/* =========================================================
   MISSION READY — Styles
   Design laws: calm, high-contrast-capable, one focus per
   screen, 44px+ targets, max 60ch reading width, soft motion.
   ========================================================= */

:root {
  --bg: #0f1420;
  --bg-soft: #171e2e;
  --card: #1d2536;
  --card-raise: #242e44;
  --line: #2e3a55;
  --text: #eef2f9;
  --text-dim: #9fadc8;
  --accent: #4da3ff;
  --accent-soft: rgba(77, 163, 255, 0.15);
  --good: #3ddc84;
  --good-soft: rgba(61, 220, 132, 0.14);
  --warm: #ffb454;
  --warm-soft: rgba(255, 180, 84, 0.14);
  --forge: #ff7849;
  --ops: #4da3ff;
  --armory: #b18cff;
  --intel: #3ddc84;
  --radius: 16px;
  --font-scale: 1;
  --letter-sp: 0em;
  --line-h: 1.55;
  --word-sp: normal;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

html[data-textsize="large"] { --font-scale: 1.15; }
html[data-textsize="xl"]    { --font-scale: 1.3; }
html[data-easyread="on"]    { --letter-sp: 0.04em; --line-h: 1.9; --word-sp: 0.12em; }
html[data-contrast="high"] {
  --bg: #000; --bg-soft: #0a0a0a; --card: #101010; --card-raise: #181818;
  --line: #555; --text: #fff; --text-dim: #cfcfcf; --accent: #6cb8ff;
}
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  animation: none !important; transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: calc(17px * var(--font-scale));
  letter-spacing: var(--letter-sp);
  word-spacing: var(--word-sp);
  line-height: var(--line-h);
  min-height: 100vh;
}

.app { max-width: 860px; margin: 0 auto; padding: 0 16px 60px; }

button { font: inherit; color: inherit; cursor: pointer; letter-spacing: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; position: sticky; top: 0; z-index: 20;
  background: linear-gradient(var(--bg) 80%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; border: none; background: none; }
.brand-mark { font-size: 1.8em; }
.brand-title { font-weight: 800; letter-spacing: 0.06em; font-size: 0.95em; }
.brand-sub { color: var(--text-dim); font-size: 0.78em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.streak-chip {
  background: var(--warm-soft); color: var(--warm); border-radius: 999px;
  padding: 6px 12px; font-weight: 700; font-size: 0.9em; min-width: 44px; text-align: center;
}
.xpbar-wrap { width: 110px; }
.xpbar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.xpbar-fill { height: 100%; background: var(--accent); border-radius: 99px; width: 0%; transition: width 0.6s ease; }
.xpbar-label { font-size: 0.68em; color: var(--text-dim); text-align: center; margin-top: 2px; }
.icon-btn {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  min-width: 44px; min-height: 44px; font-size: 1.1em;
}
.icon-btn:hover { background: var(--card-raise); }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 14px;
  padding: 12px 20px; min-height: 48px; font-weight: 600;
}
.btn:hover { background: var(--card-raise); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0b1220; }
.btn-primary:hover { filter: brightness(1.1); background: var(--accent); }
.btn-big { font-size: 1.15em; padding: 16px 28px; width: 100%; margin-top: 18px; }
.btn-ghost { background: transparent; }
.btn-back { background: transparent; border: none; color: var(--text-dim); font-size: 1em; padding: 10px 8px; }
.btn-back:hover { color: var(--text); background: transparent; }
.btn-small { min-height: 40px; }

/* ---------- Screens ---------- */
.screen { animation: fadeUp 0.35s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.screen-head { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; }
.screen-head h1 { font-size: 1.5em; }

/* ---------- Welcome ---------- */
.welcome-card {
  max-width: 480px; margin: 8vh auto 0; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 36px 30px; text-align: center; box-shadow: var(--shadow);
}
.welcome-emoji { font-size: 3em; }
.welcome-card h1 { margin: 10px 0 6px; font-size: 1.6em; }
.welcome-sub { color: var(--text-dim); margin-bottom: 26px; }
.name-label { display: block; text-align: left; margin-bottom: 6px; color: var(--text-dim); font-size: 0.9em; }
#name-input {
  width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text); font: inherit; font-size: 1.1em;
}
.welcome-note { margin-top: 18px; color: var(--text-dim); font-size: 0.85em; }

