/* Dev Console app-only styles — shared shell lives in /css/ui-kit/ */
:root {
  --panel-3: #222b36;
  --portal: #8b98a9;
  --front: #c084fc;
  --be: #4c9aff;
  --rgs: #3fb950;
  --bs: #f0883e;
  --warn: #d29922;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f8fa; --panel: #fff; --panel-2: #f0f3f6; --panel-3: #e7ecf1;
    --line: #d8dee4; --ink: #1f2328; --ink-dim: #57606a; --ink-faint: #8c959f;
  }
}

[hidden] { display: none !important; }
.view { display: block; }
.view[hidden] { display: none; }

.flow-track-switch { display: inline-flex; align-items: center; gap: 10px;
                     font-size: 12px; color: var(--ink-dim); cursor: pointer; user-select: none; flex: none; }
.flow-track-label { white-space: nowrap; }
.flow-track-switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px;
                           background: var(--line); border: 1px solid color-mix(in srgb, var(--line) 70%, var(--ink-faint));
                           position: relative; cursor: pointer; flex: none; transition: background .15s; }
.flow-track-switch input::before { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
                                   border-radius: 50%; background: var(--ink); transition: transform .15s, background .15s; }
.flow-track-switch input:checked { background: color-mix(in srgb, var(--accent) 50%, var(--line));
                                   border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.flow-track-switch input:checked::before { transform: translateX(16px); background: #fff; }
html[data-app="flow"]:not(.flow-tracking-on) #card-flow-track .flow-wrap,
html[data-app="flow"]:not(.flow-tracking-on) #card-flow-track .flow-side { opacity: .42; pointer-events: none; }
html[data-app="flow"]:not(.flow-tracking-on) #card-flow-track .flow-controls .toggle,
html[data-app="flow"]:not(.flow-tracking-on) #card-flow-track .flow-controls #btn-clear { pointer-events: none; opacity: .5; }
html[data-app="flow"]:not(.flow-tracking-on) .scenarios .btn { opacity: .45; pointer-events: none; }

main.page { padding: 16px; }

.step-no { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
           background: var(--panel-3); color: var(--ink-dim); font-size: 11px; font-weight: 700; }
.card.done > h2 .step-no { background: var(--ok); color: #06230f; }

.row { display: flex; gap: 8px; align-items: center; }
.row + .row { margin-top: 10px; }
label.small { font-size: 12px; color: var(--ink-dim); min-width: 68px; }
.prices { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2);
        color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 18%, transparent); }
/* ---------------------------------------------------------- tokens & player */
.chain { display: grid; gap: 0; }
.chain-step { display: grid; grid-template-columns: 20px 1fr; gap: 10px; }
.chain-step .gutter { display: grid; place-items: start center; position: relative; }
.chain-step .gutter i { width: 9px; height: 9px; border-radius: 50%; background: var(--panel-3); border: 2px solid var(--line); margin-top: 5px; }
.chain-step .gutter::after { content: ''; position: absolute; top: 16px; bottom: -6px; width: 1px; background: var(--line); }
.chain-step:last-child .gutter::after { display: none; }
.chain-step.filled .gutter i { background: var(--ok); border-color: var(--ok); }
.chain-body { padding-bottom: 12px; min-width: 0; }
.chain-body .who { font-size: 11px; color: var(--ink-faint); }
.chain-body .what { font-size: 12.5px; }
.chain-body .val { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); word-break: break-all;
                   background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; margin-top: 3px; display: block; }
.owner { font-size: 10px; padding: 1px 6px; border-radius: 999px; border: 1px solid currentColor; margin-left: 6px; vertical-align: 1px; }
.owner.bs { color: var(--bs); } .owner.rgs { color: var(--rgs); } .owner.fr { color: var(--front); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12px; align-items: baseline; }
.kv dt { color: var(--ink-faint); white-space: nowrap; }
.kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }
.note { font-size: 11px; color: var(--ink-faint); margin: 10px 0 0; line-height: 1.5; }

