/* ==========================================================================
   LD Quest — design system (LIGHT theme)
   Desktop-first, playful & bright. Class 7 maths gamified learning.
   Readable body font (Nunito) + friendly display font (Baloo 2).
   ========================================================================== */

:root {
  --bg: #eef1fb;
  --bg-2: #f6f8ff;
  --panel: #ffffff;
  --panel-2: #eef1fb;
  --ink: #232a4d;
  --ink-soft: #4d5679;
  --ink-mute: #8b93b6;
  --line: #e3e7f4;
  --accent: #6C5CE7;
  --accent-2: #8a76ff;
  --gold: #E9A100;
  --gold-soft: #fff5db;
  --green: #06b487;
  --green-soft: #e2f8f1;
  --red: #e5537a;
  --red-soft: #fdeaf0;
  --shadow: 0 12px 30px rgba(80,90,160,.14);
  --shadow-sm: 0 4px 14px rgba(80,90,160,.10);
  --radius: 20px;
  --radius-sm: 14px;
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Baloo 2", "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 12% -8%, rgba(138,118,255,.20), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(6,180,135,.14), transparent 55%),
    radial-gradient(700px 500px at 50% 120%, rgba(233,161,0,.10), transparent 60%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand { font-family: var(--font-display); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

/* ---------- Top HUD ---------- */
.hud {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,.82);
  border-bottom: 1px solid var(--line);
}
.hud-inner { display: flex; align-items: center; gap: 22px; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 22px; letter-spacing: .2px; }
.brand .logo {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  display: grid; place-items: center; font-size: 24px; box-shadow: var(--shadow-sm);
}
.brand small { display: block; font-size: 12px; font-weight: 700; color: var(--ink-mute); letter-spacing: .3px; font-family: var(--font); }

.hud-stats { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.stat {
  display: flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  padding: 9px 16px; border-radius: 999px; font-weight: 800; font-size: 16px;
}
.stat .ic { font-size: 18px; }
.stat.gold { color: var(--gold); }
.stat.fire { color: #f2683a; }

.level-badge { display: flex; align-items: center; gap: 10px; }
.ring {
  --p: 0;
  width: 48px; height: 48px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), #e6e9f7 0);
  display: grid; place-items: center; position: relative;
}
.ring::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }
.ring span { position: relative; z-index: 1; font-weight: 800; font-size: 16px; color: var(--accent); }

/* ---------- Hero ---------- */
.hero { padding: 22px 0 6px; }
.hero h1 { font-size: 38px; margin: 0 0 6px; line-height: 1.05; color: var(--ink); }
.hero p { color: var(--ink-soft); font-size: 17px; margin: 0; max-width: 720px; line-height: 1.45; }
.hero .kicker {
  display: inline-block; font-size: 13px; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}

.overall {
  margin-top: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  border-radius: var(--radius); padding: 14px 22px; display: flex; align-items: center; gap: 22px;
}
.overall .bar { flex: 1; height: 14px; border-radius: 999px; background: #e9ecf8; overflow: hidden; }
.overall .bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width .6s ease; }
.overall .lbl { font-weight: 800; white-space: nowrap; font-size: 18px; }
.overall .lbl small { display: block; color: var(--ink-mute); font-weight: 700; font-size: 13px; }

/* ---------- Section titles ---------- */
.section-title { font-size: 28px; margin: 26px 0 8px; display: flex; align-items: center; gap: 10px; color: var(--ink); }
.map-hint { color: var(--ink-soft); font-weight: 700; margin: 0 0 10px; font-size: 15px; }

/* ================== GAME SCREEN (home) ================== */
.game-body { overflow: hidden; height: 100vh; }

.stage {
  position: fixed; inset: 0;
  background: linear-gradient(180deg, #bfe3fb 0%, #cdeafc 45%, #c3e6fa 100%);  /* ocean, blends with map */
}
.stage #map, .worldmap { position: absolute; inset: 0; }
.worldmap { border: none; border-radius: 0; box-shadow: none; overflow: hidden; background: transparent; }
.wm-svg {
  width: 100%; height: 100%; display: block;
  transition: transform .55s cubic-bezier(.5,0,.3,1), opacity .55s ease;
}
.worldmap.zooming .wm-svg { transform: scale(7); opacity: 0; }
.stage::after {   /* soft vignette for game depth */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 140px rgba(30,60,120,.18);
}

/* floating plates */
.plate {
  position: absolute; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  padding: 12px 18px; font-family: var(--font-display);
}
.brand-plate { top: 18px; left: 20px; display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 21px; }
.brand-plate .logo {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(135deg, var(--accent), var(--green)); box-shadow: var(--shadow-sm);
}
.brand-plate small { display: block; font-size: 12px; font-weight: 700; color: var(--ink-mute); font-family: var(--font); }

.stats-plate { top: 18px; right: 20px; display: flex; align-items: center; gap: 12px; }
.stats-plate .stat { box-shadow: none; border: 1px solid var(--line); background: var(--bg-2); }

.prog-plate { bottom: 22px; left: 20px; min-width: 270px; }
.prog-plate b { font-size: 18px; color: var(--ink); }
.prog-plate .prog-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.prog-plate .bar { flex: 1; height: 12px; border-radius: 999px; background: #e9ecf8; overflow: hidden; }
.prog-plate .bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width .6s ease; }
.prog-plate small { color: var(--ink-mute); font-weight: 700; font-family: var(--font); }

/* round game buttons */
.fab-col { position: absolute; right: 22px; bottom: 22px; z-index: 20; display: flex; flex-direction: column; gap: 14px; }
.fab {
  width: 68px; height: 68px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.94); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  font-size: 26px; font-family: var(--font-display); transition: transform .15s ease;
}
.fab span { font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.fab:hover { transform: translateY(-3px) scale(1.05); }

.hint-pill {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: rgba(35,42,77,.85); color: #fff; font-weight: 800; font-family: var(--font-display);
  padding: 10px 22px; border-radius: 999px; font-size: 15px; box-shadow: var(--shadow);
  animation: hintbob 2.2s ease-in-out infinite;
}
@keyframes hintbob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-4px); } }

