/* =====================================================================
   EduNova English | Grade 6 | Friendship
   Mobile-first design system - light / dark, joyful, learner-friendly
   ===================================================================== */

:root {
  --primary: #5B4FED;
  --primary-2: #7A6BFF;
  --accent: #FF6B9D;
  --accent-2: #FFD166;
  --teal: #2EC4B6;
  --hangup: #FF8FA3;
  --bg: #F4F1FF;
  --bg-2: #FFFFFF;
  --card: #FFFFFF;
  --text: #2D2A4A;
  --text-soft: #6B6790;
  --hi: #8B59C8;              /* hindi scaffolding color */
  --good: #2EC4B6;
  --bad: #FF6B6B;
  --shadow: 0 10px 30px rgba(91, 79, 237, 0.12);
  --shadow-sm: 0 4px 14px rgba(91, 79, 237, 0.10);
  --radius: 22px;
  --radius-sm: 14px;
  --font: "Nunito", "Baloo 2", "Segoe UI", system-ui, sans-serif;
  --font-display: "Baloo 2", "Nunito", "Segoe UI", system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #191531;
  --bg-2: #221c40;
  --card: #292250;
  --text: #F3EEFF;
  --text-2: #B9B2DC;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.30);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--primary-2) 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 110%, #FFB7D9 0%, transparent 45%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  font-size: 17px;
}

[data-theme="dark"] body {
  background:
    radial-gradient(1000px 500px at 80% -10%, #3A2E8C 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 110%, #4A2A5C 0%, transparent 45%),
    var(--bg);
}

/* ---------- topbar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(91, 79, 237, 0.12);
  padding: 8px 10px;
}
.topbar-inner { display: flex; align-items: center; gap: 8px; max-width: 620px; margin: 0 auto; }
.icon-btn {
  background: var(--card); border: 1px solid rgba(91,79,237,.15);
  border-radius: 12px; font-size: 20px; width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text);
}

.progress-wrap { flex: 1; overflow: hidden; }
.progress-rail {
  display: flex; gap: 3px; align-items: center;
  overflow-x: auto; padding: 4px 2px;
  scrollbar-width: none;
}
.progress-rail::-webkit-scrollbar { display: none; }
.rail-dot {
  flex: 0 0 auto; border: none; cursor: pointer; background: transparent;
  font-size: 15px; filter: grayscale(1) opacity(.45);
  transition: transform .2s, filter .2s;
  padding: 2px 3px;
}
.rail-dot.done { filter: none; transform: scale(1.05); }
.rail-dot::after { content:""; display:block; height:3px; border-radius:2px; background:transparent; }
.rail-dot.done::after { background: var(--good); }

.top-stats { display: flex; gap: 4px; }
.stat-chip {
  background: var(--card); border: 1px solid rgba(91,79,237,.14);
  border-radius: 999px; padding: 4px 9px; font-size: 13px;
  white-space: nowrap; box-shadow: var(--shadow-sm);
}
.stat-chip b { font-variant-numeric: tabular-nums; }
.stat-streak { border-color: rgba(255,177,66,.4); }

/* ---------- open menu panel (rail + sections stacked) ---------- */
.menu-panel {
  max-width: 620px; margin: 0 auto; padding-top: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.menu-panel .progress-wrap { flex: none; }
.sections-menu { display: flex; flex-wrap: wrap; gap: 6px; }
.menu-sec {
  border: 0; background: var(--card); box-shadow: var(--shadow-sm);
  border-radius: 999px; padding: 6px 11px; font-size: 12.5px; font-weight: 800;
  color: var(--text-2); cursor: pointer;
  transition: transform .15s, background .15s, color .15s;
}
.menu-sec:hover { transform: translateY(-1px); }
.menu-sec.done { background: color-mix(in srgb, var(--good) 18%, var(--card)); color: #14756c; }
.menu-sec.now {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 45%, transparent);
}
.menu-tools { display: flex; align-items: center; gap: 6px; }
.menu-tools .icon-btn { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }
.badge-mini {
  margin-left: auto; background: var(--card);
  border: 1px solid rgba(91,79,237,.14); border-radius: 999px;
  padding: 5px 11px; font-size: 12.5px; font-weight: 800; color: var(--text-2);
  box-shadow: var(--shadow-sm); white-space: nowrap;
}

/* ---------- layout ---------- */
#app {
  max-width: 620px; margin: 0 auto; padding: 14px 14px 90px;
  outline: none;
}
.scene-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.scene-rank {
  font-weight: 900; font-size: 13px; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  padding: 5px 10px; border-radius: 999px;
}
.scene-title { font-family: var(--font-display); font-weight: 800; font-size: 20px; flex: 1; }
.scene-head .icon-btn { width: 44px; height: 44px; }

/* ---------- pedagogy card ---------- */
.ped {
  background: var(--card); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); margin-bottom: 14px; overflow: hidden;
  border: 1px solid rgba(91,79,237,.12);
}
.ped-summary {
  padding: 10px 14px; font-size: 13px; font-weight: 800;
  color: var(--primary-2); cursor: pointer; list-style: none;
}
.ped-summary::-webkit-details-marker { display: none; }
.ped-summary::before { content: "➕ "; }
.ped[open] .ped-summary::before { content: "➖ "; }
.ped-row { padding: 5px 14px; font-size: 13px; color: var(--text-2); }
.ped-row b { color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-display); font-weight: 800;
  border: none; border-radius: 18px; padding: 12px 20px;
  font-size: 17px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 50px; color: #fff; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, filter .2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.96); }
