/* ============================================================
   Geography Quest — theme
   Deep "night atlas" blues with compass-gold accents. Mobile-first.
   ============================================================ */
:root {
  /* deep ocean-and-atlas blues — an explorer's map table at night */
  --bg: #0c1a26;
  --bg-2: #102232;
  --panel: #14293c;
  --panel-2: #1a3450;
  --line: #26496a;
  --ink: #e9f2f8;
  --ink-dim: #b9cfde;
  --muted: #7d9db4;
  --gold: #ffc857;
  --gold-soft: #ffd97a;
  --good: #6cc06f;
  --bad: #e07856;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --serif: "Trebuchet MS", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 760px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 800px at 50% -10%, #16324a 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
/* fine paper grain — a little tactile warmth so it doesn't read as a flat template */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: .1px; line-height: 1.18; }
/* headings get programmatically focused on navigation for screen readers — no visible ring */
[tabindex="-1"]:focus { outline: none; }
::selection { background: var(--gold); color: #12202e; }

/* ---- App bar ------------------------------------------------ */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: rgba(12,26,38,.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; background: none; border: 0; color: var(--ink); padding: 4px; }
.brand-glyph {
  font-family: var(--serif); font-size: 26px; line-height: 1;
  color: var(--gold); text-shadow: 0 0 18px rgba(255,200,87,.5);
}
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 17px; }
.appbar-stats { display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--panel); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 999px; font-size: 14px; color: var(--ink-dim);
}
.chip b { color: var(--ink); }
.level-chip { flex-direction: column; align-items: stretch; gap: 3px; padding: 5px 10px; }
.lvl { font-size: 12px; color: var(--gold-soft); font-weight: 700; text-align: center; }
.lvl-bar { width: 54px; height: 4px; background: #081420; border-radius: 3px; overflow: hidden; }
.lvl-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); }

/* ---- Layout ------------------------------------------------- */
.screen {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px calc(40px + env(safe-area-inset-bottom));
  animation: fade .28s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Home --------------------------------------------------- */
.home-hero {
  text-align: center;
  padding: 14px 8px 6px;
}
.home-title {
  font-size: clamp(30px, 8vw, 46px);
  margin: 6px 0 4px; color: var(--ink);
  letter-spacing: .2px; font-weight: 800;
}
.home-title::after {
  content: ""; display: block; width: 42px; height: 2px; margin: 13px auto 0;
  background: var(--gold); border-radius: 2px; opacity: .8;
}
.home-tag {
  color: var(--muted); margin: 0 auto 20px; max-width: 34ch;
  font-style: italic; font-family: var(--serif); font-size: 15.5px;
}
.home-status {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px;
}
.status-box {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 8px; display: flex; flex-direction: column; gap: 3px;
}
.status-num { font-family: var(--serif); font-size: clamp(15px, 4.4vw, 19px); color: var(--gold-soft); font-weight: 700; }
.status-lbl { font-size: 11.5px; color: var(--muted); }

.section-head { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; margin: 24px 4px 12px; }

.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .game-grid { grid-template-columns: 1fr; } }

.game-tile, .study-tile {
  position: relative; text-align: left;
  display: flex; gap: 12px; align-items: center;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
  padding: 16px; color: var(--ink);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.game-tile:hover, .study-tile:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.05); }
.game-tile:active, .study-tile:active { transform: translatey(0) scale(.99); }
.tile-glyph { font-size: 30px; flex: none; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.tile-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-title { font-family: var(--serif); font-size: 18px; }
.tile-desc { font-size: 13px; color: var(--ink-dim); }
.tile-best {
  position: absolute; top: 10px; right: 12px; font-size: 11px; color: var(--gold-soft);
  background: rgba(255,200,87,.12); border: 1px solid rgba(255,200,87,.3);
  padding: 2px 8px; border-radius: 999px;
}
.tile-best.new { color: var(--muted); background: none; border-color: var(--line); }
.study-tile { width: 100%; }
.tile-arrow { margin-left: auto; font-size: 22px; color: var(--gold); }

.home-foot { text-align: center; margin-top: 26px; color: var(--muted); font-size: 14px; }
.link-btn { background: none; border: 0; color: var(--gold-soft); text-decoration: underline; font-size: 14px; }

/* ---- Progress bar ------------------------------------------- */
.progress { position: relative; height: 12px; background: #081420; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); transition: width .5s ease; }
.progress-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; color: var(--ink); text-shadow: 0 1px 2px rgba(0,0,0,.6); }

/* ---- Shared game chrome ------------------------------------- */
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.qcount { font-size: 13px; color: var(--muted); text-align: center; flex: 1; font-weight: 600; }
.ghost-btn {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim);
  padding: 8px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--gold); }
