:root {
  --paper: #F5F2EA;
  --paper-2: #ECE7DB;
  --ink: #16150F;
  --ink-2: #5B574C;
  --rule: #D8D1C2;
  --leak: #D9431E;
  --tile: #A8A294;
  --display: "Instrument Serif", "Fraunces", Georgia, serif;
  --ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --cols: 25;
  --gap: 3px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: var(--ink); text-underline-offset: 2px; }
.fig, .counter-v, .lane-t, .q-amt, .math, .runs td, .score-v { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.fine { color: var(--ink-2); font-size: 12px; margin: 12px 0 0; }

/* ------------------------------------------------ chrome */
.topbar {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 14px 28px; border-bottom: 1px solid var(--rule);
}
.brand { font: 600 13px var(--ui); letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 10px; height: 10px; background: var(--ink); display: inline-block; }
.topbar-note { color: var(--ink-2); font-size: 12px; }
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 18px 28px 28px; border-top: 1px solid var(--rule); font-size: 12px;
}
body.embed .chrome { display: none; }

/* ------------------------------------------------ layout */
.app {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px;
  max-width: 1280px; margin: 0 auto; padding: 24px 28px 32px;
}
.stage { min-width: 0; }
.headline {
  font: 400 clamp(30px, 3.1vw, 42px)/1.06 var(--display);
  letter-spacing: -.01em; margin: 0 0 18px; max-width: 18em;
}
.headline .fig { font-family: var(--display); font-variant-numeric: lining-nums; }
.headline { margin-bottom: 10px; }
.lede { font-size: 16px; line-height: 1.45; margin: 0 0 16px; max-width: 40em; }
.lede b { font-weight: 600; }
.btn-sub { font-family: var(--mono); font-weight: 400; opacity: .7; margin-left: 4px; font-size: 12px; }
.caption .grade { color: var(--ink); font-weight: 500; }

.actionbar { display: grid; }
.state { grid-area: 1 / 1; opacity: 0; pointer-events: none; visibility: hidden; transition: opacity .25s, visibility 0s .25s; }
body[data-phase="cold"] .state-cold,
body[data-phase="play"] .state-play,
body[data-phase="done"] .state-done { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity .25s; }
.btnrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.caption { margin: 8px 0 0; font-size: 12px; color: var(--ink-2); }

.btn {
  appearance: none; border: 1px solid var(--ink); background: transparent; border-radius: 2px;
  padding: 8px 14px; font-weight: 500; font-size: 13px; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: var(--paper-2); }
.btn:focus-visible, .tab:focus-visible, .seg-b:focus-visible, .tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #2b2a22; }
.btn-ghost { border-color: var(--rule); }
.btn-icon { width: 36px; height: 34px; padding: 0; display: inline-grid; place-items: center; }
.ico-pause { width: 10px; height: 12px; border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); }
.ico-play { width: 0; height: 0; border-left: 10px solid var(--ink); border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 2px; }
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: 2px; }
.seg-b { appearance: none; border: 0; background: transparent; padding: 8px 10px; font: 500 12px var(--mono); cursor: pointer; }
.seg-b.is-on { background: var(--ink); color: var(--paper); }
.progress { flex: 1 1 120px; min-width: 80px; height: 2px; background: var(--rule); position: relative; overflow: hidden; }
.progress-fill { position: absolute; inset: 0; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); }

