@font-face { font-family: 'Silkscreen'; font-weight: 400; font-display: swap; src: url(fonts/Silkscreen-400.woff2) format('woff2'); }
@font-face { font-family: 'Silkscreen'; font-weight: 700; font-display: swap; src: url(fonts/Silkscreen-700.woff2) format('woff2'); }
@font-face { font-family: 'Space Mono'; font-weight: 400; font-display: swap; src: url(fonts/SpaceMono-400.woff2) format('woff2'); }
@font-face { font-family: 'Space Mono'; font-weight: 700; font-display: swap; src: url(fonts/SpaceMono-700.woff2) format('woff2'); }
:root {
  --ink: #eaf4ff;
  --dim: #8fa6c4;
  --pink: #ff4f93;
  --cyan: #5fe6ff;
  --gold: #ffd25f;
  --panel: rgba(9, 16, 38, 0.82);
  --edge: rgba(95, 230, 255, 0.55);
  --pixel: 'Silkscreen', monospace;
  --mono: 'Space Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0a1230; color: var(--ink); font-family: var(--mono); overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button, summary { touch-action: manipulation; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; image-rendering: pixelated; z-index: 0; }
.scanlines { position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.08) 0 1px, transparent 1px 3px); }
#markers { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.mk { text-shadow: 0 1px 2px rgba(5,10,30,.8); position: absolute; right: 0; left: 0; font-size: 11px; letter-spacing: .08em; color: rgba(234,244,255,.62); text-transform: lowercase; white-space: nowrap; }
.mk.l { text-align: left; padding-left: 4vw; }
.mk.r { text-align: right; padding-right: 7vw; }
.mk.big { font-family: var(--pixel); font-size: 12px; color: rgba(255,255,255,.85); }
.mk::before, .mk::after { color: rgba(234,244,255,.35); }
.mk.r::after { content: ' ──'; } .mk.l::before { content: '── '; }
.ruler { position: absolute; right: 8px; top: 0; bottom: 0; width: 40px; }
.tick { position: absolute; right: 0; height: 1px; background: rgba(234,244,255,.35); width: 8px; }
.tick.k { width: 14px; background: rgba(234,244,255,.6); }
.tick b { position: absolute; right: 18px; top: -7px; font-size: 9px; font-weight: 400; color: rgba(234,244,255,.55); }

main { position: relative; z-index: 2; height: 100%; overflow-y: auto; overflow-x: hidden; }
.screen { min-height: 100%; display: flex; flex-direction: column; align-items: center; padding: calc(18px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); gap: 12px; text-align: center; }

.cap { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }
.dim { color: var(--dim); }
.pink { color: var(--pink); }
.cyan { color: var(--cyan); }

.panel { background: var(--panel); border: 2px solid var(--edge); box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 0 18px rgba(95,230,255,.18); padding: 12px 14px; width: min(560px, 100%); }

/* title */
.glitch { font-family: var(--pixel); font-weight: 700; margin: 0; color: #fff3f8; letter-spacing: .06em;
  text-shadow: 3px 0 0 var(--pink), -3px 0 0 var(--cyan), 0 0 22px rgba(255,79,147,.35); position: relative; }
#title h1 { font-size: clamp(28px, 8.4vw, 92px); white-space: nowrap; margin-top: 4vh; animation: jitter 4s infinite steps(1); }
@keyframes jitter { 0%, 92%, 100% { transform: none; } 93% { transform: translate(2px, -1px); text-shadow: -4px 0 0 var(--pink), 4px 0 0 var(--cyan); } 95% { transform: translate(-2px, 1px); } }
#meta { background: var(--panel); padding: 6px 10px; border: 1px solid var(--edge); }
.tag { background: rgba(234,244,255,.7); padding: 4px 10px; }
#title h2 { font-family: var(--pixel); font-weight: 400; margin: 0; font-size: clamp(13px, 3vw, 18px); letter-spacing: .4em; color: var(--cyan); text-shadow: 0 0 10px rgba(95,230,255,.5); }
.tag { margin: 4px 0 0; font-size: 12px; letter-spacing: .14em; color: rgba(16, 30, 60, .85); font-weight: 700; }
.spacer { flex: 1; min-height: 16vh; }
.howto { text-align: left; font-size: 13px; }
.credits { text-align: left; font-size: 12px; line-height: 1.6; }
.credits summary { font-family: var(--pixel); font-size: 11px; letter-spacing: .2em; cursor: pointer; color: var(--dim); }
.credits p { margin: 8px 0 0; } .credits a { color: var(--cyan); }
.howto summary { font-family: var(--pixel); font-size: 12px; letter-spacing: .2em; cursor: pointer; color: var(--cyan); }
.howto ul { margin: 10px 0 0; padding-left: 18px; line-height: 1.7; }
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between; width: min(560px, 100%); }
.row.center { justify-content: center; }

