/* Layout: the screen is a floodlit stadium. The field fills it, and each play is called over the top. */
:root {
  color-scheme: dark;
  --night: #0a2f1d; --night-glass: #0a2f1dee; --turf: #17643b; --turf-deep: #0e4a2a; --turf-line: #2a8152;
  --chalk: #f3f7ee; --chalk-dim: #b9cfbd; --pylon: #ff7a1a; --bulb: #ffc83d; --miss: #ff9b8a;
  --display: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
  --body: 'Barlow Semi Condensed', 'Arial Narrow', Arial, sans-serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
}
* { box-sizing: border-box; }
/* Panels like .reveal set their own display, which would otherwise beat the hidden attribute and leave
   the last result covering the answer box. */
[hidden] { display: none !important; }
html, body { min-height: 100%; }
html { touch-action: manipulation; }
body { margin: 0; background: var(--night); color: var(--chalk); font: 500 18px/1.4 var(--body); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body.in-stage { overflow: hidden; overscroll-behavior: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--bulb); outline-offset: 2px; }
.kb-hold { position: fixed; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; font-size: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.stage { position: fixed; top: var(--vtop, 0); left: 0; right: 0; height: var(--vh, 100dvh); overflow: hidden; background: var(--night); }
.field { position: absolute; inset: 0; display: block; }
.stage { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.stage input { -webkit-user-select: text; user-select: text; }

.primary { background: var(--pylon); color: #2a1200; border: 0; border-radius: 6px; padding: 12px 18px; font: 900 22px/1 var(--display); letter-spacing: .01em; }
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: .55; }
.primary.big { width: 100%; padding: 16px 18px; font-size: 26px; }
.ghost { background: none; color: var(--chalk); border: 2px solid var(--turf-line); border-radius: 6px; padding: 10px 14px; font-weight: 600; }
.ghost:hover { border-color: var(--chalk-dim); }
.link { background: none; border: 0; padding: 4px 0; color: var(--chalk); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; font-size: 17px; }

/* Title */
.title .logo { position: relative; z-index: 2; padding: calc(36px + env(safe-area-inset-top, 0px)) var(--gutter) 0; pointer-events: none; }
.logo h1 { margin: 0; font: 900 clamp(76px, 25vw, 150px)/.84 var(--display); letter-spacing: -.005em; text-shadow: 0 3px 0 #04170d; }
.logo p { margin: 10px 0 0; max-width: 24em; font-size: 19px; font-weight: 600; }
.dock { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: grid; gap: 10px; padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--night); }
.dock .sub { margin: 0; min-height: 22px; color: var(--chalk-dim); font-size: 16px; font-variant-numeric: tabular-nums; }
.links { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.status { margin: 0; padding: 8px 10px; background: var(--bulb); color: #2a1b00; border-radius: 4px; font-weight: 700; }
.beat { margin: 0; color: var(--bulb); font-weight: 700; }

/* Game */
.hud { position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(8px + env(safe-area-inset-top, 0px)) var(--gutter) 8px; background: var(--night-glass); font-variant-numeric: tabular-nums; }
.hud b { font: 800 22px/1 var(--display); }
.hud-y b { color: var(--bulb); display: inline-block; }
.hud-y b.pop { animation: pop .3s ease-out; }
.pips { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.pips li { width: 14px; height: 14px; background: #ffffff1f; border-radius: 2px; }
.pips li.now { outline: 2px solid var(--chalk); outline-offset: 1px; }
.tag { position: absolute; z-index: 3; top: 46px; left: var(--gutter); margin: 0; font-size: 15px; color: var(--bulb); font-weight: 600; }
.call { position: absolute; z-index: 2; top: calc(46px + env(safe-area-inset-top, 0px)); left: 0; right: 0; padding: 12px var(--gutter) 12px; background: var(--night-glass); }
.game[data-mode]:not([data-mode="daily"]) .call { padding-top: 32px; }
.prompt { margin: 0; font: 800 clamp(30px, 8.6vw, 46px)/1.03 var(--display); text-wrap: balance; }
.prompt:focus { outline: none; }
.word { animation: word .28s ease-out backwards; display: inline-block; white-space: pre; }
.rule { margin: 6px 0 0; color: var(--chalk-dim); font-size: 16px; line-height: 1.3; }
.ready { margin: 4px 0 0; min-height: 22px; color: var(--bulb); font-weight: 700; font-size: 16px; }
.bar { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; padding: 0 var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--night); }
.timeline { height: 6px; margin: 0 calc(-1 * var(--gutter)) 10px; background: #ffffff1a; }
.timeline i { display: block; height: 100%; background: var(--bulb); transform-origin: left; }
.timeline.low i { background: var(--pylon); }
.bar-row { display: flex; align-items: center; gap: 8px; }
.ring { position: relative; flex: none; width: 54px; height: 54px; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: #ffffff26; stroke-width: 4; }
.ring .arc { stroke: var(--bulb); stroke-dasharray: 100; stroke-dashoffset: 0; }
.ring.low .arc { stroke: var(--pylon); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 900 24px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--bulb); }
.ring.low b { color: var(--pylon); }
input.guess { flex: 1; min-width: 0; height: 54px; padding: 0 12px; font-size: 20px; font-weight: 600; background: var(--chalk); color: var(--night); border: 0; border-radius: 6px; }
input.guess::placeholder { color: #55705c; font-weight: 500; }
input.guess.shake { animation: shake .3s linear; }
.throw { height: 54px; }
.wait { position: absolute; z-index: 3; left: 0; right: 0; top: 34%; margin: 0; text-align: center; font: 800 30px/1 var(--display); text-shadow: 0 2px 0 #04170d; }
.boot { margin: 0; min-height: 100vh; display: grid; place-items: center; font: 900 clamp(56px, 18vw, 110px)/1 var(--display); }
.streak-now { color: var(--bulb); font-weight: 700; }
.hint { margin: 6px 0 0; min-height: 22px; color: var(--miss); font-weight: 600; font-size: 16px; line-height: 1.25; }
.reveal { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; display: grid; gap: 12px; padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--night); }
.verdict h2 { margin: 0; font: 900 clamp(40px, 12vw, 60px)/1 var(--display); animation: stamp .26s ease-out; }
.verdict .detail { margin: 4px 0 0; font-size: 21px; font-weight: 600; }
.verdict .quip { margin: 2px 0 0; color: var(--chalk-dim); }

/* Pages */
.page { max-width: 680px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top, 0px)) var(--gutter) 36px; padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.page h1 { margin: 0; font: 900 44px/1 var(--display); }
.page h2 { margin: 0 0 8px; font: 800 28px/1.1 var(--display); }
.page h3 { margin: 0; font: 700 20px/1.2 var(--body); }
.page p { margin: 0; }
.page section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.back { justify-self: start; }
.lede { font-size: 20px; }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ladder li { display: grid; grid-template-columns: 58px 1fr; align-items: baseline; }
.ladder b { font: 900 30px/1 var(--display); font-variant-numeric: tabular-nums; }
.days { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.days .ghost { width: 100%; text-align: left; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.setting select, .field-row select { padding: 10px; background: var(--turf-deep); border: 2px solid var(--turf-line); border-radius: 6px; font-weight: 600; max-width: 60%; }
.setting input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--pylon); }
.field-row { display: flex; flex-wrap: wrap; gap: 8px; }
.field-row input { flex: 1 1 140px; min-width: 0; padding: 10px; background: var(--chalk); color: var(--night); border: 0; border-radius: 6px; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .big { flex: 1 1 200px; width: auto; }
.game-no { color: var(--chalk-dim); }
.total { display: flex; align-items: baseline; gap: 10px; }
.total b { font: 900 clamp(96px, 30vw, 150px)/.84 var(--display); color: var(--bulb); font-variant-numeric: tabular-nums; }
.total span { font: 800 30px/1 var(--display); }
.headline { gap: 6px !important; }
.headline h1 { font-size: 38px; color: var(--chalk); }
.share-text { margin: 0; padding: 12px; background: var(--turf-deep); border-radius: 6px; font: 600 18px/1.4 var(--body); white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
.note:empty { display: none; }
.note { color: var(--bulb); font-weight: 600; }
.chart { display: block; width: 100%; height: auto; background: var(--turf-deep); border-radius: 6px; }
.cal { list-style: none; margin: 4px 0; padding: 0; display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; max-width: 420px; }
.cal li { aspect-ratio: 1; background: #ffffff14; border-radius: 2px; }
.cal li.hit { background: var(--bulb); }
.review { list-style: none; margin: 0; padding: 0; }
.review > li { padding-block: 12px; border-top: 2px solid var(--turf-deep); display: grid; gap: 3px; }
.review p { color: var(--chalk-dim); font-size: 16px; }
.review .mine { color: var(--chalk); font-weight: 600; font-size: 18px; }
.review .beat { color: var(--bulb); }
.tag-t { font-weight: 700; }
.bands { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.bands li { display: flex; justify-content: space-between; padding: 4px 8px; }
.bands li.me { background: var(--turf); font-weight: 700; }
.pass { background: var(--turf-deep); border-radius: 6px; padding: 16px; justify-items: start; }
.ad { min-height: 250px; background: var(--turf-deep); }
.foot { color: var(--chalk-dim); font-size: 14px; }
.foot a { color: var(--chalk-dim); margin-left: 4px; }
.stack { display: grid; gap: 10px; max-width: 460px; }
.stack input { padding: 12px; font-size: 18px; background: var(--chalk); color: var(--night); border: 0; border-radius: 6px; font-weight: 600; min-width: 0; }
.save { background: var(--turf-deep); border-radius: 6px; padding: 14px; justify-items: start; }
.league { display: grid; gap: 6px; padding-block: 10px; border-top: 2px solid var(--turf-deep); }
.league .rule { margin: 0; }
.band-head { color: var(--chalk-dim); font-size: 15px; }
.code { font-size: 26px; letter-spacing: .04em; text-align: center; font-variant-numeric: tabular-nums; }
.tip { background: var(--turf-deep); border-radius: 6px; padding: 14px; gap: 10px !important; justify-items: start; }
.tip .actions { align-items: center; }
a.ghost { display: inline-block; text-decoration: none; }
.check { display: flex; align-items: center; gap: 10px; }
.stack .check input { width: 24px; height: 24px; padding: 0; accent-color: var(--pylon); flex: none; }
.perks { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.vs { background: var(--turf-deep); border-radius: 6px; padding: 14px; }

/* Long unbroken guesses must wrap, not push the page sideways. */
.review, .hint { overflow-wrap: anywhere; }
/* Short screens: a phone held sideways, or any phone with the keyboard up. The question and answer box must both fit. */
/* Short phones, like the iPhone SE: leave the field room by tightening the title. */
@media (max-height: 620px) {
  .title .logo { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .logo h1 { font-size: clamp(56px, 19vw, 90px); }
  .logo p { display: none; }
  .dock { gap: 6px; padding-block: 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .dock .link { font-size: 16px; }
  .dock .primary.big { padding-block: 12px; font-size: 22px; }
}
/* Big screens: keep the answer box and result to a comfortable width. */
@media (min-width: 900px) {
  .call { text-align: center; }
  .bar-row, .hint, .verdict, .reveal .primary { width: 100%; max-width: 760px; margin-inline: auto; }
}
@media (max-height: 420px) {
  .hud { padding-block: calc(2px + env(safe-area-inset-top, 0px)) 2px; }
  .call { top: calc(30px + env(safe-area-inset-top, 0px)); padding-block: 4px; }
  .prompt { font-size: clamp(20px, 6vh, 26px); }
  .rule { display: none; }
  .ready { margin: 0; min-height: 0; font-size: 14px; }
  .timeline { margin-bottom: 4px; }
  .ring { width: 40px; height: 40px; }
  .ring b { font-size: 18px; }
  input.guess, .throw { height: 40px; }
  .hint { margin: 2px 0 0; min-height: 0; font-size: 14px; }
  .bar { padding-bottom: 4px; }
  .reveal { padding-block: 6px; gap: 6px; }
  .verdict h2 { font-size: 28px; }
  .verdict .detail { margin: 0; font-size: 17px; }
  .verdict .quip { display: none; }
  .primary.big { padding: 10px 18px; font-size: 20px; }
}
@keyframes word { from { opacity: 0; transform: translateY(6px); } }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes pop { 40% { transform: scale(1.35); } }
@keyframes stamp { from { opacity: 0; transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