/* counters */
.counters { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 6px 0 16px; }
.counter { padding: 10px 0; }
.counter + .counter { border-left: 1px solid var(--rule); padding-left: 16px; }
.counter-k { font-size: 12px; color: var(--ink-2); }
.counter-v { font-size: 26px; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.counter-v .unit { font-size: 14px; color: var(--ink-2); margin-left: 2px; }
.counter-s { font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.counter-leak .counter-v { color: var(--leak); }
.counter-k .lbl-short { display: none; }
.counter-leak .counter-k::before { content: "$ "; color: var(--leak); font-family: var(--mono); }
.counter-risk .counter-k::before { content: "! "; font-family: var(--mono); }

/* ------------------------------------------------ grid */
.gridhint { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); display: grid; }
.gridhint > span { grid-area: 1 / 1; transition: opacity .25s; }
.gridhint b { color: var(--ink); font-weight: 600; }
.gridhint .hint-done, body[data-phase="done"] .gridhint .hint-cold { opacity: 0; }
body[data-phase="done"] .gridhint .hint-done { opacity: 1; }
.grid.has-focus .tile:not(.is-focus) { opacity: .2; }
.gridwrap { position: relative; max-width: max(460px, calc((100svh - 400px) * 1.25)); }
.grid {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gap);
  contain: layout paint;
}
.tile {
  position: relative; aspect-ratio: 1; background: var(--tile); border: 0; padding: 0; border-radius: 1px;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .25s;
}
.tile > i {
  position: absolute; inset: 0; opacity: 0; transition: opacity .35s; font-style: normal;
  display: grid; place-items: center; font: 600 clamp(8px, 1.05vw, 12px)/1 var(--mono); border-radius: 1px;
}
.tile .h { background: var(--paper) repeating-linear-gradient(135deg, var(--leak) 0 1.6px, transparent 1.6px 4px); box-shadow: inset 0 0 0 1px var(--leak); }
.tile .s { background: var(--leak); color: var(--paper); }
.tile .r { background: var(--ink); color: var(--paper); }
.tile .c { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink); }
.tile .mk { opacity: 0; z-index: 2; background: transparent; }
.tile.is-cand .h, .tile.is-leak .s, .tile.is-risk .r, .tile.is-clear .c { opacity: 1; }
.tile.is-cand, .tile.is-leak, .tile.is-risk, .tile.is-clear { cursor: pointer; }
.tile.pop { transform: scale(1.18); }
.tile.is-sel { transform: scale(1.25); z-index: 3; }
@media (hover: hover) { .tile.is-cand:hover, .tile.is-leak:hover, .tile.is-risk:hover, .tile.is-clear:hover { transform: scale(1.18); z-index: 3; } }

/* answer-key markers */
.grid.show-key .tile .mk { opacity: 1; }
.mk-hit { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--ink); }
.mk-miss { outline: 1.5px dashed var(--ink); outline-offset: 2px; }
.mk-fp { color: var(--ink); font-size: clamp(12px, 1.6vw, 17px) !important; text-shadow: 0 0 2px var(--paper), 0 0 2px var(--paper); }
.mk-decoy { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--ink-2); }

.scan {
  position: absolute; left: -6px; right: -6px; top: 0; height: 2px; background: var(--ink);
  opacity: 0; transform: translateY(0); pointer-events: none;
}
.scan.go { opacity: .85; transition: transform 1.4s linear, opacity .2s; }

/* ticker (mobile) */
.ticker { display: none; }

/* legend */
.legend { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; display: inline-grid; place-items: center; font: 600 9px var(--mono); border-radius: 1px; }
.sw-base { background: var(--tile); }
.sw-cand { background: var(--paper) repeating-linear-gradient(135deg, var(--leak) 0 1.6px, transparent 1.6px 4px); box-shadow: inset 0 0 0 1px var(--leak); }
.sw-leak { background: var(--leak); color: var(--paper); }
.sw-risk { background: var(--ink); color: var(--paper); }
.sw-clear { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--ink); }
.legend-key { visibility: hidden; }
.legend-key.is-on { visibility: visible; }
.mk-demo { width: 14px; height: 14px; display: inline-grid; place-items: center; font: 600 13px var(--mono); }
.mk-demo.mk-hit, .mk-demo.mk-decoy { background: var(--tile); }
.mk-demo.mk-miss { background: var(--tile); }