/* --------------------------------------------------------------- tickets */
.tickets { display: grid; gap: 10px; margin-top: 14px; }
.ticket { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--panel-2); animation: pop .25s ease both; }
.ticket.win { border-color: var(--ok); }
.ticket.jackpot { border-color: var(--warn); }
.ticket-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ticket-head .id { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.cells { display: flex; gap: 6px; margin: 8px 0 6px; }
.cell { flex: 1; aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; background: var(--bg);
        border: 1px solid var(--line); font-weight: 700; font-size: 17px; }
.cell.hidden { color: transparent; background: linear-gradient(135deg, var(--line), var(--panel-2)); }
.cell.reveal { animation: flip .35s ease both; }
.award { font-variant-numeric: tabular-nums; font-weight: 600; }
.award.zero { color: var(--ink-faint); font-weight: 400; } .award.win { color: var(--ok); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); color: var(--ink-dim); }
.badge.jackpot { border-color: var(--warn); color: var(--warn); }
.notice { margin-top: 12px; padding: 9px 11px; border-radius: 8px; font-size: 13px; }
.notice.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.notice.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }

/* ------------------------------------------------------------------ flow */
.flow-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-dim);
          background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); }
.toggle i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.toggle[aria-pressed="true"] i { background: var(--accent); }
.flow-total { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }

.flow-wrap { position: relative; padding: 0 14px 16px; overflow-x: auto; }
.lanes-head { position: sticky; top: 0; z-index: 4; background: var(--panel); display: grid;
              grid-template-columns: 40px repeat(5, 1fr); padding: 10px 0 9px;
              border-bottom: 1px solid var(--line); min-width: 940px; }
.lane-title { text-align: center; font-size: 12px; font-weight: 600; }
.lane-title small { display: block; font-weight: 400; font-size: 10px; color: var(--ink-faint); font-family: var(--mono); }
.l1 { color: var(--portal); } .l2 { color: var(--front); } .l3 { color: var(--be); } .l4 { color: var(--rgs); } .l5 { color: var(--bs); }
.c-portal { color: var(--portal); } .c-front { color: var(--front); } .c-be { color: var(--be); }
.c-rgs { color: var(--rgs); } .c-bs { color: var(--bs); }

.flow { position: relative; min-width: 940px; padding-top: 10px; }
.rails { position: absolute; inset: 0; display: grid; grid-template-columns: 40px repeat(5, 1fr); pointer-events: none; }
.rail { display: grid; place-items: center; }
.rail i { display: block; width: 1px; height: 100%; background: var(--line); }

.phase { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 0; margin: 18px 0 10px; position: relative; }
.phase .ph-body { display: flex; align-items: center; gap: 10px; }
.phase span { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-dim);
              background: var(--panel); padding-right: 8px; }
.phase b { font-family: var(--mono); font-size: 10px; font-weight: 400; color: var(--ink-faint); background: var(--panel); padding: 0 8px; }
.phase i { flex: 1; height: 1px; background: var(--line); }

/* One exchange = a numbered step holding a request card and, below it, the reply. */
.ex { display: grid; grid-template-columns: 40px repeat(5, 1fr); align-items: start;
      padding: 5px 0 7px; border-radius: 10px; animation: slide .26s ease both; }
.ex:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.ex-seq { grid-column: 1; grid-row: 1 / span 2; display: grid; place-items: start center; padding-top: 7px; }
.ex-seq b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
            background: var(--panel-2); border: 1px solid var(--line);
            font: 600 10.5px/1 var(--mono); color: var(--ink-faint); }
.ex.active .ex-seq b { border-color: var(--accent); color: var(--ink); }

.hop { position: relative; padding-bottom: 13px; }
.hop.reply { padding-bottom: 15px; }
/* The wire runs rail-centre to rail-centre; --pad is half a lane width. */
.wire { position: absolute; left: var(--pad); right: var(--pad); bottom: 5px; height: 2px;
        background: currentColor; opacity: .5; border-radius: 2px; }
