@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); } }

/* ---------- vibrant menu, streaks, patches, leaderboard ---------- */
.hero { margin-top: 3vh; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#title h1 { animation: jitter 4s infinite steps(1), glow 3.2s ease-in-out infinite; }
@keyframes glow { 0%, 100% { filter: drop-shadow(0 0 6px rgba(255,79,147,.45)); } 50% { filter: drop-shadow(0 0 16px rgba(95,230,255,.6)); } }
.greet { margin: 2px 0 0; font-family: var(--pixel); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #fff;
  background: linear-gradient(90deg, rgba(255,79,147,.75), rgba(95,230,255,.75)); padding: 4px 12px; box-shadow: 0 0 14px rgba(255,79,147,.35); }
.today { display: flex; flex-direction: column; gap: 10px; border-color: var(--pink); box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 0 22px rgba(255,79,147,.3); }
.today-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; text-align: left; }
.today button.big { width: 100%; border-color: var(--pink); background: linear-gradient(180deg, rgba(255,79,147,.35), rgba(9,16,38,.9)); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 2px rgba(0,0,0,.4), 0 0 14px rgba(255,79,147,.35); } 50% { box-shadow: 0 0 0 2px rgba(0,0,0,.4), 0 0 30px rgba(255,79,147,.75); } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: rgba(5,10,28,.6); border: 1px solid rgba(95,230,255,.25); padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stat b { font-family: var(--pixel); font-size: 22px; line-height: 1; color: var(--gold); text-shadow: 0 0 10px rgba(255,210,95,.45); }
.stat .cap { font-size: 9px; color: var(--dim); }
.week { display: flex; justify-content: space-between; gap: 4px; }
.week .d { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 9px; color: var(--dim); text-transform: uppercase; }
.week .d i { width: 18px; height: 18px; border: 1px solid rgba(95,230,255,.35); background: rgba(5,10,28,.6); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.week .d.done i { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px rgba(255,210,95,.6); }
.week .d.rest i { background: rgba(95,230,255,.35); }
.week .d.today { color: #fff; }
.menu-row { display: flex; gap: 8px; width: min(560px, 100%); }
.menu-row button { flex: 1; }
.board-mini { font-size: 12px; text-align: left; }
.board-list { list-style: none; margin: 8px 0 0; padding: 0; text-align: left; font-size: 13px; }
.board-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 6px; padding: 5px 2px; border-bottom: 1px solid rgba(95,230,255,.1); }
.board-list li b { font-family: var(--pixel); color: var(--dim); }
.board-list li:nth-child(1) b { color: var(--gold); } .board-list li:nth-child(2) b { color: #dfe9f7; } .board-list li:nth-child(3) b { color: #c7a27a; }
.board-list li.me { background: rgba(255,79,147,.15); }
.board-list li span:last-child { font-family: var(--pixel); color: var(--cyan); }
.you-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pct { font-family: var(--pixel); font-size: 14px; letter-spacing: .08em; color: #fff; background: linear-gradient(90deg, rgba(255,79,147,.6), rgba(95,230,255,.6)); padding: 6px 12px; margin: 0; }
.newpatch { width: min(560px, 100%); border: 2px solid var(--gold); background: rgba(255,210,95,.12); padding: 10px; display: flex; gap: 10px; align-items: center; text-align: left; animation: rise .6s both; }
.patch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; width: min(560px, 100%); }
.patch { border: 1px solid rgba(95,230,255,.25); background: rgba(9,16,38,.92); padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 11px; }
.patch canvas { width: 54px; height: 54px; image-rendering: pixelated; }
.patch b { font-family: var(--pixel); font-size: 11px; letter-spacing: .08em; }
.patch.locked { opacity: .7; filter: grayscale(1); } .patch.locked canvas { opacity: .5; }
.card .missed { color: var(--dim); font-size: 10px; }
.newpatch canvas { width: 44px; height: 44px; image-rendering: pixelated; flex: none; }

/* ink colours (cosmetic only) */
.swatches { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; padding: 0; border: 2px solid rgba(5,10,28,.9); outline: 1px solid rgba(95,230,255,.25); background: var(--c); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 45%, transparent); }
.swatch[aria-checked="true"] { outline: 2px solid var(--gold); transform: translateY(-2px); }
@media (max-height: 640px) { .swatch { width: 22px; height: 22px; } }

.howto a { color: var(--cyan); }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.card .rarity { color: var(--gold); font-size: 10px; }
.card .rarity:empty { display: none; }