/* five ways money leaks */
.types { margin-top: 26px; border-top: 1px solid var(--ink); }
.types-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.types-head .h3 { margin: 12px 0 6px; }
.types-head .fine { margin: 0; }
.typelist { list-style: none; margin: 0; padding: 0; }
.type {
  appearance: none; width: 100%; background: none; border: 0; border-top: 1px solid var(--rule); padding: 10px 6px;
  display: grid; grid-template-columns: 16px 1fr auto; gap: 12px; align-items: start; text-align: left; cursor: pointer;
}
.type:disabled { cursor: default; }
.type:not(:disabled):hover, .type.is-on { background: var(--paper-2); }
.type.is-on { box-shadow: inset 2px 0 0 var(--ink); }
.type:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.type .sw { margin-top: 2px; }
.type-txt { display: flex; flex-direction: column; min-width: 0; }
.type-n { font-weight: 600; font-size: 14px; }
.type-d { font-size: 12px; color: var(--ink-2); }
.type-v { font-size: 14px; text-align: right; white-space: nowrap; color: var(--ink-2); }
.type:not(:disabled) .type-v { color: var(--leak); }
.type[data-type="A5"]:not(:disabled) .type-v { color: var(--ink); }
.type-v small { display: block; font-size: 11px; color: var(--ink-2); }