.btn:disabled, .btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 8px 20px rgba(91,79,237,.35); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--card); color: var(--text); border: 2px solid rgba(91,79,237,.2); box-shadow: var(--shadow-sm); }
.btn-round { border-radius: 999px; }
.btn.big { font-size: 20px; min-height: 58px; }
.btn.full { width: 100%; }
.btn-glass { background: rgba(255,255,255,.25); color:#fff; backdrop-filter: blur(6px); border:1px solid rgba(255,255,255,.4); }
.btn-small { min-height: 36px; font-size: 14px; padding: 6px 14px; }

button:focus-visible, .btn:focus-visible, [tabindex]:focus-visible, .opt:focus-visible {
  outline: 3px solid var(--primary-2); outline-offset: 2px;
}

.icon-btn { border: 1px solid rgba(91,79,237,.15); }
.icon-btn:hover { background: color-mix(in srgb, var(--primary) 10%, var(--card)); }

.mini-say { border:none; background:var(--primary); color:#fff; border-radius:8px; font-size:14px; padding: 4px 10px; cursor:pointer; }
.mini-say:hover { filter: brightness(1.1); }

/* ---------- cards & text ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
  animation: rise .35s ease;
}
.card-h { font-family: var(--font-display); margin: 0 0 10px; font-weight: 800; font-size: 19px; }
.hi { color: var(--hi); font-size: 14px; }

.game-q { font-family: var(--font-display); font-weight: 800; font-size: 20px; margin: 8px 0 4px; }
.game-q + .hi { margin-bottom: 8px; }

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

/* ---------- hero (welcome) ---------- */
.hero {
  position: relative; text-align: center;
  padding: 34px 16px 26px; border-radius: 28px; overflow: hidden;
  background: linear-gradient(145deg, #5B4FED 0%, #8A6BF3 55%, #F072C5 100%);
  color: #fff; box-shadow: 0 20px 40px rgba(91,79,237,.35);
  margin-bottom: 16px; animation: rise .4s ease;
}
.hero-pair { font-size: 52px; display: flex; justify-content: center; gap: 8px; align-items: center; }
.hp { display: inline-block; }
.hp.b1 { animation: bob 2.4s ease-in-out infinite; }
.hp.b2 { animation: bob 2.4s ease-in-out .25s infinite; }
.hp.heart { animation: throb 1.6s ease-in-out infinite; font-size: 44px; }
@keyframes bob { 0%,100%{ transform:translateY(0);} 50%{ transform:translateY(-10px);} }
@keyframes throb { 0%,100%{ transform:scale(1);} 50%{ transform:scale(1.28);} }
.hero-title { font-family: var(--font-display); font-weight: 900; font-size: 46px; letter-spacing: .5px; text-shadow: 0 4px 14px rgba(0,0,0,.2); }
.hero-hi { font-size: 22px; opacity: .95; font-weight: 700; }
.hero-tag { font-size: 17px; font-weight: 600; margin-top: 10px; }
.hero-tag-hi { font-size: 14px; opacity: .85; }
.hero .btn-glass { margin-top: 14px; }

.obj-list { list-style: none; margin: 0; padding: 0; }
.obj-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed rgba(91,79,237,.15); }
.obj-list li:last-child { border-bottom: none; }
.obj-ico { font-size: 20px; }
.obj-en { font-weight: 700; display: block; }
.obj-list .hi { display: block; }
.quote-card {
  background: linear-gradient(135deg, #FFF3E0, #FFE8F0);
  border-radius: var(--radius); padding: 16px; text-align: center;
  font-weight: 800; font-style: italic; color:#7A5416; margin-bottom: 14px;
}
[data-theme="dark"] .quote-card { background: linear-gradient(135deg, #3A2E1F, #4A2333); color:#FFE9C7; }

/* ---------- stages ---------- */
.lesson-note { background: color-mix(in srgb, var(--primary) 8%, var(--card)); border-radius: 14px; padding: 12px 14px; font-weight: 700; margin-bottom: 12px; border-left: 5px solid var(--primary-2); }
.lesson-note .hi { display: block; margin-top: 4px; }

/* ---------- game options ---------- */
.stage, .run-body { width: 100%; }
.opt-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 10px 0; }
.opt-grid-2 { grid-template-columns: 1fr 1fr; }
.opt-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.opt {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--card); border: 2px solid rgba(91,79,237,.15);
  border-radius: var(--radius-sm); padding: 14px 8px;
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  color: var(--text); cursor: pointer; min-height: 64px; justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, border-color .2s, background .2s;
  touch-action: manipulation;
}
.opt:hover { border-color: var(--primary); }
.opt:active { transform: scale(.97); }
.opt:disabled { opacity: .55; }
.opt-emoji { font-size: 34px; }
.opt-label { font-size: 16px; line-height: 1.25; }
.opt-word { min-height: 58px; padding: 10px 6px; font-size: 18px; }
.opt.picked-good { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--card)); animation: pop .35s ease; }
.opt.picked-bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--card)); animation: shake .35s ease; }
@keyframes pop { 0%{ transform:scale(.9);} 60%{ transform:scale(1.06);} 100%{ transform:scale(1);} }
@keyframes shake { 0%,100%{ transform:translateX(0);} 25%{ transform:translateX(-6px);} 75%{ transform:translateX(6px);} }