.primary {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #14202e; border: 0; font-weight: 700; font-size: 16px;
  padding: 14px 20px; border-radius: 12px; width: 100%;
  box-shadow: 0 6px 18px rgba(255,200,87,.25);
  transition: transform .1s ease, filter .1s ease;
}
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: scale(.98); }
.danger-btn { background: rgba(215,106,99,.12); border: 1px solid var(--bad); color: #f0a9a4; padding: 12px 18px; border-radius: 12px; font-weight: 600; }
.tl-instr { color: var(--ink-dim); text-align: center; margin: 4px 0 16px; }

/* ---- Quiz --------------------------------------------------- */
.combo { font-size: 13px; color: var(--muted); min-width: 68px; text-align: right; font-weight: 700; }
.combo.hot { color: var(--gold-soft); }
.qbar { height: 5px; background: #081420; border-radius: 3px; overflow: hidden; margin-bottom: 20px; }
.qbar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); transition: width .3s ease; }
.qprompt { font-size: clamp(20px, 5.2vw, 26px); line-height: 1.35; margin: 0 0 20px; }
.options { display: flex; flex-direction: column; gap: 11px; }
.option {
  text-align: left; background: var(--panel); border: 1.5px solid var(--line);
  color: var(--ink); font-size: 16px; padding: 15px 16px; border-radius: 13px;
  transition: border-color .12s, background .12s, transform .08s;
}
.option:not(:disabled):hover { border-color: var(--gold); background: var(--panel-2); }
.option:not(:disabled):active { transform: scale(.99); }
.option:disabled { opacity: .95; cursor: default; }
.option.correct { border-color: var(--good); background: rgba(107,191,115,.16); color: #d7f5db; }
.option.wrong { border-color: var(--bad); background: rgba(215,106,99,.15); color: #f6cecb; }
.explain { margin-top: 18px; border-radius: 13px; padding: 14px 16px; border: 1px solid var(--line); animation: fade .25s ease; }
.explain.good { border-color: rgba(107,191,115,.5); background: rgba(107,191,115,.08); }
.explain.bad { border-color: rgba(215,106,99,.5); background: rgba(215,106,99,.08); }
.explain-head { font-weight: 700; font-family: var(--serif); margin-bottom: 4px; }
.explain.good .explain-head { color: var(--good); }
.explain.bad .explain-head { color: var(--bad); }
.explain-body { color: var(--ink-dim); font-size: 14.5px; }
.next-btn { margin-top: 16px; }

/* ---- Results ------------------------------------------------ */
.result-card { text-align: center; background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 20px; box-shadow: var(--shadow); }
.result-emoji { font-size: 54px; }
.result-card h2 { font-size: 40px; margin: 6px 0 2px; color: var(--gold-soft); }
.result-verdict { color: var(--ink-dim); margin: 0 0 18px; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 6px; display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-family: var(--serif); font-size: 20px; color: var(--gold-soft); font-weight: 700; }
.stat-lbl { font-size: 11px; color: var(--muted); }
.record-badge { color: var(--gold-soft); font-weight: 700; margin-bottom: 16px; animation: pop .4s ease; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---- Timeline ----------------------------------------------- */
.tl-list, .dlg-log { list-style: none; padding: 0; margin: 0; }
.tl-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.tl-card {
  display: flex; align-items: center; gap: 12px; position: relative;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--gold); border-radius: var(--radius-sm); padding: 12px 14px;
}
.tl-card:not(.tl-drag) { transition: transform .16s ease; }
.tl-drag { z-index: 5; box-shadow: 0 8px 22px rgba(0,0,0,.5); border-color: var(--gold); }
.tl-handle {
  flex: none; width: 32px; height: 42px; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--muted); font-size: 21px; line-height: 1;
  cursor: grab; touch-action: none;
}
.tl-handle:active { cursor: grabbing; color: var(--gold-soft); }
.tl-handle:focus-visible { outline: 2px solid var(--gold); border-radius: 8px; }
.tl-glyph { font-size: 24px; flex: none; }
.tl-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tl-name strong { font-family: var(--serif); font-size: 17px; }
.tl-era { font-size: 12px; color: var(--muted); }
.tl-list.reveal .tl-card { border-left-width: 4px; }
.tl-card.ok { background: rgba(107,191,115,.1); }
.tl-card.miss { background: rgba(215,106,99,.1); }
.tl-mark { margin-left: auto; font-size: 18px; font-weight: 700; }
.tl-card.ok .tl-mark { color: var(--good); }
.tl-card.miss .tl-mark { color: var(--bad); }
.tl-score { text-align: center; font-size: 26px; margin: 6px 0 2px; color: var(--gold-soft); }
.check-btn { margin-top: 6px; }

/* ---- Quote Match -------------------------------------------- */
.qm-board { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
.qm-col { display: flex; flex-direction: column; gap: 10px; }
.qm-quote {
  text-align: left; background: var(--panel); border: 1.5px solid var(--line);
  color: var(--ink); font-family: var(--serif); font-style: italic; font-size: 15.5px;
  padding: 14px 15px; border-radius: 12px; line-height: 1.4;
}
.qm-quote.active { border-color: var(--gold); background: var(--panel-2); box-shadow: 0 0 0 3px rgba(255,200,87,.18); }
.qm-quote.done { opacity: .4; border-style: dashed; }
.qm-name {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel-2); border: 1.5px solid var(--line);
  color: var(--ink); font-size: 15px; padding: 12px 14px; border-radius: 999px;
}
.qm-name:not(:disabled):hover { border-color: var(--accent, var(--gold)); }
.qm-name.done { opacity: .4; border-color: var(--good); background: rgba(107,191,115,.12); }
.qm-glyph { font-size: 18px; }
.qm-progress { text-align: center; color: var(--muted); font-size: 13px; }
@media (min-width: 620px) {
  .qm-board { grid-template-columns: 1.3fr 1fr; align-items: start; }
}

/* ---- Dialogue ----------------------------------------------- */
.dlg-grid { display: flex; flex-direction: column; gap: 12px; }
.dlg-choice {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-left: 4px solid var(--accent, var(--gold));
  border-radius: var(--radius); padding: 16px; color: var(--ink);
  transition: transform .12s, border-color .12s;
}
.dlg-choice:hover { transform: translateY(-2px); border-color: var(--gold); }
.dlg-glyph { font-size: 30px; flex: none; }
.dlg-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dlg-meta strong { font-family: var(--serif); font-size: 17px; }
.dlg-blurb { font-size: 13px; color: var(--ink-dim); }
.dlg-done { margin-left: auto; color: var(--good); font-size: 20px; font-weight: 700; }

.dlg-log { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.dlg-bubble {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--accent, var(--gold));
  padding: 12px 15px; border-radius: 12px; max-width: 92%;
  animation: fade .25s ease;
}
.dlg-bubble.me { align-self: flex-end; border-left: 0; border-right: 3px solid var(--gold); background: var(--panel-2); text-align: right; }
.dlg-bubble.dim { opacity: .5; }
.dlg-speaker { font-size: 12px; color: var(--gold-soft); font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.dlg-bubble.me .dlg-speaker { color: var(--muted); justify-content: flex-end; }
.dlg-bubble p { margin: 0; font-family: var(--serif); font-size: 16.5px; line-height: 1.45; }
.dlg-glyph-sm { font-size: 15px; }
.dlg-choices { display: flex; flex-direction: column; gap: 10px; }
.dlg-reply {
  text-align: left; background: var(--panel-2); border: 1.5px solid var(--line);
  color: var(--ink); font-size: 15.5px; padding: 14px 16px; border-radius: 12px;
  transition: border-color .12s, transform .08s;
}
.dlg-reply:hover { border-color: var(--gold); }
.dlg-reply:active { transform: scale(.99); }
.dlg-takeaway {
  border: 1px solid var(--accent, var(--gold)); border-radius: var(--radius);
  background: rgba(255,200,87,.06); padding: 18px; margin: 8px 0 18px;
}
.dlg-takeaway-head { font-family: var(--serif); font-weight: 700; color: var(--gold-soft); margin-bottom: 6px; }
.dlg-takeaway p { margin: 0; color: var(--ink-dim); }
.dlg-xp { margin-top: 12px; font-weight: 700; color: var(--gold-soft); }

/* ---- Codex -------------------------------------------------- */
.codex-era { color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; font-size: 13px; margin: 22px 4px 10px; }
.codex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 560px) { .codex-grid { grid-template-columns: 1fr 1fr 1fr; } }
.codex-card {
  position: relative; text-align: center;
  background: linear-gradient(165deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-top: 3px solid var(--accent, var(--gold));
  border-radius: var(--radius); padding: 16px 10px 12px; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: transform .12s, box-shadow .12s;
}
.codex-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.codex-mastered { position: absolute; top: 8px; right: 10px; color: var(--gold); }
.codex-glyph { font-size: 34px; }
.codex-name { font-family: var(--serif); font-size: 15.5px; line-height: 1.2; }
.codex-years { font-size: 11.5px; color: var(--muted); }
.codex-stars { font-size: 13px; color: var(--gold); letter-spacing: 2px; margin-top: 3px; }

.codex-hero { text-align: center; border-bottom: 1px solid var(--line); padding: 8px 0 20px; margin-bottom: 6px; }
.codex-hero-glyph { font-size: 60px; filter: drop-shadow(0 4px 16px rgba(0,0,0,.5)); }
.codex-hero h1 { font-size: clamp(26px, 7vw, 36px); margin: 6px 0 2px; color: var(--gold-soft); }
.codex-hero-sub { color: var(--ink-dim); font-size: 14px; }
.codex-hero-school { display: inline-block; margin-top: 8px; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent, var(--gold)); border: 1px solid var(--line); padding: 3px 12px; border-radius: 999px; }
.codex-hero-stars { margin-top: 10px; color: var(--gold); letter-spacing: 3px; font-size: 16px; display: flex; gap: 10px; align-items: center; justify-content: center; }
.codex-hero-badge { font-size: 11px; letter-spacing: 1px; color: var(--good); border: 1px solid var(--good); border-radius: 999px; padding: 2px 8px; }
.codex-hero-line { color: var(--ink); font-family: var(--serif); font-style: italic; font-size: 17px; max-width: 34ch; margin: 14px auto 0; }
.codex-section { margin: 20px 0; }
.codex-section h3 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.4px; margin: 0 0 10px; }
.codex-big { font-family: var(--serif); font-size: 20px; line-height: 1.4; color: var(--ink); }
.codex-ideas { margin: 0; padding-left: 20px; }
.codex-ideas li { margin-bottom: 8px; color: var(--ink-dim); }
.codex-quotes blockquote { margin: 0 0 12px; padding: 12px 16px; border-left: 3px solid var(--gold); background: var(--panel); border-radius: 0 12px 12px 0; font-family: var(--serif); font-style: italic; color: var(--ink); }
.codex-fact { color: var(--ink-dim); }
.codex-nav { display: flex; justify-content: space-between; gap: 10px; margin: 18px 0; }

