/* ──────────────────────────────────────────────────────────────────────────
   Tokens. Light is the default; dark is a selected set, not a flip.
   Lab colours are the validated 8-slot categorical palette (dataviz skill),
   assigned in fixed order — colour follows the lab, never its rank.
   ────────────────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --bg-2: #ffffff;
  --ink: #17181c;
  --ink-2: #4b4d57;
  --ink-3: #7d808c;
  --rule: #e3e5ec;
  --rule-2: #cfd3dd;
  --glow: #cfe1ff;
  --accent: #2a78d6;
  --shadow: 0 8px 30px rgba(20, 30, 60, 0.10), 0 1px 3px rgba(20, 30, 60, 0.06);
  --shadow-2: 0 -12px 40px rgba(0, 0, 0, 0.10);

  --lab-openai:    #2a78d6;
  --lab-anthropic: #eb6834;
  --lab-google:    #1baf7a;
  --lab-meta:      #eda100;
  --lab-deepseek:  #e87ba4;
  --lab-zhipu:     #008300;
  --lab-xai:       #4a3aa7;
  --lab-open:      #e34948;
  --lab-context:   #8a8d99;
  --lab-biology:   #6c7080;

  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.25, 0.64, 1);
  --ease-apple: cubic-bezier(0.32, 0.72, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101115; --bg-2: #181a20; --ink: #f1f2f6; --ink-2: #b8bac6; --ink-3: #82859a;
    --rule: #262933; --rule-2: #353947; --glow: #1d2f52; --accent: #3987e5;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.4);
    --lab-openai: #3987e5; --lab-anthropic: #d95926; --lab-google: #199e70; --lab-meta: #c98500;
    --lab-deepseek: #d55181; --lab-zhipu: #008300; --lab-xai: #9085e9; --lab-open: #e66767;
    --lab-context: #7c8090; --lab-biology: #8d91a3;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101115; --bg-2: #181a20; --ink: #f1f2f6; --ink-2: #b8bac6; --ink-3: #82859a;
  --rule: #262933; --rule-2: #353947; --glow: #1d2f52; --accent: #3987e5;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.4);
  --lab-openai: #3987e5; --lab-anthropic: #d95926; --lab-google: #199e70; --lab-meta: #c98500;
  --lab-deepseek: #d55181; --lab-zhipu: #008300; --lab-xai: #9085e9; --lab-open: #e66767;
  --lab-context: #7c8090; --lab-biology: #8d91a3;
}

/* ─── Base ──────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--sans); overflow-x: hidden;
}
body.sheet-open { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.01em; }
p { margin: 0; }
[hidden] { display: none !important; }

.glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(60vw 45vh at 50% 46%, var(--glow) 0%, transparent 70%);
  /* Follows the bar up: same curve as the rise (640ms), starting a clear beat
     after it so the bar leads. The dim starts later still, so the blue does
     not fade before anything has moved. */
  opacity: 1; transition: opacity 600ms var(--ease-out) 220ms, transform 700ms var(--ease-out) 130ms;
  /* Fades up on first paint. No fill mode, so once it ends the state rule below owns opacity. */
  animation: glow-in 1800ms var(--ease-out);
}
@keyframes glow-in { from { opacity: 0; transform: scale(0.25); } }
/* Keyed to the bar's lift (set the instant you submit), not to the page state,
   which only changes after the hero has faded out. */
body.bar-up .glow { opacity: 0.55; transform: translateY(-38vh) scale(1.3); }