/* ------------------------------------------------ panel */
.intro { font-size: 13px; margin: 0 0 14px; }
.intro b { font-weight: 600; }
.fine .kind, .lane-n .kind { font: 500 10px var(--mono); color: var(--ink-2); border: 1px solid var(--rule); padding: 0 4px; border-radius: 2px; vertical-align: 1px; }
.panel { border-left: 1px solid var(--rule); padding-left: 24px; min-width: 0; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); margin-bottom: 14px; }
.tab {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 8px 12px 9px 0; margin-right: 14px; font-weight: 500; font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.tab.is-on { color: var(--ink); border-bottom-color: var(--ink); }
.tab-n { font: 500 11px var(--mono); border: 1px solid var(--rule); padding: 0 5px; border-radius: 8px; margin-left: 4px; }
.tabpane { display: none; }
.tabpane.is-on { display: block; }
.tab-n:empty { display: none; }
.pending { display: none; font-size: 13px; color: var(--ink-2); border: 1px dashed var(--rule); padding: 14px; margin: 0; }
.pending b { color: var(--ink); font-weight: 600; }
body:not([data-phase="done"]) .pending { display: block; }
body:not([data-phase="done"]) .gated { display: none; }

.lanes-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.lanes-head .muted { font-family: var(--mono); text-transform: none; letter-spacing: 0; }
.lanes { list-style: none; margin: 0; padding: 0; }
.lane { border-top: 1px solid var(--rule); padding: 7px 0 8px; display: grid; grid-template-columns: 42px 1fr auto; gap: 2px 10px; align-items: baseline; }
.lane-id { font: 600 12px var(--mono); }
.lane-n { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-n .kind { margin-left: 6px; }
.lane-t { font-size: 12px; color: var(--ink-2); text-align: right; }
.lane-s { grid-column: 2 / 4; font: 12px/1.4 var(--mono); color: var(--ink-2); height: 1.4em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lane-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--ink-2); margin-right: 6px; vertical-align: 1px; }
.lane.is-run .lane-dot { background: var(--ink); border-color: var(--ink); animation: blink 1s steps(2) infinite; }
.lane.is-done .lane-dot { background: var(--ink-2); border-color: var(--ink-2); }
.lane.is-done .lane-s { color: var(--ink); }
.lane.is-run .lane-s { color: var(--ink); }
.lane-group { padding: 12px 0 4px; border-top: 1px solid var(--ink); font-size: 12px; color: var(--ink-2); line-height: 1.4; }
.lane-group b { display: block; font: 400 18px/1.2 var(--display); color: var(--ink); margin-bottom: 1px; }
.lane-group + .lane { border-top: 0; }
@keyframes blink { 50% { opacity: .25; } }

/* queue */
.meter-block { border: 1px solid var(--rule); padding: 12px; margin-bottom: 12px; background: var(--paper); }
.meter-k { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; }
.meter { height: 10px; background: var(--paper-2); margin: 8px 0 6px; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px var(--rule); }
.meter-fill { position: absolute; inset: 0; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.meter-sub { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--ink-2); flex-wrap: wrap; }
.queue-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.queue-actions .fine { margin: 0; }
.badge.conf { border-style: dashed; }
.q-second .q-name { color: var(--ink-2); }
.queue { list-style: none; margin: 0; padding: 0 6px 0 0; max-height: calc(100svh - 300px); min-height: 360px; overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid var(--rule); }
.q { border-top: 1px solid var(--rule); padding: 9px 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.q-name { font-weight: 500; font-size: 13px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; background: none; border: 0; padding: 0; text-align: left; }
.q-meta { font-size: 11px; color: var(--ink-2); }
.q-amt { font-size: 13px; text-align: right; }
.q-btns { grid-column: 1 / 3; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.q-btns .btn { padding: 5px 10px; font-size: 12px; }
.q-state { font-size: 12px; font-family: var(--mono); }
.q.is-approved .q-state { color: var(--ink); }
.q.is-rejected .q-state { color: var(--ink-2); }
.q-risk { grid-column: 1 / 3; font-size: 12px; border-left: 2px solid var(--ink); padding-left: 8px; color: var(--ink); }
.q-sec { font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); padding: 12px 0 4px; border-top: 1px solid var(--rule); list-style: none; }
.badge { font: 500 10px var(--mono); border: 1px solid var(--ink-2); padding: 1px 5px; border-radius: 2px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.badge.f-high { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.badge.f-med { border-color: var(--ink); color: var(--ink); }
.chip { font: 500 10px var(--mono); padding: 1px 5px; background: var(--paper-2); border-radius: 2px; }

/* scorecard */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: 13px; padding: 4px 0 12px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 34px; height: 18px; border: 1px solid var(--ink); border-radius: 9px; position: relative; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); transition: transform .2s; }
.switch input:checked + .switch-ui { background: var(--ink); }
.switch input:checked + .switch-ui::after { background: var(--paper); transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--ink); outline-offset: 2px; }
.scoregrid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); }
.score { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.score:nth-child(odd) { padding-right: 10px; }
.score:nth-child(even) { border-left: 1px solid var(--rule); padding-left: 12px; }
.score-k { font-size: 11px; color: var(--ink-2); }
.score-v { font-size: 20px; font-weight: 500; }
.score-s { font-size: 11px; color: var(--ink-2); font-family: var(--mono); }
.h3 { font: 400 20px/1.2 var(--display); margin: 22px 0 8px; }
.tablewrap { overflow-x: auto; }
.runs { width: 100%; border-collapse: collapse; font-size: 12px; }
.runs th, .runs td { text-align: right; padding: 5px 4px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.runs th:first-child, .runs td:first-child { text-align: left; font-family: var(--ui); }
.runs th { font-weight: 500; color: var(--ink-2); }
.bullets { margin: 0; padding-left: 18px; font-size: 13px; }
.bullets li { margin: 4px 0; }
.misses li { font-size: 12px; }
.misses .fig { font-size: 11px; }
.prose { font-size: 13px; margin: 0; }

/* ------------------------------------------------ drawer */
.drawer { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(22, 21, 15, .28); opacity: 0; transition: opacity .25s; }
.drawer-sheet {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(500px, 100vw); background: var(--paper);
  border-left: 1px solid var(--ink); overflow-y: auto; overscroll-behavior: contain; padding: 22px 24px 28px;
  transform: translateX(100%); transition: transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s .32s; outline: none;
  visibility: hidden;
}
.drawer.is-open { pointer-events: auto; }
.drawer.is-open .drawer-scrim { opacity: 1; }
.drawer.is-open .drawer-sheet { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.2, .8, .2, 1); }
.drawer-x { position: absolute; top: 10px; right: 12px; width: 34px; height: 34px; border: 1px solid var(--rule); background: var(--paper); font-size: 20px; line-height: 1; cursor: pointer; border-radius: 2px; }
.d-eyebrow { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); padding-right: 40px; }
.d-title { font: 400 28px/1.1 var(--display); margin: 4px 40px 4px 0; }
.d-sub { font-size: 12px; color: var(--ink-2); }
.d-sub .fig { color: var(--ink); }
.d-status { display: inline-flex; gap: 6px; align-items: center; font: 500 11px var(--mono); padding: 3px 7px; margin-top: 10px; border-radius: 2px; }
.d-status.st-leak { background: var(--leak); color: var(--paper); }
.d-status.st-risk { background: var(--ink); color: var(--paper); }
.d-status.st-clear { box-shadow: inset 0 0 0 1.5px var(--ink); }
.d-sec { border-top: 1px solid var(--rule); margin-top: 16px; padding-top: 12px; }
.d-k { font: 500 11px var(--ui); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
.d-k .badge { text-transform: uppercase; }
.d-p { margin: 0; font-size: 13px; }
.chart { width: 100%; height: auto; display: block; margin-top: 4px; }
.chart text { font: 9px var(--mono); fill: var(--ink-2); }
.chart-legend { display: flex; gap: 14px; font-size: 11px; color: var(--ink-2); margin-top: 4px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--ink); vertical-align: 3px; margin-right: 5px; }
.chart-legend i.dash { border-top: 2px dashed var(--ink-2); }
.chart-legend i.gap { height: 9px; border: 1px solid var(--leak); background: repeating-linear-gradient(135deg, var(--leak) 0 1.4px, transparent 1.4px 3.5px); vertical-align: -1px; }
.math { font-size: 15px; font-weight: 500; background: var(--paper-2); padding: 10px 12px; border-left: 3px solid var(--leak); margin: 4px 0 6px; overflow-wrap: anywhere; }
.math.math-risk { border-left-color: var(--ink); }
.math-sub { font: 12px/1.5 var(--mono); color: var(--ink-2); margin: 2px 0; overflow-wrap: anywhere; }
.assume { font-size: 12px; color: var(--ink-2); margin: 6px 0 0; padding-left: 16px; }
.assume li::marker { content: "A  "; font: 600 10px var(--mono); }
.ev { list-style: none; margin: 0; padding: 0; font: 11px/1.45 var(--mono); color: var(--ink-2); }
.ev li { padding: 2px 0; overflow-wrap: anywhere; }
.verdict { font: 600 11px var(--mono); text-transform: uppercase; }
.letter { background: #fff; border: 1px solid var(--rule); padding: 12px 14px; font-size: 13px; white-space: pre-wrap; margin: 6px 0; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: 12px; margin-top: 8px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.d-actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; flex-wrap: wrap; position: sticky; bottom: -28px; background: var(--paper); padding: 12px 0 4px; border-top: 1px solid var(--rule); }
.d-actions .q-state { margin-left: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; max-width: min(520px, calc(100vw - 32px));
  background: var(--ink); color: var(--paper); padding: 10px 14px; font-size: 13px; border-radius: 2px;
  transform: translate(-50%, 20px); opacity: 0; transition: transform .25s, opacity .25s; pointer-events: none;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* ------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
}
@media (max-width: 860px) {
  :root { --cols: 20; --gap: 2px; }
  .app { grid-template-columns: 1fr; padding: 16px 16px 24px; gap: 18px; }
  .topbar { padding: 12px 16px; flex-direction: column; gap: 2px; }
  .footer { padding: 16px; }
  .panel { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 8px; }
  .headline { font-size: 31px; }
  .gridwrap { max-width: none; }
  .queue { max-height: 70svh; min-height: 0; }
  .meter-sub { flex-direction: column; gap: 2px; }
  .counter-v { font-size: 21px; }
  .counter-k .lbl-long { display: none; }
  .counter-k .lbl-short { display: inline; }
  .ticker {
    display: flex; gap: 8px; align-items: baseline; margin-top: 10px; padding: 7px 0;
    border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font: 12px/1.4 var(--mono); height: 33px; overflow: hidden;
  }
  .ticker-id { font-weight: 600; flex: none; }
  .ticker-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
  .counter-s { min-height: 2.7em; font-size: 11px; }
  .type-v small { max-width: 9em; white-space: normal; }
  .drawer-sheet {
    top: auto; left: 0; right: 0; width: 100%; max-height: 88vh; border-left: 0; border-top: 1px solid var(--ink);
    transform: translateY(100%); padding: 18px 16px 24px; border-radius: 8px 8px 0 0;
  }
  .drawer.is-open .drawer-sheet { transform: none; }
  .d-actions { bottom: -24px; }
  .tile > i { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (max-width: 560px) {
  .type { grid-template-columns: 16px 1fr; gap: 4px 12px; }
  .type-v { grid-column: 2; text-align: left; }
  .type-v small { display: inline; margin-left: 6px; max-width: none; }
}
