/* The Huang Record — layout: a reading column of evidence cards beside a docked clip player,
   styled like a hearing docket: testimony set in serif, timecodes and exhibit ids in mono. */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #e4e9f0;
  --ink: #121a27;
  --ink-2: #445063;
  --ink-3: #6b778a;
  --line: #d3dae4;
  --accent: #1c3f94;
  --accent-ink: #ffffff;
  --accent-soft: #dfe7f7;
  --oath: #8a6410;
  --oath-soft: #f4ead0;
  --gA: #157a55;
  --gB: #4f8a25;
  --gC: #a87400;
  --gD: #c2560c;
  --gF: #b3261e;
  --gA-soft: #d9f0e6;
  --gB-soft: #e3efd6;
  --gC-soft: #f6e9c8;
  --gD-soft: #f8dfcc;
  --gF-soft: #f6d9d6;
  --neg: #b3261e;
  --pos: #157a55;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #8a94a6;
  --dem: #2a78d6; --rep: #d92d2d;  /* party colours on the hearing timeline: validated as a pair for colour-blind separation */
  --shadow: 0 1px 2px rgba(18, 26, 39, 0.06), 0 6px 20px rgba(18, 26, 39, 0.06);
  --sans: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --dock-w: 400px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d121a;
    --surface: #151c27;
    --surface-2: #1d2634;
    --ink: #e7ecf4;
    --ink-2: #aab4c5;
    --ink-3: #7c889b;
    --line: #2a3546;
    --accent: #93b1ff;
    --accent-ink: #0d121a;
    --accent-soft: #1d2b4d;
    --oath: #dcb65c;
    --oath-soft: #3a2f14;
    --gA: #4fc796;
    --gB: #9bcb62;
    --gC: #e3b341;
    --gD: #f08a4b;
    --gF: #f2726a;
    --gA-soft: #11382a;
    --gB-soft: #26371a;
    --gC-soft: #3d3110;
    --gD-soft: #40230f;
    --gF-soft: #431a17;
    --neg: #f2726a;
    --pos: #4fc796;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #6f7b8f;
  --dem: #3987e5; --rep: #e5484d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d121a;
  --surface: #151c27;
  --surface-2: #1d2634;
  --ink: #e7ecf4;
  --ink-2: #aab4c5;
  --ink-3: #7c889b;
  --line: #2a3546;
  --accent: #93b1ff;
  --accent-ink: #0d121a;
  --accent-soft: #1d2b4d;
  --oath: #dcb65c;
  --oath-soft: #3a2f14;
  --gA: #4fc796;
  --gB: #9bcb62;
  --gC: #e3b341;
  --gD: #f08a4b;
  --gF: #f2726a;
  --gA-soft: #11382a;
  --gB-soft: #26371a;
  --gC-soft: #3d3110;
  --gD-soft: #40230f;
  --gF-soft: #431a17;
  --neg: #f2726a;
  --pos: #4fc796;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #6f7b8f;
  --dem: #3987e5; --rep: #e5484d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; line-height: 1.2; }
p { margin: 0; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.top-in {
  display: flex; align-items: center; gap: 20px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.brand b { font: 700 19px/1 var(--sans); letter-spacing: -0.01em; }
.brand span { font: 400 13px/1 var(--serif); font-style: italic; color: var(--ink-3); }
.search { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: 1 1 220px; max-width: 380px; }
.search input {
  width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit;
}
.theme-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 10px; font-size: 13px; color: var(--ink-2); }
.tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 9px 13px 10px; border: 0; background: none; color: var(--ink-2);
  font: 600 13.5px/1 var(--sans); border-bottom: 3px solid transparent; text-decoration: none; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab .n { font: 500 11px var(--mono); color: var(--ink-3); margin-left: 5px; }

/* ---------- shell ---------- */
.shell {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--dock-w); gap: 24px; align-items: start;
  padding-block: 22px 80px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  max-width: 1500px; margin: 0 auto;
}
main { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.dock { position: sticky; top: 104px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* ---------- player dock ---------- */
.player-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.player-frame { position: relative; aspect-ratio: 16 / 9; background: #05080d; max-width: 100%; }
.player-frame iframe, .player-frame #yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #b8c2d3; padding: 24px; font-size: 14px; }
.player-empty b { display: block; color: #fff; font-size: 16px; margin-bottom: 6px; }
.now { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.now-label { font: 600 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; }
.now-src { font-weight: 600; font-size: 14px; }
.now-quote { font: 400 15.5px/1.5 var(--serif); color: var(--ink); max-height: 9.2em; overflow: auto; }
.now-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 7px;
  padding: 6px 10px; font: 600 12.5px/1.2 var(--sans); text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--gA); }
.dock-note { font-size: 12.5px; color: var(--ink-3); padding: 0 4px; }

/* ---------- generic blocks ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-width: 0; }
.panel > h2, .sec-h { font: 700 17px/1.2 var(--sans); letter-spacing: -0.005em; }
.panel > h2 + p, .lede { color: var(--ink-2); margin-top: 6px; max-width: 72ch; }
.eyebrow { font: 600 11px/1 var(--mono); letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); }
.page-h { display: flex; flex-direction: column; gap: 8px; }
.page-h h1 { font: 700 28px/1.12 var(--sans); letter-spacing: -0.02em; }
.page-h p { color: var(--ink-2); max-width: 76ch; font-size: 15.5px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font: 700 26px/1.1 var(--sans); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--ink-3); }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px;
  font: 600 11.5px/1.3 var(--sans); background: var(--surface-2); color: var(--ink-2); border: 0; text-decoration: none;
  max-width: 100%; overflow-wrap: anywhere; border-radius: 12px;
}
button.chip:hover, a.chip:hover { background: var(--accent-soft); color: var(--accent); }
.chip.oath { background: var(--oath-soft); color: var(--oath); }
.chip.src { background: var(--accent-soft); color: var(--accent); }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chip.neg { background: var(--gF-soft); color: var(--gF); }
.chip.warn { background: var(--gC-soft); color: var(--gC); }
.chip.pos { background: var(--gA-soft); color: var(--gA); }
.grade {
  flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  font: 700 17px/1 var(--sans); background: var(--surface-2); color: var(--ink-2);
}
.grade.A { background: var(--gA-soft); color: var(--gA); }
.grade.B { background: var(--gB-soft); color: var(--gB); }
.grade.C { background: var(--gC-soft); color: var(--gC); }
.grade.D { background: var(--gD-soft); color: var(--gD); }
.grade.F { background: var(--gF-soft); color: var(--gF); }
.grade.sm { width: 24px; height: 24px; font-size: 13px; border-radius: 6px; }

/* play button */
.play {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 4px 11px 4px 5px; font: 500 12px/1 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums;
}
.play::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%; background: var(--accent) center / 9px no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 1l7 4-7 4z' fill='white'/%3E%3C/svg%3E");
}
.play:hover { border-color: var(--accent); background: var(--accent-soft); }
.play.is-playing { border-color: var(--accent); background: var(--accent-soft); }

/* statement card */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.hl { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card-top { display: flex; gap: 12px; align-items: flex-start; }
.card-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.quote { font: 400 17px/1.5 var(--serif); color: var(--ink); }
.quote::before { content: "“"; }
.quote::after { content: "”"; }
.claim { font-size: 13.5px; color: var(--ink-2); }
.claim b { font-weight: 600; color: var(--ink); }
.metaline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sid { font: 500 11px var(--mono); color: var(--ink-3); letter-spacing: 0.02em; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); font: 600 12.5px var(--sans); text-decoration: underline; text-underline-offset: 2px; }
.rel { border-top: 1px dashed var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.rel-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px; border-radius: 9px; background: var(--bg); }
.rel-item .quote { font-size: 15px; }
.rel-kind { font: 700 10.5px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; padding: 5px 7px; border-radius: 5px; white-space: nowrap; }
.rel-kind.contradiction, .rel-kind.reversal { background: var(--gF-soft); color: var(--gF); }
.rel-kind.tension, .rel-kind.shift { background: var(--gC-soft); color: var(--gC); }
.rel-kind.consistent, .rel-kind.support, .rel-kind.refinement { background: var(--gA-soft); color: var(--gA); }
.note { font-size: 13.5px; color: var(--ink-2); }

/* conflict pair */
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.side { background: var(--bg); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vs { font: 700 11px var(--mono); color: var(--ink-3); letter-spacing: 0.1em; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input[type="search"] {
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 13px var(--sans); max-width: 100%;
}
.count { font: 500 12px var(--mono); color: var(--ink-3); }

/* bars */
.bar { display: flex; gap: 2px; height: 12px; border-radius: 4px; overflow: hidden; }
.bar i, .bar a { display: block; height: 100%; min-width: 3px; border-radius: 2px; }
.bar a:hover, .bar a:focus-visible { filter: brightness(1.15); outline: 2px solid var(--ink); outline-offset: -2px; }
.bar.tall { height: 26px; }
.bar.tall a { display: grid; place-items: center; text-decoration: none; }
.bar.tall a span { font: 600 11px var(--mono); color: #fff; text-shadow: 0 0 3px rgba(0, 0, 0, 0.55); }
a.stat { display: block; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--accent); }
a.heat { text-decoration: none; }
a.heat:hover { outline: 2px solid var(--accent); }
a.tone { display: block; }
td.num a { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
details.cat > summary { list-style: none; display: flex; flex-direction: column; gap: 3px; font-weight: 400; }
details.cat > summary::-webkit-details-marker { display: none; }
details.cat u { color: var(--accent); text-decoration-style: dotted; }
details.cat[open] u { display: none; }

/* topic map */
.mapwrap { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); overflow: hidden; }
svg.map { display: block; width: 100%; height: auto; }
.dot { stroke: var(--bg); stroke-width: 1.5; cursor: pointer; opacity: 0.9; }
.dot:hover { stroke: var(--ink); stroke-width: 2; opacity: 1; }
.dot.dim { opacity: 0.1; pointer-events: none; }
.dot.sel { stroke: var(--ink); stroke-width: 3; opacity: 1; }
.maplabel { font: 600 11.5px var(--sans); fill: var(--ink); pointer-events: none; }
.maplabel-bg { fill: var(--surface); stroke: var(--line); opacity: 0.88; cursor: pointer; }
a:hover > .maplabel-bg { stroke: var(--accent); opacity: 1; }
.maptip { position: fixed; z-index: 5; width: 300px; max-width: 80%; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); pointer-events: none; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.maptip div { font: 400 14px/1.4 var(--serif); }
.maptip span { color: var(--ink-3); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--ink-2); }
.legend a:hover { text-decoration: underline !important; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.tone { position: relative; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--gF-soft), var(--surface-2) 50%, var(--gA-soft)); }
.tone::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-3); opacity: 0.5; }
.tone i { position: absolute; top: -4px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; border: 3px solid var(--surface); background: var(--ink); }
.scale-ends { display: flex; justify-content: space-between; font: 500 10.5px var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-2); }
.dots i.f { background: var(--accent); }