main { position: relative; z-index: 1; min-height: 100dvh; }
.view { animation: view-in 520ms var(--ease-out) both; }
.view.leaving { animation: view-out 380ms var(--ease-out) forwards; pointer-events: none; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes view-out { to { opacity: 0; transform: translateY(-6px); } }

/* ─── The pill ──────────────────────────────────────────────────────────── */
.pill {
  position: relative; width: 100%; display: flex; align-items: center; gap: 6px;
  height: 60px; padding: 0 10px 0 18px;
  background: var(--bg-2); border: 1px solid var(--rule); border-radius: 999px;
  box-shadow: var(--shadow);
  /* top/left/width are set by app.js per state; the transition is the rise. */
  transition: top 640ms var(--ease-out), left 640ms var(--ease-out), width 640ms var(--ease-out),
              height 640ms var(--ease-out), box-shadow 300ms;
  will-change: top, left, width;
}
/* Raised: absolutely positioned in the document (so it scrolls with the
   page), header height. Size and type ease in step with the rise. */
.pill.raised { position: absolute; z-index: 30; }
.pill.small { height: 48px; }
.pill.instant { transition: none; }
.pill-icon { color: var(--ink-3); display: grid; place-items: center; flex: 0 0 auto; margin-right: 6px; }
.pill input {
  flex: 1 1 auto; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--ink);
  font: 400 17px/1 var(--sans); outline: none;
  transition: font-size 640ms var(--ease-out);
}
.pill input::placeholder { color: var(--ink-3); }
.pill.small input { font-size: 15px; }
.pill-clear, .pill-go {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-2); transition: background 160ms, color 160ms, transform 160ms var(--ease-spring);
}
.pill-go { background: var(--ink); color: var(--bg); }
.pill-go:disabled { opacity: 0.35; cursor: default; }
.pill-go:not(:disabled):active { transform: scale(0.92); }
/* Retyping from the header: the text was cleared on focus, the caret sits where the pill is. */
body:not([data-state="search"]) .pill input { cursor: text; }
.pill-slot { height: 60px; width: min(720px, 100%); margin: 8px auto 0; }

/* ─── Search view ───────────────────────────────────────────────────────── */
#hero {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 0 16px 6vh; text-align: center;
}
.hero-title { font: 400 clamp(30px, 5vw, 46px)/1.1 var(--serif); letter-spacing: -0.015em; color: var(--ink); }
.hero-title em { font-style: italic; }
.hero-sub { max-width: 40rem; margin: 14px auto 22px; color: var(--ink-2); font-size: 16px; }
.fine { margin-top: 18px; color: var(--ink-3); font-size: 12.5px; }

/* ─── Thinking view ─────────────────────────────────────────────────────── */
#thinking {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 100px 16px 40px; text-align: center;
}
.think-status { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.think-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0.45; } }
.fact { margin: 34px auto 0; max-width: 34rem; min-height: 8rem; }
.fact blockquote {
  margin: 0; font: 400 clamp(20px, 2.6vw, 25px)/1.35 var(--serif); color: var(--ink);
  opacity: 0; transform: translateY(6px); transition: opacity 480ms var(--ease-out), transform 480ms var(--ease-out);
}
.fact blockquote.show { opacity: 1; transform: none; }

/* ─── Matched beat ──────────────────────────────────────────────────────── */
#matched {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  /* Sits a little above the thinking screen's centre line so the title
     reads as centred now that the kicker above it is gone. */
  padding: 100px 16px 60px; text-align: center;
}
.matched-kicker { color: var(--ink-3); font-size: 13px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.matched-label { margin-top: 10px; font: 400 clamp(30px, 5vw, 44px)/1.1 var(--serif); }
.matched-reason { margin-top: 14px; max-width: 36rem; color: var(--ink-2); }
.matched-actions { margin-top: 26px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
.btn { padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 500; }
.linkish { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule-2); }

/* ─── Unmappable: one line, nothing else ────────────────────────────────── */
#quip {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 100px 16px 40px; text-align: center;
}
.quip-text { max-width: 36rem; font: italic 400 clamp(24px, 3.2vw, 32px)/1.3 var(--serif); color: var(--ink); }

/* ─── Hub (index.html): suggestions under the bar ──────────────────────── */
.pill-slot { position: relative; }
/* The bar's own bottom border is the divider, edge to edge; the list below has no top border. */
.pill.open { border-radius: 30px 30px 0 0; }
/* Attached under the bar, same width. Each row's icon column lines up with
   the bar's: 18px of left padding before a 20px icon in both. */