/* ---- Prose (about / settings) ------------------------------- */
.prose { color: var(--ink-dim); }
.prose h2 { color: var(--ink); font-size: 22px; margin: 22px 0 8px; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose b { color: var(--ink); }
.muted { color: var(--muted); font-size: 13px; }

/* ---- Toasts ------------------------------------------------- */
#toast-host { position: fixed; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); transition: .3s ease; }
.toast.show { opacity: 1; transform: none; }
.toast.bad { border-color: var(--bad); color: #f6cecb; }

/* ---- Confetti ----------------------------------------------- */
.confetti-host { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 55; }
.confetti { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2.4s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(680deg); opacity: .9; } }

/* ---- Academy (home tile + lessons) -------------------------- */
.academy-tile {
  position: relative; width: 100%; text-align: left;
  display: flex; gap: 14px; align-items: center;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255,200,87,.14), transparent 55%),
    linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid rgba(255,200,87,.45); border-radius: var(--radius);
  padding: 18px; color: var(--ink);
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  transition: transform .12s, border-color .12s;
}
.academy-tile:hover { transform: translateY(-2px); border-color: var(--gold); }
.academy-tile .tile-glyph { font-size: 34px; }
.academy-badge {
  margin-left: auto; flex: none; font-size: 13px; font-weight: 700; color: #14202e;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  padding: 5px 12px; border-radius: 999px;
}

.learn-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 6px; }
.learn-card {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-left: 4px solid var(--accent, var(--gold));
  border-radius: var(--radius); padding: 15px; color: var(--ink);
  transition: transform .12s, border-color .12s;
}
.learn-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.learn-glyph { font-size: 30px; flex: none; }
.learn-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.learn-meta strong { font-family: var(--serif); font-size: 17px; }
.learn-hook { font-size: 13px; color: var(--ink-dim); font-style: italic; }
.learn-done, .learn-go { margin-left: auto; flex: none; font-size: 20px; }
.learn-go { color: var(--gold); }

/* lesson body shared */
.learn-body { animation: fade .25s ease; }
.learn-actions { margin-top: 18px; }
.learn-step { display: inline-block; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; font-weight: 700; }
.learn-tag { display: inline-block; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold-soft); font-weight: 700; margin-bottom: 6px; }

/* intro */
.learn-intro { text-align: center; border: 1px solid var(--line); border-top: 4px solid var(--accent, var(--gold)); border-radius: var(--radius); padding: 24px 18px; background: linear-gradient(160deg, var(--panel-2), var(--panel)); }
.learn-intro-glyph { font-size: 58px; filter: drop-shadow(0 4px 14px rgba(0,0,0,.5)); }
.learn-intro-name { font-size: clamp(26px, 7vw, 34px); margin: 6px 0 2px; color: var(--gold-soft); }
.learn-intro-sub { color: var(--muted); font-size: 13px; }
.learn-intro-hook { font-family: var(--serif); font-style: italic; font-size: clamp(18px, 4.6vw, 22px); line-height: 1.4; color: var(--ink); max-width: 32ch; margin: 16px auto; }
.learn-intro-big { text-align: left; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.learn-intro-big p { margin: 0; font-family: var(--serif); font-size: 17px; }

/* concept */
.learn-concept-head { margin-bottom: 10px; }
.learn-concept-name { font-size: clamp(22px, 5.5vw, 28px); margin: 2px 0 0; padding-left: 12px; border-left: 4px solid var(--accent, var(--gold)); }
.learn-plain { font-size: 17px; line-height: 1.6; color: var(--ink); }
.learn-example, .learn-meaning, .learn-takeaway {
  margin-top: 16px; background: rgba(255,200,87,.07);
  border: 1px solid rgba(255,200,87,.3); border-radius: 12px; padding: 14px 16px;
  animation: fade .25s ease;
}
.learn-example p, .learn-meaning p, .learn-takeaway p { margin: 0; color: var(--ink-dim); font-size: 15.5px; line-height: 1.55; }

/* thought experiment */
.learn-scenario {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--accent, var(--gold)); border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}
.learn-scenario p { margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.5; }
.learn-glyph-sm { font-size: 22px; flex: none; }
.learn-response {
  margin-top: 16px; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent, var(--gold)); border-radius: 12px; padding: 12px 15px;
  animation: fade .25s ease;
}
.learn-response p { margin: 0; font-family: var(--serif); font-size: 16px; line-height: 1.5; }

/* quote */
.learn-quote {
  margin: 0; padding: 18px 20px; border-left: 4px solid var(--accent, var(--gold));
  background: var(--panel); border-radius: 0 12px 12px 0;
  font-family: var(--serif); font-style: italic; font-size: clamp(19px, 5vw, 24px);
  line-height: 1.4; color: var(--ink);
}

/* ---- Game juice: XP pop, mute, toggle ----------------------- */
.mute-btn {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim);
  width: 34px; height: 34px; border-radius: 999px; font-size: 15px; line-height: 1;
  display: grid; place-items: center; padding: 0;
}
.mute-btn:hover { border-color: var(--gold); }

.xp-pop {
  position: fixed; z-index: 70; transform: translate(-50%, -50%);
  pointer-events: none; font-family: var(--serif); font-weight: 700;
  font-size: 22px; color: var(--gold-soft);
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
  animation: xpRise 0.95s ease-out forwards;
}
@keyframes xpRise {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  20%  { opacity: 1; transform: translate(-50%, -80%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -180%) scale(1); }
}

.toggle-btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px;
  margin-bottom: 8px;
}
.toggle-btn:hover { border-color: var(--gold); }

/* ---- Proficiency tiers -------------------------------------- */
.prof { display: inline-flex; align-items: center; gap: 6px; }
.prof-label { font-size: 11px; color: var(--muted); font-weight: 700; }
.prof[data-tier="advanced"] .prof-label { color: #d9c07a; }
.prof[data-tier="master"] .prof-label { color: var(--gold-soft); }
.prof-pips { display: inline-flex; gap: 3px; }
.pip { width: 6px; height: 6px; border-radius: 2px; background: #2a4258; display: inline-block; }
.pip.on { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); }
.prof-next { font-size: 11px; color: var(--ink-dim); }

.codex-stars { /* legacy, replaced by .prof */ }
.learn-tier {
  margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--gold-soft);
  background: rgba(255,200,87,.12); border: 1px solid rgba(255,200,87,.3);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}

