/* Skillion: pixel-art night ski resort. Hard edges everywhere: notched "pixel" borders made of box-shadows, no rounded
 * corners, the pixel font for UI and clues. Tier colours (gold, purple, red, blue, white) match the clue order. */
:root {
  --bg: #0d192b;
  --panel: rgba(13, 25, 43, 0.88);
  --panel-solid: #14243b;
  --edge: #2c456b;
  --ink: #eef3f8;
  --muted: #a9bad0;
  --snow: #e9f0f8;
  --accent: #3ed8eb;
  --accent-dark: #1d8fa0;
  --good: #6be08f;
  --bad: #fe5355;
  --gold: #f5c84c;
  --pixel: "Press Start 2P", ui-monospace, monospace; /* logo, numbers, buttons */
  --text: "IBM Plex Mono", ui-monospace, monospace; /* clues and body: must stay easy to read */
  --px: 3px; /* one "pixel" of the UI's pixel borders */
  --vvh: 100svh;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--ink); } /* no body background: it would paint over the scene canvas */
body { font: 500 16px/1.4 var(--text); overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; image-rendering: pixelated; z-index: -1;
  /* Dimmed (Anish 2026-11-23: text was hard to read): the scene is atmosphere, not something to compete with the text. */
  filter: brightness(0.55) saturate(0.75); }
/* A darker wash low down, where the bright snow sits behind the guess box and links. */
body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(8, 14, 26, 0) 35%, rgba(8, 14, 26, 0.55) 100%); }
#app { max-width: 520px; margin: 0 auto; position: relative; }
.loading { text-align: center; color: var(--muted); padding: 40vh 16px 0; margin: 0; }
.screen { padding: 16px; }
.enter { animation: enter 0.28s steps(6) both; }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } }

/* Notched pixel border: four hard box-shadows leave the corners cut out, like an 8-bit window. */
.panel, .btn, .clues li, .guess input, .card, .track {
  box-shadow: 0 calc(-1 * var(--px)) 0 0 var(--edge), 0 var(--px) 0 0 var(--edge), calc(-1 * var(--px)) 0 0 0 var(--edge), var(--px) 0 0 0 var(--edge);
}
.panel { background: var(--panel); padding: 12px 14px; margin: var(--px); }

.btn { font: 14px/1 var(--pixel); border: 0; padding: 14px 22px; cursor: pointer; color: #062430; background: var(--accent); --edge: #0b3a44; text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge), inset 0 -4px 0 0 var(--accent-dark); }
.btn:active { transform: translateY(2px); box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge), inset 0 -1px 0 0 var(--accent-dark); }
.btn:focus-visible { outline: 3px dashed var(--gold); outline-offset: 6px; }

/* Skier sprite (16×14 source pixels). */
.skier { image-rendering: pixelated; display: block; }