.wire.dashed { background: repeating-linear-gradient(90deg, currentColor 0 5px, transparent 5px 10px); opacity: .45; }
.wire::after { content: ''; position: absolute; top: -3px; width: 0; height: 0;
               border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.wire.to-right::after { right: -1px; border-left: 7px solid currentColor; }
.wire.to-left::after { left: -1px; border-right: 7px solid currentColor; }
.pin { position: absolute; bottom: 2px; width: 8px; height: 8px; border-radius: 50%;
       background: var(--panel); border: 2px solid currentColor; }
.pin.a { left: calc(var(--pad) - 4px); } .pin.b { right: calc(var(--pad) - 4px); }

.card2 { position: relative; z-index: 1; margin: 0 auto; max-width: 470px; border-radius: 9px;
         border: 1px solid var(--line); background: var(--panel-2); padding: 6px 10px 7px; cursor: pointer; transition: .12s; }
.card2:hover { border-color: var(--accent); }
.card2.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card2.reply { max-width: 380px; background: color-mix(in srgb, var(--panel-3) 55%, transparent); padding: 5px 10px 6px; }
.card2.reply.failed { background: color-mix(in srgb, var(--bad) 13%, var(--panel-2)); border-color: color-mix(in srgb, var(--bad) 48%, var(--line)); }
.card2.signal { background: transparent; border-style: dashed; max-width: 340px; }

.c-head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.c-head .op { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card2.reply .c-head .op { font-size: 11.5px; font-weight: 500; }
.c-head .ms { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); flex: none; }
.prefix { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .04em; padding: 1.5px 5px;
          border-radius: 4px; flex: none; background: color-mix(in srgb, currentColor 16%, transparent); }
.px-PURC, .px-VOID { color: var(--bs); } .px-CRED, .px-LOSE { color: var(--ok); }
.px-AUTH, .px-VALI, .px-CONF { color: var(--front); } .px-BALA, .px-NOTY, .px-ENDS { color: var(--be); }
.verdict { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .05em;
           padding: 1.5px 5px; border-radius: 4px; flex: none; }
.verdict.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.verdict.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, transparent); }
.money { font-family: var(--mono); font-size: 11px; font-weight: 700; flex: none; }
.money.down { color: var(--bs); } .money.up { color: var(--ok); }
.c-path { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); margin-top: 2px;
          white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
.c-fields { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 2px 9px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); }
.c-fields span { white-space: nowrap; }
.c-fields b { font-weight: 400; color: var(--ink-faint); }
.flow.lean .c-path, .flow.lean .c-fields { display: none; }

.flow-empty { padding: 46px 16px; text-align: center; color: var(--ink-faint); }
.flow-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-faint); }
.flow-legend b { font-weight: 500; color: var(--ink-dim); }

/* The store operations one exchange caused, parked in the Our RGS lane. */
.dbrow { padding-top: 0; }
.dbops { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 6px 6px; }
.dbop { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 7px;
        border-radius: 6px; border: 1px dashed color-mix(in srgb, var(--rgs) 45%, var(--line));
        background: color-mix(in srgb, var(--rgs) 8%, transparent);
        font-family: var(--mono); font-size: 10px; color: var(--ink-dim); }
.dbop.read { border-style: dotted; opacity: .72; }
.dbop .verb { font-weight: 700; letter-spacing: .04em; color: var(--rgs); }
.dbop.read .verb { color: var(--ink-faint); }
.dbop .tbl { color: var(--ink); }
.dbop .rowid { color: var(--ink-faint); }
.dbop .det { color: var(--ink-faint); }
.flow.lean .dbop .det { display: none; }