/* ---- Browse toggle (segmented control) ---------------------- */
.seg { display: inline-flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin: 0 0 16px; }
.seg-btn { background: none; border: 0; color: var(--ink-dim); font-size: 13px; font-weight: 600; padding: 7px 16px; border-radius: 999px; }
.seg-btn.on { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: #14202e; }

/* ---- Disclaimer --------------------------------------------- */
.disclaimer { margin-top: 22px; font-size: 12.5px; color: var(--ink-dim); line-height: 1.55; border-top: 1px solid var(--line); padding-top: 14px; }
.codex-hero-school { background: none; cursor: pointer; }

/* ---- Accessibility ------------------------------------------ */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--gold); color: #12202e; padding: 10px 16px; border-radius: 0 0 10px 0; font-weight: 700; }
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; border-radius: 6px; }

/* ---- SEO / no-JS fallback (replaced by the app on load) ------ */
.seo-fallback { max-width: 60ch; margin: 0 auto; color: var(--ink-dim); }
.seo-fallback h1 { color: var(--gold-soft); font-size: clamp(28px, 7vw, 40px); }
.seo-fallback h2 { color: var(--ink); font-size: 18px; margin-top: 20px; }

/* ---- Ask a Philosopher (AI chat) ---------------------------- */
.chat-note {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-size: 12px; color: var(--muted); margin-bottom: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px;
}
.chat-note .chat-glyph { font-size: 15px; }
.chat-log {
  height: 56vh; min-height: 300px; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-intro {
  text-align: center; margin: auto; padding: 20px; color: var(--ink-dim);
}
.chat-intro-glyph { font-size: 46px; filter: drop-shadow(0 3px 12px rgba(0,0,0,.5)); }
.chat-intro strong { display: block; font-family: var(--serif); font-size: 20px; color: var(--gold-soft); margin: 6px 0 4px; }
.chat-intro p { margin: 4px 0; }
.chat-intro-hint { font-size: 13px; color: var(--muted); }

.chat-composer {
  position: sticky; bottom: calc(6px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--bg); padding-top: 4px;
}
.chat-input {
  flex: 1; resize: none; font-family: var(--sans); font-size: 16px; line-height: 1.4;
  color: var(--ink); background: var(--panel); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 12px 14px; max-height: 140px;
}
.chat-input:focus { outline: none; border-color: var(--gold); }
.chat-send {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: #14202e;
  border: 0; font-size: 18px; font-weight: 700;
}
.chat-send:disabled { opacity: .5; }

.chat-typing .dots { display: inline-flex; gap: 4px; }
.chat-typing .dots i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ink-dim); display: inline-block;
  animation: blink 1.2s infinite both;
}
.chat-typing .dots i:nth-child(2) { animation-delay: .2s; }
.chat-typing .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.chat-report { display: block; margin-top: 6px; background: none; border: 0; color: var(--muted); font-size: 11px; padding: 2px 0; text-decoration: underline; opacity: .7; cursor: pointer; }
.chat-report:hover { color: var(--bad); opacity: 1; }

/* ---- Quests (debate arenas) --------------------------------- */
.quest-grid { display: flex; flex-direction: column; gap: 12px; }
.quest-card {
  text-align: left; display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-left: 4px solid var(--accent, var(--gold));
  border-radius: var(--radius); padding: 15px; color: var(--ink);
  transition: transform .12s, border-color .12s;
}
.quest-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.quest-card-top { display: flex; align-items: center; gap: 9px; }
.quest-glyph { font-size: 24px; flex: none; }
.quest-title { font-family: var(--serif); font-size: 17px; }
.quest-diff { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.diff-hard { background: rgba(215,106,99,.15); color: #f0a9a4; border: 1px solid rgba(215,106,99,.4); }
.diff-med { background: rgba(255,200,87,.14); color: var(--gold-soft); border: 1px solid rgba(255,200,87,.35); }
.quest-done { margin-left: auto; color: var(--good); font-size: 18px; font-weight: 700; }
.quest-goal-line { font-size: 14px; color: var(--ink); }
.quest-vs { font-size: 12px; color: var(--muted); }

.quest-goal {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: rgba(255,200,87,.08); border: 1px solid rgba(255,200,87,.35);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 10px;
}
.quest-goal.solved { background: rgba(107,191,115,.1); border-color: rgba(107,191,115,.5); }
.quest-goal-text { font-size: 14px; font-weight: 600; color: var(--ink); }
.quest-turns { flex: none; font-size: 12px; color: var(--muted); font-weight: 700; }
.quest-setup {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent, var(--gold));
  border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
}
.quest-setup p { margin: 0; font-family: var(--serif); font-size: 15px; line-height: 1.45; }
.quest-hint { text-align: center; font-size: 13px; color: var(--muted); font-style: italic; padding: 6px 0; }
.quest-won-badge { color: var(--good); font-size: 13px; font-weight: 700; white-space: nowrap; }
.quest-win { margin-top: 14px; }

.build-stamp { margin-top: 10px; font-size: 10px; letter-spacing: .3px; color: var(--muted); opacity: .65; text-align: center; }

/* ---- Deep Story Mode course --------------------------------- */
.learn-deep { display: inline-block; margin-top: 5px; font-size: 10.5px; font-weight: 700; color: var(--gold-soft); background: rgba(255,200,87,.12); border: 1px solid rgba(255,200,87,.35); border-radius: 999px; padding: 2px 8px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.course { display: flex; flex-direction: column; min-height: calc(100dvh - 110px); }
.course-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.course-x { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim); font-size: 14px; }
.course-bar { flex: 1; height: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.course-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); border-radius: 999px; transition: width .4s ease; }
.course-xp { flex: none; font-size: 13px; font-weight: 700; color: var(--gold-soft); min-width: 46px; text-align: right; }

