/* ============================================================
   Economics Quest — theme
   Its own identity in the Quest family: a deep "private-bank"
   PLUM with brass-gold, and the bull-green / bear-red duo of the
   market. Same layout shape as the sibling sites (floating side
   docks, world trail, boss), original colors. Mobile-first.
   ============================================================ */
:root {
  --bg: #171320;
  --bg-2: #1e1829;
  --panel: #241d33;
  --panel-2: #2e2540;
  --line: #463b54;
  --well: #0f0b16;
  --ink: #efeaf4;
  --ink-dim: #c6bdd2;
  --muted: #8b8199;
  --gold: #edc24d;
  --gold-soft: #ffdb7a;
  --good: #57c184;
  --bad: #e56a54;
  --heart: #e56a54;
  --bull: #57c184;
  --bear: #e56a54;
  --ink-on-gold: #241633;
  --accent: #edc24d;          /* per-world accent; JS swaps this on :root */
  --accent-soft: color-mix(in srgb, var(--accent) 50%, #ffffff);
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 10px 30px rgba(0,0,0,.4);
  --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;
  --fs: 16px;
}
:root[data-bigtext="1"] { --fs: 19px; }
:root[data-readable="1"] body, :root[data-readable="1"] button,
:root[data-readable="1"] h1, :root[data-readable="1"] h2, :root[data-readable="1"] h3 {
  font-family: Verdana, "Comic Sans MS", Tahoma, sans-serif !important; letter-spacing: .3px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 800px at 50% -10%, #33254a 0%, transparent 60%), var(--bg);
  color: var(--ink); font-family: var(--sans); font-size: var(--fs); line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
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; font-size: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: .1px; line-height: 1.18; }
[tabindex="-1"]:focus { outline: none; }
::selection { background: var(--gold); color: var(--ink-on-gold); }
a { color: var(--gold-soft); }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--gold); color: var(--ink-on-gold); padding: 8px 14px; z-index: 99; border-radius: 0 0 8px 0; font-weight: 700; }
.skip-link:focus { left: 0; }
.seo-fallback { color: var(--ink-dim); max-width: 60ch; margin: 0 auto; }
.mascot-art { display: block; }

/* ---- App bar ------------------------------------------------ */
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: rgba(23,19,32,.88); 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 { display: block; color: var(--gold); }
.chartmark { width: 26px; height: 26px; display: block; filter: drop-shadow(0 0 8px rgba(237,194,77,.5)); }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 17px; }
@media (max-width: 420px) { .brand-name { display: none; } }
.appbar-stats { display: flex; align-items: center; gap: 7px; flex-wrap: nowrap; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--panel); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; font-size: 14px; color: var(--ink-dim); }
.chip b { color: var(--ink); }
.hearts-chip, .coins-chip { display: inline-flex; align-items: center; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; color: var(--ink-dim); }
.hearts-chip:hover, .coins-chip:hover { border-color: var(--gold); }
.heartmark { width: 17px; height: 17px; display: block; }
.coinmark { width: 18px; height: 18px; display: block; }
.coins-chip b { color: var(--gold-soft); }
.streak-flame { filter: drop-shadow(0 0 6px rgba(229,106,84,.5)); }
.level-chip { flex-direction: column; align-items: stretch; gap: 3px; padding: 4px 10px; }
.lvl { font-size: 12px; color: var(--gold-soft); font-weight: 700; text-align: center; }
.lvl-bar { width: 52px; height: 4px; background: var(--well); border-radius: 3px; overflow: hidden; }
.lvl-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); }
.mute-btn { background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim); border-radius: 999px; width: 34px; height: 32px; font-size: 15px; padding: 0; flex: none; }
.mute-btn:hover { border-color: var(--gold); }
/* keep the whole bar on ONE row on phones */
@media (max-width: 500px) {
  .appbar { padding-left: 10px; padding-right: 10px; gap: 6px; }
  .appbar-stats { gap: 4px; }
  .heartmark { width: 14px; height: 14px; }
  .hearts-chip, .coins-chip, .chip { padding: 3px 6px; font-size: 12.5px; gap: 3px; }
  .coinmark { width: 15px; height: 15px; }
  .lvl-bar { width: 34px; } .lvl { font-size: 11px; }
  .mute-btn { width: 28px; height: 28px; font-size: 13px; }
}
@media (max-width: 360px) { .level-chip { display: none; } }