/* ----------------------------------------------------------------- debug */
.debug { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.debug > h2 { color: var(--warn); }
.force-row { display: flex; gap: 6px; flex-wrap: wrap; }
.force { flex: 1; min-width: 74px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
         background: var(--panel-2); color: var(--ink-dim); font-size: 12px; font-weight: 600; }
.force:hover:not(:disabled) { border-color: currentColor; }
.force[aria-pressed="true"] { background: color-mix(in srgb, currentColor 18%, transparent); color: var(--ink); }
.force.f-loss[aria-pressed="true"] { border-color: var(--bad); color: var(--bad); }
.force.f-win[aria-pressed="true"] { border-color: var(--ok); color: var(--ok); }
.force.f-jackpot[aria-pressed="true"] { border-color: var(--warn); color: var(--warn); }
.armed { margin-top: 10px; font-size: 12px; padding: 7px 10px; border-radius: 8px;
         background: color-mix(in srgb, var(--warn) 13%, transparent);
         border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.forced-tag { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 999px;
              color: var(--warn); border: 1px solid var(--warn); }

/* ----------------------------------------------------------------- stats */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.kpi { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; }
.kpi dt { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); white-space: nowrap; }
.kpi dd { margin: 2px 0 0; font: 600 15px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.kpi dd small { font-size: 10px; font-weight: 400; color: var(--ink-faint); }
.kpi.good dd { color: var(--ok); } .kpi.bad dd { color: var(--bad); } .kpi.warn dd { color: var(--warn); }
.stats-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
select { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); border-radius: 8px;
         padding: 5px 8px; font: inherit; font-size: 12.5px; max-width: 220px; }
.stats-meta { font-size: 11px; color: var(--ink-faint); margin-top: 10px; }
.evt { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
       padding: 1.5px 5px; border-radius: 4px; background: color-mix(in srgb, currentColor 15%, transparent); }
.evt.g-launch { color: var(--portal); } .evt.g-session { color: var(--front); }
.evt.g-play { color: var(--be); } .evt.g-native { color: var(--bs); }
.evt.g-money { color: var(--ok); } .evt.g-fail { color: var(--bad); }
tr.clickable { cursor: pointer; } tr.clickable:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
tr.sel-row { background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* boundary views: .views/.vtab from ui-kit */
.view[hidden] { display: none; }
.boundary { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
            padding: 9px 13px; margin-bottom: 14px; border-radius: 10px;
            border: 1px dashed var(--line); background: var(--panel);
            font-size: 11.5px; color: var(--ink-faint); }
.boundary b { color: var(--ink); font-size: 13px; }
.boundary code { font-size: 11px; }
.boundary .sep::before { content: '·'; margin-right: 8px; color: var(--line); }
.b-portal { border-color: color-mix(in srgb, var(--front) 45%, var(--line)); }
.b-be { border-color: color-mix(in srgb, var(--be) 45%, var(--line)); }
.b-bs { border-color: color-mix(in srgb, var(--bs) 45%, var(--line)); }
.act { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 10.5px; font-family: var(--mono);
       border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-dim); }
.act-RETRY_SAME_KEY { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.act-RECONCILE { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.act-RELAUNCH { color: var(--front); border-color: color-mix(in srgb, var(--front) 45%, var(--line)); }
.act-SHOW_PLAYER { color: var(--ink-dim); }
.act-ACCEPTED { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.attempts { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.attempt { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 6px;
           border: 1px solid var(--line); background: var(--panel-2); }
.attempt.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); color: var(--ok); }
.b-rgs { border-color: color-mix(in srgb, var(--rgs) 45%, var(--line)); }
.b-ops { border-color: color-mix(in srgb, var(--portal) 45%, var(--line)); }
.b-flow { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.view[data-view="flow"] > * + * { margin-top: 16px; }
.cols { display: grid; grid-template-columns: minmax(280px, 340px) 1fr; gap: 16px; align-items: stretch; width: 100%; }
.flow-top .col-side > .card,
.flow-top .col-main > .card { margin-top: 0; }
.flow-top .col-main, #card-players { display: flex; flex-direction: column; min-height: 100%; }
.flow-top .col-main > .card { flex: 1; }
#card-players .card-body { flex: 1; display: flex; min-height: 8rem; }
.seats-board { align-items: start; }
#card-players h2 .btn { margin-left: auto; }
.launch-actions { margin-top: 12px; }
.launch-actions .btn.primary { width: auto; }
.flow-scenarios { padding: 12px 14px 4px; }
.flow-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: start; }
.flow-side { padding: 10px 14px 14px; border-left: 1px solid var(--line); min-width: 0; }
.flow-side h2, .flow-side h3 { margin: 0 0 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); font-weight: 600; }
.flow-side .chain-body { padding-bottom: 6px; }
.flow-player-data { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12px; align-items: baseline; }
.kv dt { color: var(--ink-faint); white-space: nowrap; }
.kv dd { margin: 0; font-family: var(--mono); word-break: break-all; font-size: 11px; }
.flow-pd dd .owner { font-size: 10px; margin-left: 6px; vertical-align: 1px; }
@media (max-width: 1100px) {
  .flow-body { grid-template-columns: 1fr; }
  .flow-side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.col-side, .col-main { display: grid; gap: 16px; align-content: start; }

/* Each seat is drawn as a little browser, because that is what it is: a separate
   document on a separate boundary, loaded from a URL somebody else handed us. The
   chrome is not decoration — the URL bar is the evidence. */
.seats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
         flex: 1; min-height: 0; width: 100%; align-content: start; }
.seats:has(.seats-empty) { display: flex; grid-template-columns: none; }
.seat { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg);
        display: flex; flex-direction: column; min-height: 0; transition: border-color .12s; }
.seat.is-live { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.seat-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel);
             border-bottom: 1px solid var(--line); flex: none; min-width: 0; }