.course-stage { flex: 1 1 auto; animation: fadeUp .28s ease; }
.course-foot { position: sticky; bottom: 0; padding: 14px 0 calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--bg) 34%); }
.course-next { width: 100%; padding: 15px; font-size: 16px; font-weight: 700; border-radius: 14px; border: 0; background: var(--gold); color: #14202e; cursor: pointer; }
.course-next:disabled { opacity: .38; cursor: default; }

.course-chapter { text-align: center; padding: 26px 12px; }
.course-chapter-k { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.course-chapter h2 { font-family: var(--serif); font-size: 26px; color: var(--gold-soft); margin: 8px 0; }
.course-chapter p { color: var(--ink-dim); line-height: 1.5; }
.course-chapter-glyph { display: block; font-size: 56px; margin-top: 18px; filter: drop-shadow(0 3px 10px rgba(0,0,0,.4)); }

.course-teach-glyph { font-size: 40px; margin-bottom: 4px; }
.course-teach h3, .course-q { font-family: var(--serif); font-size: 20px; color: var(--ink); margin: 6px 0 12px; }
.course-teach p { font-size: 16px; line-height: 1.6; margin: 0 0 13px; color: var(--ink); }
.course-pull { border-left: 3px solid var(--accent, var(--gold)); padding: 8px 14px; margin: 10px 0; font-family: var(--serif); font-style: italic; color: var(--gold-soft); }

.course-quote { text-align: center; padding: 14px 6px; }
.course-quote-mark { display: block; font-family: var(--serif); font-size: 56px; color: var(--accent, var(--gold)); line-height: .5; }
.course-quote-text { font-family: var(--serif); font-size: 21px; line-height: 1.5; color: var(--ink); margin: 6px 0; }
.course-quote-who { color: var(--muted); font-size: 13px; }
.course-quote-gloss { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 16px; font-size: 14px; line-height: 1.55; color: var(--ink-dim); }

.course-prompt { font-size: 15px; color: var(--ink-dim); margin: 0 0 13px; line-height: 1.5; }
.course-opts { display: flex; flex-direction: column; gap: 10px; }
.course-opts-wrap { flex-direction: row; flex-wrap: wrap; }
.course-opt {
  text-align: left; padding: 14px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  font-size: 15px; line-height: 1.4; cursor: pointer; transition: border-color .1s;
  /* uniform height so option LENGTH can't be scanned as a tell */
  min-height: 3.6em; display: flex; align-items: center;
}
.course-opt:hover:not(:disabled) { border-color: var(--gold); }
.course-opt.right { border-color: var(--good); background: rgba(107,191,115,.14); color: #cdeccf; }
.course-opt.wrong { border-color: var(--bad); background: rgba(215,106,99,.12); opacity: .7; }
.course-opt.chosen { border-color: var(--gold); background: rgba(255,200,87,.12); }

.course-takeaway { margin-top: 14px; background: rgba(255,200,87,.08); border: 1px solid rgba(255,200,87,.3); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }

.course-fill { font-family: var(--serif); font-size: 19px; line-height: 1.75; margin: 6px 0 16px; }
.course-blank { display: inline-block; min-width: 70px; text-align: center; border-bottom: 2px dashed var(--gold-soft); color: var(--muted); padding: 0 6px; }
.course-blank.right { border-bottom-style: solid; border-color: var(--good); color: #cdeccf; }
.course-chip { padding: 11px 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer; }
.course-chip:hover:not(:disabled) { border-color: var(--gold); }
.course-chip.right { border-color: var(--good); background: rgba(107,191,115,.16); }
.course-chip.wrong { border-color: var(--bad); opacity: .55; }
.course-chip.used { opacity: .35; }

.course-order-answer { display: flex; flex-direction: column; gap: 6px; min-height: 20px; margin-bottom: 14px; }
.course-order-tok { background: rgba(255,200,87,.1); border: 1px solid rgba(255,200,87,.3); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.course-order-answer.right .course-order-tok { border-color: var(--good); background: rgba(107,191,115,.14); }
.course-order-answer.wrong .course-order-tok { border-color: var(--bad); }

.course-match { display: flex; gap: 14px; }
.course-match-col { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.course-match-cell { padding: 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 13px; line-height: 1.35; text-align: left; min-height: 54px; cursor: pointer; }
.course-match-cell.sel { border-color: var(--gold); background: rgba(255,200,87,.14); }
.course-match-cell.done { border-color: var(--good); background: rgba(107,191,115,.12); opacity: .7; }
.course-match-cell.miss { border-color: var(--bad); }

.course-checkpoint-head { text-align: center; margin-bottom: 10px; }
.course-checkpoint-head span { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--good); }
.course-checkpoint-head h3 { font-family: var(--serif); font-size: 20px; color: var(--ink); }
.course-cp-progress { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-align: center; }
.course-cp-done { text-align: center; font-size: 18px; font-weight: 700; color: var(--good); padding: 20px; }

.course-fb { margin-top: 12px; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; animation: fadeUp .25s ease; }
.course-fb.good { background: rgba(107,191,115,.12); border: 1px solid rgba(107,191,115,.4); color: #cdeccf; }
.course-fb.bad { background: rgba(215,106,99,.1); border: 1px solid rgba(215,106,99,.35); color: #f0b8b4; }
.course-fb.neutral { background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim); }

.course-done { text-align: center; padding: 24px 10px; }
.course-done-glyph { font-size: 60px; }
.course-done h2 { font-family: var(--serif); font-size: 24px; color: var(--gold-soft); margin: 8px 0; }
.course-done p { color: var(--ink-dim); line-height: 1.55; }
.course-done-xp { margin: 14px 0; font-weight: 700; color: var(--gold-soft); }
.course-done-msg { max-width: 32ch; margin: 6px auto 4px; }

/* ---- Story-Mode level select + understanding gauge ---------- */
.course-select { padding-bottom: 24px; }
.cs-hero { display: flex; align-items: center; gap: 14px; margin: 4px 0 6px; padding: 4px; }
.cs-glyph { font-size: 46px; flex: none; filter: drop-shadow(0 3px 8px rgba(0,0,0,.4)); }
.cs-name { font-family: var(--serif); font-size: 25px; color: var(--gold-soft); margin: 0; }
.cs-sub { font-size: 13px; color: var(--muted); }

.cs-gauge { display: flex; justify-content: center; margin: 6px 0 14px; }
.gauge { width: 240px; max-width: 78%; height: auto; }
.gauge-track { fill: none; stroke: var(--line); stroke-width: 15; stroke-linecap: round; }
.gauge-val { fill: none; stroke: var(--gold); stroke-width: 15; stroke-linecap: round; filter: drop-shadow(0 0 5px rgba(255,200,87,.4)); }
.gauge-num { fill: var(--gold-soft); font-family: var(--serif); font-size: 40px; font-weight: 700; }
.gauge-cap { fill: var(--muted); font-family: var(--sans); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; }

.cs-level {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px; margin-bottom: 11px; color: var(--ink);
}
.cs-level.open { border-left: 4px solid var(--accent, var(--gold)); }
.cs-level.done { border-left: 4px solid #67c98a; }
.cs-level.locked { opacity: .55; }
.cs-level:not(.locked):hover { border-color: var(--gold); }
.cs-level-badge {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700;
  background: var(--panel); border: 1.5px solid var(--line); color: var(--gold-soft);
}
.cs-level.done .cs-level-badge { background: #67c98a; color: #08210f; border-color: #67c98a; }
.cs-level-body { flex: 1; min-width: 0; }
.cs-level-body strong { display: block; font-size: 15.5px; margin-bottom: 3px; }
.cs-level-body span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.cs-level-go { flex: none; font-size: 12.5px; color: var(--gold-soft); font-weight: 600; }
.cs-foot { display: flex; gap: 8px; margin-top: 8px; }
.cs-foot .ghost-btn { flex: 1; }

/* ---- Talk to a Thinker (chat + debate hub) ------------------ */
.talk-banner { display: flex; gap: 14px; align-items: center; background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-left: 4px solid var(--accent, var(--gold)); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.talk-banner-glyph { font-size: 44px; flex: none; filter: drop-shadow(0 3px 8px rgba(0,0,0,.4)); }
.talk-banner-name { font-family: var(--serif); font-size: 22px; color: var(--gold-soft); display: block; }
.talk-banner-sub { font-size: 12.5px; color: var(--muted); }
.talk-banner-line { margin: 6px 0 0; font-size: 14px; color: var(--ink-dim); line-height: 1.45; }

.talk-modes { display: flex; flex-direction: column; gap: 12px; }
.talk-mode { text-align: left; display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--ink); transition: transform .1s, border-color .1s; cursor: pointer; }
.talk-mode:hover { transform: translateY(-2px); border-color: var(--gold); }
.talk-mode.duel { border-left: 4px solid var(--accent, var(--gold)); }
.talk-mode-glyph { font-size: 26px; }
.talk-mode strong { display: block; font-family: var(--serif); font-size: 18px; margin: 4px 0 2px; }
.talk-mode-desc { font-size: 13.5px; color: var(--ink-dim); line-height: 1.45; }
.talk-best { display: inline-block; margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--gold-soft); background: rgba(255,200,87,.12); border: 1px solid rgba(255,200,87,.35); border-radius: 999px; padding: 2px 9px; }

.diff-box { text-align: center; background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 18px; }
.diff-k { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.diff-readout { display: flex; align-items: baseline; justify-content: center; gap: 4px; margin: 4px 0; }
.diff-num { font-family: var(--serif); font-size: 52px; font-weight: 700; color: var(--accent, var(--gold)); line-height: 1; }
.diff-of { font-size: 16px; color: var(--muted); }
.diff-name { display: block; font-family: var(--serif); font-size: 20px; color: var(--gold-soft); }
.diff-desc { font-size: 13.5px; color: var(--ink-dim); margin: 6px 0 14px; min-height: 34px; line-height: 1.4; }
.diff-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--gold-soft), var(--bad)); outline: none; }
.diff-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); border: 3px solid var(--accent, var(--gold)); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.diff-slider::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); border: 3px solid var(--accent, var(--gold)); cursor: pointer; }
.diff-ends { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 8px; }

.prov-head { font-family: var(--serif); font-size: 17px; margin: 4px 0 10px; color: var(--ink); }
.prov-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.prov { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; color: var(--ink); cursor: pointer; transition: border-color .1s; }
.prov:hover { border-color: var(--gold); }
.prov.sel { border-color: var(--gold); background: rgba(255,200,87,.12); box-shadow: inset 0 0 0 1px var(--gold); }
.prov strong { display: block; font-size: 15px; }
.prov-sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; font-style: italic; line-height: 1.4; }

.debate-hint { text-align: center; font-size: 12.5px; color: var(--muted); font-style: italic; padding: 8px 12px; margin: 4px 0; }

/* ---- The Web of Wisdom (spider-web influence map) ----------- */
.web-outer { position: relative; margin: 0 -6px; }
.web-svg {
  display: block; width: 100%; height: 70vh; min-height: 440px;
  background: rgba(255,255,255,.014);
  border: 1px solid var(--line); border-radius: 16px;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
  overflow: hidden;
}
.web-svg:active { cursor: grabbing; }

/* threads = the strings connecting the thinkers (influence edges) */
.thread { stroke: rgba(255,200,87,.28); stroke-width: 1.6; transition: stroke .15s, stroke-width .15s; }
.thread.up { stroke: var(--gold-soft); stroke-width: 2.6; filter: drop-shadow(0 0 3px rgba(255,200,87,.6)); }
.thread.down { stroke: #66c2d0; stroke-width: 2.6; filter: drop-shadow(0 0 3px rgba(102,194,208,.5)); }
.thread.dim { stroke: rgba(255,255,255,.028); }

/* nodes */
.wnode { cursor: pointer; transition: opacity .15s; }
.wdot { fill: var(--accent, var(--gold)); stroke: var(--bg); stroke-width: 2.5; transition: stroke-width .12s; }
.wglyph { font-size: 17px; pointer-events: none; }
.wname {
  fill: var(--ink); font-family: var(--sans); font-size: 13px; font-weight: 600;
  text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: var(--bg); stroke-width: 3.5px; stroke-linejoin: round;
}
.wnode:focus { outline: none; }
.wnode:focus-visible .wdot { stroke: var(--gold-soft); stroke-width: 4; }
.wnode.far { opacity: .26; }
.wnode.near .wdot { stroke: var(--gold-soft); stroke-width: 3.5; }
.wnode.near .wname { fill: var(--gold-soft); }
.wnode.sel .wdot { stroke: var(--gold-soft); stroke-width: 4.5; filter: drop-shadow(0 0 6px rgba(255,200,87,.7)); }
.wnode.sel .wname { fill: var(--gold-soft); }

.web-controls { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 7px; }
.web-controls button {
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  font-size: 19px; line-height: 1; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.web-controls button:hover { border-color: var(--gold); color: var(--gold-soft); }
.web-controls button:active { transform: translateY(1px); }

/* detail sheet */
.tree-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  max-width: var(--maxw); margin: 0 auto;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.4);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  animation: sheetUp .25s ease;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.tree-sheet-close { position: absolute; top: 10px; right: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim); width: 30px; height: 30px; border-radius: 50%; font-size: 13px; }
.tree-sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-left: 4px; }
.tree-sheet-glyph { font-size: 32px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.tree-sheet-head strong { font-family: var(--serif); font-size: 19px; display: block; color: var(--gold-soft); }
.tree-sheet-sub { font-size: 12.5px; color: var(--muted); }
.tree-sheet-row { margin-bottom: 10px; }
.tree-lbl { display: block; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.tree-none { font-size: 13px; color: var(--ink-dim); font-style: italic; }
.tree-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.tree-chip {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent, var(--gold));
  color: var(--ink); font-size: 13px; padding: 5px 11px; border-radius: 999px;
}
.tree-chip:hover { border-color: var(--gold); }
.tree-sheet-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.tree-sheet-actions .primary { flex: 1; min-width: 140px; }

/* ---- app-bar economy: hearts + scroll tokens ----------------- */
.hearts-chip, .tokens-chip {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--panel); border: 1px solid var(--line);
  padding: 5px 9px; border-radius: 999px; cursor: pointer; color: var(--ink);
}
.hearts-chip { gap: 2px; }
.hearts-chip:hover, .tokens-chip:hover { border-color: var(--gold); }
.gqheart { width: 15px; height: 15px; display: block; transition: transform .12s; }
.gqheart.full path { fill: #d9584e; }
.gqheart.empty path { fill: none; stroke: #48617b; stroke-width: 2; }
.gqstamp { width: 18px; height: 18px; display: block; }
.tokens-chip b { color: var(--gold-soft); font-size: 14px; font-weight: 700; }

/* ---- out-of-hearts overlay ----------------------------------- */
.course-out {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10,8,5,.74); backdrop-filter: blur(4px);
  animation: fadeUp .2s ease;
}
.course-out-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 22px; max-width: 340px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.course-out-heart { width: 46px; height: 46px; margin: 0 auto 8px; }
.course-out-heart .gqheart { width: 46px; height: 46px; }
.course-out-heart .gqheart path { fill: none; stroke: #d9584e; stroke-width: 2; }
.course-out-card h3 { font-family: var(--serif); font-size: 22px; margin: 2px 0 8px; }
.course-out-card p { color: var(--ink-dim); font-size: 14px; line-height: 1.5; }
.course-out-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* level in-progress marker */
.cs-level.resuming { border-color: var(--gold); }

/* ---- scout the owl ------------------------------------------ */
.scout {
  position: fixed; right: 12px; bottom: 92px; z-index: 55;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
.scout > * { pointer-events: auto; }
.scout-fox-btn {
  width: 60px; height: 60px; padding: 0; border: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 0 9px rgba(255,200,87,.45)) drop-shadow(0 6px 12px rgba(0,0,0,.5));
  animation: scout-bob 3.4s ease-in-out infinite;
}
.scout.tucked { opacity: 0; pointer-events: none; transition: opacity .2s; }
/* Lesson screens: smaller, translucent, tucked above the Continue bar. */
.scout.compact { bottom: 150px; }
.scout.compact .scout-fox-btn { width: 44px; height: 44px; opacity: .88; }
.scout.compact .scout-fox-btn:hover { opacity: 1; }
.scout.pop .scout-fox-btn { animation: scout-pop .5s ease; }
.scout-fox { width: 100%; height: 100%; display: block; }
@keyframes scout-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes scout-pop { 0% { transform: scale(1); } 35% { transform: scale(1.18) rotate(-4deg); } 70% { transform: scale(.95); } 100% { transform: scale(1); } }
.scout-bubble {
  position: relative; max-width: min(228px, 62vw);
  background: var(--panel-2); border: 1px solid var(--gold);
  border-radius: 13px; padding: 9px 26px 9px 12px;
  color: var(--ink); font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 12px 30px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(8px) scale(.96); transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease;
}
.scout-bubble.show { opacity: 1; transform: translateY(0) scale(1); }
.scout-bubble::after {
  content: ""; position: absolute; right: 22px; bottom: -8px;
  width: 14px; height: 14px; background: var(--panel-2);
  border-right: 1px solid var(--gold); border-bottom: 1px solid var(--gold);
  transform: rotate(45deg);
}
.scout-text { margin: 0; }
.scout-x {
  position: absolute; top: 5px; right: 7px; width: 20px; height: 20px;
  border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1;
}
.scout-x:hover { color: var(--ink); }
.scout-actions { display: flex; gap: 8px; margin-top: 11px; }
.scout-btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
}
.scout-btn.primary { background: var(--gold); border-color: var(--gold); color: #14202e; font-weight: 700; }

/* ---- scout's help drawer (the slide-up chat) ------------------ */
.scout-veil { position: fixed; inset: 0; z-index: 58; background: rgba(10,8,5,.35); }
.scout-drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 59;
  max-width: 720px; margin: 0 auto;
  background: var(--panel-2); border: 1px solid var(--line); border-bottom: 0;
  border-top: 2px solid var(--gold);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -16px 44px rgba(0,0,0,.55);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .28s ease;
}
.scout-drawer.open { transform: translateY(0); }
.scout-d-head { display: flex; align-items: center; gap: 10px; }
.scout-d-head .scout-fox { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 2px 5px rgba(0,0,0,.4)); }
.scout-d-title { display: flex; flex-direction: column; line-height: 1.2; }
.scout-d-title strong { font-family: var(--serif); font-size: 16.5px; }
.scout-d-title span { font-size: 11.5px; color: var(--muted); }
.scout-d-x {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim);
  font-size: 13px; cursor: pointer;
}
.scout-d-x:hover { border-color: var(--gold); color: var(--ink); }
.scout-greet { margin: 8px 0; color: var(--ink-dim); font-size: 13.5px; line-height: 1.5; font-style: italic; }
.scout-msgs {
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto; max-height: 34vh; margin-bottom: 10px;
  overscroll-behavior: contain;
}
.scout-msg {
  padding: 8px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; max-width: 86%;
  white-space: pre-wrap;
}
.scout-msg.me { align-self: flex-end; background: rgba(255,200,87,.15); border: 1px solid rgba(255,200,87,.4); }
.scout-msg.owl { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.scout-msg.typing { color: var(--muted); letter-spacing: 2px; animation: scout-bob 1s ease-in-out infinite; }
.scout-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.scout-chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim);
  padding: 6px 11px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
}
.scout-chip:hover { border-color: var(--gold); color: var(--ink); }
.scout-inrow { display: flex; gap: 8px; }
.scout-in {
  flex: 1; min-width: 0; padding: 10px 13px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); font-size: 14px;
}
.scout-in:focus { outline: none; border-color: var(--gold); }
.scout-send {
  border: 0; border-radius: 12px; padding: 10px 18px; cursor: pointer;
  background: var(--gold); color: #14202e; font-weight: 700; font-size: 14px;
}
.scout-send:disabled { opacity: .55; cursor: default; }

