/* ══════════════════════════════════════════════════════════════
   THE ORDER DESCENT · v4 — panel layout (restored), no title bar
   Three source cards feed a central spine; six station cards
   alternate left/right of it; the order token descends the spine,
   always hugging the side OPPOSITE the active card so it can
   never block a stage name. Lands in the settlement tray.
   ══════════════════════════════════════════════════════════════ */

.rx{
  position:relative;width:100%;max-width:490px;margin:0 auto;
  border-radius:16px;padding:14px 14px 12px;
  background:linear-gradient(165deg,var(--panel-2),var(--panel));
  border:1px solid var(--line-strong);
  box-shadow:0 40px 90px -44px rgba(0,0,0,.92),inset 0 1px 0 rgba(255,255,255,.04);
  font-variant-numeric:tabular-nums;
  -webkit-user-select:none;user-select:none
}
html[data-theme="light"] .rx{
  box-shadow:0 40px 90px -50px rgba(15,45,38,.45),inset 0 1px 0 rgba(255,255,255,.85)
}

/* ── source cards ──────────────────────────────────────────── */
.rx-src{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;margin-bottom:12px}
.rx-s{
  border-radius:10px;padding:8px 6px;text-align:center;
  background:linear-gradient(160deg,var(--panel-2),var(--panel));
  border:1px solid var(--line);
  transition:border-color .5s ease,box-shadow .5s ease
}
.rx-s .sn{
  font-family:'Geist',system-ui,sans-serif;font-size:10.5px;font-weight:700;
  color:var(--text);letter-spacing:-.01em;transition:color .5s ease
}
.rx-s .sd{font-size:7.5px;color:var(--muted-2);margin-top:2px;letter-spacing:.04em}
.rx-s.ping{border-color:rgba(139,139,255,.55);box-shadow:0 0 18px -4px rgba(139,139,255,.45)}
.rx-s.ping .sn{color:#a5a5ff}

/* ── the lane: central spine + station rows ────────────────── */
.rx-lane{position:relative;padding:4px 0 8px}
.rx-lane::before{
  content:'';position:absolute;left:50%;top:0;bottom:0;width:1px;
  transform:translateX(-.5px);
  background:linear-gradient(180deg,rgba(139,139,255,.4),rgba(61,240,179,.4))
}

/* ambient dots trickling down the spine */
.rx-drip{
  position:absolute;left:50%;top:0;width:4px;height:4px;border-radius:50%;
  transform:translate(-50%,-50%);
  background:#8b8bff;opacity:0;
  box-shadow:0 0 8px rgba(139,139,255,.7);
  animation:rxDrip linear infinite
}
@keyframes rxDrip{
  0%{top:0;opacity:0}
  8%{opacity:.5}
  92%{opacity:.5}
  100%{top:100%;opacity:0}
}

/* station row: card | medallion | empty (alternating) */
.rx-st{
  position:relative;display:grid;grid-template-columns:1fr 44px 1fr;
  align-items:center;padding:5px 0
}
.rx-st .med{
  grid-column:2;grid-row:1;justify-self:center;z-index:2;
  width:24px;height:24px;border-radius:50%;
  display:grid;place-items:center;color:var(--muted-2);
  background:var(--bg);border:1px solid var(--line);
  box-shadow:0 0 0 4px var(--bg);
  transition:color .5s,border-color .5s,box-shadow .5s
}
.rx-st .med svg{width:12px;height:12px}
.rx-st.active .med{
  color:#8b8bff;border-color:rgba(139,139,255,.7);
  box-shadow:0 0 0 4px var(--bg),0 0 18px rgba(139,139,255,.5)
}
.rx-st.done .med{color:#3df0b3;border-color:rgba(61,240,179,.55)}

.rx-st .card{
  grid-row:1;border-radius:10px;padding:8px 11px;max-width:100%;
  background:linear-gradient(160deg,var(--panel-2),var(--panel));
  border:1px solid var(--line);
  box-shadow:0 14px 30px -22px rgba(0,0,0,.9);
  opacity:.55;
  transition:opacity .5s ease,border-color .5s ease,box-shadow .5s ease
}
/* nth-of-type, not nth-child: the drip <span>s share the lane,
   so nth-child would miscount and flip the card sides.         */
.rx-st:nth-of-type(odd)  .card{grid-column:1;justify-self:end;text-align:right}
.rx-st:nth-of-type(even) .card{grid-column:3;justify-self:start;text-align:left}
.rx-st.active .card{
  opacity:1;border-color:rgba(139,139,255,.55);
  box-shadow:0 14px 34px -20px rgba(0,0,0,.9),0 0 22px -6px rgba(139,139,255,.4)
}
.rx-st.done .card{opacity:.85;border-color:rgba(61,240,179,.35)}

.rx-st .card .t{
  font-family:'Geist',system-ui,sans-serif;font-size:11.5px;font-weight:600;
  color:var(--text);letter-spacing:-.015em;line-height:1.2
}
.rx-st .card .s{font-size:8.5px;color:var(--muted-2);margin-top:1px;letter-spacing:.03em}

/* chips inside the card */
.rx-st .chips{display:flex;gap:3px;margin-top:4px;flex-wrap:wrap}
.rx-st:nth-of-type(odd) .chips{justify-content:flex-end}
.rx-st .chips i{
  font-style:normal;font-size:7px;font-weight:700;letter-spacing:.04em;
  padding:1.5px 5px;border-radius:999px;white-space:nowrap;
  color:var(--muted-2);border:1px solid var(--line);
  opacity:0;transform:translateY(3px);
  transition:opacity .4s ease,transform .4s ease,color .4s,border-color .4s
}
.rx-st.active .chips i,.rx-st.done .chips i{opacity:1;transform:none}
.rx-st.active .chips i{color:#a5a5ff;border-color:rgba(139,139,255,.45)}
.rx-st.done   .chips i{color:#3df0b3;border-color:rgba(61,240,179,.4)}
.rx-st .chips i:nth-child(1){transition-delay:.05s}
.rx-st .chips i:nth-child(2){transition-delay:.2s}
.rx-st .chips i:nth-child(3){transition-delay:.35s}
.rx-st .chips i:nth-child(4){transition-delay:.5s}

/* ── the travelling order token ────────────────────────────── */
/* Hugs the side OPPOSITE the active card (JS toggles sl/sr) so
   it can never sit on top of a stage name.                     */
.rx-tok{
  position:absolute;left:50%;z-index:3;transform:translate(-50%,-50%);
  display:flex;align-items:center;gap:6px;
  border-radius:999px;padding:5px 10px;white-space:nowrap;
  background:linear-gradient(155deg,rgba(24,30,40,.97),rgba(12,16,22,.97));
  border:1px solid rgba(139,139,255,.55);
  box-shadow:0 10px 30px -8px rgba(0,0,0,.8),0 0 22px -4px rgba(139,139,255,.5);
  opacity:0;
  transition:transform .45s cubic-bezier(.32,.72,0,1)
}
.rx-tok.sl{transform:translate(calc(-100% - 18px),-50%)}
.rx-tok.sr{transform:translate(18px,-50%)}
html[data-theme="light"] .rx-tok{
  background:linear-gradient(155deg,#fff,#f2f5f4);
  box-shadow:0 10px 30px -12px rgba(15,45,38,.5),0 0 22px -6px rgba(139,139,255,.5)
}
.rx-tok .b{
  font-family:'Geist',system-ui,sans-serif;font-size:7.5px;font-weight:800;letter-spacing:.06em;
  padding:1.5px 5px;border-radius:999px;
  color:#8b8bff;background:rgba(139,139,255,.14);border:1px solid rgba(139,139,255,.4);
  transition:color .4s,background .4s,border-color .4s
}
.rx-tok .l{font-size:9px;font-weight:600;color:var(--text);letter-spacing:-.005em}
.rx-tok.fin{border-color:rgba(61,240,179,.6);box-shadow:0 10px 30px -8px rgba(0,0,0,.8),0 0 22px -4px rgba(61,240,179,.55)}
.rx-tok.fin .b{color:#3df0b3;background:rgba(61,240,179,.14);border-color:rgba(61,240,179,.45)}

/* ── settlement tray ───────────────────────────────────────── */
.rx-tray{
  display:flex;align-items:center;gap:9px;margin-top:11px;
  border-radius:10px;padding:8px 12px;
  background:linear-gradient(160deg,rgba(61,240,179,.06),transparent);
  border:1px solid rgba(61,240,179,.3);
  transition:border-color .4s ease,box-shadow .4s ease
}
.rx-tray.land{border-color:rgba(61,240,179,.65);box-shadow:0 0 26px -8px rgba(61,240,179,.5)}
.rx-tray .ti{
  width:20px;height:20px;border-radius:50%;flex-shrink:0;
  display:grid;place-items:center;color:#04241a;
  background:linear-gradient(140deg,#3df0b3,#10b981)
}
.rx-tray .ti svg{width:11px;height:11px}
.rx-tray .tl{
  font-size:8.5px;font-weight:700;letter-spacing:.13em;color:var(--muted-2);
  text-transform:uppercase
}
.rx-tray .tv{
  margin-left:auto;
  font-family:'Geist',system-ui,sans-serif;font-size:18px;font-weight:700;
  letter-spacing:-.035em;color:#3df0b3;line-height:1
}

/* ── responsive ────────────────────────────────────────────── */
@media(max-width:1080px){.rx{max-width:440px}}
@media(max-width:620px){
  .rx{padding:14px 12px 12px}
  .rx-s .sd{display:none}
  .rx-st .card .s{display:none}
  .rx-st .card .t{font-size:11.5px}
  .rx-tok .l{display:none}
}
@media(prefers-reduced-motion:reduce){
  .rx-drip{animation:none}
  .rx-tok,.rx-st .card,.rx-st .med,.rx-s{transition:none}
}