table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font: 600 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.heat { text-align: center; font: 600 12px var(--mono); border-radius: 4px; padding: 4px 0; min-width: 34px; display: block; color: var(--ink); }

/* timeline (position drift) */
.tl { display: grid; gap: 0; }
.tl-row { display: grid; grid-template-columns: 118px 18px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; position: relative; }
.tl-date { font: 500 12px var(--mono); color: var(--ink-3); text-align: right; padding-top: 2px; }
.tl-date b { display: block; color: var(--ink); font: 600 12.5px var(--sans); }
.tl-dot { position: relative; }
.tl-dot::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: -14px; width: 2px; background: var(--line); }
.tl-row:last-child .tl-dot::before { display: none; }
.tl-dot::after { content: ""; position: absolute; left: 3px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.tl-row.oath .tl-dot::after { border-color: var(--oath); background: var(--oath-soft); }
.tl-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* transcript */
.tr-para { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.tr-para:hover { background: var(--surface-2); }
.tr-para.j .tr-name { color: var(--accent); }
.tr-para.active { background: var(--accent-soft); }
.tr-name { font: 700 12px var(--sans); }
.tr-text { font: 400 15.5px/1.55 var(--serif); }
.tr-time { font: 500 11.5px var(--mono); color: var(--ink-3); padding-top: 3px; }
mark { background: var(--oath-soft); color: inherit; border-radius: 2px; padding: 0 1px; }

.verdict { border-left: 4px solid var(--accent); }
.verdict h3 { font: 700 16px var(--sans); }
.verdict .answer { font: 500 18px/1.4 var(--serif); margin-top: 6px; }
.caveat { background: var(--oath-soft); color: var(--ink); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; }
.caveat b { color: var(--oath); }
ul.clean { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
details > summary { cursor: pointer; font-weight: 600; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.loadmore { align-self: center; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-bottom: 300px; }
  .dock {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40; gap: 0;
    padding: 0 max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  }
  .player-card { display: grid; grid-template-columns: min(42vw, 260px) minmax(0, 1fr); border-radius: 12px; }
  .player-frame { aspect-ratio: 16 / 9; align-self: start; }
  .now { padding: 10px 12px; gap: 6px; }
  .now-quote { font-size: 13.5px; max-height: 4.4em; }
  .dock-note { display: none; }
  .dock.idle .player-card { grid-template-columns: minmax(0, 1fr); }
  .dock.idle .player-frame { display: none; }
  .dock.idle .now-quote, .dock.idle .now-actions, .dock.idle .meter { display: none; }
  .dock.idle + * { padding-bottom: 0; }
}
@media (max-width: 560px) {
  .page-h h1 { font-size: 23px; }
  .tl-row { grid-template-columns: 84px 18px minmax(0, 1fr); }
  .tr-para { grid-template-columns: 1fr; gap: 2px; }
  .brand span { display: none; }
  .now-actions .btn.opt { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .card.hl { transition: box-shadow 0.4s; }
}

/* tone candles */
svg.candles { display: block; width: 100%; min-width: 520px; height: auto; }
svg.candles.mini { min-width: 0; }
.cgrid { stroke: var(--line); stroke-width: 1; }
.cgrid.zero { stroke: var(--ink-3); stroke-dasharray: 3 3; }
.caxis { font: 500 10.5px var(--mono); fill: var(--ink-3); }
.clabel { font: 600 12.5px var(--sans); fill: var(--ink); }
.cwick { stroke-width: 2; }
.cwick.up, .cbody.up { stroke: var(--gA); }
.cwick.down, .cbody.down { stroke: var(--gF); }
.cbody { stroke-width: 2; cursor: pointer; }
.cbody.up { fill: var(--surface); }
.cbody.down { fill: var(--gF); }
.cmean { stroke: var(--ink); stroke-width: 2; }
.cnone { stroke: var(--line); stroke-width: 2; }
.cdot { fill: var(--ink-3); stroke: var(--surface); }
.cdot:hover, .cdot.sel { fill: var(--accent); stroke: var(--ink); }
svg.candles a:hover .cbody { stroke-width: 3; }

/* the Judge */
.claimbox { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 400 17px/1.45 var(--serif); resize: vertical; }
.verdict-banner { border-left: 6px solid var(--line); background: var(--bg); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
button.chip { cursor: pointer; font-weight: 500; white-space: normal; text-align: left; }
.btn[disabled] { opacity: 0.6; cursor: wait; }

/* watch live */
svg.wtl { display: block; width: 100%; min-width: 640px; height: 104px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.wblock { cursor: pointer; }
.wblock:hover rect { fill: var(--accent-soft); }
.wbar { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 28px; gap: 10px; align-items: center; font-size: 12.5px; color: inherit; text-decoration: none; }
.wbar:hover span { color: var(--accent); }
.wbar b { text-align: right; }
.legend button.chip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 2px; }
@media (min-width: 1081px) { body.watching { --dock-w: 520px; } }

/* three modes */
.modes { display: flex; gap: 8px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); overflow-x: auto; scrollbar-width: none; }
.modes::-webkit-scrollbar { display: none; }
.mode { flex: none; display: flex; align-items: baseline; gap: 8px; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); background: var(--surface); }
.mode b { font: 700 14.5px var(--sans); color: var(--ink); }
.mode span { font-size: 12.5px; color: var(--ink-3); }
.mode:hover { border-color: var(--accent); }
.mode[aria-current="true"] { background: var(--accent); border-color: var(--accent); }
.mode[aria-current="true"] b, .mode[aria-current="true"] span { color: var(--accent-ink); }
.door { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: inherit; }
.door b { font: 700 17px/1.25 var(--sans); }
.door span:last-child { font-size: 13.5px; color: var(--ink-2); }
.door:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (min-width: 1081px) { .dock { top: 152px; } }
@media (max-width: 700px) { .mode span { display: none; } }

/* ---------- mobile view of the hearing (#mobile): report card, sticky video + flip card, card decks ---------- */
body.mview .top { position: static; }
body.mview .shell { display: flex; flex-direction: column; align-items: stretch; gap: 12px; max-width: 720px; padding-block: 12px 48px; }
body.mview .shell > * { min-width: 0; max-width: 100%; }
body.mview main { display: contents; }
body.mview .m-report { order: -2; }
body.mview .dock { order: -1; position: sticky; top: env(safe-area-inset-top, 0px); bottom: auto; left: auto; right: auto; z-index: 25; padding: 0; gap: 0; background: var(--bg); }
body.mview .dock .player-card { display: block; border-radius: 12px; }
body.mview .dock.idle .player-frame, body.mview .dock .player-frame { display: block; }
body.mview .dock-note { display: none; }
body.mview .now { padding: 5px 8px 7px; gap: 4px; }

.m-report { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.m-rtop { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.m-rtop .eyebrow { line-height: 1.6; }
.m-info { flex: none; width: 44px; height: 44px; margin: -10px -10px -10px 0; padding: 0; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; }
.m-info span { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--ink-3); color: var(--ink-2); font: italic 700 16px/1 var(--serif); display: grid; place-items: center; }
.m-info:hover span, .m-info:focus-visible span { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.m-rhead { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.m-rhead h1 { font: 700 24px/1.1 var(--sans); letter-spacing: -0.02em; }
.m-overall.grade { width: 72px; height: 72px; border-radius: 14px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.m-overall b { font: 700 30px/1 var(--sans); }
.m-overall span { font: 600 10px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.m-oneline { font: 500 16.5px/1.45 var(--serif); }
.m-grades { display: grid; gap: 8px; }
.m-tile { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px; border-radius: 10px; background: var(--bg); text-decoration: none; color: inherit; min-height: 64px; }
.m-tile .grade { width: 46px; height: 46px; font-size: 19px; }
.m-tile b { display: block; font: 700 14.5px/1.25 var(--sans); }
.m-tile div span { font-size: 13px; line-height: 1.35; color: var(--ink-2); display: block; margin-top: 2px; }

.flip { perspective: 900px; height: 100px; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform 0.45s; transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateX(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; gap: 3px; }
.flip-back { transform: rotateX(180deg); justify-content: center; gap: 8px; }
.flip:not(.flipped) .flip-back, .flip.flipped .flip-front { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .flip-inner { transition: none; } }
.m-nowrow { display: flex; align-items: center; gap: 8px; height: 26px; flex: none; }
.m-nowrow > b { flex: 1; min-width: 0; font: 700 13.5px/1.2 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-nowrow > b.j { color: var(--accent); }
.m-nowrow .mono { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.m-flipbtn { flex: none; height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 11.5px var(--sans); cursor: pointer; }
.m-tlwrap { padding: 2px 0; cursor: pointer; flex: none; touch-action: manipulation; }
#m-tl { display: block; width: 100%; height: 28px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.m-legend { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; flex: none; }
.m-dd { position: relative; height: 36px; min-width: 0; padding: 3px 24px 3px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 2px; cursor: pointer; }
.m-dd::after { content: ""; position: absolute; right: 10px; top: 50%; width: 6px; height: 6px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: translateY(-70%) rotate(45deg); }
.m-dd[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); }
.m-dd[aria-expanded="true"]::after { transform: translateY(-20%) rotate(225deg); }
.m-dd.on { border-color: var(--ink-2); }
.m-dd small { font: 600 9px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.m-dd span { display: block; font: 700 12.5px/1.15 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-dd span i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.m-dd span em, .m-opt em { font: 500 10.5px var(--mono); font-style: normal; color: var(--ink-3); }
.m-dd span b { font: 600 10.5px var(--mono); color: var(--ink-3); }
.m-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 6; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3); display: flex; flex-direction: column; }
.m-menu-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px; display: flex; flex-direction: column; gap: 2px; position: relative; }
.m-menu-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); }
.m-menu-foot > span { flex: 1; min-width: 0; }
.m-menu-foot .btn { min-height: 40px; }
.m-menu-h { font: 700 10.5px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 12px 10px 4px; }
.m-box { flex: none; width: 18px; height: 18px; border: 2px solid var(--ink-3); border-radius: 5px; display: grid; place-items: center; text-decoration: none; }
.m-box.on { background: var(--accent); border-color: var(--accent); }
.m-box.on::after { content: "✓"; color: var(--accent-ink); font: 700 12px/1 var(--sans); }
.m-menu[hidden] { display: none; }
.m-menu-cap { font-size: 12px; line-height: 1.35; color: var(--ink-3); padding: 4px 8px 6px; }
.m-opt { flex: none; display: grid; grid-template-columns: 18px 14px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: 600 14px/1.25 var(--sans); text-align: left; cursor: pointer; }
.m-opt.plain { grid-template-columns: minmax(0, 1fr) auto; }  /* the category list has no tick boxes: the words get the full width */
.m-opt i { width: 12px; height: 12px; border-radius: 3px; }
.m-opt i.all { border: 2px solid var(--ink-3); }
.m-opt small { display: block; font: 400 12px/1.3 var(--sans); color: var(--ink-3); margin-top: 1px; }
.m-opt b { font: 600 12px var(--mono); color: var(--ink-3); }
.m-opt:hover, .m-opt:focus-visible { background: var(--surface-2); }
.m-opt.on { background: var(--accent-soft); }
.m-opt.zero:not(.on) { opacity: 0.5; }
.m-opt.is-now span::after { content: "now"; margin-left: 8px; padding: 1px 4px; border: 1px solid var(--accent); border-radius: 4px; color: var(--accent); font: 600 9.5px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
.m-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 34px; gap: 5px; cursor: pointer; }
.m-flipback { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); font: 600 16px var(--sans); cursor: pointer; padding: 0; }
.m-ansrow { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; }
.m-ansrow > span { font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); white-space: nowrap; }
.m-totals div { background: var(--bg); border-radius: 8px; padding: 5px 6px; min-width: 0; }
.m-totals b { display: block; font: 700 17px/1.1 var(--sans); font-variant-numeric: tabular-nums; }
.m-totals b i { font: 500 11px var(--mono); color: var(--ink-3); font-style: normal; }
.m-totals div > span { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.m-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.m-tabs button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; font: 600 13px/1.15 var(--sans); color: var(--ink-2); padding: 4px; }
.m-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.m-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.m-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.m-bar select { min-height: 44px; flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 14.5px var(--sans); }
.m-bar .btn { min-height: 44px; }
.m-hint { font-size: 13px; line-height: 1.4; color: var(--ink-3); }
.m-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.m-chips::-webkit-scrollbar { display: none; }
.m-chips .chip { flex: none; min-height: 38px; padding: 6px 12px; font-size: 13px; white-space: nowrap; max-width: none; }
.m-chips .chip b { font: 600 11px var(--mono); opacity: 0.75; }
.m-chips .chip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.m-list { display: flex; flex-direction: column; gap: 10px; }
.m-morebtn { min-height: 48px; justify-content: center; font-size: 14.5px; }
.m-carousel { display: flex; gap: 10px; align-items: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -16px; padding: 2px 16px 12px; scroll-padding-inline: 16px; -webkit-overflow-scrolling: touch; }
.m-carousel .mcard { flex: 0 0 86%; scroll-snap-align: center; }

.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mcard.cur { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mcard-top { display: flex; gap: 10px; align-items: center; }
.mrank { font: 600 13px var(--mono); color: var(--ink-3); min-width: 28px; }
.mcard-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mcard-meta b { font: 700 14px/1.2 var(--sans); }
.mcard-meta span { font: 500 11px/1.3 var(--mono); color: var(--ink-3); }
.mplay { flex: none; min-height: 44px; padding: 0 14px 0 12px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font: 700 12.5px var(--sans); display: inline-flex; align-items: center; gap: 7px; }
.mq { background: var(--bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.mq p { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.mcard .quote { font-size: 17px; }
.mrel summary { min-height: 44px; display: flex; align-items: center; font-size: 14px; color: var(--accent); }
.mrel-item { background: var(--bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.mrel-item .quote { font-size: 15px; }
.mcard .play, .m-report .play { min-height: 40px; padding-right: 14px; font-size: 13px; }

.popup { position: fixed; inset: 0; z-index: 80; background: rgba(5, 8, 13, 0.74); display: flex; align-items: flex-end; justify-content: center; padding: 0 max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.popup-card { width: min(100%, 560px); max-height: 92vh; overflow-y: auto; background: var(--surface); color: var(--ink); border-radius: 16px; display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; box-shadow: var(--shadow); }
.popup-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 12px 0; }
.popup-head b { display: block; font: 700 14.5px/1.25 var(--sans); }
.popup-head span { font-size: 11.5px; color: var(--ink-3); }
.popup-head .btn, .popup .row .btn { min-height: 44px; }
.popup-quote { font: 400 15.5px/1.45 var(--serif); padding: 0 14px; max-height: 8em; overflow: auto; }
.popup .row { padding: 0 12px; }
@media (min-width: 700px) { .popup { align-items: center; } }
.popup .player-frame { width: 100%; flex: none; }
.mcard-top .mplay { white-space: nowrap; }

/* interaction grades */
.trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 8px; }
.trio > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; background: var(--bg); border-radius: 10px; padding: 9px 10px; min-width: 0; }
.trio b { display: block; font: 700 13.5px/1.2 var(--sans); }
.trio i { display: block; font-style: normal; font-size: 12.5px; line-height: 1.35; color: var(--ink-2); margin-top: 2px; }
.trio.big .grade { width: 46px; height: 46px; font-size: 20px; }

/* info sheet (the "i" on the mobile report card) */
body.sheet-open { overflow: hidden; }
.popup-card.sheet { gap: 0; padding-bottom: 0; }
.sheet-head { position: sticky; top: 0; z-index: 1; background: var(--surface); padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.sheet-head b { font-size: 16px; }
.sheet-body { padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 18px; }
.sheet-body section { display: flex; flex-direction: column; gap: 8px; }
.sheet-body h3 { font: 700 15.5px/1.25 var(--sans); }
.sheet-body p { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.sheet-body .mrel-item p { color: var(--ink); }
.sheet-body .mrel-item p.small { color: var(--ink-3); }
.sheet-body .play { min-height: 40px; padding-right: 14px; font-size: 13px; }
.sheet-rule { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; }
.sheet-rule .grade { margin-top: 2px; }
.t-grades td:not(:first-child), .t-grades th { white-space: nowrap; }
.t-grades .row { flex-wrap: nowrap; gap: 6px; }

/* one control row on every mobile deck: what the cards are narrowed to, then that deck's own control */
.m-ctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.m-scope { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; min-width: 0; flex: 1 1 180px; }
.m-scope .chip { min-height: 34px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; border: 0; }
.m-ctl select { min-height: 40px; max-width: 100%; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 13.5px var(--sans); }
.m-ctl-r { display: inline-flex; gap: 8px; align-items: center; }
.m-ctl-r .btn { min-height: 40px; }
button.linkbtn { cursor: pointer; min-height: 32px; }
.m-body .empty { padding: 28px 16px; }

/* "Download dataset": header button on every page, and its sheet */
.dl-btn { flex: none; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 7px 12px; font: 600 13px var(--sans); white-space: nowrap; cursor: pointer; }
.dl-btn:hover { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 700px) { .top-in { gap: 10px 12px; } .dl-btn { order: 1; margin-left: auto; } .search { order: 2; flex-basis: 100%; max-width: none; } }
.dl-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.dl-row > div:first-child { flex: 1 1 130px; min-width: 0; }
.dl-row b { display: block; font: 700 14.5px/1.25 var(--sans); color: var(--ink); }
.dl-row span { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.dl-row .btn { min-height: 40px; min-width: 64px; justify-content: center; }
.dl-all { min-height: 48px; justify-content: center; gap: 10px; font-size: 15px; text-decoration: none; }
.dl-all span { font: 500 12px var(--mono); opacity: 0.85; }
.dl-files summary { min-height: 44px; display: flex; align-items: center; font-size: 14px; color: var(--accent); cursor: pointer; }
.dl-file { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 2px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.dl-file b { font: 600 13px var(--mono); color: var(--accent); overflow-wrap: anywhere; }
.dl-file span { font: 500 11.5px var(--mono); color: var(--ink-3); white-space: nowrap; }
.dl-file i { grid-column: 1 / -1; font-style: normal; font-size: 12.5px; line-height: 1.4; color: var(--ink-2); }

/* the sub-grades fold away under the overall grade */
.m-sub summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.m-sub summary::-webkit-details-marker { display: none; }
.m-sub-strip { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.m-sub-strip > span { display: inline-flex; align-items: center; gap: 5px; font: 600 12.5px var(--sans); color: var(--ink-2); }
.m-sub-more { flex: none; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; position: relative; }
.m-sub-more::after { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: translate(-50%, -70%) rotate(45deg); }
.m-sub[open] .m-sub-more::after { transform: translate(-50%, -25%) rotate(225deg); }
.m-sub[open] .m-sub-strip { visibility: hidden; height: 0; }
.m-sub[open] summary { min-height: 0; height: 34px; justify-content: flex-end; }
.m-sub .m-grades { margin-top: 8px; }

/* mobile: a card opens its statement's page */
.m-carousel .mcard { cursor: pointer; }
.mcard-open { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; align-items: center; min-height: 44px; margin: 2px -14px -14px; padding: 10px 14px; border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; background: var(--surface-2); text-decoration: none; font-size: 12.5px; color: var(--ink-2); }
.mcard-open b { color: var(--accent); font: 700 13px var(--sans); }
.md { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.md-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.md-nav .btn { min-height: 40px; min-width: 40px; justify-content: center; text-decoration: none; }
.md-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.md-sec h2 { font: 700 15.5px/1.25 var(--sans); }
.md-sec h2 span { font: 600 12px var(--mono); color: var(--ink-3); margin-left: 4px; }
.md-sec p { font-size: 14.5px; line-height: 1.5; }
.md-main .quote { font-size: 19px; }
.md-sec .quote.q { font-size: 15px; color: var(--ink-2); }
.md-sec .mplay, .md-sec .row .btn { min-height: 44px; }
.md-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0; }
.md-facts > div { background: var(--bg); border-radius: 8px; padding: 7px 9px; min-width: 0; }
.md-facts dt { font: 600 10px/1.2 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.md-facts dd { margin: 3px 0 0; font: 600 13.5px/1.3 var(--sans); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.md-para { padding: 8px 10px; border-radius: 8px; border-left: 3px solid var(--line); }
.md-para.on { border-left-color: var(--accent); background: var(--accent-soft); }
.md-para p { font: 400 14.5px/1.5 var(--serif); margin-top: 3px; }
.md-foot .btn { min-height: 44px; text-decoration: none; }

/* mobile cards: the grade filter above them; cards always follow the video */
.m-carousel { position: relative; }
.m-ctl { flex-wrap: nowrap; }
.m-gf { display: flex; gap: 5px; min-width: 0; }
.gchip { display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 7px 0 5px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.gchip b { font: 600 11px var(--mono); }
.gchip .grade.sm { width: 22px; height: 22px; font-size: 12px; }
.gchip.on { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.gchip.zero:not(.on) { opacity: 0.45; }

/* a phone on its side: the video on the left, the cards stacked on the right and scrolled up and down */
@media (orientation: landscape) and (max-height: 600px) {
  body.mview .shell { display: grid; grid-template-columns: min(46%, calc((100dvh - 128px - var(--trk-h, 44px)) * 16 / 9)) minmax(0, 1fr); column-gap: 12px; row-gap: 8px; max-width: none; align-items: start; padding-block: 6px 16px; }
  body.mview .dock { grid-column: 1; grid-row: 1 / span 3; top: 4px; align-self: start; }
  body.mview .m-report { grid-column: 2; grid-row: 1; }
  body.mview .m-body { grid-column: 2; grid-row: 2; }
  body.mview .md { grid-column: 2; grid-row: 1 / span 2; }
  .m-carousel { flex-direction: column; align-items: stretch; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: y proximity; height: calc(100dvh - 58px); margin-inline: 0; padding: 2px 2px 60vh; scroll-padding: 0; }
  .m-carousel .mcard { flex: none; scroll-snap-align: start; }
  .m-menu.side { position: fixed; top: 8px; bottom: 8px; right: max(8px, env(safe-area-inset-right, 0px)); max-height: none; }
  .popup-card { max-height: 96dvh; }
}

/* the flip button: top right corner of the card, identical on both sides */
.flip { position: relative; }
.flip > .m-flipbtn { position: absolute; top: 0; right: 0; z-index: 3; width: 88px; text-align: center; }
.m-nowrow, .m-ansrow { padding-right: 96px; }
.flip-back { justify-content: flex-start; gap: 6px; }
.m-ansrow { height: 26px; flex: none; }
.m-totals { grid-template-columns: repeat(4, minmax(0, 1fr)); cursor: default; }
.m-body > .m-scope { flex: none; }
#m-resp .bar { background: var(--bg); }

/* mobile cards are all one size; longer ones are cut off with a fade and can be expanded in place */
body.mview { --card-h: clamp(320px, calc(100dvh - 400px), 470px); }
.m-carousel .mcard { height: var(--card-h); }
.m-carousel .mcard.open { height: auto; min-height: var(--card-h); }
.mcard-clip { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 10px; position: relative; }
.mcard-clip > * { flex: none; }
.mcard.over:not(.open) .mcard-clip::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 46px; background: linear-gradient(to bottom, transparent, var(--surface)); pointer-events: none; }
.mcard.open .mcard-clip { overflow: visible; }
.mcard-more { display: none; flex: none; align-self: center; min-height: 36px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 600 12.5px var(--sans); cursor: pointer; }
.mcard.over .mcard-more { display: inline-flex; align-items: center; }
.mcard-open { margin-top: auto; flex: none; }
.mcard-flag { align-self: flex-start; }
.mcard .mcard-top { flex: none; }
@media (orientation: landscape) and (max-height: 600px) { body.mview { --card-h: calc(100dvh - 70px); } }
/* the ticked values above the cards stay on one line and scroll sideways, however many there are */
.m-body > .m-scope { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.m-body > .m-scope::-webkit-scrollbar { display: none; }
.m-body > .m-scope > * { flex: none; white-space: nowrap; }

/* the one play button on a card or a statement page: play, and pause while it is the thing playing */
.mplay { min-width: 96px; justify-content: center; }
.mplay em { font-style: normal; }
.mplay span { display: inline-block; width: 14px; text-align: center; font-size: 11px; letter-spacing: -1px; }
.mplay.on { background: var(--ink); color: var(--bg); }

/* the hearing view on a laptop: the graded title in a band across the top, the video at up to two-thirds of the width
   with the timeline and dropdowns under it, and the cards in a column on the right. Everything fits one screen:
   --m-avail (set by mFit in mobile.js) is the height left under the header and the band. */
@media (orientation: landscape) and (min-height: 601px) {
  body.mview #tabs { display: none; }
  body.mview .shell { display: grid; grid-template-columns: min(66.6%, calc((var(--m-avail, 70vh) - 132px) * 16 / 9)) minmax(320px, 1fr); column-gap: 16px; row-gap: 10px; max-width: none; align-items: start; padding-block: 10px 12px; }
  body.mview .m-report { grid-column: 1 / -1; grid-row: 1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 16px; }
  body.mview .m-rhead { order: 1; gap: 12px; flex: none; }
  body.mview .m-rhead h1 { font-size: 19px; }
  body.mview .m-overall.grade { width: 46px; height: 46px; border-radius: 10px; order: -1; }
  body.mview .m-overall b { font-size: 20px; }
  body.mview .m-overall span { display: none; }
  body.mview .m-oneline { order: 2; flex: 1 1 320px; font-size: 14.5px; line-height: 1.4; }
  body.mview .m-sub { order: 3; flex: 0 1 auto; }
  body.mview .m-sub[open] { flex: 1 1 100%; }
  body.mview .m-sub .m-grades { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  body.mview .m-rtop { order: 4; flex: none; }
  body.mview .m-rtop .eyebrow { display: none; }
  body.mview .m-info { margin: 0; }
  body.mview .dock { grid-column: 1; grid-row: 2; top: 8px; align-self: start; }
  body.mview .m-body { grid-column: 2; grid-row: 2; min-width: 0; height: var(--m-avail, 70vh); }
  body.mview .md { grid-column: 2; grid-row: 2; min-width: 0; height: var(--m-avail, 70vh); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
  body.mview { --card-h: auto; }
  .m-carousel { flex: 1 1 auto; min-height: 0; flex-direction: column; align-items: stretch; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: none; margin-inline: 0; padding: 2px 4px 8px 2px; }
  .m-carousel::after { content: ""; flex: none; height: 60vh; }
  .m-carousel .mcard { flex: none; height: auto; }
  .m-carousel .mcard .mcard-clip { overflow: visible; }
  .m-body > .m-scope { margin-inline: 0; padding-inline: 0; }
  .m-menu.side { position: fixed; bottom: 12px; right: 16px; max-height: none; }
}

/* above the cards: grade filter, then the bar of how Huang has answered so far, then the card counter. Where the
   column is too narrow for all three on one line, the bar takes a thin line of its own underneath. */
.m-body { container-type: inline-size; }
.m-ctl { flex-wrap: wrap; row-gap: 6px; }
.m-ctl #m-pos { margin-left: auto; white-space: nowrap; }
.m-ans { order: 3; flex: 1 1 100%; min-width: 0; }
.m-ans .bar { height: 8px; background: var(--surface-2); }
@container (min-width: 440px) { .m-ctl { flex-wrap: nowrap; } .m-ans { order: 0; flex: 1 1 90px; } .m-ans .bar { height: 12px; } }

/* the info button stays in the top right corner of the report, folded or unfolded, in every layout */
.m-report { position: relative; }
.m-report .m-info { position: absolute; top: 6px; right: 6px; margin: 0; }
.m-rtop { padding-right: 44px; min-height: 22px; }
@media (orientation: landscape) and (min-height: 601px) {
  body.mview .m-report { padding-right: 60px; }
  body.mview .m-rtop { display: contents; }
  body.mview .m-report .m-info { top: 50%; right: 12px; transform: translateY(-50%); }
  body.mview .m-report:has(.m-sub[open]) .m-info { top: 12px; transform: none; }
}

/* the timeline's bars: hover summary above everything; click opens a panel over the cards (never over the video) */
.maptip { z-index: 90; }
.popup.beside { background: none; pointer-events: none; align-items: stretch; justify-content: flex-end; padding: 8px 12px 10px 8px; }
.popup.beside .popup-card { pointer-events: auto; width: 100%; max-width: none; max-height: none; border: 1px solid var(--line); box-shadow: 0 12px 44px rgba(0, 0, 0, 0.5); }
#mseg-body .mplay, #mseg-body .row .btn { min-height: 42px; }
#mseg-body .mplay em { white-space: nowrap; }
#mseg-body .bar { height: 12px; }
.mseg-st { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 9px 10px; border-radius: 10px; background: var(--bg); text-decoration: none; color: inherit; margin-bottom: 6px; }
.mseg-st span { font: 400 14px/1.4 var(--serif); }
.mseg-st b { display: block; font: 600 11px/1.3 var(--mono); color: var(--ink-3); margin-bottom: 2px; }
.mseg-st:hover { outline: 2px solid var(--accent); }

/* the small timecode play buttons show a pause sign while they are what is playing */
.play.on { border-color: var(--accent); background: var(--accent-soft); }
.play.on::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 1h2.2v8H2zM5.8 1H8v8H5.8z' fill='white'/%3E%3C/svg%3E"); }

/* above the cards: the bar of Huang's answers so far fills the line up to the card counter; its parts are filters */
.m-ctl { flex-wrap: nowrap; }
.m-ans { order: 0; flex: 1 1 auto; min-width: 0; }
.m-ans .bar { height: 16px; border-radius: 5px; }
.m-ans .bar button { border: 0; padding: 0; height: 100%; min-width: 8px; border-radius: 3px; cursor: pointer; }
.m-ans .bar.picked button:not(.on) { opacity: 0.28; }
.m-ans .bar button.on { outline: 2px solid var(--ink); outline-offset: 1px; }

/* sheets and panels close with a plain ✕; a panel's play button sits to the left of its title */
.sheet-x { flex: none; width: 40px; min-width: 40px; height: 40px; padding: 0; justify-content: center; font-size: 16px; border-radius: 50%; }
#mseg .sheet-head { justify-content: flex-start; gap: 10px; }
#mseg-title { flex: 1; min-width: 0; }
#mseg-play:empty { display: none; }
.mplay.icon { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; }
.mplay.icon span { width: auto; font-size: 13px; }



/* three progress bars across the full width, above the video and the cards; they stay in view while the page scrolls */
.m-trk { display: none; }
body.mview .m-trk { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 16px; padding: 4px 2px 6px; background: var(--bg); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 26; order: -2; }
body.mview .m-report { order: -3; }
body.mview .dock { top: calc(env(safe-area-inset-top, 0px) + var(--trk-h, 44px)); }
.trk { min-width: 0; }
.trk-l { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 3px; font-size: 11.5px; line-height: 1.3; color: var(--ink-3); white-space: nowrap; }
.trk-l > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.trk-l b { color: var(--ink); font-weight: 700; }
.trk-l em { font-style: normal; }
.trk-n { flex: none; font: 600 10.5px var(--mono); font-style: normal; color: var(--ink-2); }
/* each category is a progress bar, as wide as its share of the total; the bars of one group are joined end to end,
   and each carries its count ("39/102") inside it where there is room */
.trk-cats { display: flex; gap: 0; }
.cat { flex: var(--w) 1 0; min-width: 6px; }
.cat-l { display: none; }
.cat-bar { display: block; position: relative; height: 18px; overflow: hidden; background: color-mix(in srgb, var(--c) 22%, var(--surface-2)); }
.cat + .cat .cat-bar { box-shadow: inset 1px 0 0 var(--bg); }
.cat:first-child .cat-bar { border-radius: 6px 0 0 6px; }
.cat:last-child .cat-bar { border-radius: 0 6px 6px 0; }
.cat-bar u { display: block; height: 100%; width: 0; background: var(--c); text-decoration: none; transition: width 0.4s; }
.cat + .cat .cat-bar u { box-shadow: inset 1px 0 0 var(--bg); }
.cat-n { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 700 10px/1 var(--mono); white-space: nowrap; color: var(--ink); text-shadow: 0 0 2px var(--bg), 0 0 2px var(--bg), 0 0 3px var(--bg), 0 1px 2px var(--bg); pointer-events: none; }
.cat.n-none .cat-n { display: none; }
@media (prefers-reduced-motion: reduce) { .cat-bar u { transition: none; } }
/* wide screens: the name of each part above it, where it fits */
@media (min-width: 1100px) {
  .cat-l { display: block; padding: 0 3px 0 2px; font-size: 10.5px; line-height: 1.3; color: var(--ink-2); white-space: nowrap; overflow: hidden; margin-bottom: 2px; }
  .cat.l-none .cat-l { visibility: hidden; }
}
@media (max-width: 760px) { .trk-l em { display: none; } body.mview .m-trk { gap: 4px 10px; } }
/* a phone on its side */
@media (orientation: landscape) and (max-height: 600px) {
  body.mview .m-trk { grid-column: 1 / -1; grid-row: 1; top: 0; }
  body.mview .dock { grid-row: 2 / span 3; top: var(--trk-h, 44px); }
  body.mview .m-report { grid-row: 2; }
  body.mview .m-body { grid-row: 3; }
  body.mview .md { grid-row: 2 / span 2; }
  .m-carousel { height: calc(100dvh - 58px - var(--trk-h, 44px)); }
  body.mview { --card-h: calc(100dvh - 70px - var(--trk-h, 44px)); }
  .m-menu.side { top: calc(var(--trk-h, 44px) + 2px); }
}
/* a laptop: band, then the three bars, then the video and the cards */
@media (orientation: landscape) and (min-height: 601px) {
  body.mview .m-trk { grid-column: 1 / -1; grid-row: 2; position: static; padding: 0 2px 2px; }
  body.mview .dock { grid-row: 3; top: 8px; }
  body.mview .m-body, body.mview .md { grid-row: 3; }
}

/* the "card x of y" counter sits on its own line directly above the cards */
.m-ctl { min-height: 0; justify-content: flex-end; }
.m-ctl #m-pos { margin-left: auto; line-height: 1.2; }
.m-body { gap: 6px; }
.m-body > .m-ctl { flex: none; }

/* calmer progress bars: no names above the parts (they are in the hover), a plain track with a thin line in each part's
   colour along the bottom, the colour itself only where the part has filled, and the count inside */
.cat-l, .cat.l-none .cat-l { display: none !important; }
.cat-bar { background: var(--surface-2); box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--c) 70%, transparent); }
.cat + .cat .cat-bar { box-shadow: inset 1px 0 0 var(--bg), inset 0 -3px 0 color-mix(in srgb, var(--c) 70%, transparent); }
.cat-n { font-weight: 600; }
.trk-l { margin-bottom: 4px; }

/* final form of the progress bars: the whole of each part is in its colour (pale until it fills, solid where it has),
   and the count is kept for the hover */
.cat-n { display: none !important; }
.cat-bar { background: color-mix(in srgb, var(--c) 30%, var(--surface-2)); box-shadow: none; }
.cat + .cat .cat-bar { box-shadow: inset 1px 0 0 var(--bg); }

/* the two dropdown lists open over the video as a see-through grey sheet (the cards are left alone). The sheet is
   dark in both themes, like any control laid over a video, so its text colours are set here. */
.m-menu, .m-menu.side { position: absolute; right: auto; bottom: auto; max-height: none; z-index: 7; border: 0; border-radius: 12px 12px 0 0;
  background: rgba(24, 28, 36, 0.8); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); box-shadow: none; color: #f2f4f8;
  --ink: #f2f4f8; --ink-2: #d9dee7; --ink-3: #b3bbc8; --line: rgba(255, 255, 255, 0.24); --surface: rgba(255, 255, 255, 0.08); --surface-2: rgba(255, 255, 255, 0.13); --accent-soft: rgba(255, 255, 255, 0.2); --bg: #181c24; }
.m-menu .m-opt { color: var(--ink); }
.m-menu .m-box.on { background: #f2f4f8; border-color: #f2f4f8; }
.m-menu .m-box.on::after { color: #181c24; }
.m-menu .m-menu-foot .btn:not(.primary) { background: rgba(255, 255, 255, 0.1); color: var(--ink); border-color: var(--line); }
.m-menu .m-opt.is-now span::after { color: #f2f4f8; border-color: rgba(255, 255, 255, 0.6); }

/* theme switch, to the right of Download dataset */
.theme-btn { flex: none; width: 36px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; line-height: 1; cursor: pointer; }
/* the icon shows the mode a click switches to: a sun while in dark mode, a moon while in light mode */
.theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: inline; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-btn .sun { display: inline; } :root:not([data-theme="light"]) .theme-btn .moon { display: none; } }
@media (max-width: 700px) { .theme-btn { order: 1; } .dl-btn { order: 1; margin-left: auto; } }
.dl-short { display: none; }
@media (max-width: 700px) { .dl-long { display: none; } .dl-short { display: inline; } }

/* the five grades in the Overall band carry fuller names where there is room for them */
.sub-l { display: none; }
@media (min-width: 1500px) { .sub-s { display: none; } .sub-l { display: inline; } }
@media (orientation: landscape) and (min-height: 601px) { body.mview .m-oneline { flex: 1 1 280px; } }
/* the explanation after each bar's title runs onto a second line where one line is not enough */
.trk-l { white-space: normal; align-items: flex-start; }
.trk-l > span { overflow: hidden; text-overflow: clip; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.trk-n { white-space: nowrap; }
.m-trk { align-items: end; }
@media (max-height: 600px) { .trk-l em { display: none; } }  /* a phone on its side has no height to spare for them */

/* "what Huang has talked about": a button on the video (hearing view only) that opens a see-through panel over it */
.m-ovbtn, .m-ov { display: none; }
body.mview .m-ovbtn { display: grid; place-items: center; position: absolute; top: 58px; right: 10px; z-index: 4; width: 38px; height: 38px; padding: 0; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(24, 28, 36, 0.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); color: #f2f4f8; cursor: pointer; }
body.mview .m-ovbtn:hover, body.mview .m-ovbtn[aria-expanded="true"] { background: rgba(24, 28, 36, 0.92); border-color: #fff; }
body.mview .m-ov:not([hidden]) { display: flex; flex-direction: column; gap: 5px; position: absolute; top: 8px; right: 8px; z-index: 5; width: min(360px, calc(100% - 16px)); max-height: calc(100% - 16px); overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px 12px; border-radius: 12px; background: rgba(24, 28, 36, 0.8); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); color: #f2f4f8; }
.m-ov-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; align-items: center; margin-bottom: 4px; }
.m-ov-head b { font: 700 13.5px/1.25 var(--sans); }
.m-ov-head span { grid-column: 1; font-size: 11.5px; color: #b3bbc8; }
.m-ov-x { grid-column: 2; grid-row: 1 / span 2; width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.1); color: #f2f4f8; font-size: 14px; cursor: pointer; }
.m-ov-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; font-size: 12px; }
.m-ov-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-ov-row b { font: 600 10.5px var(--mono); color: #b3bbc8; }
.m-ov-row i { grid-column: 1 / -1; display: block; height: 7px; border-radius: 4px; overflow: hidden; background: color-mix(in srgb, var(--c) 32%, rgba(255, 255, 255, 0.1)); }
.m-ov-row u { display: block; height: 100%; background: var(--c); transition: width 0.4s; }
.m-ov-row span { grid-row: 1; grid-column: 1; }
.m-ov-row b { grid-row: 1; grid-column: 2; }
.m-ov-row i { grid-row: 2; }

/* the "what Huang has talked about" button: a megaphone on a solid amber button, so it stands out on the video */
body.mview .m-ovbtn { width: 42px; height: 42px; border-radius: 12px; border: 0; background: #f2a900; color: #1b1f27; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); }
body.mview .m-ovbtn:hover, body.mview .m-ovbtn[aria-expanded="true"] { background: #ffc233; border: 0; }
body.mview .m-ovbtn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* unfilled parts of the progress bars are a very pale tint of their colour, so the filled part stands out clearly */
.cat-bar { background: color-mix(in srgb, var(--c) 13%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent); }
.cat + .cat .cat-bar { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent); }
.cat + .cat .cat-bar u { box-shadow: none; }
.m-ov-row i { background: color-mix(in srgb, var(--c) 16%, rgba(255, 255, 255, 0.08)); }

/* header without a title: the mode buttons share one line with the search box, the download button and the theme switch */
.top-in { gap: 10px 12px; }
.top-in .modes { flex: 0 1 auto; min-width: 0; padding: 0; }
.top-in .search { flex: 1 1 180px; max-width: 320px; }
@media (max-width: 1500px) { .mode span { display: none; } }
@media (max-width: 700px) {
  .top-in .modes { flex: 1 1 100%; order: 0; }
  .top-in .search { order: 1; flex: 1 1 120px; max-width: none; }
  .dl-btn { order: 2; margin-left: 0; }
  .theme-btn { order: 3; }
}
body.mview #tabs { display: none; }  /* the hearing view has a single section, so its one-tab row is not shown on any screen */

/* header without the search box: mode buttons on the left, Download dataset and the theme switch on the right, one line on every screen */
.top-in .modes { flex: 1 1 auto; }
@media (max-width: 700px) { .top-in .modes { flex: 1 1 auto; order: 0; } .dl-btn { order: 2; margin-left: auto; } .mode { padding: 7px 10px; } }
@media (max-width: 700px) { .dl-short { display: none; } .dl-btn { width: 40px; height: 34px; padding: 0; text-align: center; font-size: 16px; } .top-in .modes { overflow: visible; } }  /* on a phone the download button is just the arrow, so the header stays on one line */

/* no toolbar band at the top: the header sits directly on the page background */
.top { background: transparent; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.top-in { padding-top: 8px; padding-bottom: 0; }

/* the header row is anchored to the top of the screen on every page. It has the page's own background (no white band),
   and in the hearing view the three bars and the video stick directly under it. --top-h is its height (mFit). */
.top, body.mview .top { position: sticky; top: 0; z-index: 30; background: var(--bg); }
.top-in { padding-bottom: 6px; }
body.mview .m-trk { top: calc(env(safe-area-inset-top, 0px) + var(--top-h, 44px)); }
body.mview .dock { top: calc(env(safe-area-inset-top, 0px) + var(--top-h, 44px) + var(--trk-h, 44px)); }
@media (orientation: landscape) and (max-height: 600px) {
  body.mview .shell { grid-template-columns: min(46%, calc((100dvh - 128px - var(--trk-h, 44px) - var(--top-h, 44px)) * 16 / 9)) minmax(0, 1fr); }
  body.mview .m-trk { top: var(--top-h, 44px); }
  body.mview .dock { top: calc(var(--top-h, 44px) + var(--trk-h, 44px)); }
  .m-carousel { height: calc(100dvh - 58px - var(--trk-h, 44px) - var(--top-h, 44px)); }
  body.mview { --card-h: calc(100dvh - 70px - var(--trk-h, 44px) - var(--top-h, 44px)); }
}
@media (orientation: landscape) and (min-height: 601px) { body.mview .dock { top: calc(var(--top-h, 44px) + 8px); } }

/* the Judge: choose one of the prepared claims */
.jpick { width: 100%; min-height: 46px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 15px var(--sans); }

/* the app's name, HuangJury — Jensen Under Oath: a small wordmark at the left of the header row (not on phones, where
   the row has no room for it; there the name is the browser tab's title) */
.top-in .brand { flex: none; gap: 8px; margin-right: 6px; }
.top-in .brand b { font-size: 17px; }
.top-in .brand span { display: inline; font-size: 12.5px; }
@media (max-width: 900px) { .top-in .brand { display: none; } }

/* header without the download button: the theme switch sits at the right end of the row */
.theme-btn { margin-left: auto; }

/* a phone on its side, hearing view: the video's column takes two thirds of the width and the cards one third.
   Height is the scarce thing here, so the header row and the three bars are not anchored (they scroll away) and
   the video is as large as fits with the timeline and the two dropdowns still on screen under it. */
@media (orientation: landscape) and (max-height: 600px) {
  .top, body.mview .top { position: static; }
  body.mview .m-trk { position: static; }
  body.mview .shell { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); column-gap: 10px; }
  body.mview .dock { top: 4px; }
  body.mview .player-frame { width: min(100%, calc((100dvh - 118px) * 16 / 9)); margin-inline: auto; }
  .m-carousel { height: calc(100dvh - 12px); }
  body.mview { --card-h: calc(100dvh - 24px); }
  .mcard-top { flex-wrap: wrap; }
}

/* upright phone (body.m-fill, set by mFitCards): the cards end the page, so nothing scrolls under the video. A card
   whose text is longer than the card scrolls inside itself; the fade at its foot says there is more. */
body.mview.m-fill .shell { padding-bottom: 8px; }
body.m-fill .m-carousel { padding-bottom: 12px; }
body.m-fill .m-carousel .mcard, body.m-fill .m-carousel .mcard.open { height: var(--card-h); min-height: 0; }
body.m-fill .mcard-clip, body.m-fill .mcard.open .mcard-clip { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
body.m-fill .mcard.over .mcard-clip { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent); }
body.m-fill .mcard.over:not(.open) .mcard-clip::after { display: none; }
body.m-fill .mcard-more { display: none !important; }