/* ---- first-visit welcome card -------------------------------- */
.ob-veil {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(10,8,5,.86); backdrop-filter: blur(5px);
  overflow-y: auto;
}
.ob-veil.out { opacity: 0; transition: opacity .25s; }
.ob-card {
  background: var(--panel-2); border: 1px solid var(--gold); border-radius: 20px;
  padding: 26px 24px; max-width: 400px; width: 100%;
  box-shadow: 0 28px 70px rgba(0,0,0,.6);
  margin: auto;
}
.ob-fox { width: 64px; height: 64px; margin: 0 auto 6px; }
.ob-fox .scout-fox { width: 64px; height: 64px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }
.ob-title { font-family: var(--serif); font-size: 24px; text-align: center; margin: 0 0 6px; }
.ob-sub { color: var(--ink-dim); font-size: 13.5px; line-height: 1.5; text-align: center; margin: 0 0 14px; }
.ob-label { display: block; font-size: 12.5px; color: var(--gold-soft); font-weight: 600; margin: 12px 0 6px; letter-spacing: .3px; }
.ob-in, .ob-sel {
  width: 100%; padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); font-size: 14px;
}
.ob-in:focus, .ob-sel:focus { outline: none; border-color: var(--gold); }
.ob-row { display: flex; gap: 8px; }
.ob-row .ob-sel { flex: 1; min-width: 0; }
.ob-err { color: var(--bad); font-size: 13px; margin: 10px 0 0; text-align: center; }
.ob-go { width: 100%; margin-top: 16px; }
.ob-cancel { width: 100%; margin-top: 8px; }

