/* =====================================================================
   LibNext Clever Kids Quiz Quest — STYLES
   ===================================================================== */
@font-face { font-family: "Fredoka"; font-weight: 500; font-display: swap; src: url(../assets/fonts/fredoka-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url(../assets/fonts/fredoka-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url(../assets/fonts/fredoka-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap; src: url(../assets/fonts/nunito-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url(../assets/fonts/nunito-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url(../assets/fonts/nunito-latin-800-normal.woff2) format("woff2"); }

:root {
  --ink: #1d1a4f;
  --ink-2: #3b3680;
  --night: #120f3a;
  --night-2: #2a1f6e;
  --paper: #fffaf0;
  --paper-2: #fff1d6;
  --sun: #ffd23f;
  --sun-d: #e0a800;
  --coral: #ff5d73;
  --coral-d: #d63a52;
  --mint: #2ec4a0;
  --mint-d: #189a7b;
  --sky: #4cc9f0;
  --grape: #7b5cff;
  --grape-d: #5638d6;
  --orange: #ff9f1c;
  --good: #1fae64;
  --good-bg: #dcfbe9;
  --bad: #e5484d;
  --bad-bg: #ffe3e3;
  --muted: #6b6894;
  --radius: 22px;
  --shadow: 0 8px 0 rgba(18, 15, 58, .28);
  --shadow-soft: 0 18px 40px rgba(10, 6, 40, .35);
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --scale: 1;
  --stage-w: 1120px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #120f3a; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--body); font-weight: 700; color: var(--ink);
  background: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; line-height: 1.12; }
p { margin: 0; }
:focus-visible { outline: 4px solid var(--sun); outline-offset: 3px; border-radius: 12px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--sun); color: var(--ink); padding: 10px 16px; border-radius: 12px; font-weight: 800; }
.skip-link:focus { left: 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.noscript { color: #fff; text-align: center; padding: 40px; }

/* ---------- Animated sky ---------- */
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background: radial-gradient(1200px 800px at 15% -10%, #4a2fb8 0%, transparent 60%),
              radial-gradient(900px 700px at 110% 10%, #1b6fd0 0%, transparent 55%),
              linear-gradient(180deg, var(--night-2) 0%, var(--night) 100%); }
.sky__glow { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: drift 24s ease-in-out infinite alternate; }
.sky__glow--a { width: 520px; height: 520px; left: -120px; bottom: -160px; background: #ff5d73; opacity: .28; }
.sky__glow--b { width: 600px; height: 600px; right: -200px; top: 30%; background: #2ec4a0; opacity: .2; animation-duration: 30s; }
.sky__stars { position: absolute; inset: 0; background-image:
  radial-gradient(2px 2px at 10% 20%, #fff8 50%, transparent 52%), radial-gradient(1.5px 1.5px at 30% 70%, #fff6 50%, transparent 52%),
  radial-gradient(2px 2px at 55% 15%, #fff7 50%, transparent 52%), radial-gradient(1.5px 1.5px at 80% 40%, #fff6 50%, transparent 52%),
  radial-gradient(2px 2px at 92% 85%, #fff7 50%, transparent 52%), radial-gradient(1.5px 1.5px at 66% 92%, #fff5 50%, transparent 52%),
  radial-gradient(1.5px 1.5px at 4% 88%, #fff6 50%, transparent 52%), radial-gradient(2px 2px at 44% 44%, #fff4 50%, transparent 52%);
  animation: twinkle 6s ease-in-out infinite alternate; }
.sky__shapes span { position: absolute; font-family: var(--display); font-weight: 700; animation: floaty 20s linear infinite; }
@keyframes drift { to { transform: translate(60px, -40px) scale(1.1); } }
@keyframes twinkle { from { opacity: .6; } to { opacity: 1; } }
@keyframes floaty { 0% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-40px) rotate(25deg); } 100% { transform: translateY(0) rotate(0); } }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px clamp(12px, 3vw, 28px);
  padding-top: max(10px, env(safe-area-inset-top)); background: rgba(18,15,58,.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 1px 0 rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 6px; color: #fff; text-align: left; border-radius: 14px; }
.brand__mark svg { width: 40px; height: 40px; display: block; }
.brand__text b { display: block; font-family: var(--display); font-size: 1.25rem; letter-spacing: .3px; }
.brand__text small { display: block; font-size: .72rem; color: #c9c3ff; font-weight: 700; letter-spacing: .4px; margin-top: -2px; }
.topbar__hud { flex: 1; display: flex; justify-content: center; gap: 6px; flex-wrap: nowrap; min-width: 0; }
.topbar__tools { display: flex; gap: 8px; }
.tool { width: 46px; height: 46px; border-radius: 14px; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 1.3rem; display: grid; place-items: center;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); transition: transform .15s, background .15s; }
.tool:hover { background: rgba(255,255,255,.24); }
.tool:active { transform: translateY(2px); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: rgba(255,255,255,.95); color: var(--ink);
  font-family: var(--display); font-weight: 600; font-size: 1rem; box-shadow: 0 4px 0 rgba(0,0,0,.22); white-space: nowrap; }
.pill b { font-weight: 700; }
.pill__xp { font-style: normal; color: var(--muted); font-size: .85rem; margin-left: 4px; }
.pill--streak.hot { background: linear-gradient(90deg, #ffb347, #ff5d73); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
.pill.bump { animation: bump .5s; }
@keyframes pulse { 50% { transform: scale(1.07); } }
@keyframes bump { 30% { transform: scale(1.25); } }

/* ---------- Stage & screens ---------- */
.stage { width: min(var(--stage-w), 100%); margin: 0 auto; padding: 8px clamp(14px, 3vw, 28px) 40px; outline: none; }
.screen { animation: screenIn .45s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.screen__head { display: flex; align-items: center; gap: 16px; color: #fff; margin: 6px 0 22px; }
.screen__head h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.screen__head p { color: #d9d4ff; margin-top: 4px; max-width: 60ch; }
.screen__head > div { flex: 1; }
.screen__head .head-char { width: 96px; flex: none; }
.back { width: 52px; height: 52px; border-radius: 16px; border: 0; background: #fff; color: var(--ink); font-size: 1.5rem; font-weight: 800; box-shadow: var(--shadow); flex: none; }
.back:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(18,15,58,.28); }

/* ---------- Characters ---------- */
.char svg { width: 100%; height: auto; display: block; overflow: visible; }
.char { animation: bob 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
.char.bounce { animation: hop .6s cubic-bezier(.3,1.6,.5,1) both, bob 3.2s 0.6s ease-in-out infinite; }
.char[data-mood="encourage"] { animation: tilt 1.6s ease-in-out infinite; }
.char--bolt .bulb { animation: glow 1s ease-in-out infinite alternate; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes hop { 0% { transform: scale(1); } 40% { transform: translateY(-18px) scale(1.06, .95); } 70% { transform: translateY(0) scale(.96, 1.04); } 100% { transform: none; } }
@keyframes tilt { 50% { transform: rotate(-4deg); } }
@keyframes glow { to { fill: #fff6b0; filter: drop-shadow(0 0 6px #ffd23f); } }
.speech { position: relative; background: #fff; color: var(--ink); border-radius: 20px; padding: 12px 16px; font-weight: 800; box-shadow: var(--shadow); line-height: 1.35; }
.speech.pop { animation: pop .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { from { transform: scale(.85); opacity: .4; } }

/* ---------- HOME ---------- */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 12px; color: #fff; min-height: 340px; }
.eyebrow { font-family: var(--display); font-weight: 600; color: #cfc8ff; letter-spacing: 2px; text-transform: uppercase; font-size: .95rem; }
.eyebrow span { color: var(--sun); }
.logo { margin: 6px 0 10px; line-height: .92; }
.logo__a { display: block; font-size: clamp(3rem, 9vw, 5.6rem); color: #fff; letter-spacing: -1px;
  text-shadow: 0 5px 0 var(--grape-d), 0 10px 0 rgba(0,0,0,.25); }
.logo__b { display: inline-block; margin-top: 12px; font-size: clamp(1.5rem, 4.2vw, 2.6rem); background: var(--sun); color: var(--ink); padding: 6px 22px 8px; border-radius: 16px;
  transform: rotate(-3deg); box-shadow: 0 6px 0 var(--sun-d), 0 12px 20px rgba(0,0,0,.25); letter-spacing: 1px; text-transform: uppercase; }
.tagline { font-family: var(--display); font-weight: 600; font-size: clamp(1.15rem, 2.6vw, 1.5rem); color: #fff; margin-top: 16px; }
.facts { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.facts li { background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.18); padding: 6px 14px; border-radius: 999px; color: #e7e3ff; }
.facts b { color: var(--sun); font-family: var(--display); font-size: 1.15rem; }
.hero__cast { position: relative; height: 340px; }
.cast-ring { position: absolute; left: 50%; top: 52%; width: 300px; height: 300px; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(255,210,63,.35), rgba(255,210,63,0) 70%); }
.cast { position: absolute; }
.cast--hoot { width: 190px; left: 50%; top: 40px; transform: translateX(-50%); z-index: 2; }
.cast--nova { width: 130px; left: 4%; bottom: 10px; animation-delay: -.8s; }
.cast--pip  { width: 130px; right: 4%; bottom: 14px; animation-delay: -1.6s; }
.cast--bolt { width: 92px; right: 0; top: 4px; animation-delay: -2.2s; }
.speech--hero { position: absolute; left: 0; top: 18px; font-size: .95rem; max-width: 170px; transform: rotate(-4deg); animation: pop .6s .3s both; }
.speech--hero::after { content: ""; position: absolute; right: -10px; bottom: 16px; border: 10px solid transparent; border-left-color: #fff; }

.resume { display: flex; align-items: center; gap: 14px; width: 100%; margin: 14px 0 4px; padding: 14px 18px; border: 0; border-radius: 20px; background: #fff; text-align: left;
  box-shadow: var(--shadow); animation: pop .5s both; }
.resume__icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: #fff; font-size: 1.3rem; flex: none; }
.resume b { display: block; font-family: var(--display); font-size: 1.2rem; }
.resume small { color: var(--muted); }
.menu { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 16px; margin-top: 18px; }
.mbtn { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 6px; min-height: 150px; padding: 18px; border: 0; border-radius: 26px;
  text-align: left; color: #fff; box-shadow: 0 8px 0 rgba(0,0,0,.28), var(--shadow-soft); transition: transform .15s, box-shadow .15s; overflow: hidden; }
.mbtn::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.14); }
.mbtn:hover { transform: translateY(-4px) rotate(-.6deg); }
.mbtn:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0,0,0,.28); }
.mbtn__ic { font-size: 2.6rem; line-height: 1; font-family: var(--emoji); filter: drop-shadow(0 3px 0 rgba(0,0,0,.2)); }
.mbtn__t { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1.1; }
.mbtn__t small { display: block; font-family: var(--body); font-weight: 700; font-size: .85rem; opacity: .92; margin-top: 4px; }
.mbtn--hero { background: linear-gradient(135deg, #ffd23f, #ff9f1c); color: var(--ink); }
.mbtn--hero .mbtn__t { font-size: 1.75rem; }
.mbtn--hero .mbtn__ic { font-size: 3.2rem; animation: wiggle 2.4s ease-in-out infinite; }
.mbtn--rapid { background: linear-gradient(135deg, #ff5d73, #c2185b); }
.mbtn--practice { background: linear-gradient(135deg, #2ec4a0, #0f8f8a); }
.mbtn--ach { background: linear-gradient(135deg, #7b5cff, #4a2fb8); }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-12deg); } 90% { transform: rotate(10deg); } }
.menu--more { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.chipbtn { border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff; padding: 11px 18px; border-radius: 999px; font-family: var(--display); font-weight: 600; font-size: 1.05rem; transition: background .15s, transform .15s; }
.chipbtn:hover { background: rgba(255,255,255,.2); transform: translateY(-2px); }
.chipbtn--class { background: #fff; color: var(--ink); border-color: #fff; }
.levelbar { margin-top: 22px; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.16); border-radius: 18px; padding: 12px 16px; color: #fff; }
.levelbar__row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-size: .95rem; margin-bottom: 8px; }
.levelbar__row b { font-family: var(--display); }
.levelbar--up { background: rgba(255,210,63,.18); border-color: var(--sun); animation: pop .6s 1s both; }
.meter { height: 14px; border-radius: 999px; background: rgba(0,0,0,.28); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sun), var(--orange)); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); transition: width 1s; }
.credits { margin-top: 26px; color: #b9b3ea; font-size: .85rem; text-align: center; line-height: 1.6; }
.credits p + p { margin-top: 4px; }
.linkbtn { background: none; border: 0; padding: 0; color: #fff; text-decoration: underline; font-weight: 800; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 12px 24px; border: 0; border-radius: 18px;
  font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: .4px; background: #fff; color: var(--ink);
  box-shadow: 0 6px 0 rgba(18,15,58,.3); transition: transform .12s, box-shadow .12s, filter .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 rgba(18,15,58,.3); }
.btn:disabled { opacity: .45; filter: grayscale(.6); }
.btn--go { background: linear-gradient(180deg, #ffe066, #ffc52e); color: var(--ink); box-shadow: 0 6px 0 var(--sun-d); }
.btn--go:not(:disabled) { animation: ready 2s ease-in-out infinite; }
@keyframes ready { 50% { box-shadow: 0 6px 0 var(--sun-d), 0 0 0 8px rgba(255,210,63,.25); } }
.btn--rapid { background: var(--coral); color: #fff; box-shadow: 0 6px 0 var(--coral-d); }
.btn--practice { background: var(--mint); color: #fff; box-shadow: 0 6px 0 var(--mint-d); }
.btn--ghost { background: #efeaff; color: var(--ink); box-shadow: 0 5px 0 #c9bff5; }
.btn--warn { background: var(--coral); color: #fff; box-shadow: 0 5px 0 var(--coral-d); }
.btn--big { min-height: 66px; font-size: 1.4rem; padding: 14px 34px; border-radius: 22px; }
.btn--small { min-height: 42px; padding: 8px 14px; font-size: .95rem; border-radius: 14px; }

/* ---------- WORLDS ---------- */
.worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.world { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 18px 16px 16px; border: 0; border-radius: 24px; text-align: left;
  background: var(--paper); box-shadow: 0 8px 0 color-mix(in srgb, var(--wc) 70%, #000), var(--shadow-soft); border-top: 10px solid var(--wc);
  transition: transform .18s, box-shadow .18s; animation: screenIn .5s calc(var(--i, 0) * 40ms) both; }
.world:hover { transform: translateY(-6px) rotate(-1deg); }
.world:active { transform: translateY(4px); }
.world__ic { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 20px; font-size: 2.3rem; font-family: var(--emoji);
  background: color-mix(in srgb, var(--wc) 22%, #fff); margin-bottom: 6px; transition: transform .2s; }
.world:hover .world__ic { transform: scale(1.12) rotate(-8deg); }
.world__name { font-family: var(--display); font-size: 1.3rem; }
.world__blurb { color: var(--muted); font-size: .9rem; line-height: 1.3; }
.world__meta { margin-top: 8px; display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--ink-2); }
.world--all { background: linear-gradient(135deg, #fff7d1, #ffe6a3); }
.stars { display: inline-flex; gap: 2px; font-size: 1.15rem; letter-spacing: 1px; }
.stars i { font-style: normal; color: #d8d3ef; }
.stars i.on { color: #ffb703; text-shadow: 0 2px 0 #c77d00; }

/* ---------- INTRO + COUNTDOWN ---------- */
.introcard { max-width: 640px; margin: 4vh auto 0; background: var(--paper); border-radius: 32px; padding: 34px 28px 30px; text-align: center; box-shadow: 0 10px 0 rgba(0,0,0,.25), var(--shadow-soft);
  border-top: 14px solid var(--wc); position: relative; }
.introcard__badge { width: 96px; height: 96px; margin: -84px auto 10px; border-radius: 30px; display: grid; place-items: center; font-size: 3.2rem; font-family: var(--emoji);
  background: var(--wc); box-shadow: 0 8px 0 rgba(0,0,0,.2); animation: hop .8s cubic-bezier(.3,1.6,.5,1) both; }
.introcard h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.introcard__talk { display: flex; align-items: center; gap: 14px; margin: 18px 0; text-align: left; }
.intro-char { width: 120px; flex: none; }
.introcard__talk .speech { background: #f1edff; box-shadow: none; flex: 1; font-size: 1.05rem; }
.journey { list-style: none; padding: 0; margin: 0 0 22px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; font-family: var(--display); font-weight: 600; color: var(--ink-2); }
.journey li { background: #f1edff; padding: 6px 12px; border-radius: 999px; }
.journey li + li::before { content: "→ "; color: var(--muted); }
.countdown { text-align: center; color: #fff; padding-top: 6vh; }
.cd-char { width: 150px; margin: 0 auto; }
.countdown__ready { font-family: var(--display); font-size: 2rem; letter-spacing: 4px; color: var(--sun); margin-top: 8px; }
.countdown__num { font-family: var(--display); font-weight: 700; font-size: clamp(6rem, 22vw, 11rem); line-height: 1; text-shadow: 0 8px 0 var(--grape-d); margin: 10px 0; }
.countdown__num.pop { animation: cdpop .6s cubic-bezier(.3,1.6,.5,1); }
.countdown__num.go { color: var(--sun); animation: cdpop .6s; }
@keyframes cdpop { from { transform: scale(2.2); opacity: 0; } }

/* ---------- PLAY ---------- */
.mission { background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.15); border-radius: 20px; padding: 10px 14px; color: #fff; margin-bottom: 16px; }
.mission__top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-family: var(--display); font-weight: 600; margin-bottom: 8px; }
.mission__pct b { color: var(--sun); }
.mission__path { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; position: relative; }
.mission__path::before { content: ""; position: absolute; left: 14px; right: 14px; top: 50%; height: 6px; transform: translateY(-50%); background: rgba(255,255,255,.18); border-radius: 6px; }
.node { position: relative; flex: 1; max-width: 46px; aspect-ratio: 1; min-width: 18px; display: grid; place-items: center; border-radius: 50%; background: #3b3384; color: #b9b2ee;
  font-family: var(--display); font-size: .78rem; border: 3px solid rgba(255,255,255,.2); transition: transform .3s; }
.node.start, .node.end { background: transparent; border: 0; font-size: 1.3rem; font-family: var(--emoji); max-width: 34px; }
.node.ok { background: var(--mint); color: #fff; border-color: #fff; }
.node.no { background: #8a83c9; color: #fff; border-color: rgba(255,255,255,.6); }
.node.now { background: var(--sun); color: var(--ink); border-color: #fff; transform: scale(1.25); box-shadow: 0 0 0 6px rgba(255,210,63,.3); animation: pulse 1.4s infinite; }
.mission--run { display: flex; justify-content: space-between; font-family: var(--display); font-size: 1.2rem; }
.mission--run b { color: var(--sun); font-size: 1.5rem; }

.play { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: start; }
.host { position: sticky; top: 84px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.host__char { width: 170px; }
.host__bubble { font-size: .98rem; text-align: center; }
.host__bubble::before { content: ""; position: absolute; left: 50%; top: -18px; transform: translateX(-50%); border: 10px solid transparent; border-bottom-color: #fff; }

.qcard { position: relative; background: var(--paper); border-radius: 30px; padding: 18px clamp(16px, 3vw, 28px) 20px; box-shadow: 0 10px 0 color-mix(in srgb, var(--wc) 55%, #120f3a), var(--shadow-soft);
  border-top: 12px solid var(--wc); animation: cardIn .5s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes cardIn { from { opacity: 0; transform: translateX(40px) rotate(2deg); } }
.qcard.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.qcard__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.fmt { font-family: var(--display); font-weight: 700; font-size: .95rem; letter-spacing: 1.2px; background: var(--ink); color: #fff; padding: 6px 12px; border-radius: 10px; transform: rotate(-2deg); }
.chip { font-weight: 800; font-size: .82rem; padding: 5px 10px; border-radius: 999px; background: color-mix(in srgb, var(--wc) 18%, #fff); color: var(--ink); }
.chip--diff.diff--easy { background: #dcfbe9; } .chip--diff.diff--medium { background: #fff3c4; } .chip--diff.diff--hard { background: #ffe0e3; }
.qnum { margin-left: auto; font-family: var(--display); font-weight: 700; color: var(--muted); font-size: 1rem; }
.qcard__body { display: flex; align-items: center; gap: 18px; }
.qpic { flex: none; width: 108px; height: 108px; border-radius: 30px; display: grid; place-items: center; background: color-mix(in srgb, var(--wc) 20%, #fff);
  border: 3px dashed color-mix(in srgb, var(--wc) 55%, #fff); transform: rotate(-4deg); }
.qpic span { font-size: 3.8rem; font-family: var(--emoji); animation: bob 3s ease-in-out infinite; display: block; }
.qmain { flex: 1; min-width: 0; }
.qtext { font-size: clamp(1.35rem, 3.2vw, 1.95rem); line-height: 1.25; }
.qlead { display: block; font-family: var(--body); font-size: .9rem; color: var(--muted); font-weight: 800; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 4px; }
.blank { display: inline-block; min-width: 3.2em; margin: 0 .2em; padding: 0 .35em; border-bottom: 5px dashed var(--grape); color: var(--grape); text-align: center; border-radius: 8px; transition: all .2s; }
.blank.filled { background: #efeaff; border-bottom-style: solid; animation: pop .3s; }
.blank.is-correct { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.clues { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.clues li { background: #fff; border: 3px solid color-mix(in srgb, var(--wc) 35%, #fff); border-radius: 16px; padding: 9px 14px; font-size: 1.05rem; animation: clueIn .5s var(--d) both; }
.clues b { display: inline-block; font-family: var(--display); background: var(--wc); color: #fff; border-radius: 8px; padding: 1px 8px; margin-right: 6px; font-size: .85rem; }
@keyframes clueIn { from { opacity: 0; transform: translateY(10px) scale(.95); } }

/* Answer options */
.answers { margin-top: 18px; display: grid; gap: 12px; }
.answers--list.four { grid-template-columns: 1fr 1fr; }
.opt { position: relative; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 16px; border-radius: 18px; text-align: left;
  background: #fff; border: 3px solid #e3ddff; box-shadow: 0 5px 0 #d8d0fb; font-size: 1.15rem; font-weight: 800; color: var(--ink);
  transition: transform .12s, box-shadow .12s, border-color .15s, background .15s; animation: optIn .4s calc(var(--k, 0) * 60ms) both; }
.answers .opt:nth-child(2) { --k: 1; } .answers .opt:nth-child(3) { --k: 2; } .answers .opt:nth-child(4) { --k: 3; }
@keyframes optIn { from { opacity: 0; transform: translateY(12px); } }
.opt:hover:not(:disabled) { border-color: var(--grape); transform: translateY(-2px); }
.opt:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #d8d0fb; }
.opt__key { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #efeaff; color: var(--grape-d); font-family: var(--display); font-size: 1.15rem; }
.opt__ic { font-family: var(--emoji); font-size: 1.6rem; }
.opt__txt { flex: 1; }
.opt__mark { flex: none; font-size: 1.5rem; font-weight: 800; }
.opt.sel { border-color: var(--grape); background: #f3efff; box-shadow: 0 5px 0 var(--grape); transform: translateY(-2px); }
.opt.sel .opt__key { background: var(--grape); color: #fff; }
.opt.is-correct { border-color: var(--good); background: var(--good-bg); box-shadow: 0 5px 0 var(--good); animation: correctPop .5s; opacity: 1; }
.opt.is-correct .opt__key { background: var(--good); color: #fff; }
.opt.is-correct .opt__mark { color: var(--good); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 5px 0 var(--bad); }
.opt.is-wrong .opt__key { background: var(--bad); color: #fff; }
.opt.is-wrong .opt__mark { color: var(--bad); }
.opt.dim { opacity: .5; }
.opt.gone { opacity: .35; text-decoration: line-through; filter: grayscale(1); }
.opt.gone.is-wrong { opacity: .6; filter: none; }
@keyframes correctPop { 40% { transform: scale(1.04); } }
.answers--tf { grid-template-columns: 1fr 1fr; }
.opt--tf { flex-direction: column; justify-content: center; gap: 4px; min-height: 120px; text-align: center; font-family: var(--display); font-size: 1.5rem; letter-spacing: 2px; }
.opt--tf .opt__big { font-size: 2.6rem; line-height: 1; }
.opt--true .opt__big { color: var(--good); } .opt--false .opt__big { color: var(--coral); }
.opt--tf .opt__mark { position: absolute; top: 10px; right: 14px; }
.answers--odd { grid-template-columns: repeat(4, 1fr); }
.opt--tile { flex-direction: column; justify-content: center; text-align: center; gap: 6px; min-height: 150px; padding: 14px 8px; }
.opt--tile .opt__key { position: absolute; top: 8px; left: 8px; width: 32px; height: 32px; font-size: .95rem; }
.opt--tile .opt__pic { font-family: var(--emoji); font-size: 3.2rem; line-height: 1; transition: transform .2s; }
.opt--tile:hover .opt__pic { transform: scale(1.15) rotate(-6deg); }
.opt--tile .opt__txt { flex: none; font-size: 1.05rem; }
.opt--tile .opt__mark { position: absolute; top: 8px; right: 10px; }
.answers--words { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.opt--word { min-width: 160px; justify-content: center; font-family: var(--display); font-size: 1.3rem; border-radius: 999px; padding-inline: 14px 22px; }
.opt--word .opt__txt { flex: none; }

/* Word jumble */
.jumble { margin-top: 20px; display: grid; gap: 18px; justify-items: center; }
.slots { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 58px)); justify-content: center; gap: 6px; width: 100%; }
.slot { width: 100%; height: clamp(46px, 8vw, 66px); border-radius: 14px; border: 3px dashed #c9bff5; background: #fff; font-family: var(--display); font-size: clamp(1.4rem, 3.5vw, 2rem); color: var(--ink); padding: 0; }
.slot { display: grid; place-items: center; }
.slot.given { border-style: solid; border-color: var(--ink); background: var(--ink); color: #fff; box-shadow: 0 4px 0 rgba(18,15,58,.35); }
.slot.full { border-style: solid; border-color: var(--grape); background: #f3efff; box-shadow: 0 4px 0 var(--grape); animation: pop .25s; }
.slot.fixed { border-color: var(--orange); background: #fff3dd; box-shadow: 0 4px 0 var(--orange); }
.slot.is-correct { border-color: var(--good); background: var(--good-bg); box-shadow: 0 4px 0 var(--good); color: var(--good); }
.slot.shown { border-color: var(--orange); background: #fff3dd; box-shadow: 0 4px 0 var(--orange); }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tile { width: clamp(50px, 8vw, 64px); height: clamp(50px, 8vw, 64px); border-radius: 16px; border: 0; background: linear-gradient(180deg, #ffe066, #ffc52e); box-shadow: 0 6px 0 var(--sun-d);
  font-family: var(--display); font-size: clamp(1.5rem, 3.8vw, 2.1rem); color: var(--ink); transition: transform .12s; }
.tile:nth-child(odd) { transform: rotate(-4deg); } .tile:nth-child(even) { transform: rotate(3deg); }
.tile:hover:not(:disabled) { transform: translateY(-4px) rotate(0); }
.tile:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--sun-d); }
.tile:disabled { background: #eee9fb; box-shadow: inset 0 3px 0 rgba(0,0,0,.06); transform: none; }
.jumble__tools { display: flex; gap: 10px; }

/* Match up */
.match { margin-top: 18px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.match__col { display: grid; gap: 10px; }
.match__mid { font-size: 1.8rem; font-family: var(--emoji); opacity: .5; }
.mitem { position: relative; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 12px; border-radius: 16px; border: 3px solid #e3ddff; background: #fff;
  box-shadow: 0 4px 0 #d8d0fb; font-weight: 800; font-size: 1.02rem; text-align: left; line-height: 1.25; transition: transform .12s, border-color .15s; }
.mitem:hover:not(:disabled) { border-color: var(--grape); transform: translateY(-2px); }
.mitem .mtxt { flex: 1; }
.mnum { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #efeaff; font-family: var(--display); color: #fff; font-size: .95rem; }
.mitem.sel { border-color: var(--lc); background: color-mix(in srgb, var(--lc) 12%, #fff); box-shadow: 0 4px 0 var(--lc); transform: translateY(-2px); }
.mitem.sel .mnum, .mitem.linked .mnum { background: var(--lc); }
.mitem.linked { border-color: var(--lc); background: color-mix(in srgb, var(--lc) 10%, #fff); box-shadow: 0 4px 0 var(--lc); }
.mitem.fixed { border-style: dashed; }
.mitem.is-correct { border-color: var(--good); background: var(--good-bg); box-shadow: 0 4px 0 var(--good); }
.mitem.is-wrong { border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 4px 0 var(--bad); }
.mitem.is-correct .opt__mark { color: var(--good); } .mitem.is-wrong .opt__mark { color: var(--bad); }

/* Out of order */
.order { margin-top: 18px; display: grid; gap: 14px; }
.order__ends { display: flex; justify-content: space-between; font-family: var(--display); font-weight: 600; color: var(--muted); font-size: .95rem; }
.order__slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 10px; }
.oslot { position: relative; width: 100%; min-height: 76px; border-radius: 16px; border: 3px dashed #c9bff5; background: #fff; padding: 22px 6px 8px; font-weight: 800; font-size: 1rem; line-height: 1.2; }
.oslot i { position: absolute; top: 4px; left: 8px; font-style: normal; font-family: var(--display); color: var(--muted); font-size: .85rem; }
.oslot.full { border-style: solid; border-color: var(--grape); background: #f3efff; box-shadow: 0 4px 0 var(--grape); animation: pop .25s; }
.oslot.fixed { border-color: var(--orange); background: #fff3dd; box-shadow: 0 4px 0 var(--orange); }
.oslot.is-correct { border-color: var(--good); background: var(--good-bg); box-shadow: 0 4px 0 var(--good); }
.oslot.is-wrong { border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 4px 0 var(--bad); }
.oslot .opt__mark { position: absolute; top: 2px; right: 8px; font-size: 1.1rem; }
.oslot.is-correct .opt__mark { color: var(--good); } .oslot.is-wrong .opt__mark { color: var(--bad); }
.order__pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 56px; align-items: center; }
.oitem { border: 0; border-radius: 999px; padding: 12px 20px; background: linear-gradient(180deg, #ffe066, #ffc52e); box-shadow: 0 5px 0 var(--sun-d); font-family: var(--display); font-weight: 600; font-size: 1.1rem; transition: transform .12s; }
.oitem:hover { transform: translateY(-3px); }
.oitem:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--sun-d); }

/* Clue box + footer */
.cluebox { margin-top: 16px; background: #fff8d6; border: 3px solid #ffe08a; border-radius: 16px; padding: 10px 14px; display: grid; gap: 6px; animation: pop .35s; }
.qcredit { margin-top: 10px; font-size: .78rem; color: var(--muted); }
.qcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.qcard__foot > .btn { margin-left: auto; }
.lifelines { display: flex; gap: 8px; flex-wrap: wrap; }
.life { position: relative; display: flex; align-items: center; gap: 6px; padding: 8px 12px 8px 10px; min-height: 48px; border-radius: 14px; border: 2px solid #e3ddff; background: #fff;
  box-shadow: 0 4px 0 #ddd5fb; font-weight: 800; font-size: .9rem; transition: transform .12s; }
.life span { font-family: var(--emoji); font-size: 1.25rem; }
.life i { font-style: normal; font-family: var(--display); background: var(--grape); color: #fff; border-radius: 999px; min-width: 24px; padding: 0 6px; font-size: .85rem; line-height: 22px; text-align: center; }
.life:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--grape); }
.life:disabled { opacity: .45; }
.life.armed { opacity: 1; border-color: var(--mint); background: #ddfaf2; box-shadow: 0 4px 0 var(--mint); }
.life.armed::after { content: "ON"; position: absolute; top: -9px; right: -6px; background: var(--mint); color: #fff; font-size: .7rem; padding: 1px 6px; border-radius: 999px; }

/* Timer */
.timer { position: absolute; top: -26px; right: 18px; width: 70px; height: 70px; display: grid; place-items: center; background: #fff; border-radius: 50%; box-shadow: 0 5px 0 rgba(0,0,0,.2); z-index: 2; }
.timer svg { position: absolute; inset: 5px; width: calc(100% - 10px); height: calc(100% - 10px); transform: rotate(-90deg); }
.timer__bg { fill: none; stroke: #eee9fb; stroke-width: 5; }
.timer__fg { fill: none; stroke: var(--mint); stroke-width: 5; stroke-linecap: round; transition: stroke .3s; }
.timer b { font-family: var(--display); font-size: 1.6rem; position: relative; }
.timer.hurry .timer__fg { stroke: var(--orange); }
.timer.hurry { animation: pulse .5s infinite; }
.timer.done .timer__fg { stroke: var(--coral); }
body.hurry .qcard { box-shadow: 0 10px 0 color-mix(in srgb, var(--wc) 55%, #120f3a), 0 0 0 6px rgba(255,159,28,.45), var(--shadow-soft); }
.play[data-type] .qcard:has(.timer) .qcard__head { padding-right: 80px; }

/* Feedback panel */
.feedback { margin-top: 18px; }
.fb { display: grid; grid-template-columns: 110px 1fr; gap: 10px 16px; align-items: center; border-radius: 22px; padding: 16px; animation: fbIn .45s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes fbIn { from { opacity: 0; transform: translateY(20px) scale(.96); } }
.fb--ok { background: linear-gradient(135deg, #e3fcef, #c9f7e0); border: 3px solid #8be3b6; }
.fb--no { background: linear-gradient(135deg, #fff3dc, #ffe6bf); border: 3px solid #ffd08a; }
.fb__char { width: 110px; grid-row: span 2; }
.fb__title { font-family: var(--display); font-weight: 700; font-size: clamp(1.4rem, 3.4vw, 2rem); }
.fb--ok .fb__title { color: #0f7a46; }
.fb--no .fb__title { color: #b45309; }
.fb__xp { font-family: var(--display); font-size: 1.35rem; color: #0f7a46; margin-top: 2px; }
.fb__xp small { font-family: var(--body); font-size: .85rem; color: #3f6f57; }
.fb__xp.small { font-size: 1rem; }
.fb__answer { font-size: 1.15rem; margin-top: 4px; }
.fb__partial { margin-top: 4px; color: #92400e; }
.fb__fact { margin-top: 8px; background: rgba(255,255,255,.7); border-radius: 14px; padding: 10px 12px; line-height: 1.45; font-weight: 700; }
.btn--next { grid-column: 1 / -1; justify-self: end; }
.fb--mini { grid-template-columns: 1fr auto; padding: 12px 18px; font-size: 1.15rem; }
.fb--mini b { font-family: var(--display); font-size: 1.3rem; }
.fb--mini .fb__xp { margin: 0; }
.fb--class { grid-template-columns: 1fr; }
.teacher { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.teamscore { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.teambtn { border: 0; border-radius: 16px; padding: 12px 16px; background: #fff; box-shadow: 0 5px 0 #c9bff5; font-family: var(--display); font-weight: 600; font-size: 1.15rem; }
.teambtn b { display: inline-block; min-width: 32px; margin-left: 6px; background: var(--grape); color: #fff; border-radius: 999px; padding: 0 8px; }
.teambtn.bump { animation: bump .5s; }

/* Floating XP text */
.floaty { position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 700; font-size: 2.4rem;
  color: var(--sun); text-shadow: 0 4px 0 var(--ink), 0 0 20px rgba(255,210,63,.6); animation: floatUp 1.4s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -220%) scale(1); } }

/* ---------- RESULTS ---------- */
.results { max-width: 820px; margin: 0 auto; }
.results__hero { text-align: center; color: #fff; }
.trophy { width: 150px; height: 150px; display: block; margin: 0 auto -6px; filter: drop-shadow(0 10px 20px rgba(255,183,3,.45)); animation: hop 1s cubic-bezier(.3,1.6,.5,1) both; }
.results h1 { font-size: clamp(2rem, 6vw, 3.2rem); text-shadow: 0 5px 0 var(--grape-d); }
.results__lead { font-size: 1.3rem; margin-top: 8px; color: #e7e3ff; }
.results__lead b { color: var(--sun); }
.rank { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; background: var(--sun); color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 1.5rem; padding: 8px 22px; border-radius: 999px;
  box-shadow: 0 6px 0 var(--sun-d); transform: rotate(-2deg); animation: pop .6s .4s both; }
.results__msg { margin-top: 12px; color: #e7e3ff; font-size: 1.1rem; }
.results__stars { margin-top: 12px; display: grid; justify-items: center; color: #d9d4ff; }
.results__stars .stars { font-size: 2.4rem; gap: 6px; }
.results__stars .stars i { color: rgba(255,255,255,.25); }
.results__stars .stars i.on { color: #ffd23f; animation: pop .5s both; }
.results__stars .stars i:nth-child(2) { animation-delay: .2s; } .results__stars .stars i:nth-child(3) { animation-delay: .4s; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 20px; }
.stat { background: var(--paper); border-radius: 20px; padding: 14px 10px; text-align: center; box-shadow: var(--shadow); }
.stat span { font-size: 1.8rem; font-family: var(--emoji); }
.stat b { display: block; font-family: var(--display); font-size: 1.7rem; margin-top: 2px; }
.stat small { color: var(--muted); }
.results .levelbar { margin-top: 18px; }
.newach { margin-top: 18px; background: rgba(255,210,63,.15); border: 2px solid var(--sun); border-radius: 20px; padding: 14px; color: #fff; text-align: center; }
.newach h2 { font-size: 1.3rem; color: var(--sun); }
.newach ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.newach li { background: #fff; color: var(--ink); border-radius: 999px; padding: 6px 14px; display: flex; gap: 6px; align-items: center; }
.results__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
.review { margin-top: 24px; background: var(--paper); border-radius: 22px; padding: 6px 16px; box-shadow: var(--shadow); }
.review summary { font-family: var(--display); font-weight: 700; font-size: 1.2rem; padding: 10px 0; cursor: pointer; }
.review ol { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.review li { display: flex; gap: 10px; padding: 10px; border-radius: 14px; background: #fff; border-left: 6px solid var(--good); }
.review li.no { border-left-color: var(--orange); }
.review__mark { font-family: var(--display); font-size: 1.3rem; width: 26px; flex: none; color: var(--good); }
.review li.no .review__mark { color: var(--orange); }
.review small { display: block; color: var(--muted); margin-top: 2px; }
.podium { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.podium li { display: flex; align-items: center; gap: 14px; background: var(--paper); border-radius: 20px; padding: 14px 20px; box-shadow: var(--shadow); font-size: 1.4rem; }
.podium li span { font-size: 2rem; font-family: var(--emoji); }
.podium li b { font-family: var(--display); flex: 1; }
.podium li em { font-style: normal; font-family: var(--display); background: var(--grape); color: #fff; border-radius: 999px; padding: 4px 14px; }
.podium li.win { background: linear-gradient(135deg, #fff7d1, #ffe08a); transform: scale(1.03); }

/* ---------- ACHIEVEMENTS ---------- */
.sub { color: #fff; font-size: 1.4rem; margin: 26px 0 12px; }
.levels { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.levels li { background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.15); color: #cfc8ff; border-radius: 18px; padding: 12px; text-align: center; }
.levels li span { font-size: 1.9rem; font-family: var(--emoji); display: block; filter: grayscale(1); opacity: .6; }
.levels li b { display: block; font-family: var(--display); }
.levels li.on { background: #fff; color: var(--ink); }
.levels li.on span { filter: none; opacity: 1; }
.badges { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.badge { background: rgba(255,255,255,.08); border: 2px dashed rgba(255,255,255,.25); color: #b9b3ea; border-radius: 20px; padding: 16px; text-align: center; }
.badge__ic { display: grid; place-items: center; width: 70px; height: 70px; margin: 0 auto 8px; border-radius: 50%; background: rgba(255,255,255,.1); font-size: 2.2rem; font-family: var(--emoji); }
.badge b { display: block; font-family: var(--display); font-size: 1.1rem; }
.badge small { display: block; margin-top: 4px; line-height: 1.35; }
.badge.on { background: var(--paper); border: 0; color: var(--ink); box-shadow: var(--shadow); }
.badge.on .badge__ic { background: radial-gradient(circle, #fff6c2, #ffd23f); box-shadow: 0 5px 0 var(--sun-d); }
.badge.on small { color: var(--muted); }

/* ---------- CLASSROOM SETUP ---------- */
.setup { max-width: 640px; margin: 0 auto; background: var(--paper); border-radius: 28px; padding: 26px; display: grid; gap: 18px; box-shadow: var(--shadow), var(--shadow-soft); }
.field { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; }
.field > span, .field legend { font-family: var(--display); font-weight: 600; font-size: 1.15rem; padding: 0; margin-bottom: 8px; }
.field select { font: inherit; font-weight: 800; padding: 14px; border-radius: 14px; border: 3px solid #e3ddff; background: #fff; color: var(--ink); min-height: 54px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; padding: 12px 18px; border-radius: 14px; border: 3px solid #e3ddff; background: #fff; font-weight: 800; cursor: pointer; min-width: 64px; text-align: center; }
.seg input:checked + span { border-color: var(--grape); background: var(--grape); color: #fff; box-shadow: 0 4px 0 var(--grape-d); }
.seg input:focus-visible + span { outline: 4px solid var(--sun); outline-offset: 2px; }

/* Classroom game — big type for smart boards */
body.classroom-on { --scale: 1.2; }
.play--class { grid-template-columns: 170px 1fr; }
.play--class .qtext { font-size: clamp(1.8rem, 3.6vw, 2.7rem); }
.play--class .opt { font-size: clamp(1.25rem, 2.2vw, 1.7rem); min-height: 80px; }
.play--class .opt__key { width: 50px; height: 50px; font-size: 1.4rem; }
.play--class .mitem, .play--class .oslot, .play--class .oitem { font-size: 1.3rem; }
.play--class .fb__fact { font-size: 1.2rem; }
.play--class .fb__answer { font-size: 1.5rem; }

/* ---------- TOASTS + MODAL ---------- */
.toasts { position: fixed; z-index: 70; right: 16px; top: 76px; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 12px; background: #fff; color: var(--ink); border-radius: 20px; padding: 12px 16px; box-shadow: 0 8px 0 rgba(0,0,0,.2), var(--shadow-soft);
  animation: toastIn .5s cubic-bezier(.2,1.4,.4,1) both; }
.toast.out { animation: toastOut .5s forwards; }
.toast b { display: block; font-family: var(--display); font-size: 1.15rem; }
.toast small { display: block; text-transform: uppercase; letter-spacing: 1px; font-size: .72rem; color: var(--grape-d); font-weight: 800; }
.toast span { display: block; color: var(--muted); font-size: .9rem; }
.toast__char { width: 64px; flex: none; }
.toast__char svg { width: 100%; height: auto; display: block; }
.toast--ach { border: 3px solid var(--sun); }
.toast--streak { background: linear-gradient(90deg, #ffb347, #ff5d73); color: #fff; }
.toast--streak b, .toast--streak span { color: #fff; display: inline; }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px); } }
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(10, 8, 40, .65); display: grid; place-items: center; padding: 16px; animation: fade .2s; backdrop-filter: blur(3px); }
@keyframes fade { from { opacity: 0; } }
.modal__box { width: min(520px, 100%); max-height: 90vh; overflow: auto; background: var(--paper); border-radius: 26px; padding: 24px; box-shadow: var(--shadow-soft); animation: pop .3s; }
.modal__box h2 { font-size: 1.6rem; margin-bottom: 10px; }
.modal__box h3 { font-size: 1.15rem; margin: 18px 0 8px; }
.modal__box p + p { margin-top: 8px; }
.modal__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 2px dashed #ece6ff; }
.toggle { min-width: 92px; min-height: 44px; border-radius: 999px; border: 0; font-weight: 800; background: #e9e5f7; box-shadow: inset 0 -3px 0 rgba(0,0,0,.08); }
.toggle[aria-pressed="true"] { background: var(--mint); color: #fff; }
.pause { text-align: center; }
.pause-char { width: 120px; margin: -10px auto 6px; }

/* ---------- Full-screen polish ---------- */
body.is-full .credits { display: none; }
body.is-full .topbar { background: transparent; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .menu { grid-template-columns: 1fr 1fr; }
  .mbtn--hero { grid-column: 1 / -1; min-height: 130px; }
  .mbtn--ach { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; gap: 14px; }
  .play { grid-template-columns: 1fr; }
  .host { position: static; flex-direction: row; justify-content: flex-start; }
  .host__char { width: 88px; flex: none; }
  .host__bubble { text-align: left; flex: 1; }
  .host__bubble::before { left: -18px; top: 50%; transform: translateY(-50%); border-color: transparent; border-right-color: #fff; }
  .play--class { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; text-align: center; min-height: 0; }
  .hero__cast { height: 230px; order: -1; margin-top: -6px; }
  .cast--hoot { width: 140px; top: 22px; }
  .cast--nova { width: 96px; left: 6%; } .cast--pip { width: 96px; right: 6%; } .cast--bolt { width: 70px; right: 20%; }
  .cast-ring { width: 220px; height: 220px; }
  .speech--hero { display: none; }
  .facts { justify-content: center; }
  .logo__b { transform: rotate(-2deg); }
  .brand__text small { display: none; }
  .tool { width: 42px; height: 42px; }
  .pill { padding: 6px 10px; font-size: .9rem; }
  .pill__xp { display: none; }
  .mbtn { min-height: 120px; padding: 14px; border-radius: 22px; }
  .mbtn__t { font-size: 1.15rem; }
  .mbtn__ic { font-size: 2.2rem; }
  .qcard { border-radius: 24px; padding: 14px 14px 16px; }
  .qcard__body { gap: 12px; }
  .qpic { width: 72px; height: 72px; border-radius: 20px; }
  .qpic span { font-size: 2.6rem; }
  .answers--odd { grid-template-columns: 1fr 1fr; }
  .answers--list.four { grid-template-columns: 1fr; }
  .opt { min-height: 58px; font-size: 1.05rem; }
  .opt--tile { min-height: 124px; }
  .match { grid-template-columns: 1fr 1fr; }
  .match__mid { display: none; }
  .mitem { font-size: .92rem; padding: 8px; min-height: 54px; }
  .order__slots { grid-template-columns: 1fr 1fr; }
  .fb { grid-template-columns: 1fr; position: relative; padding-top: 18px; }
  .fb__char { position: absolute; width: 64px; right: 10px; top: -34px; }
  .fb__title { padding-right: 60px; }
  body[data-screen="play"] .brand__text { display: none; }
  .qcard__foot { flex-direction: column; align-items: stretch; }
  .qcard__foot > .btn { margin-left: 0; width: 100%; }
  .lifelines { justify-content: space-between; }
  .life { flex: 1; justify-content: center; padding: 8px 6px; }
  .life b { display: none; }
  .btn--next { justify-self: stretch; }
  .screen__head .head-char { display: none; }
  .worlds { grid-template-columns: 1fr 1fr; gap: 12px; }
  .world { padding: 14px 12px; }
  .world__ic { width: 54px; height: 54px; font-size: 1.9rem; }
  .world__name { font-size: 1.1rem; }
  .world__blurb { display: none; }
  .world__meta { flex-direction: column; align-items: flex-start; gap: 2px; }
  .mission__path { gap: 2px; }
  .node { font-size: 0; border-width: 2px; }
  .node.ok, .node.now { font-size: .7rem; }
  .timer { width: 58px; height: 58px; top: -20px; right: 12px; }
  .introcard__talk { flex-direction: column; text-align: center; }
  .teacher { width: 100%; } .teacher .btn { flex: 1; }
}
@media (max-width: 380px) {
  .worlds { grid-template-columns: 1fr; }
  .menu { grid-template-columns: 1fr; }
}
/* Large classroom displays */
@media (min-width: 1600px) {
  :root { --stage-w: 1400px; }
  html { font-size: 19px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
html.calm *, html.calm *::before, html.calm *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

/* Effects canvas */
.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 65; }
