@font-face { font-family: 'VT323'; src: url('fonts/vt323.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --ink: #07050F;
  --panel: rgba(16, 11, 36, .84);
  --panel-solid: #120C28;
  --ring: #33285A;
  --text: #EEE6FA;
  --muted: #A094C4;
  --dim: #6F6496;
  --lime: #A6E56A;
  --lime-deep: #10250C;
  --amber: #FFC266;
  --pink: #FF6F9F;
  /* rarity tiers */
  --t-common: #9C93B8;
  --t-uncommon: #4FB868;
  --t-rare: #4FA8F0;
  --t-super: #B479F2;
  --t-mega: #FFC266;
  --font: 'VT323', ui-monospace, monospace;
  --kb: 0px;                       /* on-screen keyboard height (set from JS on iOS) */
  --pad-x: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --dur: 1;                        /* animation speed multiplier (reduced motion sets 0.01) */
  --rings: 0 0 0 2px var(--ink), 0 0 0 4px var(--ring);
}
@media (prefers-reduced-motion: reduce) { :root { --dur: 0.01; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #140C2E; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--font); font-size: 20px; color: var(--text); -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 6px; }
.micro { font-size: clamp(15px, 1.8vh, 18px); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.accent { color: var(--lime); }
.amber { color: var(--amber); }

/* ---------- the world (sprites are positioned from JS with transforms only) ---------- */
#world { position: fixed; inset: 0; overflow: hidden; contain: strict; background: #0C1330; }
#world > * { position: absolute; left: 0; top: 0; }
#fx { z-index: 2; }
#bg { image-rendering: pixelated; max-width: none; }
#sprite-defs { position: absolute; }
.sprite { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.sprite svg { display: block; width: 100%; height: 100%; overflow: visible; shape-rendering: crispEdges; }
#pads .sprite svg, #player svg { filter: drop-shadow(0 3px 0 rgba(6, 8, 26, .45)); }
#pads .sprite, #player, #crocs .sprite { transition: transform calc(.55s * var(--dur)) cubic-bezier(.3, .7, .3, 1), opacity calc(.4s * var(--dur)); }
#world.instant .sprite { transition: none !important; }
#player svg { color: #8FD14F; }
.croc svg { animation: bob calc(2.4s * var(--dur)) steps(2) infinite; }
@keyframes bob { 50% { transform: translateY(6%); } }
#fx .jaw { display: block; width: 100%; will-change: transform; transform: translateY(100%); }
#fx .drop, #fx .spark { background: #FFF3A8; box-shadow: 0 0 6px 2px rgba(255, 226, 130, .55); }
.bank-glow { opacity: 0; transition: opacity calc(1.4s * var(--dur)) ease-out; }
.lit .bank-glow { opacity: 1; animation: lanterns 3.6s ease-in-out infinite alternate; }
@keyframes lanterns { from { opacity: .75; } to { opacity: 1; } }
#fx .bub { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
#fx .drop { background: linear-gradient(#F2FBFF 55%, #9FD3EA 55%); }
#fx .bub { background: transparent; box-shadow: inset 0 0 0 1px rgba(214, 242, 255, .9); }
.fly { position: absolute; width: 4px; height: 4px; background: #FFF8C8; box-shadow: 0 0 8px 3px rgba(255, 236, 150, .35); animation: blink 3.2s steps(4) infinite; will-change: opacity; }
@keyframes blink { 0%, 100% { opacity: .1; } 50% { opacity: .95; } }

/* faint scanlines + edge vignette, like an old monitor */
.crt { position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .09) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(5, 3, 16, .5) 100%); }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center;
  padding: max(16px, env(safe-area-inset-top)) var(--pad-x) 0;
  pointer-events: none;
}
.screen > * { pointer-events: auto; }
.grow { flex: 1; pointer-events: none !important; }
.dock { width: min(560px, 100%); display: flex; flex-direction: column; gap: 18px; padding-bottom: max(24px, calc(env(safe-area-inset-bottom) + 14px)); }

.panel { background: var(--panel); box-shadow: var(--rings); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }

/* buttons */
.btn { font-family: var(--font); border: 0; cursor: pointer; color: var(--text); background: var(--panel); box-shadow: var(--rings);
  text-transform: uppercase; letter-spacing: .2em; transition: background .15s, box-shadow .15s, color .15s; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-main { width: 100%; height: clamp(56px, 7.5vh, 70px); font-size: clamp(24px, 3.4vh, 32px); color: #E9FFD4;
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--lime), 0 0 22px rgba(166, 229, 106, .28); }
.btn-alt { width: 100%; height: clamp(50px, 6.5vh, 60px); display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: clamp(21px, 2.8vh, 26px); color: #FFE3B8; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--amber), 0 0 18px rgba(255, 194, 102, .22); }
.btn-alt .micro { font-size: 13px; color: var(--amber); letter-spacing: .16em; }
.btn-small { height: 38px; padding: 0 14px; font-size: 16px; color: var(--muted); }
.btn-go { height: 56px; padding: 0 22px; font-size: 28px; color: var(--lime-deep); background: var(--lime);
  box-shadow: 0 0 0 2px var(--ink), inset 0 -4px 0 rgba(0, 0, 0, .2), 0 0 16px rgba(166, 229, 106, .3); }
@media (hover: hover) {
  .btn-main:hover { background: rgba(28, 44, 30, .9); }
  .btn-small:hover:not(:disabled) { color: var(--text); box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--muted); }
  .btn-go:hover { background: #BDF286; }
  .btn-alt:hover { background: rgba(48, 34, 18, .9); }
}
.link { background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; color: var(--muted); cursor: pointer; }
.link:hover { color: var(--text); }
.foot { display: flex; justify-content: space-between; gap: 12px; }

/* home */
.home-title { margin-top: clamp(28px, 9vh, 110px); display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 1.2vh, 14px); text-align: center; }
.logo { margin: 0; font-weight: 400; font-size: clamp(64px, min(13vh, 17vw), 150px); line-height: .9; letter-spacing: .06em; color: #F6EEFF;
  text-shadow: -3px 0 rgba(255, 111, 159, .85), 3px 0 rgba(120, 232, 160, .75), 0 0 26px rgba(255, 190, 130, .25); }
.logo span { white-space: nowrap; }
.subtitle { font-size: clamp(20px, 2.8vh, 28px); letter-spacing: .5em; padding-left: .5em; color: var(--lime); text-shadow: 0 0 12px rgba(166, 229, 106, .35); }
.tagline { margin: 4px 0 0; font-size: clamp(17px, 2.2vh, 22px); letter-spacing: .08em; color: #D6C9EE; text-shadow: 0 2px 0 rgba(0, 0, 0, .5); }
.row-btns { display: flex; gap: 14px; }
.row-btns .btn { flex: 1; }

/* hud */
.hud { width: min(760px, 100%); display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px; }
.stat { justify-self: start; min-width: 96px; padding: 6px 14px 4px; display: flex; flex-direction: column; background: var(--panel); box-shadow: var(--rings); }
.stat.right { justify-self: end; text-align: right; }
.stat .micro { font-size: 13px; }
.stat b { font-weight: 400; font-size: 32px; line-height: 1; color: var(--lime); }
.stat b.amber { color: var(--amber); }
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 4px; }
.hud-mid .micro { font-size: 13px; }
@media (max-width: 480px) {
  .hud { gap: 8px; }
  .stat { min-width: 64px; padding: 5px 10px 3px; }
  .stat b { font-size: 26px; }
  .trail { gap: 4px; }
}
@media (max-width: 420px) { .foot .hide-narrow { display: none; } }
.trail { display: flex; gap: 5px; }
.trail i { width: clamp(10px, 1.7vh, 16px); height: clamp(10px, 1.7vh, 16px); background: rgba(40, 32, 76, .9); box-shadow: 0 0 0 2px var(--ink); }
.trail i.now { background: var(--text); box-shadow: 0 0 0 2px var(--ink), 0 0 8px rgba(255, 255, 255, .5); }
.t-common { --t: var(--t-common); } .t-uncommon { --t: var(--t-uncommon); } .t-rare { --t: var(--t-rare); }
.t-super { --t: var(--t-super); } .t-mega { --t: var(--t-mega); } .t-chomp { --t: var(--pink); }
.trail i[class^="t-"], .tiles i[class^="t-"] { background: var(--t); }
.trail i.t-mega, .tiles i.t-mega { box-shadow: 0 0 0 2px var(--ink), 0 0 10px rgba(255, 194, 102, .6); }

/* prompt card */
.card { margin-top: clamp(14px, 3vh, 34px); width: min(640px, calc(100% - 8px)); padding: clamp(14px, 2vh, 22px) clamp(18px, 2.4vw, 28px); display: flex; flex-direction: column; gap: clamp(6px, 1vh, 12px); }
.card-big { margin: 0; font-weight: 400; font-size: clamp(32px, 5vh, 50px); line-height: 1.05; color: #FFF6EA; letter-spacing: .02em; text-shadow: 0 2px 0 rgba(0, 0, 0, .45); overflow-wrap: anywhere; }
.card-big.long { font-size: clamp(26px, 3.8vh, 40px); }
.card-big.words { color: var(--amber); }
#card-sub { letter-spacing: .14em; }
#card-sub b { color: var(--text); font-weight: 400; }
#card-sub .tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 8px; }
#card-sub .tags .tag { margin-left: 0; }
#card-sub .said { font-size: 15px; letter-spacing: .14em; color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; margin-left: 8px; font-size: 14px; letter-spacing: .18em; color: var(--ink); vertical-align: 2px; }
.tag[class*="t-"] { background: var(--t); } .tag.near { background: var(--pink); } .tag.safe { background: var(--lime); }
.pop { animation: pop calc(.3s * var(--dur)) steps(3); }
@keyframes pop { 0% { opacity: .3; transform: translateY(-6px); } 100% { opacity: 1; transform: none; } }
#prompt-card.chomp { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--pink), 0 0 22px rgba(255, 111, 159, .3); }
#prompt-card.chomp #card-kicker { color: var(--pink); }

/* answer bar */
.answer-bar {
  width: calc(100% + 2 * var(--pad-x)); margin-bottom: var(--kb);
  padding: 34px var(--pad-x) max(22px, calc(env(safe-area-inset-bottom) + 12px));
  background: linear-gradient(to bottom, rgba(8, 6, 20, 0), rgba(8, 6, 20, .88) 40%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.answer-bar > * { width: min(640px, 100%); }
.msg { min-height: 24px; font-size: 19px; letter-spacing: .04em; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.msg.bad { color: var(--pink); }
.chip { font-family: var(--font); font-size: 20px; letter-spacing: .06em; border: 0; cursor: pointer; padding: 2px 12px; color: var(--text); background: var(--panel-solid); box-shadow: var(--rings); }
.chip.first { color: var(--lime-deep); background: var(--lime); box-shadow: 0 0 0 2px var(--ink); }
.hint { font-size: 15px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.row { display: flex; gap: 14px; padding: 4px; }
#answer { flex: 1; min-width: 0; height: 56px; border: 0; padding: 0 16px; font-family: var(--font); font-size: max(26px, min(3.4vh, 32px)); letter-spacing: .04em; color: var(--text);
  background: rgba(10, 8, 26, .92); box-shadow: var(--rings), inset 0 -3px 0 rgba(166, 229, 106, .25); }
#answer::placeholder { color: var(--dim); }
#answer:focus { outline: none; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--ring), inset 0 -3px 0 var(--lime); }
.shake { animation: shake calc(.3s * var(--dur)) steps(6); }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* result */
.res-card { margin-top: clamp(18px, 5vh, 60px); width: min(600px, 100%); min-height: 0; flex: 0 1 auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.res-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.res-big { font-size: clamp(52px, 7.5vh, 76px); line-height: .95; color: #FFF6EA; text-shadow: -2px 0 rgba(255, 111, 159, .6), 2px 0 rgba(120, 232, 160, .5); }
.res-head .stat { box-shadow: var(--rings); }
.tiles { display: flex; gap: 6px; flex: none; }
.tiles.grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.tiles.grid i { height: 14px; }
.tiles i { flex: 1; height: 22px; background: rgba(10, 8, 26, .9); box-shadow: 0 0 0 2px var(--ink); }
.recap { margin: 0; padding: 0 6px 0 0; list-style: none; display: flex; flex-direction: column; min-height: 60px; overflow: auto; flex: 0 1 auto;
  scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }
.recap li { display: grid; grid-template-columns: 30px 1fr auto; gap: 0 8px; padding: 6px 0; border-bottom: 1px dashed rgba(160, 148, 196, .25); }
.recap .n { color: var(--dim); }
.recap .a { color: var(--text); letter-spacing: .03em; }
.recap .r { font-size: 14px; letter-spacing: .16em; color: var(--t); align-self: center; text-align: right; }
.recap .c { grid-column: 2 / 4; color: var(--muted); font-size: 17px; }
.recap .chomped .a { color: var(--pink); }
.dists { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; flex: none; }
.dist { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 8px; background: rgba(10, 8, 26, .55); box-shadow: 0 0 0 2px var(--ink); min-width: 0; }
.dist-head { display: flex; justify-content: space-between; align-items: baseline; }
.dist-head .micro { font-size: 13px; }
.dist-head b { font-weight: 400; font-size: 26px; line-height: 1; color: var(--lime); }
.dist-head b.amber { color: var(--amber); }
.curve { position: relative; display: flex; align-items: flex-end; gap: 1px; height: clamp(40px, 7vh, 64px); margin-top: 14px; border-bottom: 2px solid var(--ring); }
.curve i { flex: 1; background: var(--ring); }
#dist-pads .curve i.on { background: #3E8F57; }
#dist-score .curve i.on { background: #B8873E; }
.curve.empty { margin-top: 0; height: 18px; border-bottom-style: dashed; }
.curve .you { position: absolute; bottom: 0; top: -16px; border-left: 2px solid var(--text); padding-left: 4px; font-size: 13px; letter-spacing: .16em; line-height: 1; color: var(--text); white-space: nowrap; }
.curve .you.flip { border-left: 0; border-right: 2px solid var(--text); padding: 0 4px 0 0; transform: translateX(-100%); }
.dist .note { font-size: 13px; letter-spacing: .12em; text-transform: none; }
#chart-note { font-size: 13px; text-align: center; margin-top: -8px; }
@media (max-width: 420px) { .dists { gap: 10px; } .dist { padding: 8px 8px 6px; } .dist-head b { font-size: 22px; } }
.res-actions { margin-top: 24px; }
.res-btns .btn-alt, .res-btns .btn-main { height: clamp(56px, 7.5vh, 70px); }

/* overlay */
.overlay { position: fixed; inset: 0; z-index: 5; background: rgba(8, 5, 20, .7); display: flex; align-items: center; justify-content: center; padding: 28px; }
.how-card { width: min(560px, 100%); max-height: 100%; overflow: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.how-card ol { margin: 0; padding-left: 26px; display: flex; flex-direction: column; gap: 10px; font-size: 21px; line-height: 1.2; color: #DCD2F0; }
.how-card li::marker { color: var(--lime); }
.toast { position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%); z-index: 6; padding: 8px 18px; font-size: 20px; letter-spacing: .12em; text-transform: uppercase; background: var(--panel-solid); box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--lime); }