/* ---------- Home ---------- */
.home-head { margin: 18px 0 14px; }
.home-head h1 { font-size: 1.6em; }
.home-sub { color: var(--text-dim); }
.mission-cards { display: grid; gap: 14px; }
.mission-card {
  display: flex; align-items: center; gap: 16px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; width: 100%; box-shadow: var(--shadow);
}
.mission-card:hover:not(.done) { background: var(--card-raise); transform: translateY(-2px); transition: all 0.15s ease; }
.mission-card .mc-icon { font-size: 2em; }
.mission-card .mc-body { flex: 1; }
.mission-card .mc-title { font-weight: 700; font-size: 1.05em; }
.mission-card .mc-hook { color: var(--text-dim); font-size: 0.88em; }
.mission-card .mc-meta { color: var(--text-dim); font-size: 0.8em; white-space: nowrap; }
.mission-card.done { opacity: 0.6; }
.mission-card.done .mc-meta { color: var(--good); font-weight: 700; }
.home-footer { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.daily-done { margin-top: 22px; }
.daily-done-inner {
  background: var(--good-soft); border: 1px solid var(--good); border-radius: var(--radius);
  padding: 16px 20px; color: var(--good);
}

/* ---------- Worlds ---------- */
.worlds-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.world-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; text-align: left; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.world-card:hover { background: var(--card-raise); transform: translateY(-2px); transition: all 0.15s ease; }
.world-card .w-icon { font-size: 2.2em; }
.world-card .w-name { font-weight: 800; font-size: 1.15em; margin-top: 6px; }
.world-card .w-sub { color: var(--text-dim); font-size: 0.82em; }
.world-card .w-bar { height: 8px; background: var(--line); border-radius: 99px; margin-top: 14px; overflow: hidden; }
.world-card .w-fill { height: 100%; border-radius: 99px; transition: width 0.6s ease; }
.world-card .w-pct { font-size: 0.78em; color: var(--text-dim); margin-top: 4px; }
.w-fill.forge { background: var(--forge); } .w-fill.ops { background: var(--ops); }
.w-fill.armory { background: var(--armory); } .w-fill.intel { background: var(--intel); }

.world-tagline { color: var(--text-dim); margin: 4px 0 16px; }
.skills-list { display: grid; gap: 10px; }
.skill-row {
  display: flex; align-items: center; gap: 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; width: 100%; text-align: left;
}
.skill-row:hover:not(.locked) { background: var(--card-raise); }
.skill-row.locked { opacity: 0.45; cursor: default; }
.skill-row .s-icon { font-size: 1.5em; }
.skill-row .s-body { flex: 1; }
.skill-row .s-name { font-weight: 700; }
.skill-row .s-stars { font-size: 0.85em; letter-spacing: 0.15em; }
.skill-row .s-bar { height: 6px; background: var(--line); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.skill-row .s-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.skill-row .s-m { color: var(--text-dim); font-size: 0.8em; min-width: 40px; text-align: right; }

/* ---------- Mission player ---------- */
.mission-top { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.mission-progress { flex: 1; display: flex; gap: 6px; justify-content: center; }
.mp-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.mp-dot.now { background: var(--accent); transform: scale(1.25); }
.mp-dot.done { background: var(--good); }

.mission-stage { max-width: 620px; margin: 4vh auto 0; }
.stage-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); animation: fadeUp 0.3s ease;
}
.stage-label { color: var(--text-dim); font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 10px; }
.stage-visual { font-size: 2.4em; margin-bottom: 8px; }
.stage-passage {
  background: var(--bg-soft); border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 14px 16px; margin-bottom: 16px; max-width: 60ch; font-size: 0.98em;
}
.stage-stem { font-size: 1.2em; font-weight: 700; margin-bottom: 18px; max-width: 60ch; }
.choices { display: grid; gap: 10px; }
.choice-btn {
  text-align: left; background: var(--bg-soft); border: 2px solid var(--line);
  border-radius: 14px; padding: 14px 18px; font-size: 1.05em; min-height: 52px;
  display: flex; align-items: center; gap: 12px;
}
.choice-btn:hover:not(:disabled) { border-color: var(--accent); }
.choice-btn:disabled { cursor: default; }
.choice-btn .ck { color: var(--text-dim); font-weight: 700; font-size: 0.85em; }
.choice-btn.correct { border-color: var(--good); background: var(--good-soft); }
.choice-btn.picked-wrong { border-color: var(--warm); background: var(--warm-soft); }
.choice-btn.dim { opacity: 0.45; }

.hint-row { margin-top: 14px; display: flex; gap: 10px; }
.hint-box {
  margin-top: 12px; background: var(--accent-soft); border-radius: 12px; padding: 12px 16px;
  color: var(--accent); font-size: 0.95em; animation: fadeUp 0.25s ease;
}
.feedback {
  margin-top: 18px; border-radius: 14px; padding: 16px 18px; animation: fadeUp 0.3s ease;
}
.feedback.good { background: var(--good-soft); border: 1px solid var(--good); }
.feedback.coach { background: var(--warm-soft); border: 1px solid var(--warm); }
.feedback .fb-head { font-weight: 800; margin-bottom: 6px; }
.feedback.good .fb-head { color: var(--good); }
.feedback.coach .fb-head { color: var(--warm); }
.feedback .fb-why { max-width: 60ch; }
.feedback .fb-again { color: var(--text-dim); font-size: 0.85em; margin-top: 8px; }

/* Lesson card */
.lesson-lines { max-width: 60ch; display: grid; gap: 10px; margin-bottom: 18px; }
.lesson-example {
  background: var(--bg-soft); border-radius: 12px; padding: 16px 18px; display: grid; gap: 8px;
  max-width: 60ch;
}
.lesson-example .ex-step { display: flex; gap: 10px; align-items: baseline; }
.lesson-example .ex-n {
  background: var(--accent); color: #0b1220; border-radius: 50%; min-width: 22px; height: 22px;
  font-size: 0.75em; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.lesson-key {
  margin-top: 16px; font-weight: 800; color: var(--accent); background: var(--accent-soft);
  border-radius: 12px; padding: 12px 16px; max-width: 60ch;
}
.stage-next { margin-top: 22px; width: 100%; }

/* Debrief */
.debrief { text-align: center; }
.debrief .db-emoji { font-size: 3.2em; animation: pop 0.5s ease; }
@keyframes pop { 0% { transform: scale(0.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
.debrief h2 { margin: 8px 0 4px; }
.debrief .db-praise { color: var(--text-dim); max-width: 46ch; margin: 0 auto 18px; }
.db-stats { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.db-stat {
  background: var(--bg-soft); border-radius: 12px; padding: 12px 18px; min-width: 90px;
}
.db-stat .v { font-size: 1.4em; font-weight: 800; color: var(--accent); }
.db-stat .k { font-size: 0.75em; color: var(--text-dim); }
.db-teaser { color: var(--text-dim); font-size: 0.9em; margin-top: 14px; }

/* ---------- Armory ---------- */
.armory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.armory-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  text-align: center;
}
.armory-item .a-word { font-weight: 800; color: var(--armory); }
.armory-item .a-def { font-size: 0.78em; color: var(--text-dim); }
.armory-empty { color: var(--text-dim); padding: 30px 0; }

/* ---------- Coach ---------- */
.coach-grid { display: grid; gap: 14px; margin-top: 12px; }
.coach-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.coach-card h3 { font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 12px; }
.coach-bignum { font-size: 1.9em; font-weight: 800; }
.coach-bignum small { font-size: 0.5em; color: var(--text-dim); font-weight: 600; }
.coach-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.coach-row .cr-label { min-width: 150px; font-size: 0.9em; }
.coach-row .cr-bar { flex: 1; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.coach-row .cr-fill { height: 100%; border-radius: 99px; background: var(--accent); }
.coach-row .cr-val { min-width: 44px; text-align: right; font-size: 0.85em; color: var(--text-dim); }
.coach-tip { background: var(--bg-soft); border-radius: 12px; padding: 12px 16px; margin: 8px 0; font-size: 0.95em; }
.estimate-band { font-size: 1.5em; font-weight: 800; color: var(--accent); }
.estimate-note { color: var(--text-dim); font-size: 0.85em; margin-top: 6px; max-width: 60ch; }
.coach-actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Settings ---------- */
.settings-list { display: grid; gap: 12px; margin-top: 12px; max-width: 560px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px;
}
.setting-row .st-label { font-weight: 600; }
.setting-row .st-desc { color: var(--text-dim); font-size: 0.82em; }
.seg { display: flex; gap: 6px; }
.seg button {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; min-height: 40px; font-size: 0.9em;
}
.seg button.on { background: var(--accent); border-color: var(--accent); color: #0b1220; font-weight: 700; }

/* ---------- Toasts ---------- */
.toast-layer { position: fixed; bottom: 20px; left: 0; right: 0; display: grid; gap: 8px; justify-items: center; z-index: 50; pointer-events: none; }
.toast {
  background: var(--card-raise); border: 1px solid var(--accent); border-radius: 14px;
  padding: 14px 22px; box-shadow: var(--shadow); animation: toastIn 0.4s ease; font-weight: 700;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.toast.badge-toast { border-color: var(--warm); color: var(--warm); }

/* ---------- Celebration layer (v1.5) ---------- */
.confetti-piece {
  position: fixed; top: -14px; z-index: 100; pointer-events: none;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(680deg); opacity: 0.7; }
}

.combo-chip {
  display: inline-block; margin-top: 8px; padding: 6px 14px; border-radius: 999px;
  background: var(--warm-soft); color: var(--warm); font-weight: 800; font-size: 0.9em;
  animation: pop 0.4s ease;
}

.promotion {
  margin: 18px auto 6px; padding: 18px 22px; border-radius: 16px; max-width: 420px;
  background: linear-gradient(135deg, rgba(255,180,84,0.18), rgba(77,163,255,0.18));
  border: 2px solid var(--warm); animation: pop 0.6s ease;
}
.promo-stars { font-size: 1.8em; }
.promo-title { font-weight: 900; letter-spacing: 0.2em; color: var(--warm); font-size: 1.2em; margin: 4px 0; }
.promo-rank { color: var(--text); }
.promo-rank strong { color: var(--warm); }

.supply-drop {
  margin: 18px auto 6px; padding: 18px 22px; border-radius: 16px; max-width: 460px;
  background: var(--bg-soft); border: 2px dashed var(--accent); animation: fadeUp 0.5s ease;
}
.sd-head { font-weight: 800; color: var(--accent); letter-spacing: 0.08em; font-size: 0.85em; }
.sd-icon { font-size: 2.6em; margin: 8px 0; animation: pop 0.6s ease; }
.sd-fact { max-width: 46ch; margin: 0 auto; font-size: 0.95em; }
.sd-xp { margin-top: 10px; font-weight: 800; color: var(--good); }

.mom-note {
  margin: 18px auto 6px; padding: 18px 22px; border-radius: 16px; max-width: 460px;
  background: rgba(177, 140, 255, 0.12); border: 1px solid var(--armory);
  text-align: left; animation: fadeUp 0.6s ease;
}
.mn-head { font-weight: 800; color: var(--armory); margin-bottom: 8px; font-size: 0.85em; letter-spacing: 0.08em; }
.mn-text { font-style: italic; line-height: 1.7; max-width: 50ch; }

@media (max-width: 560px) {
  .xpbar-wrap { display: none; }
  .stage-card { padding: 20px; }
  .coach-row .cr-label { min-width: 110px; font-size: 0.8em; }
}

/* ---------- Boss Battles + Recursive Engine (v1.8) ---------- */
.boss-bar {
  display: flex; align-items: center; gap: 14px; max-width: 620px; margin: 0 auto 14px;
  background: linear-gradient(135deg, rgba(255,120,73,0.14), rgba(177,140,255,0.14));
  border: 2px solid var(--forge); border-radius: 16px; padding: 12px 18px;
}
.boss-face { font-size: 2.2em; }
.boss-info { flex: 1; }
.boss-name { font-weight: 900; letter-spacing: 0.04em; display: block; }
.boss-hp { display: flex; gap: 5px; margin-top: 6px; }
.hp-seg { height: 12px; flex: 1; max-width: 60px; border-radius: 4px; display: inline-block; }
.hp-seg.full { background: var(--forge); box-shadow: 0 0 8px rgba(255,120,73,0.5); }
.hp-seg.hit { background: var(--line); opacity: 0.5; }
.boss-hit { font-weight: 900; color: var(--forge); margin-bottom: 8px; animation: pop 0.4s ease; }
.boss-hit.blocked { color: var(--text-dim); }

.boss-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  margin-top: 14px; padding: 16px 18px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,120,73,0.12), rgba(77,163,255,0.10));
  border: 2px solid var(--forge); font: inherit; color: inherit;
}
.boss-row:hover:not(.locked) { transform: translateY(-2px); transition: all 0.15s ease; box-shadow: 0 0 18px rgba(255,120,73,0.25); }
.boss-row.locked { opacity: 0.5; border-color: var(--line); background: var(--card); cursor: default; }
.boss-row .s-name { font-weight: 900; letter-spacing: 0.03em; }
.boss-taunt { color: var(--text-dim); font-style: italic; font-size: 0.85em; }

.cause-row { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cause-label { width: 100%; color: var(--text-dim); font-size: 0.82em; }
.cause-btn {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: 0.85em; min-height: 40px;
}
.cause-btn:hover { border-color: var(--accent); }

/* ---------- Records / Memory Engine (v1.9) ---------- */
.records-grid { display: grid; gap: 10px; margin-top: 14px; max-width: 560px; }
.record-row {
  display: flex; align-items: center; gap: 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px;
}
.rec-icon { font-size: 1.5em; }
.rec-label { flex: 1; color: var(--text-dim); }
.rec-val { font-weight: 800; color: var(--accent); }
.memory-line { color: var(--armory) !important; font-style: italic; }

/* fix: armory empty-state should span the full grid width */
.armory-empty { grid-column: 1 / -1; max-width: 46ch; }

/* =========================================================
   v2.4 "SHOWROOM" — premium visual layer.
   Pure overrides: depth, glow, typography, identity.
   Body text stays system fonts (dyslexia-friendly); display
   font only on headings, brand, and buttons.
   ========================================================= */

:root {
  --font-display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --glow-accent: 0 0 24px rgba(77, 163, 255, 0.25);
  --glow-warm: 0 0 24px rgba(255, 180, 84, 0.25);
}

body {
  background:
    radial-gradient(1100px 500px at 15% -10%, rgba(77, 163, 255, 0.10), transparent 60%),
    radial-gradient(900px 480px at 110% 15%, rgba(177, 140, 255, 0.07), transparent 55%),
    radial-gradient(800px 600px at 50% 115%, rgba(255, 120, 73, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
html[data-contrast="high"] body { background: var(--bg); }

h1, h2, h3, .brand-title, .btn, .promo-title, .mc-title, .w-name, .s-name, .boss-name, .db-stat .v, .estimate-band, .coach-bignum {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

/* glass topbar */
.topbar {
  background: rgba(15, 20, 32, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(77, 163, 255, 0.12);
  margin: 0 -16px; padding-left: 16px; padding-right: 16px;
}
.brand-mark {
  filter: drop-shadow(0 0 10px rgba(255, 180, 84, 0.45));
}
.brand-title {
  background: linear-gradient(100deg, #eef2f9, #8ec4ff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* cards get depth + sheen */
.mission-card, .world-card, .stage-card, .coach-card, .welcome-card, .skill-row, .setting-row, .record-row, .armory-item {
  background: linear-gradient(160deg, rgba(255,255,255,0.035), rgba(255,255,255,0) 38%), var(--card);
  border-color: rgba(122, 152, 205, 0.20);
}
.stage-card, .welcome-card {
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

/* mission cards: identity stripe + icon chip */
.mission-card { position: relative; overflow: hidden; }
.mission-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(var(--accent), var(--armory));
}
.mission-card .mc-icon {
  background: rgba(77, 163, 255, 0.10);
  border: 1px solid rgba(77, 163, 255, 0.18);
  border-radius: 14px; min-width: 58px; height: 58px;
  display: flex; align-items: center; justify-content: center;
}

/* world identity tints */
.world-card { border-top: 3px solid transparent; }
.worlds-grid .world-card:nth-child(1) { border-top-color: var(--forge); }
.worlds-grid .world-card:nth-child(2) { border-top-color: var(--ops); }
.worlds-grid .world-card:nth-child(3) { border-top-color: var(--armory); }
.worlds-grid .world-card:nth-child(4) { border-top-color: var(--intel); }
.world-card .w-icon { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4)); }

/* buttons: primary glows, all get press-feel */
.btn-primary {
  background: linear-gradient(135deg, #5fb0ff, #3d8fe6);
  box-shadow: var(--glow-accent), 0 4px 14px rgba(0, 0, 0, 0.35);
  border: none;
}
.btn-primary:hover { box-shadow: 0 0 32px rgba(77, 163, 255, 0.4), 0 4px 14px rgba(0,0,0,0.35); transform: translateY(-1px); }
.btn, .choice-btn, .icon-btn { transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease; }
.btn:active, .choice-btn:active, .icon-btn:active { transform: scale(0.97); }

/* progress + XP bars: gradient + glow */
.xpbar-fill, .w-fill, .s-fill, .cr-fill {
  background: linear-gradient(90deg, #4da3ff, #7cc4ff);
  box-shadow: 0 0 10px rgba(77, 163, 255, 0.5);
}
.w-fill.forge { background: linear-gradient(90deg, #ff7849, #ffab7c); box-shadow: 0 0 10px rgba(255,120,73,0.5); }
.w-fill.armory { background: linear-gradient(90deg, #b18cff, #d3bcff); box-shadow: 0 0 10px rgba(177,140,255,0.5); }
.w-fill.intel { background: linear-gradient(90deg, #3ddc84, #7ceeae); box-shadow: 0 0 10px rgba(61,220,132,0.5); }

/* choice letters become chips */
.choice-btn .ck {
  background: rgba(77, 163, 255, 0.12);
  border: 1px solid rgba(77, 163, 255, 0.25);
  border-radius: 50%; min-width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
}
.choice-btn.correct .ck { background: var(--good); color: #06130b; border-color: var(--good); }
.choice-btn.picked-wrong .ck { background: var(--warm); color: #1d1204; border-color: var(--warm); }
.choice-btn.correct { box-shadow: 0 0 18px rgba(61, 220, 132, 0.25); }

/* welcome hero */
.welcome-card h1 {
  font-size: 1.8em;
  background: linear-gradient(100deg, #eef2f9 30%, #8ec4ff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome-emoji { animation: heroFloat 3.5s ease-in-out infinite; display: inline-block; }
@keyframes heroFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* streak chip pulse when alive */
.streak-chip { border: 1px solid rgba(255, 180, 84, 0.3); box-shadow: var(--glow-warm); }

/* boss bar drama */
.boss-bar { box-shadow: 0 0 30px rgba(255, 120, 73, 0.15); }
.hp-seg.full { background: linear-gradient(180deg, #ff9a6b, #ff7849); }

/* scrollbar (webkit) — the detail people notice */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3d4c6e; }

/* section headers get a quiet military stamp */
.screen-head h1 { text-transform: uppercase; letter-spacing: 0.06em; font-size: 1.35em; }

/* debrief stat cards */
.db-stat {
  background: linear-gradient(160deg, rgba(77,163,255,0.08), rgba(77,163,255,0.02));
  border: 1px solid rgba(77, 163, 255, 0.15);
}

/* =========================================================
   v2.5 — THE FRONT DOOR. A mother's dedication page.
   ========================================================= */
.intro-wrap {
  max-width: 560px; margin: 4vh auto 0; text-align: center;
  animation: fadeUp 0.8s ease;
}
.flag {
  position: relative; width: 228px; height: 120px; margin: 0 auto 22px;
  background: repeating-linear-gradient(180deg,
    #B22234 0, #B22234 9.23px, #FFFFFF 9.23px, #FFFFFF 18.46px);
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 40px rgba(77, 163, 255, 0.12);
  animation: flagFloat 5s ease-in-out infinite;
}
.flag-canton {
  position: absolute; top: 0; left: 0; width: 40%; height: 53.9%;
  background-color: #3C3B6E;
  background-image:
    radial-gradient(circle at 50% 50%, #fff 1.15px, transparent 1.6px);
  background-size: 15px 13px;
  background-position: 4px 3px;
}
.flag-shine {
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.22) 46%, rgba(255,255,255,0.05) 52%, transparent 66%);
  background-size: 260% 100%;
  animation: flagShine 4.5s ease-in-out infinite;
}
@keyframes flagFloat { 0%, 100% { transform: translateY(0) rotate(-0.4deg); } 50% { transform: translateY(-6px) rotate(0.4deg); } }
@keyframes flagShine { 0% { background-position: 120% 0; } 60%, 100% { background-position: -120% 0; } }

.intro-anthem {
  color: var(--text-dim); font-style: italic; font-size: 0.95em; margin-bottom: 18px; line-height: 1.7;
}
.intro-title {
  font-family: var(--font-display); font-size: 1.9em; letter-spacing: 0.04em; margin-bottom: 18px;
  background: linear-gradient(100deg, #ff9b9b 5%, #ffffff 50%, #8ec4ff 95%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.intro-letter {
  text-align: left; background: linear-gradient(160deg, rgba(255,255,255,0.04), rgba(255,255,255,0) 40%), var(--card);
  border: 1px solid rgba(122, 152, 205, 0.22); border-radius: var(--radius);
  padding: 26px 28px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  display: grid; gap: 14px; max-width: 60ch; margin: 0 auto;
}
.intro-letter p { line-height: 1.75; }
.intro-sign { font-style: italic; }
.intro-hearts { font-style: normal; }
.intro-enter {
  max-width: 340px; margin: 26px auto 0; display: block;
  font-size: 1.2em; letter-spacing: 0.08em;
  background: linear-gradient(135deg, #d64545, #b22234 45%, #3c5db0);
  box-shadow: 0 0 34px rgba(210, 70, 70, 0.35), 0 6px 18px rgba(0, 0, 0, 0.4);
  color: #fff;
}
.intro-enter:hover { box-shadow: 0 0 44px rgba(210, 70, 70, 0.5), 0 6px 18px rgba(0,0,0,0.4); transform: translateY(-1px); }
.intro-outro { color: var(--text-dim); font-style: italic; font-size: 0.9em; margin: 16px 0 30px; }
@media (max-width: 560px) { .intro-letter { padding: 20px; } .intro-title { font-size: 1.5em; } }

/* anthem button + intro spacing (topbar hidden on dedication page) */
.intro-wrap { margin-top: 7vh; }
.anthem-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin: -6px auto 20px; padding: 10px 20px; min-height: 44px;
  background: rgba(77, 163, 255, 0.08); color: var(--text-dim);
  border: 1px solid rgba(122, 152, 205, 0.3); border-radius: 999px;
  font-size: 0.88em; font-family: var(--font-display); letter-spacing: 0.04em;
  transition: all 0.15s ease;
}
.anthem-btn:hover { color: var(--text); border-color: var(--accent); box-shadow: 0 0 18px rgba(77, 163, 255, 0.2); }

/* =========================================================
   v2.6 — DEDICATION PAGE, full ceremony layout
   ========================================================= */
#screen-intro {
  background:
    radial-gradient(900px 480px at 12% 100%, rgba(255, 120, 73, 0.13), transparent 60%),
    radial-gradient(800px 400px at 88% 90%, rgba(255, 160, 90, 0.08), transparent 55%),
    radial-gradient(1000px 500px at 50% -10%, rgba(77, 163, 255, 0.10), transparent 60%);
  margin: 0 -16px; padding: 0 16px;
}
.intro-wrap { max-width: 1080px; }
.intro-emblem { margin-bottom: 20px; }
.emblem-mark { font-size: 3.2em; filter: drop-shadow(0 0 18px rgba(255, 180, 84, 0.5)); animation: heroFloat 4s ease-in-out infinite; }
.emblem-word {
  font-family: var(--font-display); font-size: 1.7em; font-weight: 700; letter-spacing: 0.22em;
  background: linear-gradient(180deg, #ffffff, #b8d4ff);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-top: 4px;
}
.emblem-sub { font-family: var(--font-display); color: var(--warm); letter-spacing: 0.34em; font-size: 0.72em; margin-top: 4px; }

.intro-heart {
  font-size: 1.9em; color: #ff5470; margin: 6px 0 22px; line-height: 1;
  text-shadow: 0 0 14px rgba(255, 84, 112, 0.8), 0 0 34px rgba(255, 84, 112, 0.4);
  animation: heartbeat 2.4s ease-in-out infinite;
}
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.14); } 24% { transform: scale(1); } 36% { transform: scale(1.1); } 48% { transform: scale(1); } }

.intro-grid {
  display: grid; grid-template-columns: 230px minmax(0, 1fr) 230px;
  gap: 18px; align-items: start; text-align: left; margin: 0 auto;
}
.intro-side { display: grid; gap: 18px; }
.side-card {
  border-radius: 16px; padding: 20px 18px; text-align: center;
  background: linear-gradient(165deg, rgba(255,255,255,0.03), rgba(255,255,255,0) 45%), rgba(20, 26, 42, 0.85);
  display: grid; gap: 10px; font-size: 0.88em; line-height: 1.65;
}
.side-card p { margin: 0; color: var(--text-dim); }
.side-card strong { color: var(--text); }
.heart-card { border: 1px solid rgba(255, 84, 112, 0.35); box-shadow: 0 0 24px rgba(255, 84, 112, 0.10); }
.heart-card .sc-icon { color: #ff5470; text-shadow: 0 0 12px rgba(255, 84, 112, 0.7); }
.star-card { border: 1px solid rgba(122, 163, 255, 0.35); box-shadow: 0 0 24px rgba(77, 163, 255, 0.10); }
.star-card .sc-icon { color: #7aa3ff; text-shadow: 0 0 12px rgba(122, 163, 255, 0.7); }
.sc-icon { font-size: 1.5em; line-height: 1; }
.sc-title { font-family: var(--font-display); letter-spacing: 0.14em; font-size: 0.82em; color: var(--text); }

.intro-letter { margin: 0; }
.hl-warm { color: #ff9b9b; }
.intro-letter .hl-warm { text-shadow: 0 0 18px rgba(255, 120, 120, 0.25); }

.intro-footer { margin-top: 26px; }
.if-main {
  font-family: var(--font-display); letter-spacing: 0.2em; font-size: 1.02em;
  background: linear-gradient(100deg, #ff9b9b, #ffffff 50%, #8ec4ff);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.if-sub { font-family: var(--font-display); color: var(--text-dim); letter-spacing: 0.26em; font-size: 0.68em; margin-top: 8px; }

@media (max-width: 900px) {
  .intro-grid { grid-template-columns: 1fr; }
  .intro-side { grid-template-columns: 1fr 1fr; }
  .intro-side:first-child { order: 2; }
  .intro-letter { order: 1; }
}
@media (max-width: 560px) {
  .intro-side { grid-template-columns: 1fr; }
  .emblem-word { font-size: 1.3em; letter-spacing: 0.14em; }
}

/* v2.6.1 — final letter refinements */
.gold-card { border: 1px solid rgba(255, 191, 99, 0.4); box-shadow: 0 0 24px rgba(255, 180, 84, 0.10); }
.gold-card .sc-icon { color: #ffbf63; text-shadow: 0 0 12px rgba(255, 191, 99, 0.7); }
.gold-card .sc-title { color: #ffcf8a; }
.hl-gold { color: #ffbf63; }
.mom-sign { font-family: var(--font-display); font-size: 1.25em; letter-spacing: 0.05em; }
.sign-heart {
  color: #ff5470; font-size: 1.3em; vertical-align: middle;
  text-shadow: 0 0 12px rgba(255, 84, 112, 0.8), 0 0 28px rgba(255, 84, 112, 0.4);
}
.if-sub { font-size: 0.9em; color: var(--warm); letter-spacing: 0; }

/* v2.6.2 — tighten the dedication page: less empty space, more presence */
.intro-wrap { margin-top: 2.5vh; max-width: 1150px; }
.intro-emblem { margin-bottom: 10px; }
.emblem-mark { font-size: 2.4em; }
.emblem-word { font-size: 1.45em; margin-top: 2px; }
.emblem-sub { margin-top: 2px; }
.flag { width: 186px; height: 98px; margin: 0 auto 12px; }
.anthem-btn { margin: 0 auto 10px; padding: 8px 16px; min-height: 40px; }
.intro-anthem { margin-bottom: 8px; font-size: 0.88em; line-height: 1.5; }
.intro-title { margin-bottom: 6px; font-size: 1.75em; }
.intro-heart { margin: 0 0 16px; font-size: 1.6em; }
.intro-grid { grid-template-columns: 265px minmax(0, 1fr) 265px; gap: 16px; }
.intro-side { gap: 14px; }
.side-card { padding: 16px 16px; }
.intro-letter { padding: 24px 28px; }
.intro-enter { margin: 20px auto 0; }
.intro-footer { margin-top: 18px; }
.intro-outro { margin: 10px 0 20px; }

/* v2.6.3 — dedication page breaks out of the app's 860px column.
   Full-bleed on desktop (wide letter, cards at the sides),
   clean edge-to-edge stack on phones. */
#screen-intro {
  margin: 0 calc(50% - 50vw);
  padding: 0 22px;
}
.intro-wrap { max-width: 1220px; margin-left: auto; margin-right: auto; }
.intro-grid { grid-template-columns: 280px minmax(480px, 1fr) 280px; gap: 20px; }
.intro-letter { font-size: 1.04em; }
.intro-letter p { line-height: 1.8; }

@media (max-width: 1080px) {
  .intro-grid { grid-template-columns: 1fr; max-width: 640px; margin: 0 auto; }
  .intro-side { grid-template-columns: 1fr 1fr; order: 2; }
  .intro-letter { order: 1; }
}
@media (max-width: 560px) {
  #screen-intro { padding: 0 14px; }
  .intro-side { grid-template-columns: 1fr; }
  .intro-letter { padding: 22px 20px; font-size: 1em; }
  .intro-title { font-size: 1.45em; }
  .flag { width: 168px; height: 89px; }
}
