/* Lumina course look, shared by every course (load after the course's own CSS, with lumina-fx.js).
   Academic inside, game outside: serif headings and calm reading cards, vivid colour for progress,
   feedback and rewards. Decided 2026-11-09 (replaces the white-paper-only look). */
:root {
  color-scheme: light;
  --lu-bg: #f5f4ff;
  --lu-card: #ffffff;
  --lu-ink: #1c1a3a;
  --lu-muted: #5d5a7c;
  --lu-line: #e2dff4;
  --lu-primary: #5b4ef0;
  --lu-violet: #8b5cf6;
  --lu-pink: #ec4899;
  --lu-gold: #f59e0b;
  --lu-cyan: #06b6d4;
  --lu-good: #059669;
  --lu-good-soft: #e7f8f0;
  --lu-nudge: #ea7317;
  --lu-nudge-soft: #fff4e8;
  --lu-hero: linear-gradient(125deg, #4338ca 0%, #6d28d9 52%, #c026d3 100%);
  --lu-btn: linear-gradient(135deg, #5b4ef0, #8b5cf6);
  --lu-shadow: 0 1px 2px rgba(40, 30, 110, .06), 0 8px 24px -10px rgba(40, 30, 110, .18);
  --lu-r: 16px;
  --lu-serif: "Source Serif 4", Charter, Georgia, serif;
  --lu-sans: Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* course tokens, mapped onto the shared palette */
  --sky: var(--lu-bg); --paper: var(--lu-bg); --ink: var(--lu-ink); --muted: var(--lu-muted); --faint: #8d89aa;
  --line: var(--lu-line); --line-2: #ece9fa; --tint: #f3f1fd; --glass-2: #f3f1fd;
  --accent: var(--lu-primary); --accent-soft: rgba(91, 78, 240, .1);
  --good: var(--lu-good); --good-soft: var(--lu-good-soft);
  --bad: var(--lu-nudge); --bad-soft: var(--lu-nudge-soft); --hot: #e8590c; --hot-soft: rgba(232, 89, 12, .1); --frontier: #e8590c;
  --gold: #c27c0e; --gold-soft: rgba(245, 158, 11, .14);
  --c1: #4f46e5; --c2: #e8590c;
  --radius: 12px;
  --serif: var(--lu-serif); --sans: var(--lu-sans);
}
html { background: var(--lu-bg); }
body {
  background: var(--lu-bg);
  background-image:
    radial-gradient(1100px 520px at 100% -8%, rgba(139, 92, 246, .13), transparent 62%),
    radial-gradient(900px 520px at -10% 30%, rgba(6, 182, 212, .07), transparent 60%),
    radial-gradient(800px 600px at 50% 115%, rgba(236, 72, 153, .07), transparent 60%);
  background-attachment: fixed;
  color: var(--lu-ink); font-family: var(--lu-sans); font-size: 16.5px; line-height: 1.62;
}
h1, h2, h3 { font-family: var(--lu-serif); font-weight: 650; letter-spacing: -.005em; color: var(--lu-ink); }
a { color: var(--lu-primary); }

/* top bar */
.topbar { background: rgba(255, 255, 255, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--lu-line); }
.brand { font-family: var(--lu-serif); font-weight: 700; color: var(--lu-ink); }
.brand span { color: var(--lu-pink); }
.topbar nav a { color: var(--lu-muted); }
.topbar nav a:hover { color: var(--lu-primary); }
#acct button { border-radius: 999px; border: 1.5px solid var(--lu-line); background: #fff; }
#acct button:hover { border-color: var(--lu-primary); }

/* hero header of every page */
.lhead, .shead, .chero {
  position: relative; overflow: hidden; color: #fff; background: var(--lu-hero);
  border-radius: 22px; padding: 26px 28px 24px; margin: 22px 0 18px; box-shadow: 0 18px 40px -18px rgba(79, 40, 200, .55);
}
.lhead::after, .shead::after, .chero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(1.5px 1.5px at 12% 22%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 78% 18%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 70%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 40% 82%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 62% 40%, #fff 50%, transparent 51%), radial-gradient(260px 160px at 95% 0%, rgba(255, 255, 255, .22), transparent 70%);
}
.lhead > *, .shead > *, .chero > * { position: relative; z-index: 1; }
.lhead h1, .shead h1, .chero h1 { color: #fff; margin: 4px 0 8px; font-size: clamp(27px, 4.6vw, 38px); }
.lhead .kicker, .shead .crumb, .chero .kicker { color: rgba(255, 255, 255, .78); font-family: var(--lu-sans); font-size: 13.5px; letter-spacing: .02em; }
.lhead .kicker a, .shead .crumb a, .chero .kicker a { color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .45); }
.lhead .hook, .shead .hook, .chero .lead, .chero p, .chero li { color: rgba(255, 255, 255, .9); }
.lhead .hook, .shead .hook { font-size: 17px; margin: 0; max-width: 640px; }
.chero .howto { margin: 14px 0 6px; }
.chero .howto li { color: rgba(255, 255, 255, .92); }
.chero .howto b { color: #fff; }
.chero .muted { color: rgba(255, 255, 255, .8); }
.chero .btn { background: #fff; color: #4c1d95; border-color: #fff; box-shadow: 0 4px 0 rgba(30, 10, 90, .35); }
.chero .btn:hover { background: #fff; filter: brightness(1.03); }

/* buttons: chunky, pressable */
.btn {
  background: var(--lu-btn); color: #fff; border: 0; border-radius: 999px; font: 650 15px/1.2 var(--lu-sans);
  padding: 10px 20px; cursor: pointer; box-shadow: 0 4px 0 #3f2fb8; transition: transform .08s, box-shadow .08s, filter .15s; text-decoration: none; display: inline-block;
}
.btn:hover { filter: brightness(1.07); background: var(--lu-btn); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #3f2fb8; }
.btn.small { padding: 7px 15px; font-size: 14px; }
.btn.ghost { background: #fff; color: var(--lu-primary); box-shadow: 0 3px 0 var(--lu-line); border: 1.5px solid var(--lu-line); }
.btn.ghost:hover { background: #faf9ff; border-color: var(--lu-primary); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: default; transform: none; }
.linkbtn { color: var(--lu-primary); font-weight: 600; }

/* section titles: Learn / Problems */
.stage, .part-title { border-top: 0; margin: 34px 0 10px; padding: 0; }
.stage h2, .part-title { display: flex; align-items: center; gap: 10px; font-family: var(--lu-serif); font-size: 23px; color: var(--lu-ink); text-transform: none; letter-spacing: 0; font-weight: 650; }
.stage h2::before, .part-title::before { content: ""; width: 8px; height: 26px; border-radius: 4px; background: linear-gradient(180deg, var(--lu-violet), var(--lu-pink)); flex: none; }
#s-levels h2::before { background: linear-gradient(180deg, var(--lu-gold), var(--lu-pink)); }
.stage p { color: var(--lu-muted); font-size: 15px; }

/* learn steps: cards with a numbered badge */
.lstep, .step {
  background: var(--lu-card); border: 1px solid var(--lu-line); border-radius: var(--lu-r); box-shadow: var(--lu-shadow);
  padding: 18px 20px 16px; margin: 0 0 14px;
}
.lstep:first-child { border-top: 1px solid var(--lu-line); }
.lstep h3 { align-items: center; }
.lstep h3 .k, .step .sn {
  display: inline-grid; place-items: center; width: 28px; height: 28px; min-width: 28px; border-radius: 50%;
  background: var(--lu-btn); color: #fff; font: 700 13.5px/1 var(--lu-sans); box-shadow: 0 2px 0 #3f2fb8;
}
.lstep.done h3 .k, .step:not(.cur) .sn { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 2px 0 #047857; }
.lstep:last-child:not(.done), .step.cur { border-color: rgba(91, 78, 240, .45); box-shadow: 0 0 0 4px rgba(91, 78, 240, .08), var(--lu-shadow); }
.step { display: flex; gap: 14px; padding: 18px 20px 16px; }
.step .sn { position: static; border: 0; flex: none; margin-top: 1px; }
.step.cur .sn { background: var(--lu-btn); color: #fff; }
.step .body { flex: 1; min-width: 0; }
.st-vis { background: none; }
.lstep .btn.next { margin-top: 14px; }

/* questions and problem cards */
.problem-card, .pcard {
  background: var(--lu-card); border: 1px solid var(--lu-line); border-radius: 20px; box-shadow: var(--lu-shadow);
  padding: 20px 22px; margin: 16px 0;
}
.problem-card.solved { border-color: rgba(5, 150, 105, .45); }
.problem-card .tag, .pcard .ptag {
  display: inline-block; padding: 3px 11px; border-radius: 999px; font: 700 12.5px/1.5 var(--lu-sans); letter-spacing: .03em;
  color: #fff; background: var(--lu-btn); margin-bottom: 8px; text-transform: none;
}
.ok-badge { background: #fff; color: var(--lu-good); border-radius: 999px; padding: 0 7px; margin-left: 4px; font-size: 11.5px; }
.solution .tag, .insight .tag { background: none; color: var(--lu-muted); padding: 0; }

/* choices */
.choices button, .opt, .tfrow .tfb button {
  border: 2px solid var(--lu-line); background: #fff; border-radius: 12px; color: var(--lu-ink);
  transition: transform .08s, border-color .15s, background .15s; box-shadow: 0 2px 0 var(--lu-line);
}
.choices button:hover:not(:disabled), .opt:hover:not([disabled]), .tfrow .tfb button:hover:not(:disabled) { border-color: var(--lu-violet); background: #faf8ff; transform: translateY(-1px); }
.choices button.sel, .opt.sel, .tfrow .tfb button.sel { border-color: var(--lu-primary); background: #efedff; box-shadow: 0 2px 0 var(--lu-primary); }
.choices button.right, .opt.right, .tfrow .tfb button.right { border-color: var(--lu-good); background: var(--lu-good-soft); box-shadow: 0 2px 0 var(--lu-good); opacity: 1; }
.choices button.wrong, .opt.wrong, .tfrow .tfb button.wrong { border-color: #f6b27a; background: var(--lu-nudge-soft); box-shadow: none; opacity: .75; }
.opt .mk { border-radius: 8px; background: #efedff; color: var(--lu-primary); border: 0; font-weight: 700; }
.opt.sel .mk { background: var(--lu-primary); color: #fff; }
.opt.right .mk { background: var(--lu-good); color: #fff; }
.chips button { border-radius: 999px; border: 1.5px solid var(--lu-line); background: #fff; color: var(--lu-ink); }
.chips button.on { background: var(--lu-primary); border-color: var(--lu-primary); color: #fff; }

/* inputs */
input.ans, select.ans, .st-ask input, textarea, select { border: 2px solid var(--lu-line); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
input.ans:focus, select.ans:focus, .st-ask input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--lu-primary); box-shadow: 0 0 0 4px rgba(91, 78, 240, .14); }

/* feedback: green when right, a warm nudge (never red, never the answer) when not yet */
.feedback, .fb { border-radius: 12px; }
.feedback.good, .fb.good, .st-fb.good, .st-note.good {
  color: #065f46; background: var(--lu-good-soft); border: 0; border-left: 4px solid var(--lu-good); padding: 8px 12px; border-radius: 10px;
}
.feedback.bad, .fb.bad, .st-fb.bad {
  color: #7c3a0a; background: var(--lu-nudge-soft); border: 0; border-left: 4px solid var(--lu-nudge); padding: 8px 12px; border-radius: 10px;
}
.feedback.bad::before, .fb.bad .verdict::before, .st-fb.bad::before { content: "💡 "; }
.fb .verdict { font-weight: 700; }
.fb.good .verdict { color: var(--lu-good); }
.fb.bad .verdict { color: var(--lu-nudge); }
.st-fb.good, .st-fb.bad { display: inline-block; margin-left: 8px; padding: 3px 10px; font-weight: 600; }
.st-fb:empty, .st-note:empty, .feedback:empty { display: none; }
.st-note { margin-top: 8px; }

/* level path (drawn by LuminaFX.ladder) */
.ladder { display: block; margin: 8px 0 6px; font-family: var(--lu-sans); }
.lfx-path { display: flex; align-items: center; gap: 0; margin: 6px 0 4px; max-width: 520px; }
.lfx-node { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
.lfx-dot {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 800 17px/1 var(--lu-sans);
  background: #fff; color: var(--lu-muted); border: 2.5px solid var(--lu-line); box-shadow: 0 3px 0 var(--lu-line);
}
.lfx-node.boss .lfx-dot { width: 52px; height: 52px; font-size: 22px; color: #b45309; }
.lfx-lab { font-size: 12.5px; font-weight: 700; color: var(--lu-muted); letter-spacing: .02em; }
.lfx-node.on .lfx-dot { border-color: var(--lu-primary); color: var(--lu-primary); box-shadow: 0 3px 0 var(--lu-primary), 0 0 0 6px rgba(91, 78, 240, .12); animation: lfx-glow 1.8s ease-in-out infinite; }
.lfx-node.on .lfx-lab { color: var(--lu-primary); }
.lfx-node.done .lfx-dot { background: linear-gradient(135deg, #fbbf24, #f59e0b); border-color: #f59e0b; color: #fff; box-shadow: 0 3px 0 #b45309; }
.lfx-node.done .lfx-lab { color: #b45309; }
.lfx-link { flex: 1; height: 5px; min-width: 24px; margin: 0 6px 22px; border-radius: 3px; background: var(--lu-line); }
.lfx-link.done { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
@keyframes lfx-glow { 50% { box-shadow: 0 3px 0 var(--lu-primary), 0 0 0 11px rgba(91, 78, 240, .06); } }
.won {
  display: block; margin: 12px 0 4px; padding: 12px 16px; border-radius: 14px; color: #713f12; font-size: 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a); border: 1px solid #fcd34d;
}
.won a { color: #92400e; font-weight: 700; }
.lvnote { color: var(--lu-muted); }

/* reading blocks */
pre.code { background: #1e1b4b; color: #e0e7ff; border: 0; border-left: 0; border-radius: 12px; padding: 12px 14px; box-shadow: var(--lu-shadow); }
pre.code .k { color: #a5b4fc; } pre.code .c { color: #8f8bb8; } pre.code .s { color: #fbbf24; } pre.code .hl { background: rgba(250, 204, 21, .18); }
code, kbd { background: #f1effd; border: 1px solid #e4e0fb; border-radius: 6px; }
pre.code code { background: none; border: 0; }
.note, .def, .points { border-radius: 12px; }
.points { background: #fff; border: 1px solid var(--lu-line); border-left: 4px solid var(--lu-gold); box-shadow: var(--lu-shadow); padding: 12px 16px; }
.solution, .insight { border-left: 4px solid var(--lu-violet); background: #faf9ff; border-radius: 0 12px 12px 0; padding: 8px 14px; }

/* overview pages */
.chapter { background: #fff; border: 1px solid var(--lu-line); border-radius: 20px; box-shadow: var(--lu-shadow); padding: 16px 20px 10px; margin: 18px 0; }
.chapter.locked { border: 1px dashed var(--lu-line); background: rgba(255, 255, 255, .6); }
.chapter header .num { display: inline-block; color: #fff; background: var(--lu-btn); border-radius: 999px; padding: 1px 10px; font: 700 12.5px/1.6 var(--lu-sans); letter-spacing: .02em; text-transform: none; }
.chapter.practice header .num { background: linear-gradient(135deg, #f59e0b, #ec4899); }
.lessons .st.done, .secs .st.done { color: #fff; background: var(--lu-good); border-radius: 999px; padding: 0 9px; font-weight: 700; font-size: 12px; }
.secs .st.part { color: var(--lu-primary); font-weight: 700; }
.exammap { background: #fff; border-radius: 12px; overflow: hidden; }
.pager a { background: #fff; border: 1px solid var(--lu-line); border-radius: 14px; padding: 10px 14px; text-decoration: none; box-shadow: var(--lu-shadow); }
.pager a:hover { border-color: var(--lu-primary); }
.locked { background: #fff; border: 1px solid var(--lu-line); border-radius: 18px; padding: 18px 20px; }
footer.foot, .foot { color: var(--lu-muted); }

/* ---------- effects ---------- */
.lfx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 9998; }
.lfx-progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 60; background: rgba(91, 78, 240, .08); pointer-events: none; }
.lfx-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #06b6d4, #5b4ef0, #ec4899); border-radius: 0 3px 3px 0; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.lfx-progress.full i { background: linear-gradient(90deg, #fbbf24, #f59e0b, #ec4899); }
.lfx-progress span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.lfx-toast {
  position: fixed; left: 50%; top: 16vh; z-index: 9999; pointer-events: none; text-align: center;
  transform: translate(-50%, -10px) scale(.6); opacity: 0; transition: opacity .2s, transform .35s cubic-bezier(.2, 1.6, .4, 1);
  background: #fff; border-radius: 22px; padding: 14px 28px 12px; box-shadow: 0 20px 50px -14px rgba(60, 30, 160, .45); border: 2px solid #ece9ff; max-width: calc(100vw - 32px);
}
.lfx-toast.in { opacity: 1; transform: translate(-50%, 0) scale(1); }
.lfx-toast b { display: block; font: 900 clamp(28px, 6vw, 42px)/1.1 var(--lu-sans); letter-spacing: -.01em;
  background: linear-gradient(120deg, #5b4ef0, #c026d3 55%, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lfx-toast span { display: block; margin-top: 4px; font: 600 15px/1.4 var(--lu-sans); color: var(--lu-muted); }
.lfx-toast.small { padding: 8px 20px 7px; top: 14vh; }
.lfx-toast.small b { font-size: 24px; }

.lfx-banner { position: fixed; inset: 0; z-index: 9997; display: grid; place-items: center; padding: 16px; background: rgba(24, 16, 70, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: lfx-fade .25s ease-out; }
.lfx-banner.out { opacity: 0; transition: opacity .3s; }
.lfx-card {
  width: min(420px, 100%); text-align: center; color: #fff; background: var(--lu-hero); border-radius: 26px; padding: 26px 24px 22px;
  box-shadow: 0 30px 80px -20px rgba(20, 10, 80, .7), inset 0 0 0 2px rgba(255, 255, 255, .18); animation: lfx-bounce .55s cubic-bezier(.2, 1.5, .4, 1);
}
.lfx-banner.boss .lfx-card { background: linear-gradient(130deg, #f59e0b 0%, #ec4899 50%, #7c3aed 100%); }
.lfx-kick { font: 800 12.5px/1 var(--lu-sans); letter-spacing: .18em; text-transform: uppercase; opacity: .85; }
.lfx-card h2 { color: #fff; font: 900 clamp(30px, 8vw, 40px)/1.08 var(--lu-sans); margin: 10px 0 6px; letter-spacing: -.01em; }
.lfx-card p { margin: 6px 0 16px; font-size: 16px; color: rgba(255, 255, 255, .92); }
.lfx-stars { font-size: 40px; letter-spacing: 8px; line-height: 1.1; }
.lfx-stars i { font-style: normal; color: rgba(255, 255, 255, .25); display: inline-block; }
.lfx-stars i.on { color: #fde047; text-shadow: 0 0 18px rgba(253, 224, 71, .7); animation: lfx-star .5s cubic-bezier(.2, 1.8, .4, 1) both; }
.lfx-go { font: 800 15px/1 var(--lu-sans); color: #4c1d95; background: #fff; border: 0; border-radius: 999px; padding: 12px 26px; cursor: pointer; box-shadow: 0 4px 0 rgba(30, 10, 90, .35); }
.lfx-go:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(30, 10, 90, .35); }
@keyframes lfx-fade { from { opacity: 0; } }
@keyframes lfx-bounce { from { transform: scale(.5) translateY(30px); opacity: 0; } }
@keyframes lfx-star { from { transform: scale(0) rotate(-40deg); } }
.lfx-pop { animation: lfx-pop .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes lfx-pop { 40% { transform: scale(1.025); } }
.lfx-shake { animation: lfx-shake .42s; }
@keyframes lfx-shake { 15%, 55% { transform: translateX(-6px); } 35%, 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .lfx-pop, .lfx-shake, .lfx-card, .lfx-stars i.on, .lfx-node.on .lfx-dot { animation: none; } }

@media (max-width: 560px) {
  .lhead, .shead, .chero { border-radius: 18px; padding: 20px 18px 18px; margin: 14px 0; }
  .lstep, .step, .problem-card, .pcard { padding: 15px 14px; border-radius: 16px; }
  .step { gap: 10px; padding: 15px 14px; }
  .lfx-dot { width: 38px; height: 38px; font-size: 15px; }
  .lfx-node.boss .lfx-dot { width: 44px; height: 44px; }
}
.bench { border-radius: 14px; border-color: var(--lu-line); background: #fff; }
.bench .seg { border-radius: 10px; overflow: hidden; } .bench .seg button.on { background: var(--lu-primary); color: #fff; }
