/* Fredoka: rounded and playful but easy to read */
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(../fonts/fredoka.woff2) format('woff2'); }
/* same variable file pinned to bold: headings, buttons and labels */
@font-face { font-family: 'Fredoka Display'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/fredoka.woff2) format('woff2'); }
/* Self-hosted fonts (OFL), so text renders the same with or without Google Fonts */
@font-face { font-family: 'Press Start 2P'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/pressstart-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Press Start 2P'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/pressstart-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #07060b;
  --stone: #16131f;
  --stone-2: #211d2e;
  --panel: rgba(22, 19, 33, 0.82);
  --line: rgba(242, 193, 78, 0.22);
  --gold: #f2c14e;
  --gold-2: #ffdf8a;
  --text: #f4eddc;
  --muted: #cfc7b8;
  --red: #ff4d5e;
  --green: #3ddc84;
  --accent: #5b8def;
  --display: 'Fredoka Display', 'Segoe UI', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', system-ui, sans-serif;
  --pixel: 'Press Start 2P', 'Courier New', monospace;
  --body: 'Fredoka', 'Segoe UI', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', system-ui, sans-serif;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 19px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Backdrop ---------- */
.cave-bg {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1200px 600px at 50% 115%, rgba(255, 120, 40, 0.18), transparent 60%),
    radial-gradient(900px 500px at 10% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(900px 500px at 90% -10%, rgba(120, 60, 200, 0.16), transparent 60%),
    linear-gradient(#0b0912, #07060b 60%, #0d0907);
  transition: background 1.2s ease;
}
.cave-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255,255,255,.025) 2px, transparent 2px);
  background-size: 64px 32px;
  mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
}
#embers { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.vignette { position: fixed; inset: 0; pointer-events: none; z-index: 50; box-shadow: inset 0 0 180px 40px rgba(0,0,0,.85); }

/* ---------- Shared UI ---------- */
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; animation: fadeIn .5s var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; transform: scale(.985); } }

.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(0,0,0,.35), 0 20px 60px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.05);
  backdrop-filter: blur(6px);
}
.title {
  font-family: var(--display);
  line-height: 1.25;
  letter-spacing: 2px;
  margin: 0;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, #c9822a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #3a2208) drop-shadow(0 0 24px rgba(242,193,78,.35));
}
.kicker { font-family: var(--display); font-size: 12px; line-height: 1.9; letter-spacing: 3px; color: var(--muted); text-transform: uppercase; }

