/* Ballpark v2: a full-screen world with a clean overlay. System fonts only, no remote assets. */
:root {
  --bg: #0b0e24;
  --ink: #ffffff;
  --muted: rgba(235, 240, 255, 0.78);
  --faint: rgba(235, 240, 255, 0.55);
  --glass: rgba(9, 13, 42, 0.74);
  --glass-strong: rgba(9, 13, 42, 0.88);
  --line: rgba(255, 255, 255, 0.2);
  --amber: #ffd24a;
  --amber-deep: #ffb703;
  --coral: #ff6b81;
  --teal: #38e8c6;
  --focus: #ffffff;
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-text: 0 2px 22px rgba(6, 10, 40, 0.65), 0 1px 3px rgba(6, 10, 40, 0.5);
  --pad: clamp(1rem, 3.2vw, 2.75rem);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden;
  font-family: var(--font); font-size: 1.0625rem; line-height: 1.45; color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, ol { margin: 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em;
  padding: 0.05em 0.38em; border-radius: 6px; background: rgba(255, 255, 255, 0.14); color: #fff0b8;
}
a { color: #ffe08a; text-underline-offset: 3px; }
a:hover { color: #fff; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
main:focus, [tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 0.75rem; top: -4rem; z-index: 100; background: #fff; color: #111; padding: 0.55rem 0.9rem; border-radius: 10px; font-weight: 700; }
.skip-link:focus { top: 0.75rem; }

/* ---------------------------------------------------------------- the world */
.world, .world-fade { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.world { background: #7fc873; }
.world-fade { pointer-events: none; opacity: 0; transition: opacity 0.4s ease; }
.world-fade.hold { transition: none !important; }
.scrim { position: fixed; left: 0; right: 0; pointer-events: none; transition: opacity 0.6s ease; }
.scrim-top { top: 0; height: 44%; background: linear-gradient(to bottom, rgba(6, 10, 40, 0.5) 0%, rgba(6, 10, 40, 0.24) 50%, rgba(6, 10, 40, 0) 100%); }
.scrim-bottom { bottom: 0; height: 34%; background: linear-gradient(to top, rgba(6, 10, 40, 0.5) 0%, rgba(6, 10, 40, 0.22) 55%, rgba(6, 10, 40, 0) 100%); }
body[data-screen="start"] .scrim-bottom { opacity: 0.7; }
body[data-screen="battle-setup"] .scrim-top, body[data-screen="battle-setup"] .scrim-bottom { opacity: 1; }
body[data-screen="battle-setup"]::before { content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none; background: rgba(6, 10, 40, 0.5); }
body[data-screen="start"]::before { content: ""; position: fixed; inset: 0 40% 0 0; z-index: 1; pointer-events: none; background: linear-gradient(to right, rgba(6, 10, 40, 0.5), rgba(6, 10, 40, 0)); }
body[data-screen="reveal"] .scrim-bottom { opacity: 0; }
body[data-screen="reveal"][data-settled="1"] .scrim-bottom { opacity: 0.8; }
body[data-screen="summary"] .scrim-top, body[data-screen="summary"] .scrim-bottom { opacity: 0.55; }

/* ---------------------------------------------------------------- HUD */
.hud {
  position: fixed; z-index: 5; left: 0; right: 0; top: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 0.75rem;
  padding: max(0.85rem, env(safe-area-inset-top)) var(--pad) 0;
  pointer-events: none;
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 800; letter-spacing: -0.01em; font-size: 1.15rem; text-shadow: var(--shadow-text); justify-self: start; }
.brand-mark { width: 1.05rem; height: 1.05rem; border-radius: 50%; background: radial-gradient(circle, var(--amber) 0 22%, transparent 24% 40%, #fff 42% 52%, transparent 54%); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9); }
.best-chip { justify-self: end; font-size: 0.9rem; font-weight: 600; color: var(--muted); text-shadow: var(--shadow-text); }
.best-chip strong { color: #fff; }
.scale { justify-self: center; text-align: center; min-width: 0; }
.scale-caption { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.01em; text-shadow: var(--shadow-text); white-space: nowrap; }
.scale-width { color: var(--muted); font-weight: 600; }
.scale-caption.is-swapping { animation: caption-in 0.5s ease both; }
@keyframes caption-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.scale-track { position: relative; width: min(30rem, 52vw); height: 4px; margin: 0.5rem auto 0; border-radius: 4px; background: rgba(255, 255, 255, 0.28); box-shadow: 0 0 0 1px rgba(6, 10, 40, 0.18); }
.scale-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--teal), var(--amber)); }
.scale-fill::after { content: ""; position: absolute; right: -6px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 210, 74, 0.7), 0 2px 8px rgba(0, 0, 0, 0.4); }
.scale-ticks { position: absolute; inset: 0; display: block; }
.scale-ticks i { position: absolute; top: -2px; width: 2px; height: 8px; margin-left: -1px; border-radius: 2px; background: rgba(255, 255, 255, 0.55); }

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none; font: inherit; font-weight: 700; color: #fff; cursor: pointer;
  padding: 0.7rem 1.25rem; border-radius: 999px; border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.24); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: linear-gradient(180deg, #ffe07a, var(--amber-deep)); color: #1b1740; border-color: transparent; box-shadow: 0 8px 26px rgba(255, 183, 3, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.btn-primary:hover { background: linear-gradient(180deg, #ffe992, #ffbf1f); }
.btn-big { padding: 0.95rem 1.9rem; font-size: 1.15rem; }

/* ---------------------------------------------------------------- screens */
.screen { position: fixed; inset: 0; z-index: 4; padding: calc(4.6rem + env(safe-area-inset-top)) var(--pad) max(1.25rem, env(safe-area-inset-bottom)); display: flex; flex-direction: column; pointer-events: none; }
.screen > * { pointer-events: auto; }
.eyebrow { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber); text-shadow: var(--shadow-text); }

/* start */
.screen-start { justify-content: center; align-items: flex-start; }
.screen-start h1 { font-size: clamp(4rem, 12vw, 9.5rem); line-height: 0.92; font-weight: 900; letter-spacing: -0.045em; text-shadow: var(--shadow-text); margin: 0.35rem 0 1.1rem; }
.screen-start .lead { max-width: 27rem; font-size: clamp(1.1rem, 2.2vw, 1.5rem); font-weight: 600; line-height: 1.3; color: #fff; text-shadow: var(--shadow-text); margin-bottom: 1.7rem; }
.screen-start .fine { max-width: 26rem; margin-top: 1.4rem; font-size: 0.88rem; color: var(--muted); text-shadow: var(--shadow-text); }
.mode-row { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.btn-mode { display: grid; gap: 0.1rem; text-align: left; padding: 0.8rem 1.5rem 0.85rem; border-radius: 22px; min-width: 13.5rem; max-width: 17rem; }
.mode-title { font-size: 1.35rem; font-weight: 900; letter-spacing: -0.01em; line-height: 1.1; }
.mode-sub { font-size: 0.85rem; font-weight: 600; opacity: 0.85; line-height: 1.25; }
.btn-battle { background: rgba(9, 13, 42, 0.62); border-color: rgba(255, 255, 255, 0.5); }
.btn-battle:hover { background: rgba(9, 13, 42, 0.8); }
.screen-start { animation: rise 0.7s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* question */
.screen-question { justify-content: space-between; }
.q-head { max-width: min(46rem, 100%); animation: rise 0.55s ease both; }
.progress-text { display: flex; gap: 1rem; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); text-shadow: var(--shadow-text); text-transform: uppercase; }
.progress-total strong { color: var(--amber); }
.dots { list-style: none; padding: 0; display: flex; gap: 6px; margin: 0.55rem 0 1.1rem; }
.dot { width: 22px; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.28); box-shadow: 0 0 0 1px rgba(6, 10, 40, 0.15); }
.dot-now { background: #fff; }
.dot-done { background: var(--amber); }
.dot-band-0, .dot-band-1 { background: var(--coral); }
.dot-band-2, .dot-band-3 { background: #ff9d4a; }
.dot-band-4 { background: var(--amber); }
.dot-band-5, .dot-band-6 { background: var(--teal); }
.chip { display: inline-block; padding: 0.15rem 0.75rem; border-radius: 999px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #11153a; background: rgba(255, 255, 255, 0.92); margin-bottom: 0.7rem; }
.question-text { font-size: clamp(1.7rem, 4.6vw, 3.6rem); line-height: 1.06; font-weight: 900; letter-spacing: -0.03em; text-shadow: var(--shadow-text); text-wrap: balance; }
.asof { margin-top: 0.7rem; font-size: 0.9rem; font-weight: 600; color: var(--amber); text-shadow: var(--shadow-text); }

.guess-form { width: min(44rem, 100%); align-self: center; }
.field-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.field-row {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.45rem 0.45rem 1.4rem;
  border-radius: 999px; background: var(--glass); border: 1.5px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(2, 4, 24, 0.45);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field-row:focus-within { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(255, 210, 74, 0.25), 0 18px 50px rgba(2, 4, 24, 0.45); }
.guess-input { flex: 1 1 0; min-width: 0; width: 0; appearance: none; border: 0; outline: 0; background: transparent; color: #fff; font: inherit; font-size: clamp(1.35rem, 3.2vw, 2rem); font-weight: 800; letter-spacing: -0.01em; padding: 0.35rem 0; }
.guess-input::placeholder { color: rgba(255, 255, 255, 0.4); font-weight: 600; }
.guess-input[aria-invalid="true"] { color: #ffb4bf; }
.unit { color: var(--muted); font-weight: 700; font-size: 0.95rem; max-width: 9rem; text-align: right; line-height: 1.15; }
.btn-go { padding: 0.85rem 1.5rem; font-size: 1.05rem; white-space: nowrap; }
.preview { margin: 0.7rem 0 0 1.4rem; min-height: 1.5em; font-weight: 700; color: #fff; text-shadow: var(--shadow-text); font-variant-numeric: tabular-nums; }
.preview-error { color: #ffc2cb; }
.preview-hint { font-weight: 600; color: rgba(255, 255, 255, 0.78); }
.slider-row { display: flex; align-items: center; gap: 0.7rem; margin: 0.7rem 0 0 1.2rem; width: min(30rem, calc(100% - 1.2rem)); }
.slider-row[hidden] { display: none; }
.slider-end { font-size: 0.78rem; font-weight: 800; color: #fff; opacity: 0.85; text-shadow: var(--shadow-text); font-variant-numeric: tabular-nums; }
.guess-slider { flex: 1 1 auto; min-width: 0; height: 2.6rem; margin: 0; padding: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
.guess-slider::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.38); box-shadow: 0 0 0 1px rgba(10, 14, 50, 0.45); }
.guess-slider::-moz-range-track { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.38); box-shadow: 0 0 0 1px rgba(10, 14, 50, 0.45); }
.guess-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 30px; height: 30px; margin-top: -10px; border-radius: 50%; background: var(--amber); border: 3px solid #fff; box-shadow: 0 4px 14px rgba(2, 4, 24, 0.5); }
.guess-slider::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--amber); border: 3px solid #fff; box-shadow: 0 4px 14px rgba(2, 4, 24, 0.5); }
.guess-slider.is-untouched::-webkit-slider-thumb { background: #fff; border-color: rgba(255, 255, 255, 0.55); opacity: 0.8; }
.guess-slider.is-untouched::-moz-range-thumb { background: #fff; border-color: rgba(255, 255, 255, 0.55); opacity: 0.8; }
.guess-slider:focus-visible { outline: 3px solid #fff; outline-offset: 4px; border-radius: 8px; }
.b-form .slider-row { margin: 0.6rem auto 0; padding-left: 0.4rem; width: min(30rem, 100%); }
.hint { margin: 0.1rem 0 0 1.4rem; font-size: 0.85rem; color: var(--muted); text-shadow: var(--shadow-text); }

/* ---------------------------------------------------------------- the reveal */
.reveal { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.reveal > * { pointer-events: auto; }
.reveal-stage { position: absolute; inset: 0; pointer-events: auto; cursor: pointer; }
.reveal-head { position: absolute; left: 0; right: 0; top: calc(5.2rem + env(safe-area-inset-top)); text-align: center; padding: 0 var(--pad); pointer-events: none; }
.reveal-kicker { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); text-shadow: var(--shadow-text); }
.reveal-score { font-weight: 900; line-height: 0.95; letter-spacing: -0.05em; text-shadow: var(--shadow-text); margin: 0.25rem 0 0.35rem; font-variant-numeric: tabular-nums; }
.reveal-score > span:first-child { font-size: clamp(5.5rem, 21vmin, 12rem); color: #fff; }
.reveal-score-max { font-size: clamp(1.5rem, 5vmin, 3rem); color: var(--muted); margin-left: 0.15em; letter-spacing: 0; }
.reveal-line { font-size: clamp(1.2rem, 3.2vw, 2rem); font-weight: 800; letter-spacing: -0.01em; color: #fff; text-shadow: var(--shadow-text); min-height: 1.3em; }
.reveal-tier { margin-top: 0.3rem; font-size: 0.95rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); text-shadow: var(--shadow-text); min-height: 1.3em; }
.reveal[data-band="0"] .reveal-score > span:first-child, .reveal[data-band="1"] .reveal-score > span:first-child { color: #ffc2cb; }
.reveal[data-band="5"] .reveal-score > span:first-child, .reveal[data-band="6"] .reveal-score > span:first-child { color: #b9ffee; }
.reveal.is-counting .reveal-score > span:first-child { animation: pulse 0.9s ease-in-out infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.025); } }

.reveal-panel {
  position: absolute; left: var(--pad); bottom: max(1.25rem, env(safe-area-inset-bottom)); width: min(27rem, calc(100% - 2 * var(--pad)));
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.55rem; padding: 1.15rem 1.3rem 1.25rem;
  border-radius: 24px; background: var(--glass-strong); border: 1.5px solid var(--line);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 24px 70px rgba(2, 4, 24, 0.55);
  max-height: calc(100% - 7rem); overflow: auto;
  opacity: 0; transform: translateY(24px); visibility: hidden;
  transition: opacity 0.45s ease, transform 0.55s cubic-bezier(.2, .9, .25, 1), visibility 0s linear 0.55s;
}
.reveal.is-ready .reveal-panel { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.compare-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--faint); font-weight: 800; }
.compare-value { font-weight: 900; font-size: clamp(1.25rem, 3.8vw, 1.7rem); line-height: 1.12; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.compare-truth .compare-value { color: var(--amber); }
.verdict { font-weight: 700; }
.moved { font-size: 0.92rem; color: var(--teal); font-weight: 700; }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.badge { font-size: 0.76rem; font-weight: 800; padding: 0.12rem 0.6rem; border-radius: 999px; background: rgba(255, 255, 255, 0.14); color: #e9edff; }
.badge-asof { background: rgba(255, 210, 74, 0.2); color: #ffe08a; }
.source { font-size: 0.9rem; color: #e3e7ff; overflow-wrap: anywhere; }
.source-label { display: inline-block; margin-right: 0.35rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--faint); font-weight: 800; }
.source-meta { color: var(--faint); }
.source-note { font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; }
.note summary { cursor: pointer; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.note summary:hover { color: #fff; }
.reveal-actions { margin-top: 0.3rem; }
.reveal-actions .btn { width: 100%; }
.skip-hint { position: absolute; left: 0; right: 0; bottom: max(1.1rem, env(safe-area-inset-bottom)); text-align: center; font-size: 0.85rem; font-weight: 600; color: var(--muted); text-shadow: var(--shadow-text); pointer-events: none; transition: opacity 0.3s ease; }
.reveal.is-ready .skip-hint { opacity: 0; }

/* ---------------------------------------------------------------- summary */
.screen-summary { pointer-events: auto; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 31rem); gap: 1.5rem var(--pad); align-items: start; padding-top: calc(5rem + env(safe-area-inset-top)); }
.screen-summary > * { pointer-events: auto; }
.summary-hero { position: sticky; top: 0; padding-top: 0.5rem; }
.summary-reached { margin-top: 0.4rem; font-size: clamp(2.4rem, 6.4vw, 5.6rem); font-weight: 900; line-height: 0.98; letter-spacing: -0.04em; text-shadow: var(--shadow-text); text-wrap: balance; }
.summary-reached-label { display: block; font-size: 0.34em; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 800; margin-bottom: 0.25em; }
#summary-destination { color: var(--amber); }
.summary-far { margin-top: 0.9rem; max-width: 30rem; font-weight: 700; font-size: 1.1rem; text-shadow: var(--shadow-text); }
.summary-card { padding: 1.4rem 1.4rem 1.2rem; border-radius: 26px; background: var(--glass-strong); border: 1.5px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 24px 70px rgba(2, 4, 24, 0.5); margin-bottom: 1.5rem; }
.summary-score { font-weight: 900; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.summary-score > span:first-child { font-size: clamp(3.6rem, 9vw, 5.2rem); }
.summary-max { font-size: 1.4rem; color: var(--muted); letter-spacing: 0; font-weight: 700; }
.summary-title { margin-top: 0.3rem; font-size: 1.3rem; font-weight: 900; color: var(--amber); letter-spacing: -0.01em; }
.summary-best { margin-top: 0.2rem; font-size: 0.95rem; font-weight: 700; color: var(--teal); }
.summary-blurb { margin-top: 0.4rem; color: var(--muted); font-size: 0.95rem; }
.summary-list { list-style: none; padding: 0; margin: 1.1rem 0 1.2rem; display: grid; gap: 0.35rem; }
.summary-row { padding: 0.5rem 0.7rem 0.55rem; border-radius: 14px; background: rgba(255, 255, 255, 0.07); }
.row-head { display: flex; justify-content: space-between; gap: 0.75rem; font-weight: 800; font-size: 0.95rem; }
.row-score { font-variant-numeric: tabular-nums; }
.row-bar { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); margin: 0.3rem 0 0.25rem; overflow: hidden; }
.row-fill { display: block; height: 100%; border-radius: 5px; background: var(--amber); }
.band-0 .row-fill, .band-1 .row-fill { background: var(--coral); }
.band-2 .row-fill, .band-3 .row-fill { background: #ff9d4a; }
.band-5 .row-fill, .band-6 .row-fill { background: var(--teal); }
.row-detail { font-size: 0.8rem; color: var(--muted); line-height: 1.35; }
.share { padding: 1rem; border-radius: 18px; background: rgba(255, 255, 255, 0.07); }
.share h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--faint); font-weight: 800; margin-bottom: 0.55rem; }
.share-text { width: 100%; resize: none; font: 0.95rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #fff; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 12px; padding: 0.65rem 0.75rem; }
.share-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.65rem; }
.share-status { min-height: 1.3em; margin-top: 0.4rem; font-size: 0.85rem; color: var(--teal); font-weight: 700; }
.summary-actions { margin-top: 0.9rem; }
.summary-actions .btn { width: 100%; }
.footer-note { margin-top: 1rem; font-size: 0.78rem; color: var(--faint); }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 44rem) {
  .hud { grid-template-columns: 1fr auto; row-gap: 0.45rem; }
  .scale { grid-column: 1 / -1; grid-row: 2; }
  .scale-track { width: min(24rem, 86vw); }
  .scale-caption { font-size: 0.9rem; white-space: normal; line-height: 1.2; }
  .scale-width { display: block; font-size: 0.78rem; }
  .scale-sep { display: none; }
  body[data-screen="start"]::before { inset: 0; background: linear-gradient(to top, rgba(6, 10, 40, 0.7) 0%, rgba(6, 10, 40, 0) 38%), linear-gradient(to bottom, rgba(6, 10, 40, 0.4) 0%, rgba(6, 10, 40, 0) 40%); }
  .screen { padding-top: calc(6.2rem + env(safe-area-inset-bottom) * 0 + env(safe-area-inset-top)); }
  .screen-start { justify-content: flex-start; padding-top: calc(7rem + env(safe-area-inset-top)); }
  .screen-start h1 { font-size: clamp(3.6rem, 19vw, 5.6rem); }
  .screen-start .mode-row { position: fixed; left: var(--pad); right: var(--pad); bottom: max(1.2rem, env(safe-area-inset-bottom)); margin: 0; flex-direction: column; gap: 0.6rem; }
  .screen-start .btn-mode { width: 100%; padding: 0.7rem 1.2rem; }
  .screen-start .fine { position: fixed; left: var(--pad); right: var(--pad); bottom: calc(max(1.2rem, env(safe-area-inset-bottom)) + 10.4rem); margin: 0; max-width: none; font-size: 0.8rem; }
  .screen-question { justify-content: flex-start; gap: 0.9rem; }
  .question-text { font-size: clamp(1.45rem, 6.6vw, 2.1rem); }
  .dots { margin-bottom: 0.7rem; }
  .field-row { padding-left: 1rem; flex-wrap: wrap; border-radius: 28px; row-gap: 0.4rem; padding-right: 0.45rem; }
  .guess-input { flex: 1 1 60%; }
  .unit { max-width: 6.5rem; font-size: 0.82rem; }
  .btn-go { flex: 1 1 100%; }
  .hint { display: none; }
  .preview { margin-left: 1rem; }
  .reveal-head { top: calc(6.9rem + env(safe-area-inset-top)); }
  .reveal-score > span:first-child { font-size: clamp(4.6rem, 26vw, 7rem); }
  .reveal-panel { left: 0.6rem; right: 0.6rem; width: auto; bottom: max(0.6rem, env(safe-area-inset-bottom)); padding: 0.95rem 1rem 1rem; gap: 0.42rem; border-radius: 22px; max-height: 62%; }
  .compare-value { font-size: 1.2rem; }
  .source-note { font-size: 0.8rem; }
  .skip-hint { bottom: max(0.9rem, env(safe-area-inset-bottom)); }
  .screen-summary { grid-template-columns: minmax(0, 1fr); padding-top: calc(5.4rem + env(safe-area-inset-top)); gap: 0.6rem; }
  .summary-hero { position: static; min-height: 36dvh; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 0.4rem; }
  .summary-reached { font-size: clamp(2.1rem, 11vw, 3.4rem); }
  .summary-far { font-size: 0.98rem; }
  .btn-big { padding: 0.9rem 1.5rem; }
}

@media (max-height: 34rem) and (orientation: landscape) {
  .screen-start h1 { font-size: 3.2rem; margin-bottom: 0.5rem; }
  .screen-start .lead { font-size: 1rem; margin-bottom: 1rem; }
  .screen-start .fine { display: none; }
  .reveal-score > span:first-child { font-size: 4.2rem; }
  .reveal-head { top: 4.4rem; text-align: left; left: var(--pad); right: auto; width: 20rem; padding: 0; }
  .reveal-panel { left: auto; right: var(--pad); top: 4.4rem; bottom: 0.7rem; width: min(24rem, 52vw); max-height: none; }
  .question-text { font-size: 1.6rem; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .b-fade:not(.hold) { transition: opacity 0.35s ease !important; }
  .world-fade:not(.hold) { transition: opacity 0.35s ease !important; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
}

/* ================================================================ battle mode */
/* setup: mode and difficulty */
.screen-setup { justify-content: flex-start; pointer-events: auto; overflow-y: auto; overscroll-behavior: contain; animation: rise 0.6s ease both; }
.screen-setup > * { pointer-events: auto; }
.setup-title { font-size: clamp(2.4rem, 6vw, 4.8rem); font-weight: 900; line-height: 1; letter-spacing: -0.04em; text-shadow: var(--shadow-text); margin: 0.4rem 0 0.8rem; }
.screen-setup .lead { max-width: 34rem; font-size: clamp(1rem, 1.8vw, 1.25rem); font-weight: 600; line-height: 1.3; text-shadow: var(--shadow-text); margin-bottom: 1.3rem; }
.diff-grid { border: 0; margin: 0 0 1.3rem; padding: 0; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; max-width: 64rem; }
.diff-card { position: relative; display: grid; align-content: start; gap: 0.3rem; padding: 1rem 1.05rem 1.05rem; border-radius: 22px; background: var(--glass); border: 2px solid var(--line); cursor: pointer; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease; }
.diff-card:hover { transform: translateY(-2px); background: var(--glass-strong); }
.diff-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.diff-card.is-selected { border-color: var(--amber); background: var(--glass-strong); box-shadow: 0 0 0 4px rgba(255, 210, 74, 0.22), 0 18px 46px rgba(2, 4, 24, 0.5); }
.diff-card:focus-within { outline: 3px solid #fff; outline-offset: 3px; }
.diff-head { display: flex; align-items: center; gap: 0.5rem; }
.diff-emoji { font-size: 1.5rem; line-height: 1; }
.diff-label { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; }
.diff-who { font-size: 0.9rem; font-weight: 800; color: var(--amber); }
.diff-tagline { font-size: 0.86rem; color: var(--muted); line-height: 1.32; }
.diff-record { margin-top: 0.3rem; font-size: 0.76rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.diff-card.is-selected .diff-record { color: var(--teal); }
.setup-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; }

/* the battle */
.battle { position: fixed; inset: 0; z-index: 6; background: #0b0e24; overflow: hidden; }
body[data-screen="battle"] .world, body[data-screen="battle"] .world-fade, body[data-screen="battle"] .scrim, body[data-screen="battle"] .hud { display: none; }
.b-half { position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; background: #7fc873; }
.b-you { left: 0; }
.b-cpu { right: 0; }
.b-world, .b-fade { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.b-fade { pointer-events: none; opacity: 0; transition: opacity 0.4s ease; }
.b-fade.hold { transition: none !important; }
.b-half::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(to bottom, rgba(6, 10, 40, 0.5) 0%, rgba(6, 10, 40, 0.12) 26%, rgba(6, 10, 40, 0) 60%, rgba(6, 10, 40, 0.32) 100%); }
.b-half.is-winner::before { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; border: 4px solid var(--amber); box-shadow: inset 0 0 70px rgba(255, 210, 74, 0.3); animation: rise 0.5s ease both; }
.b-seam { position: absolute; z-index: 3; left: 50%; top: 0; bottom: 0; width: 0; pointer-events: none; }
.b-seam::before { content: ""; position: absolute; left: -2px; top: 0; bottom: 0; width: 4px; background: #0b0e24; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28); }
.b-seam span { position: absolute; left: -1.35rem; top: 50%; margin-top: -1.35rem; width: 2.7rem; height: 2.7rem; display: grid; place-items: center; border-radius: 50%; background: var(--amber); color: #1b1740; font-weight: 900; font-size: 0.85rem; letter-spacing: 0.02em; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.battle[data-phase="locked"] .b-seam span { opacity: 0; }

.b-tag { position: absolute; z-index: 2; top: max(0.9rem, env(safe-area-inset-top)); width: 14rem; padding: 0.6rem 0.8rem 0.65rem; border-radius: 16px; background: var(--glass); border: 1.5px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.b-you .b-tag { left: 0.9rem; }
.b-cpu .b-tag { right: 0.9rem; }
.b-who { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; font-weight: 900; line-height: 1.2; }
.b-name { font-size: 1.05rem; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.b-pts { font-size: 0.8rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.b-pts strong { font-size: 1.15rem; color: var(--amber); font-variant-numeric: tabular-nums; }
.b-level { margin-top: 0.1rem; font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.b-track { height: 4px; margin-top: 0.4rem; border-radius: 4px; background: rgba(255, 255, 255, 0.22); overflow: hidden; }
.b-fill { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--teal), var(--amber)); }
.b-status { margin-top: 0.4rem; min-height: 1.25em; font-size: 0.82rem; font-weight: 800; color: var(--muted); }
.b-status:empty { display: none; }
.b-half[data-status="locked"] .b-status { color: var(--teal); }
.b-half[data-status="thinking"] .b-status::after { content: "\2026"; display: inline-block; width: 1em; text-align: left; animation: blink 1.2s steps(3, end) infinite; }
@keyframes blink { 0% { clip-path: inset(0 100% 0 0); } 100% { clip-path: inset(0 0 0 0); } }

.b-result { position: absolute; z-index: 2; left: 0; right: 0; top: 20%; padding: 0 1rem; text-align: center; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
.b-result.is-on { opacity: 1; }
.b-score { font-weight: 900; line-height: 0.95; letter-spacing: -0.05em; text-shadow: var(--shadow-text); font-variant-numeric: tabular-nums; }
.b-score-num { font-size: clamp(4.2rem, 16vmin, 8.5rem); }
.b-score-max { font-size: clamp(1.2rem, 4vmin, 2.4rem); color: var(--muted); margin-left: 0.15em; letter-spacing: 0; }
.b-score-line { margin-top: 0.35rem; font-size: clamp(1rem, 1.7vw, 1.45rem); font-weight: 800; text-shadow: var(--shadow-text); min-height: 1.3em; }
.b-score-guess { margin-top: 0.15rem; font-size: 0.95rem; font-weight: 700; color: var(--muted); text-shadow: var(--shadow-text); min-height: 1.3em; }
.b-win-chip { position: absolute; z-index: 3; left: 50%; top: 1.1rem; transform: translateX(-50%) scale(0.9); padding: 0.25rem 0.9rem; border-radius: 999px; background: var(--amber); color: #1b1740; font-size: 0.82rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0; transition: opacity 0.3s ease, transform 0.35s cubic-bezier(.2, .9, .25, 1.4); pointer-events: none; }
.b-win-chip.is-on { opacity: 1; transform: translateX(-50%) scale(1); }

.b-reach { position: absolute; z-index: 2; top: 8rem; width: max-content; max-width: min(26rem, calc(100% - 17rem)); text-shadow: var(--shadow-text); }
.b-you .b-reach { left: 1.1rem; }
.b-cpu .b-reach { right: 1.1rem; text-align: right; }
.b-reach-text { margin-top: 0.2rem; font-size: clamp(1.7rem, 3.6vw, 3.1rem); font-weight: 900; line-height: 1; letter-spacing: -0.035em; color: var(--amber); text-wrap: balance; }

.b-ui { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.b-ui > * { pointer-events: auto; }
.b-card { position: absolute; left: 0; right: 0; margin: 0 auto; top: max(0.9rem, env(safe-area-inset-top)); width: min(38rem, calc(100% - 30rem)); padding: 0.85rem 1.2rem 1rem; border-radius: 22px; background: var(--glass-strong); border: 1.5px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 20px 60px rgba(2, 4, 24, 0.5); animation: rise 0.5s ease both; }
.b-card-top { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.4rem; }
.b-chip { margin: 0; font-size: 0.7rem; padding: 0.12rem 0.65rem; }
.b-qno { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.b-timer { margin-left: auto; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: var(--amber); display: inline-flex; align-items: baseline; gap: 0.1rem; }
.b-timer strong { font-size: 2.7rem; letter-spacing: -0.03em; min-width: 1.2em; text-align: right; }
.b-timer span { font-size: 0.95rem; color: var(--muted); }
.b-timer.is-low { color: var(--coral); }
.b-timer.is-low strong { animation: pulse 0.5s ease-in-out infinite alternate; }
.b-question { font-size: clamp(1.25rem, 2.3vw, 2rem); line-height: 1.1; font-weight: 900; letter-spacing: -0.025em; text-wrap: balance; }
.b-asof { margin-top: 0.35rem; font-size: 0.82rem; font-weight: 700; color: var(--amber); }
.b-bar { height: 6px; margin-top: 0.7rem; border-radius: 6px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.b-bar-fill { display: block; height: 100%; width: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--amber-deep), var(--amber)); transform-origin: left center; }
.b-card.is-low .b-bar-fill { background: var(--coral); }

.b-form { position: absolute; left: 0; bottom: max(1.4rem, env(safe-area-inset-bottom)); width: 50%; padding: 0 1.2rem; }
.b-form .field-row { width: min(30rem, 100%); margin: 0 auto; }
.b-form .preview { width: min(30rem, 100%); margin: 0.6rem auto 0; padding-left: 1.4rem; text-shadow: var(--shadow-text); }
.b-form .guess-input { font-size: clamp(1.25rem, 2.2vw, 1.8rem); }
.b-form .field-row:has(input:disabled) { opacity: 0.6; }
.battle:not([data-phase="question"]):not([data-phase="locked"]) .b-card, .battle:not([data-phase="question"]):not([data-phase="locked"]) .b-form { display: none; }

.b-kicker { position: absolute; z-index: 4; left: 50%; top: max(0.9rem, env(safe-area-inset-top)); transform: translateX(-50%); padding: 0.35rem 1rem; border-radius: 999px; background: var(--glass); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; pointer-events: none; }
.b-kicker:empty { display: none; }
.b-banner { position: absolute; z-index: 7; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 0.8rem 2.1rem; border-radius: 999px; background: var(--amber); color: #1b1740; font-weight: 900; font-size: clamp(1.4rem, 3vw, 2.4rem); letter-spacing: -0.02em; white-space: nowrap; box-shadow: 0 14px 50px rgba(0, 0, 0, 0.45); pointer-events: none; }
.b-banner[data-kind="time"] { background: var(--coral); color: #fff; }
.b-banner.is-in { animation: pop 0.45s cubic-bezier(.2, .9, .25, 1.3) both; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -50%) scale(0.7); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.b-panel { position: absolute; z-index: 5; left: 50%; bottom: max(1.25rem, env(safe-area-inset-bottom)); width: min(40rem, calc(100% - 2rem)); display: grid; gap: 0.55rem; padding: 1.05rem 1.3rem 1.2rem; border-radius: 24px; background: var(--glass-strong); border: 1.5px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 24px 70px rgba(2, 4, 24, 0.55); max-height: calc(100% - 2rem); overflow: auto; opacity: 0; transform: translate(-50%, 24px); visibility: hidden; transition: opacity 0.45s ease, transform 0.55s cubic-bezier(.2, .9, .25, 1), visibility 0s linear 0.55s; }
.b-panel.is-ready { opacity: 1; transform: translate(-50%, 0); visibility: visible; transition-delay: 0s; }
.b-win { font-size: clamp(1.3rem, 2.4vw, 1.75rem); font-weight: 900; letter-spacing: -0.02em; }
.b-win[data-winner="you"] { color: var(--teal); }
.b-win[data-winner="cpu"] { color: #ffb4bf; }
.b-win[data-winner="tie"] { color: var(--amber); }
.b-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr); gap: 0.8rem; }
.b-col-value { font-weight: 900; font-size: clamp(1.15rem, 2.2vw, 1.55rem); line-height: 1.12; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.b-col-truth .b-col-value { color: var(--amber); }
.b-col-truth .b-col-value.is-long { font-size: clamp(0.95rem, 1.5vw, 1.1rem); line-height: 1.2; }
.b-col-pts { font-size: 0.85rem; font-weight: 800; color: var(--teal); }
.b-panel .reveal-actions .btn { width: 100%; }

.b-verdict { position: absolute; z-index: 5; left: 0; right: 0; margin: 0 auto; top: max(0.9rem, env(safe-area-inset-top)); width: min(32rem, calc(100% - 30rem)); padding: 0.9rem 1.2rem 1rem; border-radius: 24px; text-align: center; background: var(--glass-strong); border: 1.5px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 20px 60px rgba(2, 4, 24, 0.5); animation: rise 0.6s ease both; }
.b-verdict-title { font-size: clamp(2.2rem, 4.6vw, 3.8rem); font-weight: 900; line-height: 1; letter-spacing: -0.04em; margin: 0.2rem 0; color: var(--amber); }
.b-verdict[data-outcome="you"] .b-verdict-title { color: var(--teal); }
.b-verdict[data-outcome="cpu"] .b-verdict-title { color: #ffb4bf; }
.b-verdict-score { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.b-verdict-line { margin-top: 0.35rem; font-size: 0.88rem; color: var(--muted); font-weight: 600; line-height: 1.35; }

.b-end { position: absolute; z-index: 5; left: 0; right: 0; margin: 0 auto; bottom: max(1.1rem, env(safe-area-inset-bottom)); width: min(44rem, calc(100% - 2rem)); padding: 0.9rem 1.1rem 1rem; border-radius: 24px; background: var(--glass-strong); border: 1.5px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 24px 70px rgba(2, 4, 24, 0.55); animation: rise 0.6s ease 0.15s both; }
.b-end-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.b-end-actions .btn { padding: 0.55rem 1.05rem; font-size: 0.95rem; }
.b-end .share-status { margin-top: 0.3rem; min-height: 1.2em; }
.b-results { margin-top: 0.4rem; }
.b-results > summary { cursor: pointer; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding: 0.2rem 0; }
.b-results > summary:hover { color: #fff; }
.b-rows { list-style: none; padding: 0; margin: 0.4rem 0 0.7rem; display: grid; gap: 0.3rem; max-height: min(22rem, 34vh); overflow-y: auto; overscroll-behavior: contain; }
.b-row { display: grid; grid-template-columns: minmax(0, 1fr) 2.6rem 1.3rem 2.6rem; align-items: baseline; gap: 0 0.5rem; padding: 0.3rem 0.65rem 0.35rem; border-radius: 12px; background: rgba(255, 255, 255, 0.07); }
.b-row-name { font-weight: 800; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-row-score { font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; }
.b-row-mark { text-align: center; color: var(--faint); font-size: 0.75rem; }
.b-row-you .b-row-you, .b-row-cpu .b-row-cpu { color: var(--amber); }
.b-row-you .b-row-mark { color: var(--teal); }
.b-row-cpu .b-row-mark { color: #ffb4bf; }
.b-row-detail { grid-column: 1 / -1; font-size: 0.76rem; color: var(--muted); }
.b-end .share-text { font-size: 0.85rem; }

.b-quit { position: absolute; z-index: 4; left: 50%; bottom: max(0.9rem, env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 0.35rem 1rem; font-size: 0.8rem; background: var(--glass); }
.battle:not([data-phase="question"]) .b-quit { display: none; }
.b-skip { position: absolute; z-index: 4; left: 0; right: 0; bottom: max(1.1rem, env(safe-area-inset-bottom)); text-align: center; font-size: 0.85rem; font-weight: 600; color: var(--muted); text-shadow: var(--shadow-text); pointer-events: none; }

/* a phone (or any tall, narrow window): the two worlds stack, you on top */
@media (max-width: 704px), (max-aspect-ratio: 100/115) {
  .diff-grid { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .diff-card { padding: 0.65rem 0.9rem 0.7rem; grid-template-columns: 7.4rem minmax(0, 1fr); column-gap: 0.8rem; align-items: center; }
  .diff-head { grid-row: 1 / span 3; }
  .diff-emoji { font-size: 1.4rem; }
  .diff-label { font-size: 1.25rem; }
  .diff-who { font-size: 0.82rem; }
  .diff-tagline { font-size: 0.78rem; }
  .diff-record { margin-top: 0; font-size: 0.68rem; }
  .screen-setup .lead { display: none; }
  .screen-setup { padding-top: calc(3.9rem + env(safe-area-inset-top)); }
  body[data-screen="battle-setup"] .scale { display: none; }
  .setup-title { font-size: clamp(2.2rem, 11vw, 3.2rem); }
  .setup-actions .btn-big { flex: 1 1 auto; }

  .b-half { left: 0; right: 0; width: 100%; height: 50%; bottom: auto; }
  .b-you { top: 0; }
  .b-cpu { top: 50%; }
  .b-seam { left: 0; right: 0; top: 50%; bottom: auto; width: auto; height: 0; }
  .b-seam::before { left: 0; right: 0; top: -2px; bottom: auto; width: auto; height: 4px; }
  .b-seam span { left: auto; right: 0.8rem; top: auto; margin-top: -1.1rem; width: 2.2rem; height: 2.2rem; font-size: 0.72rem; }
  .b-tag { width: 14rem; padding: 0.45rem 0.65rem 0.5rem; border-radius: 14px; }
  .b-you .b-tag { top: auto; bottom: 0.7rem; left: 0.7rem; right: auto; }
  .b-cpu .b-tag { top: 0.7rem; left: 0.7rem; right: auto; }
  .b-name { font-size: 0.95rem; }
  .b-level { font-size: 0.74rem; }
  .b-status { margin-top: 0.25rem; font-size: 0.76rem; }

  .b-ui { display: flex; flex-direction: column; gap: 0.45rem; padding: max(0.5rem, env(safe-area-inset-top)) 0.55rem 0; }
  .b-card, .b-form { position: static; transform: none; width: auto; left: auto; right: auto; margin: 0; bottom: auto; padding: 0; }
  .b-card { padding: 0.6rem 0.8rem 0.7rem; border-radius: 18px; }
  .b-card-top { margin-bottom: 0.25rem; gap: 0.5rem; }
  .b-timer strong { font-size: 1.6rem; }
  .b-question { font-size: 1.12rem; line-height: 1.12; }
  .b-bar { margin-top: 0.5rem; height: 5px; }
  .b-form .field-row { width: 100%; padding: 0.3rem 0.3rem 0.3rem 1rem; flex-wrap: nowrap; border-radius: 999px; }
  .b-form .guess-input { flex: 1 1 0; font-size: 1.3rem; }
  .b-form .unit { max-width: 5rem; font-size: 0.72rem; }
  .b-form .btn-go { flex: 0 0 auto; padding: 0.6rem 1.1rem; font-size: 0.98rem; }
  .b-form .preview { margin: 0.25rem 0 0 1rem; width: auto; padding: 0; font-size: 0.8rem; min-height: 1.2em; text-shadow: var(--shadow-text); }
  .b-kicker { display: none; }

  .b-you .b-result { top: 2.4rem; }
  .b-cpu .b-result { top: 5.5rem; }
  .b-score-num { font-size: clamp(3.2rem, 12vmin, 4.4rem); }
  .b-score-line { font-size: 1rem; }
  .b-score-guess { display: none; }
  .b-win-chip { left: auto; right: 0.7rem; top: 0.7rem; transform: scale(0.9); transform-origin: right top; font-size: 0.72rem; }
  .b-win-chip.is-on { transform: scale(1); }
  .b-cpu .b-win-chip { top: 2.9rem; }
  .b-reach { top: 8.2rem; max-width: calc(100% - 1.4rem); }
  .b-you .b-reach, .b-cpu .b-reach { left: 0.7rem; right: auto; text-align: left; }
  .b-cpu .b-reach { top: 5.4rem; }
  .b-banner { top: 31%; font-size: 1.45rem; padding: 0.6rem 1.7rem; }
  .b-reach-text { font-size: clamp(1.5rem, 8vw, 2.3rem); }

  .b-panel { left: 0.55rem; right: 0.55rem; width: auto; transform: translateY(24px); bottom: max(0.55rem, env(safe-area-inset-bottom)); padding: 0.8rem 0.95rem 0.9rem; gap: 0.35rem; border-radius: 20px; max-height: 58%; }
  .b-panel.is-ready { transform: none; }
  .b-panel { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "win next" "cols cols" "src src" "note note"; align-items: center; column-gap: 0.6rem; }
  .b-win { grid-area: win; font-size: 1.15rem; line-height: 1.15; }
  .b-panel .reveal-actions { grid-area: next; margin: 0; }
  .b-panel .reveal-actions .btn { width: auto; }
  .b-cols { grid-area: cols; gap: 0.5rem; }
  .b-source { grid-area: src; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .b-panel .note { grid-area: note; }
  .b-col-value { font-size: 1.02rem; }
  .b-col-pts { font-size: 0.78rem; }
  .b-source { font-size: 0.8rem; }
  .b-panel .btn-big { padding: 0.6rem 1.15rem; font-size: 0.98rem; }
  .b-verdict { left: 0.55rem; right: 0.55rem; margin: 0; width: auto; transform: none; top: max(0.55rem, env(safe-area-inset-top)); padding: 0.6rem 0.9rem 0.7rem; border-radius: 20px; }
  .b-verdict-title { font-size: 2.1rem; }
  .b-verdict-score { font-size: 1rem; }
  .b-verdict-line { display: none; }
  .b-end { left: 0.55rem; right: 0.55rem; margin: 0; width: auto; transform: none; bottom: max(0.55rem, env(safe-area-inset-bottom)); padding: 0.7rem 0.8rem 0.8rem; border-radius: 20px; }
  .b-end-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
  .b-end-actions .btn { padding: 0.5rem 0.3rem; font-size: 0.88rem; }
  .b-end-actions #b-change { grid-column: span 2; }
  .b-col-truth .b-col-value.is-long { font-size: 0.85rem; }
  .b-rows { max-height: 30vh; }
  .b-quit { bottom: max(0.6rem, env(safe-area-inset-bottom)); }
  .b-skip { bottom: max(0.8rem, env(safe-area-inset-bottom)); }
}

/* a short, wide window (a phone on its side): squeeze the vertical sizes */
@media (max-height: 34rem) and (min-aspect-ratio: 100/115) {
  .b-tag { width: 11rem; padding: 0.4rem 0.6rem; }
  .b-card { padding: 0.5rem 0.9rem 0.6rem; }
  .b-question { font-size: 1.15rem; }
  .b-timer strong { font-size: 1.5rem; }
  .b-form { bottom: 0.6rem; }
  .b-score-num { font-size: 4rem; }
  .b-result { top: 14%; }
  .b-panel { padding: 0.7rem 1rem; gap: 0.3rem; }
  .b-reach { top: 6rem; }
  .b-verdict-title { font-size: 2rem; }
  .b-verdict-line { display: none; }
  .b-rows { max-height: 8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .b-half[data-status="thinking"] .b-status::after { animation: none; }
}