/* home welcome line */
.home-welcome {
  font-family: var(--serif); font-style: italic; font-size: 17px;
  color: var(--gold-soft); margin: 2px 0 4px;
}

/* ---- Story Mode sortable (order exercises) -------------------- */
.course-sort { list-style: none; margin: 14px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.course-sort-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; font-size: 14px; line-height: 1.4;
}
.course-sort-item.ok { border-color: var(--good); background: rgba(107,191,115,.1); }
.course-sort-item.miss { border-color: var(--bad); }
.course-sort-n {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted); font-weight: 700;
}
.course-sort-item .tl-name { flex: 1; }
.course-sort-submit { width: 100%; margin-top: 2px; }

@media (max-width: 480px) {
  .brand-name { display: none; }
  .gqheart { width: 13px; height: 13px; }
  .hearts-chip, .tokens-chip { padding: 5px 7px; }
  .scout-fox-btn { width: 52px; height: 52px; }
  .scout { right: 10px; bottom: 86px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .05s !important; }
}


/* ============================================================
   Geography Quest additions — journey cards, the trail, bosses,
   sort buckets, the Atlas glossary and flag styling.
   ============================================================ */

/* ---- home: world journey cards ------------------------------- */
.world-card {
  position: relative; width: 100%; text-align: left;
  display: flex; gap: 14px; align-items: center;
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line); border-left: 5px solid var(--accent, var(--gold));
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
  padding: 16px; margin-bottom: 12px; color: var(--ink);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.world-card:hover { transform: translateY(-2px); border-color: var(--accent, var(--gold)); box-shadow: var(--shadow); }