.menu {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 31; margin: 0; padding: 8px 0 10px; list-style: none; text-align: left;
  background: var(--bg-2); border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 30px 30px; box-shadow: var(--shadow); overflow: hidden;
  animation: menu-in 220ms var(--ease-out);
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; cursor: pointer; }
.menu-item[aria-selected="true"] { background: var(--bg); }
.menu-icon { color: var(--ink-3); display: grid; place-items: center; flex: 0 0 auto; width: 20px; height: 20px; }
.menu-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.menu-name { font-size: 16px; font-weight: 500; color: var(--ink); }
.menu-blurb { font-size: 13px; color: var(--ink-3); }
.menu-blurb em { font-style: italic; }
.pill.shake { animation: shake 320ms var(--ease-out); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ─── Graph view ────────────────────────────────────────────────────────── */
#result { padding: 84px clamp(16px, 5vw, 64px) 40px; }
.result-grid {
  max-width: 1180px; margin: 0 auto; display: grid; gap: 18px;
  /* The receipts column is `auto`: 0 while the panel is hidden, so the chart
     takes the full width instead of leaving an empty 320px on the right. */
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "verdict verdict" "chart panel" "detail detail" "foot foot";
}
.verdict { grid-area: verdict; }
.chart-wrap { grid-area: chart; min-width: 0; }
.panel { grid-area: panel; }
.detail { grid-area: detail; }
.foot { grid-area: foot; }

.verdict-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.verdict-family { color: var(--ink-3); font-size: 12.5px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.verdict-label { font: 400 clamp(26px, 3.4vw, 34px)/1.15 var(--serif); }
.verdict-reason { margin-top: 6px; color: var(--ink-2); max-width: 60rem; }
.verdict-line { margin-top: 8px; font-weight: 500; }
.verdict-line b { color: var(--accent); font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 6px; font-size: 12.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer; user-select: none; transition: opacity 160ms; }
.legend-swatch { width: 14px; height: 3px; border-radius: 2px; background: currentColor; transition: background 160ms; }
.legend-item.off { opacity: 0.45; }
.legend-item.off .legend-swatch { background: var(--rule-2); }
.legend-item.off .legend-name { text-decoration: line-through; text-decoration-color: var(--ink-3); }

.chart { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 300px; max-height: 560px; }
/* The chart renders into a host layer. When the receipts panel opens, a
   second host is rendered ahead of time at the final width and crossfaded
   in, so nothing is scaled or re-laid-out at the end of the motion. */
.chart-host { position: absolute; inset: 0; transition: opacity 320ms ease; }
.chart-host svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; touch-action: pan-y; }
.chart-hint { margin-top: 8px; color: var(--ink-3); font-size: 12.5px; }

/* SVG parts */
.grid line { stroke: var(--rule); stroke-width: 1; }
.axis text { fill: var(--ink-3); font: 500 11px var(--sans); }
.axis line { stroke: var(--rule-2); }
.axis-break text { fill: var(--ink-3); font: 500 10.5px var(--sans); }
.ref line { stroke: var(--lab-biology); stroke-dasharray: 3 5; stroke-width: 1; opacity: 0.8; }
.ref text { fill: var(--ink-3); font: 500 11px var(--sans); }
.lab-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; transition: opacity 260ms; }
.lab-pt { stroke: var(--bg); stroke-width: 2; transition: opacity 260ms, r 160ms; cursor: pointer; }
.lab-hit { fill: transparent; cursor: pointer; }
.lab-label { font: 500 11.5px var(--sans); transition: opacity 260ms; pointer-events: none; }
.ctx-pt { stroke: var(--bg); stroke-width: 2; fill: var(--lab-context); cursor: pointer; }
.ctx-label { fill: var(--ink-3); font: 500 11px var(--sans); pointer-events: none; }
.selected-pt { r: 6.5; }
.dimmed { opacity: 0.22; }
.crosshair { stroke: var(--rule-2); stroke-width: 1; pointer-events: none; }
.mode-band rect { fill: url(#hatch); opacity: 0.55; }
.mode-band text { fill: var(--ink-2); font: 400 15px/1.4 var(--serif); }
.hatch-line { stroke: var(--rule-2); stroke-width: 1; }

/* lab colours by class — theme-aware for free */
.lab-openai    { color: var(--lab-openai);    stroke: var(--lab-openai);    fill: var(--lab-openai); }
.lab-anthropic { color: var(--lab-anthropic); stroke: var(--lab-anthropic); fill: var(--lab-anthropic); }
.lab-google    { color: var(--lab-google);    stroke: var(--lab-google);    fill: var(--lab-google); }
.lab-meta      { color: var(--lab-meta);      stroke: var(--lab-meta);      fill: var(--lab-meta); }
.lab-deepseek  { color: var(--lab-deepseek);  stroke: var(--lab-deepseek);  fill: var(--lab-deepseek); }
.lab-zhipu     { color: var(--lab-zhipu);     stroke: var(--lab-zhipu);     fill: var(--lab-zhipu); }
.lab-xai       { color: var(--lab-xai);       stroke: var(--lab-xai);       fill: var(--lab-xai); }
.lab-open      { color: var(--lab-open);      stroke: var(--lab-open);      fill: var(--lab-open); }
.lab-line.lab-openai, .lab-line.lab-anthropic, .lab-line.lab-google, .lab-line.lab-meta,
.lab-line.lab-deepseek, .lab-line.lab-zhipu, .lab-line.lab-xai, .lab-line.lab-open { fill: none; }
.lab-label.lab-openai, .lab-label.lab-anthropic, .lab-label.lab-google, .lab-label.lab-meta,
.lab-label.lab-deepseek, .lab-label.lab-zhipu, .lab-label.lab-xai, .lab-label.lab-open { stroke: none; }

/* Tooltip (desktop hover only) */
.tip {
  position: absolute; z-index: 5; pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity 120ms, transform 120ms; max-width: 240px;
  background: var(--bg-2); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow);
  padding: 8px 10px; font-size: 12.5px; line-height: 1.35;
}
.tip.show { opacity: 1; transform: none; }
.tip b { display: block; font-weight: 600; }
.tip .tip-meta { color: var(--ink-3); }
.tip .tip-score { font-weight: 600; margin-top: 2px; }

/* Receipts panel (desktop) */
/* The column opens by transitioning its width; the chart beside it follows
   (its grid column is `auto`) and re-renders once the motion settles. */
.panel { align-self: start; width: 0; overflow: hidden; opacity: 0;
  background: var(--bg-2); border: 1px solid var(--rule); border-radius: 14px;
  transition: width 380ms var(--ease-out), opacity 260ms ease 120ms; }
.panel.show { width: 320px; opacity: 1; }
.panel-inner { width: 320px; padding: 16px; }
.r-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.r-name { font: 400 22px/1.15 var(--serif); }
.r-score { font: 600 22px/1 var(--sans); }
.r-meta { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.r-lab { display: inline-flex; align-items: center; gap: 6px; }
.r-lab i { width: 10px; height: 10px; border-radius: 50%; background: currentColor; display: inline-block; }
.r-headline { margin-top: 10px; color: var(--ink-2); font-size: 14px; }
.r-same { margin-top: 8px; color: var(--ink-3); font-size: 12.5px; }
.panel-inner, .sheet-body { position: relative; }
.r-info { position: absolute; right: 10px; bottom: 8px; width: 28px; height: 28px; display: grid; place-items: center;
  color: var(--ink-3); border-radius: 50%; transition: color 160ms, background 160ms; }
.r-info-tip { position: absolute; right: 0; bottom: 32px; width: 220px; padding: 8px 10px; text-align: left;
  background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.4; border-radius: 8px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity 140ms, transform 140ms; }
.r-info.open .r-info-tip, .r-info:focus-visible .r-info-tip { opacity: 1; transform: none; }
.panel-inner { padding-bottom: 40px; }
.sheet-body { padding-bottom: 32px; }
.r-gate { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--rule); font-size: 13px; }
.r-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.r-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; font-size: 13px; }
/* Text wears text tokens, never the series colour; the bar beside it carries identity. */
.r-row .r-crit { font-weight: 500; color: var(--ink); }
.r-row .r-pts { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-row .r-w { color: var(--ink-3); margin-left: 6px; }
.r-row .r-note { grid-column: 1 / -1; color: var(--ink-2); font-size: 12.5px; line-height: 1.4; }
.r-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.r-bar i { display: block; height: 100%; background: currentColor; }
.r-arch { margin-top: 12px; color: var(--ink-3); font-size: 12.5px; }

/* Detail + foot */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding-top: 6px; border-top: 1px solid var(--rule); }
.detail h3 { font: 500 13px var(--sans); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); margin: 14px 0 8px; }
.detail ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink-2); }
.detail p { color: var(--ink-2); }
.thinkers { margin-top: 8px; color: var(--ink-3); font-size: 13px; }
.foot { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding-top: 12px; border-top: 1px solid var(--rule); }
.disclosure { color: var(--ink-3); font-size: 12.5px; max-width: 70rem; }