/* ---- Layout ------------------------------------------------- */
.screen { max-width: var(--maxw); margin: 0 auto; padding: 18px 16px calc(44px + env(safe-area-inset-bottom)); animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.section-head { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; margin: 26px 4px 12px; }
.section-head.realm-head { color: var(--gold-soft); text-align: center; letter-spacing: 2px; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 28px; }

.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; font-family: var(--serif); }
.qbest { color: var(--muted); font-size: 13px; white-space: nowrap; }
.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: var(--ink-on-gold); border: 0; font-weight: 700; font-size: 16px; padding: 14px 20px; border-radius: 12px; width: 100%; box-shadow: 0 6px 18px rgba(237,194,77,.25); transition: transform .1s ease, filter .1s ease; }
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: scale(.98); }
.primary:disabled { filter: grayscale(.5) brightness(.7); cursor: default; transform: none; }
.toggle-btn { display: block; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); color: var(--ink); padding: 13px 16px; border-radius: 12px; font-size: 15px; margin: 6px 0; }
.toggle-btn:hover { border-color: var(--gold); }
.danger-btn { display: block; width: 100%; background: rgba(229,106,84,.12); border: 1px solid var(--bad); color: #f2b4a4; padding: 12px 16px; border-radius: 12px; margin: 6px 0; font-size: 15px; font-weight: 600; }
.link-btn { background: none; border: 0; color: var(--gold-soft); text-decoration: underline; padding: 0; font-size: inherit; }
.prose { color: var(--ink-dim); }
.prose h2 { color: var(--gold-soft); margin: 22px 0 8px; font-size: 20px; }
.prose ul { padding-left: 20px; } .prose li { margin: 7px 0; } .prose b { color: var(--ink); }
.muted { color: var(--muted); font-size: 13px; }

/* ---- Home --------------------------------------------------- */
.home-hero { text-align: center; padding: 10px 8px 4px; }
.home-hero-mascots { display: flex; gap: 6px; justify-content: center; margin-bottom: 4px; }
.home-hero-mascots .mascot-art { width: 74px; height: 74px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }
.duo-bull { animation: bob 3.4s ease-in-out infinite; }
.duo-bear { animation: bob 3.4s ease-in-out infinite .6s; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.home-title { font-size: clamp(30px, 8vw, 46px); margin: 4px 0; letter-spacing: .2px; font-weight: 800; }
.home-title::after { content: ""; display: block; width: 42px; height: 2px; margin: 12px auto 0; background: var(--gold); border-radius: 2px; opacity: .8; }
.home-welcome { color: var(--gold-soft); margin: 6px 0 0; font-weight: 600; }
.home-tag { color: var(--muted); margin: 8px auto 14px; max-width: 36ch; font-style: italic; font-family: var(--serif); font-size: 15.5px; }
.hero-market { display: block; width: min(440px, 84%); height: auto; margin: 2px auto 16px; filter: drop-shadow(0 7px 16px rgba(0,0,0,.4)); }

.coach-tile, .daily-tile { position: relative; display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); padding: 16px; color: var(--ink); margin-bottom: 12px; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.coach-tile { background: linear-gradient(120deg, rgba(87,193,132,.14), rgba(229,106,84,.14)), var(--panel); border-color: #5a4a6e; }
.coach-tile:hover, .daily-tile:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow); }
.coach-tile-faces { display: flex; gap: 2px; flex: none; }
.coach-tile-faces .mascot-art { width: 40px; height: 40px; }
.tile-glyph { font-size: 30px; width: 42px; text-align: center; flex: none; }
.tile-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-title { font-family: var(--serif); font-size: 18px; }
.tile-desc { color: var(--ink-dim); font-size: 13.5px; }
.tile-arrow { color: var(--gold); font-size: 22px; flex: none; }
.daily-tile.done { opacity: .8; }
.daily-badge { position: absolute; top: 10px; right: 12px; background: var(--gold); color: var(--ink-on-gold); font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; letter-spacing: .5px; }
.exam-tile { background: linear-gradient(120deg, rgba(237,194,77,.14), transparent), var(--panel); border-color: #5a4a30; }

/* Term of the Week card */
.totw-card { position: relative; display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--ink); margin-bottom: 12px; }
.totw-card:hover { border-color: var(--gold); }
.totw-seal { font-size: 30px; flex: none; }
.totw-label { font-size: 11px; color: var(--gold-soft); text-transform: uppercase; letter-spacing: 1.4px; }
.totw-term { display: block; font-family: var(--serif); font-size: 18px; margin: 2px 0 4px; }
.totw-def { color: var(--ink-dim); font-size: 13.5px; }

/* world cards */
.world-card { position: relative; text-align: left; width: 100%; display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); padding: 16px; color: var(--ink); margin-bottom: 11px; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.world-card:not(.locked):hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.world-card.locked { opacity: .55; }
.world-card.complete { border-left-color: var(--gold); }
.world-glyph { font-size: 32px; flex: none; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.world-body { display: flex; flex-direction: column; gap: 4px; 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: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--accent-soft); background: rgba(255,255,255,.05); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.world-tag { display: block; font-size: 13px; color: var(--ink-dim); margin: 1px 0 0; }
.world-meta { display: block; font-size: 12px; color: var(--muted); margin: 0 0 7px; }
.world-crown { font-size: 20px; flex: none; }

.progress { position: relative; height: 17px; background: var(--well); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); transition: width .5s ease; }
.progress-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; letter-spacing: .4px; color: var(--ink); text-shadow: 0 1px 2px rgba(0,0,0,.75); }

.home-foot { text-align: center; margin-top: 26px; color: var(--muted); }
.home-foot .link-btn { margin: 0 4px; }
.build-stamp { color: #4a3f5c; font-size: 11px; margin-top: 8px; }

/* ---- Floating side docks (arcade left · explore right) ------ */
/* Icons only — no hover labels (those were the stray "subtitles"). Sit well
   below the sticky one-row header so they never merge into it. */
.dock { display: none; }
body.home-active .dock { display: block; }
.dock-rail { position: fixed; top: 90px; z-index: 25; display: flex; flex-direction: column; gap: 12px; }
.dock-left { left: 12px; align-items: flex-start; }
.dock-right { right: 12px; align-items: flex-end; }
.dock-left .dock-btn:nth-child(even) { margin-left: 22px; }
.dock-right .dock-btn:nth-child(even) { margin-right: 22px; }
.dock-btn { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--panel); border: 2px solid var(--line); box-shadow: inset 0 -3px 0 rgba(0,0,0,.28), var(--shadow); transition: transform .12s ease, border-color .12s ease; }
.dock-btn:hover { transform: translateY(-2px); border-color: var(--gold); }
.dock-btn:active { transform: scale(.95); }
.dock-ico { font-size: 27px; line-height: 1; }
@media (max-width: 1080px) { body.home-active .screen { padding-left: 92px; padding-right: 92px; } }
@media (max-width: 760px) {
  .dock-btn { width: 44px; height: 44px; } .dock-ico { font-size: 21px; }
  .dock-rail { top: calc(env(safe-area-inset-top) + 96px); gap: 11px; }
  .dock-left { left: 6px; } .dock-right { right: 6px; }
  .dock-left .dock-btn:nth-child(even), .dock-right .dock-btn:nth-child(even) { margin: 0; }
  body.home-active .screen { padding-left: 52px; padding-right: 52px; }
  .dock-rail { transition: opacity .38s ease, transform .42s cubic-bezier(.2,.75,.25,1), visibility .42s; }
  .dock.dock-attop .dock-left { opacity: 0; visibility: hidden; pointer-events: none; transform: translateX(-80px); }
  .dock.dock-attop .dock-right { opacity: 0; visibility: hidden; pointer-events: none; transform: translateX(80px); }
}