/* badges popup */
.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(35,42,77,.45); backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }
.modal-card {
  position: relative; background: #fff; border-radius: 24px; box-shadow: var(--shadow);
  padding: 30px 34px; max-width: 720px; width: calc(100vw - 48px); max-height: 80vh; overflow: auto;
}
.modal-card h2 { margin: 0 0 18px; font-size: 26px; }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--line); font-size: 16px; font-weight: 800; color: var(--ink-soft); cursor: pointer;
}

/* recolor the open-source world map into a soft game palette */
.wm-land path { fill: #bfe0a0; stroke: #f2f9ea; stroke-width: 0.4; }
.wm-land #World, .wm-land #Ocean { fill: transparent; stroke: none; }
.wm-land text { display: none; }

.wm-node { cursor: pointer; transform-box: fill-box; transform-origin: center; transition: transform .16s ease; }
.wm-node:hover { transform: scale(1.09); }
.wm-node:focus { outline: none; }

.wm-pulse { transform-box: fill-box; transform-origin: center; animation: wmpulse 1.8s ease-out infinite; }
@keyframes wmpulse { 0% { transform: scale(.85); opacity: .8; } 70% { transform: scale(1.3); opacity: 0; } 100% { opacity: 0; } }

.wm-avatar { animation: wmbob 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
@keyframes wmbob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }

/* legacy grid map (unused, kept for fallback) */
.map { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
@media (min-width: 900px) { .map { grid-template-columns: repeat(4, 1fr); } }

.node {
  position: relative; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  border-radius: var(--radius); padding: 24px 22px; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: flex; flex-direction: column; gap: 14px; min-height: 210px;
}
.node::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 6px;
  background: var(--chip, var(--accent));
}
.node:not(.locked):hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--chip) 55%, var(--line)); }
.node.locked { opacity: .7; cursor: not-allowed; background: #f4f5fb; }
.node .num {
  position: absolute; top: 18px; right: 20px; font-size: 13px; font-weight: 800;
  color: var(--ink-mute); letter-spacing: 1px;
}
.node .ic {
  width: 70px; height: 70px; border-radius: 19px; display: grid; place-items: center;
  font-size: 40px; background: color-mix(in srgb, var(--chip) 16%, #fff);
  border: 1px solid color-mix(in srgb, var(--chip) 38%, transparent);
}
.node h3 { margin: 0; font-size: 22px; line-height: 1.18; color: var(--ink); }
.node .sub { color: var(--ink-soft); font-size: 15px; margin: -2px 0 0; font-weight: 600; }
.node .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.stars { display: flex; gap: 3px; font-size: 21px; color: #d7dbe8; }
.stars .s { opacity: 1; }
.stars .s.on { color: var(--gold); filter: drop-shadow(0 1px 3px rgba(233,161,0,.4)); }
.node .go { font-size: 15px; font-weight: 800; color: var(--accent); }
.node.locked .go { color: var(--ink-mute); }
.lockchip { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 800; color: var(--ink-mute); }

/* ---------- Badges strip ---------- */
.badges { display: flex; flex-wrap: wrap; gap: 14px; }
.badge {
  display: flex; align-items: center; gap: 12px; background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  border-radius: 16px; padding: 14px 16px; min-width: 210px;
}
.badge.locked { opacity: .5; background: #f4f5fb; box-shadow: none; }
.badge .b-ic { font-size: 30px; }
.badge b { display: block; font-size: 16px; }
.badge small { color: var(--ink-mute); font-size: 13px; font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 800; font-size: 17px; padding: 14px 24px; border-radius: 14px;
  box-shadow: 0 8px 20px rgba(108,92,231,.28); transition: transform .12s ease, filter .12s ease;
  font-family: var(--font-display);
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.btn.green { background: linear-gradient(135deg, #06b487, #17d29b); box-shadow: 0 8px 20px rgba(6,180,135,.28); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ================== CHAPTER PAGE (quest screen) ================== */
.chapter-body {
  background:
    radial-gradient(1000px 460px at 85% -10%, rgba(108,92,231,.10), transparent 60%),
    linear-gradient(180deg, #cfe9fb 0%, #e6f1fc 26%, #f1f4fd 60%, #f3f6fd 100%);
  background-attachment: fixed;
}

/* quest banner */
.quest-banner {
  position: relative; display: flex; align-items: center; gap: 22px;
  background: #fff; border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--shadow); padding: 26px 28px 22px; margin-top: 26px; overflow: hidden;
}
.quest-banner::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 7px;
  background: linear-gradient(90deg, var(--chip), color-mix(in srgb, var(--chip) 45%, #fff));
}
.quest-banner .q-ic {
  flex: none; width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center;
  font-size: 44px; background: color-mix(in srgb, var(--chip) 14%, #fff);
  border: 4px solid var(--chip); box-shadow: 0 6px 16px color-mix(in srgb, var(--chip) 35%, transparent);
}
.quest-banner .kick {
  display: inline-block; font-size: 13px; font-weight: 800; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--chip); font-family: var(--font-display);
}
.quest-banner h1 { margin: 2px 0 0; font-size: 34px; color: var(--ink); }
.quest-banner .sub { color: var(--ink-soft); margin: 4px 0 0; font-size: 17px; font-weight: 600; }
.map-fab {
  margin-left: auto; flex: none; width: 66px; height: 66px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 24px; transition: transform .15s ease; font-family: var(--font-display);
}
.map-fab span { font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.map-fab:hover { transform: translateY(-3px) scale(1.05); }

/* quest trail: the 4 stages as a game path */
.quest-steps { display: flex; margin: 26px 0 24px; }
.qstep {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 0;
}
.qstep::before {
  content: ""; position: absolute; top: 28px; right: 50%; width: 100%;
  border-top: 3.5px dashed #c9d2e8; z-index: 0;
}
.qstep:first-child::before { display: none; }
.qstep.done::before { border-color: color-mix(in srgb, var(--green) 55%, #fff); }
.qstep .bub {
  position: relative; z-index: 1; width: 58px; height: 58px; border-radius: 50%;
  background: #fff; border: 3.5px solid #d4dbee; display: grid; place-items: center;
  font-size: 25px; box-shadow: var(--shadow-sm); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.qstep:hover .bub { transform: scale(1.1); }
.qstep.done .bub { border-color: var(--green); }
.qstep.done .bub::after {
  content: "✓"; position: absolute; top: -5px; right: -5px; width: 21px; height: 21px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 12px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid #fff;
}
.qstep.active .bub {
  border-color: var(--chip);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--chip) 22%, transparent), var(--shadow-sm);
  transform: scale(1.06);
}
.qstep b { font-family: var(--font-display); font-size: 17px; color: var(--ink-mute); }
.qstep.active b { color: var(--ink); }
.qstep .meta { font-size: 13px; font-weight: 800; color: var(--ink-mute); }
.qstep .meta:has(+ *) {}
@media (max-width: 620px) {
  .quest-banner { flex-wrap: wrap; }
  .quest-banner h1 { font-size: 26px; }
  .qstep b { font-size: 14px; }
}

/* ---------- Chapter page ---------- */
.chapter-head { padding: 36px 0 10px; display: flex; align-items: center; gap: 22px; }
.chapter-head .ic {
  width: 90px; height: 90px; border-radius: 24px; display: grid; place-items: center; font-size: 50px;
  background: color-mix(in srgb, var(--chip) 16%, #fff);
  border: 1px solid color-mix(in srgb, var(--chip) 38%, transparent);
}
.chapter-head h1 { margin: 0; font-size: 40px; color: var(--ink); }
.chapter-head .sub { color: var(--ink-soft); margin: 6px 0 0; font-size: 19px; font-weight: 600; }
.bigidea {
  background: color-mix(in srgb, var(--chip) 8%, #fff); border: 1px solid var(--line);
  border-left: 6px solid var(--chip, var(--accent));
  border-radius: var(--radius-sm); padding: 18px 24px; margin: 22px 0 6px; color: var(--ink-soft);
  font-size: 18px; line-height: 1.6;
}
.bigidea b { color: var(--ink); }

/* tabs */
.tabs { display: flex; gap: 10px; margin: 28px 0 24px; flex-wrap: wrap; }
.tab {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-soft); box-shadow: var(--shadow-sm);
  padding: 12px 20px; border-radius: 13px; font-weight: 800; font-size: 17px;
  display: flex; align-items: center; gap: 8px; font-family: var(--font-display);
}
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(108,92,231,.28); }

/* content cards */
.cards { display: grid; gap: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 26px; box-shadow: var(--shadow-sm);
}
.card h3 { margin: 0 0 10px; font-size: 24px; color: var(--ink); }
.card p { margin: 0; color: var(--ink-soft); line-height: 1.65; font-size: 18.5px; font-weight: 600; }
.card .eg {
  margin-top: 16px; background: var(--gold-soft); border: 1px solid #f3dfa3; border-radius: 12px;
  padding: 14px 18px; font-weight: 800; color: #a9720a; font-size: 17px;
}
.card b, .card strong { color: var(--ink); font-weight: 800; }

/* concept card leading number bubble */
.card.concept { display: flex; gap: 18px; align-items: flex-start; }
.card .c-num {
  flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 22px; color: #fff;
  background: linear-gradient(135deg, var(--chip, var(--accent)), color-mix(in srgb, var(--chip) 60%, #fff));
  box-shadow: 0 5px 14px color-mix(in srgb, var(--chip) 40%, transparent);
}
.card .c-body { flex: 1; }
.card .c-body h3 { margin-top: 2px; }

/* visual formula ladder (shortcuts & examples) */
.formula { margin: 14px 0 4px; display: flex; flex-direction: column; gap: 12px; }
.fblock {
  background: linear-gradient(135deg, #f4f1ff, #eafaf5); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 20px;
}
.frow {
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--font-display); font-size: 23px; font-weight: 800; color: var(--ink);
  line-height: 1.45; font-variant-numeric: tabular-nums; letter-spacing: .5px;
}
.frow .rail {
  flex: none; width: 22px; text-align: center; color: var(--green); font-weight: 800;
}
.frow .rail.arrow { color: var(--gold); }
.frow .expr { flex: 1; }
.frow .expr .op { color: var(--accent); padding: 0 4px; font-weight: 800; }

/* inline SVG diagrams for visual learners */
.viz {
  margin: 16px 0 4px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.viz svg { width: 100%; max-width: 480px; height: auto; }
.viz-cap { font-size: 14px; color: var(--ink-mute); font-weight: 700; text-align: center; }

/* shortcut cards */
.shortcut { display: flex; gap: 18px; align-items: flex-start; }
.shortcut .pw {
  flex: none; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  font-size: 26px; background: linear-gradient(135deg, #ffcf4d, #f5a623); color: #6b4800;
  box-shadow: 0 6px 16px rgba(245,166,35,.32);
}

/* example stepper */
.steps { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  position: relative; padding: 9px 0 9px 44px; color: var(--ink-soft); line-height: 1.55; font-size: 18px;
  border-left: 2px solid var(--line); margin-left: 15px; font-weight: 600;
}
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: -16px; top: 6px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 15px; font-weight: 800;
}
.answer { margin-top: 16px; font-weight: 800; color: var(--green); font-size: 19px; }

/* ---------- Quiz ---------- */
.quiz-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 18px; font-weight: 800; }
.quiz-progress { flex: 1; height: 12px; border-radius: 999px; background: #e9ecf8; margin: 0 18px; overflow: hidden; }
.quiz-progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width .3s ease; }
.q-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; box-shadow: var(--shadow-sm); }
.q-type { font-size: 13px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.q-text { font-size: 30px; font-weight: 800; margin: 12px 0 26px; line-height: 1.3; color: var(--ink); font-family: var(--font-display); }
.options { display: grid; gap: 14px; }
.opt {
  text-align: left; background: var(--bg-2); border: 2px solid var(--line); color: var(--ink);
  padding: 18px 20px; border-radius: 14px; font-size: 19px; font-weight: 700; transition: all .12s ease;
  display: flex; align-items: center; gap: 14px;
}
.opt .k { width: 34px; height: 34px; border-radius: 9px; background: #e8ebf7; display: grid; place-items: center; font-weight: 800; font-size: 16px; flex: none; }
.opt:hover:not(:disabled) { border-color: var(--accent); transform: translateX(2px); background: #fff; }
.opt.correct { border-color: var(--green); background: var(--green-soft); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt.correct .k { background: var(--green); color: #fff; }
.opt.wrong .k { background: var(--red); color: #fff; }

.fill-in { display: flex; gap: 12px; }
.fill-in input {
  flex: 1; background: var(--bg-2); border: 2px solid var(--line); border-radius: 14px;
  padding: 16px 20px; color: var(--ink); font-size: 20px; font-family: inherit; font-weight: 800;
}
.fill-in input:focus { outline: none; border-color: var(--accent); background: #fff; }

.tf-row { display: flex; gap: 14px; }
.tf-row .opt { flex: 1; justify-content: center; font-size: 20px; font-weight: 800; }

.feedback { margin-top: 20px; padding: 16px 20px; border-radius: 12px; font-weight: 800; display: none; font-size: 18px; }
.feedback.show { display: block; }
.feedback.ok { background: var(--green-soft); color: #058968; border: 1px solid #9fe6d1; }
.feedback.no { background: var(--red-soft); color: #c33a63; border: 1px solid #f2b6ca; }
.feedback small { display: block; color: var(--ink-soft); font-weight: 600; margin-top: 6px; font-size: 16px; }

.quiz-actions { display: flex; justify-content: flex-end; margin-top: 24px; }

/* result screen */
.result { text-align: center; padding: 42px 20px; }
.result .big { font-size: 72px; margin-bottom: 6px; }
.result h2 { font-size: 32px; margin: 0 0 8px; color: var(--ink); }
.result p { color: var(--ink-soft); margin: 0 0 8px; font-size: 19px; }
.result .stars-big { font-size: 50px; margin: 12px 0 20px; color: #d7dbe8; }
.result .stars-big .s.on { color: var(--gold); filter: drop-shadow(0 2px 6px rgba(233,161,0,.5)); }
.result .rewards { display: flex; gap: 14px; justify-content: center; margin: 20px 0 28px; }
.result .rw { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: 14px; padding: 16px 24px; font-weight: 800; font-size: 22px; }
.result .rw small { display: block; color: var(--ink-mute); font-weight: 700; font-size: 13px; }
.result .actions { display: flex; gap: 12px; justify-content: center; }

/* toast */
.toast-wrap { position: fixed; top: 84px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--panel); border: 1px solid var(--accent); border-radius: 14px; padding: 15px 20px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; min-width: 250px;
  animation: slidein .3s ease, fadeout .4s ease 3.2s forwards;
}
.toast .t-ic { font-size: 30px; }
.toast b { display: block; font-size: 15px; }
.toast small { color: var(--ink-mute); font-size: 13px; font-weight: 600; }
@keyframes slidein { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeout { to { transform: translateX(120%); opacity: 0; } }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; width: 11px; height: 15px; top: -20px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-weight: 800; margin-top: 26px; font-size: 17px; }
.back-link:hover { color: var(--accent); }

.footer { text-align: center; color: var(--ink-mute); font-size: 14px; font-weight: 600; padding: 52px 0 32px; }

/* small screens graceful */
@media (max-width: 620px) {
  .hero h1 { font-size: 36px; }
  .hud-stats .stat span.txt { display: none; }
  .q-text { font-size: 23px; }
  .chapter-head .ic { width: 68px; height: 68px; font-size: 38px; }
  .chapter-head h1 { font-size: 30px; }
}