/* ---------- picture games ---------- */
.pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px,1fr)); gap: 10px; margin: 10px 0; }
.pic-grid-5 { grid-template-columns: repeat(auto-fill, minmax(88px,1fr)); }
.pic-card {
  background: var(--card); border: 2px solid rgba(91,79,237,.15);
  border-radius: var(--radius-sm); padding: 12px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .12s;
  font-family: var(--font); color: var(--text);
}
.pic-card:active { transform: scale(.96); }
.pic-emoji { font-size: 42px; }
.pic-label { font-weight: 800; font-size: 14px; text-align: center; }
.pic-hi { font-size: 12px; }
.pic-card.picked-good { border-color: var(--good); background: color-mix(in srgb, var(--good) 15%, var(--card)); }

/* ---------- feedback toast ---------- */
.feedback-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120%);
  z-index: 300; max-width: min(92vw, 480px); width: max-content;
  background: var(--card); border-radius: 18px; padding: 14px 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
  display: flex; gap: 12px; align-items: center;
  transition: transform .35s cubic-bezier(.2,.9,.3,1.4); opacity: 0;
  border: 2px solid var(--good);
}
.feedback-toast.bad { border-color: var(--bad); }
.feedback-toast.show { transform: translate(-50%, 0); opacity: 1; }
.fb-emoji { font-size: 34px; }
.fb-text b { font-family: var(--font-display); }
.fb-hi { color: var(--hi); font-size: 13px; max-width: 300px; }
.fb-text { font-weight: 700; }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 400; }

