/* ============================================================
   EMT REFRESHER — Interactive Learning Game
   Overhauled visual system. Self-contained. No external deps
   except Google Fonts (Inter + Space Grotesk).
   ============================================================ */

:root {
  --navy: #0a1020;
  --navy-2: #13203b;
  --ink: #101622;
  --muted: #54607a;
  --line: #e7ebf3;
  --bg: #f6f8fc;
  --card: #ffffff;

  --ember: #e8521f;
  --ember-2: #ff7a3d;
  --ember-deep: #c23d12;
  --blue: #e8521f;
  --blue-2: #ff7a3d;
  --sky: #fdefe8;
  --grape: #c23d12;
  --teal: #0e8c84;
  --green: #16a34a;
  --green-2: #22c55e;
  --green-soft: #e3f7ea;
  --red: #c62828;
  --red-soft: #fde7ec;
  --gold: #ffb020;

  --shadow-sm: 0 3px 12px rgba(16, 22, 34, 0.08);
  --shadow: 0 10px 30px rgba(16, 22, 34, 0.12);
  --shadow-lg: 0 22px 60px rgba(16, 22, 34, 0.22);
  --glow-ember: 0 8px 26px rgba(232, 82, 31, 0.45);
  --glow-blue: 0 8px 26px rgba(232, 82, 31, 0.35);
  --radius: 20px;
  --radius-sm: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* ---------- Animated background ---------- */
.bg-aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; background:
  radial-gradient(1200px 700px at 80% -10%, #fde9dd 0%, transparent 60%),
  radial-gradient(900px 600px at -5% 20%, #fdebe0 0%, transparent 55%),
  var(--bg); }
.bg-aurora .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.5; }
.blob.b1 { width: 420px; height: 420px; background: radial-gradient(circle, #ff9250, transparent 70%); top: -80px; right: -60px; animation: float1 18s ease-in-out infinite; }
.blob.b2 { width: 480px; height: 480px; background: radial-gradient(circle, #ffd089, transparent 70%); bottom: -120px; left: -80px; animation: float2 22s ease-in-out infinite; }
.blob.b3 { width: 320px; height: 320px; background: radial-gradient(circle, #ff7a3d, transparent 70%); top: 40%; left: 55%; opacity: 0.35; animation: float1 26s ease-in-out infinite reverse; }
.bg-grid { position: absolute; inset: 0; opacity: 0.4;
  background-image: linear-gradient(rgba(16,22,34,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(16,22,34,.04) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 50% 0, #000 30%, transparent 75%); }
@keyframes float1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-30px,40px)} }
@keyframes float2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,-30px)} }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 100;
  background: linear-gradient(115deg, #0a1020, var(--navy-2));
  color: #fff; box-shadow: 0 4px 24px rgba(10, 28, 64, 0.35); }
.topbar-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 12px 20px; }
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.brand .logo { width: 44px; height: 44px; border-radius: 13px; background: linear-gradient(135deg, var(--ember), var(--ember-deep));
  display: grid; place-items: center; font-size: 23px; box-shadow: var(--glow-ember); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0) rotate(-2deg)} 50%{transform:translateY(-3px) rotate(2deg)} }
.brand h1 { font-family: var(--display); font-size: 1.2rem; letter-spacing: 0.2px; }
.brand small { display: block; font-size: 0.7rem; opacity: 0.72; font-weight: 500; }
.topbar-stats { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chip { background: rgba(255,255,255,0.12); padding: 7px 13px; border-radius: 999px; font-size: 0.85rem; font-weight: 800;
  display: flex; align-items: center; gap: 6px; backdrop-filter: blur(6px); font-variant-numeric: tabular-nums; }
.chip .ic { font-size: 0.95rem; }
.chip.streak { background: rgba(255,140,60,0.22); }
.chip.streak.hot { animation: pulseGlow 1.2s infinite; }
@keyframes pulseGlow { 0%,100%{box-shadow:0 0 0 0 rgba(255,140,60,.4)} 50%{box-shadow:0 0 0 6px rgba(255,140,60,0)} }
.chip.lvl { background: rgba(255,176,32,0.2); }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(255,255,255,0.12); color: #fff; cursor: pointer; font-size: 1rem; transition: transform .15s, background .15s; }
.icon-btn:hover { background: rgba(255,255,255,0.24); transform: scale(1.06); }
.btn-ghost { background: rgba(255,255,255,0.14); color: #fff; border: none; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 0.82rem; transition: background 0.2s, transform .15s; }
.btn-ghost:hover { background: rgba(255,255,255,0.28); transform: translateY(-1px); }
.xp-track { height: 4px; background: rgba(255,255,255,0.12); }
.xp-track > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--ember)); box-shadow: 0 0 12px rgba(255,176,32,.8); transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* ---------- Layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 20px 90px; }
.view { animation: fadeUp 0.4s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Buttons (chunky 3D) ---------- */
.btn { position: relative; border: none; cursor: pointer; font-family: var(--font); font-weight: 800; font-size: 0.94rem;
  padding: 13px 24px; border-radius: 14px; transition: transform 0.12s, box-shadow 0.2s, filter .2s;
  display: inline-flex; align-items: center; gap: 8px; letter-spacing: 0.2px; }
.btn:active { transform: translateY(2px); }
.btn-primary { background: linear-gradient(135deg, var(--ember), var(--ember-deep)); color: #fff; box-shadow: 0 5px 0 #9c3110, var(--glow-ember); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { box-shadow: 0 1px 0 #b93c0e, var(--glow-ember); }
.btn-light { background: #fff; color: var(--navy); box-shadow: 0 4px 0 #d6def0, var(--shadow-sm); }
.btn-light:active { box-shadow: 0 1px 0 #d6def0; }
.btn-blue { background: linear-gradient(135deg, var(--ember-2), var(--ember-deep)); color: #fff; box-shadow: 0 5px 0 #9c3110, var(--glow-blue); }
.btn-blue:active { box-shadow: 0 1px 0 #1d4894; }
.btn-exam { background: linear-gradient(135deg, var(--red), #a31621); color: #fff; box-shadow: 0 5px 0 #7f1119, 0 8px 22px rgba(198,40,40,.4); }
.btn-exam:active { box-shadow: 0 1px 0 #a3152f; }
.btn-green { background: linear-gradient(135deg, var(--green-2), var(--green)); color: #fff; box-shadow: 0 5px 0 #12813a, 0 8px 22px rgba(22,163,74,.35); }
.btn-lg { padding: 16px 30px; font-size: 1.02rem; border-radius: 16px; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-radius: 28px; color: #fff; padding: 38px 34px; margin-bottom: 22px;
  background: linear-gradient(125deg, #0a1020 0%, #13203b 60%, #274069 100%); box-shadow: var(--shadow-lg); }
.hero::after { content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232,82,31,0.55), transparent 68%); }
.hero::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.06) 1.4px, transparent 1.4px); background-size: 22px 22px; opacity: .5; }
.hero-eyebrow { position: relative; display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.14); padding: 6px 13px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; letter-spacing: .4px; margin-bottom: 14px; }
.hero h2 { position: relative; font-family: var(--display); font-size: 2.15rem; line-height: 1.1; margin-bottom: 10px; }
.hero h2 em { font-style: normal; color: #ffcf9a; }
.hero p { position: relative; max-width: 600px; opacity: 0.92; font-size: 1.02rem; }
.hero-actions { position: relative; margin-top: 20px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Stat row ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--card); border-radius: var(--radius-sm); padding: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); text-align: center; position: relative; overflow: hidden; }
.stat .sv { font-family: var(--display); font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.stat .sl { font-size: 0.74rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.stat .se { font-size: 1.3rem; margin-bottom: 2px; }

/* ---------- Section titles ---------- */
.sec-title { display: flex; align-items: center; gap: 10px; margin: 32px 4px 6px; font-family: var(--display); font-size: 1.3rem; }
.sec-title .ic { font-size: 1.2rem; }
.sec-sub { color: var(--muted); font-size: 0.9rem; margin: 0 4px 18px; }

/* ---------- Daily challenge ---------- */
.daily { position: relative; overflow: hidden; border-radius: var(--radius); padding: 24px 26px; margin-bottom: 26px;
  background: linear-gradient(120deg, #ff7a3d, #e8521f 55%, #c23d12); color: #fff; box-shadow: 0 16px 44px rgba(232,82,31,.4); display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.daily::after { content: "⚡"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 6rem; opacity: 0.12; }
.daily .d-ic { font-size: 2.6rem; }
.daily .d-body { flex: 1; min-width: 200px; }
.daily .d-body h3 { font-family: var(--display); font-size: 1.25rem; }
.daily .d-body p { opacity: 0.9; font-size: 0.9rem; margin-top: 3px; }
.daily .d-done { background: rgba(255,255,255,.16); padding: 6px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; }

/* ---------- Module grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.mod-card { position: relative; overflow: hidden; background: var(--card); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-sm); cursor: pointer; border: 1px solid var(--line); transition: transform 0.2s, box-shadow 0.25s; }
.mod-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--mc, var(--blue)); }
.mod-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.mod-card .mc-top { display: flex; align-items: flex-start; gap: 14px; }
.mod-card .icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 27px; color: #fff; flex-shrink: 0; box-shadow: 0 8px 20px rgba(15,44,92,.18); }
.mod-card .num { margin-left: auto; font-family: var(--display); font-size: 2.4rem; font-weight: 700; color: #eef3fb; line-height: 1; }
.mod-card h3 { font-size: 1.1rem; margin: 14px 0 5px; }
.mod-card .desc { color: var(--muted); font-size: 0.85rem; margin-bottom: 12px; min-height: 36px; }
.mod-card .stars { display: flex; gap: 3px; font-size: 0.95rem; margin-bottom: 12px; }
.mod-card .stars .s { filter: grayscale(1); opacity: 0.3; }
.mod-card .stars .s.on { filter: none; opacity: 1; }
.mod-card .mini-bar { height: 8px; background: var(--sky); border-radius: 999px; overflow: hidden; }
.mod-card .mini-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--mc, var(--blue)), var(--blue-2)); border-radius: 999px; transition: width 0.6s; }
.mod-card .foot-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.tag-done { color: var(--green); }

/* ---------- Module detail ---------- */
.crumb { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.88rem; margin-bottom: 14px; cursor: pointer; font-weight: 700; }
.crumb:hover { color: var(--blue); }
.mod-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.mod-head .icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 31px; color: #fff; flex-shrink: 0; box-shadow: var(--shadow); }
.mod-head h2 { font-family: var(--display); font-size: 1.6rem; }
.mod-head p { color: var(--muted); margin-top: 2px; font-size: 0.9rem; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; background: var(--card); border-radius: 999px; padding: 6px; box-shadow: var(--shadow-sm); margin-bottom: 22px; overflow-x: auto; border: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; min-width: fit-content; border: none; background: transparent; cursor: pointer; padding: 11px 16px; border-radius: 999px;
  font-weight: 800; font-size: 0.86rem; color: var(--muted); white-space: nowrap; transition: all 0.2s; display: flex; align-items: center; gap: 7px; justify-content: center; }
.tab.active { background: linear-gradient(135deg, var(--navy), var(--blue)); color: #fff; box-shadow: var(--glow-blue); }
.tab:not(.active):hover { background: var(--sky); color: var(--navy); }
.tab .tick { color: var(--green-2); }

/* ---------- Learn content ---------- */
.learn { background: var(--card); border-radius: var(--radius); padding: 30px 32px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.learn h3 { font-family: var(--display); color: var(--navy); margin: 28px 0 12px; font-size: 1.22rem; display: flex; align-items: center; gap: 10px; }
.learn h3:first-child { margin-top: 0; }
.learn h3 .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 0 4px rgba(255,106,44,.18); }
.learn h4 { color: var(--blue); margin: 18px 0 6px; font-size: 1.02rem; }
.learn p { margin-bottom: 11px; }
.learn ul { margin: 0 0 15px 2px; list-style: none; }
.learn ul li { position: relative; padding-left: 24px; margin-bottom: 8px; }
.learn ul li::before { content: "▸"; position: absolute; left: 4px; color: var(--ember); font-weight: 800; }
.learn strong { color: var(--navy); }
.callout { background: var(--sky); border-left: 4px solid var(--blue); border-radius: 0 12px 12px 0; padding: 13px 17px; margin: 15px 0; }
.callout.key { background: #fff6ee; border-left-color: var(--ember); }
.callout.warn { background: var(--red-soft); border-left-color: var(--red); }
.callout .k { font-weight: 800; color: var(--navy); }
.datatable { width: 100%; border-collapse: collapse; margin: 13px 0; font-size: 0.9rem; overflow: hidden; border-radius: 12px; box-shadow: var(--shadow-sm); }
.datatable th { background: var(--navy); color: #fff; text-align: left; padding: 10px 13px; }
.datatable td { padding: 10px 13px; border-bottom: 1px solid var(--line); background: #fff; }
.datatable tr:nth-child(even) td { background: #f7fafe; }
.learn-done { margin-top: 26px; text-align: center; }

/* ---------- Immersive game stage ---------- */
.gstage { position: relative; border-radius: var(--radius); padding: 24px; background: linear-gradient(160deg, #0a1020, #1a2a49); color: #fff; box-shadow: var(--shadow-lg); overflow: hidden; }
.gstage::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.05) 1.2px, transparent 1.2px); background-size: 20px 20px; opacity: .5; pointer-events: none; }
.g-hud { position: relative; display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.g-hud .pill { background: rgba(255,255,255,.12); border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 0.86rem; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.g-hud .pill.score { background: rgba(255,176,32,.22); }
.g-hud .qcount { margin-left: auto; opacity: 0.8; font-weight: 700; font-size: 0.85rem; }
.hearts { display: flex; gap: 3px; font-size: 1.05rem; }
.hearts .h.lost { filter: grayscale(1); opacity: 0.3; transform: scale(.85); transition: .3s; }

/* combo meter */
.combo-wrap { position: relative; height: 10px; background: rgba(255,255,255,.14); border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.combo-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--ember)); border-radius: 999px; transition: width .3s; box-shadow: 0 0 12px rgba(255,176,32,.7); }
.combo-label { display: flex; justify-content: space-between; font-size: 0.76rem; font-weight: 800; opacity: 0.85; margin-bottom: 14px; }
.combo-flame { color: var(--ember-2); }
.combo-flame.big { animation: flamePulse .5s; }
@keyframes flamePulse { 0%{transform:scale(1)} 50%{transform:scale(1.4)} 100%{transform:scale(1)} }

/* timer bar */
.tbar { height: 8px; background: rgba(255,255,255,.14); border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.tbar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green-2), var(--gold)); border-radius: 999px; transition: width .1s linear; }
.tbar.warn > span { background: linear-gradient(90deg, var(--gold), var(--red)); }

/* question */
.g-stem { font-family: var(--display); font-size: 1.32rem; line-height: 1.35; margin-bottom: 6px; }
.g-scn { background: rgba(255,255,255,.1); border-left: 3px solid var(--ember); border-radius: 0 10px 10px 0; padding: 12px 15px; margin-bottom: 16px; font-size: 0.92rem; }
.g-opts { display: grid; gap: 11px; margin-top: 16px; }
.g-opt { text-align: left; border: 2px solid rgba(255,255,255,.16); background: rgba(255,255,255,.07); color: #fff; border-radius: 14px;
  padding: 15px 17px; cursor: pointer; font-size: 0.97rem; font-weight: 600; transition: all 0.14s; display: flex; align-items: center; gap: 13px; }
.g-opt:hover:not(.locked) { border-color: #fff; background: rgba(255,255,255,.16); transform: translateX(3px); }
.g-opt .key { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.16); display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; flex-shrink: 0; }
.g-opt.correct { border-color: var(--green-2); background: rgba(34,197,94,.25); animation: popIn .3s; }
.g-opt.correct .key { background: var(--green-2); }
.g-opt.wrong { border-color: var(--red); background: rgba(239,45,86,.22); animation: shake .4s; }
.g-opt.wrong .key { background: var(--red); }
.g-opt.locked { cursor: default; }
@keyframes popIn { 0%{transform:scale(.96)} 50%{transform:scale(1.02)} 100%{transform:scale(1)} }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 60%{transform:translateX(8px)} }
.g-explain { margin-top: 15px; padding: 14px 16px; border-radius: 12px; background: rgba(255,255,255,.1); border-left: 4px solid var(--gold); font-size: 0.9rem; animation: fadeUp .3s; }
.g-explain.ok { border-left-color: var(--green-2); }
.g-explain .k { font-weight: 800; }
.g-next { margin-top: 18px; display: flex; justify-content: flex-end; gap: 10px; }
.plusfx { position: absolute; font-weight: 900; font-family: var(--display); color: var(--gold); pointer-events: none; animation: floatUp 1s ease forwards; text-shadow: 0 2px 8px rgba(0,0,0,.4); z-index: 5; }
@keyframes floatUp { 0%{opacity:0; transform:translateY(6px) scale(.8)} 20%{opacity:1} 100%{opacity:0; transform:translateY(-40px) scale(1.2)} }

/* screen flash */
.flash-ok, .flash-bad { position: fixed; inset: 0; z-index: 60; pointer-events: none; animation: flashFade .5s ease forwards; }
.flash-ok { background: radial-gradient(circle, rgba(34,197,94,.25), transparent 60%); }
.flash-bad { background: radial-gradient(circle, rgba(198,40,40,.25), transparent 60%); }
@keyframes flashFade { from{opacity:1} to{opacity:0} }

/* ---------- Flashcards ---------- */
.flash-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.flash-counter { color: #dce6f7; font-weight: 800; font-size: 0.9rem; }
.flashcard { width: 100%; max-width: 580px; height: 330px; perspective: 1500px; cursor: pointer; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s cubic-bezier(.2,.9,.3,1); transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 34px; text-align: center; box-shadow: var(--shadow-lg); }
.flash-front { background: linear-gradient(140deg, #13203b, #2c4470); color: #fff; }
.flash-front .term { font-family: var(--display); font-size: 1.85rem; font-weight: 700; }
.flash-front .hint { position: absolute; bottom: 20px; font-size: 0.78rem; opacity: 0.75; }
.flash-back { background: #fff; border: 3px solid var(--blue); transform: rotateY(180deg); color: var(--ink); }
.flash-back .def { font-size: 1.18rem; }
.flash-tag { position: absolute; top: 16px; left: 16px; font-size: 0.72rem; background: rgba(255,255,255,0.2); padding: 4px 11px; border-radius: 999px; font-weight: 700; }
.flash-back .flash-tag { background: var(--sky); color: var(--muted); }
.flash-controls { display: flex; align-items: center; gap: 12px; }
.round-btn { width: 50px; height: 50px; border-radius: 50%; border: none; background: #fff; box-shadow: var(--shadow-sm); cursor: pointer; font-size: 1.3rem; color: var(--navy); transition: transform 0.15s, background .15s; }
.round-btn:hover:not(:disabled) { transform: scale(1.1); background: var(--sky); }
.round-btn:disabled { opacity: 0.35; cursor: default; }
.conf-row { display: flex; gap: 10px; }
.conf { border: none; cursor: pointer; padding: 10px 18px; border-radius: 12px; font-weight: 800; font-size: 0.86rem; color: #fff; transition: transform .12s; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.conf:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.conf.again { background: var(--red); }
.conf.good { background: var(--blue); }
.conf.easy { background: var(--green); }

/* ---------- Matching ---------- */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col h4 { text-align: center; color: #cdd9ee; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; font-weight: 800; }
.match-item { background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.16); color: #fff; border-radius: 13px; padding: 14px 15px; margin-bottom: 10px; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: all 0.15s; user-select: none; }
.match-item:hover:not(.matched) { border-color: #fff; background: rgba(255,255,255,.16); }
.match-item.selected { border-color: var(--gold); background: rgba(255,176,32,.2); box-shadow: 0 0 0 3px rgba(255,176,32,.25); }
.match-item.matched { background: rgba(34,197,94,.22); border-color: var(--green-2); color: #d6ffe4; cursor: default; opacity: 0.7; }
.match-item.miss { animation: shake 0.4s; border-color: var(--red); }

/* ---------- Result screen ---------- */
.result { text-align: center; background: var(--card); border-radius: var(--radius); padding: 42px 30px; box-shadow: var(--shadow); max-width: 640px; margin: 0 auto; border: 1px solid var(--line); }
.result .ring { width: 168px; height: 168px; margin: 0 auto 18px; position: relative; }
.result .ring svg { transform: rotate(-90deg); }
.result .ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 2.3rem; font-weight: 700; color: var(--navy); }
.result h2 { font-family: var(--display); font-size: 1.6rem; margin-bottom: 6px; }
.result .msg { color: var(--muted); margin-bottom: 20px; }
.result-stars { font-size: 2.2rem; margin: 4px 0 14px; letter-spacing: 6px; }
.result-stars .s { filter: grayscale(1); opacity: 0.28; display: inline-block; }
.result-stars .s.on { filter: none; opacity: 1; animation: popStar .4s backwards; }
.result-stars .s.on:nth-child(2){ animation-delay:.12s } .result-stars .s.on:nth-child(3){ animation-delay:.24s }
@keyframes popStar { 0%{transform:scale(0) rotate(-40deg)} 70%{transform:scale(1.3)} 100%{transform:scale(1)} }
.result-mini { display: flex; justify-content: center; gap: 22px; margin-bottom: 20px; flex-wrap: wrap; }
.result-mini .rm { text-align: center; }
.result-mini .rm .v { font-family: var(--display); font-size: 1.3rem; font-weight: 700; color: var(--navy); }
.result-mini .rm .l { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.badge-pop { font-size: 3.4rem; animation: bigPop 0.6s cubic-bezier(.2,1.5,.4,1); }
@keyframes bigPop { 0%{transform:scale(0) rotate(-20deg)} 60%{transform:scale(1.25)} 100%{transform:scale(1)} }

/* ---------- Badges ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 14px; }
.badge-card { background: var(--card); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow-sm); border: 1px solid var(--line); transition: transform .2s; }
.badge-card.earned { border-color: var(--gold); box-shadow: 0 8px 22px rgba(255,176,32,.25); }
.badge-card.earned:hover { transform: translateY(-4px); }
.badge-card .em { font-size: 2.4rem; filter: grayscale(1); opacity: 0.32; transition: all 0.3s; }
.badge-card.earned .em { filter: none; opacity: 1; }
.badge-card .bn { font-size: 0.84rem; font-weight: 800; margin-top: 8px; }
.badge-card .bd { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

/* ---------- Exam ---------- */
.exam-intro { background: var(--card); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); max-width: 720px; margin: 0 auto; text-align: center; border: 1px solid var(--line); }
.exam-intro .big { font-size: 3.2rem; }
.exam-intro h2 { font-family: var(--display); font-size: 1.7rem; margin: 6px 0; }
.exam-facts { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin: 24px 0; }
.fact { background: var(--sky); border-radius: 14px; padding: 18px; }
.fact .n { font-family: var(--display); font-size: 1.7rem; font-weight: 700; color: var(--navy); }
.fact .l { font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.exam-timer { position: sticky; top: 74px; z-index: 40; background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 999px; display: flex; align-items: center; gap: 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.exam-timer .t { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.15rem; margin-left: auto; }
.exam-timer.low { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.7; } }
.review-item { background: var(--card); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow-sm); border-left: 4px solid var(--green); }
.review-item.bad { border-left-color: var(--red); }
.review-item .rq { font-weight: 700; margin-bottom: 8px; }
.review-item .ra { font-size: 0.88rem; margin-bottom: 4px; }
.review-item .ra .lab { font-weight: 800; }
.review-item .ra.you-wrong { color: var(--red); }
.review-item .ra.correct { color: var(--green); }

/* quiz progress (exam) */
.quiz { max-width: 740px; margin: 0 auto; }
.q-card { background: var(--card); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.q-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.q-progress .bar { flex: 1; height: 10px; background: var(--sky); border-radius: 999px; overflow: hidden; }
.q-progress .bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue-2)); border-radius: 999px; transition: width .4s; }
.q-progress .qn { font-weight: 800; color: var(--muted); font-size: 0.84rem; white-space: nowrap; }
.q-stem { font-family: var(--display); font-size: 1.15rem; font-weight: 600; margin-bottom: 6px; }
.opts { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.opt { text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 13px 16px; cursor: pointer; font-size: 0.95rem; font-weight: 500; transition: all 0.15s; display: flex; align-items: center; gap: 12px; }
.opt:hover:not(.locked) { border-color: var(--blue); background: var(--sky); }
.opt .key { width: 26px; height: 26px; border-radius: 7px; background: var(--sky); color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 0.82rem; flex-shrink: 0; }
.opt.correct { border-color: var(--green); background: var(--green-soft); }
.opt.correct .key { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt.wrong .key { background: var(--red); color: #fff; }
.opt.locked { cursor: default; }
.q-nav { display: flex; justify-content: space-between; margin-top: 20px; }

/* ---------- Modal / celebration ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 150; background: rgba(10,20,40,.6); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: fadeFast .25s; }
@keyframes fadeFast { from{opacity:0} to{opacity:1} }
.modal-card { background: #fff; border-radius: 26px; padding: 38px 34px; max-width: 440px; text-align: center; box-shadow: var(--shadow-lg); animation: modalPop .5s cubic-bezier(.2,1.4,.4,1); }
@keyframes modalPop { 0%{transform:scale(.7); opacity:0} 100%{transform:scale(1); opacity:1} }
.modal-card .m-em { font-size: 4rem; animation: bob 1.4s ease-in-out infinite; }
.modal-card h2 { font-family: var(--display); font-size: 1.7rem; margin: 8px 0 6px; color: var(--navy); }
.modal-card p { color: var(--muted); margin-bottom: 20px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow-lg); font-weight: 800; font-size: 0.9rem; animation: toastIn 0.35s; display: flex; align-items: center; gap: 8px; }
.toast.xp { background: linear-gradient(135deg, var(--ember), var(--ember-deep)); }
.toast.badge { background: linear-gradient(135deg, var(--gold), #ffca55); color: var(--navy); }
.toast.streak { background: linear-gradient(135deg, #ff7a3d, #c62828); }
@keyframes toastIn { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- FX canvas ---------- */
#fxCanvas { position: fixed; inset: 0; z-index: 140; pointer-events: none; width: 100vw; height: 100vh; }

/* ---------- Lesson Plan (printable) ---------- */
.lp-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.lp-sheet { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px 44px; max-width: 900px; margin: 0 auto; border: 1px solid var(--line); }
.lp-head { border-bottom: 3px solid var(--navy); padding-bottom: 16px; margin-bottom: 22px; }
.lp-brand { font-size: 0.78rem; font-weight: 900; letter-spacing: 2px; color: var(--ember); }
.lp-head h1 { font-family: var(--display); font-size: 1.7rem; color: var(--navy); margin: 6px 0 10px; }
.lp-meta { display: flex; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
.lp-meta strong { color: var(--ink); }
.lp-section { margin-bottom: 22px; }
.lp-section h2 { font-size: 1.05rem; color: var(--navy); border-left: 4px solid var(--ember); padding-left: 10px; margin-bottom: 10px; }
.lp-lead { color: var(--muted); margin-bottom: 8px; }
.lp-list { margin-left: 20px; }
.lp-list li { margin-bottom: 6px; }
.lp-two { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.lp-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.lp-table th { background: var(--navy); color: #fff; text-align: left; padding: 9px 10px; }
.lp-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lp-table tr:nth-child(even) td { background: #f8fafd; }
.lp-time { font-weight: 800; color: var(--navy); white-space: nowrap; }
.lp-dur { color: var(--muted); white-space: nowrap; }
.lp-phase { font-weight: 700; color: var(--ember); white-space: nowrap; }
.lp-foot { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 0.78rem; }
@media (max-width: 640px) { .lp-two { grid-template-columns: 1fr; gap: 0; } .lp-sheet { padding: 24px 20px; } }

/* ---------- Print ---------- */
@media print {
  .topbar, .foot, .toast-wrap, .no-print, .lp-actions, .bg-aurora, #fxCanvas, #modalRoot { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .lp-sheet { box-shadow: none; border: none; border-radius: 0; max-width: none; padding: 0.4in 0.5in; }
  .lp-section, .lp-two { page-break-inside: avoid; }
  .lp-table tr { page-break-inside: avoid; }
  @page { margin: 0.5in; }
}

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 40px; }
.center { text-align: center; }
.mt { margin-top: 18px; }
.foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 30px 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .stat-row { grid-template-columns: repeat(2,1fr); }
  .exam-facts { grid-template-columns: 1fr; }
  .hero h2 { font-size: 1.6rem; }
  .brand h1 { font-size: 1.05rem; }
  .topbar-stats .txt { display: none; }
  .chip { padding: 6px 10px; }
  .learn { padding: 22px 20px; }
  .flashcard { height: 290px; }
  .g-stem { font-size: 1.15rem; }
  .match-grid { gap: 8px; }
  .gstage { padding: 18px 14px; }
}
@media (max-width: 460px) {
  .topbar-stats .icon-btn, .chip.lvl { display: none; }
}

/* home link in topbar + footer links back to the main site */
a.btn-ghost { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.foot a { color: var(--muted); text-decoration: underline; }
.foot a:hover { color: #fff; }
