/* Scout: no external fonts or frameworks (keeps the CSP tight). */

:root {
  --bg: #f6f7f8;
  --bg-2: #eef0f2;
  --surface: #ffffff;
  --surface-2: #f6f7f8;
  --border: #e1e4e8;
  --border-strong: #c9ced4;
  --text: #16191d;
  --text-2: #4b535c;
  --text-3: #646c76;
  --mixed: #8a5a00;
  --accent: #1f5fcc;
  --accent-2: #1f5fcc;
  --accent-ink: #ffffff;
  --accent-soft: #e8effb;
  --marker: #fff0a6;
  --marker-ink: #16191d;
  --ink: #16191d;
  --ink-text: #ffffff;
  --pos: #1a7f37;
  --pos-soft: #e6f4ea;
  --neg: #c62828;
  --neg-soft: #fdecea;
  --focus: #1f5fcc;
  --bar: #59626c;
  --shadow: none;
  --shadow-lg: none;
  --radius: 8px;
  /* Type scale (16px base, ~1.125–1.25 steps) */
  --text-2xs: .75rem;    /* 12 */
  --text-xs: .8125rem;   /* 13 */
  --text-sm: .875rem;    /* 14 */
  --text-md: .9375rem;   /* 15 */
  --text-base: 1rem;     /* 16 */
  --text-lg: 1.125rem;   /* 18 */
  --text-xl: 1.25rem;    /* 20 */
  --text-2xl: 1.5rem;    /* 24 */
  --text-3xl: 2rem;      /* 32 */
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --radius-sm: 6px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --serif: var(--font); /* one typeface throughout */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0f1114;
  --bg-2: #16191d;
  --surface: #16191d;
  --surface-2: #1c2025;
  --border: #2a2f36;
  --border-strong: #3b424b;
  --text: #e6e8eb;
  --text-2: #adb4bd;
  --text-3: #858d97;
  --mixed: #e0a63a;
  --accent: #78a6ff;
  --accent-2: #78a6ff;
  --accent-ink: #0f1114;
  --accent-soft: #1a2740;
  --marker: #5a4c10;
  --marker-ink: #f6f1d8;
  --ink: #e6e8eb;
  --ink-text: #0f1114;
  --pos: #4cc06d;
  --pos-soft: #14271b;
  --neg: #f2706a;
  --neg-soft: #2d1615;
  --focus: #78a6ff;
  --bar: #9aa2ac;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1114;
  --bg-2: #16191d;
  --surface: #16191d;
  --surface-2: #1c2025;
  --border: #2a2f36;
  --border-strong: #3b424b;
  --text: #e6e8eb;
  --text-2: #adb4bd;
  --text-3: #858d97;
  --mixed: #e0a63a;
  --accent: #78a6ff;
  --accent-2: #78a6ff;
  --accent-ink: #0f1114;
  --accent-soft: #1a2740;
  --marker: #5a4c10;
  --marker-ink: #f6f1d8;
  --ink: #e6e8eb;
  --ink-text: #0f1114;
  --pos: #4cc06d;
  --pos-soft: #14271b;
  --neg: #f2706a;
  --neg-soft: #2d1615;
  --focus: #78a6ff;
  --bar: #9aa2ac;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--text-base)/var(--leading-normal) var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); padding: .08em .35em; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--text-2); }
.small { font-size: var(--text-sm); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, calc((100vw - 1120px) / 2));
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.topnav { display: flex; align-items: center; gap: 4px; }
.link-btn {
  background: none; border: 0; color: var(--text-2); font: inherit; font-size: var(--text-md); font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.link-btn:hover { color: var(--text); background: var(--surface-2); }
.count { background: var(--accent); color: var(--accent-ink); font-size: var(--text-2xs); font-weight: 700; padding: 1px 7px; border-radius: var(--radius-sm); }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 0; background: none; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }

/* ---------- Layout ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 0 16px 64px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3.5vw, 32px);
  margin-top: 20px;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } html { scroll-behavior: auto; } }

/* ---------- Hero ---------- */
.hero { padding: clamp(40px, 9vw, 96px) 0 12px; text-align: center; }
.eyebrow { margin: 0 0 12px; font-size: var(--text-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.hero h1 { margin: 0 auto; max-width: 18ch; font-size: clamp(var(--text-2xl), 3.4vw, var(--text-3xl)); line-height: var(--leading-tight); letter-spacing: -.02em; font-weight: 700; text-wrap: balance; }
.hero h1 br { display: none; }
@media (min-width: 760px) { .hero h1 { max-width: none; } .hero h1 br { display: inline; } }

.lede { max-width: 640px; margin: 20px auto 0; color: var(--text-2); font-size: var(--text-base); text-wrap: pretty; }

.lookup {
  display: flex; gap: 8px; max-width: 720px; margin: 32px auto 0;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px; box-shadow: var(--shadow-lg);
  transition: border-color .15s, box-shadow .15s;
}
.lookup:focus-within { border-color: var(--accent); box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-soft); }
.lookup-field { flex: 1; display: flex; align-items: center; gap: 10px; padding-left: 14px; color: var(--text-3); min-width: 0; }
.lookup input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; padding: 10px 0; outline: none; }
.lookup input::placeholder { color: var(--text-3); }
.lookup .btn { border-radius: var(--radius-sm); }
@media (max-width: 560px) {
  .lookup { flex-direction: column; border-radius: 20px; padding: 8px; }
  .lookup-field { padding: 2px 8px; }
  .lookup .btn { width: 100%; justify-content: center; }
}
.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; list-style: none; padding: 0; margin: 20px 0 0; color: var(--text-2); font-size: var(--text-md); }
.trust li { display: inline-flex; align-items: center; gap: 6px; }
.trust svg { width: 16px; height: 16px; color: var(--pos); stroke-width: 2.6; }

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: inherit; font-weight: 600; font-size: var(--text-md); letter-spacing: -.005em;
  padding: 11px 20px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s, opacity .15s; white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: var(--ink-text); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border-strong); }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--accent-ink); border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 6px; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); min-width: 0; border: 0; padding: 0; margin: 0; }