/* Intro */
.intro { min-height: var(--vvh); display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.logo { font: clamp(30px, 10vw, 44px)/1 var(--pixel); margin: 0; text-transform: uppercase; color: var(--snow); text-shadow: 4px 4px 0 #1d8fa0, 8px 8px 0 #0a1322; }
/* The mark (brand/logo.js → public/logo.svg): pixel art, so never smoothed. */
.mark { image-rendering: pixelated; display: block; }
.mark.hero { width: 96px; height: 96px; animation: bob-mark 2.4s steps(2) infinite; }
@keyframes bob-mark { 50% { transform: translateY(-3px); } }
.results .home { display: inline-block; margin-top: 8px; }
.results .home .mark { width: 48px; height: 48px; }
.intro .num { color: var(--gold); margin: 14px 0 4px; font: 12px var(--pixel); }
/* How to play: a looping mini-run (see playDemo in app.js) and three one-line steps. */
.demo { display: flex; flex-direction: column; gap: 8px; }
.demo-track { height: 10px; background: #0a1322; position: relative; overflow: hidden; }
.demo-track .fill { position: absolute; inset: 0; transform-origin: left; background: repeating-linear-gradient(90deg, var(--snow) 0 10px, #cfdbea 10px 12px); }
.demo .demo-clues { gap: 7px; padding: 0 2px; }
.demo .demo-clues li { font-size: 14px; line-height: 1.2; padding: 6px 10px; box-shadow: 0 -2px 0 0 var(--edge), 0 2px 0 0 var(--edge), -2px 0 0 0 var(--edge), 2px 0 0 0 var(--edge), inset 0 -3px 0 0 rgba(0, 0, 0, 0.18); }
.demo .demo-clues .tn { font-size: 7px; }
.demo .demo-clues .tn img { width: 14px; height: 14px; }
.demo:not(.shown) .demo-clues li { opacity: 0; }
.demo.shown .demo-clues li { animation: drop 0.32s steps(5) both; animation-delay: calc(var(--i) * 220ms); }
.demo-guess { position: relative; display: flex; align-items: center; min-height: 36px; padding: 6px 10px; background: #0a1322; font-weight: 700; font-size: 15px;
  box-shadow: 0 -2px 0 0 #2c456b, 0 2px 0 0 #2c456b, -2px 0 0 0 #2c456b, 2px 0 0 0 #2c456b; }
.demo-guess .caret { width: 8px; height: 16px; background: var(--accent); margin-left: 2px; animation: blink 0.8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.demo-guess .pop { position: absolute; right: 10px; font: 13px var(--pixel); color: var(--good); opacity: 0; }
.demo.solved .demo-guess { box-shadow: 0 -2px 0 0 var(--good), 0 2px 0 0 var(--good), -2px 0 0 0 var(--good), 2px 0 0 0 var(--good); color: var(--good); }
.demo.solved .demo-guess .caret { display: none; }
.demo.solved .pop { opacity: 1; animation: pop 0.3s steps(4) both; }
.steps { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: baseline; font-size: 15px; line-height: 1.35; }
.steps b { font: 11px var(--pixel); color: #0a1322; background: var(--gold); padding: 4px 6px; flex: none; }
.steps em { font-style: normal; color: var(--gold); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.intro .btn { align-self: flex-start; margin-top: 8px; }
/* Returning players: no rules panel, a big Drop in. */
.intro .btn.big { align-self: stretch; font-size: 22px; padding: 24px; margin: 18px var(--px) 0; } /* full width, same as the demo panel */
.intro .nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 12px; align-self: stretch; margin: 18px var(--px) 0; }
.intro .nav .btn { font-size: 9px; padding: 12px 4px; white-space: nowrap; margin: 0; }


/* Clues: colour + order carry the tier (the name is in aria-label); dark text on every tier but purple. */
.clues { list-style: none; margin: 0; padding: 0 var(--px); display: flex; flex-direction: column; gap: 12px; }
.clues li { background: var(--tier); --edge: rgba(0, 0, 0, 0.55); color: #0d131c; font-weight: 700; font-size: 19px; line-height: 1.25; padding: 11px 14px; overflow-wrap: anywhere; box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge), inset 0 -4px 0 0 rgba(0, 0, 0, 0.18), inset 0 3px 0 0 rgba(255, 255, 255, 0.22); }
.clues li.t2 { color: #fff; }
.clues li { display: flex; flex-direction: column; gap: 3px; }
.tn { display: flex; align-items: center; gap: 6px; font: 8px/1 var(--pixel); text-transform: uppercase; opacity: 0.8; }
.tn img { width: 18px; height: 18px; image-rendering: pixelated; }
.clues li.locked { background: #3a4458; color: #8d99ab; --edge: rgba(0, 0, 0, 0.4); }
.clues li.locked .tn img { filter: grayscale(1) opacity(0.6); }
.clues.drop li { animation: drop 0.32s steps(5) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes drop { from { opacity: 0; transform: translateY(-14px); } }
.clues.small { gap: 7px; margin-top: 8px; }
.clues.small li { font-size: 14px; padding: 5px 8px; box-shadow: 0 -2px 0 0 var(--edge), 0 2px 0 0 var(--edge), -2px 0 0 0 var(--edge), 2px 0 0 0 var(--edge); }
.example li { font-size: 15px; padding: 7px 10px; }

/* Play: header, timer track, clues (with the reveal card over them), feedback, guess box at the bottom. */
.play { height: var(--vvh); display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
/* Site name on the play screen, so screenshots and screen recordings say where the game is. */
.brandbar { display: flex; align-items: center; justify-content: center; gap: 8px; font: 13px/1 var(--pixel); color: var(--snow); letter-spacing: 0.5px; text-shadow: 2px 2px 0 #0a1322; }
.brandbar img { width: 22px; height: 22px; image-rendering: pixelated; }
.bar { display: flex; justify-content: space-between; color: var(--muted); font: 11px/1 var(--pixel); padding: 0 var(--px); }
.bar .tot { color: var(--gold); font-weight: 700; }
.ask { margin: 6px 0 2px; text-align: center; font: 600 15px/1.2 var(--text); color: var(--snow); text-shadow: 1px 1px 0 #0a1322; }
.stage:has(.card:not([hidden])) .ask { display: none; }
.track { position: relative; height: 30px; margin: 4px var(--px) 0; background: #0a1322; --edge: #2c456b; }
.track .fill { position: absolute; inset: 0; transform-origin: left; background: repeating-linear-gradient(90deg, var(--snow) 0 12px, #cfdbea 12px 14px); }
.track.low .fill { background: repeating-linear-gradient(90deg, #ffb3b4 0 12px, var(--bad) 12px 14px); }
.track .secs { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font: 12px/1 var(--pixel); color: #0a1322; }
.track.low .secs { color: #fff; }
.rider { position: absolute; bottom: 4px; width: 36px; height: auto; scale: -1 1; } /* faces downhill (left), the way the timer drains */
/* Between prompts: the snow refills and the skier rides the lift back to the top, in steps like the rest of the art. */
.track.reset .fill { transition: transform 1.2s steps(12); }
.track.reset .rider { transition: left 1.2s steps(12); scale: 1 1; animation: bob 0.8s steps(2) 1.2s infinite; }
@keyframes bob { 50% { transform: translateY(-2px); } }
.card.ready { --edge: var(--accent); }
.card.ready .verdict { color: var(--accent); }
.rider.jump { animation: jump 0.6s steps(6); }
@keyframes jump { 40% { transform: translateY(-26px) rotate(-12deg); } }
.rider.wipeout { animation: wipeout 0.7s steps(7) forwards; }
@keyframes wipeout { to { transform: translate(10px, 4px) rotate(200deg); opacity: 0.85; } }

.stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.clueslot { flex: 1; min-height: 0; overflow-y: auto; padding: var(--px) 0; }
.card { position: absolute; inset: 0 0 auto 0; max-height: calc(100% - 2 * var(--px)); background: var(--panel-solid); padding: 14px; overflow-y: auto; cursor: pointer; animation: slideup 0.26s steps(5) both; margin: var(--px); }
.card[hidden] { display: none; }
@keyframes slideup { from { transform: translateY(24px); opacity: 0; } }
.card.won { --edge: var(--good); }
.card.lost { --edge: var(--bad); }
.verdict { font: 26px/1.2 var(--pixel); margin: 0; }
.verdict small { font-size: 13px; color: var(--muted); }
.won .verdict { color: var(--good); }
.lost .verdict { color: var(--bad); }
.card h2 { font: 700 26px/1.1 var(--text); margin: 10px 0 4px; }
.note { color: var(--muted); margin: 10px 0 0; }
.hint { color: var(--muted); margin: 12px 0 0; font-size: 15px; }

.feedback { min-height: 1.35em; margin: 0 var(--px); padding: 3px 8px; color: var(--muted); align-self: flex-start; background: var(--panel); }
.feedback:empty { background: none; }
.feedback.close { color: var(--gold); }
.feedback.wrong { color: var(--bad); }
.guess { display: flex; gap: 12px; padding: var(--px); }
.guess input { flex: 1; min-width: 0; font: 700 17px var(--text); padding: 12px; border: 0; background: #0a1322; color: var(--ink); --edge: #2c456b; }
.guess input:focus { outline: none; --edge: var(--accent); }
/* Between prompts: no guess box, just a full-width Next. */
/* "Name a…" fixed at the start of the box (Anish 2026-11-24), so the player types straight after it: a reminder of what
   kind of answer to give that costs no height. */
.guess .field { flex: 1; min-width: 0; position: relative; display: flex; }
.guess .field input { width: 100%; padding-left: 98px; }
.guess .pre { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font: 700 17px var(--text); color: var(--muted); pointer-events: none; }
html.tight .guess .field input { padding-left: 90px; }
html.tight .guess .pre { left: 10px; font-size: 16px; }
.guess.paused .field { display: none; }
.guess.paused .btn { flex: 1; padding: 16px; font-size: 18px; }
.guess .btn { padding: 12px 18px; }
.shake { animation: shake 0.3s steps(4); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Pixel snow burst on a correct guess. */
.burst { position: fixed; width: 0; height: 0; pointer-events: none; z-index: 10; }
.burst i { position: absolute; width: 6px; height: 6px; background: var(--snow); animation: puff 0.7s steps(7) forwards; }
.burst i:nth-child(3n) { background: var(--accent); }
@keyframes puff { to { transform: translate(var(--x), var(--y)); opacity: 0; } }

/* Results */
.results { text-align: center; padding-bottom: 32px; }
.results .num { color: var(--gold); margin: 16px 0 0; font: 12px var(--pixel); }
.score { font: clamp(40px, 13vw, 56px)/1.2 var(--pixel); margin: 10px 0 4px; color: var(--snow); text-shadow: 4px 4px 0 #1d8fa0, 8px 8px 0 #0a1322; font-variant-numeric: tabular-nums; }
.squares { font-size: 30px; letter-spacing: 3px; margin: 8px 0 16px; }
.squares span { display: inline-block; animation: pop 0.3s steps(4) both; animation-delay: calc(0.5s + var(--i) * 90ms); }
@keyframes pop { from { transform: scale(0); } }
.copied { min-height: 1.3em; color: var(--good); margin: 10px 0 4px; }
.recap { list-style: none; padding: 0; margin: 12px 0; text-align: left; display: flex; flex-direction: column; gap: 14px; }
.recap .row { display: flex; gap: 8px; align-items: baseline; }
.recap .row b { flex: 1; font-size: 17px; }
.recap .pts { color: var(--gold); font: 11px var(--pixel); }
.recap .meta { color: var(--muted); font-size: 14px; }
.next { color: var(--muted); background: var(--panel); display: inline-block; padding: 6px 12px; }

/* Small and ghost buttons; nav row (Archive, Stats). */
.btn.small { font-size: 11px; padding: 10px 14px; }
.btn.ghost { background: var(--panel-solid); color: var(--ink); --edge: var(--edge-ghost, #2c456b); box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.nav { display: flex; gap: 14px; justify-content: center; margin: 14px 0 4px; }
.intro .nav { justify-content: flex-start; }
.below { background: var(--panel); margin: 24px 16px 32px; padding: 4px 18px 14px; color: var(--ink); font-size: 15px; line-height: 1.5; }
.below h2 { font: 14px/1.4 var(--pixel); color: var(--gold); margin: 22px 0 8px; }
.below h3 { font-size: 15px; color: var(--snow); margin: 14px 0 4px; }
.below p { margin: 0 0 10px; }
.below ul { margin: 0 0 10px; padding-left: 20px; }
.below a { color: var(--accent); }
.prerender { color: var(--muted); font-size: 14px; padding: 0 16px; }
.prerender h1 { font-size: 16px; color: var(--snow); }
.more, .legal { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.intro .more, .intro .legal { background: var(--panel); padding: 6px 10px; align-self: flex-start; }
.more a, .legal a, .sub a, .next a { color: var(--accent); }
.legal { font-size: 12px; }
.results .more, .results .legal { text-align: center; }

/* Sheets (Archive, Stats, unlock): a pixel-bordered dialog over the scene. */
#sheet { border: 0; padding: 0; background: var(--panel-solid); color: var(--ink); width: min(480px, calc(100vw - 32px)); max-height: calc(var(--vvh) - 48px); --edge: var(--accent);
  box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge); }
#sheet::backdrop { background: rgba(6, 12, 22, 0.7); }
.sheet-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.sheet-body h2 { font: 16px/1.3 var(--pixel); margin: 0; color: var(--snow); }
.sheet-body p { margin: 0; }
.sheet-body .btn { align-self: stretch; text-align: center; text-decoration: none; }
.sub { color: var(--muted); font-size: 14px; }
.code { font: 13px var(--pixel); color: var(--gold); letter-spacing: 1px; white-space: nowrap; }
.code.big { font-size: 18px; text-align: center; padding: 8px 0; }
.restore label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.restore div { display: flex; gap: 10px; }
.restore input { flex: 1; min-width: 0; font: 700 15px var(--text); padding: 10px; border: 0; background: #0a1322; color: var(--ink); text-transform: uppercase; }
.err { color: var(--bad); min-height: 1.2em; font-size: 14px; margin-top: 4px !important; }
.days { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; padding: 3px; }
.day { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; background: #0f1d31; color: var(--ink); text-decoration: none; }
.day b { font: 11px var(--pixel); color: var(--accent); min-width: 44px; }
.day span { flex: 1; }
.day i { font-style: normal; color: var(--gold); font-weight: 700; }

/* How you compare: percentile line + pixel bar chart of today's scores. */
.compare { margin: 16px var(--px) 4px; text-align: center; }
.badge { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 14px; text-align: left; }
.badge img { width: 34px; height: 34px; image-rendering: pixelated; }
.badge b { display: block; font: 15px/1.2 var(--pixel); color: var(--tier); }
.badge small { display: block; font-size: 15px; color: var(--ink); margin-top: 4px; }
.chart-wrap { position: relative; padding-top: 16px; }
.chart-wrap .you { position: absolute; top: 0; transform: translateX(-50%); font: 8px var(--pixel); color: var(--gold); }
.chart-wrap .avg { position: absolute; top: 16px; bottom: 0; width: 2px; background: repeating-linear-gradient(var(--muted) 0 4px, transparent 4px 7px); }
.axis { position: relative; }
.axis .avg-label { position: absolute; transform: translateX(-50%); color: var(--muted); }
.pstat { font-size: 13px; color: var(--muted); margin-top: 2px; min-height: 0; }
.pstat b { color: var(--ink); }
.pstat:empty { display: none; }
.chart { display: flex; align-items: flex-end; gap: 2px; height: 70px; }
.chart i { flex: 1; background: #3a5476; min-height: 2px; }
.chart i.me { background: var(--gold); }
.axis { display: flex; justify-content: space-between; font: 8px var(--pixel); color: var(--muted); margin-top: 6px; }

/* Stats grid (results + Stats sheet). */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 16px 0 4px; }
.stats div { background: var(--panel); padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stats b { font: 15px var(--pixel); color: var(--snow); }
.stats span { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }

/* Privacy, terms, refunds pages. */
.legal-page { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; background: var(--panel); min-height: 100vh; }
.legal-page h1 { font: 22px/1.3 var(--pixel); color: var(--snow); }
.legal-page h2 { font: 13px/1.4 var(--pixel); color: var(--gold); margin-top: 28px; }
.legal-page a { color: var(--accent); }
.legal-page .back { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.legal-page .updated, .legal-page .legal-more { color: var(--muted); font-size: 14px; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; font-size: 14px; }

/* Keyboard open on a phone: tighten the clues so they stay visible above the guess box. */
/* Keyboard open (html.tight, set from visualViewport in app.js; the media query covers short desktop windows): every
 * clue on one slim line (tier icon + clue; the tier name stays in aria-label) so all five fit above the guess box. */
html.tight .play { gap: 6px; padding-top: 6px; padding-bottom: 6px; }
html.tight .bar { font-size: 9px; }
html.tight .ask { font-size: 13px; margin: 2px 0 0; }
html.tight .brandbar { font-size: 10px; gap: 6px; }
html.tight .brandbar img { width: 16px; height: 16px; }
html.tight .track { height: 20px; margin-top: 0; }
html.tight .track .secs { font-size: 10px; }
html.tight .rider { width: 24px; bottom: 2px; }
html.tight .play .clues { gap: 6px; }
html.tight .play .clues li { font-size: 15px; line-height: 1.2; padding: 5px 10px; flex-direction: row; align-items: center; gap: 8px; box-shadow: 0 -2px 0 0 var(--edge), 0 2px 0 0 var(--edge), -2px 0 0 0 var(--edge), 2px 0 0 0 var(--edge), inset 0 -3px 0 0 rgba(0, 0, 0, 0.18); }
html.tight .play .tn { font-size: 0; gap: 0; }
html.tight .play .tn img { width: 16px; height: 16px; }
html.tight .feedback:empty { display: none; }
html.tight .feedback { font-size: 14px; padding: 2px 8px; }
html.tight .guess input { padding: 9px 10px; font-size: 16px; } /* 16px stops iOS zooming into the input */
html.tight .guess .btn { padding: 9px 14px; }
html.tight .card { padding: 10px; }
html.tight .card h2 { font-size: 19px; margin: 4px 0 2px; }
html.tight .verdict { font-size: 18px; }
html.tight .card .clues.small li { font-size: 12px; padding: 3px 6px; }
html.tight .card .tn { font-size: 0; }
html.tight .hint { font-size: 13px; margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