.btn {
  position: relative;
  font-family: var(--display); font-size: 14px; letter-spacing: 1px;
  padding: 18px 26px;
  border: 0; border-radius: 10px;
  color: #2a1704;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 60%, #d08b24);
  box-shadow: 0 6px 0 #7a4810, 0 10px 24px rgba(242,193,78,.25);
  transition: transform .12s, box-shadow .12s, filter .2s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 8px 0 #7a4810, 0 14px 30px rgba(242,193,78,.35); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #7a4810; }
.btn:disabled { filter: grayscale(.8) brightness(.7); cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid var(--line); box-shadow: none; }
.btn.danger { background: linear-gradient(180deg, #ff8090, var(--red) 60%, #b8283a); color: #fff; box-shadow: 0 6px 0 #6d1220; }
.btn:focus-visible, .choice:focus-visible, .diff:focus-visible, input:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 3px; }

.field {
  width: 100%;
  padding: 18px 20px;
  font-size: 22px;
  background: rgba(0,0,0,.45);
  border: 2px solid var(--line); border-radius: 10px;
  transition: border-color .2s, box-shadow .2s;
}
.field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(242,193,78,.15); }

/* ---------- Name screen ---------- */
.hero { text-align: center; width: min(640px, 100%); }
.hero .title { font-size: clamp(30px, 5vw, 56px); margin: 14px 0 6px; }
.hero .sub { color: var(--muted); font-size: 20px; margin: 0 0 30px; }
.hero-art { display: flex; justify-content: center; align-items: flex-end; gap: 40px; height: 150px; margin-bottom: 8px; }
.hero-art svg { height: 120px; image-rendering: pixelated; filter: drop-shadow(0 8px 0 rgba(0,0,0,.5)); }
.hero-art .k { animation: bob 1.2s steps(2) infinite; }
.hero-art .b { height: 150px; animation: float 2.4s ease-in-out infinite; filter: drop-shadow(0 0 20px rgba(107,47,179,.7)); }
.join { padding: 28px; display: grid; gap: 16px; }
.join .err { color: var(--red); min-height: 1.2em; margin: 0; }
.rules { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin-top: 22px; color: var(--muted); font-size: 16px; }
.rules b { color: var(--text); }

/* torches */
.torch { position: fixed; top: 22%; width: 18px; height: 70px; z-index: 0; pointer-events: none; }
.torch.l { left: 5%; } .torch.r { right: 5%; }
.torch::before { content: ''; position: absolute; bottom: 0; left: 4px; width: 10px; height: 46px; background: linear-gradient(#6b4423, #3a2412); border-radius: 2px; }
.torch::after {
  content: ''; position: absolute; bottom: 40px; left: -6px; width: 30px; height: 40px;
  background: radial-gradient(circle at 50% 70%, #fff6b0, #ffb02e 35%, #ff5a1a 60%, transparent 70%);
  border-radius: 50% 50% 45% 45%;
  filter: blur(.5px);
  animation: flicker .18s infinite alternate;
  box-shadow: 0 0 60px 30px rgba(255,140,40,.25);
}
@keyframes flicker { from { transform: scale(1, 1) rotate(-2deg); opacity: .9; } to { transform: scale(1.08, .94) rotate(2deg); opacity: 1; } }

/* ---------- Lobby ---------- */
.lobby { text-align: center; padding: 40px 48px; width: min(720px, 100%); }
.lobby .title { font-size: 26px; margin: 12px 0 18px; }
.lobby .gate { font-size: 20px; color: var(--muted); }
.lobby .count { font-family: var(--display); font-size: 40px; color: var(--gold); margin: 18px 0 6px; }
.lobby .names { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; max-height: 160px; overflow: hidden; }
.chip { padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--line); font-size: 15px; animation: pop .4s var(--ease-back); }
.chip.me { background: rgba(242,193,78,.18); border-color: var(--gold); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.dots span { animation: blink 1.4s infinite; } .dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

/* ---------- Game layout ---------- */
.game {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: 1fr 300px;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  padding: 14px;
}
.hud { grid-column: 1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; padding: 12px 18px; }
.zone-badge { display: flex; align-items: center; gap: 12px; }
.zone-gem { width: 16px; height: 16px; transform: rotate(45deg); background: var(--accent); box-shadow: 0 0 14px var(--accent); transition: background .6s, box-shadow .6s; }
.zone-name { font-family: var(--display); font-size: 13px; white-space: nowrap; color: var(--accent); transition: color .6s; }
.zone-domain { font-size: 14px; color: var(--muted); }

.track { display: flex; align-items: center; gap: 6px; justify-content: center; }
.track .pip { width: 22px; height: 10px; border-radius: 3px; background: rgba(255,255,255,.08); transition: background .4s, box-shadow .4s, transform .3s var(--ease-back); }
.track .pip.done { background: var(--green); box-shadow: 0 0 10px rgba(61,220,132,.5); }
.track .pip.miss { background: var(--red); box-shadow: 0 0 10px rgba(255,77,94,.45); }
.track .pip.now { background: var(--gold); transform: scaleY(1.5); box-shadow: 0 0 12px var(--gold); }
.track .pip.gap { margin-left: 8px; }
.track .skull { font-size: 18px; margin-left: 8px; filter: grayscale(1) brightness(.6); transition: filter .4s; }
.track .skull.now { filter: none; animation: pulse 1s infinite; }

.timers { display: flex; gap: 18px; align-items: center; }
.timer { text-align: right; }
.timer .lbl { font-size: 13px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.timer .val { font-family: var(--display); font-size: 22px; font-variant-numeric: tabular-nums; }
.timer.event .val { color: var(--gold); }
.timer.event.low .val { color: var(--red); animation: pulse .8s infinite; }
.timer .pen { font-size: 13px; color: var(--red); }
.hearts { display: flex; gap: 4px; }
.hearts svg { width: 26px; image-rendering: pixelated; transition: transform .3s, opacity .3s, filter .3s; }
.hearts svg.lost { filter: grayscale(1) brightness(.4); transform: scale(.8); }
.hearts svg.refill { animation: refill .6s var(--ease-back); }
@keyframes refill { 0% { transform: scale(0); } 100% { transform: scale(1); } }

.runes { grid-column: 1; display: flex; justify-content: center; gap: 6px; }
.rune {
  width: 40px; height: 44px; display: grid; place-items: center;
  font-family: var(--display); font-size: 16px;
  border-radius: 6px;
  background: rgba(0,0,0,.4); border: 2px solid rgba(255,255,255,.07);
  color: transparent;
  transition: background .3s, border-color .3s, color .3s, transform .3s var(--ease-back);
}
.rune.gap { margin-left: 14px; }
.rune.got { color: #2a1704; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: var(--gold-2); box-shadow: 0 0 16px rgba(242,193,78,.5); transform: translateY(-2px); }
.rune.lost { color: rgba(255,77,94,.7); border-color: rgba(255,77,94,.35); }
.flyer { position: fixed; z-index: 80; font-family: var(--display); font-size: 22px; color: var(--gold-2); text-shadow: 0 0 16px var(--gold); pointer-events: none; transition: transform .75s cubic-bezier(.5,-0.3,.6,1), opacity .75s; }

/* stage */
.stage { grid-column: 1; position: relative; overflow: hidden; border-radius: 14px; border: 2px solid var(--line); min-height: 220px;
  background:
    radial-gradient(500px 200px at 50% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    linear-gradient(180deg, #120f1b 0%, #0c0a12 62%, #1a1410 62%, #0f0b08 100%);
}
.stage::before { /* stone wall bricks */
  content: ''; position: absolute; inset: 0 0 38% 0; opacity: .5;
  background-image:
    linear-gradient(rgba(0,0,0,.6) 3px, transparent 3px),
    linear-gradient(90deg, rgba(0,0,0,.6) 3px, transparent 3px),
    linear-gradient(90deg, rgba(0,0,0,.6) 3px, transparent 3px);
  background-size: 96px 40px, 96px 80px, 96px 80px;
  background-position: 0 0, 0 0, 48px 40px;
}
.stage::after { /* floor edge */
  content: ''; position: absolute; left: 0; right: 0; top: 62%; height: 4px; background: rgba(255,200,120,.15); box-shadow: 0 0 20px rgba(255,160,60,.25);
}
.stage .stage-torch { position: absolute; top: 14%; width: 14px; height: 50px; z-index: 1; }
.stage .stage-torch.l { left: 38%; } .stage .stage-torch.r { right: 38%; }
.stage .stage-torch::before { content: ''; position: absolute; bottom: 0; left: 3px; width: 8px; height: 32px; background: #5b3a1d; }
.stage .stage-torch::after { content: ''; position: absolute; bottom: 28px; left: -6px; width: 26px; height: 32px; border-radius: 50%;
  background: radial-gradient(circle at 50% 70%, #fff6b0, #ffb02e 35%, #ff5a1a 60%, transparent 70%); animation: flicker .16s infinite alternate; box-shadow: 0 0 50px 24px rgba(255,140,40,.2); }

.actor { position: absolute; bottom: 30%; z-index: 3; image-rendering: pixelated; }
.actor svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 0 rgba(0,0,0,.45)); }
.actor .shadow { position: absolute; left: 10%; right: 10%; bottom: -10px; height: 12px; border-radius: 50%; background: rgba(0,0,0,.55); filter: blur(3px); z-index: -1; }
#knight { left: 14%; width: clamp(110px, 12vw, 170px); }
#knight .body { animation: bob 1s steps(2) infinite; }
#enemy { right: 14%; width: clamp(110px, 12vw, 170px); }
#enemy.boss { width: clamp(200px, 21vw, 300px); right: 10%; }
#enemy .body { animation: float 2s ease-in-out infinite; }
#enemy.boss .body svg { filter: drop-shadow(0 0 30px rgba(140,60,230,.6)) drop-shadow(0 10px 0 rgba(0,0,0,.45)); }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes float { 50% { transform: translateY(-10px); } }
@keyframes pulse { 50% { opacity: .55; } }

.nameplate { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); white-space: nowrap; text-align: center; }
.nameplate .n { font-family: var(--display); font-size: 13px; color: var(--text); text-shadow: 0 2px 0 #000; }
.nameplate .d { font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.d.easy { color: var(--green); } .d.medium { color: var(--gold); } .d.hard { color: var(--red); }
.hpbar { width: 220px; height: 16px; margin: 6px auto 0; border-radius: 4px; background: rgba(0,0,0,.6); border: 2px solid rgba(255,255,255,.15); overflow: hidden; position: relative; }
.hpbar i { position: absolute; inset: 0; transform-origin: left; background: linear-gradient(90deg, #ff3b5c, #ff8a3d); transition: transform .6s var(--ease-out); }
.hpbar b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 10px; text-shadow: 0 1px 0 #000; }

/* actor animations */
.enter { animation: enter .55s var(--ease-back) both; }
@keyframes enter { from { transform: translateX(160px) scale(.6); opacity: 0; } }
.k-enter { animation: kenter .6s var(--ease-out) both; }
@keyframes kenter { from { transform: translateX(-120px); opacity: 0; } }
.attack { animation: attack .45s var(--ease-out); }
@keyframes attack { 40% { transform: translateX(clamp(140px, 28vw, 460px)) rotate(8deg); } 55% { transform: translateX(clamp(140px, 28vw, 460px)) rotate(-6deg); } }
.e-attack { animation: eattack .45s var(--ease-out); }
@keyframes eattack { 40% { transform: translateX(calc(-1 * clamp(140px, 28vw, 460px))); } }
.hit .body { animation: hit .35s steps(2) 2 !important; }
@keyframes hit { 0% { filter: brightness(4) saturate(0); transform: translateX(8px); } 100% { filter: none; transform: translateX(-8px); } }
.hurt .body { animation: hurt .35s steps(2) 2 !important; }
@keyframes hurt { 0% { filter: sepia(1) saturate(6) hue-rotate(-40deg); transform: translateX(-8px); } 100% { filter: none; transform: translateX(8px); } }
.die { animation: die .55s ease-in forwards; }
@keyframes die { to { transform: scale(1.4) translateY(-20px); opacity: 0; filter: brightness(3); } }
.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translate(-10px, 4px); } 40% { transform: translate(9px, -4px); } 60% { transform: translate(-6px, 3px); } 80% { transform: translate(4px, -2px); } }

.fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.dmg { position: absolute; font-family: var(--display); font-size: 26px; color: var(--gold-2); text-shadow: 0 3px 0 #000, 0 0 20px rgba(255,200,80,.7); animation: dmg 1s var(--ease-out) forwards; }
.dmg.bad { color: var(--red); text-shadow: 0 3px 0 #000, 0 0 20px rgba(255,77,94,.7); }
@keyframes dmg { 0% { transform: translateY(0) scale(.5); opacity: 0; } 15% { transform: translateY(-10px) scale(1.25); opacity: 1; } 100% { transform: translateY(-80px) scale(1); opacity: 0; } }
.slash { position: absolute; width: 180px; height: 180px; border-radius: 50%; border-top: 10px solid #fff; border-right: 4px solid transparent; filter: drop-shadow(0 0 12px #fff) drop-shadow(0 0 24px var(--accent)); animation: slash .35s ease-out forwards; }
@keyframes slash { from { transform: rotate(-60deg) scale(.6); opacity: 1; } to { transform: rotate(120deg) scale(1.1); opacity: 0; } }
.spark { position: absolute; width: 8px; height: 8px; background: var(--c, var(--gold)); box-shadow: 0 0 10px var(--c, var(--gold)); animation: spark .7s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; } }
.flash { position: fixed; inset: 0; z-index: 60; pointer-events: none; animation: flashA .4s ease-out forwards; }
@keyframes flashA { from { opacity: .45; } to { opacity: 0; } }

.banner { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; text-align: center; background: radial-gradient(closest-side, rgba(0,0,0,.75), transparent); animation: banner 1.8s var(--ease-out) forwards; pointer-events: none; }
.banner .t { font-family: var(--display); font-size: clamp(22px, 3vw, 40px); color: var(--accent); text-shadow: 0 4px 0 #000, 0 0 30px var(--accent); }
.banner .s { margin-top: 12px; font-size: 18px; letter-spacing: 4px; text-transform: uppercase; color: var(--muted); }
@keyframes banner { 0% { opacity: 0; transform: scale(1.3); letter-spacing: 12px; } 15% { opacity: 1; transform: scale(1); letter-spacing: 2px; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* question card */
.qcard { grid-column: 1; padding: 20px 22px; display: grid; gap: 16px; animation: rise .45s var(--ease-out); }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.prompt { font-size: clamp(20px, 1.7vw, 28px); line-height: 1.35; white-space: pre-line; margin: 0; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 14px 16px; min-height: 64px;
  font-size: clamp(16px, 1.25vw, 20px);
  background: linear-gradient(180deg, var(--stone-2), var(--stone));
  border: 2px solid rgba(255,255,255,.08); border-radius: 10px;
  box-shadow: 0 4px 0 rgba(0,0,0,.5);
  transition: transform .12s, border-color .15s, background .2s, box-shadow .15s;
}
.choice:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 0 rgba(0,0,0,.5), 0 0 22px color-mix(in srgb, var(--accent) 35%, transparent); }
.choice:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.5); }
.choice .key { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; font-family: var(--display); font-size: 13px; background: rgba(0,0,0,.45); color: var(--accent); border: 1px solid rgba(255,255,255,.1); }
.choice:disabled { cursor: default; }
.choice.right { border-color: var(--green); background: linear-gradient(180deg, #1d4a33, #12301f); box-shadow: 0 0 24px rgba(61,220,132,.4); }
.choice.right .key { color: var(--green); }
.choice.wrong { border-color: var(--red); background: linear-gradient(180deg, #4a1d25, #301218); animation: shake .4s; }
.choice.dim { opacity: .4; }
.explain { min-height: 1.4em; margin: 0; font-size: 17px; color: var(--muted); }
.explain.ok { color: var(--green); } .explain.bad { color: var(--red); }

/* boss difficulty picker */
.diffs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.diff { padding: 18px; border-radius: 12px; border: 2px solid rgba(255,255,255,.1); background: linear-gradient(180deg, var(--stone-2), var(--stone)); text-align: center; transition: transform .15s var(--ease-back), border-color .15s, box-shadow .15s; box-shadow: 0 5px 0 rgba(0,0,0,.5); }
.diff:hover { transform: translateY(-4px) scale(1.02); }
.diff .dn { font-family: var(--display); font-size: 14px; }
.diff .dd { font-size: 28px; font-family: var(--display); margin: 10px 0 4px; }
.diff .dh { font-size: 14px; color: var(--muted); }
.diff.easy { --c: var(--green); } .diff.medium { --c: var(--gold); } .diff.hard { --c: var(--red); }
.diff .dn, .diff .dd { color: var(--c); }
.diff:hover { border-color: var(--c); box-shadow: 0 8px 0 rgba(0,0,0,.5), 0 0 26px color-mix(in srgb, var(--c) 40%, transparent); }

/* side leaderboard */
.side { grid-column: 2; grid-row: 1 / -1; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.side h3 { margin: 0; font-family: var(--display); font-size: 12px; color: var(--gold); display: flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); animation: pulse 1.2s infinite; }
.lb { list-style: none; margin: 0; padding: 0; position: relative; flex: 1; overflow: hidden; }
.lb li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; background: rgba(255,255,255,.03); font-size: 16px; transition: transform .5s var(--ease-out), background .3s; }
.lb li.me { background: rgba(242,193,78,.14); outline: 1px solid var(--gold); }
.lb .r { font-family: var(--display); font-size: 12px; color: var(--muted); }
.lb li:nth-child(1) .r { color: #ffd700; } .lb li:nth-child(2) .r { color: #d0d6e0; } .lb li:nth-child(3) .r { color: #e3a066; }
.lb .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .bar { grid-column: 2 / 4; height: 4px; border-radius: 2px; background: rgba(255,255,255,.07); overflow: hidden; }
.lb .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width .6s var(--ease-out); }
.lb .tm { font-family: var(--display); font-size: 11px; color: var(--muted); }
.lb .tm.fin { color: var(--green); }
.my-rank { padding: 12px; border-radius: 10px; background: rgba(0,0,0,.35); border: 1px dashed var(--line); text-align: center; font-size: 15px; color: var(--muted); }
.my-rank b { display: block; font-family: var(--display); font-size: 24px; color: var(--gold); margin-top: 4px; }

/* ---------- End screens ---------- */
.end { text-align: center; padding: 36px 44px; width: min(760px, 100%); }
.end .title { font-size: clamp(22px, 3vw, 34px); margin: 8px 0 20px; }
.chest { position: relative; width: 200px; height: 170px; margin: 0 auto 10px; }
.chest .rays { position: absolute; left: 50%; top: 40%; width: 420px; height: 420px; margin: -210px; border-radius: 50%; opacity: 0;
  background: repeating-conic-gradient(rgba(255,223,138,.35) 0 10deg, transparent 10deg 30deg);
  mask-image: radial-gradient(closest-side, #000 20%, transparent); animation: spin 8s linear infinite; transition: opacity 1s; }
.chest.open .rays { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.chest svg { position: absolute; left: 0; width: 200px; image-rendering: pixelated; }
.chest .cbody { bottom: 0; }
.chest .clid { bottom: 87px; transform-origin: 50% 100%; transition: transform .7s var(--ease-back); }
.chest.open .clid { transform: translateY(-34px) rotate(-18deg); }
.chest .glow { position: absolute; left: 30px; right: 30px; bottom: 80px; height: 20px; border-radius: 50%; background: #fff3b0; filter: blur(14px); opacity: 0; transition: opacity .6s .3s; }
.chest.open .glow { opacity: 1; }
.clue { margin: 16px auto 22px; padding: 20px 24px; max-width: 560px; font-size: 22px; line-height: 1.4; color: #2a1704;
  background: linear-gradient(180deg, #f6e7c1, #e7cf98); border-radius: 6px; box-shadow: 0 8px 0 #8b6a32, 0 20px 40px rgba(0,0,0,.5);
  transform-origin: top; animation: unroll .8s 1s var(--ease-out) both; }
@keyframes unroll { from { transform: scaleY(0); opacity: 0; } }
.clue small { display: block; font-family: var(--display); font-size: 11px; letter-spacing: 2px; color: #8b5a2b; margin-bottom: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 10px 0 0; }
.stat { padding: 14px 8px; border-radius: 10px; background: rgba(0,0,0,.35); border: 1px solid var(--line); }
.stat .v { font-family: var(--display); font-size: 20px; color: var(--gold); }
.stat .l { font-size: 14px; color: var(--muted); margin-top: 6px; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; padding: 12px 20px; border-radius: 10px; background: #2a1218; border: 1px solid var(--red); color: #ffd3d8; animation: rise .3s; }

@media (max-width: 1100px) {
  .game { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; overflow: auto; }
  .side { display: none; }
  .runes .rune { width: 30px; height: 36px; font-size: 12px; }
}
@media (max-height: 760px) {
  .rune { height: 34px; width: 34px; font-size: 13px; }
  .choice { min-height: 52px; padding: 10px 14px; }
  .qcard { padding: 14px 18px; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Projector leaderboard ---------- */
.board { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto 1fr; gap: 22px; padding: 28px 40px; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.board-head .title { font-size: clamp(22px, 2.6vw, 40px); }
.big-timer { text-align: right; }
.big-timer .val { font-family: var(--display); font-size: clamp(40px, 5vw, 78px); color: var(--gold); text-shadow: 0 5px 0 #3a2208, 0 0 30px rgba(242,193,78,.4); font-variant-numeric: tabular-nums; }
.big-timer.low .val { color: var(--red); animation: pulse .8s infinite; }
.big-timer .lbl { font-size: 16px; color: var(--muted); letter-spacing: 3px; text-transform: uppercase; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 20px; max-width: 1100px; width: 100%; margin: 0 auto; }
.pod { text-align: center; padding: 18px 14px 20px; border-radius: 14px 14px 6px 6px; background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.3)); border: 2px solid var(--line); position: relative; transition: transform .5s var(--ease-back); }
.pod .medal { font-size: 40px; filter: drop-shadow(0 4px 0 rgba(0,0,0,.4)); }
.pod .pn { font-size: clamp(18px, 1.6vw, 26px); margin: 8px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pt { font-family: var(--display); font-size: clamp(14px, 1.3vw, 20px); color: var(--gold); }
.pod.p1 { min-height: 190px; border-color: #ffd700; box-shadow: 0 0 40px rgba(255,215,0,.25); }
.pod.p2 { min-height: 160px; border-color: #c0c8d4; }
.pod.p3 { min-height: 140px; border-color: #d08a4c; }
.pod.empty { opacity: .35; }
.board-list { list-style: none; margin: 0 auto; padding: 0; width: 100%; max-width: 1300px; columns: 2; column-gap: 24px; overflow: hidden; }
.board-list li { break-inside: avoid; display: grid; grid-template-columns: 56px 1fr 120px 110px; align-items: center; gap: 12px; padding: 10px 16px; margin-bottom: 8px; border-radius: 10px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.05); font-size: 20px; }
.board-list li.top10 { border-color: rgba(242,193,78,.35); background: rgba(242,193,78,.07); }
.board-list .r { font-family: var(--display); font-size: 14px; color: var(--muted); }
.board-list li.top10 .r { color: var(--gold); }
.board-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.board-list .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width .6s var(--ease-out); }
.board-list .tm { font-family: var(--display); font-size: 13px; text-align: right; color: var(--muted); }
.board-list .tm.fin { color: var(--green); }
.board-empty { text-align: center; color: var(--muted); font-size: 22px; margin-top: 40px; }

/* ---------- Admin ---------- */
body.admin { overflow: auto; }
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; display: grid; gap: 18px; }
.admin-wrap .title { font-size: 22px; }
.admin-card { padding: 22px; display: grid; gap: 14px; }
.admin-card h3 { margin: 0; font-family: var(--display); font-size: 12px; color: var(--gold); letter-spacing: 1px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row .field { width: auto; flex: 1; min-width: 200px; font-size: 18px; padding: 12px 14px; }
.row .btn { padding: 14px 18px; font-size: 12px; }
.status-pill { font-family: var(--display); font-size: 12px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); }
.status-pill.running { color: var(--green); border-color: var(--green); }
.status-pill.ended { color: var(--red); border-color: var(--red); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.admin-table th, .admin-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.06); }
.admin-table th { font-size: 13px; color: var(--muted); font-weight: 400; text-transform: uppercase; letter-spacing: 1px; }
.admin-table button { background: none; border: 1px solid rgba(255,77,94,.4); color: var(--red); border-radius: 6px; padding: 4px 10px; }
.login { width: min(420px, 100%); padding: 28px; display: grid; gap: 14px; text-align: center; }
.msg { min-height: 1.2em; margin: 0; color: var(--muted); }
.msg.err { color: var(--red); }

/* ---------- Extra juice ---------- */
.mute { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.35); font-size: 16px; transition: transform .15s; }
.mute:hover { transform: scale(1.1); }
.count-pop { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; font-family: var(--display); font-size: clamp(60px, 9vw, 120px); color: var(--gold); text-shadow: 0 8px 0 #3a2208, 0 0 40px rgba(242,193,78,.6); animation: countPop .65s var(--ease-out) forwards; pointer-events: none; }
.count-pop.go { color: var(--green); text-shadow: 0 8px 0 #0b3a20, 0 0 50px rgba(61,220,132,.7); font-size: clamp(44px, 7vw, 96px); }
@keyframes countPop { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(.7); opacity: 0; } }
.combo { position: absolute; top: 14px; left: 50%; z-index: 7; transform: translateX(-50%) rotate(-3deg); padding: 8px 16px; border-radius: 10px; font-family: var(--display); font-size: 13px; color: #2a1704; background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 4px 0 #7a4810, 0 0 24px rgba(242,193,78,.5); }
.combo b { font-size: 18px; }
.stage.walking::before { animation: walkScroll .6s linear; }
@keyframes walkScroll { to { background-position: -192px 0, -192px 0, -144px 40px; } }
#knight.walking .body { animation: bob .15s steps(2) infinite; }
.lobby .lobby-art { display: flex; justify-content: center; gap: 18px; margin: 10px 0 4px; }
.lobby .lobby-art svg { height: 70px; image-rendering: pixelated; animation: bob 1s steps(2) infinite; }
.lobby .lobby-art svg:nth-child(2) { animation-delay: .2s; } .lobby .lobby-art svg:nth-child(3) { animation-delay: .4s; } .lobby .lobby-art svg:nth-child(4) { animation-delay: .6s; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; text-align: left; }
.how div { padding: 12px; border-radius: 10px; background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.06); font-size: 15px; color: var(--muted); }
.how b { display: block; font-family: var(--display); font-size: 11px; color: var(--gold); margin-bottom: 6px; }
.practice-only { display: none; }
body.practice .practice-only { display: inline-block; }
body.practice .stage::after { content: 'PRACTICE'; position: absolute; top: 12px; right: 14px; left: auto; height: auto; padding: 6px 10px; border-radius: 6px; font-family: var(--display); font-size: 11px; color: #0b3a20; background: var(--green); box-shadow: none; z-index: 6; }

/* ---------- Guides, bonus chests ---------- */
.guide { display: grid; gap: 14px; }
.guide h3 { margin: 0; font-family: var(--display); font-size: 15px; line-height: 1.6; color: var(--accent); }
.guide ul { margin: 0; padding-left: 22px; display: grid; gap: 8px; font-size: clamp(17px, 1.35vw, 21px); line-height: 1.4; }
.guide li::marker { content: '▸ '; color: var(--gold); }
.guide .btn { justify-self: start; font-size: 12px; padding: 14px 20px; }
.q-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.q-foot .skip { font-size: 11px; padding: 10px 14px; flex: none; }
#enemy.chest-foe { width: clamp(120px, 12vw, 170px); bottom: 32%; }
#enemy.chest-foe .body svg { filter: drop-shadow(0 0 18px rgba(242,193,78,.6)) drop-shadow(0 8px 0 rgba(0,0,0,.45)); }
.track .pip { width: 14px; }
.track .pip.star { width: 14px; height: 14px; border-radius: 50%; background: rgba(242,193,78,.25); }
.track .pip.star.done { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.rune { width: 32px; height: 38px; font-size: 13px; }
.rune.gap { margin-left: 10px; }
.timer .pen .bad { color: var(--red); } .timer .pen .good { color: var(--gold); }
.organiser { margin-top: 18px; font-size: 14px; }
.organiser a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.organiser a:hover, .organiser a:focus-visible { color: var(--gold); }

/* ---------- Admin dashboard ---------- */
.admin-card h3 { text-transform: none; letter-spacing: .5px; line-height: 1.6; }
.muted-small { font-family: var(--body); font-size: 14px; color: var(--muted); letter-spacing: 0; }
.back-link { color: var(--muted); font-size: 15px; }
.ledger { display: grid; grid-template-columns: repeat(7, auto); justify-content: space-between; gap: 10px 22px; padding: 18px 24px; }
.ledger div { display: grid; gap: 4px; min-width: 0; }
.ledger b { font-family: var(--display); font-size: 22px; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.ledger div:last-child b { font-family: var(--body); font-size: 20px; font-weight: 600; color: var(--text); }
.ledger span { font-size: 14px; color: var(--muted); }
.descent { display: flex; align-items: flex-end; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.leg { flex: 1; min-width: 96px; display: grid; justify-items: center; gap: 4px; text-align: center; }
.leg-bar { width: 100%; max-width: 120px; height: 110px; display: flex; align-items: flex-end; border-radius: 8px 8px 4px 4px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.06); overflow: hidden; }
.leg-bar i { display: block; width: 100%; min-height: 3px; background: linear-gradient(180deg, var(--c), color-mix(in srgb, var(--c) 45%, #000)); box-shadow: 0 0 18px color-mix(in srgb, var(--c) 50%, transparent); transition: height .6s var(--ease-out); }
.leg b { font-family: var(--display); font-size: 20px; color: var(--c); }
.leg span { font-size: 15px; }
.leg small { font-size: 13px; color: var(--muted); }
.leg-arrow { align-self: center; color: var(--muted); font-size: 22px; padding-bottom: 50px; }
.table-scroll { overflow-x: auto; }
.admin-table td.num { font-variant-numeric: tabular-nums; }
.admin-table td.fin { color: var(--green); }
.admin-table .pname { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table .adj { color: var(--gold); border-color: var(--line); }
.admin-table small { color: var(--muted); font-size: 12px; }
.admin-table .empty-row { text-align: center; color: var(--muted); padding: 24px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: #6b6576; }
.dot.done { background: var(--gold); }
.mini-bar { width: 90px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); }
.report { display: none; }
@media (max-width: 900px) { .ledger { grid-template-columns: repeat(2, 1fr); } }

@media print {
  @page { margin: 14mm; }
  body, body.admin { background: #fff !important; color: #000; overflow: visible; }
  .cave-bg, .vignette, #embers, #panel, #login-screen { display: none !important; }
  .report { display: block !important; font-family: var(--body); color: #000; }
  .report h1 { font-family: var(--display); font-size: 18px; margin: 0 0 8px; }
  .report p { margin: 0 0 4px; font-size: 13px; }
  .report table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 12px; }
  .report th, .report td { border: 1px solid #999; padding: 5px 7px; text-align: left; }
  .report th { background: #eee; }
  .report tr.top td { font-weight: 700; background: #fff6d6; }
  .report tr { break-inside: avoid; }
  .report .foot { margin-top: 10px; color: #444; }
}

/* Full-screen pages scroll instead of clipping on short windows; auto margins keep them centred when they fit */
.screen { display: flex; flex-direction: column; overflow-y: auto; }
.screen > :not(.torch) { margin: auto; flex: none; }

/* ---------- Admin monitor ---------- */
.monitor { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.proj-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); background: #000; }
.proj-frame iframe { position: absolute; top: 0; left: 0; width: 1600px; height: 900px; border: 0; transform: scale(var(--s, .4)); transform-origin: 0 0; pointer-events: none; }
.scorecard { display: grid; gap: 14px; padding: 16px; border-radius: 12px; background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.07); }
.sc-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.sc-name { font-size: 24px; font-weight: 600; overflow-wrap: anywhere; }
.sc-rank { font-family: var(--display); font-size: 26px; color: var(--gold); text-align: right; }
.sc-rank small { display: block; font-family: var(--body); font-size: 13px; color: var(--muted); }
.sc-time { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sc-time div { display: grid; gap: 2px; padding: 10px; border-radius: 8px; background: rgba(255,255,255,.03); }
.sc-time b { font-family: var(--display); font-size: 15px; }
.sc-time span { font-size: 13px; color: var(--muted); }
.sc-time .bad b { color: var(--red); } .sc-time .good b { color: var(--gold); }
.sc-time .total { background: rgba(242,193,78,.1); outline: 1px solid var(--line); } .sc-time .total b { color: var(--gold-2); }
.sc-zones { display: grid; gap: 8px; }
.sc-zone { display: grid; grid-template-columns: minmax(0, 9.5em) minmax(90px, 1fr) auto; align-items: center; gap: 10px; font-size: 15px; }
.sc-zone small { color: var(--muted); text-align: right; }
.sc-pips { display: flex; gap: 4px; }
.sc-pips i { flex: 1; min-width: 8px; height: 10px; border-radius: 3px; background: rgba(255,255,255,.08); }
.sc-pips i.on { background: var(--c); box-shadow: 0 0 8px color-mix(in srgb, var(--c) 60%, transparent); }
.sc-pips i.star { border-radius: 50%; flex: 0 0 10px; }
.sc-pips i.star.on { background: var(--gold); }
.mini-bar.boss { width: auto; height: 10px; } .mini-bar.boss i { background: linear-gradient(90deg, #ff4d5e, #ff8a3d); }
.sc-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--muted); }
.sc-facts b { color: var(--text); }
.admin-table .sel { background: none; border: 0; padding: 0; color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.admin-table .sel:hover { color: var(--gold); }
.admin-table tr.picked td { background: rgba(242,193,78,.08); }
@media (max-width: 1000px) { .monitor { grid-template-columns: 1fr; } .sc-time { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Rules, attempts, tab strikes ---------- */
.rules-card { width: min(760px, 100%); padding: 28px 32px; display: grid; gap: 14px; }
.rules-card .title { font-size: clamp(18px, 2.2vw, 26px); text-align: center; }
.rules-card .kicker { text-align: center; }
.rules-who { margin: 0; text-align: center; color: var(--muted); }
.rules-who b { color: var(--gold); }
.rules-list { margin: 0; padding-left: 24px; display: grid; gap: 9px; font-size: 17px; line-height: 1.4; }
.rules-list li::marker { color: var(--gold); font-weight: 600; }
.rules-list b { color: var(--gold-2); font-weight: 600; }
.agree { display: flex; align-items: center; gap: 10px; justify-content: center; font-size: 17px; cursor: pointer; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.3); border: 1px dashed var(--line); }
.agree input { width: 22px; height: 22px; accent-color: var(--gold); }
.rules-card .err { color: var(--red); text-align: center; min-height: 1.2em; margin: 0; }
.choice.used { opacity: .55; }
.qcard { user-select: none; -webkit-user-select: none; }
.strikes { font-family: var(--display); font-size: 11px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.35); color: var(--muted); white-space: nowrap; }
.strikes.hot { color: var(--red); border-color: var(--red); animation: pulse 1s infinite; }
.warn-modal { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 20px; background: rgba(10, 2, 4, .78); backdrop-filter: blur(4px); animation: fadeIn .25s; }
.warn-box { width: min(520px, 100%); padding: 28px; text-align: center; display: grid; gap: 12px; border-color: var(--red); box-shadow: 0 0 0 4px rgba(0,0,0,.4), 0 0 60px rgba(255,77,94,.35); }
.warn-box .warn-icon { font-size: 48px; }
.warn-box h2 { margin: 0; font-family: var(--display); font-size: 18px; line-height: 1.5; color: var(--red); }
.warn-box p { margin: 0; font-size: 18px; line-height: 1.45; }
.warn-box .btn { justify-self: center; }
.warn-box.restart h2 { color: #ff8a8a; }

.admin-table td.warn, .sc-facts b.warn { color: var(--red); }

/* ---------- Feedback ---------- */
.feedback { margin-top: 22px; padding: 18px 20px; border-radius: 12px; background: rgba(0,0,0,.3); border: 1px solid var(--line); display: grid; gap: 12px; text-align: left; }
.feedback h3 { margin: 0; font-family: var(--display); font-size: 13px; color: var(--gold); line-height: 1.6; text-align: center; }
.feedback.done { text-align: center; color: var(--green); font-size: 18px; }
.feedback.done p { margin: 0; }
.fb-q { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.fb-q legend { font-size: 17px; padding: 0; margin-bottom: 4px; }
.fb-q .req { color: var(--gold); } .fb-q .opt { color: var(--muted); font-size: 14px; }
.stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.stars label { cursor: pointer; font-size: 30px; line-height: 1; color: rgba(255,255,255,.18); transition: color .12s, transform .12s; }
.stars input, .chips input { position: absolute; opacity: 0; pointer-events: none; }
.stars label:hover, .stars label:hover ~ label, .stars label:has(input:checked), .stars label:has(input:checked) ~ label { color: var(--gold); }
.stars label:hover { transform: scale(1.15); }
.stars label:has(input:focus-visible) { outline: 2px solid var(--gold-2); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.chips { display: flex; gap: 8px; }
.chips label span { display: inline-block; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; transition: background .15s, color .15s; }
.chips label:has(input:checked) span { background: var(--gold); color: #2a1704; border-color: var(--gold); }
.chips label:has(input:focus-visible) span { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.feedback textarea { width: 100%; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--text); background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.feedback .btn { justify-self: center; font-size: 12px; padding: 14px 22px; }
.fb-msg { margin: 0; min-height: 1.2em; text-align: center; color: var(--muted); }
.end { max-height: calc(100vh - 48px); overflow-y: auto; }
.fb-ledger { padding: 12px 0; background: none; border: 0; box-shadow: none; }
.admin-table .stars-txt { color: var(--gold); letter-spacing: 1px; white-space: nowrap; }
.admin-table .fb-comment { max-width: 340px; white-space: normal; }

/* ---------- Readability for students: nothing below ~15px, brighter secondary text ---------- */
.kicker { font-size: 13px; }
.zone-domain { font-size: 15px; }
.timer .lbl { font-size: 14px; }
.timer .pen { font-size: 15px; }
.nameplate .n { font-size: 14px; }
.nameplate .d { font-size: 15px; }
.prompt { font-size: clamp(22px, 1.9vw, 30px); line-height: 1.4; }
.choice { font-size: clamp(18px, 1.4vw, 22px); }
.explain { font-size: 19px; }
.guide ul { font-size: clamp(18px, 1.45vw, 22px); }
.stat .l { font-size: 16px; }
.stat .v { font-size: 22px; }
.lb li { font-size: 17px; }
.lb .tm { font-size: 12px; }
.my-rank { font-size: 16px; }
.how div { font-size: 16px; }
.rules { font-size: 17px; }
.rules-list { font-size: 18px; }
.hero .sub { font-size: 21px; }
.chip { font-size: 16px; }
.fb-q legend { font-size: 18px; }
.fb-sub { margin: 6px 0 0; font-family: var(--display); font-size: 12px; color: var(--gold); letter-spacing: 1px; }
.fb-text { width: 100%; padding: 10px 12px; font: inherit; font-size: 17px; color: var(--text); background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 8px; }
.chips { flex-wrap: wrap; }
.muted-small { font-size: 15px; }

/* ---------- Pixel font only on rune letters; everything people read is Fredoka ---------- */
.rune, .flyer { font-family: var(--pixel); }
body { font-weight: 500; }
.title { letter-spacing: 1px; }
.kicker, .btn, .zone-name, .nameplate .n, .timer .val, .diff .dn, .diff .dd, .combo, .strikes, .lb .r, .lb .tm, .stat .v, .sc-rank, .sc-time b, .leg b, .ledger b, .status-pill, .choice .key, .guide h3, .feedback h3, .fb-sub, .clue small, .how b, .hpbar b, .side h3, .admin-card h3, .warn-box h2 { letter-spacing: .3px; }
.btn { font-size: 16px; }
.kicker { font-size: 14px; letter-spacing: 2px; }
.zone-name { font-size: 17px; }
.nameplate .n { font-size: 16px; }
.timer .val { font-size: 26px; }
.lb .tm { font-size: 14px; }
.lb .r { font-size: 14px; }
.side h3, .admin-card h3 { font-size: 16px; }
.guide h3 { font-size: 20px; }
.feedback h3 { font-size: 18px; }
.warn-box h2 { font-size: 24px; }
.clue small { font-size: 13px; }
.choice .key { font-size: 15px; }

/* ---------- Activities ---------- */
.game:has(.activity) .stage { min-height: 150px; }
.qcard { max-height: 64vh; overflow-y: auto; }
.act-tag { display: inline-block; margin-right: 10px; padding: 4px 12px; border-radius: 999px; font-family: var(--display); font-size: 15px; color: #1a1030; background: linear-gradient(135deg, var(--gold-2), var(--accent)); vertical-align: middle; box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.activity { display: grid; gap: 14px; padding: 4px; border-radius: 14px; transition: box-shadow .3s; }
.activity.ok { box-shadow: 0 0 0 3px var(--green), 0 0 30px rgba(61,220,132,.35); }
.activity.bad { box-shadow: 0 0 0 3px var(--red), 0 0 30px rgba(255,77,94,.3); animation: shake .4s; }
.act-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.act-hint, .act-total { color: var(--muted); font-size: 17px; }
.act-total b { color: var(--gold); font-family: var(--display); font-size: 22px; }
.act-check { padding: 14px 24px; }

/* bulbs */
.bulbs { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.bulb { width: 92px; padding: 12px 8px 10px; border-radius: 18px; border: 2px solid rgba(255,255,255,.1); background: linear-gradient(180deg, var(--stone-2), var(--stone)); display: grid; justify-items: center; gap: 8px; transition: transform .15s var(--ease-back), border-color .2s, box-shadow .2s; }
.bulb:hover { transform: translateY(-4px); }
.bulb .glass { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #5a5468, #2a2535); box-shadow: inset 0 -6px 10px rgba(0,0,0,.5); transition: background .25s, box-shadow .25s; }
.bulb b { font-family: var(--display); font-size: 24px; color: var(--muted); }
.bulb.on { border-color: var(--gold); box-shadow: 0 0 30px rgba(242,193,78,.45); }
.bulb.on .glass { background: radial-gradient(circle at 35% 30%, #fffbe0, #ffd84a 45%, #ff9d1a); box-shadow: 0 0 34px 10px rgba(255,210,74,.6); }
.bulb.on b { color: var(--gold-2); }

/* order */
.order-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.slot { min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 2px dashed rgba(255,255,255,.15); color: var(--muted); font-size: 17px; text-align: left; background: rgba(0,0,0,.25); }
.slot i { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-style: normal; font-family: var(--display); font-size: 15px; background: rgba(255,255,255,.08); }
.slot.filled { border-style: solid; border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 16%, transparent); animation: pop .3s var(--ease-back); }
.slot.filled i { background: var(--accent); color: #12101a; }
.order-pool { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 52px; }
.tile { padding: 12px 18px; border-radius: 12px; font-size: 18px; border: 2px solid rgba(255,255,255,.12); background: linear-gradient(180deg, var(--stone-2), var(--stone)); box-shadow: 0 4px 0 rgba(0,0,0,.5); transition: transform .15s var(--ease-back), border-color .2s; }
.tile:hover { transform: translateY(-3px) rotate(-1deg); border-color: var(--accent); }

/* crack the code */
.abc { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.abc span { width: 30px; height: 34px; display: grid; place-items: center; border-radius: 6px; font-family: var(--display); font-size: 17px; background: rgba(255,255,255,.06); color: var(--gold-2); }
.act-type { display: flex; gap: 12px; }
.act-input { flex: 1; font-family: var(--display); font-size: 26px; letter-spacing: 6px; text-transform: uppercase; text-align: center; }

/* robot coder */
.robot-wrap { display: flex; gap: 22px; align-items: center; justify-content: center; flex-wrap: wrap; }
.grid { --c: 54px; position: relative; display: grid; grid-template-columns: repeat(var(--n), var(--c)); grid-auto-rows: var(--c); border-radius: 12px; overflow: hidden; border: 2px solid var(--line); background: #0d1220; }
.cell { display: grid; place-items: center; font-size: 26px; border: 1px solid rgba(255,255,255,.05); }
.cell.wall { background: repeating-linear-gradient(45deg, #3a2a20, #3a2a20 6px, #2c2018 6px, #2c2018 12px); }
.bot { position: absolute; left: 0; top: 0; width: var(--c); height: var(--c); display: grid; place-items: center; font-size: 32px; transition: transform .24s var(--ease-out); filter: drop-shadow(0 0 10px rgba(125,249,255,.6)); }
.bot.crash { animation: shake .4s; filter: drop-shadow(0 0 14px rgba(255,77,94,.9)); }
.robot-ctl { display: grid; gap: 12px; justify-items: center; min-width: 220px; }
.pad { display: grid; grid-template-areas: ". u ." "l . r" ". d ."; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(3, 52px); gap: 6px; }
.pad-btn { font-size: 26px; border-radius: 12px; border: 2px solid rgba(255,255,255,.12); background: linear-gradient(180deg, var(--stone-2), var(--stone)); box-shadow: 0 4px 0 rgba(0,0,0,.5); transition: transform .1s; }
.pad-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.5); }
.pad-U { grid-area: u; } .pad-D { grid-area: d; } .pad-L { grid-area: l; } .pad-R { grid-area: r; }
.program { min-height: 40px; max-width: 260px; display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; font-size: 20px; }
.program em { color: var(--muted); font-size: 15px; }
.program span { animation: pop .2s var(--ease-back); }

/* sort it out */
.sort-list { display: grid; gap: 8px; }
.sort-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); font-size: 18px; }
.sort-btns { display: flex; gap: 8px; flex: none; }
.sort-btn { padding: 8px 16px; border-radius: 999px; font-size: 16px; font-weight: 600; border: 2px solid rgba(255,255,255,.15); background: transparent; transition: background .15s, color .15s, transform .12s var(--ease-back); }
.sort-btn:hover { transform: scale(1.06); }
.sort-btn.s0.on { background: var(--green); border-color: var(--green); color: #08261a; }
.sort-btn.s1.on { background: var(--red); border-color: var(--red); color: #fff; }

/* shooting gallery */
.range { position: relative; height: 260px; border-radius: 14px; overflow: hidden; cursor: crosshair; border: 2px solid var(--line); container-type: inline-size;
  background: radial-gradient(ellipse at 50% 120%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 60%), repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 40px), #0c0a14; }
.range-hud { position: absolute; top: 8px; left: 12px; right: 12px; display: flex; justify-content: space-between; font-family: var(--display); font-size: 17px; z-index: 2; pointer-events: none; }
.target { position: absolute; left: 0; padding: 10px 16px; border-radius: 999px; font-size: 16px; font-weight: 600; white-space: nowrap; cursor: crosshair; color: #1a1030; background: radial-gradient(circle at 30% 30%, #fff, #ffd9a0); border: 3px solid #ff8a3d; box-shadow: 0 0 18px rgba(255,138,61,.5); animation: 6s linear forwards; }
.target.ltr { animation-name: flyLtr; } .target.rtl { animation-name: flyRtl; }
@keyframes flyLtr { from { transform: translateX(-110%); } to { transform: translateX(100cqw); } }
@keyframes flyRtl { from { transform: translateX(100cqw); } to { transform: translateX(-110%); } }
.target.hit { animation-play-state: paused; background: var(--green); border-color: #fff; color: #08261a; scale: 1.15; }
.target.bad { animation-play-state: paused; background: var(--red); border-color: #fff; color: #fff; }

/* lane racer */
.road { position: relative; height: 270px; border-radius: 14px; overflow: hidden; outline: none; border: 2px solid var(--line); background: linear-gradient(90deg, #1d3a1d 0 6%, #2b2b33 6% 94%, #1d3a1d 94%); }
.road:focus-visible { box-shadow: 0 0 0 3px var(--gold-2); }
.lanes { position: absolute; inset: 0 6%; display: grid; grid-template-columns: repeat(3, 1fr); }
.lane { cursor: pointer; border-left: 4px dashed rgba(255,255,255,.18); animation: roadRun .6s linear infinite; background-image: repeating-linear-gradient(180deg, transparent 0 30px, rgba(255,255,255,.03) 30px 60px); }
.lane:first-child { border-left: 0; }
@keyframes roadRun { to { background-position: 0 60px; } }
.gate { position: absolute; left: 6%; right: 6%; top: -60px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 8px; pointer-events: none; }
.gate span { padding: 10px 6px; border-radius: 10px; text-align: center; font-family: var(--display); font-size: 17px; color: #1a1030; background: linear-gradient(180deg, #fff3c4, var(--gold)); box-shadow: 0 6px 0 #7a4810; }
.gate.roll { animation: gateRoll 3.6s linear forwards; }
@keyframes gateRoll { from { top: -60px; } to { top: calc(100% - 118px); } }
.gate span.pass { background: var(--green); box-shadow: 0 0 24px var(--green); }
.gate span.crash { background: var(--red); color: #fff; }
.car { position: absolute; bottom: 12px; left: 50%; translate: -50% 0; width: 46px; height: 74px; transition: left .18s var(--ease-out); filter: drop-shadow(0 8px 6px rgba(0,0,0,.6)); }
.car svg { width: 100%; height: 100%; display: block; }
.car.crash { animation: shake .45s; filter: drop-shadow(0 0 16px rgba(255,77,94,.9)); }
.car.boost { filter: drop-shadow(0 10px 12px rgba(242,193,78,.9)); }
.road-q { position: absolute; top: 8px; left: 50%; translate: -50% 0; padding: 6px 14px; border-radius: 999px; background: rgba(0,0,0,.65); font-family: var(--display); font-size: 17px; white-space: nowrap; z-index: 2; }
@media (max-height: 760px) { .range, .road { height: 220px; } .grid { --c: 46px; } }

/* ---------- Landing showcase + scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(28px) scale(.98); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
.scroll-hint { display: inline-block; margin-top: 22px; color: var(--gold-2); text-decoration: none; font-weight: 600; font-size: 17px; animation: hintBob 1.6s ease-in-out infinite; }
.scroll-hint:hover { color: #fff; }
@keyframes hintBob { 50% { transform: translateY(6px); } }
#s-name { scroll-behavior: smooth; }
.showcase { width: min(1100px, 100%); padding: 40px 0 30px; text-align: center; display: grid; gap: 22px; }
.showcase .title { font-size: clamp(28px, 3.6vw, 44px); }
.showcase-sub { margin: 0; color: var(--muted); font-size: 20px; }
.zone-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.zone-card { position: relative; padding: 22px 18px 20px; border-radius: 20px; text-align: left; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 22%, var(--stone)), var(--stone) 70%);
  border: 2px solid color-mix(in srgb, var(--c) 45%, transparent);
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
  transition: opacity .7s var(--ease-out), transform .45s var(--ease-back), box-shadow .3s; }
.zone-card.in:hover { transform: translateY(-8px) rotate(-.6deg); box-shadow: 0 26px 50px rgba(0,0,0,.55), 0 0 36px color-mix(in srgb, var(--c) 40%, transparent); }
.zone-card::after { content: ''; position: absolute; inset: -40% -40% auto auto; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%); pointer-events: none; }
.zc-art { height: 86px; display: flex; align-items: flex-end; }
.zc-art svg { height: 80px; width: auto; image-rendering: pixelated; animation: float 2.6s ease-in-out infinite; filter: drop-shadow(0 8px 0 rgba(0,0,0,.45)); }
.zone-card h3 { margin: 12px 0 2px; font-family: var(--display); font-size: 22px; color: var(--c); }
.zone-card p { margin: 0 0 10px; color: var(--muted); font-size: 16px; }
.zone-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 17px; }
.win-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.win-strip div { padding: 16px; border-radius: 16px; background: rgba(0,0,0,.35); border: 1px solid var(--line); display: grid; gap: 6px; justify-items: center; }
.win-strip b { font-size: 30px; }
.win-strip span { font-size: 17px; color: var(--text); }
@media (max-width: 1000px) { .zone-cards, .win-strip { grid-template-columns: repeat(2, 1fr); } }

/* ---------- General polish ---------- */
.title { background-size: 200% 100%; animation: titleShine 6s ease-in-out infinite; background-image: linear-gradient(100deg, #c9822a 0%, var(--gold) 25%, #fff6c8 45%, var(--gold) 60%, #c9822a 100%); }
@keyframes titleShine { 50% { background-position: 100% 0; } }
.btn { transition: transform .15s var(--ease-back), box-shadow .2s, filter .2s; }
.panel { transition: border-color .3s, box-shadow .3s; }
.choice, .tile, .sort-btn, .pad-btn, .bulb, .diff { will-change: transform; }
.qcard > * { animation: rise .45s var(--ease-out) both; }
.qcard > *:nth-child(2) { animation-delay: .06s; } .qcard > *:nth-child(3) { animation-delay: .12s; }

.btn { font-size: 18px; }

/* ---------- Catch it ---------- */
.sky { position: relative; height: 260px; border-radius: 14px; overflow: hidden; outline: none; cursor: none; border: 2px solid var(--line);
  background: radial-gradient(ellipse at 50% -20%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 60%), linear-gradient(#0f1a2e, #0a0d18); }
.sky:focus-visible { box-shadow: 0 0 0 3px var(--gold-2); }
.drop { position: absolute; top: 0; translate: -50% 0; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 16px; white-space: nowrap; color: #1a1030; background: linear-gradient(180deg, #fff, #d9ecff); box-shadow: 0 0 16px rgba(160,210,255,.45); pointer-events: none; }
.drop.yum { background: var(--green); color: #08261a; scale: 1.2; transition: scale .2s; }
.drop.yuck { background: var(--red); color: #fff; scale: 1.2; transition: scale .2s; }
.drop.gone { opacity: .3; transition: opacity .3s; }
.basket { position: absolute; bottom: 6px; translate: -50% 0; font-size: 46px; transition: left .08s linear; filter: drop-shadow(0 0 14px color-mix(in srgb, var(--accent) 70%, transparent)); pointer-events: none; }

/* ---------- Memory match ---------- */
.mem-hud { font-family: var(--display); font-size: 17px; text-align: center; }
.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; perspective: 800px; }
.mcard { position: relative; min-height: 70px; border-radius: 14px; border: 2px solid rgba(255,255,255,.12); font-size: 16px; font-weight: 600; padding: 8px;
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--accent) 35%, var(--stone)) 0 10px, var(--stone) 10px 20px);
  transform: rotateY(180deg); transition: transform .35s var(--ease-out), background .2s, border-color .2s; }
.mcard span { opacity: 0; transition: opacity .15s .1s; }
.mcard.up { transform: none; background: linear-gradient(180deg, #fff6d8, var(--gold)); color: #2a1704; border-color: var(--gold-2); }
.mcard.up span { opacity: 1; }
.mcard.done { background: linear-gradient(180deg, #c9ffd9, var(--green)); color: #08261a; border-color: #fff; box-shadow: 0 0 20px rgba(61,220,132,.45); }
@media (max-height: 760px) { .sky { height: 220px; } .mcard { min-height: 58px; } }

/* ---------- Scenery + knight levels ---------- */
.scenery { position: absolute; inset: 0; z-index: 0; pointer-events: none; animation: fadeIn .8s ease; }
.scenery svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lv-badge { flex: none; padding: 6px 10px; border-radius: 10px; font-family: var(--display); font-size: 15px; color: #2a1704; background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 3px 0 #7a4810, 0 0 14px rgba(242,193,78,.4); }
#knight[data-lv="3"] .body svg { filter: drop-shadow(0 0 10px rgba(61,220,132,.45)) drop-shadow(0 10px 0 rgba(0,0,0,.45)); }
#knight[data-lv="4"] .body svg { filter: drop-shadow(0 0 14px rgba(194,123,255,.6)) drop-shadow(0 10px 0 rgba(0,0,0,.45)); }
#knight[data-lv="5"] .body svg { filter: drop-shadow(0 0 18px rgba(255,216,74,.8)) drop-shadow(0 10px 0 rgba(0,0,0,.45)); }
#knight.levelup { animation: levelUp 1.1s var(--ease-back); }
@keyframes levelUp { 0% { transform: none; } 30% { transform: translateY(-34px) scale(1.25); filter: brightness(2.2); } 60% { transform: translateY(-18px) scale(1.15); } 100% { transform: none; } }

/* ---------- A different world for every level ---------- */
body[data-zone] .stage { transition: background 1s ease; }
body[data-zone="crypt"] .stage { background: radial-gradient(420px 160px at 82% 20%, rgba(170,190,255,.22), transparent 70%), linear-gradient(180deg, #0c1530 0%, #131c38 62%, #1a1c2a 62%, #0d0e16 100%); }
body[data-zone="forge"] .stage { background: radial-gradient(600px 200px at 50% 100%, rgba(255,110,30,.45), transparent 70%), linear-gradient(180deg, #2a0e08 0%, #3a1608 62%, #2a1208 62%, #160904 100%); }
body[data-zone="shields"] .stage { background: radial-gradient(500px 180px at 50% 0%, rgba(61,220,132,.2), transparent 70%), linear-gradient(180deg, #0b1f18 0%, #12302a 62%, #1d2a1f 62%, #0b130e 100%); }
body[data-zone="heart"] .stage { background: radial-gradient(520px 200px at 50% 40%, rgba(194,123,255,.35), transparent 70%), linear-gradient(180deg, #1a0d33 0%, #26124a 62%, #1f1430 62%, #0f0a1a 100%); }
body[data-zone="boss"] .stage { background: radial-gradient(520px 220px at 50% 50%, rgba(255,60,90,.3), transparent 70%), linear-gradient(180deg, #1a0626 0%, #2c0a3c 62%, #24102a 62%, #0e0612 100%); animation: bossPulse 3s ease-in-out infinite; }
@keyframes bossPulse { 50% { box-shadow: inset 0 0 80px rgba(255,60,90,.35); } }
body[data-zone] .cave-bg { transition: background 1.2s ease; }
body[data-zone="crypt"] .cave-bg { background: radial-gradient(1200px 600px at 50% 115%, rgba(91,141,239,.18), transparent 60%), linear-gradient(#0a0f1f, #07060b 60%, #090b14); }
body[data-zone="forge"] .cave-bg { background: radial-gradient(1200px 600px at 50% 115%, rgba(255,120,40,.3), transparent 60%), linear-gradient(#140805, #0b0503 60%, #170a04); }
body[data-zone="shields"] .cave-bg { background: radial-gradient(1200px 600px at 50% 115%, rgba(61,220,132,.18), transparent 60%), linear-gradient(#06120d, #040a07 60%, #08140e); }
body[data-zone="heart"] .cave-bg { background: radial-gradient(1200px 600px at 50% 115%, rgba(194,123,255,.25), transparent 60%), linear-gradient(#100720, #08040f 60%, #120821); }
body[data-zone="boss"] .cave-bg { background: radial-gradient(1200px 600px at 50% 115%, rgba(255,60,90,.25), transparent 60%), linear-gradient(#12041a, #08020c 60%, #16051c); }

/* outdoor scenes replace the cave wall, floor line and torches */
body[data-zone] .stage::before, body[data-zone] .stage::after, body[data-zone] .stage-torch { display: none; }
.scenery .drift { animation: drift 22s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(30px); } }
.scenery .twinkle { animation: twinkle 2.8s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .25; } }
.scenery .bolt { opacity: 0; animation: bolt 3.2s steps(1) infinite; }
@keyframes bolt { 0%, 88% { opacity: 0; } 90%, 94% { opacity: 1; } 92%, 100% { opacity: 0; } }
#knight { width: clamp(130px, 13.5vw, 190px); }
#knight .body svg { filter: drop-shadow(0 0 2px rgba(0,0,0,.9)) drop-shadow(0 10px 0 rgba(0,0,0,.45)); }

/* tougher monsters: bigger, crisp dark outline */
#enemy:not(.boss):not(.chest-foe) { width: clamp(130px, 13.5vw, 190px); }
#enemy .body svg { filter: drop-shadow(0 0 2px rgba(0,0,0,.95)) drop-shadow(0 10px 0 rgba(0,0,0,.45)); }

/* ==========================================================================
   One screen, no scrolling: the stage takes a fixed share of the height and
   every activity is sized to fit the rest. Actors scale with the stage height.
   ========================================================================== */
.game { grid-template-rows: auto auto clamp(180px, 28vh, 300px) minmax(0, 1fr); }
.stage, .game:has(.activity) .stage { min-height: 0; }
.qcard { max-height: none; min-height: 0; overflow: hidden; align-content: start; gap: 10px; padding: 14px 18px; }
.prompt { font-size: clamp(19px, 1.6vw, 26px); }

/* actors stand on the scenery's ground line and always fit inside the stage */
.actor svg { width: auto; height: 100%; }
.actor .body { height: 100%; }
#knight, #enemy, #enemy:not(.boss):not(.chest-foe) { width: auto; height: 56%; bottom: 22%; }
#enemy.boss { width: auto; height: 60%; bottom: 20%; }
#enemy.chest-foe { width: auto; height: 30%; bottom: 24%; }
#knight { left: 12%; }
#enemy { right: 12%; }
.nameplate .hpbar { width: 180px; }

/* activities sized to the space left under the stage */
.range, .road, .sky { height: clamp(150px, 25vh, 240px); }
.grid { --c: clamp(30px, 4.6vh, 50px); }
.cell { font-size: calc(var(--c) * .5); }
.bot { font-size: calc(var(--c) * .6); }
.pad { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(3, 44px); }
.mcard { min-height: clamp(44px, 6.5vh, 64px); }
.bulb { padding: 8px 6px; gap: 6px; } .bulb .glass { width: 36px; height: 36px; }
.slot { min-height: 44px; }
.abc span { width: 26px; height: 28px; font-size: 15px; }
.sort-row { padding: 6px 12px; }
.act-input { font-size: 22px; }

/* clean look: no dark vignette, no heavy glows */
.vignette { display: none; }
#knight .body svg, #knight[data-lv] .body svg { filter: drop-shadow(0 0 1.5px rgba(0,0,0,.9)) drop-shadow(0 6px 0 rgba(0,0,0,.3)); }
#enemy .body svg, #enemy.boss .body svg { filter: drop-shadow(0 0 1.5px rgba(0,0,0,.9)) drop-shadow(0 6px 0 rgba(0,0,0,.3)); }

/* end screen: results left, feedback right, so it fits without scrolling */
.end { width: min(1180px, 100%); max-height: none; overflow: visible; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 28px; align-items: start; padding: 26px 30px; }
.end > .kicker, .end > .title, .end > .sub { grid-column: 1 / -1; }
.end > .chest, .end > .clue, .end > .stats, .end > .row { grid-column: 1; }
.end > .feedback { grid-column: 2; grid-row: 3 / span 4; margin-top: 0; }
.end .chest { width: 160px; height: 130px; } .end .chest svg { width: 160px; } .end .chest .clid { bottom: 70px; }
.end .clue { margin: 8px auto 14px; font-size: 19px; padding: 14px 18px; }
.end .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.end .stat { padding: 10px 6px; }
.feedback { grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 14px 16px; }
.feedback h3, .feedback .fb-sub, .feedback .btn, .feedback .fb-msg, .feedback .fb-q:has(textarea), .feedback .fb-q:has(.fb-text) { grid-column: 1 / -1; }
.fb-q legend { font-size: 15px; }
.stars label { font-size: 24px; }
.chips label span { padding: 5px 11px; font-size: 14px; }
.feedback textarea { min-height: 0; }
@media (max-width: 1000px) { .end { grid-template-columns: 1fr; } .end > .feedback { grid-column: 1; grid-row: auto; } }

/* ==========================================================================
   Float + glow accents: only transform/opacity are animated (cheap on school PCs);
   glow sits on a few key things, not over the whole screen.
   ========================================================================== */
/* lane racer fits the space below the stage */
.road { height: clamp(130px, 17.5vh, 220px); }
.car { width: 34px; height: 56px; }
.gate.roll { animation-name: gateRollFit; }
@keyframes gateRollFit { from { top: -60px; } to { top: calc(100% - 100px); } }

/* animated "electric" border around the challenge card */
@property --spin { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.qcard { position: relative; isolation: isolate; }
.qcard::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 2px; pointer-events: none; z-index: -1;
  background: conic-gradient(from var(--spin), transparent 0 62%, color-mix(in srgb, var(--accent) 80%, transparent) 76%, var(--gold-2) 82%, transparent 92%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spinBorder 7s linear infinite; }
@keyframes spinBorder { to { --spin: 360deg; } }

/* collected runes glow softly; the current checkpoint pulses */
.rune.got { position: relative; }
.rune.got::after { content: ''; position: absolute; inset: -4px; border-radius: 8px; background: radial-gradient(circle, rgba(255,223,138,.55), transparent 70%); z-index: -1; animation: softPulse 2.6s ease-in-out infinite; }
@keyframes softPulse { 50% { opacity: .35; transform: scale(.92); } }
.track .pip.now { animation: pulse 1.2s ease-in-out infinite; }

/* level badge + zone gem float and shine */
.lv-badge { animation: floaty 3s ease-in-out infinite; }
.zone-gem { animation: gemSpin 6s linear infinite; }
@keyframes gemSpin { to { transform: rotate(405deg); } }
@keyframes floaty { 50% { transform: translateY(-3px); } }

/* bonus chest floats on a golden aura */
#enemy.chest-foe::before { content: ''; position: absolute; left: -20%; right: -20%; bottom: -10%; height: 80%; border-radius: 50%; background: radial-gradient(ellipse, rgba(255,215,100,.45), transparent 65%); animation: softPulse 2s ease-in-out infinite; z-index: -1; }

/* glowing motes drifting up through every scene */
.mote { animation: moteRise linear infinite; opacity: 0; }
@keyframes moteRise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .9; } 85% { opacity: .7; } 100% { transform: translateY(-160px); opacity: 0; } }

/* primary buttons: light sweep on hover */
.btn:not(.ghost):not(.danger) { overflow: hidden; }
.btn:not(.ghost):not(.danger)::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent); transform: skewX(-20deg); transition: left .6s ease; pointer-events: none; }
.btn:not(.ghost):not(.danger):hover::after { left: 120%; }

/* choices and activity buttons lift with an accent glow */
.choice:hover:not(:disabled), .tile:hover, .bulb:hover, .pad-btn:hover, .sort-btn:hover, .mcard:not(.up):hover { box-shadow: 0 6px 0 rgba(0,0,0,.45), 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent); }

/* end-screen stats float in one after another */
.stat { animation: rise .5s var(--ease-out) both; }
.stat:nth-child(2) { animation-delay: .08s; } .stat:nth-child(3) { animation-delay: .16s; } .stat:nth-child(4) { animation-delay: .24s; } .stat:nth-child(5) { animation-delay: .32s; }
@media (prefers-reduced-motion: reduce) { .qcard::before, .rune.got::after, .mote, .lv-badge, .zone-gem { animation: none; } }

/* robot controls side by side, catch sky shorter: both fit under the stage at 768px tall */
.robot-ctl { grid-template-columns: auto auto; grid-template-areas: "pad prog" "pad run"; align-items: center; column-gap: 18px; }
.robot-ctl .pad { grid-area: pad; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 38px); }
.robot-ctl .program { grid-area: prog; }
.robot-ctl .row { grid-area: run; }
.pad-btn { font-size: 20px; }
.sky { height: clamp(130px, 18vh, 220px); }

.range { height: clamp(140px, 22vh, 240px); }

/* snappier: shorter rune flight and walk to match the faster game loop */
.flyer { transition-duration: .45s; }
.stage.walking::before { animation-duration: .3s; }

/* last fit pass at 1366x768: sort in two columns, slightly shorter arenas */
.qcard { padding: 12px 16px; gap: 8px; }
.sort-list { grid-template-columns: 1fr 1fr; gap: 8px; }
.sort-row { padding: 6px 10px; font-size: 16px; }
.sort-btn { padding: 6px 12px; font-size: 15px; }
.range { height: clamp(130px, 19vh, 240px); }
.sky { height: clamp(120px, 16.5vh, 220px); }
.grid { --c: clamp(28px, 4.2vh, 50px); }
.slot { min-height: 40px; padding: 8px 10px; }
.tile { padding: 9px 14px; font-size: 17px; }
@media (max-width: 1100px) { .sort-list { grid-template-columns: 1fr; } }

/* end screen fits 768px: compact results column + paired feedback questions */
.end { padding: 18px 24px; row-gap: 6px; }
.end > .kicker { font-size: 12px; }
.end > .title { font-size: clamp(22px, 2.4vw, 30px); margin: 0 0 6px; }
.end > .sub { margin: 0 0 6px; font-size: 17px !important; }
.end .chest { width: 120px; height: 100px; margin-bottom: 0; } .end .chest svg { width: 120px; } .end .chest .clid { bottom: 52px; } .end .chest .rays { width: 300px; height: 300px; margin: -150px; }
.end .clue { margin: 4px auto 10px; padding: 10px 14px; font-size: 17px; }
.end .stats { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.end .stat { padding: 8px 4px; } .end .stat .v { font-size: 18px; } .end .stat .l { font-size: 13px; }
.end .row { margin-top: 10px !important; }
.feedback { gap: 8px 14px; padding: 12px 14px; }
.feedback h3 { font-size: 16px; }
.feedback .fb-sub { display: none; }
.feedback .fb-q:has(textarea), .feedback .fb-q:has(.fb-text) { grid-column: auto; }
.feedback .fb-q:has(input[name="plan"]) { grid-column: 1 / -1; }
.fb-q legend { font-size: 14px; margin-bottom: 2px; }
.stars label { font-size: 22px; }
.chips { gap: 6px; } .chips label span { padding: 4px 10px; font-size: 13px; }
.feedback textarea { height: 42px; resize: none; font-size: 15px; padding: 8px 10px; }
.fb-text { font-size: 15px; padding: 8px 10px; }
.feedback .btn { padding: 10px 18px; font-size: 15px; }

/* time-up screen has a subtitle row, so its feedback column starts one row lower */
.end:has(> .sub) > .feedback { grid-row: 4 / span 3; }

/* ---------- Fill in the blanks ---------- */
.fill-text { margin: 4px 0; font-size: clamp(19px, 1.55vw, 24px); line-height: 2; }
.blank { display: inline-block; min-width: 110px; margin: 0 6px; padding: 2px 12px; border: 0; border-bottom: 3px dashed var(--accent); border-radius: 6px 6px 0 0; background: rgba(255,255,255,.05); font: inherit; font-weight: 600; color: var(--gold-2); vertical-align: baseline; transition: background .2s, border-color .2s; }
.blank.filled { border-bottom-style: solid; border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); animation: pop .25s var(--ease-back); }
.word-bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.word-bank .tile:disabled { opacity: .3; transform: none; }

/* ---------- Crossword ---------- */
.cw-wrap { display: flex; gap: 22px; align-items: center; justify-content: center; flex-wrap: wrap; }
.cw-grid { --cw: clamp(34px, 5vh, 46px); display: grid; gap: 4px; }
.cw-cell { position: relative; width: var(--cw); height: var(--cw); }
.cw-cell.void { visibility: hidden; }
.cw-cell i { position: absolute; top: 2px; left: 4px; font-style: normal; font-size: 11px; font-weight: 700; color: #6a5a3a; pointer-events: none; z-index: 1; }
.cw-cell input { width: 100%; height: 100%; border-radius: 8px; border: 2px solid var(--gold); background: linear-gradient(180deg, #fff8e0, #f3e2b0); color: #2a1704; text-align: center; font-family: var(--display); font-size: calc(var(--cw) * .5); text-transform: uppercase; caret-color: var(--accent); box-shadow: 0 3px 0 #8b6a32; padding: 0; }
.cw-cell input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent), 0 3px 0 #8b6a32; }
.cw-clues { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 8px; font-size: 17px; max-width: 460px; }
.cw-clues b { color: var(--gold); margin-right: 6px; }
.cw-clues small { color: var(--muted); }

/* crossword fits under the stage at 768px tall */
.cw-grid { --cw: clamp(28px, 4vh, 44px); gap: 3px; }
.cw-clues { font-size: 15px; gap: 6px; }

/* contact details sit two per row */
.feedback .fb-q.half { grid-column: auto; }
.feedback .fb-q.half .fb-text { padding: 7px 10px; font-size: 15px; }
.feedback .fb-q.half { gap: 2px; }
.feedback .fb-q.half legend { font-size: 14px; margin-bottom: 0; }
.feedback .fb-sub .opt { font-family: var(--body, inherit); font-size: 12px; color: var(--muted); letter-spacing: 0; }
