/* BASELINE — retro arcade skin. Pixel font for game chrome, Inter for anything students read. */
:root {
    --bg: #0b1020;
    --panel: #141b33;
    --panel-2: #1c2547;
    --line: #2d3a6b;
    --text: #e8ecff;
    --muted: #8f9bc7;
    --teal: #2ee6c5;
    --gold: #ffcc4d;
    --coral: #ff5d73;
    --violet: #a78bfa;
    --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body { min-height: 100vh; }
#stage > section.center { padding-top: 8vh; }
[hidden] { display: none !important; }
body {
    background: radial-gradient(ellipse at top, #18214a 0%, var(--bg) 60%) fixed;
    color: var(--text);
    font-family: "Inter", system-ui, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
.pixel, h1, h2, .btn, .tag-pixel { font-family: "Press Start 2P", monospace; letter-spacing: 0.02em; }

/* CRT scanlines */
.crt {
    pointer-events: none; position: fixed; inset: 0; z-index: 50;
    background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.025) 0 1px, transparent 1px 3px);
    mix-blend-mode: overlay;
}

/* HUD */
.hud {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: 0.6rem 1rem;
    background: rgba(11, 16, 32, 0.92);
    border-bottom: 2px solid var(--line);
    backdrop-filter: blur(4px);
}
.hud-player { font-weight: 700; }
.hud-level { font-family: "Press Start 2P", monospace; font-size: 0.6rem; color: var(--gold); flex: 1; }
.hud-xp { display: flex; align-items: center; gap: 0.5rem; font-size: 0.6rem; color: var(--teal); }
.bar { width: 140px; height: 12px; background: var(--panel-2); border: 2px solid var(--line); }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width 0.4s steps(8); }
.icon-btn { background: none; border: 2px solid var(--line); color: var(--text); border-radius: var(--radius); padding: 0.2rem 0.5rem; cursor: pointer; font-size: 1rem; }