button.big, button.mid, button.go, button.small { background: var(--panel); border: 2px solid var(--cyan); font-family: var(--pixel); letter-spacing: .2em; text-transform: uppercase;
  box-shadow: 0 0 0 2px rgba(0,0,0,.4), 0 0 16px rgba(95,230,255,.35); transition: transform .08s, box-shadow .15s; }
button.big { width: min(560px, 100%); padding: 20px; font-size: clamp(16px, 4vw, 22px); }
button.mid { padding: 14px 28px; font-size: 14px; }
button.small { padding: 8px 12px; font-size: 11px; border-color: var(--edge); }
button.go { white-space: nowrap; padding: 12px 18px; font-size: 14px; border-color: var(--pink); background: rgba(255,79,147,.2); }
button.go.ready { background: var(--pink); color: #fff; box-shadow: 0 0 22px rgba(255,79,147,.7); }
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: default; transform: none; }

/* hud */
#hud { position: fixed; z-index: 3; top: calc(8px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); right: calc(8px + env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.hudbox { background: var(--panel); border: 2px solid var(--edge); padding: 4px 12px; min-width: 96px; text-align: left; }
.hudbox.right { text-align: right; }
.hudbox .cap { display: block; font-size: 9px; color: var(--dim); }
.hudbox b { font-family: var(--pixel); font-size: 18px; color: var(--cyan); }
.hudbox b.pink { color: var(--pink); }
.pips { text-align: center; background: var(--panel); border: 1px solid var(--edge); padding: 5px 8px 2px; }
#pips { display: flex; gap: 3px; justify-content: center; }
#pips i { width: 10px; height: 10px; border: 1px solid var(--edge); background: rgba(10,18,40,.8); }
#pips i.done { background: var(--gold); } #pips i.cur { background: var(--pink); }
.pips .cap { font-size: 8px; color: var(--dim); }

/* play */
#play { padding-top: 70px; }
.prompt { text-align: left; }
#p-text { font-family: var(--pixel); font-size: clamp(17px, 4.4vw, 24px); line-height: 1.35; margin: 6px 0; text-transform: none; }
#countdown { background: var(--panel); border: 1px solid var(--edge); padding: 8px 14px; margin-top: 8vh; }
#drawzone { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(560px, 100%); }
.padwrap { padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#pad { width: min(84vw, 44vh, 420px); height: min(84vw, 44vh, 420px); width: min(84vw, 44dvh, 420px); height: min(84vw, 44dvh, 420px); touch-action: none; cursor: crosshair; display: block; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  background: radial-gradient(circle at 50% 40%, #142452, #0b1535); border: 1px dashed rgba(95,230,255,.25); }
#guess { min-height: 44px; width: 100%; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.chip { border: 1px solid rgba(143,166,196,.5); padding: 3px 8px; font-size: 12px; position: relative; overflow: hidden; color: var(--dim); }
.chip i { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--dim); }
.chip.fit { border-color: var(--gold); color: #fff; } .chip.fit i { background: var(--gold); }
.chip.pick { border-color: var(--pink); background: rgba(255,79,147,.18); color: #fff; } .chip.pick i { background: var(--pink); }
.sees { font-family: var(--pixel); font-size: 11px; letter-spacing: .1em; color: var(--cyan); width: 100%; }
#nope { min-height: 14px; color: var(--gold); }
.controls { display: flex; gap: 8px; align-items: center; justify-content: center; width: 100%; }
.timer { position: relative; width: 50px; height: 50px; }
.timer svg { width: 50px; height: 50px; transform: rotate(-90deg); }
.timer .track { fill: rgba(9,16,38,.85); stroke: rgba(95,230,255,.2); stroke-width: 3; }
.timer .ring { fill: none; stroke: var(--cyan); stroke-width: 3; stroke-dasharray: 106.8; transition: stroke-dashoffset .25s linear; }
.timer.low .ring { stroke: var(--pink); }
.timer b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--pixel); font-size: 15px; }