/* ─── Bottom sheet (mobile) — mechanics ported from Obsidian ───────────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.22); opacity: 0; pointer-events: none; transition: opacity 200ms ease; }
body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: -40px; z-index: 41;
  max-height: calc(75vh + 40px);
  background: var(--bg-2); border-top: 1px solid var(--rule); border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow-2); padding: 6px 16px 60px; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 460ms var(--ease-spring), max-height 380ms cubic-bezier(0.22, 1, 0.36, 1);
  touch-action: pan-y; overscroll-behavior: contain; will-change: transform;
}
body.sheet-open .sheet { transform: translateY(0); }
body.sheet-open.sheet-expanded .sheet { max-height: calc(100vh + 40px); }
.sheet.dragging { transition: none; }
.sheet.closing { transition: transform 520ms var(--ease-apple) !important; }
.sheet-grabber { width: 100%; padding: 10px 0 8px; display: flex; justify-content: center; cursor: grab; touch-action: none; }
.sheet-grabber:active { cursor: grabbing; }
.sheet-grabber span { display: block; width: 40px; height: 4px; background: var(--rule-2); border-radius: 2px; transition: background 160ms; }
.sheet.dragging .sheet-grabber span { background: var(--ink-3); }
.sheet-body { padding-top: 4px; }
@media (min-width: 861px) { .sheet, .sheet-backdrop { display: none; } }

/* ─── Criteria table ────────────────────────────────────────────────── */
.inline-link { padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: var(--rule-2); cursor: pointer; }
.crit-dialog { width: min(760px, calc(100vw - 32px)); max-height: min(82vh, 820px); padding: 0; border: 1px solid var(--rule);
  border-radius: 16px; background: var(--bg-2); color: var(--ink); box-shadow: var(--shadow); overflow: hidden; }
