:root {
  --ink: #2b2440;
  --ink-soft: #5b5470;
  --paper: #fdf6ec;
  --card: #ffffff;
  --primary: #7c5cff;
  --primary-dark: #5b3ce0;
  --teal: #34d1bf;
  --teal-dark: #1fa896;
  --gold: #ffb833;
  --rose: #ff6b8a;
  --sky: #4aa8ff;
  --green: #46c46e;
  --red: #ef4f4f;
  --shadow: 0 10px 30px rgba(43, 36, 64, 0.12);
  --shadow-sm: 0 4px 12px rgba(43, 36, 64, 0.10);
  --radius: 18px;
  --radius-lg: 28px;
}

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

html, body { height: 100%; }

body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  background: var(--grad-bg, linear-gradient(160deg, #fdf6ec, #f3ecff));
  color: var(--ink);
  background-attachment: fixed;
}

h1, h2, h3, h4 { font-family: 'Baloo 2', 'Nunito', sans-serif; line-height: 1.15; }

button {
  font-family: 'Baloo 2', 'Nunito', sans-serif;
  cursor: pointer;
  border: none;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
button:hover { transform: translateY(-2px); }
button:active { transform: translateY(0); }
button:disabled { cursor: not-allowed; filter: grayscale(.6); opacity: .6; transform: none; }

/* ---------- Layout ---------- */
#app { max-width: 1080px; margin: 0 auto; padding: 16px; min-height: 100vh; }

.hud {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(6px);
  border-radius: var(--radius); padding: 10px 16px;
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
  position: sticky; top: 10px; z-index: 40;
}
.hud-left { display: flex; align-items: center; gap: 12px; }
.hud-avatar { width: 46px; height: 46px; border-radius: 12px; overflow: hidden; background: #eee; flex: 0 0 auto; }
.hud-avatar svg { width: 100%; height: 100%; display: block; }
.hud-name { font-weight: 800; font-size: 1.05rem; }
.hud-sub { font-size: .78rem; color: var(--ink-soft); }
.hud-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hud-chip {
  display: flex; align-items: center; gap: 6px; background: #f1edff; color: var(--primary-dark);
  padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: .85rem;
}
.hud-chip.gold { background: #fff3d6; color: #a06a00; }
.hud-chip.teal { background: #d8f7f2; color: var(--teal-dark); }

/* ---------- Screens ---------- */
.screen { animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none;} }

.panel {
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 26px;
}
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.spacer { height: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 1rem;
  padding: 13px 24px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--primary-dark); }
.btn.teal { background: var(--teal); color: #06332c; }
.btn.teal:hover { background: var(--teal-dark); color: #fff; }
.btn.gold { background: var(--gold); color: #5c3c00; }
.btn.gold:hover { background: #eaa323; }
.btn.ghost { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 2px var(--primary); }
.btn.ghost:hover { background: #f1edff; }
.btn.rose { background: var(--rose); color: #fff; }
.btn.rose:hover { filter: brightness(.95); }
.btn.sm { padding: 9px 16px; font-size: .88rem; }
.btn.lg { padding: 16px 32px; font-size: 1.15rem; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ---------- Title ---------- */
.title-wrap { text-align: center; padding: 34px 10px 10px; }
.title-logo {
  font-size: clamp(2.6rem, 8vw, 4.6rem); font-weight: 800; color: var(--ink);
  background: linear-gradient(120deg, #7c5cff, #34d1bf, #ffb833);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  display: inline-block; letter-spacing: .5px;
}
.title-tag { color: var(--ink-soft); font-size: 1.15rem; margin-top: 4px; font-weight: 700; }
.title-art { width: 220px; height: 220px; margin: 18px auto 8px; }
.title-art svg { width: 100%; height: 100%; }
.menu-card { max-width: 620px; margin: 18px auto; }
.menu-list { display: grid; gap: 12px; margin-top: 18px; }
.menu-btn {
  display: flex; align-items: center; gap: 16px; text-align: left; padding: 16px 20px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm);
  border: 2px solid transparent; width: 100%;
}
.menu-btn:hover { border-color: var(--primary); background: #f8f6ff; }
.menu-ico {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.7rem; flex: 0 0 auto;
}
.menu-btn b { font-size: 1.12rem; display: block; font-family: 'Baloo 2', sans-serif; }
.menu-btn span { font-size: .88rem; color: var(--ink-soft); }

/* ---------- Stage map ---------- */
.map-screen { position: relative; }
.map-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.map-bg svg { width: 100%; height: 100%; display: block; }
.map-content { position: relative; z-index: 1; }
.map { display: grid; gap: 16px; grid-template-columns: 1fr; }
.stage-card {
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center;
  background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
  border: 2px solid #eee; cursor: pointer; transition: all .15s ease; text-align: left; width: 100%;
}
.stage-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow); }
.stage-card.locked { opacity: .62; cursor: not-allowed; }
.stage-card.locked:hover { transform: none; border-color: #eee; }
.stage-num {
  width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.5rem; color: #fff;
}
.stage-title { font-size: 1.25rem; font-weight: 800; }
.stage-goal { font-size: .9rem; color: var(--ink-soft); margin-top: 2px; }
.stage-meta { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.meta-chip { font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #f0f0f6; color: var(--ink-soft); }
.meta-chip.done { background: #dcf7e6; color: #1d7a3c; }
.stage-progress { margin-top: 10px; }
.progress-track { height: 8px; border-radius: 999px; background: #eef; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--teal)); transition: width .4s ease; }

/* ---------- Challenge / Boss ---------- */
.challenge-layout { display: grid; gap: 16px; }
.scenario-box {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 24px; position: relative;
}
.scenario-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.badge-tag { font-size: .72rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.badge-tag.stage { background: var(--primary); color: #fff; }
.badge-tag.module { background: #e8f7ff; color: #0a6aa0; }
.badge-tag.boss { background: #ffe3e9; color: #b52b4d; }
.badge-tag.hearts { background: #fff0f2; color: #b52b4d; letter-spacing: 1px; }

.scene-line { display: flex; gap: 12px; margin: 14px 0; align-items: flex-start; }
.scene-avatar { width: 42px; height: 42px; border-radius: 10px; overflow: hidden; background: #eee; flex: 0 0 auto; }
.scene-avatar svg { width: 100%; height: 100%; display: block; }
.scene-bubble {
  background: #f5f3ff; padding: 12px 16px; border-radius: 4px 16px 16px 16px;
  max-width: 86%; font-size: .97rem; line-height: 1.5;
}
.scene-bubble.player { background: #e2f7f3; border-radius: 16px 4px 16px 16px; }
.scene-bubble b { color: var(--primary-dark); }
.scene-bubble.player b { color: var(--teal-dark); }

.option-grid { display: grid; gap: 12px; margin-top: 18px; }
.option-btn {
  text-align: left; background: #fff; border: 2px solid #e8e4f4; border-radius: var(--radius);
  padding: 15px 18px; font-size: .98rem; color: var(--ink); display: flex; gap: 12px; align-items: flex-start;
  box-shadow: var(--shadow-sm); font-family: 'Nunito', sans-serif; font-weight: 600;
}
.option-btn:hover:not(:disabled) { border-color: var(--primary); background: #f8f6ff; transform: translateY(-2px); }
.option-tag {
  flex: 0 0 auto; font-size: .7rem; font-weight: 800; padding: 4px 9px; border-radius: 999px;
  background: #f0edff; color: var(--primary-dark); margin-top: 2px; text-transform: uppercase; letter-spacing: .4px;
}
.option-tag.wrong { background: #ffe9ec; color: var(--red); }
.option-tag.correct { background: #dcf7e6; color: #1d7a3c; }
.option-btn.revealed.correct { border-color: var(--green); background: #f0fbf3; }
.option-btn.revealed.wrong { border-color: var(--red); background: #fff4f4; opacity: .8; }

.feedback-box { margin-top: 18px; border-radius: var(--radius); padding: 18px; animation: fadeIn .3s ease; }
.feedback-box.good { background: #effbf3; border: 2px solid #b7e6c6; }
.feedback-box.bad { background: #fff3f3; border: 2px solid #f3c1c1; }
.feedback-box h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.feedback-box .skill-name { color: var(--primary-dark); font-weight: 800; }

.opp-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.opp-chip {
  display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px;
  padding: 7px 14px; font-weight: 800; font-size: .85rem; box-shadow: var(--shadow-sm);
}
.opp-chip .dot { width: 10px; height: 10px; border-radius: 50%; }

.heartbar { width: 46px; height: 10px; border-radius: 999px; background: #eee; overflow: hidden; position: relative; }
.heartbar i { position: absolute; inset: 0; border-radius: 999px; background: var(--rose); transition: width .3s; }

/* ---------- Boss ---------- */
.boss-header {
  display: flex; align-items: center; gap: 18px; background: linear-gradient(120deg, #3b2b6b, #5b3ce0);
  color: #fff; border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.boss-header .big-avatar { width: 92px; height: 92px; border-radius: 22px; overflow: hidden; background: #fff; flex: 0 0 auto; }
.boss-header .big-avatar svg { width: 100%; height: 100%; }
.boss-title { font-size: 1.5rem; font-weight: 800; }
.boss-sub { font-size: .92rem; opacity: .9; }
.boss-rounds { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.round-dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,.35); }
.round-dot.done { background: var(--gold); }
.round-dot.now { background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.3); }

/* ---------- Coach / skills ---------- */
.coach-grid { display: grid; gap: 18px; }
.module-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.module-head { padding: 18px 22px; display: flex; align-items: center; gap: 14px; }
.module-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; color: #fff; }
.module-head h3 { font-size: 1.2rem; }
.module-head p { font-size: .85rem; color: var(--ink-soft); }
.skill-list { padding: 0 22px 20px; display: grid; gap: 12px; }
.skill-item {
  border: 2px solid #ece9f6; border-radius: var(--radius); padding: 14px 16px; cursor: pointer;
  transition: all .12s ease; background: #fcfbff;
}
.skill-item:hover { border-color: var(--primary); background: #f6f3ff; }
.skill-item.locked { opacity: .55; }
.skill-name-row { display: flex; align-items: center; gap: 10px; }
.skill-name-row b { font-size: 1rem; }
.skill-tag { font-size: .68rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: #f0edff; color: var(--primary-dark); }
.skill-tag.earned { background: #ffe9a8; color: #7a5400; }
.skill-tag.video { background: #ffe0e8; color: #b0165a; }
.skill-desc { font-size: .86rem; color: var(--ink-soft); margin-top: 4px; line-height: 1.45; }
.skill-progress { margin-top: 8px; }

/* ---------- jeopardy ---------- */
.jeopardy-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.jeopardy-col { display: grid; grid-template-rows: auto repeat(auto-fill, 1fr); gap: 8px; }
.jeopardy-cat {
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 800;
  border-radius: var(--radius); padding: 12px 8px; text-align: center; font-size: .82rem; line-height: 1.25;
  display: flex; align-items: center; justify-content: center; min-height: 52px;
}
.jeopardy-cell {
  background: #fff; border: 2px solid #ece9f6; border-radius: var(--radius); padding: 14px 8px;
  font-family: 'Baloo 2', sans-serif; font-size: 1.15rem; font-weight: 800; color: var(--primary);
  cursor: pointer; transition: all .12s ease; min-height: 54px;
}
.jeopardy-cell:hover { border-color: var(--primary); background: #f6f3ff; transform: translateY(-2px); }
.jeopardy-cell.done { background: #eef1f5; color: #9aa5b1; border-color: #e4e8ee; cursor: default; transform: none; }

/* ---------- Ambient soundscape ---------- */
.ambient-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 120;
  width: 58px; height: 58px; border-radius: 50%; font-size: 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--teal)); color: #fff;
  box-shadow: var(--shadow); display: grid; place-items: center;
}
.ambient-fab.on { animation: fabPulse 2.4s ease-in-out infinite; }
@keyframes fabPulse { 0%,100% { box-shadow: var(--shadow); } 50% { box-shadow: 0 0 0 8px rgba(52,209,191,.18), var(--shadow); } }
.ambient-fab:hover { transform: translateY(-2px) scale(1.05); }

.ambient-backdrop {
  position: fixed; inset: 0; background: rgba(30,20,50,.55); backdrop-filter: blur(4px);
  z-index: 110; display: grid; place-items: center; padding: 18px; animation: fadeIn .2s;
}
.ambient-panel {
  background: var(--paper); border-radius: var(--radius-lg); max-width: 460px; width: 100%;
  max-height: 86vh; overflow: auto; padding: 24px; box-shadow: var(--shadow); position: relative; animation: popIn .25s ease;
}
.ambient-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; background: #eee; font-size: 1rem; color: var(--ink-soft); }
.ambient-close:hover { background: #ddd; }
.ambient-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.ambient-item {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px;
  border: 2px solid #ece9f6; border-radius: var(--radius); background: #fff; cursor: pointer; transition: all .12s;
}
.ambient-item:hover { border-color: var(--primary); background: #f6f3ff; }
.ambient-item.active { border-color: var(--teal); background: #e9fbf8; }
.ambient-emoji { font-size: 1.5rem; }
.ambient-meta { flex: 1; min-width: 0; }
.ambient-meta b { font-size: .9rem; display: block; }
.ambient-meta i { font-size: .72rem; color: var(--ink-soft); font-style: normal; line-height: 1.3; display: block; }
.ambient-dot { font-size: .8rem; font-weight: 800; color: var(--teal-dark); }
.ambient-controls { margin-top: 16px; padding-top: 14px; border-top: 2px dashed #e4def5; }
.ambient-volrow { display: flex; align-items: center; gap: 10px; }
.ambient-volrow input[type="range"] { flex: 1; accent-color: var(--primary); height: 30px; }
.ambient-volnum { font-weight: 800; font-size: .82rem; color: var(--ink-soft); min-width: 38px; text-align: right; }



/* ---------- Badges ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.badge-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 16px; text-align: center; border: 2px solid #eee; transition: all .15s;
}
.badge-card.earned { border-color: var(--gold); background: #fffbea; }
.badge-card.locked { opacity: .55; filter: grayscale(.7); }
.badge-medal {
  width: 62px; height: 62px; margin: 0 auto 10px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.8rem;
  background: #f0f0f6; color: #aaa;
}
.badge-card.earned .badge-medal { background: linear-gradient(140deg, #ffd76a, #ffb833); color: #6b4a00; box-shadow: 0 4px 14px rgba(255,184,51,.4); }
.badge-card b { font-size: .92rem; display: block; }
.badge-card span { font-size: .74rem; color: var(--ink-soft); }

/* ---------- Creator / Closet ---------- */
.creator-grid { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
@media (max-width: 820px) { .creator-grid { grid-template-columns: 1fr; } }
.preview-pane { background: linear-gradient(180deg, #efeaff, #dff5f1); border-radius: var(--radius-lg); padding: 22px; text-align: center; position: sticky; top: 84px; align-self: start; }
.avatar-stage { width: 200px; height: 240px; margin: 0 auto; }
.avatar-stage svg { width: 100%; height: 100%; }
.opt-group { margin-bottom: 20px; }
.opt-group > label { font-weight: 800; font-size: .92rem; display: block; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }
.opt-group > label .lock-note { color: var(--gold); font-weight: 800; font-size: .75rem; margin-left: 6px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: var(--shadow-sm);
  cursor: pointer; position: relative;
}
.swatch:hover { transform: scale(1.08); }
.swatch.sel { box-shadow: 0 0 0 3px var(--primary), var(--shadow-sm); }
.swatch.locked { opacity: .35; }
.swatch .lockico { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1rem; color: #444; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: #fff; border: 2px solid #e8e4f4; border-radius: 999px; padding: 8px 14px;
  font-weight: 700; font-size: .86rem; cursor: pointer; transition: all .12s;
}
.chip:hover { border-color: var(--primary); }
.chip.sel { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.locked { opacity: .5; cursor: not-allowed; }
.chip.locked::after { content: " 🔒"; }

.name-input {
  width: 100%; padding: 14px 18px; font-size: 1rem; border-radius: var(--radius);
  border: 2px solid #e0dbf0; font-family: inherit; font-weight: 700; color: var(--ink); background: #fff;
}
.name-input:focus { outline: none; border-color: var(--primary); }

.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.preset-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 14px; text-align: center; cursor: pointer; border: 3px solid transparent; transition: all .12s;
}
.preset-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.preset-card.sel { border-color: var(--primary); }
.preset-avatar { width: 110px; height: 120px; margin: 0 auto 8px; }
.preset-avatar svg { width: 100%; height: 100%; }
.preset-card b { font-size: .92rem; display: block; }
.preset-card span { font-size: .72rem; color: var(--ink-soft); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(30,20,50,.55); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 100; padding: 18px; animation: fadeIn .2s;
}
.modal { background: var(--paper); border-radius: var(--radius-lg); max-width: 640px; width: 100%; max-height: 88vh; overflow: auto; padding: 26px; box-shadow: var(--shadow); position: relative; animation: popIn .25s ease; }
@keyframes popIn { from { transform: scale(.94); opacity: 0;} to { transform: none; opacity: 1;} }
.modal-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; background: #eee; font-size: 1.1rem; color: var(--ink-soft); }
.modal-close:hover { background: #ddd; }
.clip-box {
  margin-top: 14px; border-radius: var(--radius); background: #0d0d20; color: #eef;
  padding: 18px; font-size: .88rem; line-height: 1.5;
}
.clip-box .clip-link { color: var(--sky); word-break: break-all; }
.clip-video {
  margin-top: 14px; position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius);
  overflow: hidden; background: #000; box-shadow: var(--shadow);
}
.clip-video iframe { display: block; width: 100%; height: 100%; border: 0; }
.skill-item .clip-video.sm { border-radius: var(--radius); }

/* YouTube embed-failure fallback */
.clip-fallback {
  height: 100%; min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 18px; background: #f4f1fb;
}
.clip-fallback-icon { font-size: 2rem; }
.clip-fallback-text { font-size: .85rem; color: var(--ink-soft); max-width: 320px; line-height: 1.45; }
.clip-video .ytp-embed, .clip-video > div:not(.clip-fallback) { width: 100% !important; height: 100% !important; }


/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; z-index: 200; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 800;
  box-shadow: var(--shadow); animation: toastIn .3s ease; font-size: .92rem; max-width: 90vw; text-align: center;
}
.toast.gold { background: linear-gradient(90deg, #ffb833, #ff9d2e); color: #5c3c00; }
.toast.teal { background: linear-gradient(90deg, #34d1bf, #2aa99b); color: #06332c; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px);} to { opacity: 1; transform: none;} }

/* ---------- Misc ---------- */
.section-title { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; }
.section-title h2 { font-size: 1.5rem; }
.section-title .back { margin-right: auto; }
.divider { height: 2px; background: linear-gradient(90deg, transparent, var(--primary), transparent); margin: 18px 0; opacity: .25; }

.quest-banner {
  background: linear-gradient(120deg, var(--teal), #3aa0ff); color: #fff;
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.quest-banner h2 { font-size: 1.7rem; }
.quest-banner p { opacity: .94; margin-top: 4px; }

.result-card { text-align: center; padding: 30px; }
.result-emoji { font-size: 3.4rem; }
.result-card h2 { font-size: 1.8rem; margin: 8px 0; }
.earned-list { display: grid; gap: 10px; margin: 18px auto; max-width: 460px; text-align: left; }
.earned-item { display: flex; align-items: center; gap: 12px; background: #f7f5ff; border-radius: var(--radius); padding: 12px 16px; }
.earned-item b { font-family: 'Baloo 2', sans-serif; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 16px 0; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); text-align: center; }
.stat-card b { font-size: 1.9rem; font-family: 'Baloo 2', sans-serif; display: block; color: var(--primary); }
.stat-card span { font-size: .8rem; color: var(--ink-soft); font-weight: 700; }

.progress-track.sm { height: 6px; }
.tiny { font-size: .78rem; }

.scroll-x { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.tabbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

footer { text-align: center; color: var(--ink-soft); font-size: .78rem; padding: 26px 0 14px; position: relative; z-index: 1; }

/* ---------- Map layout with movie tab sidebar ---------- */
.map-layout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 900px) {
  .map-layout { grid-template-columns: 1fr 260px; }
}
.movie-tabs { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 900px) {
  .movie-tabs { position: sticky; top: 84px; }
}
.movie-tabs-title {
  font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: .6px;
  color: var(--ink-soft); margin-bottom: 2px;
}
.movie-tab {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  padding: 12px 14px; border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm);
  border: 2px solid #eee; font-weight: 800; font-size: .9rem; color: var(--ink); line-height: 1.2;
}
.movie-tab:hover { border-color: var(--primary); background: #f8f6ff; }
.movie-tab.active { border-color: var(--primary); background: #f1edff; box-shadow: var(--shadow); }
.movie-tab-sub { margin-left: auto; color: var(--primary); }
@media (max-width: 899px) {
  .movie-tabs { flex-direction: row; flex-wrap: wrap; }
  .movie-tab { width: auto; flex: 1 1 45%; }
  .movie-tab-sub { display: none; }
}


/* ---------- Scene backgrounds ---------- */
.scene-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.scene-bg .scene-bg-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-content { position: relative; z-index: 1; }

.confetti-piece { position: fixed; width: 10px; height: 16px; z-index: 300; pointer-events: none; animation: confFall linear forwards; }
@keyframes confFall { to { transform: translateY(110vh) rotate(720deg); opacity: .2; } }

/* ---------- Dialectical dilemma explainers ---------- */
.dilemma-explain { display: grid; gap: 10px; }
.dilemma-sec b { display: block; color: var(--primary-dark); font-family: 'Baloo 2', sans-serif; font-size: .85rem; text-transform: uppercase; letter-spacing: .5px; }
.dilemma-sec p { font-size: .9rem; line-height: 1.55; color: var(--ink-soft); margin-top: 2px; }
.dilemma-sec.dialectic { background: #eefbf8; border: 2px solid #bfe9e1; border-radius: 12px; padding: 10px 12px; }
.dilemma-sec.dialectic b { color: #0a6a5a; }
.dilemma-sec.dialectic p { color: #0a6a5a; }
.dilemma-sec.ask { background: #f5f3ff; border: 2px solid #dcd3ff; border-radius: 12px; padding: 10px 12px; }
.dilemma-sec.ask b { color: #4a3ba8; }
.dilemma-sec.ask p { color: #4a3ba8; }
.dilemma-poles { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.pole { border: 2px solid #ece9f6; border-radius: 12px; padding: 10px 12px; background: #fcfbff; }
.pole-tag { display: block; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--primary); margin-bottom: 4px; }
.pole p { font-size: .85rem; line-height: 1.5; color: var(--ink-soft); }
.pole-gap { display: grid; place-items: center; color: var(--primary); font-weight: 800; }
@media (max-width: 560px) { .dilemma-poles { grid-template-columns: 1fr; } .pole-gap { transform: rotate(90deg); } }

/* ---------- Practice worksheets ---------- */
.ws-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ws-toggle { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.ws-age { padding: 9px 18px; border-radius: 999px; font-weight: 800; font-size: .88rem; background: #fff; border: 2px solid #e0dbf0; color: var(--ink-soft); }
.ws-age:hover { border-color: var(--primary); }
.ws-age.sel { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.ws-fields { display: flex; gap: 18px; flex-wrap: wrap; }
.ws-field { flex: 1 1 220px; }
.ws-field label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); display: block; margin-bottom: 4px; }
.ws-field .ws-line { border-bottom: 2px dotted #cfc8e4; min-height: 26px; }
.ws-sheet { cursor: default; }
.ws-sheet:hover { border-color: #ece9f6; background: #fcfbff; transform: none; }
.ws-steps { list-style: none; counter-reset: ws; margin: 10px 0 0; }
.ws-steps li { position: relative; counter-increment: ws; padding: 4px 0 30px 36px; font-size: .92rem; line-height: 1.45; }
.ws-steps li::before { content: counter(ws); position: absolute; left: 2px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; font-size: .74rem; display: grid; place-items: center; }
.ws-answer { border-bottom: 2px dotted #cfc8e4; height: 20px; margin-top: 6px; }
.ws-scene { margin-top: 10px; border: 2px dashed #cfc4f5; background: #f5f3ff; border-radius: var(--radius); padding: 14px 16px; }
.ws-scene-head { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--primary-dark); margin-bottom: 6px; }
.ws-scene p { font-size: .9rem; line-height: 1.5; margin-bottom: 8px; }
.ws-lines { display: grid; gap: 6px; }
.ws-line { border-bottom: 2px dotted #cfc8e4; min-height: 20px; }
.ws-tip { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #fff8ec; font-size: .82rem; color: var(--ink-soft); line-height: 1.4; }
.ws-tip b { color: #a06a00; }

/* ---------- Print: clean worksheet copies ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .hud, .tabbar, .ambient-fab, .modal-backdrop, #toast-root, .no-print, footer { display: none !important; }
  #app { max-width: 100%; padding: 0; }
  .screen { animation: none; }
  .module-card { box-shadow: none; border: 1px solid #d8d2e6; break-inside: avoid; }
  .skill-item { border-color: #d8d2e6; break-inside: avoid; }
  .ws-scene { background: none; border-color: #a89fd0; }
  .module-ico, .ws-scene, .ws-tip, .skill-tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