.world-card:active { transform: translateY(0) scale(.995); }
.world-card.locked { opacity: .55; filter: saturate(.4); }
.world-card.complete { border-color: var(--gold); }
.world-glyph { font-size: 34px; flex: none; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.world-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.world-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.world-name { font-family: var(--serif); font-size: 17.5px; }
.world-grades {
  font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--accent, var(--gold-soft));
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 999px;
}
.world-tag { font-size: 13px; color: var(--ink-dim); }
.world-crown { position: absolute; top: 10px; right: 12px; font-size: 18px; }

/* ---- the trail (path screen) ---------------------------------- */
.path-hero { text-align: center; padding: 6px 8px 14px; }
.path-hero-glyph { font-size: 44px; display: block; filter: drop-shadow(0 4px 12px rgba(0,0,0,.45)); }
.path-title { font-size: clamp(26px, 7vw, 38px); margin: 6px 0 2px; }
.path-grades {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--accent, var(--gold-soft)); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; margin-bottom: 8px; background: var(--panel);
}
.path-tag { color: var(--muted); font-size: 14px; max-width: 40ch; margin: 0 auto 14px; }
.path-unit {
  font-size: 14px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 1.4px;
  margin: 26px 4px 14px; text-align: center; position: relative;
}
.path-unit::before, .path-unit::after {
  content: ""; position: absolute; top: 50%; width: 18%; height: 1px; background: var(--line);
}
.path-unit::before { left: 4px; }
.path-unit::after { right: 4px; }

.path-node {
  position: relative; display: flex; align-items: center; gap: 14px; text-align: left;
  width: min(430px, 92%); margin: 0 auto 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 12px 14px; color: var(--ink); cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.path-node.even { transform: translateX(-7%); }
.path-node.odd { transform: translateX(7%); }
.path-node:hover { border-color: var(--accent, var(--gold)); box-shadow: var(--shadow); }
.path-node.even:hover { transform: translateX(-7%) translateY(-2px); }
.path-node.odd:hover { transform: translateX(7%) translateY(-2px); }
.path-node.locked { opacity: .5; filter: saturate(.3); cursor: not-allowed; }
.path-node.done { border-color: var(--accent, var(--gold)); background: linear-gradient(135deg, var(--panel), var(--panel-2)); }
.path-node.next { border-color: var(--accent, var(--gold)); box-shadow: 0 0 0 3px rgba(255,200,87,.18), var(--shadow); }
.path-node-circle {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 25px;
  background: var(--bg-2); border: 2px solid var(--line);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.35);
}
.path-node.done .path-node-circle { border-color: var(--accent, var(--gold)); background: linear-gradient(180deg, var(--panel-2), var(--bg-2)); }
.path-node.next .path-node-circle { border-color: var(--accent, var(--gold)); animation: node-pulse 1.8s ease-in-out infinite; }
@keyframes node-pulse {
  0%, 100% { box-shadow: inset 0 -3px 0 rgba(0,0,0,.35), 0 0 0 0 rgba(255,200,87,.35); }
  50% { box-shadow: inset 0 -3px 0 rgba(0,0,0,.35), 0 0 0 9px rgba(255,200,87,0); }
}
.path-node-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.path-node-body strong { font-size: 15.5px; }
.path-node-sub { font-size: 12.5px; color: var(--ink-dim); letter-spacing: .4px; }
.path-node-start {
  position: absolute; top: -9px; right: 14px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px;
  background: var(--gold); color: #14202e; border-radius: 999px; padding: 3px 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,.4);
}
.path-boss .path-node-circle.boss { width: 60px; height: 60px; font-size: 30px; border-width: 3px; }
.path-boss.open { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(224,120,86,.16), var(--shadow); }
.path-boss.open .path-node-circle { border-color: var(--bad); }
.path-boss.open .path-node-start { background: var(--bad); color: #fff; }
.path-next-world { text-align: center; margin: 22px 0 8px; }

/* ---- boss battle ----------------------------------------------- */
.bossfight .course-stage { padding-top: 8px; }
.boss-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.boss-face { font-size: 44px; flex: none; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); transition: transform .1s ease; }
.boss-face.hit { animation: boss-hit .45s ease; }
.boss-face.beaten { filter: grayscale(.8) drop-shadow(0 4px 10px rgba(0,0,0,.5)); transform: rotate(12deg) scale(.9); }
@keyframes boss-hit {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255,80,60,0)); }
  30% { transform: scale(.86) rotate(-7deg); filter: drop-shadow(0 0 14px rgba(255,80,60,.8)); }
  100% { transform: scale(1); }
}
.boss-meta { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.boss-name { font-family: var(--serif); font-size: 16.5px; }
.boss-hp {
  height: 14px; border-radius: 999px; overflow: hidden;
  background: #081420; border: 1px solid var(--line);
}
.boss-hp-fill {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #d9584e, #e07856);
  transition: width .45s cubic-bezier(.2, .8, .3, 1.2);
}
.boss-hearts { display: flex; gap: 2px; flex: none; }
.boss-hearts .gqheart { width: 14px; height: 14px; }
.boss-intro { text-align: center; padding: 10px 6px; }
.boss-intro h2 { font-size: clamp(24px, 6.5vw, 32px); margin: 8px 0 10px; }
.boss-intro p { color: var(--ink-dim); font-size: 15px; line-height: 1.6; max-width: 46ch; margin: 0 auto 10px; }
.boss-rules {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; font-size: 13.5px !important; color: var(--ink) !important;
}

/* ---- lesson extras: stars, buckets, replay note ----------------- */
.course-stars { font-size: 34px; letter-spacing: 6px; margin: 4px 0 8px; animation: pop .4s ease; }
.course-replay-note { color: var(--gold-soft); font-size: 13.5px; margin-top: 10px; }
.course-sort-item-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 16px; text-align: center; font-size: 17.5px; font-weight: 600;
  margin: 10px 0 14px; min-height: 68px;
  display: flex; align-items: center; justify-content: center;
  animation: fadeUp .18s ease;
}
.course-bucket-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.course-bucket {
  padding: 18px 12px; font-size: 15.5px; font-weight: 700;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px;
  color: var(--ink); cursor: pointer; transition: border-color .12s, transform .12s;
}
.course-bucket:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-2px); }
.course-bucket.right { border-color: var(--good); background: rgba(107,191,115,.14); }
.course-bucket.wrong { border-color: var(--bad); background: rgba(215,106,99,.15); animation: shake .3s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ---- flags: big emoji everywhere they star ---------------------- */
.qm-flag { font-size: 38px; text-align: center; line-height: 1.15; padding: 8px 10px; }
.tl-flag { font-size: 26px; }
.codex-flag { font-size: 34px; line-height: 1.1; }
.codex-hero-flag { font-size: 58px; line-height: 1.1; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }

/* ---- the Atlas glossary ------------------------------------------ */
.gloss-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.gloss-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 3px;
}
.gloss-term { font-family: var(--serif); font-size: 15.5px; color: var(--gold-soft); }
.gloss-def { font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.gloss-ex { font-size: 12.5px; color: var(--muted); font-style: italic; }