.crit-dialog[open] { display: flex; flex-direction: column; animation: crit-in 260ms var(--ease-out); }
.crit-dialog::backdrop { background: rgba(0, 0, 0, 0.28); animation: fade-in 200ms ease; }
@keyframes crit-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
@keyframes fade-in { from { opacity: 0; } }
.crit-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 8px; }
.crit-title { font: 400 26px/1.1 var(--serif); }
.crit-close { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.crit-cols { display: grid; grid-template-columns: 38% 1fr; padding: 10px 22px 8px; border-bottom: 1px solid var(--rule);
  font: 500 12px var(--sans); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.crit-cols span:first-child { padding-right: 16px; }
.crit-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 22px 18px; }
/* In the dialog the fixed labels above replace the table's own header row. */
.crit-dialog .crit-table thead { display: none; }
.crit-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.crit-table thead th { text-align: left; padding: 10px 0 8px;
  font: 500 12px var(--sans); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--rule); }
.crit-table th.crit-sec { padding: 16px 0 6px; text-align: left; font: 600 11.5px var(--sans); letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--accent); border-bottom: 1px solid var(--rule); }
.crit-table td { padding: 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.crit-table td.crit-name { width: 38%; padding-right: 16px; font-weight: 500; color: var(--ink); }
.crit-table td.crit-desc { color: var(--ink-2); }
.crit-note { margin-top: 14px; color: var(--ink-3); font-size: 12.5px; }
.sheet-body .crit-table { font-size: 13.5px; }
.sheet-body .crit-title { margin: 2px 0 6px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow); }

/* ─── Hover — desktop only, never lingers on touch ─────────────────────── */
@media (hover: hover) and (pointer: fine) {
  .pill-clear:hover { background: var(--rule); }
  .pill-go:not(:disabled):hover { transform: scale(1.05); }
  .inline-link:hover { text-decoration-color: var(--ink); }
  .crit-close:hover { background: var(--rule); }
  .linkish:hover { color: var(--ink); text-decoration-color: var(--ink); }
  .btn:hover { opacity: 0.9; }
  .r-info:hover { color: var(--ink); background: var(--rule); }
  .r-info:hover .r-info-tip { opacity: 1; transform: none; }
  .lab-pt:hover { r: 6.5; }
  .ctx-pt:hover { r: 6.5; }
  .legend-item:hover { opacity: 0.75; }
  .legend-item.off:hover { opacity: 0.6; }
}

/* ─── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .result-grid { grid-template-columns: 1fr; grid-template-areas: "verdict" "chart" "detail" "foot"; gap: 16px; }
  .panel { display: none; }
  .detail { grid-template-columns: 1fr; gap: 8px; }
  #result { padding-top: 76px; }
  .chart { aspect-ratio: 4 / 3; min-height: 260px; }
  .chart-hint { display: none; }
  .verdict-label { font-size: 26px; }
  .verdict-reason { font-size: 15px; line-height: 1.4; }
  .verdict-line { font-size: 15.5px; line-height: 1.4; }
  .detail ul, .detail p { font-size: 15px; line-height: 1.45; }
  .hero-sub { font-size: 15px; }
}

/* ─── Reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
