/* SMI Proof PWA (T-013). Tokens verbatim from docs/mockups/proof-mobile-mockups.md. */

:root {
  --bg: #0E1116;
  --surface: #161B22;
  --surface-2: #1E252E;
  --border: #2A323D;
  --text: #E6E8EB;
  --muted: #9AA4B0;
  --muted-2: #7C8794;
  --teal: #34D3B0;
  --amber: #F2B84B;
  --red: #F87171;
  --gray: #6B7480;
  --blue: #6CA4FF;
  --line: #3A414B;
  --sans: "IBM Plex Sans", "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --touch: 44px;
  --tabbar: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

/* M-03: the page never scrolls — header, panel, player and nav share the real
   viewport height; the panel takes what the others leave */
html { height: 100%; overflow: hidden; }
body {
  max-width: 430px; margin: 0 auto; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
}
.noscroll { scrollbar-width: none; -ms-overflow-style: none; }
.noscroll::-webkit-scrollbar { display: none; }

a { color: var(--teal); }
h2 { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 8px; }
h3 { font-size: 14px; font-weight: 600; margin: 14px 0 6px; display: flex; align-items: center; gap: 8px; }
ul, ol { list-style: none; margin: 0; padding: 0; }

.mono { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.muted2 { color: var(--muted-2); }
.pos { color: var(--teal); }
.neg { color: var(--red); }
.pad { padding: 16px 0; }

/* header (M-03, as in loop/design/replay-ux/) */
.top {
  flex-shrink: 0; padding-top: env(safe-area-inset-top);
  background: var(--bg); border-bottom: 1px solid var(--border);
}
/* M-03b (D-069d): the middle column takes only the room the sides leave; the title
   and subtitle shrink to one line with an ellipsis instead of running under the
   Demo chip or the EN · TH pill */
.top-grid {
  height: 56px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 4px;
  align-items: center; padding: 0 8px 0 4px;
}
.top-left { display: flex; align-items: center; min-width: 0; }
.top h1 { margin: 0; padding-left: 12px; font-size: 20px; font-weight: 600; white-space: nowrap; }
.back-btn {
  min-height: var(--touch); min-width: var(--touch); display: flex; align-items: center; gap: 2px;
  padding: 0 8px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 15px; white-space: nowrap;
}
.top-mid { display: flex; flex-direction: column; align-items: center; min-width: 0; overflow: hidden; }
.top-title, .top-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-title { font-size: 16px; font-weight: 600; }
.top-sub { font-size: 11px; color: var(--muted-2); }
.top-right { display: flex; align-items: center; justify-content: flex-end; gap: 2px; flex-shrink: 0; }
.demo-chip {
  height: 26px; display: flex; align-items: center; gap: 5px; padding: 0 9px; border-radius: 13px;
  background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap;
}
.lang-pill {
  min-width: 52px; min-height: var(--touch); padding: 0 6px; border: 0; background: none;
  color: var(--text); font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.lang-pill .off { color: var(--muted-2); }

main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
main.scroll { display: block; overflow-y: auto; padding: 0 16px 24px; }

.tabbar {
  flex-shrink: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--bg); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  min-height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; text-align: center; padding: 0 2px;
}
.tabbar a[aria-current="page"] { color: var(--teal); }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font: 500 12px var(--mono);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.chip.sev.sev-high { color: var(--bg); background: var(--teal); border-color: var(--teal); }
.chip.sev.sev-watch { color: var(--bg); background: var(--amber); border-color: var(--amber); }
.chip.sev.sev-record { color: var(--text); background: var(--gray); border-color: var(--gray); }
.chip.role-sup { color: var(--text); }
.chip.role-ctx { color: var(--gray); }
.chip.role-unmet { color: var(--gray); }
.chip.role-con { color: var(--amber); border-color: var(--amber); }
.chip.src-ai { color: var(--teal); border-color: var(--teal); }
.chip.when { color: var(--muted-2); }
.chip.src-fb { color: var(--muted); }
.chip.result-sent { color: var(--teal); }
.chip.result-suppressed { color: var(--gray); }
.chip.result-failed { color: var(--red); }
.peak { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip.filter {
  min-height: var(--touch); padding: 0 14px; font: 500 13px var(--sans); color: var(--muted); border-radius: 22px;
}
.chip.filter[aria-pressed="true"] { color: var(--text); border-color: var(--teal); }

/* session bar (T-019 #29): the trading day, where the tape is, where signals opened */
.sbar { margin: 12px 0 2px; }
.sbar-track {
  position: relative; height: 10px; margin: 0 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px;
}
.sbar-lunch {
  position: absolute; top: 0; bottom: 0; pointer-events: none;
  background: repeating-linear-gradient(45deg, var(--border) 0 3px, transparent 3px 6px);
}
.sbar-mark {
  position: absolute; top: 50%; width: 24px; height: var(--touch); z-index: 2;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.sbar-mark.sev-high { z-index: 3; }
.sbar-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--bg); }
.sbar-mark.sev-high .sbar-dot { background: var(--teal); }
.sbar-mark.sev-watch .sbar-dot { background: var(--amber); }
.sbar-mark.sev-record .sbar-dot { background: var(--gray); }
.sbar-now {
  position: absolute; top: 50%; width: 12px; height: 12px; z-index: 4; pointer-events: none;
  transform: translate(-50%, -50%); border-radius: 50%; background: var(--text); border: 2px solid var(--bg);
}
.sbar-under { position: relative; height: 18px; margin: 5px 2px 0; font-size: 11px; }
.sbar-clock { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.sbar-none { position: absolute; top: 0; left: 0; }
.sbar-axis { display: flex; justify-content: space-between; margin: 0 2px; font-size: 11px; }

/* watchlist */
.wl-head, .wl-main { display: grid; grid-template-columns: 1.5fr 1fr 1fr 0.9fr; gap: 6px; align-items: center; }
.wl-head { grid-template-columns: 1.5fr 1fr 1fr 0.9fr var(--touch); font-size: 11px; padding: 10px 0 4px; }
.wl-row { display: grid; grid-template-columns: 1fr var(--touch); border-bottom: 1px solid var(--border); }
.wl-main {
  position: relative;
  min-height: 56px; background: none; border: 0; color: var(--text); text-align: left;
  padding: 6px 14px 6px 0; font: inherit;
}
.wl-sym { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.sym { font-weight: 600; }
.dot-btn { min-width: var(--touch); min-height: var(--touch); background: none; border: 0; display: flex; align-items: center; justify-content: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.st-normal { background: var(--teal); }
.dot.st-degraded { background: var(--amber); }
.dot.st-suspended { background: var(--red); }
.wl-reason { grid-column: 1 / -1; margin: 0 0 8px; font-size: 13px; color: var(--muted); }

/* feed */
.feed { display: flex; flex-direction: column; gap: 10px; }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; color: var(--text); text-decoration: none; }
.sig-card { min-height: var(--touch); position: relative; padding-right: 26px; }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* tap affordance (T-019 #31): the chevron, the pressed state, the one-line hint */
.chev { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted-2); font-size: 18px; line-height: 1; }
.wl-main .chev { right: 0; }
.sig-card, .wl-main, .sbar-mark { transition: background-color 120ms; }
.sig-card:active { background: var(--surface-2); }
.wl-main:active { background: var(--surface); }
.sbar-mark:active { background: var(--surface-2); border-radius: 6px; }
.hint { font-size: 12px; margin: 0 0 6px; }
.card-meta { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.card-ev { font-size: 12px; color: var(--muted); margin-top: 6px; }
.type { color: var(--text); }
.arrow { font-size: 12px; }

/* detail */
.back { display: inline-flex; align-items: center; min-height: var(--touch); text-decoration: none; }
.d-head { display: flex; flex-direction: column; gap: 6px; }
.d-title { font-size: 18px; display: flex; align-items: center; gap: 6px; }
.d-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 40px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--teal); }
.bar-num { text-align: right; }
.bar-row.total { border-top: 1px solid var(--border); padding-top: 6px; }

.ev-head, .ev { display: grid; grid-template-columns: 1fr 72px 92px 76px; gap: 6px; align-items: center; }
.ev-head { font-size: 11px; padding-bottom: 4px; }
.ev { padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.ev-note { color: var(--muted); }
.ev-value, .ev-thr { text-align: right; }
.ev .chip { justify-self: end; }
.ev.role-con .ev-label, .ev.role-con .ev-value, .conflict { color: var(--amber); }

.expl { margin-top: 16px; }
.expl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.expl-head h2 { margin: 0; flex: 1; }
.expl ul li { margin: 4px 0; }

.tl { border-left: 2px solid var(--border); margin-left: 6px; }
.tl-item { display: grid; grid-template-columns: 14px 72px 1fr auto; gap: 8px; align-items: center; padding: 6px 0 6px 0; margin-left: -8px; font-size: 13px; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg); }
.tl-dot.sev-high { background: var(--teal); }
.tl-dot.sev-watch { background: var(--amber); }
.tl-dot.sev-record { background: var(--gray); }

.why { display: inline-flex; align-items: center; min-height: var(--touch); margin-top: 8px; }
.disclaimer { color: var(--muted-2); font-size: 12px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 20px; }

/* system and settings */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  min-height: var(--touch); min-width: var(--touch); padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 600 14px var(--sans);
}
.btn.primary { background: var(--teal); border-color: var(--teal); color: var(--bg); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { min-height: var(--touch); min-width: 52px; padding: 0 10px; background: var(--surface); color: var(--muted); border: 0; border-right: 1px solid var(--border); font: 500 13px var(--mono); }
.seg-btn:last-child { border-right: 0; }
.seg-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--teal); }
.until {
  min-height: var(--touch); width: 92px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 13px var(--mono);
}
.err { color: var(--red); font-size: 12px; overflow-wrap: anywhere; }
.health-row { display: grid; grid-template-columns: 64px 14px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.alerts { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.alert-sig { display: block; margin-top: 6px; font-size: 12px; overflow-wrap: anywhere; }
/* the SOP §9.3 card: chips, header, evidence, conflicts, explanation, link */
.alert-card { display: flex; flex-direction: column; gap: 6px; }
.alert-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.alert-head { font-size: 13px; overflow-wrap: anywhere; }
.alert-ev { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.alert-con { font-size: 12px; color: var(--amber); overflow-wrap: anywhere; }
.alert-expl { font-size: 13px; }
.chip.kind { color: var(--muted-2); }
.chip.reason { color: var(--amber); border-color: var(--amber); }
.chip.src { color: var(--muted); }

.token { padding-top: 24px; display: flex; flex-direction: column; gap: 12px; }
/* M-04i: Settings' "Signed in as {name}" */
.signed-as { margin: 12px 0 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.token input {
  min-height: var(--touch); padding: 0 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 15px;
}

button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ------------------------------------------------------------------------- */
/* M-03: one screen at three levels, one player (loop/design/replay-ux/)      */
/* every control is a button at least 44 × 44 px; a smaller look sits inside  */
/* ------------------------------------------------------------------------- */

.level { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.empty { margin: 16px; color: var(--muted); font-size: 14px; }
.c-record { background: var(--gray); }
.c-watch { background: var(--amber); }
.c-high { background: var(--teal); }
.dot.st-none { background: var(--gray); }
.chip.ended { color: var(--muted); }
.chip.quiet { color: var(--muted); }

/* level 1 · list */
.rows { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 68px; }
.row {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 84px 96px; align-items: center; column-gap: 8px;
  height: 60px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--surface-2);
  background: none; color: var(--text); font: inherit; text-align: left;
}
.row:active { background: var(--surface); }
.row-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-sym { display: flex; align-items: center; gap: 8px; }
.row-sym .sym { font-size: 15px; font-weight: 600; }
.row-sym .dot { width: 8px; height: 8px; }
.row-name { padding-left: 16px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted-2); }
.row-name.warn { color: var(--amber); }
.row-px { display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; }
.row-chg { font-size: 12px; }
.row-sig { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.more { font-size: 11px; color: var(--muted); }
.flip {
  position: absolute; right: 16px; bottom: 12px; z-index: 1;
  min-height: var(--touch); display: flex; align-items: center; gap: 8px; padding: 0 16px 0 14px;
  border-radius: 22px; border: 1px solid var(--border); background: rgba(22, 27, 34, 0.94);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* level 1 · chart */
.chart { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 6px 16px 0; overflow: hidden; }
.chart-head { height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sel { display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); font-size: 15px; white-space: nowrap; }
.sel-sym { font-weight: 600; }
.sel-chg { font-size: 12px; }
.seg2 { display: flex; gap: 2px; }
.seg2 button {
  min-width: 56px; min-height: var(--touch); padding: 0; border: 0; background: none;
  display: flex; align-items: center; justify-content: center; font: inherit;
}
.seg2 button span {
  height: 30px; padding: 0 10px; display: flex; align-items: center; border-radius: 8px;
  font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.seg2 button[aria-pressed="true"] span { background: var(--border); color: var(--text); }
.picks { height: 44px; flex-shrink: 0; display: flex; align-items: center; gap: 4px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.pick { flex-shrink: 0; min-width: var(--touch); min-height: var(--touch); padding: 0; border: 0; background: none; display: flex; align-items: center; justify-content: center; }
.pick span {
  height: 28px; display: flex; align-items: center; padding: 0 9px; border-radius: 14px;
  font: 600 12px var(--mono); color: var(--muted); border: 1px solid var(--border);
}
.pick[aria-pressed="true"] span { background: var(--text); color: var(--bg); border-color: var(--text); }
.pick.auto span { font-family: var(--sans); }
.pick.auto[aria-pressed="true"] span { background: rgba(108, 164, 255, 0.14); color: var(--blue); border-color: var(--blue); }
.chart-svg { flex-shrink: 0; margin-top: 4px; overflow: visible; }
.svg-lunch { fill: var(--surface-2); opacity: 0.6; }
.svg-grid { stroke: var(--border); stroke-dasharray: 2 4; }
.svg-zero { stroke: var(--line); }
.svg-label { font: 9px var(--mono); fill: var(--muted-2); }
.band-watch { fill: var(--amber); opacity: 0.14; }
.band-high { fill: var(--teal); opacity: 0.16; }
.svg-dim { fill: none; stroke: #4A5563; stroke-width: 1; stroke-linejoin: round; }
.svg-bright { fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linejoin: round; }
.svg-head { stroke: var(--blue); stroke-dasharray: 3 3; }
.svg-dot { fill: var(--text); stroke: var(--bg); stroke-width: 2; }
.axis { position: relative; height: 14px; flex-shrink: 0; }
.axis span { position: absolute; top: 0; transform: translateX(-50%); font: 10px var(--mono); color: var(--muted-2); white-space: nowrap; }
/* M-03b: a tap on the time axis moves the view clock there */
.axis.tap { height: 24px; cursor: pointer; }
.axis.tap span { top: 5px; pointer-events: none; }
.plot { position: relative; flex-shrink: 0; margin-top: 4px; }
.plot .chart-svg { margin-top: 0; display: block; }
/* M-03b (D-071f): a chart's own time marker is a 44 px-wide drag handle */
.handle {
  position: absolute; top: 0; width: 44px; z-index: 3; cursor: ew-resize;
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.lanes .handle { top: 0; }
.how {
  min-height: var(--touch); margin: 10px 0 6px; padding: 0 14px; border-radius: 22px;
  border: 1px solid var(--border); background: var(--surface); color: var(--teal); font: inherit; font-size: 13px; font-weight: 500;
}
.rows .how { margin-left: 16px; }

/* level 2 · signals */
.signals { gap: 6px; padding: 6px 16px 0; overflow: hidden; }
.sig-head { height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sig-title { display: flex; flex-direction: column; min-width: 0; }
.sig-all { font-size: 15px; font-weight: 600; }
.sig-hint { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.crits { height: 44px; flex-shrink: 0; display: flex; align-items: center; gap: 4px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.crit { flex-shrink: 0; min-width: var(--touch); min-height: var(--touch); padding: 0; border: 0; background: none; display: flex; align-items: center; justify-content: center; font: inherit; }
.crit > span {
  height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 11px; border-radius: 15px;
  font-size: 13px; font-weight: 500; color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.crit[aria-pressed="true"] > span { background: var(--text); color: var(--bg); border-color: var(--text); }
.crit .cnt { font: 600 11px var(--mono); color: var(--muted-2); }
.crit[aria-pressed="true"] .cnt { color: var(--line); }
.hi-quiet { flex-shrink: 0; margin: 0; padding: 8px 10px; border-radius: 8px; background: rgba(108, 164, 255, 0.08); font-size: 12px; color: #C9CED4; }
.lanes-box { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.lanes { position: relative; padding-top: 22px; }
.lane {
  position: relative; display: block; width: 100%; height: 72px; padding: 0; border: 0;
  border-bottom: 1px solid var(--surface-2); border-radius: 4px; background: transparent;
  color: var(--text); font: inherit; text-align: left;
}
.lane.hi { background: rgba(108, 164, 255, 0.10); }
.lane-name, .lane-chip, .lane-detail { z-index: 2; } /* above the future's hatching */
.lane-name { position: absolute; left: 0; top: 8px; font-size: 13px; white-space: nowrap; }
.lane-name .sym { font-weight: 600; }
.lane-name .type { color: var(--muted); }
.lane-chip { position: absolute; right: 0; top: 6px; }
.lane-seg { position: absolute; top: 36px; height: 12px; border-radius: 3px; }
.lane-tick { position: absolute; top: 33px; width: 2px; height: 18px; margin-left: -1px; border-radius: 1px; background: var(--text); }
.lane-detail { position: absolute; left: 0; top: 54px; font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.future {
  position: absolute; top: 22px; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(14, 17, 22, 0.72) 0 6px, rgba(14, 17, 22, 0.55) 6px 12px);
}
.headline { position: absolute; top: 18px; width: 2px; margin-left: -1px; pointer-events: none; background: var(--blue); }
.headlabel {
  position: absolute; top: 0; width: 72px; height: 20px; border-radius: 10px; background: var(--blue); color: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; pointer-events: none;
}
.empty-lanes { margin: 4px 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.minor { flex-shrink: 0; }
.minor-btn {
  width: 100%; min-height: var(--touch); display: flex; align-items: center; justify-content: space-between;
  padding: 0; border: 0; border-top: 1px solid var(--surface-2); background: none; color: var(--muted); font: inherit; font-size: 13px;
}
.minor-list { max-height: 96px; overflow-y: auto; scrollbar-width: none; }
.minor-list::-webkit-scrollbar { display: none; }
.minor-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; color: var(--muted-2); }
.minor-open { color: var(--text); }
.tip { flex-shrink: 0; margin: 0 0 6px; font-size: 12px; color: var(--muted-2); }

/* level 3 · detail */
.detail3 { overflow-y: auto; padding: 8px 16px 10px; gap: 8px; }
.detail3 > * { flex-shrink: 0; }
.d3-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.d3-card h2 { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
.d3-card p { margin: 0; font-size: 13px; line-height: 1.5; }
.d3-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.d3-sub { font-size: 12px; color: var(--muted-2); }
.d3-times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.d3-times > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; }
.d3-times .v { font-size: 15px; }
.d3-times .k { font-size: 11px; color: var(--muted-2); }
.jump { min-height: var(--touch); border-radius: 12px; border: 1px solid var(--blue); background: none; color: var(--blue); font: inherit; font-size: 14px; font-weight: 500; }
.detail3 .expl { margin-top: 0; border-radius: 14px; }
.detail3 .disclaimer { border-top: 0; margin-top: 0; padding-top: 0; text-align: center; font-size: 11px; }
.tr-btn {
  min-height: var(--touch); margin-top: 8px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--teal); background: none; color: var(--teal); font: inherit; font-size: 14px; font-weight: 500;
}
.tr-btn[disabled] { opacity: 0.5; }
/* M-04h: "translating…" with a turning ring and, from 3 s, the seconds; the label
   keeps the room of its widest text ("… 00 s"), so the count never moves anything */
.chip.tr.busy { font-variant-numeric: tabular-nums; }
.tr-spin {
  flex: none; width: 10px; height: 10px; box-sizing: border-box; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: tr-spin 1s linear infinite;
}
@keyframes tr-spin { to { transform: rotate(360deg); } }
.tr-label { display: inline-grid; }
.tr-label > span { grid-area: 1 / 1; }
.tr-room { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .tr-spin { animation: none; }
}

/* M-03b: the reading pill and the Newbie reading (loop/design/reading-modes/) */
.reading {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.reading button {
  min-height: var(--touch); border: 0; border-radius: 9px; background: none;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 500;
}
.reading button[aria-pressed="true"] { background: var(--teal); color: var(--bg); font-weight: 600; }
.nb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.nb-card h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
.nb-head h2 { font-size: 21px; line-height: 1.3; }
.nb-pill {
  align-self: flex-start; display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 10px;
  border-radius: 999px; font-size: 13px; font-weight: 600;
}
.nb-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.nb-pill.b-noted { background: rgba(107, 116, 128, 0.2); color: #C9CED4; }
.nb-pill.b-watch { background: rgba(242, 184, 75, 0.14); color: var(--amber); }
.nb-pill.b-strong, .nb-pill.b-very { background: rgba(52, 211, 176, 0.14); color: var(--teal); }
.nb-time { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.nb-happen { padding-bottom: 6px; gap: 0; }
.nb-happen h2 { margin-bottom: 2px; }
.nb-at { font-size: 11px; color: var(--muted-2); padding-bottom: 6px; }
.nb-none { margin: 6px 0 8px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.nb-row {
  display: grid; grid-template-columns: 92px minmax(0, 1fr); column-gap: 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.nb-big { font-size: 24px; font-weight: 500; color: var(--teal); white-space: nowrap; }
.nb-big.word { font-family: var(--sans); font-size: 19px; font-weight: 600; color: var(--text); }
.nb-line { font-size: 14px; line-height: 1.45; }
.nb-sh { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.nb-score { font-size: 14px; color: var(--muted); white-space: nowrap; }
.nb-bar { position: relative; height: 34px; }
.nb-zones { position: absolute; left: 0; right: 0; top: 8px; height: 10px; display: flex; gap: 2px; }
.nb-zone.z-noted { background: var(--line); border-radius: 5px 0 0 5px; }
.nb-zone.z-watch { background: var(--amber); opacity: 0.55; }
.nb-zone.z-strong { background: var(--teal); opacity: 0.7; }
.nb-zone.z-very { background: var(--teal); border-radius: 0 5px 5px 0; }
.nb-mark { position: absolute; top: 2px; width: 4px; height: 22px; margin-left: -2px; border-radius: 2px; background: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.nb-ticks { position: absolute; left: 0; right: 0; top: 22px; font-size: 10px; color: var(--muted-2); }
.nb-ticks span { position: absolute; transform: translateX(-50%); }
.nb-ticks span.first { transform: none; }
.nb-ticks span.last { transform: translateX(-100%); }
.nb-colours { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.nb-strength .how { align-self: flex-start; margin: 0; }
.nb-plain-sub { margin: -4px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.nb-meta { margin: 0; font-size: 15px; line-height: 1.6; }
.nb-not { background: var(--surface-2); border: 0; }
.nb-not ul { padding-left: 18px; list-style: disc; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.5; color: #C9CED4; }

/* M-03b: the one "How to read this" sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; background: rgba(0, 0, 0, 0.55); }
.sheet {
  position: relative; width: 100%; max-width: 430px; max-height: 88%; overflow-y: auto;
  background: var(--surface); border-top: 1px solid var(--border); border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px;
}
.sheet h2 { margin: 0; font-size: 17px; color: var(--text); text-transform: none; letter-spacing: 0; }
.sheet p { margin: 0; font-size: 14px; line-height: 1.5; }
.sheet .disclaimer { margin-top: 0; }
.ht-bands { display: flex; flex-direction: column; gap: 6px; }
.ht-bands li { display: grid; grid-template-columns: 14px 56px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 14px; }
.ht-sw { width: 12px; height: 12px; border-radius: 3px; }
.c-high-light { background: var(--teal); opacity: 0.7; }
.sheet-close {
  min-height: var(--touch); border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 15px; font-weight: 600;
}

/* the player */
#player { flex-shrink: 0; }
.player { background: var(--surface); border-top: 1px solid var(--border); padding: 0 16px 6px; }
.strip { height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.levels-grp { display: flex; align-items: center; margin-left: -6px; min-width: 0; }
.lv {
  min-height: var(--touch); min-width: var(--touch); display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 0 6px; border: 0; background: none; font: inherit; font-size: 12px; color: var(--muted-2); white-space: nowrap;
}
.lv-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.lv[aria-current="page"] { color: var(--text); font-weight: 600; }
.lv[aria-current="page"] .lv-dot { background: var(--blue); }
.lv.dim { opacity: 0.45; }
.lv-sep { width: 8px; height: 1px; background: var(--line); flex-shrink: 0; }
.fold {
  min-height: var(--touch); min-width: var(--touch); display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-right: -6px; padding: 0 6px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 11px;
}
.daybar { position: relative; height: 90px; }
.mk {
  position: absolute; top: 0; width: 44px; height: 44px; margin-left: -22px; padding: 0; border: 0;
  background: none !important; display: flex; align-items: center; justify-content: center; z-index: 2;
}
.mk .mk-dot { border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 700 12px var(--mono); color: var(--bg); }
.mk.c-record .mk-dot { background: var(--gray); }
.mk.c-watch .mk-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(242, 184, 75, 0.12); }
.mk.c-high .mk-dot { background: var(--teal); box-shadow: 0 0 0 5px rgba(52, 211, 176, 0.16); }
.mk.ahead { opacity: 0.45; }
.mk-stem { position: absolute; width: 1px; opacity: 0.45; pointer-events: none; }
.trk { position: absolute; top: 58px; height: 6px; background: var(--border); }
.trk.first { border-radius: 3px 0 0 3px; }
.trk.last { border-radius: 0 3px 3px 0; }
.lunch { position: absolute; top: 58px; height: 6px; background: repeating-linear-gradient(135deg, var(--line) 0 2px, transparent 2px 4px); }
.avail { position: absolute; left: 0; top: 58px; height: 6px; border-radius: 3px 0 0 3px; background: #4A5563; pointer-events: none; }
.played { position: absolute; left: 0; top: 58px; height: 6px; border-radius: 3px 0 0 3px; background: var(--blue); pointer-events: none; }
.bracket { position: absolute; top: 50px; height: 22px; border: 2px solid var(--blue); border-radius: 6px; background: rgba(108, 164, 255, 0.12); pointer-events: none; }
.headdot {
  position: absolute; top: 53px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 0 3px var(--surface); pointer-events: none;
}
.seek {
  position: absolute; left: -8px; top: 39px; height: 44px; margin: 0; padding: 0; opacity: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent; z-index: 1;
}
.seek::-webkit-slider-runnable-track { height: 44px; background: transparent; }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 44px; }
.seek::-moz-range-thumb { width: 16px; height: 44px; border: 0; }
.blabel { position: absolute; top: 74px; font-size: 10px; color: var(--muted-2); pointer-events: none; }
.ctrls { height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.clock { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.clock .c { font-size: 18px; font-weight: 600; }
.clock .m { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.clock.sm { flex: 0 0 auto; }
.clock.sm .c { font-size: 14px; }
.clock.sm .m { font-size: 10px; }
.btns { display: flex; align-items: center; gap: 4px; }
.ib { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 22px; background: none; color: var(--text); }
.ib.off { color: var(--line); }
.pp { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: var(--blue); color: var(--bg); }
.pp.sm { flex-shrink: 0; width: 44px; height: 44px; }
.spd-wrap { flex: 1 1 0; min-width: 0; display: flex; justify-content: flex-end; }
.spd {
  min-width: 56px; min-height: var(--touch); padding: 0 8px; border: 1px solid var(--border); border-radius: 10px;
  font: 600 14px var(--mono); background: var(--surface-2); color: var(--text);
}
.spd.new { font: 600 12px var(--sans); }
.startbox { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 8px; }
.startbox p { margin: 0; font-size: 12px; }
.start { min-height: 48px; border: 0; border-radius: 12px; background: var(--blue); color: var(--bg); font: inherit; font-size: 15px; font-weight: 600; }
.start[disabled] { opacity: 0.6; }
.mini-row { height: 48px; display: flex; align-items: center; gap: 10px; }
.mini { position: relative; flex-grow: 1; min-height: var(--touch); padding: 0; border: 0; background: none; }
.mini span { position: absolute; pointer-events: none; }
.mini-track { left: 0; right: 0; top: 20px; height: 3px; border-radius: 2px; background: var(--border); }
.mini-avail { left: 0; top: 20px; height: 3px; border-radius: 2px; background: #4A5563; }
.mini-played { left: 0; top: 20px; height: 3px; border-radius: 2px; background: var(--blue); }
.mini-mark { top: 18px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.mini-head { top: 17px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--blue); }