/* result */
#result { justify-content: center; }
.resultcard { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(420px, 100%); padding: 18px; }
#r-icon { width: 60px; height: 60px; image-rendering: pixelated; filter: drop-shadow(0 0 12px currentColor); }
#r-tier { font-family: var(--pixel); font-size: clamp(30px, 8vw, 48px); margin: 0; letter-spacing: .1em; text-shadow: 0 0 18px currentColor; }
.q { font-family: var(--pixel); font-size: 17px; margin: 0; }
#r-pts { margin: 0; font-weight: 700; }
#r-thumb { width: 84px; height: 84px; border: 1px dashed rgba(95,230,255,.3); background: rgba(9,16,38,.6); }
#result.pop .resultcard > * { animation: rise .5s both; }
#result.pop .resultcard > *:nth-child(2) { animation-delay: .08s; } #result.pop .resultcard > *:nth-child(3) { animation-delay: .16s; }
#result.pop .resultcard > *:nth-child(4) { animation-delay: .24s; } #result.pop .resultcard > *:nth-child(5) { animation-delay: .32s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* end */
#end { background: linear-gradient(rgba(8,10,30,.55), rgba(8,10,30,.85)); }
.endhead { width: min(560px, 100%); display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 18px; }
.score-row { width: min(560px, 100%); display: flex; align-items: baseline; gap: 14px; }
#e-score { font-family: var(--pixel); font-size: clamp(56px, 16vw, 96px); line-height: 1; }
#e-alt { font-family: var(--pixel); font-size: 16px; }
#e-rank { width: min(560px, 100%); text-align: left; color: var(--cyan); margin: 0; }
#e-chart { width: 100%; height: auto; margin-top: 8px; }
.route ol { list-style: none; margin: 8px 0 0; padding: 0; text-align: left; font-size: 12px; }
.route li { padding: 5px 0; border-bottom: 1px solid rgba(95,230,255,.1); color: var(--dim); display: grid; grid-template-columns: 70px 1fr; }
.route li.me { color: #fff; } .route li.me b { color: var(--pink); }
#e-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.card { border: 1px solid rgba(95,230,255,.25); padding: 8px; text-align: left; font-size: 11px; display: flex; flex-direction: column; gap: 4px; }
.card img { width: 100%; aspect-ratio: 1; background: rgba(9,16,38,.7); }
.card .lbl { font-family: var(--pixel); font-size: 12px; color: #fff; }
.card .pts { float: right; }

#climb { justify-content: flex-start; padding-top: 74px; cursor: pointer; user-select: none; }
#climb-tag { background: var(--panel); border: 1px solid var(--edge); padding: 6px 12px; }
.skiphint { background: rgba(9,16,38,.6); padding: 4px 10px; }
#banner { position: fixed; z-index: 4; left: 50%; top: 24%; transform: translate(-50%, -10px); opacity: 0; pointer-events: none;
  font-family: var(--pixel); font-size: clamp(18px, 5vw, 30px); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
  background: var(--panel); border: 2px solid var(--gold); color: var(--gold); padding: 10px 18px; text-shadow: 0 0 14px rgba(255,210,95,.6); }
#banner.zone { border-color: var(--cyan); color: var(--cyan); font-size: clamp(13px, 3.4vw, 18px); text-shadow: 0 0 12px rgba(95,230,255,.5); }
#banner.on { animation: bannerIn 1.6s both; }
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, -10px) scale(.9); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 20% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -6px); } }
.timer .speed { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); font-family: var(--pixel); font-size: 9px; color: var(--gold); white-space: nowrap; text-shadow: 0 0 6px rgba(255,210,95,.7); }
.timer .speed.off { visibility: hidden; }
.gold { color: var(--gold); }
.ask { width: 100%; border-top: 1px dashed rgba(95,230,255,.25); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.askchips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.askchips button { background: rgba(9,16,38,.8); border: 1px solid var(--edge); padding: 6px 10px; font-size: 12px; font-family: var(--mono); }
.askchips button.yes { border-color: var(--gold); color: var(--gold); }
.askform { display: flex; gap: 6px; width: 100%; max-width: 300px; }
.askform input { flex: 1; min-width: 0; background: rgba(9,16,38,.9); border: 1px solid var(--edge); color: var(--ink); font: 13px var(--mono); padding: 6px 8px; }
.asknote { font-size: 9px; letter-spacing: .1em; text-transform: none; }
#r-thanks { color: var(--gold); margin: 0; }
#toast { position: fixed; z-index: 9; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0; transition: .25s; background: var(--panel); border: 2px solid var(--pink); padding: 10px 16px; font-size: 13px; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .hudbox { min-width: 74px; padding: 3px 8px; } .hudbox b { font-size: 14px; }
  #play { padding-top: 62px; gap: 8px; }
  .mk { font-size: 9px; }
  button.go { padding: 12px 12px; letter-spacing: .1em; }
  button.small { padding: 8px 9px; letter-spacing: .12em; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } #banner.on { opacity: 1; transform: translate(-50%, 0); } }