/* Stage */
main { max-width: 860px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.screen { animation: boot 0.35s steps(6); }
@keyframes boot { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { font-size: clamp(1.5rem, 6vw, 2.8rem); line-height: 1.3; margin: 0.5rem 0 1rem; color: var(--teal); text-shadow: 4px 4px 0 #0e6b5c; }
h2 { font-size: clamp(0.85rem, 3vw, 1.1rem); line-height: 1.6; color: var(--gold); margin: 0 0 1rem; }
.kicker { font-family: "Press Start 2P", monospace; font-size: 0.6rem; color: var(--coral); margin-bottom: 0.6rem; }
.lead { color: var(--muted); font-size: 1.05rem; }
.center { text-align: center; }

.panel {
    background: var(--panel);
    border: 3px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45);
}
.question { font-size: 1.25rem; font-weight: 600; margin: 0 0 0.3rem; }
.hint { color: var(--muted); font-size: 0.92rem; margin: 0 0 1rem; }

/* Buttons */
.btn {
    display: inline-block; cursor: pointer;
    font-size: 0.75rem; line-height: 1;
    padding: 1rem 1.3rem;
    color: #0b1020; background: var(--teal);
    border: none; border-radius: 4px;
    box-shadow: 0 5px 0 #0e6b5c;
    transition: transform 0.06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #0e6b5c; }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.btn.gold { background: var(--gold); box-shadow: 0 5px 0 #9c7a1c; }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; border: 2px solid var(--line); }
.actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.4rem; flex-wrap: wrap; }
.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Options */
.options { display: grid; gap: 0.7rem; }
.opt {
    display: flex; align-items: center; gap: 0.8rem;
    text-align: left; width: 100%;
    font: inherit; color: var(--text);
    background: var(--panel-2);
    border: 2px solid var(--line); border-radius: var(--radius);
    padding: 0.85rem 1rem; cursor: pointer;
}
.opt:hover, .opt:focus-visible { border-color: var(--teal); outline: none; }
.opt .key { font-family: "Press Start 2P", monospace; font-size: 0.6rem; color: var(--muted); min-width: 1.6rem; }
.opt.on { border-color: var(--gold); background: #2b2a3f; }
.opt.on .key { color: var(--gold); }

textarea, input[type="text"] {
    width: 100%; font: inherit; color: var(--text);
    background: #0d1330; border: 2px solid var(--line); border-radius: var(--radius);
    padding: 0.85rem 1rem;
}
textarea { min-height: 8rem; resize: vertical; }
textarea:focus, input:focus { outline: none; border-color: var(--teal); }

/* Avatars */
.avatars { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0 1.2rem; }
.avatar {
    font-size: 1.8rem; width: 3.4rem; height: 3.4rem;
    background: var(--panel-2); border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.avatar.on { border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 3px 0 var(--gold); }

/* Progress pips */
.pips { display: flex; gap: 6px; margin-bottom: 1rem; }
.pip { width: 18px; height: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.pip.done { background: var(--teal); }
.pip.now { background: var(--gold); }

/* Reaction line (the Voight-Kampff needle) */
.needle { margin-top: 1rem; min-height: 1.5em; color: var(--violet); font-style: italic; }

/* Power-ups (A–P) */
.coins { font-family: "Press Start 2P", monospace; font-size: 0.75rem; color: var(--gold); margin: 0 0 1rem; }
.worlds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.world h3 { font-family: "Press Start 2P", monospace; font-size: 0.6rem; line-height: 1.6; color: var(--teal); margin: 0 0 0.6rem; }
.tile {
    position: relative; display: block; width: 100%; text-align: left;
    font: inherit; color: var(--text);
    background: var(--panel-2); border: 2px solid var(--line); border-radius: var(--radius);
    padding: 0.6rem 2.6rem 0.6rem 0.8rem; margin-bottom: 0.5rem; cursor: pointer;
}
.tile b { color: var(--gold); font-family: "Press Start 2P", monospace; font-size: 0.6rem; margin-right: 0.4rem; }
.tile small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }
.tile .stack { position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%); font-size: 1.1rem; }
.tile.on { border-color: var(--gold); }
.tile:hover { border-color: var(--teal); }

/* Boss */
.boss { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.boss-face { font-size: 3rem; animation: wobble 1.4s steps(4) infinite; }
@keyframes wobble { 50% { transform: translateY(-4px) rotate(-3deg); } }
.boss-bar { flex: 1; height: 16px; border: 2px solid var(--line); background: var(--panel-2); }
.boss-fill { height: 100%; background: var(--coral); width: 100%; transition: width 0.25s steps(6); }
.boss.hit .boss-face { filter: brightness(2); }

/* End screen */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.8rem; margin: 1rem 0; }
.badge { background: var(--panel-2); border: 2px solid var(--gold); border-radius: var(--radius); padding: 0.8rem; text-align: center; }
.badge .ico { font-size: 1.8rem; display: block; }
.badge b { display: block; font-size: 0.9rem; }
.badge span { color: var(--muted); font-size: 0.8rem; }
.codename-card { font-family: "Press Start 2P", monospace; font-size: 1rem; color: var(--gold); border: 3px dashed var(--gold); padding: 1rem; display: inline-block; margin: 0.5rem 0 1rem; word-break: break-all; }

/* Toast (achievement unlocked) */
.toast {
    position: fixed; left: 50%; bottom: 1.2rem; z-index: 60;
    transform: translate(-50%, 200%);
    visibility: hidden;
    background: var(--panel); border: 3px solid var(--gold); border-radius: var(--radius);
    padding: 0.8rem 1.1rem; max-width: 92vw;
    box-shadow: 6px 6px 0 rgba(0,0,0,0.5);
    transition: transform 0.3s steps(5);
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast .pixel { font-size: 0.55rem; color: var(--gold); display: block; margin-bottom: 0.3rem; }

.privacy { color: var(--muted); font-size: 0.85rem; border-left: 3px solid var(--coral); padding-left: 0.8rem; margin-top: 1.2rem; }
.error { color: var(--coral); font-weight: 600; }

/* Pixel confetti */
.confetti { position: fixed; top: -10px; width: 8px; height: 8px; z-index: 40; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-width: 640px) {
    body { font-size: 16px; }
    .worlds { grid-template-columns: 1fr; }
    .bar { width: 80px; }
    .hud-level { order: 3; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Bonus quiz: right / wrong feedback */
.opt.right { border-color: var(--teal); background: rgba(46, 230, 197, 0.12); }
.opt.right .key { color: var(--teal); }
.opt.wrong { border-color: var(--coral); background: rgba(255, 93, 115, 0.12); }
.opt.wrong .key { color: var(--coral); }
.opt[disabled] { cursor: default; }
.opt small { color: var(--muted); }
.pip.miss { background: var(--coral); }