.field.grow { flex: 1; }
.field legend { padding: 0; margin-bottom: 6px; }
select, .field input[type="text"], .key-input {
  font: inherit; font-size: var(--text-md); font-weight: 500; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: 44px; width: 100%;
}
select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
select:focus, .field input:focus, .key-input:focus-within { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.key-input { display: flex; align-items: center; padding: 0 4px 0 12px; }
.key-input input { flex: 1; border: 0; background: none; font: inherit; font-family: var(--mono); font-size: var(--text-md); color: var(--text); padding: 10px 0; outline: none; min-width: 0; }
.hint { font-weight: 500; color: var(--text-3); }
.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: var(--text-md); color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; min-height: 44px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: var(--text-md); color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.seg input:checked + label { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg input:focus-visible + label { outline: 2px solid var(--focus); }

/* ---------- Game card ---------- */
.game { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 24px; align-items: center; padding: 16px; }
.game-art { width: 100%; height: auto; aspect-ratio: 460 / 215; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }
.game-body { padding: 4px 8px 4px 0; min-width: 0; }
.game-name { margin: 0; font-size: clamp(var(--text-xl), 3vw, var(--text-2xl)); letter-spacing: -.02em; line-height: var(--leading-tight); }
.game-meta { margin: 6px 0 0; color: var(--text-3); font-size: var(--text-md); }
.game-desc { margin: 10px 0 0; color: var(--text-2); font-size: var(--text-md); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.game-score { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 14px; font-size: var(--text-md); color: var(--text-2); }
.score-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; padding: 4px 12px; border-radius: var(--radius-sm); background: var(--pos-soft); color: var(--pos); }
.score-pill.mixed { background: color-mix(in oklab, var(--mixed) 14%, transparent); color: var(--mixed); }
.score-pill.bad { background: var(--neg-soft); color: var(--neg); }
.ratio { flex: 1 1 160px; max-width: 260px; height: 8px; border-radius: var(--radius-sm); background: var(--neg-soft); overflow: hidden; }
.ratio span { display: block; height: 100%; background: var(--pos); border-radius: var(--radius-sm); }
@media (max-width: 680px) { .game { grid-template-columns: 1fr; gap: 14px; } .game-body { padding: 0 6px 6px; } }

/* ---------- Steps ---------- */
.step-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.step-head h2 { margin: 2px 0 4px; font-size: var(--text-xl); letter-spacing: -.015em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-head p { margin: 0; font-size: var(--text-md); max-width: 70ch; }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: var(--radius); display: grid; place-items: center;
  font-weight: 700; color: var(--accent); background: var(--accent-soft);
}
.pill { font-size: var(--text-2xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.options { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; }
.options > .field { flex: 1 1 180px; }
.options > .segmented { flex: 0 1 auto; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 22px; }
.form-error { margin: 14px 0 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--neg-soft); color: var(--neg); font-size: var(--text-md); font-weight: 500; }
.hero .form-error { max-width: 720px; margin: 14px auto 0; }

.progress { margin-top: 20px; }
.bar { height: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--bar); border-radius: var(--radius-sm); transition: width .3s; }
.bar.indeterminate span { width: 30% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.progress-text { margin: 8px 0 0; font-size: var(--text-md); color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- Results ---------- */
.results { margin-top: 26px; border-top: 1px solid var(--border); padding-top: 26px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 1040px) { .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); } .stat-value { font-size: var(--text-2xl); } }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat-value { font-size: var(--text-xl); } }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: var(--text-2xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: var(--text-xs); color: var(--text-2); }
.stat.pos .stat-value { color: var(--pos); }
.stat.neg .stat-value { color: var(--neg); }

.charts { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 760px) { .charts { grid-template-columns: 1fr; } }
.chart { margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.chart figcaption { font-weight: 700; font-size: var(--text-md); margin-bottom: 12px; }
.hbars, .lbars { display: grid; gap: 7px; }
.hrow, .lrow { display: grid; grid-template-columns: 64px 1fr 44px; gap: 10px; align-items: center; font-size: var(--text-xs); color: var(--text-2); font-variant-numeric: tabular-nums; }
.lrow { grid-template-columns: 110px 1fr 44px; }
.hrow .num, .lrow .num { text-align: right; }
.track { display: flex; height: 12px; border-radius: 4px; overflow: hidden; background: color-mix(in oklab, var(--border) 50%, transparent); }
.track .p { background: var(--pos); }
.track .n { background: var(--neg); }
.track .l { background: var(--bar); border-radius: 4px; }
.legend { display: flex; gap: 6px 14px; align-items: center; margin-top: 12px; font-size: var(--text-xs); color: var(--text-2); flex-wrap: wrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: -8px; }
.sw.pos { background: var(--pos); }
.sw.neg { background: var(--neg); }

.download-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-top: 22px; }

.preview { margin-top: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.preview summary, .security summary, .advanced summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
.preview summary { padding: 14px 16px; }
.preview summary::-webkit-details-marker, .security summary::-webkit-details-marker, .advanced summary::-webkit-details-marker { display: none; }
.preview summary::before, .advanced summary::before, .security summary::after {
  content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; opacity: .6;
}
.security summary::after { margin: 0 0 0 auto; }
details[open] > summary::before, .security[open] summary::after { transform: rotate(45deg); }
.preview-list { display: grid; gap: 10px; padding: 0 16px 16px; max-height: 520px; overflow: auto; }
.review { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.review-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: var(--text-xs); color: var(--text-3); margin-bottom: 6px; }
.tag { font-weight: 700; font-size: var(--text-2xs); padding: 2px 8px; border-radius: var(--radius-sm); }
.tag.pos { background: var(--pos-soft); color: var(--pos); }
.tag.neg { background: var(--neg-soft); color: var(--neg); }
.review p { margin: 0; font-size: var(--text-md); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- AI step ---------- */
.key-row { display: flex; gap: 12px; }
.security { margin: 18px 0; border: 1px solid color-mix(in oklab, var(--pos) 35%, var(--border)); background: color-mix(in oklab, var(--pos-soft) 55%, var(--surface)); border-radius: var(--radius); padding: 12px 16px; font-size: var(--text-md); }
.security summary svg { color: var(--pos); width: 18px; height: 18px; }
.security ul { margin: 12px 0 4px; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); }
.security strong { color: var(--text); }
.advanced { flex: 1 1 220px; align-self: center; }
.advanced summary { font-size: var(--text-sm); color: var(--text-2); padding: 12px 0; }
.advanced[open] { display: grid; gap: 10px; }
.estimate { margin: 12px 0 0; }

.batches { margin-top: 20px; }
.batch-grid { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; }
.batch {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2);
  font-size: var(--text-xs); color: var(--text-2); display: grid; gap: 2px; font-variant-numeric: tabular-nums;
}
.batch b { font-size: var(--text-sm); color: var(--text); }
.batch.running { border-color: var(--accent); background: var(--accent-soft); }
.batch.done, .batch.reused { border-color: color-mix(in oklab, var(--pos) 45%, var(--border)); }
.batch.done b::after, .batch.reused b::after { content: " ✓"; color: var(--pos); }
.batch.failed { border-color: var(--neg); background: var(--neg-soft); }
.batch.report { grid-column: 1 / -1; }

/* ---------- Report ---------- */
.report-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.report-head h2 { margin: 0; font-size: clamp(var(--text-xl), 3vw, var(--text-2xl)); letter-spacing: -.02em; line-height: var(--leading-tight); }
.report-head .eyebrow { margin-bottom: 6px; }
.report-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.report-tools .btn { padding: 9px 14px; font-size: var(--text-sm); }
.report-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; margin-top: 24px; }
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; font-size: var(--text-sm); display: grid; gap: 2px; }
/* Narrow screens: the contents become a plain list at the top of the report (must come after .toc). */
@media (max-width: 900px) {
  .report-layout { grid-template-columns: 1fr; gap: 16px; }
  .toc { position: static; max-height: none; overflow: visible; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
}
.toc a { color: var(--text-2); text-decoration: none; padding: 5px 10px; border-radius: 8px; border-left: 2px solid transparent; }
.toc a:hover { color: var(--text); background: var(--surface-2); }
.toc a.sub { padding-left: 22px; font-size: var(--text-xs); color: var(--text-3); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }

.prose { font-size: var(--text-base); line-height: var(--leading-relaxed); overflow-wrap: break-word; min-width: 0; }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: var(--text-2xl); letter-spacing: -.02em; margin: 1.6em 0 .5em; }
.prose h2 { font-size: var(--text-2xl); letter-spacing: -.015em; margin: 2em 0 .6em; padding-top: 1.2em; border-top: 1px solid var(--border); scroll-margin-top: 84px; }
.prose h3 { font-size: var(--text-lg); margin: 1.6em 0 .4em; scroll-margin-top: 84px; }
.prose h4 { font-size: var(--text-base); margin: 1.4em 0 .3em; }
.prose p, .prose ul, .prose ol { margin: .7em 0; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--text-3); }
.prose strong { font-weight: 700; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose blockquote { margin: 1em 0; padding: .2em 1.1em; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--text-2); }
.prose pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow: auto; font-size: var(--text-sm); }
.prose pre code { background: none; border: 0; padding: 0; }
.table-wrap { overflow-x: auto; margin: 1em 0; border: 1px solid var(--border); border-radius: var(--radius); }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); line-height: var(--leading-normal); }
.prose th, .prose td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose th { background: var(--surface-2); font-weight: 700; white-space: nowrap; position: sticky; top: 0; }
.prose tr:last-child td { border-bottom: 0; }
.prose td:first-child { font-variant-numeric: tabular-nums; color: var(--text-3); }
.prose.streaming::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- History drawer ---------- */
.drawer {
  margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(440px, 100vw); border: 0; padding: 22px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.drawer::backdrop { background: rgb(0 0 0 / 35%); backdrop-filter: blur(2px); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { margin: 0; font-size: var(--text-xl); }
.history-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.history-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 4px; background: var(--surface-2); }
.history-item .name { font-weight: 700; }
.history-item .meta { font-size: var(--text-xs); color: var(--text-3); }
.history-item .row { display: flex; gap: 8px; margin-top: 6px; }
.history-item .btn { padding: 6px 12px; font-size: var(--text-xs); border-radius: 8px; }
.empty { color: var(--text-3); text-align: center; padding: 40px 10px; }

/* ---------- Footer & toast ---------- */
.footer { max-width: 1120px; margin: 0 auto; padding: 24px 16px 40px; color: var(--text-3); font-size: var(--text-xs); text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 600; font-size: var(--text-md);
  box-shadow: var(--shadow-lg);
}

@media print {
  .topbar, .hero, #step-fetch, #step-ai, .game, .report-tools, .toc, .footer { display: none !important; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .report-layout { display: block; }
  body { background: #fff; color: #000; }
}

/* ======================================================================
   Multi-tool additions
   ====================================================================== */

/* ---------- Tabs ---------- */
.topbar { flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.tab {
  color: var(--text-2); text-decoration: none; font-weight: 600; font-size: var(--text-md);
  padding: 7px 16px; border-radius: var(--radius-sm); white-space: nowrap; transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (max-width: 760px) {
  .tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; justify-content: space-between; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1; text-align: center; padding: 7px 10px; }
  .link-btn .label-long { display: none; }
}

/* ---------- Tool hero ---------- */
.tool-hero { padding: clamp(32px, 6vw, 64px) 0 4px; max-width: 760px; }
.tool-hero h1 { margin: 0; font-size: clamp(var(--text-2xl), 3.4vw, var(--text-3xl)); line-height: var(--leading-tight); letter-spacing: -.02em; font-weight: 700; text-wrap: balance; }
.tool-hero .lede { margin: 14px 0 0; text-align: left; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 520px) { .form-grid .span-2 { grid-column: auto; } }
.mt { margin-top: 16px; }
.opt { font-style: normal; font-weight: 500; color: var(--text-3); }
.field input[type="number"], .field textarea {
  font: inherit; font-size: var(--text-md); font-weight: 500; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: 44px; width: 100%;
}
.field textarea { font-family: var(--mono); font-size: var(--text-sm); line-height: var(--leading-relaxed); resize: vertical; }
.field input[type="number"]:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.affix { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 44px; }
.affix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.affix > span { padding: 0 0 0 12px; color: var(--text-3); font-weight: 600; }
.affix.suffix > span { padding: 0 12px 0 0; }
.field .affix input { border: 0 !important; box-shadow: none !important; background: none; min-height: 42px; }
.field .affix.suffix input { text-align: right; padding-right: 4px; }
input[type="number"] { -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
input[type="number"]::-webkit-inner-spin-button { opacity: .5; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: var(--text-xs); font-weight: 600;
  padding: 6px 12px; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); background: none; color: var(--text-2); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.seg-lg { display: flex; width: 100%; max-width: 560px; margin-bottom: 20px; }
.seg-lg label { flex: 1; padding: 10px 12px; }
@media (max-width: 520px) { .seg-lg label { font-size: var(--text-xs); padding: 8px 6px; } }

.lookup-inline { display: flex; gap: 8px; margin-bottom: 18px; }
.lookup-inline input {
  flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px;
}
.lookup-inline input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.assumptions { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.assumptions:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.assumptions > summary { cursor: pointer; font-weight: 700; font-size: var(--text-md); list-style: none; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.assumptions > summary::-webkit-details-marker { display: none; }
.assumptions > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; opacity: .6; margin-right: 4px; }
.assumptions[open] > summary::before { transform: rotate(45deg); }

/* ---------- Generic sections ---------- */
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.section-head h2, .card-title { margin: 0; font-size: var(--text-lg); letter-spacing: -.01em; }
.card-title { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; }
.grid-2 .span-all { grid-column: 1 / -1; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1040px) { .stats.stats-3 .stat-value { font-size: var(--text-3xl); } }
@media (max-width: 560px) { .stats.stats-3 { grid-template-columns: 1fr; } }
.stat.accent .stat-value { color: var(--accent); }

/* ---------- Data tables ---------- */
table.data { border-collapse: collapse; width: 100%; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
table.data thead th { background: var(--surface-2); font-weight: 700; color: var(--text-2); font-size: var(--text-xs); position: sticky; top: 0; }
table.data thead th:first-child { background: var(--surface-2); z-index: 1; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data td.strong { font-weight: 700; color: var(--text); }
table.data td.dim { color: var(--text-3); }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--border-strong); border-bottom: 0; }
.cmp-up { color: var(--neg); font-weight: 600; }
.cmp-down { color: var(--pos); font-weight: 600; }
.tier { font-size: var(--text-2xs); font-weight: 700; padding: 2px 8px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); }
.mini-bar { display: inline-block; width: 60px; height: 6px; border-radius: var(--radius-sm); background: var(--border); vertical-align: middle; margin-right: 8px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--accent); }

.game-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.game-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--text-xs); font-weight: 600; }
.game-chip img { width: 46px; height: 22px; object-fit: cover; border-radius: var(--radius-sm); }
.game-chip.own { border-color: var(--accent); }
.game-chip.bad { opacity: .55; text-decoration: line-through; }

/* ---------- Revenue ---------- */
.keep { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 18px; }
.keep-value { font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 700; letter-spacing: -.02em; color: var(--accent); line-height: 1; }
.keep-label { color: var(--text-2); font-size: var(--text-base); }
.waterfall { display: grid; gap: 8px; }
.wf-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) 84px; gap: 12px; align-items: center; font-size: var(--text-sm); }
.wf-row .lbl { color: var(--text-2); }
.wf-row .amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.wf-track { position: relative; height: 22px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.wf-track .kept { position: absolute; inset: 0 auto 0 0; background: var(--bar); border-radius: 6px; }
.wf-track .lost { position: absolute; top: 0; bottom: 0; background: var(--neg-soft); border-left: 2px solid var(--neg); }
.wf-row.final .lbl { color: var(--text); font-weight: 700; }
@media (max-width: 560px) { .wf-row { grid-template-columns: 1fr 72px; } .wf-track { grid-column: 1 / -1; grid-row: 2; } }

.cols { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 8px; border-bottom: 1px solid var(--border); }
.col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.col .b { width: 100%; max-width: 44px; border-radius: 6px 6px 0 0; background: var(--bar); min-height: 2px; }
.col .b.sale { background: var(--accent); }
.col-labels { display: flex; gap: 6px; margin-top: 6px; }
.col-labels span { flex: 1; text-align: center; font-size: var(--text-2xs); color: var(--text-3); min-width: 0; overflow: hidden; }
.scenarios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .scenarios { grid-template-columns: 1fr; } }
.scenario { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface-2); }
.scenario.mid { border-color: var(--accent); background: color-mix(in oklab, var(--accent-soft) 45%, var(--surface)); }
.scenario h3 { margin: 0 0 6px; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.scenario .big { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -.02em; }
.scenario dl { display: grid; grid-template-columns: auto auto; gap: 4px 12px; margin: 10px 0 0; font-size: var(--text-sm); }
.scenario dt { color: var(--text-2); }
.scenario dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.est-game { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: center; margin-bottom: 18px; }
.est-game img { width: 100%; border-radius: var(--radius); }
.est-game h3 { margin: 0; font-size: var(--text-xl); }
@media (max-width: 560px) { .est-game { grid-template-columns: 1fr; } }

/* ---------- Hardware ---------- */
.gpu-list { display: grid; gap: 6px; }
.gpu-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: var(--text-sm); padding: 6px 8px; border-radius: 8px; }
.gpu-row:nth-child(odd) { background: var(--surface-2); }
.gpu-row .ok { color: var(--pos); font-weight: 700; }
.gpu-row .no { color: var(--neg); font-weight: 700; }
.gpu-row .unk { color: var(--text-3); }
.gpu-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gpu-row .score, .gpu-row .share { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: var(--text-xs); }
.lrow.meets .l { background: var(--pos); }
.lrow.below .l { background: color-mix(in oklab, var(--text-3) 50%, transparent); }
.label-short { display: none; }
@media (max-width: 760px) { .label-short { display: block; } }
.chart-pair { display: grid; grid-template-columns: 3fr 1fr; gap: 24px; }
.chart-group { margin: 0; min-width: 0; }
.chart-group figcaption { font-size: var(--text-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
@media (max-width: 560px) { .chart-pair { grid-template-columns: 1fr; } }

/* ======================================================================
   Trends, Explore, Ask, Compare, cache, print
   ====================================================================== */
.link-inline { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cache-note { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.drawer-sub { font-size: var(--text-base); margin: 28px 0 4px; }

.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.subtab {
  font: inherit; font-weight: 600; font-size: var(--text-md); color: var(--text-2); background: none; border: 0;
  padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap;
}
.subtab:hover { color: var(--text); }
.subtab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* Trends */
.trend-wrap { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 8px 4px; margin-top: 12px; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-svg .grid { stroke: var(--border); stroke-width: 1; }
.trend-svg .axis { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.trend-svg .vol-pos { fill: color-mix(in oklab, var(--pos) 55%, transparent); }
.trend-svg .vol-neg { fill: color-mix(in oklab, var(--neg) 55%, transparent); }
.trend-svg .pct-line { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; }
.trend-svg .pct-dot { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
.trend-svg .upd line { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3; }
.trend-svg .upd circle { fill: var(--accent); }
.trend-svg .upd:hover line { stroke-width: 3; }
table.data td.wrap { white-space: normal; min-width: 220px; max-width: 420px; }

/* Explore */
.terms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .terms-grid { grid-template-columns: 1fr; } }
.terms { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.terms h4 { margin: 0 0 10px; font-size: var(--text-md); }
.terms.neg h4 { color: var(--neg); }
.terms.pos h4 { color: var(--pos); }
.term-list { display: flex; flex-wrap: wrap; gap: 6px; }
.term {
  font: inherit; font-size: var(--text-sm); font-weight: 600; padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-flex; gap: 6px; align-items: center;
}
.term span { font-size: var(--text-2xs); color: var(--text-3); font-weight: 600; }
.terms.neg .term:hover { border-color: var(--neg); }
.terms.pos .term:hover { border-color: var(--pos); }
.explore-filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 8px; margin: 18px 0 8px; }
.explore-filters input {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px;
}
.explore-filters input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 760px) { .explore-filters { grid-template-columns: 1fr 1fr; } .explore-filters input { grid-column: 1 / -1; } }
.explore-list { padding: 0; max-height: none; }
.review p.full { -webkit-line-clamp: unset; display: block; max-height: 18em; overflow: auto; }
mark { background: color-mix(in oklab, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Ask */
.ask { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.ask h3 { margin: 0 0 4px; font-size: var(--text-lg); }
.ask-form { display: flex; gap: 8px; margin-top: 12px; }
.ask-form input {
  flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px;
}
.ask-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask-answer { margin-top: 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.ask-answer .prose { font-size: var(--text-md); }
.ask-answer .preview { background: var(--surface); }
.cite {
  font: inherit; font-size: var(--text-2xs); font-weight: 700; padding: 1px 6px; border-radius: 6px; cursor: pointer; vertical-align: 1px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-variant-numeric: tabular-nums;
}
.cite:hover { border-color: var(--accent); color: var(--accent); }
.review.flash { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.strong { border-style: solid; border-color: var(--accent); color: var(--accent); }
.chip-meta { color: var(--text-3); font-weight: 500; }

/* Compare */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 12px; }
.pick {
  display: grid; grid-template-columns: auto 92px 1fr; gap: 10px; align-items: center; padding: 8px 10px 8px 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); transition: border-color .15s, background .15s;
}
.pick:hover { border-color: var(--border-strong); }
.pick.on { border-color: var(--accent); background: color-mix(in oklab, var(--accent-soft) 40%, var(--surface)); }
.pick.seed { box-shadow: inset 3px 0 0 var(--accent); }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.pick img, .pick .noimg { width: 92px; height: 43px; object-fit: cover; border-radius: 6px; background: var(--border); }
.pick-body { display: grid; gap: 2px; min-width: 0; }
.pick-name { font-weight: 700; font-size: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-meta { font-size: var(--text-2xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-pill.sm { font-size: var(--text-2xs); padding: 1px 7px; }
.cmp-progress { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 6px; }
.cmp-progress:empty { display: none; }
.cmp-progress li {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: var(--text-sm);
}
.cmp-progress img { width: 64px; height: 30px; object-fit: cover; border-radius: 5px; }
.cmp-progress .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-progress .st { color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; }
.cmp-progress li.running { border-color: var(--accent); background: var(--accent-soft); }
.cmp-progress li.done .st::after { content: " ✓"; color: var(--pos); }
.cmp-progress li.failed { border-color: var(--neg); background: var(--neg-soft); }
.step-num.ai { font-size: var(--text-2xs); }

/* Print / PDF: only the report, with a cover page */
.print-cover { display: none; }
@media print {
  @page { margin: 16mm 14mm; }
  body.printing-report main > :not(#report), body.printing-report .footer, body.printing-report .topbar { display: none !important; }
  body.printing-report #report { display: block !important; margin: 0; }
  #report .report-head, #report .toc { display: none !important; }
  .print-cover {
    display: flex !important; flex-direction: column; justify-content: center; min-height: 92vh; page-break-after: always; break-after: page;
  }
  .print-cover h1 { font-size: 30pt; letter-spacing: -.02em; margin: 6px 0 22px; line-height: var(--leading-tight); }
  .print-cover .cover-games { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
  .print-cover figure { margin: 0; font-size: 9pt; color: #555; }
  .print-cover img { width: 100%; border-radius: 4px; margin-bottom: 4px; }
  .print-cover dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 10pt; }
  .print-cover dt { color: #666; }
  .print-cover dd { margin: 0; }
  .print-cover .cover-foot { margin-top: 40px; font-size: 8.5pt; color: #777; }
  .prose { font-size: 10.5pt; line-height: var(--leading-normal); color: #000; }
  .prose h2 { break-after: avoid; border-top-color: #ccc; }
  .prose h3 { break-after: avoid; }
  .prose table, .prose blockquote, .prose li { break-inside: avoid; }
  .table-wrap { overflow: visible; border-color: #ccc; }
  .prose th { position: static; background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .prose th, .prose td { border-color: #ddd; padding: 5px 7px; }
  .prose a { color: #000; }
}
@media (max-width: 760px) { .tab { padding: 7px 4px; font-size: var(--text-xs); } }
@media (max-width: 360px) { .tab { font-size: var(--text-2xs); } }

/* ======================================================================
   Design: a plain research tool. One sans-serif typeface, neutral greys,
   blue only for links and focus, green/red only for review sentiment.
   No decorative labels, highlights or shadows.
   ====================================================================== */
::selection { background: var(--accent-soft); }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; }
.eyebrow { margin: 0 0 4px; font-size: var(--text-xs); font-weight: 500; color: var(--text-3); letter-spacing: 0; text-transform: none; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); backdrop-filter: none; -webkit-backdrop-filter: none; padding-top: 10px; padding-bottom: 10px; }
.brand { gap: 8px; font-weight: 600; font-size: var(--text-base); }
.tabs { background: none; border: 0; padding: 0; gap: 2px; border-radius: 0; }
.tab { border-radius: var(--radius-sm); padding: 6px 12px; font-size: var(--text-md); font-weight: 500; color: var(--text-2); }
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab[aria-current="page"] { background: var(--surface-2); color: var(--text); box-shadow: none; font-weight: 600; }
.link-btn { border-radius: var(--radius-sm); font-size: var(--text-md); font-weight: 500; }
.count { border-radius: 10px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); font-weight: 600; }
.icon-btn { border-radius: var(--radius-sm); }
@media (max-width: 760px) { .tab { padding: 6px 4px; font-size: var(--text-sm); } }

/* Page headers */
.hero { text-align: left; padding: 36px 0 4px; }
.hero h1, .tool-hero h1 { margin: 0; max-width: none; font-size: clamp(var(--text-2xl), 3.4vw, var(--text-3xl)); line-height: var(--leading-tight); letter-spacing: -.015em; font-weight: 600; }
.lede { margin: 8px 0 0; max-width: 68ch; font-size: var(--text-base); color: var(--text-2); }
.tool-hero { padding: 36px 0 4px; border: 0; max-width: 760px; }
.tool-hero .lede { margin-top: 8px; }
.lookup { margin: 20px 0 0; max-width: 720px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); padding: 4px; box-shadow: none; }
.lookup:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lookup-field { padding-left: 10px; }
.lookup .btn { border-radius: var(--radius-sm); }
.hero .form-error { margin: 12px 0 0; max-width: 720px; }
@media (max-width: 560px) { .lookup { border-radius: var(--radius); } }
.try { margin: 10px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: var(--text-md); color: var(--text-3); }
.try-game { font: inherit; color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.try-game:hover { text-decoration-color: currentColor; }
/* Once a game is loaded, the intro gives way to the results; only the search stays. */
.has-game .hero { padding-top: 20px; }
.has-game .hero h1, .has-game .hero .lede, .has-game .try { display: none; }
.has-game .hero .lookup { margin-top: 0; }

/* Cards and sections */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; background: var(--surface); margin-top: 16px; }
.game-art { border-radius: var(--radius-sm); }
.step-head { gap: 0; margin-bottom: 18px; }
.step-head h2 { font-size: var(--text-xl); margin: 0 0 4px; gap: 8px; }
.step-num { display: inline-block; width: auto; height: auto; background: none; border: 0; border-radius: 0; color: var(--text-3); font-size: var(--text-xl); font-weight: 600; padding: 0; margin: 0 8px 0 0; line-height: var(--leading-normal); }
.step-num::after { content: "."; }
.pill { padding: 0; background: none; border: 0; text-transform: none; letter-spacing: 0; font-size: var(--text-md); font-weight: 400; color: var(--text-3); }
.pill::before { content: "("; } .pill::after { content: ")"; }

/* Buttons */
.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: var(--text-md); padding: 9px 16px; }
.btn-primary { background: var(--ink); color: var(--ink-text); border-color: var(--ink); box-shadow: none; }
.btn-primary:hover:not(:disabled) { filter: none; background: color-mix(in srgb, var(--ink) 85%, var(--bg)); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.btn.busy::after { border-color: var(--ink-text); border-right-color: transparent; }
.btn.ok { background: var(--pos); border-color: var(--pos); color: #fff; }
.chip { border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: var(--text-sm); font-weight: 500; padding: 5px 10px; }
.chip:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }

/* Fields */
select, .field input[type="text"], .field input[type="number"], .field textarea, .affix, .lookup-inline input, .ask-form input, .explore-filters input {
  background: var(--surface); border-color: var(--border-strong); border-radius: var(--radius-sm);
}
select:focus, .field input:focus, .affix:focus-within, .lookup-inline input:focus, .ask-form input:focus, .explore-filters input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { font-family: var(--font); font-size: var(--text-md); }
.seg { background: var(--surface-2); border-color: var(--border); border-radius: var(--radius-sm); }
.seg label { border-radius: 4px; font-weight: 500; }
.seg input:checked + label { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong); font-weight: 600; }
.pick input, .check input { accent-color: var(--accent); }

/* Results */
.stats { gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); border: 0; border-radius: 0; padding: 12px 14px; }
.stat-label { font-size: var(--text-xs); font-weight: 500; color: var(--text-3); text-transform: none; letter-spacing: 0; }
.stat-value { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -.01em; }
.stat-sub { font-size: var(--text-xs); color: var(--text-3); }
.chart, .terms, .trend-wrap, .scenario, .ask-answer, .cache-note, .history-item, .pick, .cmp-progress li, .batch, .preview, .review {
  border-radius: var(--radius); background: var(--surface); border-color: var(--border);
}
.chart figcaption, .chart-group figcaption { font-size: var(--text-md); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); }
.track, .bar, .ratio, .mini-bar { border-radius: 3px; }
.bar { height: 6px; border: 0; background: var(--surface-2); }
.track .l, .bar span, .wf-track .kept, .col .b { background: var(--bar); border-radius: 3px; }
.col .b.sale { background: var(--accent); }
.subtab { font-size: var(--text-md); font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-2); }
.subtab[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.term { border-radius: var(--radius-sm); }
mark { background: var(--marker); color: var(--marker-ink); border-radius: 2px; }
.score-pill { border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: 600; padding: 2px 8px; }
.tag { border-radius: 4px; font-weight: 600; }
.scenario.mid { border-color: var(--accent); box-shadow: none; }
.pick.on { border-color: var(--accent); background: var(--surface); box-shadow: none; }
.pick.seed { box-shadow: inset 3px 0 0 var(--accent); }
.pick.on.seed { box-shadow: inset 3px 0 0 var(--accent); }
.cmp-progress li.running, .batch.running { border-color: var(--accent); background: var(--accent-soft); }
.trend-svg .pct-line { stroke: var(--text); }
.trend-svg .upd line { stroke: var(--accent); }

/* Report */
.report-head { border-bottom: 1px solid var(--border); }
.report-head h2 { font-size: var(--text-2xl); }
.report-head .eyebrow { font-size: var(--text-sm); }
.prose { font-size: var(--text-base); }
.prose h2 { font-size: var(--text-xl); border-top: 1px solid var(--border); }
.prose h3 { font-size: var(--text-lg); }
.prose blockquote { border-left: 3px solid var(--border-strong); background: none; font-style: normal; color: var(--text-2); }
.prose th { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-2); }
.table-wrap { border-radius: var(--radius); border-color: var(--border); }
.toc a { border-radius: 0; font-size: var(--text-sm); }
.toc a.active { background: none; color: var(--text); border-left-color: var(--text); font-weight: 600; }

/* Drawer, toast, footer */
.drawer { background: var(--surface); border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgb(0 0 0 / 8%); }
.toast { border-radius: var(--radius-sm); background: var(--ink); color: var(--ink-text); font-size: var(--text-sm); font-weight: 500; }
.footer { font-size: var(--text-sm); color: var(--text-3); border-top: 1px solid var(--border); max-width: 1088px; text-align: left; padding-left: 0; padding-right: 0; }
.footer { width: calc(100% - 32px); }
.footer p { margin-left: 0; margin-right: 0; max-width: 90ch; }
.footer .link-inline { font: inherit; text-decoration: underline; }

/* ---------- Prompt panel (copy → paste into your AI → paste back) ---------- */
.preset-tabs { display: flex; gap: 2px; margin: 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.preset-tabs::-webkit-scrollbar { display: none; }
.preset-tab {
  flex: none; font: inherit; font-size: var(--text-md); font-weight: 500; color: var(--text-2); background: none; border: 0;
  border-bottom: 2px solid transparent; padding: 8px 10px; margin-bottom: -1px; cursor: pointer; white-space: nowrap; min-height: 40px;
}
.preset-tab:hover { color: var(--text); }
.preset-tab[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.preset-tab:focus-visible { outline-offset: -3px; }
.preset-blurb { margin: 12px 0 16px; font-size: var(--text-md); color: var(--text-2); }

.size-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.size-picker input { position: absolute; opacity: 0; pointer-events: none; }
.size-picker label { display: grid; gap: 2px; padding: 10px 12px; cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.size-picker label b { font-size: var(--text-md); font-weight: 600; }
.size-picker label span { font-size: var(--text-xs); color: var(--text-3); line-height: var(--leading-snug); }
.size-picker label:hover { border-color: var(--border-strong); }
.size-picker input:checked + label { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.size-picker input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 640px) { .size-picker { grid-template-columns: 1fr; } }

.prompt-steps { list-style: none; counter-reset: ps; margin: 0; padding: 0; display: grid; gap: 22px; }
.prompt-steps > li { counter-increment: ps; position: relative; padding: 0 0 0 36px; margin: 0; }
.prompt-steps > li::before {
  content: counter(ps); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; display: grid; place-items: center;
  font-size: var(--text-xs); font-weight: 600; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface);
}
.prompt-steps > li.done::before { content: "✓"; background: var(--pos); border-color: var(--pos); color: #fff; }
.ps-title { font-size: var(--text-base); font-weight: 600; }
.ps-title .opt { font-size: var(--text-sm); font-weight: 400; color: var(--text-3); margin-left: 2px; }
.ps-title .opt::before { content: "("; } .ps-title .opt::after { content: ")"; }
.ps-meta { margin: 2px 0 0; font-size: var(--text-sm); color: var(--text-3); }
.ps-note { margin: 8px 0 0; font-size: var(--text-sm); color: var(--text-2); max-width: 70ch; }
.ps-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ps-hint { font-size: var(--text-xs); color: var(--text-3); align-self: center; }
@media (max-width: 560px) { .ps-hint { display: none; } }
.ps-warn { margin: 8px 0 0; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--neg) 30%, var(--border)); background: var(--neg-soft); color: var(--text); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.chat-link { text-decoration: none; color: var(--text); }
.prompt-preview { margin-top: 10px; }
.prompt-preview summary { cursor: pointer; font-size: var(--text-sm); color: var(--text-2); }
.prompt-preview textarea, .answer-box {
  width: 100%; margin-top: 8px; font: var(--text-xs)/var(--leading-normal) var(--mono); color: var(--text); resize: vertical;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px;
}
.answer-box { min-height: 120px; background: var(--surface); font-family: var(--font); font-size: var(--text-md); }
.answer-box:focus, .prompt-preview textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#ask-panel:not(:empty) { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
#cmp-panel:not(:empty) { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
.prose > h2:first-child { border-top: 0; padding-top: 0; }

/* Citation chips in reports, and the review they open */
.cite { font: inherit; font-family: var(--mono); border-radius: 4px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; }
.cite:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.prose .cite { font-size: var(--text-2xs); padding: 0 4px; margin: 0 1px; line-height: var(--leading-normal); vertical-align: 2px; }
.cite.pos { color: var(--pos); }
.cite.neg { color: var(--neg); }
.cite[aria-expanded="true"] { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.report-card { position: relative; }
.cite-pop {
  position: absolute; z-index: 30; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgb(0 0 0 / 14%); padding: 12px 14px; font-size: var(--text-md); line-height: var(--leading-normal);
  max-height: 320px; overflow: auto;
}
.cite-pop p { margin: 8px 0 0; white-space: pre-wrap; }
.cite-pop-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: var(--text-xs); color: var(--text-3); }
.cite-pop-head b { color: var(--text); }
.cite-id { margin-left: auto; font-family: var(--mono); }
@media print { .cite-pop { display: none; } .prose .cite { border: 0; padding: 0; color: var(--text-3); } }

/* Notices and small pages */
.shared-note { margin: 10px 0 0; padding: 8px 12px; background: var(--accent-soft); color: var(--text); font-size: var(--text-md); border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); }
.shared-note .link-inline { color: var(--accent); font-weight: 600; text-decoration: underline; }
.noscript { margin: 0; padding: 12px 16px; background: var(--neg-soft); color: var(--text); text-align: center; font-weight: 600; }
.notfound { max-width: 640px; margin: 18vh auto 0; padding: 0 16px; }
.notfound h1 { font-size: var(--text-3xl); line-height: var(--leading-tight); margin: 0 0 8px; }
.notfound .btn { display: inline-flex; text-decoration: none; margin-top: 12px; }
.about h3 { font-size: var(--text-md); font-weight: 600; color: var(--text); margin: 22px 0 6px; }
.about li { margin: 0 0 8px; }

@media print { body { background: #fff; } }

/* Game search (type-ahead) */
.gs-anchor { position: relative; }
.gs-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgb(0 0 0 / 14%); max-height: min(420px, 60vh); overflow: auto;
}
.lookup .gs-list { left: -5px; right: -5px; }
.gs-item { display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; align-items: center; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.gs-item[aria-selected="true"] { background: var(--surface-2); }
.gs-item img, .gs-noimg { width: 92px; height: 35px; object-fit: cover; border-radius: 3px; background: var(--surface-2); }
.gs-name { font-size: var(--text-md); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-price { font-size: var(--text-sm); color: var(--text-3); font-variant-numeric: tabular-nums; }
.gs-empty { padding: 10px 12px; color: var(--text-3); font-size: var(--text-md); }
@media (max-width: 560px) { .gs-item { grid-template-columns: 64px 1fr; } .gs-item img, .gs-noimg { width: 64px; height: 24px; } .gs-price { display: none; } }

/* Game overview header */
.game { display: block; padding: 20px; }
.game-top { display: grid; grid-template-columns: minmax(0, 280px) 1fr; gap: 22px; align-items: start; }
.game-links { margin: 8px 0 0; font-size: var(--text-sm); }
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 18px 0 0; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.figures > div { background: var(--surface); padding: 10px 14px; min-width: 0; }
.figures dt { font-size: var(--text-xs); color: var(--text-3); }
.figures dd { margin: 2px 0 0; font-size: var(--text-lg); font-weight: 600; font-variant-numeric: tabular-nums; display: grid; gap: 6px; }
.fig-score.pos { color: var(--pos); } .fig-score.mixed { color: var(--mixed); } .fig-score.neg { color: var(--neg); }
@media (max-width: 760px) { .game-top { grid-template-columns: 1fr; gap: 14px; } .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Signature sentiment bar: green share of positive reviews, red for the rest */
.sbar-wrap { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-xs); font-weight: 500; color: var(--text-3); }
.sbar { display: inline-block; width: 120px; max-width: 100%; height: 6px; border-radius: 3px; background: var(--neg); overflow: hidden; vertical-align: middle; }
.sbar > span { display: block; height: 100%; background: var(--pos); }
.figures .sbar { width: 100%; }
.figures .sbar-wrap { display: grid; grid-template-columns: 1fr auto; }

/* Positive reviews by month */
.spark { margin: 16px 0 0; }
.spark figcaption { font-size: var(--text-sm); font-weight: 600; color: var(--text); margin-bottom: 6px; }
.spark figcaption .muted { font-weight: 400; }
.spark-svg { display: block; width: 100%; height: 120px; overflow: visible; stroke: none; fill: none; }
.spark-grid { stroke: var(--border); stroke-width: 1; }
.spark-label { fill: var(--text-3); stroke: none; font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.spark-vol { fill: var(--border); stroke: none; }
.spark-line { fill: none; stroke: var(--pos); stroke-width: 2; stroke-linejoin: round; }
.spark-dot { fill: var(--pos); stroke: var(--surface); stroke-width: 2; }
.spark-hit { fill: transparent; stroke: none; cursor: crosshair; }
.spark-hit:hover { fill: color-mix(in srgb, var(--text) 6%, transparent); }

/* Tooltip */
.tooltip { position: absolute; z-index: 60; max-width: 280px; padding: 6px 9px; border-radius: var(--radius-sm); background: var(--ink); color: var(--ink-text); font-size: var(--text-xs); line-height: var(--leading-snug); pointer-events: none; box-shadow: 0 6px 18px rgb(0 0 0 / 18%); font-variant-numeric: tabular-nums; }

/* Current-game bar on the other tools */
.ctx { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: var(--text-md); }
.ctx img { width: 64px; height: 30px; object-fit: cover; border-radius: 3px; }
.ctx-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-link { margin-left: auto; white-space: nowrap; }
@media (max-width: 560px) { .ctx .sbar-wrap { display: none; } }

/* Loading placeholders */
.skel { display: inline-block; height: .9em; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; vertical-align: middle; }
.skel-lg { height: 1.2em; width: 70%; }
.game-desc .skel { display: block; margin: 6px 0; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.skel.w40 { width: 40%; } .skel.w50 { width: 50%; } .skel.w60 { width: 60%; } .skel.w70 { width: 70%; } .skel.w90 { width: 90%; }
.hw-skel { display: grid; gap: 12px; padding: 8px 0; } .hw-skel .skel { height: 14px; }

/* Chart rows and periods: exact values on hover and keyboard focus */
.hrow, .lrow { border-radius: 4px; padding: 1px 4px; margin: 0 -4px; cursor: default; }
.hrow:hover, .lrow:hover, .hrow:focus-visible, .lrow:focus-visible { background: var(--surface-2); }
.trend-svg .hit { fill: transparent; stroke: none; cursor: crosshair; }
.trend-svg .hit:hover { fill: color-mix(in srgb, var(--text) 6%, transparent); }
.trend-svg .upd { cursor: help; }

/* Floating "Contents" button for long reports on phones */
.toc-jump { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 20; font: inherit; font-size: var(--text-md); font-weight: 600; padding: 10px 16px; border-radius: 20px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); box-shadow: 0 6px 20px rgb(0 0 0 / 16%); cursor: pointer; }
@media print { .toc-jump { display: none !important; } }

.pick-meta .sbar-wrap { margin-right: 6px; }
.pick-meta .sbar { width: 64px; }

/* Opening a game link: reserve the overview's space before the scripts fill it in */
.has-game #game[hidden] { display: block !important; min-height: 520px; }
@media (min-width: 761px) { .has-game #game[hidden] { min-height: 470px; } }
#game.loading { min-height: 470px; }
@media (max-width: 760px) { #game.loading { min-height: 520px; } }
#game.loading .game-art { display: block !important; }
#game.loading .figures > div { min-height: 76px; }
@media (max-width: 760px) { #game.loading .figures > div { min-height: 94px; } }
.has-game #game[hidden] .game-art { display: block !important; }

/* Recent vs all-time, and unusual months */
.figures { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 760px) { .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } .figures > div:last-child:nth-child(odd) { grid-column: span 2; } }
.fig-sub { font-size: var(--text-2xs); font-weight: 500; color: var(--text-3); }
.fig-sub.worse { color: var(--neg); } .fig-sub.better { color: var(--pos); }
.fig-muted { color: var(--text-3); font-weight: 500; font-size: var(--text-md); }
.spark-flag { stroke: none; }
.spark-flag.drop { fill: var(--neg); } .spark-flag.spike { fill: var(--mixed); }
.spark-notes { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; font-size: var(--text-xs); color: var(--text-2); }
.spark-flag-key { color: var(--text-3); }
.spark-note::before { content: ""; display: inline-block; width: 0; height: 0; margin-right: 6px; vertical-align: 1px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid var(--mixed); }
.spark-note.drop::before { border-top-color: var(--neg); }

/* Compare: side-by-side table */
.cmp-table:not(:empty) { margin-top: 22px; }
.ct-title { font-size: var(--text-base); margin: 0 0 10px; }
table.ct th, table.ct td { text-align: left; }
table.ct .num { text-align: right; }
table.ct tbody th { font-weight: 600; background: var(--surface); }
table.ct tr.seed th { box-shadow: inset 3px 0 0 var(--accent); }
table.ct .sbar { width: 70px; }
.ct-name { display: inline-block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.ct-sort { font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.ct-sort:hover { color: var(--text); }
.ct-delta.worse { color: var(--neg); font-weight: 600; } .ct-delta.better { color: var(--pos); font-weight: 600; }

/* Watchlist */
.btn-sm { padding: 5px 10px; font-size: var(--text-sm); }
.game-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.watch-btn[aria-pressed="true"] { color: var(--text); border-color: var(--text-3); }
.has-game .watch { display: none; }
.watch { margin-top: 30px; max-width: 720px; }
.watch-title { font-size: var(--text-base); margin: 0 0 8px; }
.watch-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.watch-item { display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.watch-item:last-child { border-bottom: 0; }
.watch-open { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; font: inherit; color: var(--text); background: none; border: 0; text-align: left; cursor: pointer; }
.watch-open:hover { background: var(--surface-2); }
.watch-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-figs { display: flex; align-items: center; gap: 14px; font-size: var(--text-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.watch-figs .skel { width: 160px; }
.watch-remove { margin-right: 6px; font-size: var(--text-xl); line-height: 1; }
@media (max-width: 560px) { .watch-open { grid-template-columns: 1fr; gap: 4px; } .watch-recent { display: none; } }

/* Stats: 4 × 2 on wide screens */
@media (min-width: 1040px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Home-page examples */
.has-game .examples { display: none; }
.examples { margin-top: 34px; max-width: 900px; }
.examples-title { font-size: var(--text-base); margin: 0 0 10px; }
.examples-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.examples-list a { display: grid; gap: 4px; height: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.examples-list a:hover { border-color: var(--border-strong); background: var(--surface-2); }
.examples-list b { font-weight: 600; font-size: var(--text-md); }
.examples-list span { font-size: var(--text-sm); color: var(--text-2); }
@media (max-width: 640px) { .examples-list { grid-template-columns: 1fr; } }

/* Icons in buttons, tabs and links */
.ic { width: 1.05em; height: 1.05em; flex: none; stroke-width: 2; }
.btn .ic { width: 17px; height: 17px; margin-left: -2px; }
.btn-sm .ic { width: 15px; height: 15px; }
.tab, .subtab { display: inline-flex; align-items: center; gap: 6px; }
.tab .ic { width: 16px; height: 16px; opacity: .85; }
.subtab .ic { width: 15px; height: 15px; }
.chip .ic { width: 14px; height: 14px; }
.link-inline, .icon-link, #about-open { display: inline-flex; align-items: center; gap: 5px; }
.link-inline .ic, .icon-link .ic, #about-open .ic { width: 14px; height: 14px; }
.toc-jump { display: inline-flex; align-items: center; gap: 6px; }
.toc-jump .ic { width: 16px; height: 16px; }
.watch-btn .ic-starFilled { color: #c99a06; }
.icon-btn .ic { width: 18px; height: 18px; }
@media (max-width: 760px) { .tab .ic { display: none; } }

/* Home: intro beside a live example overview */
.hero-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 40px; align-items: center; }
.hero-main > :last-child { margin-bottom: 0; }
@media (max-width: 960px) { .hero-top { grid-template-columns: 1fr; gap: 24px; } }
.has-game .hero-top { display: block; }
.has-game .preview { display: none; }
.preview {
  min-height: 336px; padding: 14px 16px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 8px 24px rgb(0 0 0 / 5%);
}
.preview-kicker { margin: 0 0 10px; font-size: var(--text-2xs); font-weight: 500; color: var(--text-3); }
.preview-head { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; align-items: center; }
.preview-art { width: 92px; height: 43px; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.preview-name { margin: 0; font-size: var(--text-lg); line-height: var(--leading-tight); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-meta { margin: 2px 0 0; font-size: var(--text-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 6px; }
.preview-figs dt { font-size: var(--text-2xs); color: var(--text-3); }
.preview-figs dd { margin: 3px 0 0; font-size: var(--text-md); font-weight: 600; font-variant-numeric: tabular-nums; }
.preview-figs .sbar { width: 100%; max-width: 110px; }
.preview-chart { height: 96px; margin-top: 8px; }
.preview-chart .spark-svg { height: 96px; }
.preview-note { margin: 6px 0 0; min-height: 1.3em; font-size: var(--text-2xs); color: var(--text-2); }
.preview-open { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.preview-open .ic { width: 15px; height: 15px; }
.preview-open:hover { text-decoration: underline; }
.preview-figs .sbar-wrap { display: grid; grid-template-columns: minmax(0, 110px) auto; align-items: center; }
.hero-top > .preview { margin: 0; }

/* ======================================================================
   Typography: one scale (tokens above), four weights, four line heights.
   Page title 32 > section 20 > card title 16 > body 16 / UI 15 > meta 14 > labels 13 > micro 12.
   ====================================================================== */
h1, h2, h3, h4 { line-height: var(--leading-tight); text-wrap: balance; }
p, li, dd { text-wrap: pretty; }

/* Page titles and lede */
.hero h1, .tool-hero h1, .notfound h1 { font-size: clamp(var(--text-2xl), 3.4vw, var(--text-3xl)); font-weight: 700; letter-spacing: -.02em; }
.lede { font-size: clamp(var(--text-base), 1.5vw, var(--text-lg)); line-height: var(--leading-normal); }

/* Section and card titles */
.step-head h2, .section-head h2, .card-title { font-size: var(--text-xl); font-weight: 600; letter-spacing: -.01em; }
.step-num { font-size: var(--text-xl); }
.step-head p { font-size: var(--text-md); }
.game-name, .report-head h2 { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.015em; }
.ask h3, .ct-title, .examples-title, .watch-title, .about h3, .drawer-sub, .ps-title, .spark figcaption, .chart figcaption, .chart-group figcaption { font-size: var(--text-base); font-weight: 600; letter-spacing: 0; }
.drawer-head h2 { font-size: var(--text-xl); font-weight: 600; }

/* Reading text */
.prose { font-size: var(--text-base); line-height: var(--leading-relaxed); }
.prose h2 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -.01em; }
.prose h3 { font-size: var(--text-lg); font-weight: 600; }
.prose table { font-size: var(--text-sm); line-height: var(--leading-normal); }
.game-desc, .ps-note, .preset-blurb, .examples-list span { line-height: var(--leading-normal); }

/* Meta, labels and micro text */
.game-meta, .ps-meta, .preview-meta, .muted.small, .small, .footer, .cache-note { font-size: var(--text-sm); }
.stat-label, .figures dt, .preview-figs dt, .preview-kicker, .fig-sub, .stat-sub, .legend, .spark-notes, .ps-hint { font-size: var(--text-xs); }
.tag, .score-pill, .count { font-size: var(--text-2xs); }
.ct-delta { font-size: inherit; }

/* Numbers */
.stat-value { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.figures dd { font-size: var(--text-lg); font-weight: 600; }
.preview-figs dd { font-size: var(--text-base); }
.keep-value, .scenario .big { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* Controls */
.btn { font-size: var(--text-md); font-weight: 600; }
.btn-sm { font-size: var(--text-sm); }
.tab, .subtab, .preset-tab { font-size: var(--text-md); font-weight: 500; }
.tab[aria-current="page"], .subtab[aria-selected="true"], .preset-tab[aria-selected="true"] { font-weight: 600; }
.chip { font-size: var(--text-sm); font-weight: 500; }
.field { font-size: var(--text-sm); font-weight: 500; }
select, .field input[type="text"], .field input[type="number"], .lookup input, .lookup-inline input, .ask-form input, .explore-filters input { font-size: var(--text-md); }
/* iOS Safari zooms the page when a text field under 16px gets focus; touch screens get 16px fields. */
@media (pointer: coarse) {
  select, textarea, .answer-box, .field input[type="text"], .field input[type="number"], .lookup input, .lookup-inline input, .ask-form input, .explore-filters input { font-size: 16px; }
}

/* Spacing that scales with the type */
.hero h1 + .lede, .tool-hero h1 + .lede { margin-top: 12px; }
.step-head { align-items: baseline; }
.step-num { line-height: var(--leading-tight); }
.step-head h2 { margin-bottom: 6px; }
@media (max-width: 760px) { .tab { font-size: var(--text-sm); padding: 6px 4px; } }
@media (max-width: 380px) { .tab { font-size: var(--text-xs); } }

/* Clearer data labels */
.cap-sub { display: block; margin-top: 2px; font-size: var(--text-xs); font-weight: 400; color: var(--text-3); }
.chart-head { font-size: var(--text-2xs); font-weight: 600; color: var(--text-3); text-transform: none; padding-bottom: 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; cursor: default; }
.chart-head:hover { background: none; }
.th-label { display: block; }
.th-sub { display: block; margin-top: 2px; font-size: var(--text-2xs); font-weight: 400; color: var(--text-3); }
table.data thead th, .prose th { font-size: var(--text-xs); font-weight: 600; color: var(--text-2); vertical-align: bottom; line-height: var(--leading-snug); }
table.data thead th { white-space: normal; min-width: 7ch; }
table.data tbody tr:hover > * { background: var(--surface-2); }
.spark-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 6px 0 0; font-size: var(--text-xs); color: var(--text-3); }
.spark-legend span { display: inline-block; margin-right: 5px; vertical-align: middle; }
.lg-line { width: 14px; height: 2px; background: var(--pos); }
.lg-bar { width: 8px; height: 10px; background: var(--border); }
.lg-flag { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid var(--neg); }

/* Bigger headings on larger screens (fluid between phone and desktop) */
.hero h1, .tool-hero h1, .notfound h1 { font-size: clamp(var(--text-2xl), 1rem + 2.1vw, 2.5rem); letter-spacing: -.025em; }
.step-head h2, .section-head h2, .card-title, .step-num { font-size: clamp(var(--text-xl), .95rem + .7vw, var(--text-2xl)); }
.game-name, .report-head h2 { font-size: clamp(var(--text-2xl), 1.1rem + 1vw, 2rem); }
.prose h2 { font-size: clamp(var(--text-xl), 1rem + .5vw, 1.375rem); }
.ask h3, .ct-title, .examples-title, .watch-title, .drawer-sub { font-size: clamp(var(--text-base), .9rem + .3vw, var(--text-lg)); }
.ct-sort { display: block; width: 100%; text-align: inherit; }
table.ct thead th { text-align: left; } table.ct thead th.num { text-align: right; }

/* Logo: light and dark versions follow the site theme (system setting or the toggle) */
.brand { gap: 0; }
.brand-logo { display: block; height: 40px; width: auto; margin: -3px 0; }
.brand-logo-dark { display: none; }
:root[data-theme="dark"] .brand-logo-light { display: none; }
:root[data-theme="dark"] .brand-logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo-light { display: none; }
  :root:not([data-theme="light"]) .brand-logo-dark { display: block; }
}
@media (max-width: 760px) { .brand-logo { height: 34px; } }
.notfound-character { display: block; width: 112px; height: auto; margin-bottom: 18px; }