/* ---------- floater ---------- */
.floater {
  position: fixed; z-index: 350; font-family: var(--font-display); font-weight: 900;
  font-size: 18px; color: var(--primary-2); pointer-events: none;
  animation: float-up 1.3s ease forwards;
}
@keyframes float-up { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-60px) scale(1.2); } }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 250; background: rgba(20,14,60,.55);
  display: none; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(4px);
}
.overlay.show-flex { display: flex; }
.modal {
  background: var(--card); color: var(--text);
  border-radius: 24px; max-width: min(94vw, 520px); max-height: 86vh;
  overflow-y: auto; padding: 20px; box-shadow: 0 24px 60px rgba(0,0,0,.35);
  animation: rise .3s ease; width: 100%;
}
.modal.wide { max-width: 620px; }
.menu-h { font-family: var(--font-display); margin: 14px 0 8px; font-weight: 800; }

.note-card { background: var(--bg-2); border: 1px solid rgba(91,79,237,.15); border-radius: 14px; padding: 12px; margin: 8px 0; }
.note-card h4 { margin: 0 0 6px; font-family: var(--font-display); }
.note-row { font-size: 13.5px; margin: 3px 0; }
.note-list { margin: 8px 0; padding-left: 20px; font-size: 14px; }

/* ---------- badge popup ---------- */
.badge-pop { text-align:center; background: var(--card); border-radius: 24px; padding: 26px; max-width: 320px; width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.35); animation: pop .4s ease; }
.badge-emoji { font-size: 62px; animation: throb 1.4s ease-in-out infinite; }
.badge-name { font-family: var(--font-display); font-weight: 900; font-size: 22px; color: var(--primary-2); margin: 6px 0; }