/* ---- Arcade + Explore tiles (in the content flow) ---------- */
.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .game-grid { grid-template-columns: 1fr; } }
.game-tile { display: flex; gap: 12px; align-items: center; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); padding: 15px; color: var(--ink); transition: transform .12s, border-color .12s, box-shadow .12s; }
.game-tile:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow); }
.game-glyph { font-size: 26px; flex: none; }
.game-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.game-body strong { font-family: var(--serif); font-size: 16px; }
.game-desc { color: var(--ink-dim); font-size: 12.5px; }

/* ---- The winding Path (world trail) ------------------------- */
/* Card-row nodes, same shape as the sibling Quests: emoji circle + lesson
   title + blurb, weaving gently left/right — dense, readable, no dead bands. */
.path-hero { text-align: center; padding: 6px 8px 12px; }
.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: 42ch; margin: 0 auto 10px; font-style: italic; font-family: var(--serif); }
.path-progress { max-width: 320px; margin: 0 auto; }
.path-unit { font-size: 13.5px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 1.4px;
  margin: 24px 4px 12px; 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: 13px; text-align: left;
  width: min(440px, 92%); margin: 0 auto 13px;
  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(237,194,77,.16), 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(237,194,77,.35); }
  50% { box-shadow: inset 0 -3px 0 rgba(0,0,0,.35), 0 0 0 9px rgba(237,194,77,0); }
}
.path-node-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.path-node-body strong { font-family: var(--serif); font-size: 15.5px; }
.path-node-sub { font-size: 12.5px; color: var(--ink-dim); letter-spacing: .3px; }
.path-node-start { position: absolute; top: -9px; right: 14px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px;
  background: var(--gold); color: var(--ink-on-gold); 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(229,106,84,.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-boss.done .path-node-circle { border-color: var(--gold); }
.path-next-world { text-align: center; margin: 22px auto 8px; max-width: 440px; }

/* ---- Lesson player ----------------------------------------- */
.course { max-width: 640px; margin: 0 auto; }
.course-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.course-x { background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim); width: 38px; height: 38px; border-radius: 50%; font-size: 16px; flex: none; }
.course-bar { flex: 1; height: 8px; background: var(--well); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.course-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); transition: width .35s ease; }
.course-stage { min-height: 40vh; }
.course-foot { margin-top: 22px; }
.course-next { width: 100%; background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: var(--ink-on-gold); border: 0; padding: 15px; border-radius: 12px; font-weight: 700; font-size: 16px; box-shadow: 0 6px 18px rgba(237,194,77,.25); }
.course-next:disabled { filter: grayscale(.5) brightness(.7); }
.course-chapter { text-align: center; padding: 18px 0; }
.course-chapter-k { color: var(--gold-soft); font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; }
.course-chapter h2 { font-size: 27px; margin: 10px 0; }
.course-chapter p { color: var(--ink-dim); }
.course-replay-note { color: var(--gold-soft); font-size: 14px; }
.course-teach { background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.course-teach-glyph { font-size: 42px; text-align: center; }
.course-teach h3 { font-size: 21px; margin: 8px 0 12px; color: var(--gold-soft); text-align: center; }
.course-teach p { color: var(--ink); font-size: 16px; margin: 10px 0; }
.course-pull { border-left: 3px solid var(--gold); margin: 14px 0 0; padding: 4px 0 4px 14px; color: var(--gold-soft); font-style: italic; font-family: var(--serif); }
.course-q { font-size: clamp(19px, 5vw, 23px); margin: 6px 0 16px; text-align: center; font-family: var(--serif); line-height: 1.35; }
.course-prompt { color: var(--muted); text-align: center; margin: -8px 0 16px; font-size: 14px; }
.course-opts { display: flex; flex-direction: column; gap: 11px; }
.course-opts-wrap { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.course-opt { text-align: left; background: var(--panel); border: 1.5px solid var(--line); color: var(--ink); padding: 15px 16px; border-radius: 13px; font-size: 16px; transition: border-color .12s, background .12s, transform .08s; }
.course-opt:not(:disabled):hover { border-color: var(--accent); background: var(--panel-2); }
.course-opt:not(:disabled):active { transform: scale(.99); }
.course-opt.right { border-color: var(--good); background: rgba(87,193,132,.16); color: #d7f5df; }
.course-opt.wrong { border-color: var(--bad); background: rgba(229,106,84,.15); color: #ffd6cc; }
.course-opt:disabled { cursor: default; }
.course-fill { text-align: center; font-size: 20px; margin: 8px 0 16px; font-family: var(--serif); }
.course-blank { display: inline-block; min-width: 74px; border-bottom: 2px dashed var(--gold); color: var(--gold-soft); padding: 0 4px; }
.course-blank.right { border-bottom-style: solid; color: var(--good); }
.course-chip { background: var(--panel); border: 1.5px solid var(--line); border-bottom-width: 3px; color: var(--ink); padding: 10px 15px; border-radius: 11px; font-size: 15.5px; margin: 4px; font-family: var(--serif); }
.course-chip:not(:disabled):hover { border-color: var(--accent); }
.course-chip.right { border-color: var(--good); background: rgba(87,193,132,.16); }
.course-chip.wrong { border-color: var(--bad); opacity: .6; }
.course-sort { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.course-sort-item { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.course-sort-item.ok { border-color: var(--good); background: rgba(87,193,132,.12); }
.course-sort-item.miss { border-color: var(--bad); background: rgba(229,106,84,.1); }
.course-sort-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--panel-2); color: var(--gold-soft); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.course-sort-name { flex: 1; font-size: 15px; }
.course-sort-moves { display: flex; flex-direction: column; gap: 3px; }
.course-move { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-dim); width: 30px; height: 22px; border-radius: 6px; font-size: 11px; line-height: 1; }
.course-move:disabled { opacity: .3; }
.course-sort-submit { width: 100%; margin-top: 12px; }
.course-match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.course-match-col { display: flex; flex-direction: column; gap: 10px; }
.course-match-cell { background: var(--panel); border: 1.5px solid var(--line); color: var(--ink); padding: 13px 10px; border-radius: 12px; font-size: 14.5px; min-height: 52px; line-height: 1.35; }
.course-match-cell.sel { border-color: var(--gold); background: var(--panel-2); box-shadow: 0 0 0 3px rgba(237,194,77,.18); }
.course-match-cell.done { border-color: var(--good); background: rgba(87,193,132,.14); opacity: .5; border-style: dashed; cursor: default; }
.course-match-cell.miss { border-color: var(--bad); background: rgba(229,106,84,.15); animation: shake .3s ease; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.course-bucket-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.course-bucket { background: var(--panel); border: 2px solid var(--line); color: var(--ink); padding: 20px 12px; border-radius: 14px; font-size: 16px; font-weight: 600; font-family: var(--serif); }
.course-bucket.right { border-color: var(--good); background: rgba(87,193,132,.18); }
.course-bucket.wrong { border-color: var(--bad); background: rgba(229,106,84,.16); }
.course-sort-item-card { text-align: center; font-size: 20px; font-family: var(--serif); background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; padding: 26px 16px; margin: 8px 0; }
.course-fb { margin-top: 16px; padding: 14px 16px; border-radius: 13px; font-size: 14.5px; border: 1px solid var(--line); }
.course-fb.good { border-color: rgba(87,193,132,.5); background: rgba(87,193,132,.08); color: #d7f5df; }
.course-fb.bad { border-color: rgba(229,106,84,.5); background: rgba(229,106,84,.08); color: #ffd6cc; }
.course-fb.neutral { background: var(--panel); color: var(--ink-dim); }
.course-checkpoint-head { text-align: center; margin: 8px 0 16px; }
.course-checkpoint-head span { color: var(--gold-soft); font-size: 13px; }
.course-checkpoint-head h3 { font-size: 19px; margin: 6px 0; }
.course-cp-progress { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.course-cp-done { text-align: center; color: var(--good); font-weight: 700; padding: 16px; font-family: var(--serif); }
.course-out { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(10,7,16,.85); padding: 20px; }
.course-out-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; text-align: center; max-width: 380px; box-shadow: var(--shadow); }
.course-out-heart { width: 46px; margin: 0 auto 8px; } .course-out-heart .heartmark { width: 46px; height: 46px; }
.course-out-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.course-done { text-align: center; padding: 20px 0; }
.course-done-glyph { font-size: 56px; }
.course-done h2 { font-size: 30px; margin: 8px 0; color: var(--gold-soft); }
.course-stars { font-size: 26px; color: var(--gold); letter-spacing: 4px; }
.course-done-msg { color: var(--ink-dim); max-width: 40ch; margin: 8px auto; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 18px auto; max-width: 380px; }
.course-recap { text-align: left; max-width: 420px; margin: 4px auto 0; background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--radius-sm); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.course-recap-k { font-size: 11.5px; color: var(--gold-soft); text-transform: uppercase; letter-spacing: 1.2px; }
.course-recap-item { display: flex; gap: 10px; align-items: flex-start; }
.course-recap-glyph { flex: none; font-size: 18px; line-height: 1.3; }
.course-recap-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.course-recap-body strong { font-family: var(--serif); font-size: 14px; }
.course-recap-quote { color: var(--muted); font-size: 12.5px; font-style: italic; }
.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; align-items: center; }
.stat-num { font-family: var(--serif); font-size: 20px; color: var(--gold-soft); font-weight: 700; }
.stat-lbl { font-size: 11px; color: var(--muted); }
.result-actions { display: flex; flex-direction: column; gap: 10px; max-width: 380px; margin: 16px auto 0; }

/* ---- Boss --------------------------------------------------- */
.boss { max-width: 640px; margin: 0 auto; }
.boss-gate, .boss-intro, .boss-result { text-align: center; padding: 20px 0; }
.boss-face { font-size: 40px; }
.boss-face-big { font-size: 84px; filter: drop-shadow(0 4px 14px rgba(0,0,0,.5)); animation: bossbob 3s ease-in-out infinite; display: inline-block; }
@keyframes bossbob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.boss-face-big.defeated { filter: grayscale(.6) drop-shadow(0 0 14px rgba(87,193,132,.5)); transform: rotate(-8deg); opacity: .85; animation: none; }
.boss-intro h2, .boss-result h2 { font-size: 26px; margin: 10px 0; color: var(--gold-soft); }
.boss-blurb { color: var(--ink-dim); max-width: 46ch; margin: 10px auto; }
.boss-meta { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.boss-stage { padding-top: 6px; }
.boss-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.boss-top .boss-face { font-size: 40px; transition: transform .15s; }
.boss-top .boss-face.hurt { animation: bosshit .4s ease; }
@keyframes bosshit { 0% { transform: scale(1); filter: brightness(2) drop-shadow(0 0 18px rgba(237,194,77,.8)); } 100% { transform: scale(1); } }
.boss-top-bars { flex: 1; }
.boss-name { font-family: var(--serif); font-size: 15px; margin-bottom: 5px; color: var(--gold-soft); }
.boss-hp { height: 14px; background: var(--well); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.boss-hp-fill { height: 100%; background: linear-gradient(90deg, #b0503c, var(--bad)); transition: width .4s ease; }
.boss-hearts { display: flex; gap: 2px; } .boss-hearts .heartmark { width: 18px; height: 18px; }
.boss-round { text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0; }
.boss-q { text-align: center; font-size: 19px; margin: 6px 0 16px; font-family: var(--serif); }
.boss-win { color: var(--ink-dim); max-width: 44ch; margin: 10px auto; font-style: italic; font-family: var(--serif); }
.boss-reward { color: var(--gold-soft); font-weight: 700; margin: 12px 0; }

/* ---- Guide (Value & Cost mascot) --------------------------- */
.guide { position: fixed; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: 74vw; pointer-events: none; }
.guide-hidden { display: none; }
.guide-bubble { display: none; background: var(--panel-2); border: 1px solid var(--gold); border-radius: 14px; padding: 10px 13px; box-shadow: 0 12px 30px rgba(0,0,0,.5); font-size: 13px; max-width: 280px; pointer-events: auto; }
.guide-bubble.show { display: block; animation: fade .2s ease; }
.gb-value, .gb-cost { margin: 3px 0; color: var(--ink-dim); }
.gb-value b { color: var(--bull); } .gb-cost b { color: var(--bear); }
.guide-pair { display: flex; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; box-shadow: 0 6px 16px rgba(0,0,0,.5); pointer-events: auto; transition: transform .12s ease, border-color .12s ease; }
.guide-pair:hover { transform: translateY(-2px); border-color: var(--gold); }
.guide-pair .mascot-art { width: 40px; height: 40px; display: block; }
.guide-pop .guide-pair { animation: bob 1s ease-in-out 2; }
.guide-compact .guide-pair .mascot-art { width: 30px; height: 30px; }
.mascot-art { display: block; max-width: 100%; }

/* ---- Onboarding -------------------------------------------- */
.onboard-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(10,7,16,.86); backdrop-filter: blur(4px); padding: 18px; }
.onboard-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 440px; width: 100%; text-align: center; box-shadow: var(--shadow); max-height: 92vh; overflow: auto; }
.onboard-mascots { display: flex; justify-content: center; gap: 4px; }
.onboard-mascots .mascot-art { width: 72px; height: 72px; }
.onboard-card h2 { font-size: 23px; margin: 8px 0 6px; color: var(--gold-soft); }
.onboard-sub { color: var(--ink-dim); font-size: 14.5px; }
.onboard-label { display: block; text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin: 16px 0 6px; }
.onboard-input { width: 100%; background: var(--bg-2); border: 1.5px solid var(--line); color: var(--ink); border-radius: 12px; padding: 13px; font-size: 16px; text-align: center; }
.onboard-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(237,194,77,.15); }
.onboard-grades { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.onboard-grade { background: var(--bg-2); border: 1.5px solid var(--line); color: var(--ink-dim); border-radius: 11px; padding: 12px 6px; font-size: 13.5px; }
.onboard-grade.sel { border-color: var(--gold); background: rgba(237,194,77,.14); color: var(--ink); font-weight: 700; }
.onboard-note { color: var(--muted); font-size: 12px; margin: 14px 0; }
.onboard-go { width: 100%; }

/* ---- Portfolio --------------------------------------------- */
.pf-hero { text-align: center; margin-bottom: 8px; }
.pf-badge-lvl { display: flex; justify-content: center; gap: 4px; }
.pf-badge-lvl .mascot-art { width: 58px; height: 58px; }
.pf-hero h1 { font-size: 25px; margin: 6px 0 2px; }
.pf-rank { color: var(--gold-soft); font-weight: 600; }
.pf-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
@media (max-width: 460px) { .pf-stats { grid-template-columns: repeat(2, 1fr); } }
.pf-stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; text-align: center; }
.pf-stat-g { display: block; font-size: 20px; }
.pf-stat-num { display: block; font-family: var(--serif); font-size: 18px; color: var(--gold-soft); font-weight: 700; }
.pf-stat-lbl { display: block; font-size: 11px; color: var(--muted); }
.pf-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pf-badge { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px; opacity: .6; filter: saturate(.4); }
.pf-badge.has { opacity: 1; filter: none; border-color: rgba(237,194,77,.4); }
.pf-badge-emoji { font-size: 26px; flex: none; }
.pf-badge-name { display: block; font-family: var(--serif); font-size: 14.5px; color: var(--gold-soft); }
.pf-badge-desc { display: block; color: var(--ink-dim); font-size: 12px; }

/* ---- Arcade / results -------------------------------------- */
.arcade-intro { text-align: center; padding: 24px 0; }
.arcade-glyph { font-size: 54px; }
.arcade-intro h1 { font-size: 28px; margin: 8px 0; color: var(--gold-soft); }
.arcade-intro p { color: var(--ink-dim); max-width: 42ch; margin: 8px auto 18px; }
.arcade-hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-family: var(--serif); position: relative; }
.arcade-score { color: var(--gold-soft); font-weight: 700; }
.arcade-time { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-weight: 700; }
.arcade-combo { color: var(--bear); font-weight: 700; min-width: 46px; text-align: right; }
.arcade-q { text-align: center; font-size: 20px; margin: 8px 0 16px; font-family: var(--serif); }
.arcade-pop { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); color: var(--good); font-family: var(--serif); font-weight: 800; font-size: 30px; pointer-events: none; z-index: 5; animation: popup .7s ease forwards; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
@keyframes popup { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.7); } 30% { opacity: 1; transform: translate(-50%, -6px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -40px) scale(1); } }
.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: 32px; margin: 6px 0 2px; color: var(--gold-soft); }
.result-verdict { color: var(--ink-dim); margin: 8px auto; max-width: 42ch; }

/* ---- Bull or Bear game ------------------------------------- */
.bob-card { background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 30px 20px; text-align: center; margin: 8px 0 16px; min-height: 150px; display: flex; flex-direction: column; justify-content: center; transition: border-color .15s, background .15s; }
.bob-card.bob-right { border-color: var(--good); background: rgba(87,193,132,.16); }
.bob-card.bob-wrong { border-color: var(--bad); background: rgba(229,106,84,.15); animation: shake .3s ease; }
.bob-head { color: var(--gold-soft); font-size: 13px; text-transform: uppercase; letter-spacing: 1.4px; }
.bob-text { font-family: var(--serif); font-size: clamp(20px, 5.5vw, 26px); line-height: 1.3; margin: 12px 0 0; }
.bob-fb { text-align: center; color: var(--ink-dim); font-size: 14px; min-height: 20px; margin-bottom: 12px; opacity: 0; transition: opacity .15s; }
.bob-fb.show { opacity: 1; }
.bob-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bob-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 12px; border-radius: 16px; font-family: var(--serif); font-size: 18px; font-weight: 700; border: 2px solid var(--line); color: var(--ink); background: var(--panel); transition: transform .08s, border-color .12s, background .12s; }
.bob-btn:active { transform: scale(.96); }
.bob-emoji { font-size: 40px; line-height: 1; }
.bob-bull:hover { border-color: var(--bull); background: rgba(87,193,132,.14); }
.bob-bear:hover { border-color: var(--bear); background: rgba(229,106,84,.14); }

/* ---- Equilibrium game -------------------------------------- */
.eq-wrap { max-width: 520px; margin: 0 auto; }
.eq-wrap.eq-clearflash { animation: eqflash .5s ease; }
@keyframes eqflash { 0%,100% { filter: none; } 40% { filter: drop-shadow(0 0 16px rgba(87,193,132,.6)); } }
.eq-readout { text-align: center; margin-bottom: 14px; }
.eq-price { font-family: var(--serif); font-size: 26px; color: var(--gold-soft); font-weight: 700; }
.eq-qty { color: var(--ink-dim); font-size: 14px; }
.eq-bars { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.eq-bar-row { display: flex; align-items: center; gap: 10px; }
.eq-bar-label { flex: none; width: 84px; font-size: 13px; color: var(--ink-dim); }
.eq-bar-track { flex: 1; height: 22px; background: var(--well); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.eq-bar-fill { height: 100%; border-radius: 8px 0 0 8px; transition: width .18s ease; }
.eq-bar-val { flex: none; width: 34px; text-align: right; font-weight: 700; font-size: 14px; }
.eq-label { display: block; text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0 8px; }
.eq-slider { width: 100%; accent-color: var(--gold); height: 30px; }
.eq-status { margin-top: 14px; padding: 13px; border-radius: 12px; text-align: center; font-size: 14.5px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim); }
.eq-status.eq-ok { border-color: var(--good); background: rgba(87,193,132,.16); color: #d7f5df; font-weight: 700; }
.eq-status.eq-short { border-color: var(--bear); color: #ffd6cc; }
.eq-status.eq-surplus { border-color: #6f97d0; color: #d6e4ff; }

/* ---- Coach (Value & Cost chat) ----------------------------- */
.coach-hero { text-align: center; margin-bottom: 14px; }
.coach-avatars { display: flex; gap: 10px; align-items: center; justify-content: center; }
.coach-avatars .mascot-art { width: 56px; height: 56px; }
.coach-vs { font-size: 15px; color: var(--muted); font-style: italic; font-family: var(--serif); }
.coach-bull { animation: bob 3.4s ease-in-out infinite; }
.coach-bear { animation: bob 3.4s ease-in-out infinite .6s; }
.coach-hero h1 { font-size: 26px; margin: 6px 0; color: var(--gold-soft); }
.coach-hero p { color: var(--ink-dim); max-width: 46ch; margin: 6px auto; font-size: 14.5px; }
.coach-topics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 460px) { .coach-topics { grid-template-columns: 1fr; } }
.coach-topic { display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 12px; padding: 15px; font-size: 14.5px; text-align: left; }
.coach-topic:hover { border-color: var(--gold); }
.coach-topic-emoji { font-size: 22px; }
.coach-note { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 16px; }
.coach-log { display: flex; flex-direction: column; gap: 12px; padding: 6px 2px 14px; min-height: 40vh; }
.coach-msg { max-width: 90%; }
.coach-user { align-self: flex-end; background: var(--panel-2); border: 1px solid var(--accent); color: var(--ink); padding: 11px 14px; border-radius: 14px 14px 4px 14px; font-size: 14.5px; }
.coach-ai { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.coach-voice { font-size: 14.5px; line-height: 1.5; padding-left: 8px; }
.coach-voice-tag { font-weight: 800; margin-right: 5px; font-family: var(--serif); }
.coach-value { border-left: 2px solid rgba(87,193,132,.6); } .coach-value .coach-voice-tag { color: var(--bull); }
.coach-cost { border-left: 2px solid rgba(229,106,84,.6); } .coach-cost .coach-voice-tag { color: var(--bear); }
.coach-both { border-left: 2px solid rgba(237,194,77,.6); } .coach-both .coach-voice-tag { color: var(--gold-soft); }
.coach-typing .coach-dots { font-size: 18px; letter-spacing: 2px; animation: pulse2 1.2s ease-in-out infinite; }
@keyframes pulse2 { 0%,100% { opacity: .4; } 50% { opacity: 1; } }
.coach-input { display: flex; gap: 8px; position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--bg) 30%); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
.coach-field { flex: 1; background: var(--bg-2); border: 1.5px solid var(--line); color: var(--ink); border-radius: 999px; padding: 13px 16px; font-size: 15px; }
.coach-field:focus { outline: none; border-color: var(--gold); }
.coach-send { width: auto; padding: 12px 18px; }

/* ---- Ledger (glossary) ------------------------------------- */
.ledger-hero { text-align: center; margin-bottom: 12px; }
.ledger-glyph { font-size: 44px; }
.ledger-hero h1 { font-size: 26px; margin: 6px 0 4px; color: var(--gold-soft); }
.ledger-hero p { color: var(--ink-dim); font-size: 14px; max-width: 44ch; margin: 0 auto; }
.ledger-search { width: 100%; background: var(--bg-2); border: 1.5px solid var(--line); color: var(--ink); border-radius: 12px; padding: 13px 16px; font-size: 15px; margin-bottom: 16px; }
.ledger-search:focus { outline: none; border-color: var(--gold); }
.ledger-cat { font-size: 13px; color: var(--gold-soft); text-transform: uppercase; letter-spacing: 1.4px; margin: 18px 2px 8px; }
.ledger-entry { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.ledger-term { display: block; font-family: var(--serif); font-size: 16px; color: var(--ink); }
.ledger-def { display: block; color: var(--ink-dim); font-size: 13.5px; margin-top: 3px; }
.ledger-empty { color: var(--muted); text-align: center; padding: 20px; }

/* ---- Certificate ------------------------------------------- */
.cert { max-width: 560px; margin: 0 auto; }
.cert-inner { background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 3px double var(--gold); border-radius: 14px; padding: 30px 26px; text-align: center; box-shadow: var(--shadow); }
.cert-seal { font-size: 40px; letter-spacing: 4px; }
.cert-kicker { color: var(--muted); font-size: 13px; margin: 10px 0 4px; font-family: var(--serif); }
.cert-name { font-size: 30px; color: var(--gold-soft); margin: 4px 0; }
.cert-body { color: var(--ink-dim); font-size: 14px; max-width: 42ch; margin: 12px auto; }
.cert-title { color: var(--muted); margin: 10px 0 2px; }
.cert-rank { font-size: 30px; letter-spacing: 4px; color: var(--good); margin: 2px 0 14px; }
.cert-foot { display: flex; justify-content: space-around; margin: 20px 0 6px; }
.cert-sig { font-size: 14px; }
.cert-sig hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.cert-sig small { color: var(--muted); }
.cert-date { color: var(--muted); font-size: 12px; margin-top: 14px; }

/* ---- Toasts + confetti ------------------------------------- */
#toast-host { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 480px); }
.toast { background: var(--panel-2); border: 1px solid var(--gold); color: var(--ink); padding: 11px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; text-align: center; }
.toast.show { opacity: 1; transform: none; }
.confetti-host { position: fixed; inset: 0; z-index: 80; pointer-events: none; overflow: hidden; }
.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; } }

/* ---- Value & Cost chat drawer (Ponder-style) --------------- */
.guide.tucked { opacity: 0; pointer-events: none; }
.guide-quiet .guide-pair { pointer-events: none; opacity: .85; cursor: default; }
.guide-veil { position: fixed; inset: 0; z-index: 58; background: rgba(8,6,14,.5); }
.guide-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,.6);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); transform: translateY(106%); transition: transform .28s ease; }
.guide-drawer.open { transform: translateY(0); }
.guide-d-head { display: flex; align-items: center; gap: 10px; }
.guide-d-faces { display: flex; } .guide-d-faces .mascot-art { width: 34px; height: 34px; }
.guide-d-title { display: flex; flex-direction: column; line-height: 1.2; }
.guide-d-title strong { font-family: var(--serif); font-size: 16.5px; color: var(--gold-soft); }
.guide-d-title span { font-size: 11.5px; color: var(--muted); }
.guide-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; }
.guide-d-x:hover { border-color: var(--gold); color: var(--ink); }
.guide-greet { margin: 8px 0; font-size: 13.5px; line-height: 1.5; font-style: italic; }
.guide-greet .gv { color: var(--bull); } .guide-greet .gc { color: var(--bear); }
.guide-msgs { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 40vh; margin-bottom: 10px; overscroll-behavior: contain; }
.guide-msg { padding: 8px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; max-width: 88%; white-space: pre-wrap; }
.guide-msg.me { align-self: flex-end; background: rgba(237,194,77,.15); border: 1px solid rgba(237,194,77,.4); }
.guide-msg.ai { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.guide-msg.typing { align-self: flex-start; color: var(--muted); letter-spacing: 2px; }
.guide-voice { padding-left: 8px; }
.gv-value { border-left: 2px solid rgba(87,193,132,.6); } .gv-value .gv-tag { color: var(--bull); }
.gv-cost { border-left: 2px solid rgba(229,106,84,.6); } .gv-cost .gv-tag { color: var(--bear); }
.gv-both { border-left: 2px solid rgba(237,194,77,.6); } .gv-both .gv-tag { color: var(--gold-soft); }
.gv-tag { font-weight: 800; font-family: var(--serif); margin-right: 5px; }
.guide-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.guide-chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim); padding: 6px 11px; border-radius: 999px; font-size: 12.5px; }
.guide-chip:hover { border-color: var(--gold); color: var(--ink); }
.guide-inrow { display: flex; gap: 8px; }
.guide-in { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); font-size: 14px; }
.guide-in:focus { outline: none; border-color: var(--gold); }
.guide-send { border: 0; border-radius: 12px; padding: 11px 18px; background: var(--gold); color: var(--ink-on-gold); font-weight: 700; font-size: 14px; }
.guide-send:disabled { opacity: .55; }