.seat-head .who { flex: 1; min-width: 0; color: var(--ink); font-size: 13px; font-weight: 600;
                  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-head .state { flex: none; max-width: 58%; font-size: 10px; color: var(--ink-dim);
                    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.seat.is-playing .state { color: var(--accent); }
.seat.is-waiting .state { color: color-mix(in srgb, var(--warn) 85%, var(--ink)); }
.seat-kv .si-activity { color: var(--ink-dim); font-size: 10px; line-height: 1.35; }
.seat-head .seat-close { flex: none; }
.seat-preview { position: relative; flex: none; width: 100%; aspect-ratio: 4 / 3; min-height: 120px;
                max-height: 180px; background: #000; border-bottom: 1px solid var(--line); overflow: hidden; }
.seat-info { padding: 10px 12px 12px; flex: 1; min-width: 0; }
.seat-kv { gap: 6px 10px; }
.seat-kv dd { font-size: 11px; }
.seat-kv .si-token,
.seat-kv .si-game { font-family: var(--mono); }
.seat-cheat { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px;
              padding: 8px 10px 10px; border-top: 1px solid var(--line); background: var(--panel); }
.seat-cheat .btn { padding: 2px 8px; font-size: 11px; }
.seat-auto-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-dim); }
.seat-auto-toggle input { width: auto; accent-color: var(--accent); }
.seat-auto-ms { width: 4.2rem; font-family: var(--mono); font-size: 10px; padding: 3px 5px; }
.seat-auto-ms-label { font-size: 10px; color: var(--ink-faint); }
.seat.is-auto { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
#seat-dock { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.seat-viewport { position: fixed; overflow: hidden; background: var(--bg); pointer-events: none; }
.seat-viewport.is-tile { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.seat-viewport .seat-frame { display: block; width: 100%; height: 100%; border: 0; }
.seat-chrome { display: flex; align-items: center; gap: 7px; padding: 5px 8px;
               background: var(--panel-2); border-bottom: 1px solid var(--line); flex: none; }
.lights { display: flex; gap: 4px; flex: none; }
.lights i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.lights i:nth-child(1) { background: color-mix(in srgb, var(--bad) 70%, var(--line)); }
.lights i:nth-child(2) { background: color-mix(in srgb, var(--warn) 70%, var(--line)); }
.lights i:nth-child(3) { background: color-mix(in srgb, var(--ok) 70%, var(--line)); }
.seat-url { flex: 1; min-width: 0; font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
            background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
            padding: 3px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-chrome .btn { padding: 1px 7px; font-size: 11px; border-radius: 6px; }
.seat-meta { display: flex; align-items: center; gap: 8px; padding: 4px 9px; font-size: 11px;
             color: var(--ink-faint); border-bottom: 1px solid var(--line); background: var(--panel); flex: none; }
.seat-meta b { color: var(--ink); }
.seat-meta .ch { font-family: var(--mono); }
.seat-meta .money { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); }
.seats-empty { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%;
               min-height: 12rem; padding: 26px 18px; text-align: center; color: var(--ink-faint); font-size: 14px; }
.seats-empty code { color: var(--ink-dim); }

.player-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pd-field { display: grid; gap: 4px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.pd-k { color: var(--ink-faint); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.pd-v { display: flex; align-items: center; gap: 8px; min-width: 0; font-family: var(--mono); font-size: 12.5px; }
.pd-v .owner { flex: none; margin: 0; white-space: nowrap; }
.scenarios { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.scenarios .btn { width: 100%; min-height: 2.6rem; padding: 10px 12px; font-size: 13px; white-space: normal; }
@media (max-width: 1100px) {
  .player-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scenarios { grid-template-columns: 1fr 1fr; }
}
.fault-row { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px;
             padding: 5px 0; border-bottom: 1px solid var(--line); }
.fault-row:last-child { border-bottom: none; }
.fault-row .op { color: var(--warn); }
.fault-row .btn { margin-left: auto; padding: 2px 8px; font-size: 11px; }

.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { border: none; background: none; color: var(--ink-dim); padding: 9px 12px; border-bottom: 2px solid transparent; font-size: 13px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabpanel { padding: 12px 14px; max-height: 360px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink-faint); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
td.mono, th.mono { font-family: var(--mono); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.leg-debit { color: var(--bs); } .leg-credit { color: var(--ok); }
.st-VOIDED { color: var(--warn); } .st-FAILURE, .st-REJECTED { color: var(--bad); }
pre { margin: 0; font-family: var(--mono); font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--ink-dim); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.split h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); }
/* ------------------------------------------------------------- inspector modal
   Clicking a block opens the exchange in a dialog rather than a side panel: the
   payloads and the headers are the detail view, and they deserve the width. */
.ins-backdrop { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, #000 62%, transparent);
                display: flex; align-items: center; justify-content: center; padding: 24px;
                animation: fade .12s ease-out; }
/* `display: flex` above outranks the user agent's `[hidden] { display: none }`, so the
   attribute the JS toggles needs saying again here or the dialog is always on screen. */
.ins-backdrop[hidden] { display: none; }
.ins { width: min(1040px, 100%); max-height: 88vh; display: flex; flex-direction: column;
       background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
       box-shadow: 0 24px 64px rgba(0,0,0,.45); animation: pop .14s ease-out; overflow: hidden; }
.ins:focus { outline: none; }
.ins-head { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.ins-title-row { display: flex; align-items: center; gap: 8px; }
.ins-title-row h3 { margin: 0; font-size: 14px; font-weight: 600; }
.ins-x { margin-left: auto; padding: 4px 10px; font-size: 15px; line-height: 1; }
.ins-sub { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center;
           font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
.ins-sub .ok { color: var(--ok); } .ins-sub .bad { color: var(--bad); }
.ins-body { padding: 14px; overflow: auto; }
.ins-col { min-width: 0; }
.ins-col.focus h4:first-child { color: var(--accent); }
.ins-col.focus { border-left: 2px solid var(--accent); padding-left: 10px; margin-left: -12px; }
.ins-body h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); }
.ins-body h4:not(:first-child) { margin-top: 14px; }
.ins-body pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; max-height: 40vh; overflow: auto; }
/* JSON viewer: the payload is the point of the inspector, so it gets syntax
   colouring, folding and a copy button rather than one flat block of text. */
.jb { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.jb-tools { display: flex; align-items: center; gap: 4px; padding: 4px 6px;
            border-bottom: 1px solid var(--line); background: var(--panel-2); }
.jb-tools .btn { padding: 2px 8px; font-size: 11px; border-radius: 6px; }
.jb-size { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }
/* Headers and body are the same kind of thing — one exchange half seen two ways —
   so they get the same shell, the same padding and the same scroll behaviour. */
.jb-body { font-family: var(--mono); font-size: 11.5px; line-height: 1.6; padding: 9px 10px;
           max-height: 40vh; overflow: auto; color: var(--ink-dim); }
.json.raw { white-space: pre-wrap; word-break: break-word; }
.jb-label { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); padding-left: 2px; }
.j-row { padding-left: 14px; }
.j-key { color: var(--accent); }
.j-str { color: var(--ok); }
.j-num { color: var(--bs); font-variant-numeric: tabular-nums; }
.j-bool { color: var(--warn); }
.j-null { color: var(--ink-faint); font-style: italic; }
.j-punct { color: var(--ink-faint); }
.j-count { color: var(--ink-faint); font-style: italic; }
/* Native folding: no state to keep, and it works from the keyboard. */
.json details { margin: 0; }
.json summary { cursor: pointer; list-style: none; }
.json summary::-webkit-details-marker { display: none; }
.json summary::before { content: '\25be'; display: inline-block; width: 12px; color: var(--ink-faint); }
.json details:not([open]) > summary::before { content: '\25b8'; }
.json details:not([open]) > summary .j-count { color: var(--ink-dim); }
.json summary:hover { color: var(--ink); }
.json summary:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.hdrs { font-size: 11px; }
.hdrs th, .hdrs td { border-bottom: none; padding: 1px 8px 1px 0; }
/* A header name is a name, like a JSON key — colour them the same way. */
.hdrs th { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--accent);
           white-space: nowrap; vertical-align: top; width: 1%; }
.hdrs td { color: var(--ink); white-space: pre-wrap; word-break: break-all; }
.hdrs .redacted { color: var(--warn); }
.ins-empty { margin: 0; color: var(--ink-faint); font-size: 11.5px; }
.ins-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
            border-top: 1px solid var(--line); background: var(--panel-2); }
.ins-pos { margin: 0 auto; font-size: 11.5px; color: var(--ink-faint); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) { .ins-col.focus { border-left: none; padding-left: 0; margin-left: 0; } }

.bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }

@keyframes slide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes flip { from { transform: rotateX(90deg); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