/* ---------- stage runner ---------- */
.run-rail { display: flex; gap: 6px; margin: 10px 0 12px; overflow-x: auto; scrollbar-width:none; }
.run-rail::-webkit-scrollbar { display:none; }
.rail-item {
  flex: 0 0 auto; border: 0; width: 40px; height: 40px; border-radius: 12px;
  font-size: 18px; font-weight: 900; cursor: pointer;
  background: var(--card); box-shadow: var(--shadow-sm); color: var(--text-2);
}
.rail-item.now { background: linear-gradient(135deg,var(--primary),var(--primary-2)); color:#fff; transform: scale(1.08); }
.rail-item.done { color: #06756c; }
.run-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.run-emoji { font-size: 30px; }
.run-title { font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.run-back { margin-top: 12px; }
.game-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.dots { display: flex; gap: 5px; }
.dot { width: 22px; height: 22px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; color: var(--text-2); }
.dot.done { background: var(--good); color: #fff; }
.dot.now { background: linear-gradient(135deg,var(--primary),var(--primary-2)); color:#fff; }
.score-chip { font-weight: 900; font-family: var(--font-display); }
.game-done { text-align:center; font-family: var(--font-display); font-weight: 900; font-size: 24px; padding: 30px 0 20px; }

/* ---------- flashcards ---------- */
.flashcard {
  position: relative; width: 100%; min-height: 230px; perspective: 900px;
  cursor: pointer; margin: 10px 0;
}
.flash-front, .flash-back {
  position: absolute; inset: 0; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  backface-visibility: hidden; transition: transform .5s ease;
  box-shadow: var(--shadow); padding: 18px;
}
.flash-front { background: linear-gradient(150deg, #5B4FED, #7A6BFF); color: #fff; }
.flash-back { background: var(--card); transform: rotateY(180deg); border: 2px solid rgba(91,79,237,.2); }
.flashcard.flipped .flash-front { transform: rotateY(180deg); }
.flashcard.flipped .flash-back { transform: rotateY(360deg); }
.flash-emoji { font-size: 58px; }
.flash-word { font-family: var(--font-display); font-weight: 900; font-size: 38px; }
.flash-pron { font-size: 15px; opacity: .9; }
.flash-meaning { font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.flash-hi { color: var(--hi); font-weight: 700; }
.flash-sent { font-style: italic; color: var(--text-2); }
.flash-count { text-align: center; color: var(--text-2); font-size: 13px; margin: 8px 0; }
.flash-say { margin: 8px auto 0; }
.game-nav { display: flex; gap: 10px; margin-top: 12px; }
.game-nav .btn { flex: 1; }

/* ---------- memory ---------- */
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mem-card {
  min-height: 88px; border-radius: var(--radius-sm); border: none;
  background: linear-gradient(150deg, var(--primary), var(--primary-2));
  color: #fff; font-weight: 900; font-size: 15px; cursor: pointer;
  box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.mem-card:active { transform: scale(.94); }
.mem-card.open { background: var(--card); color: var(--text); border: 2px solid rgba(91,79,237,.25); box-shadow: var(--shadow); }
.mem-card.open.mem-word { font-family: var(--font-display); }
.mem-card.done { background: color-mix(in srgb, var(--good) 20%, var(--card)); border: 2px solid var(--good); }
.mem-emoji { font-size: 38px; }
.mem-word { font-weight: 900; }
.mem-cover { font-size: 20px; }

/* ---------- fill blanks ---------- */
.fill-line { font-family: var(--font-display); font-weight: 800; font-size: 20px; padding: 12px; text-align: center; border-radius: 14px; background: var(--bg-2); margin: 10px 0 14px; }
.fill-slot { display: inline-block; min-width: 90px; border-bottom: 3px dotted var(--primary); color: var(--primary-2); text-align: center; }

/* ---------- arrange ---------- */
.arrange-list { display: flex; flex-direction: column; gap: 8px; }
.arrange-row {
  display: flex; gap: 10px; align-items: center;
  background: var(--card); border: 2px solid rgba(91,79,237,.15);
  border-radius: 14px; padding: 12px; font-weight: 700; color: var(--text);
  cursor: pointer; text-align: left; box-shadow: var(--shadow-sm);
}
.arrange-row.picked { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.arrange-row.locked { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--card)); cursor: default; }
.arr-num { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color:#fff; display: inline-flex; align-items:center; justify-content:center; font-weight: 900; }
.arrange-row:not(.picked):not(.locked) .arr-num { background: var(--card); color: var(--text-2); border: 2px solid var(--primary); }

/* ---------- true/false ---------- */
.tf-wrap { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; }
.tf-sent, .find-sent { font-family: var(--font-display); font-weight: 800; font-size: 19px; flex: 1; padding: 10px 14px; background: var(--bg-2); border-radius: 14px; }
.tf-opt { min-height: 88px; }

/* ---------- match ---------- */
.match-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-chip {
  border: 2px solid rgba(91,79,237,.18); background: var(--card);
  border-radius: 14px; padding: 12px 8px; font-weight: 800; font-size: 14px;
  color: var(--text); cursor: pointer; text-align: center; box-shadow: var(--shadow-sm);
  min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 5px;
}
.match-left.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--card)); transform: scale(1.03); }
.match-chip.done { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--card)); cursor: default; opacity: .85; }

/* ---------- build sentence ---------- */
.build-row { display: flex; flex-direction: column; gap: 12px; }
.build-bank { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; }
.build-line { min-height: 56px; border: 2px dashed var(--primary); border-radius: 14px; padding: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 700; color: var(--text-2); }
.build-word { background: var(--primary); color: #fff; border-radius: 8px; padding: 6px 12px; font-weight: 800; font-size: 16px; }
.bank-chip, .chip {
  background: var(--card); border: 2px solid rgba(91,79,237,.2);
  border-radius: 999px; padding: 10px 16px; font-family: var(--font-display);
  font-weight: 800; font-size: 15px; color: var(--text); cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .12s;
}
.chip:active { transform: scale(.94); }
.chip.chosen { background: var(--good); color: #fff; border-color: var(--good); }

/* ---------- dialogue ---------- */
.dlog-wrap { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.bubble { background: var(--bg-2); border-radius: 16px; padding: 12px 16px; font-family: var(--font-display); font-weight: 800; position: relative; }
.bubble::after { content:""; position:absolute; left:-8px; top:16px; border:8px solid transparent; border-right-color: var(--bg-2); }

/* ---------- word race ---------- */
.race-start { text-align:center; padding: 30px 0; }
.race-bar { height: 14px; background: var(--card); border-radius: 999px; overflow: hidden; margin: 10px 0 14px; box-shadow: inset 0 2px 6px rgba(0,0,0,.1); }
.race-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
[data-theme="dark"] .race-bar { background: #00000055; }

/* ---------- sort ---------- */
.sort-buckets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.sort-bucket { border: 2px dashed rgba(91,79,237,.3); border-radius: 16px; padding: 10px; min-height: 120px; }
.sort-head { font-family: var(--font-display); font-weight: 800; text-align: center; margin-bottom: 6px; }
.sort-drop { min-height: 60px; border-radius: 12px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 6px; }
.sort-drop.hot { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.sort-pool { margin: 12px 0; }
.sort-chip.picked { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 16%, var(--card)); }
.sort-chip.placed { border-color: var(--good); background: var(--good); color: #fff; }

/* ---------- speaking ---------- */
.speak-tip { color: var(--text-2); margin-bottom: 10px; font-weight: 700; }
.speak-grid { display: flex; flex-direction: column; gap: 10px; }
.speak-card {
  background: var(--card); border-radius: var(--radius-sm); padding: 14px;
  box-shadow: var(--shadow-sm); border: 2px solid transparent;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.speak-card.done { border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--card)); }
.speak-text { font-family: var(--font-display); font-weight: 900; font-size: 19px; flex: 1; }
.speak-text.done-speak { text-decoration: line-through 3px var(--good); }
.speak-card .btn { margin-left: auto; }
.speak-card .hi { width: 100%; }

/* ---------- role play ---------- */
.rp-stage { margin-top: 12px; }
.rp-who { font-weight: 900; font-family: var(--font-display); font-size: 17px; margin-bottom: 6px; }
.rp-bubble { min-height: 80px; margin-bottom: 12px; }
.rp-friend-bubble, .rp-mine-bubble, .rp-word { display: inline-block; }
.rp-friend-bubble { background: var(--primary); color: #fff; padding: 16px 20px; border-radius: 18px; border-bottom-left-radius: 4px; font-family: var(--font-display); font-weight: 800; }
.rp-mine-bubble { background: var(--accent); color: #fff; padding: 16px 20px; border-radius: 18px; border-bottom-right-radius: 4px; font-family: var(--font-display); font-weight: 800; }
.rp-blank { border-bottom: 3px dotted #fff; }
.rp-chips { gap: 8px; display: flex; flex-wrap: wrap; margin: 8px 0; }
.rp-end { text-align: center; font-family: var(--font-display); font-weight: 900; font-size: 22px; padding: 30px 10px; }

/* ---------- listening ---------- */
.list-player { margin: 10px 0; }
.list-bubbles { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.list-line { padding: 10px 12px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow-sm ); }
.list-line.A { background: color-mix(in srgb, var(--primary) 12%, var(--card)); border-left: 5px solid var(--primary); }
.list-line.B { background: color-mix(in srgb, var(--accent) 12%, var(--card)); border-left: 5px solid var(--accent); }
.list-line.now { outline: 3px solid var(--accent-2); }
.list-who { font-weight: 900; font-family: var(--font-display); }
.say-hint { color: var(--text-2); font-weight: 700; text-align: center; margin-bottom: 10px; }
.speak-btn {
  background: linear-gradient(150deg, var(--primary), var(--primary-2));
  border: none; border-radius: 999px; color: #fff;
  width: 60px; height: 60px; font-size: 24px; cursor: pointer; margin: 6px auto;
  box-shadow: 0 10px 22px rgba(91,79,237,.4); display: flex; align-items: center; justify-content: center;
  animation: throb 1.8s ease-in-out infinite;
}
.speak-btn:active { transform: scale(.9); }

/* ---------- reading ---------- */
.story-title { text-align: center; margin-bottom: 12px; }
.part-badge { display: inline-block; background: var(--accent-2); color: #6a4a00; font-weight: 900; border-radius: 999px; padding: 4px 14px; font-size: 13px; box-shadow: var(--shadow-sm); }
.story-title-en { font-family: var(--font-display); font-weight: 900; font-size: 26px; margin-top: 6px; }
.read-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.read-para { font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1.7; }
.rw { cursor: default; border-radius: 6px; transition: background .15s; }
.rw-vocab { color: var(--primary); text-decoration: underline dotted var(--primary); cursor: pointer; }
.rw.hl { background: var(--accent-2); color: #4a3600; }
.read-hi { margin-top: 12px; color: var(--text-2); font-size: 16px; }
.read-tip { color: var(--text-2); font-size: 13px; margin-top: 8px; }
.read-controls { display: flex; gap: 10px; margin: 12px 0; }
.read-controls .btn { flex: 1; }
.read-step { margin-top: 8px; }
.predict-card, .check-card { border-left: 6px solid var(--accent-2); }
.card-q { font-family: var(--font-display); font-weight: 800; font-size: 19px; margin-bottom: 8px; }

.vocab-pop { text-align: center; }
.fp-emoji { font-size: 54px; }
.fp-word { font-family: var(--font-display); font-weight: 900; font-size: 32px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.fp-pron { color: var(--text-2); }
.fp-meaning { font-weight: 800; margin: 8px 0; }
.fp-hi { color: var(--hi); font-weight: 700; font-size: 18px; }
.fp-sent { font-style: italic; color: var(--text-2); margin: 8px 0 14px; }

/* ---------- scenarios ---------- */
.scenario-card { background: linear-gradient(150deg, var(--primary), var(--primary-2)); color: #fff; border-radius: var(--radius); padding: 18px; font-family: var(--font-display); font-weight: 800; font-size: 19px; }
.sc-title { font-size: 20px; }

/* ---------- mission ---------- */
.mission-head { background: linear-gradient(150deg, #F6A821, #FFD166); color: #4a3000; }
[data-theme="dark"] .mission-head { color: #3a2600; }
.mission-intro { font-weight: 700; margin-top: 6px; }
.mission-list { display: flex; flex-direction: column; gap: 10px; }
.mission-row {
  display: flex; gap: 12px; align-items: center; text-align: left;
  background: var(--card); border: 2px solid rgba(91,79,237,.15); border-radius: var(--radius-sm);
  padding: 14px; cursor: pointer; font-weight: 700; color: var(--text); box-shadow: var(--shadow-sm);
}
.mission-row.done { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--card)); }
.mission-check { font-size: 24px; width: 30px; }
.mission-emoji { font-size: 28px; }
.mission-text { flex: 1; }
.mission-text .hi { display: block; }

/* ---------- assessment ---------- */
.assess-progress { height: 14px; border-radius: 999px; background: var(--card); overflow: hidden; margin: 12px 0; box-shadow: inset 0 2px 6px rgba(0,0,0,.1); }
.assess-fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--good)); transition: width .4s; }
.assess-q { animation: rise .3s ease; }
.result-card { text-align: center; padding: 26px 18px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.result-card.win { background: linear-gradient(160deg, #FFF6DC, #FFE8B8); color: #4a3000; border: 2px solid var(--accent-2); }
[data-theme="dark"] .result-card.win { background: linear-gradient(160deg, #3A2E1F, #4A2E1F); color: #FFE9C7; }
.result-emoji { font-size: 64px; }
.result-card h2 { font-family: var(--font-display); font-weight: 900; font-size: 44px; margin: 6px 0; }
.stars { font-size: 30px; letter-spacing: 4px; }

/* ---------- writing ---------- */
.frame-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; font-family: var(--font-display); font-weight: 800; font-size: 19px; }
.frame-slot { border: 2px dashed var(--primary); background: transparent; color: var(--primary-2); font-family: var(--font-display); font-weight: 800; border-radius: 12px; padding: 8px 14px; cursor: pointer; min-width: 110px; }
.frame-slot.filled { border-style: solid; background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--text); }
.write-story { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 14px 0; }
.write-out { font-family: var(--font-display); font-weight: 800; font-size: 20px; line-height: 1.8; min-height: 60px; }
.free-write textarea { width: 100%; border: 2px dashed var(--primary); border-radius: 14px; padding: 12px; font-family: var(--font) ; font-size: 17px; margin-top: 10px; background: var(--bg-2); color: var(--text); }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

/* ---------- reflection ---------- */
.reflect-list { display: flex; flex-direction: column; gap: 12px; }
.reflect-row { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px; }
.reflect-label { font-family: var(--font-display); font-weight: 900; font-size: 18px; margin-bottom: 6px; }
.reflect-chip.chosen { border-color: var(--good); background: var(--good); color: #fff; }

.certificate { text-align: center; background: var(--card); border-radius: 28px; padding: 30px 20px; box-shadow: var(--shadow); animation: rise .4s ease; }
.cert-emoji { font-size: 64px; }
.certificate h2 { font-family: var(--font-display); font-weight: 900; margin: 6px 0; color: var(--primary-2); }
.cert-stats { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.cert-stats span { background: var(--bg); border-radius: 12px; padding: 8px 12px; font-weight: 800; }
.cert-badges { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.cert-badge { font-size: 30px; }
.cert-msg { font-style: italic; color: var(--text-2); }

/* ---------- install bar ---------- */
.install-bar { display: flex; align-items: center; gap: 8px; background: var(--accent-2); color: #4a3000; border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; font-weight: 800; box-shadow: var(--shadow-sm); font-size: 14px; }
.install-bar span { flex: 1; }

/* ---------- sec done overlay ---------- */
.sec-card { text-align: center; background: var(--card); border-radius: 24px; padding: 26px; max-width: 380px; width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.35); animation: rise .35s ease; }
.sec-emoji { font-size: 60px; animation: throb 1.3s infinite; }
.sec-card h2 { font-family: var(--font-display); margin: 8px 0; }
.sec-gains { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.gain { background: var(--bg); border-radius: 999px; padding: 8px 14px; font-weight: 900; color: var(--text); }

.error-card { border-left: 6px solid var(--bad); }

/* ---------- responsive / desktop ---------- */
@media (min-width: 640px) {
  #app { padding-top: 22px; }
  .opt-grid { grid-template-columns: 1fr 1fr; }
  .opt-grid-3 { grid-template-columns: repeat(3,1fr); }
  .mem-grid { grid-template-columns: repeat(5,1fr); }
  .hero { padding: 44px 30px 34px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}