/* ---- The Exchange (stock market) --------------------------- */
.exchange-tile { background: linear-gradient(120deg, rgba(87,193,132,.12), transparent), var(--panel); border-color: #3d6a52; }
.exch-head { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 4px; }
.exch-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.exch-net { border-color: rgba(237,194,77,.45); }
.exch-stat-num { font-family: var(--serif); font-size: clamp(13px, 3.6vw, 17px); font-weight: 700; color: var(--gold-soft); }
.exch-stat-num.up { color: var(--good); } .exch-stat-num.down { color: var(--bad); }
.exch-stat-lbl { font-size: 10px; color: var(--muted); }
.exch-note { text-align: center; color: var(--muted); font-size: 12.5px; margin: 8px 0 14px; }
.exch-list { display: flex; flex-direction: column; gap: 8px; }
.exch-item { display: flex; flex-direction: column; }
.exch-row { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.exch-row:hover { border-color: var(--gold); }
.exch-item.open .exch-row { border-radius: 12px 12px 0 0; border-bottom-color: transparent; }
.exch-detail { display: none; background: var(--bg-2); border: 1px solid var(--line); border-top: 1px dashed var(--line); border-radius: 0 0 12px 12px; padding: 10px 12px 12px; flex-direction: column; gap: 8px; }
.exch-item.open .exch-detail { display: flex; }
.exch-spark { width: 100%; height: 48px; display: block; background: var(--well); border-radius: 8px; }
.exch-spark-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.exch-spark-line.up { stroke: var(--good); } .exch-spark-line.down { stroke: var(--bad); }
.exch-range { text-align: center; color: var(--muted); font-size: 11.5px; }
.exch-trade { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.exch-emoji { font-size: 26px; flex: none; }
.exch-co { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.exch-name { font-family: var(--serif); font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exch-tkr { font-size: 11px; color: var(--muted); }
.exch-pricebox { display: flex; flex-direction: column; align-items: flex-end; flex: none; min-width: 72px; }
.exch-price { font-family: var(--serif); font-weight: 700; font-size: 15px; color: var(--ink); }
.exch-chg { font-size: 11.5px; font-weight: 700; }
.exch-chg.up { color: var(--good); } .exch-chg.down { color: var(--bad); }
.exch-actions { display: flex; gap: 6px; flex: none; }
.exch-btn { border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; font-size: 13px; font-weight: 700; }
.exch-buy { background: rgba(87,193,132,.16); border-color: var(--good); color: #d7f5df; }
.exch-sell { background: rgba(229,106,84,.14); border-color: var(--bad); color: #ffd6cc; }
.exch-btn:disabled { opacity: .3; cursor: default; }
@media (max-width: 430px) { .exch-emoji { font-size: 21px; } .exch-name { font-size: 13px; } .exch-btn { padding: 8px 8px; } .exch-actions { gap: 4px; } }

/* ---- Equilibrium graph ------------------------------------- */
.eq-graph { width: 100%; max-width: 420px; display: block; margin: 0 auto 8px; background: var(--well); border: 1px solid var(--line); border-radius: 12px; touch-action: none; cursor: crosshair; }
.eq-probe-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.eq-probe-dot { fill: none; stroke: var(--gold-soft); stroke-width: 2; }
.eq-probe-txt { fill: var(--gold-soft); font-size: 11px; font-weight: 700; paint-order: stroke; stroke: rgba(15,11,22,.85); stroke-width: 3px; }
.eq-grid { stroke: var(--line); stroke-width: 1; opacity: .4; }
.eq-axis { stroke: var(--muted); stroke-width: 1.5; }
.eq-tick { fill: var(--muted); font-size: 9px; }
.eq-axtitle { fill: var(--ink-dim); font-size: 11px; }
.eq-demand { stroke: var(--good); stroke-width: 3; }
.eq-supply { stroke: var(--bad); stroke-width: 3; }
.eq-dlabel { fill: var(--good); font-size: 11px; font-weight: 700; }
.eq-slabel { fill: var(--bad); font-size: 11px; font-weight: 700; }
.eq-guide { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 3; opacity: .85; }
.eq-dot { fill: var(--gold); stroke: var(--ink-on-gold); stroke-width: 1.5; }
.eq-marker { transition: opacity .3s ease; }
.eq-entry { display: flex; gap: 14px; justify-content: center; margin: 10px 0; }
.eq-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); align-items: center; text-align: center; }
.eq-input { width: 96px; text-align: center; background: var(--bg-2); border: 1.5px solid var(--line); color: var(--ink); border-radius: 10px; padding: 11px; font-size: 19px; font-family: var(--serif); }
.eq-input:focus { outline: none; border-color: var(--gold); }
.eq-submit { max-width: 340px; margin: 8px auto 0; }

/* ---- Reduced motion + print -------------------------------- */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  .appbar, .guide, #toast-host, .game-top { display: none !important; }
  body { background: #fff; color: #111; }
  .cert-inner { border-color: #b8891f; background: #fff; color: #222; }
  .cert-name, .cert-rank { color: #6a4a1a; }
}
