:root {
  --bg: #0b1020; --bg2: #0f1629; --panel: #121a2f; --panel2: #18223b; --line: #24304d; --line2: #2f3d60;
  --txt: #e5e9f2; --mut: #93a0bd; --dim: #66718c;
  --acc: #6c7bff; --acc2: #8b97ff; --ok: #22c55e; --bad: #f05252; --warn: #f5a524;
  --term-bg: #0a0e1a; --left: 46%;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--txt); font: 15px/1.55 system-ui, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
a { color: var(--acc2); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .88em; background: #1b2540; border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--mut); } .small { font-size: 13px; } .hidden { display: none !important; } .spacer { flex: 1; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); color: var(--txt); border: 1px solid var(--line2);
  border-radius: 8px; padding: 7px 14px; font: 600 14px system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--acc); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.primary:hover { background: var(--acc2); }
.btn.success { background: #15803d; border-color: #16a34a; color: #fff; }
.btn.warn { background: #3a2a0a; border-color: #7a5a14; color: #ffd58a; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--mut); }
.btn.ghost:hover { color: var(--txt); background: var(--panel2); }
.btn.small { padding: 3px 8px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; }

/* ---------- top bar ---------- */
.topbar { height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--txt); font-size: 18px; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--acc2); }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff; font: 700 14px var(--mono); }
.brand.big { font-size: 26px; justify-content: center; } .brand.big .logo { width: 42px; height: 42px; font-size: 18px; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--mut); font-size: 14px; min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--mut); } .crumbs a:hover { color: var(--txt); }
.crumbs .sep { color: var(--dim); }
.lab-ip { font: 12px var(--mono); color: var(--dim); }

/* ---------- layout ---------- */
#app { position: absolute; top: 52px; left: 0; right: 0; bottom: 0; display: flex; }
.view { flex: 1; overflow: auto; min-width: 0; }
.splitter { width: 5px; cursor: col-resize; background: var(--line); display: none; }
.splitter:hover, .splitter.drag { background: var(--acc); }
.term-pane { display: none; flex-direction: column; min-width: 0; background: var(--term-bg); }
body.with-term .view { flex: 0 0 var(--left); }
body.with-term .splitter { display: block; }
body.with-term .term-pane { display: flex; flex: 1; }
body.dragging { user-select: none; cursor: col-resize; }

/* ---------- terminal ---------- */
.term-bar { display: flex; align-items: center; gap: 4px; height: 38px; padding: 0 6px; background: #0e1424; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 6px 6px 0 0; color: var(--mut); font: 13px var(--mono); cursor: pointer; border: 1px solid transparent; }
.tab.active { background: var(--term-bg); color: var(--txt); border-color: var(--line); border-bottom-color: var(--term-bg); }
.tab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.tab .dot.on { background: var(--ok); } .tab .dot.off { background: var(--bad); }
.tab .x { color: var(--dim); font-size: 12px; } .tab .x:hover { color: var(--bad); }
.tab-new { background: none; border: 0; color: var(--mut); font-size: 16px; cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.tab-new:hover { background: var(--panel2); color: var(--txt); }
.term-status { font-size: 12px; color: var(--dim); margin-right: 6px; }
.terms { position: relative; flex: 1; min-height: 0; }
.term { position: absolute; inset: 0; padding: 6px 4px 4px 10px; display: none; }
.term.active { display: block; }
.term-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #0a0e1acc; z-index: 5; }
.term-overlay .box { text-align: center; color: var(--mut); }
.xterm .xterm-viewport { scrollbar-width: thin; scrollbar-color: #2a3555 transparent; }

/* ---------- pages ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 28px 28px 80px; }
.hero { display: flex; gap: 20px; align-items: center; margin-bottom: 26px; }
.hero .icon { font-size: 52px; width: 84px; height: 84px; display: grid; place-items: center; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); }
.hero h1 { margin: 0; font-size: 28px; } .hero p { margin: 4px 0 0; color: var(--mut); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); margin: 30px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.course-card { cursor: pointer; transition: transform .12s, border-color .12s; position: relative; overflow: hidden; }
.course-card:hover { transform: translateY(-2px); border-color: var(--acc); }
.course-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c, var(--acc)); }
.course-card.soon { opacity: .55; cursor: default; } .course-card.soon:hover { transform: none; border-color: var(--line); }
.course-card .top { display: flex; gap: 12px; align-items: center; }
.course-card .ic { font-size: 32px; }
.course-card h3 { margin: 0; font-size: 18px; } .course-card .sub { color: var(--mut); font-size: 13px; }
.course-card .desc { color: var(--mut); font-size: 14px; flex: 1; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--panel2); color: var(--mut); border: 1px solid var(--line); }
.progress { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #4ade80); transition: width .4s; }
.prog-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--mut); }
.prog-row .progress { flex: 1; }
.errbox { border: 1px solid #7f1d1d; background: #2a0f12; color: #fecaca; border-radius: 10px; padding: 10px 14px; font-size: 13px; }

.module { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; margin: 14px 0; overflow: hidden; }
.module-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
.module-head h3 { margin: 0; font-size: 16px; flex: 1; }
.module-head .num { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--panel2); color: var(--acc2); font-weight: 700; }
.module-head .count { color: var(--mut); font-size: 13px; }
.module-head .chev { color: var(--dim); transition: transform .15s; }
.module.open .module-head .chev { transform: rotate(90deg); }
.module-body { display: none; border-top: 1px solid var(--line); }
.module.open .module-body { display: block; }
.module-concepts { padding: 4px 18px 6px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.prow { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); cursor: pointer; color: var(--txt); }
.prow:last-child { border-bottom: 0; }
.prow:hover { background: var(--panel2); text-decoration: none; }
.prow .pid { font: 12px var(--mono); color: var(--dim); width: 36px; }
.prow .pt { flex: 1; }
.st { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line2); display: inline-grid; place-items: center; font-size: 12px; flex: none; }
.st.done { background: var(--ok); border-color: var(--ok); color: #04210f; }
.st.done::after { content: "✓"; font-weight: 900; }
.st.tried { border-color: var(--warn); }
.lvl { font-size: 11px; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--line2); color: var(--mut); white-space: nowrap; }
.lvl.Beginner { color: #86efac; border-color: #1f5135; } .lvl.Intermediate { color: #93c5fd; border-color: #1e3a6a; }
.lvl.Advanced { color: #fcd34d; border-color: #5f4b12; } .lvl.Master { color: #f9a8d4; border-color: #6b2148; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #2b2410; color: #fcd34d; border: 1px solid #5f4b12; white-space: nowrap; }

/* ---------- lab (question panel) ---------- */
.lab { display: flex; flex-direction: column; height: 100%; }
.qhead { padding: 14px 20px 12px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.qmeta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mut); }
.qtitle { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.qtitle h2 { margin: 0; font-size: 20px; }
.qtitle .qid { font: 700 13px var(--mono); color: var(--acc2); background: #1c2450; padding: 3px 8px; border-radius: 6px; }
.qnav { display: flex; align-items: center; gap: 6px; }
.qbody { flex: 1; overflow: auto; padding: 6px 22px 30px; }
.qfoot { display: flex; gap: 10px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--bg2); }
.panel-block { border: 1px solid var(--line); border-radius: 12px; margin: 16px 0; background: var(--panel); }
.panel-block > .ph { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.panel-block > .pc { padding: 0 14px 12px; }
details.concepts { border: 1px solid var(--line); border-radius: 12px; margin: 14px 0 4px; background: var(--bg2); }
details.concepts > summary { cursor: pointer; padding: 9px 14px; color: var(--mut); font-size: 14px; }
details.concepts > .md { padding: 0 14px 6px; }
.hint { border-left: 3px solid var(--warn); background: #1d1a10; border-radius: 0 8px 8px 0; padding: 8px 12px; margin: 8px 0; }
.hint .hn { font-size: 12px; color: var(--warn); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.hint .md p:first-child { margin-top: 2px; } .hint .md p:last-child { margin-bottom: 0; }
.solution { border-left: 3px solid var(--acc); background: #141a36; border-radius: 0 8px 8px 0; padding: 4px 12px; margin: 8px 0; }

.result { margin: 16px 0; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.result .rh { padding: 10px 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.result.pass { border-color: #166534; } .result.pass .rh { background: #0d2a18; color: #86efac; }
.result.fail { border-color: #7f1d1d; } .result.fail .rh { background: #2a0f12; color: #fca5a5; }
.result.info .rh { background: var(--panel2); color: var(--txt); }
.result ul { list-style: none; margin: 0; padding: 8px 14px 12px; }
.result li { margin: 5px 0; font-size: 14px; display: grid; grid-template-columns: 20px 1fr; }
.result li .ic { font-weight: 900; } .result li.ok .ic { color: var(--ok); } .result li.bad .ic { color: var(--bad); }
.result li .tip { grid-column: 2; color: var(--warn); font-size: 13px; }
.result .msg { padding: 10px 14px; font-size: 14px; white-space: pre-wrap; }

/* ---------- markdown ---------- */
.md { overflow-wrap: anywhere; }
.md h1, .md h2, .md h3 { margin: 18px 0 8px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; color: var(--acc2); }
.md ul, .md ol { padding-left: 22px; } .md li { margin: 3px 0; }
.md table { border-collapse: collapse; margin: 10px 0; font-size: 14px; } .md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md th { background: var(--panel2); }
.md blockquote { margin: 10px 0; padding: 4px 14px; border-left: 3px solid var(--line2); color: var(--mut); }
.md strong { color: #fff; }
.codewrap { position: relative; margin: 10px 0; }
.md pre { background: #0a0e1a; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow: auto; margin: 0; }
.md pre code { background: none; border: 0; padding: 0; font-size: 13px; line-height: 1.5; color: #d6deff; }
.codebar { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.codewrap:hover .codebar { opacity: 1; }
.codebar button { background: #1b2540; border: 1px solid var(--line2); color: var(--mut); border-radius: 6px; font-size: 12px; padding: 2px 8px; cursor: pointer; }
.codebar button:hover { color: var(--txt); border-color: var(--acc); }

/* ---------- drawer, toast ---------- */
.drawer { position: fixed; inset: 52px 0 0 0; background: #0008; z-index: 20; }
.drawer-panel { position: absolute; left: 0; top: 0; bottom: 0; width: min(420px, 92vw); background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow: auto; flex: 1; }
.drawer-body .mh { padding: 12px 16px 4px; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.drawer-body .prow { padding: 8px 16px; border: 0; }
.drawer-body .prow.current { background: #1c2450; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line2); padding: 9px 16px; border-radius: 10px; z-index: 50; box-shadow: 0 10px 30px #0008; }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; overflow: auto; background: radial-gradient(1000px 600px at 50% -10%, #1d2a5a, var(--bg)); }
.login-card { width: min(380px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card label { text-align: left; font-size: 13px; color: var(--mut); }
.login-card input { background: var(--bg); border: 1px solid var(--line2); color: var(--txt); border-radius: 8px; padding: 10px 12px; font-size: 15px; }
.login-card input:focus { outline: 2px solid var(--acc); border-color: transparent; }
.err { color: var(--bad); min-height: 1em; margin: 0; font-size: 14px; }

@media (max-width: 900px) {
  body.with-term #app { flex-direction: column; }
  body.with-term .view { flex: 0 0 50%; }
  .splitter { display: none !important; }
}

/* ---------- right pane: Terminal | VS Code ---------- */
.seg { display: flex; background: #070a14; border: 1px solid var(--line); border-radius: 8px; padding: 2px; margin-right: 8px; flex: none; }
.seg button { background: none; border: 0; color: var(--mut); font: 600 12px system-ui, sans-serif; padding: 4px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--panel2); color: var(--txt); }
.seg button:hover { color: var(--txt); }
.tools { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.tab .dot.wait { background: var(--warn); }
.ide { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: #1f1f1f; }
.ide iframe { flex: 1; width: 100%; border: 0; background: #1f1f1f; }
.ide-note { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 12px; background: #2b2410; color: #fcd34d; border-bottom: 1px solid #5f4b12; }
.ide-note code { background: #3a3014; border-color: #5f4b12; }

/* ---------- fun overlays: solution roast + Check pass/fail (just for fun) ---------- */
.fun { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: hidden; pointer-events: none;
  animation: fun-in .2s ease-out; --c: #f05252; }
.fun.blocking { pointer-events: auto; cursor: pointer; background: radial-gradient(circle at 50% 45%, #3b0d2acc, #05060cf0 70%); }
.fun.out { animation: fun-out .32s ease-in forwards; }
.fun-pass { --c: #22c55e; } .fun-fail { --c: #f97316; }
.fun .drop { position: absolute; top: -60px; animation: fun-fall linear forwards; }
.fun .confetti { position: absolute; left: 50%; top: 55%; width: 9px; height: 15px; border-radius: 2px; opacity: 0;
  animation: fun-burst 1.6s cubic-bezier(.15, .7, .3, 1) forwards; }
.fun-card { position: relative; text-align: center; padding: 26px 40px; max-width: min(560px, 90vw); border-radius: 22px;
  background: #141a33f2; border: 2px solid var(--c); box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 18%, transparent), 0 30px 80px #000a; }
.fun-fail .fun-card { animation: fun-shake .5s .1s both; }
.fun-pass .fun-card { animation: fun-pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.fun-hero { font-size: 80px; line-height: 1; display: inline-block; }
.fun-hero .dance { display: inline-block; animation: fun-dance .5s ease-in-out infinite alternate; }
.fun-hero .tip-over { display: inline-block; animation: fun-tip 1s .2s ease-in both; }
.fun-stamp { display: inline-block; margin: 10px 0 6px; padding: 4px 18px; font: 900 38px/1.1 Impact, "Arial Black", sans-serif;
  letter-spacing: 2px; color: var(--c); border: 5px solid var(--c); border-radius: 10px; transform: rotate(-8deg);
  animation: fun-stamp .45s .3s cubic-bezier(.2, 1.6, .4, 1) both; text-shadow: 0 0 18px color-mix(in srgb, var(--c) 45%, transparent); }
.fun-fail .fun-stamp { animation: fun-stamp .45s .3s cubic-bezier(.2, 1.6, .4, 1) both, fun-glitch .25s .8s steps(2) 3; }
.fun-line { font-size: 19px; margin: 14px 0 6px; color: #fff; }
.fun-line code { font-size: 15px; }
.fun-sub { color: var(--warn); font-size: 13px; margin: 6px 0 0; }
.fun-pass .fun-sub { color: #86efac; }
.fun-skip { color: var(--dim); font-size: 12px; margin: 14px 0 0; }
.fun.calm, .fun.calm * { animation: none !important; }
@keyframes fun-in { from { opacity: 0; } }
@keyframes fun-out { to { opacity: 0; transform: scale(1.04); } }
@keyframes fun-fall { to { transform: translateY(115vh) rotate(540deg); } }
@keyframes fun-burst { 0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  60% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 70vh)) rotate(var(--r)); } }
@keyframes fun-dance { from { transform: rotate(-12deg) translateY(0) scale(1); } to { transform: rotate(12deg) translateY(-14px) scale(1.1); } }
@keyframes fun-tip { 0% { transform: rotate(0); } 40% { transform: rotate(-12deg); } 70% { transform: rotate(18deg) translateY(4px); }
  100% { transform: rotate(8deg) translateY(2px); } }
@keyframes fun-stamp { from { opacity: 0; transform: rotate(-8deg) scale(3.2); } }
@keyframes fun-pop { from { opacity: 0; transform: scale(.6) translateY(30px); } }
@keyframes fun-glitch { 50% { transform: rotate(-8deg) translate(4px, -2px) skewX(12deg); filter: hue-rotate(90deg); } }
@keyframes fun-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-14px) rotate(-1deg); }
  40% { transform: translateX(12px) rotate(1deg); } 60% { transform: translateX(-8px); } 80% { transform: translateX(5px); } }

/* ---------- battle-royale style victory screen (original design) ---------- */
.vic { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; overflow: hidden; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, #1b2a6bcc 0%, #0a0f2ee6 45%, #02030af2 80%); animation: vic-in .25s ease-out; }
.vic.out { animation: vic-out .4s ease-in forwards; }
.vic-rays { position: absolute; left: 50%; top: 50%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; opacity: .5;
  background: repeating-conic-gradient(from 0deg, #ffd76a33 0deg 6deg, transparent 6deg 18deg);
  mask-image: radial-gradient(circle, #000 0%, transparent 55%); -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  animation: vic-spin 14s linear infinite, vic-rays-in .6s .45s both; }
.vic-stage { position: relative; display: flex; flex-direction: column; align-items: center; animation: vic-shake .35s .55s both; }
.vic-ribbon { position: absolute; left: 50%; top: 50%; width: min(1100px, 130vw); height: 150px; margin: -95px 0 0 calc(min(1100px, 130vw) / -2);
  background: linear-gradient(90deg, transparent, #3b2bd1 18%, #6d28d9 50%, #3b2bd1 82%, transparent);
  transform: skewY(-4deg); box-shadow: 0 0 60px #6d28d988; animation: vic-ribbon .4s .35s cubic-bezier(.2, .9, .3, 1) both; }
.vic-title { position: relative; display: flex; align-items: baseline; gap: 18px; transform: skewY(-4deg) rotate(-1deg);
  font: italic 900 clamp(56px, 11vw, 150px)/1 Impact, "Arial Black", "Segoe UI Black", sans-serif; letter-spacing: 2px;
  animation: vic-slam .5s .45s cubic-bezier(.2, 1.4, .35, 1) both; }
.vic-title span { background: linear-gradient(180deg, #fff7c2 0%, #ffd34d 38%, #f59e0b 62%, #b45309 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 3px #3a1d00; filter: drop-shadow(0 6px 0 #1e0f50) drop-shadow(0 0 22px #ffcf4d88); }
.vic-num { font-size: .72em; }
.vic-sub { position: relative; margin-top: 14px; font: 800 clamp(16px, 2.4vw, 26px)/1 system-ui, sans-serif; letter-spacing: .35em;
  color: #e0e7ff; text-shadow: 0 2px 0 #1e0f50; animation: vic-up .4s .95s both; }
.vic-mascot { display: inline-block; letter-spacing: 0; animation: fun-dance .45s ease-in-out infinite alternate; }
.vic-hud { position: relative; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 26px; animation: vic-up .4s 1.25s both; }
.vic-hud span { padding: 7px 14px; background: #0b1030cc; border: 1px solid #ffd34d55; border-radius: 6px; transform: skewX(-10deg);
  color: #c7d2fe; font: 600 13px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.vic-hud b { color: #ffd34d; font-size: 16px; }
.vic-hud .vic-rank { color: #1e0f50; background: linear-gradient(180deg, #ffe680, #f5b300); border-color: #fff3; font-weight: 900; }
.vic .confetti { position: absolute; left: 50%; top: 50%; height: 14px; border-radius: 2px; opacity: 0;
  animation: fun-burst 1.9s cubic-bezier(.15, .7, .3, 1) forwards; }
.vic.calm, .vic.calm * { animation: none !important; }
@keyframes vic-in { from { opacity: 0; } }
@keyframes vic-out { to { opacity: 0; transform: scale(1.06); } }
@keyframes vic-spin { to { transform: rotate(360deg); } }
@keyframes vic-rays-in { from { opacity: 0; } }
@keyframes vic-ribbon { from { transform: skewY(-4deg) scaleX(0); } }
@keyframes vic-slam { 0% { opacity: 0; transform: skewY(-4deg) rotate(-1deg) scale(3.4); filter: blur(10px); }
  70% { opacity: 1; filter: blur(0); } 100% { transform: skewY(-4deg) rotate(-1deg) scale(1); } }
@keyframes vic-shake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-10px, 6px); }
  50% { transform: translate(8px, -6px); } 75% { transform: translate(-5px, 3px); } }
@keyframes vic-up { from { opacity: 0; transform: translateY(18px); } }

/* ---------- auto-cleanup countdowns ---------- */
.cl-chip { display: inline-flex; align-items: center; gap: 6px; background: #2b2410; border: 1px solid #5f4b12; color: #fcd34d;
  border-radius: 20px; padding: 4px 12px; font: 600 13px var(--mono); cursor: pointer; }
.cl-chip:hover { border-color: var(--warn); }
.cl-menu { position: fixed; top: 50px; right: 120px; z-index: 30; width: min(440px, 94vw); background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 12px; box-shadow: 0 20px 50px #000a; padding: 6px 0; }
.cl-head { padding: 8px 14px; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.cl-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); }
.cl-row a { font: 700 13px var(--mono); min-width: 40px; }
.cl-time { font: 600 13px var(--mono); color: var(--warn); min-width: 70px; }
.cl-btns { display: inline-flex; gap: 6px; margin-left: auto; }
.cl-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0; padding: 10px 14px; border-radius: 12px;
  background: #1d1a10; border: 1px solid #5f4b12; color: #fde68a; font-size: 14px; }
.cl-banner b { color: var(--warn); font-family: var(--mono); }

/* ---------- prominent Setup + READY/GO animation ---------- */
.setup-callout { display: flex; align-items: center; gap: 14px; margin: 16px 0 6px; padding: 14px 16px; border-radius: 14px; }
.setup-callout .sc-icon { font-size: 28px; flex: none; }
.setup-callout .sc-text { flex: 1; font-size: 14px; }
.setup-callout.needed { background: linear-gradient(135deg, #3a2a0a, #2b1d05); border: 2px solid var(--warn);
  animation: sc-glow 1.6s ease-in-out infinite; color: #fde68a; }
.setup-callout.needed b { color: #fff; }
.setup-callout.ready { background: #0d2a18; border: 1px solid #166534; color: #bbf7d0; }
.setup-callout.working { animation: none; opacity: .8; }
.setup-go { background: var(--warn); border-color: var(--warn); color: #1d1300; font-size: 15px; padding: 9px 18px;
  animation: sc-bounce 1.6s ease-in-out infinite; }
.setup-go:hover { background: #ffc14d; }
#setupBtn.setup-needed { background: var(--warn); border-color: var(--warn); color: #1d1300; animation: sc-pulse 1.6s ease-in-out infinite; }
.btn.dim { opacity: .5; }
@keyframes sc-glow { 50% { box-shadow: 0 0 0 4px #f5a52433, 0 0 26px #f5a52455; } }
@keyframes sc-pulse { 50% { box-shadow: 0 0 0 6px #f5a52444; transform: scale(1.04); } }
@keyframes sc-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.rdy { position: fixed; inset: 0; z-index: 105; display: grid; place-items: center; pointer-events: none; background: #02050ccc;
  animation: fun-in .2s ease-out; }
.rdy.out { animation: fun-out .3s ease-in forwards; }
.rdy-ring { position: absolute; width: 40vmin; height: 40vmin; border-radius: 50%; border: 6px solid #22c55e;
  animation: rdy-ring 1.2s .7s ease-out both; }
.rdy-box { position: relative; text-align: center; }
.rdy-ready, .rdy-go { font: italic 900 clamp(48px, 9vw, 110px)/1 Impact, "Arial Black", sans-serif; letter-spacing: 3px; }
.rdy-ready { color: #fde68a; text-shadow: 0 0 30px #f5a52488; animation: rdy-ready .75s ease-out both; }
.rdy-go { position: absolute; left: 0; right: 0; top: 0; color: #4ade80; text-shadow: 0 0 34px #22c55eaa, 0 6px 0 #052e16;
  animation: rdy-go .6s .7s cubic-bezier(.2, 1.6, .4, 1) both; }
.rdy-rocket { display: inline-block; font-style: normal; animation: rdy-launch 1.2s 1.05s ease-in both; }
.rdy-sub { margin-top: 1.4em; color: #d1fae5; font: 600 16px system-ui, sans-serif; animation: vic-up .4s 1s both; }
.term-pane.flash { animation: rdy-flash 1.3s ease-in-out 2; }
.rdy.calm, .rdy.calm * { animation: none !important; }
.rdy.calm .rdy-ready { display: none; }
@keyframes rdy-ready { 0% { opacity: 0; transform: scale(.6); } 25% { opacity: 1; transform: scale(1); } 80% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.3); } }
@keyframes rdy-go { from { opacity: 0; transform: scale(3); } }
@keyframes rdy-ring { from { opacity: 1; transform: scale(.2); } to { opacity: 0; transform: scale(2.4); } }
@keyframes rdy-launch { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-2px, 2px) rotate(-4deg); }
  100% { transform: translate(40vw, -70vh) rotate(10deg); opacity: 0; } }
@keyframes rdy-flash { 50% { box-shadow: inset 0 0 0 3px #22c55e, inset 0 0 40px #22c55e55; } }

.solved-note { margin: 14px 0; padding: 10px 14px; border-radius: 12px; background: #0d2a18; border: 1px solid #166534; color: #bbf7d0; font-size: 14px; }
.solved-note b { color: #fff; }


.cl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cl-head .btn { text-transform: none; letter-spacing: 0; }

/* ---------- Mochi, the mascot (mascot.js): a squishy marshmallow cat ---------- */
.mochi { position: fixed; right: 16px; bottom: 70px; z-index: 15; width: 176px; pointer-events: none; user-select: none; touch-action: none; }
body.mode-browse .mochi { bottom: 16px; }
.mochi.hidden, #mochiShow.hidden { display: none; }
.qbody { padding-bottom: 210px; }   /* so the end of a question can scroll out from under Mochi */
.mo-svg { width: 176px; height: 167px; pointer-events: auto; cursor: grab; overflow: visible; filter: drop-shadow(0 10px 16px #000a); }
.mochi.dragging .mo-svg { cursor: grabbing; }
.mo-hide { position: absolute; top: 18px; right: 6px; pointer-events: auto; background: var(--panel2); border: 1px solid var(--line2); color: var(--dim);
  width: 22px; height: 22px; border-radius: 50%; font-size: 11px; line-height: 18px; cursor: pointer; opacity: 0; transition: opacity .2s; z-index: 2; }
.mochi:hover .mo-hide { opacity: 1; }
#mochiShow { position: fixed; left: 12px; bottom: 12px; z-index: 15; background: var(--panel2); border: 1px solid var(--line2);
  border-radius: 50%; width: 38px; height: 38px; cursor: pointer; font-size: 19px; opacity: .65; }
#mochiShow:hover { opacity: 1; }
/* position is computed in mascot.js (placeBubble) so the bubble always stays inside the window */
.mo-bubble { position: absolute; left: 132px; top: -40px; width: max-content; max-width: min(280px, calc(100vw - 16px)); padding: 10px 14px;
  border-radius: 16px 16px 16px 3px; overflow-wrap: anywhere;
  background: #fff; color: #1e1b4b; font: 700 14px/1.4 system-ui, sans-serif; box-shadow: 0 10px 30px #0008; border: 2px solid #f9a8d4;
  opacity: 0; transform: translateY(8px) scale(.85); transform-origin: bottom left; transition: opacity .2s, transform .25s cubic-bezier(.2, 1.5, .4, 1); }
.mo-bubble.show { opacity: 1; transform: none; }
/* the pointy "tail" corner faces Mochi */
.mo-bubble[data-side="left"][data-vert="above"] { border-radius: 16px 16px 3px 16px; transform-origin: bottom right; }
.mo-bubble[data-side="right"][data-vert="below"] { border-radius: 3px 16px 16px 16px; transform-origin: top left; }
.mo-bubble[data-side="left"][data-vert="below"] { border-radius: 16px 3px 16px 16px; transform-origin: top right; }

.mo-shadow { fill: #000; opacity: .35; transform-origin: 100px 178px; }
.mo-all { transform-origin: 100px 176px; }
.mo-body { fill: url(#moBody); stroke: #f4a7c8; stroke-width: 2.5; }
.mo-ear path:first-child { fill: #ffeef5; stroke: #f4a7c8; stroke-width: 2.5; stroke-linejoin: round; }
.mo-ear-in { fill: #fbb6d0; }
.mo-ear { transform-box: fill-box; transform-origin: 50% 100%; }
.mo-tail { fill: #ffe4ef; stroke: #f4a7c8; stroke-width: 2.5; transform-box: fill-box; transform-origin: 0% 100%; animation: mo-tail 2.2s ease-in-out infinite; }
.mo-eye ellipse { fill: #2a1f3d; }
.mo-shine { fill: #fff; }
.mo-eye { transition: transform .12s ease-out; transform-box: fill-box; transform-origin: center; }
.mo-lids { fill: #fff3f8; opacity: 0; }
.mo-brows path, .mo-happy-eyes, .mo-closed-eyes, .mo-sad-eyes { fill: none; stroke: #2a1f3d; stroke-width: 4; stroke-linecap: round; opacity: 0; }
.mo-mouth { fill: none; stroke: #2a1f3d; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.mo-mouth-w { opacity: 1; }
.mo-mouth-o { fill: #7a2e4a; stroke: none; }
.mo-mouth-laugh { fill: #7a2e4a; }
.mo-tongue { fill: #fb7185; opacity: 0; }
.mo-cheek { fill: #fb8fb8; opacity: .55; }
.mo-tear { fill: #7dd3fc; opacity: 0; }
.mo-sweat { fill: #93c5fd; opacity: 0; }
.mo-paw ellipse { fill: #fff; stroke: #f4a7c8; stroke-width: 2.5; }
.mo-paw { transform-box: fill-box; transform-origin: 50% 50%; transition: transform .25s; }
.mo-zzz { fill: #c7d2fe; font: 800 18px var(--mono); opacity: 0; }
.mo-prop { font-size: 34px; }

/* idle: squishy breathing, ear twitch, blink */
.m-idle .mo-all, .m-type .mo-all { animation: mo-squish 2.6s ease-in-out infinite; }
.m-idle .mo-shadow { animation: mo-shadow 2.6s ease-in-out infinite; }
.m-idle .mo-ear-r { animation: mo-twitch 6s ease-in-out infinite; }
.blink .mo-eye { transform: scaleY(.08) !important; }
/* smug: half-closed eyes, raised brows, smirk, tongue out a little */
.m-smug .mo-lids, .m-smug .mo-brows path, .m-smug .mo-mouth-smirk { opacity: 1; }
.m-smug .mo-mouth-w { opacity: 0; }
.m-smug .mo-all { animation: mo-sway 1.2s ease-in-out infinite alternate; }
/* laugh: squeezed eyes, open mouth, shaking with laughter, paw at mouth */
.m-laugh .mo-eye { opacity: 0; } .m-laugh .mo-happy-eyes, .m-laugh .mo-mouth-laugh, .m-laugh .mo-tongue { opacity: 1; }
.m-laugh .mo-mouth-w { opacity: 0; }
.m-laugh .mo-all { animation: mo-laugh .16s ease-in-out infinite alternate; }
.m-laugh .mo-paw-r { transform: translate(-14px, -40px); }
.m-laugh .mo-tear { opacity: 1; animation: mo-drop 1s ease-in infinite; }
/* typing: paws tap */
.m-type .mo-paw-l { animation: mo-tap .16s ease-in-out infinite alternate; }
.m-type .mo-paw-r { animation: mo-tap .16s .08s ease-in-out infinite alternate; }
/* wave */
.m-wave .mo-paw-r { animation: mo-wave .3s ease-in-out 6 alternate; }
/* happy / jump */
.m-happy .mo-eye, .m-jump .mo-eye { opacity: 0; }
.m-happy .mo-happy-eyes, .m-jump .mo-happy-eyes, .m-happy .mo-mouth-laugh, .m-jump .mo-mouth-laugh { opacity: 1; }
.m-happy .mo-mouth-w, .m-jump .mo-mouth-w { opacity: 0; }
.m-happy .mo-all { animation: mo-hop .45s ease-out 3; }
.m-jump .mo-all { animation: mo-jump 1s cubic-bezier(.3, .7, .4, 1) 2; }
.m-jump .mo-paw-l { transform: translate(-6px, -60px); } .m-jump .mo-paw-r { transform: translate(6px, -60px); }
/* sad */
.m-sad .mo-eye { opacity: 0; } .m-sad .mo-sad-eyes, .m-sad .mo-mouth-sad { opacity: 1; }
.m-sad .mo-mouth-w { opacity: 0; }
.m-sad .mo-tear { opacity: 1; animation: mo-drop 1.2s ease-in 2; }
.m-sad .mo-ear { transform: rotate(-30deg); transition: transform .4s; } .m-sad .mo-ear-r { transform: rotate(30deg); }
.m-sad .mo-all { animation: mo-melt 3s ease-in-out both; }
/* nervous (waiting for Check) */
.m-nervous .mo-all { animation: mo-shiver .1s linear infinite; }
.m-nervous .mo-sweat { opacity: 1; animation: mo-drop .9s ease-in infinite; }
.m-nervous .mo-mouth-w { opacity: 0; } .m-nervous .mo-mouth-o { opacity: 1; }
/* cover eyes (solution peek) */
.m-cover .mo-paw-l { transform: translate(4px, -62px) scale(1.1); }
.m-cover .mo-paw-r { transform: translate(-4px, -62px) scale(1.1); }
.m-cover .mo-all { animation: mo-shiver .3s linear infinite; }
/* think */
.m-think .mo-paw-r { transform: translate(-30px, -36px); }
.m-think .mo-eye { transform: translate(3px, -4px) !important; }
.m-think .mo-prop { animation: mo-pop .4s cubic-bezier(.2, 1.6, .4, 1) both; }
/* work (setup / sweeping) */
.m-work .mo-all { animation: mo-squish .5s ease-in-out infinite; }
.m-work .mo-paw-r { animation: mo-sweep .35s ease-in-out infinite alternate; }
.m-work .mo-prop { animation: mo-sweep-prop .35s ease-in-out infinite alternate; }
/* wow (surprised / dragged) */
.m-wow .mo-mouth-w { opacity: 0; } .m-wow .mo-mouth-o { opacity: 1; }
.m-wow .mo-eye ellipse { transform: scale(1.15); transform-box: fill-box; transform-origin: center; }
.m-wow .mo-all { animation: mo-hop .4s ease-out 1; }
.mochi.dragging .mo-all { animation: mo-dangle .5s ease-in-out infinite alternate; }
/* sleep: a cat loaf */
.m-sleep .mo-eye { opacity: 0; } .m-sleep .mo-closed-eyes { opacity: 1; }
.m-sleep .mo-all { animation: mo-squish 4.5s ease-in-out infinite; }
.m-sleep .mo-zzz { opacity: 1; animation: mo-zzz 2.6s ease-in-out infinite; }
.m-sleep .mo-tail { animation: none; }

.mochi.calm *, .mochi.calm .mo-svg * { animation: none !important; }

@keyframes mo-squish { 50% { transform: scale(1.04, .95); } }
@keyframes mo-shadow { 50% { transform: scaleX(1.08); opacity: .28; } }
@keyframes mo-twitch { 0%, 92%, 100% { transform: rotate(0); } 95% { transform: rotate(14deg); } }
@keyframes mo-tail { 50% { transform: rotate(-12deg); } }
@keyframes mo-sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes mo-laugh { from { transform: translateY(0) scale(1.02, .97); } to { transform: translateY(-4px) scale(.98, 1.03); } }
@keyframes mo-tap { to { transform: translateY(-9px); } }
@keyframes mo-wave { from { transform: translate(14px, -60px) rotate(-20deg); } to { transform: translate(18px, -66px) rotate(25deg); } }
@keyframes mo-hop { 40% { transform: translateY(-16px) scale(.96, 1.05); } 70% { transform: scale(1.06, .94); } }
@keyframes mo-jump { 0% { transform: translateY(0) rotate(0); } 15% { transform: translateY(6px) scale(1.1, .88); }
  50% { transform: translateY(-60px) rotate(180deg); } 85% { transform: translateY(0) rotate(360deg) scale(1.08, .92); } 100% { transform: rotate(360deg); } }
@keyframes mo-melt { 30%, 100% { transform: translateY(8px) scale(1.12, .86); } }
@keyframes mo-shiver { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes mo-drop { from { transform: translateY(0); } to { transform: translateY(20px); opacity: 0; } }
@keyframes mo-pop { from { opacity: 0; transform: translateY(10px) scale(.3); } }
@keyframes mo-sweep { from { transform: translate(10px, -20px) rotate(-25deg); } to { transform: translate(24px, -16px) rotate(25deg); } }
@keyframes mo-sweep-prop { from { transform: translate(-6px, 30px) rotate(-18deg); } to { transform: translate(6px, 30px) rotate(18deg); } }
@keyframes mo-dangle { from { transform: rotate(-10deg) scale(.95, 1.08); } to { transform: rotate(10deg) scale(.95, 1.08); } }
@keyframes mo-zzz { 50% { transform: translate(6px, -10px); opacity: .5; } }

/* ---------- Mochi's dance moves (original choreography) ---------- */
.mo-notes text { fill: #f9a8d4; font: 700 22px system-ui, sans-serif; opacity: 0; }
.m-dance .mo-notes text { animation: mo-note 1.6s ease-out infinite; }
.m-dance .mo-notes text:nth-child(2) { animation-delay: .5s; fill: #a5b4fc; }
.m-dance .mo-notes text:nth-child(3) { animation-delay: 1s; fill: #86efac; }
.m-dance .mo-eye { opacity: 0; } .m-dance .mo-happy-eyes, .m-dance .mo-mouth-laugh { opacity: 1; } .m-dance .mo-mouth-w { opacity: 0; }

/* 1. Marshmallow Wiggle: hips side to side, squishing on every beat, ears bopping */
.dance-wiggle .mo-all { animation: dn-wiggle .5s ease-in-out infinite; }
.dance-wiggle .mo-ear-l { animation: dn-ear .25s ease-in-out infinite alternate; }
.dance-wiggle .mo-ear-r { animation: dn-ear .25s .12s ease-in-out infinite alternate; }
.dance-wiggle .mo-paw-l { animation: dn-shake .25s ease-in-out infinite alternate; }
.dance-wiggle .mo-paw-r { animation: dn-shake .25s .12s ease-in-out infinite alternate; }
/* 2. Paw Pump: alternating paws punch the air, bouncing to the beat */
.dance-pawpump .mo-all { animation: dn-bounce .4s ease-in-out infinite; }
.dance-pawpump .mo-paw-l { animation: dn-pump .4s ease-in-out infinite; }
.dance-pawpump .mo-paw-r { animation: dn-pump .4s .2s ease-in-out infinite; }
/* 3. Loaf Spin: squat, full spin, freeze pose, repeat */
.dance-spin .mo-all { animation: dn-spin 1.5s cubic-bezier(.5, 0, .3, 1) infinite; }
.dance-spin .mo-paw-r { transform: translate(14px, -60px) rotate(20deg); }
/* 4. Sideways Slide: glides left and right, leaning into it, tail swishing double time */
.dance-slide .mo-all { animation: dn-slide 1.2s ease-in-out infinite; }
.dance-slide .mo-tail { animation: mo-tail .3s ease-in-out infinite; }
.dance-slide .mo-paw-l { transform: translate(-10px, -20px); } .dance-slide .mo-paw-r { transform: translate(10px, -20px); }
/* 5. Disco Point: one paw points up, then down, while the body sways */
.dance-disco .mo-all { animation: mo-sway .5s ease-in-out infinite alternate; }
.dance-disco .mo-paw-r { animation: dn-point 1s steps(1) infinite; }
.dance-disco .mo-paw-l { transform: translate(6px, -24px); }

@keyframes dn-wiggle { 0%, 100% { transform: translateX(0) rotate(0) scale(1); } 25% { transform: translateX(-8px) rotate(-7deg) scale(1.05, .95); }
  75% { transform: translateX(8px) rotate(7deg) scale(1.05, .95); } }
@keyframes dn-ear { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
@keyframes dn-shake { from { transform: translate(-6px, -30px); } to { transform: translate(6px, -40px); } }
@keyframes dn-bounce { 50% { transform: translateY(-10px) scale(.97, 1.04); } }
@keyframes dn-pump { 0%, 100% { transform: translate(0, -20px); } 50% { transform: translate(0, -90px) scale(1.1); } }
@keyframes dn-spin { 0% { transform: scale(1.08, .9); } 20% { transform: translateY(-20px) rotate(0); }
  60% { transform: translateY(-20px) rotate(360deg); } 75% { transform: rotate(360deg) scale(1.1, .9); } 100% { transform: rotate(360deg); } }
@keyframes dn-slide { 0%, 100% { transform: translateX(0) skewX(0); } 25% { transform: translateX(-26px) skewX(10deg); }
  75% { transform: translateX(26px) skewX(-10deg); } }
@keyframes dn-point { 0% { transform: translate(30px, -95px) rotate(-30deg); } 50% { transform: translate(34px, 0) rotate(30deg); } }
@keyframes mo-note { 0% { opacity: 0; transform: translateY(10px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(8px, -40px) rotate(15deg); } }

/* ---------- Mochi wandering around ---------- */
.mochi.face-left .mo-svg { transform: scaleX(-1); }
.m-walk .mo-all { animation: mo-waddle .42s ease-in-out infinite; }
.m-walk .mo-paw-l { animation: mo-step .42s ease-in-out infinite; }
.m-walk .mo-paw-r { animation: mo-step .42s .21s ease-in-out infinite; }
.m-walk .mo-ear-l, .m-walk .mo-ear-r { animation: dn-ear .21s ease-in-out infinite alternate; }
.m-walk .mo-tail { animation: mo-tail .42s ease-in-out infinite; }
.m-walk .mo-shadow { animation: mo-shadow .42s ease-in-out infinite; }
@keyframes mo-waddle { 0%, 100% { transform: rotate(-6deg) translateY(0); } 25% { transform: rotate(0) translateY(-7px); }
  50% { transform: rotate(6deg) translateY(0); } 75% { transform: rotate(0) translateY(-7px); } }
@keyframes mo-step { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(6px, -9px); } }

/* ---------- catalog: learning-path stages ---------- */
.stage { margin-top: 10px; }
.stage-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.stage-head .section-title { margin: 0; }
.stage-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2);
  border: 1px solid var(--line2); color: var(--acc2); font: 800 13px var(--mono); }
.stage-num:empty { display: none; }
.stage-count { margin-left: auto; color: var(--dim); font-size: 12px; }

/* ---------- per-lab "Quick read" (guide.md <details><summary>Learn</summary>) ---------- */
details.learn { margin: 14px 0 10px; border: 1px solid #1e3a6a; border-left: 4px solid #60a5fa; border-radius: 12px; background: #0f1a33; }
details.learn > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: 14px; color: #bfdbfe; list-style: none; }
details.learn > summary::-webkit-details-marker { display: none; }
details.learn > summary::before { content: "▸ "; color: #60a5fa; }
details.learn[open] > summary::before { content: "▾ "; }
details.learn > .md { padding: 0 16px 8px; font-size: 14px; }
details.learn > .md h4 { margin: 12px 0 4px; color: #93c5fd; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- resource-locked courses ---------- */
.course-card.locked { opacity: .8; }
.course-card.locked::after { content: "🔒"; position: absolute; top: 12px; right: 14px; font-size: 18px; }
.lockbox { border: 1px solid #5f4b12; background: #2b2410; color: #fde68a; border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.lockbox.big { margin: 14px 0; padding: 12px 16px; font-size: 14px; }

/* ---------- game-style loading screens (original design) ---------- */
.gl { position: relative; overflow: hidden; margin: 14px 0; padding: 18px 20px 14px; border-radius: 14px;
  background: radial-gradient(120% 140% at 0% 0%, #1d2a5a 0%, #0b1024 55%, #070a17 100%);
  border: 2px solid #4f5bd5; box-shadow: 0 0 0 4px #4f5bd522, 0 0 34px #4f5bd544 inset; color: #e0e7ff;
  font-family: var(--mono); }
.gl-setup { border-color: #f5a524; box-shadow: 0 0 0 4px #f5a52422, 0 0 34px #f5a52433 inset; }
.gl-check { border-color: #22d3ee; box-shadow: 0 0 0 4px #22d3ee22, 0 0 34px #22d3ee33 inset; }
.gl-page { display: grid; place-items: center; min-height: 60vh; }
.gl-page .gl { width: min(620px, 92%); }
.gl-scan { position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background: repeating-linear-gradient(0deg, #fff1 0 1px, transparent 1px 3px); animation: gl-scan 6s linear infinite; }
.gl-top { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .18em; color: #a5b4fc; }
.gl-level { padding: 2px 8px; border: 1px solid #6366f1; border-radius: 4px; background: #1e1b4b; color: #c7d2fe; }
.gl-time { color: #fde68a; }
.gl-title { margin: 12px 0 2px; font: 900 22px/1.1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: #fff; text-shadow: 0 0 12px #818cf8, 2px 2px 0 #312e81; }
.gl-dots i { font-style: normal; animation: gl-blink 1.2s infinite; } .gl-dots i:nth-child(2) { animation-delay: .2s; } .gl-dots i:nth-child(3) { animation-delay: .4s; }
.gl-sub { color: #94a3b8; font-size: 12px; margin-bottom: 2px; }
.gl-bar { position: relative; height: 22px; margin: 16px 0 6px; border: 2px solid #c7d2fe; border-radius: 4px; background: #0a0f24; overflow: visible; }
.gl-fill { height: 100%; width: 0; transition: width .2s linear;
  background: repeating-linear-gradient(90deg, #4ade80 0 14px, #22c55e 14px 16px, transparent 16px 18px); box-shadow: 0 0 12px #22c55e88; }
.gl-setup .gl-fill { background: repeating-linear-gradient(90deg, #fbbf24 0 14px, #f59e0b 14px 16px, transparent 16px 18px); box-shadow: 0 0 12px #f59e0b88; }
.gl-check .gl-fill { background: repeating-linear-gradient(90deg, #67e8f9 0 14px, #22d3ee 14px 16px, transparent 16px 18px); box-shadow: 0 0 12px #22d3ee88; }
.gl-runner { position: absolute; top: -22px; left: -14px; font-size: 22px; transition: left .2s linear; animation: gl-run .32s steps(2) infinite; }
.gl-meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; }
.gl-pct { font: 800 18px var(--mono); color: #fde68a; }
.gl-hint { color: #64748b; font-size: 11px; }
.gl-tip { margin-top: 12px; padding: 8px 10px; border-left: 3px solid #818cf8; background: #ffffff08; border-radius: 0 6px 6px 0;
  font: 13px/1.45 system-ui, sans-serif; color: #cbd5e1; min-height: 2.9em; opacity: 0; }
.gl-tip.in { animation: gl-tip .45s ease-out forwards; }
.gl-tip code { font-size: 12px; }
.gl-ok { border-color: #22c55e; } .gl-ok .gl-title { color: #bbf7d0; text-shadow: 0 0 14px #22c55e; animation: gl-pop .4s cubic-bezier(.2, 1.6, .4, 1); }
.gl-bad { border-color: #f97316; } .gl-bad .gl-title { color: #fed7aa; text-shadow: 0 0 14px #f97316; animation: gl-shake .4s; }
.gl-ok .gl-runner { animation: gl-jump .4s ease-out 2; }
.gl.calm *, .gl.calm { animation: none !important; transition: none !important; }
.gl.calm .gl-tip { opacity: 1; }
@keyframes gl-scan { to { background-position: 0 120px; } }
@keyframes gl-blink { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }
@keyframes gl-run { 0% { transform: translateY(0) scaleX(-1); } 50% { transform: translateY(-3px) scaleX(-1); } }
@keyframes gl-jump { 50% { transform: translateY(-14px) scaleX(-1); } }
@keyframes gl-tip { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes gl-pop { from { transform: scale(1.4); } }
@keyframes gl-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- home screen: game "mode select" (original design) ---------- */
.modes { max-width: 1240px; }
.ms-hero { display: flex; gap: 22px; align-items: stretch; flex-wrap: wrap; margin: 6px 0 18px; }
.ms-title { flex: 1 1 380px; }
.ms-kicker { font: 700 12px var(--mono); letter-spacing: .3em; color: var(--acc2); text-transform: uppercase; }
.ms-title h1 { margin: 6px 0 6px; font: 900 clamp(32px, 5vw, 52px)/1 Impact, "Arial Black", sans-serif; letter-spacing: .06em; font-style: italic;
  background: linear-gradient(180deg, #fff 0%, #c7d2fe 45%, #818cf8 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #1e1b4b) drop-shadow(0 0 18px #6366f155); }
.ms-title p { color: var(--mut); margin: 0; }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--line2); border-bottom-width: 3px; border-radius: 6px;
  background: var(--panel2); font: 700 11px var(--mono); color: var(--txt); text-align: center; }
.ms-player { flex: 0 1 380px; display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px;
  background: linear-gradient(135deg, #1e1b4b, #0f172a); border: 2px solid #4f46e5; box-shadow: 0 0 0 4px #4f46e522, 0 10px 30px #0006; }
.ms-avatar { font-size: 42px; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 14px; background: #312e81;
  box-shadow: inset 0 0 0 2px #6366f1; animation: ms-float 3s ease-in-out infinite; }
.ms-pinfo { flex: 1; min-width: 0; }
.ms-pname { font: 900 13px var(--mono); letter-spacing: .12em; color: #c7d2fe; }
.ms-rank { margin-left: 6px; padding: 1px 8px; border-radius: 20px; background: #f5a524; color: #1d1300; font-size: 11px; letter-spacing: .04em; }
.ms-xp { margin: 4px 0; font-size: 13px; color: var(--mut); } .ms-xp b { color: #fde68a; font: 800 16px var(--mono); }
.ms-xpbar { height: 10px; border-radius: 6px; background: #0b1024; border: 1px solid #312e81; overflow: hidden; }
.ms-xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #f59e0b, #fde047); box-shadow: 0 0 10px #f59e0b; }
.ms-next { margin-top: 4px; font-size: 12px; color: var(--dim); } .ms-next b { color: #c7d2fe; }
.ms-resume { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 8px; padding: 12px 16px; border-radius: 12px; cursor: pointer;
  border: 2px solid #22c55e; background: linear-gradient(90deg, #052e16, #0d2a18); color: #bbf7d0; font: 900 15px var(--mono); letter-spacing: .08em;
  animation: ms-pulse 2s ease-in-out infinite; }
.ms-resume span { margin-left: auto; color: #86efac; font-size: 13px; }
.world { margin-top: 22px; }
.world-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.world-num { padding: 3px 10px; border-radius: 6px; background: #1e1b4b; border: 1px solid #6366f1; font: 900 12px var(--mono); letter-spacing: .14em; color: #a5b4fc; }
.world-name { font: 900 20px/1 Impact, "Arial Black", sans-serif; letter-spacing: .05em; font-style: italic; text-transform: uppercase; color: #e0e7ff; }
.world-bar { flex: 1; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; max-width: 320px; margin-left: auto; }
.world-bar i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #4ade80); }
.world-count { font: 700 12px var(--mono); color: var(--dim); min-width: 56px; text-align: right; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.mode { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 12px; border-radius: 16px; cursor: pointer;
  background: radial-gradient(130% 90% at 0% 0%, color-mix(in srgb, var(--c) 30%, transparent), transparent 60%), #10172c;
  border: 2px solid color-mix(in srgb, var(--c) 45%, #24304d); transition: transform .15s ease-out, box-shadow .2s, border-color .2s; outline: none; }
.mode:hover, .mode.sel, .mode:focus-visible { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent), 0 16px 40px #0008, 0 0 30px color-mix(in srgb, var(--c) 40%, transparent); }
.mode.sel:not(:hover) { transform: translateY(-3px) scale(1.02); }
.mode-shine { position: absolute; inset: -40% auto -40% -60%; width: 40%; transform: rotate(20deg); pointer-events: none;
  background: linear-gradient(90deg, transparent, #ffffff22, transparent); }
.mode:hover .mode-shine, .mode.sel .mode-shine { animation: ms-shine 1.1s ease-out; }
.mode-top { display: flex; align-items: flex-start; justify-content: space-between; }
.mode-icon { font-size: 44px; line-height: 1; filter: drop-shadow(0 6px 10px #0008); transition: transform .2s; }
.mode:hover .mode-icon, .mode.sel .mode-icon { transform: scale(1.15) rotate(-6deg); }
.mode-stars { color: #fbbf24; font-size: 14px; letter-spacing: 1px; text-shadow: 0 0 6px #f59e0b88; } .mode-stars em { color: #334155; font-style: normal; text-shadow: none; }
.mode h3 { margin: 4px 0 0; font: 900 19px/1.15 system-ui, sans-serif; letter-spacing: .01em; }
.mode-sub { font-size: 12px; color: color-mix(in srgb, var(--c) 60%, #cbd5e1); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.mode-desc { font-size: 13px; color: var(--mut); flex: 1; }
.mode-stats { display: flex; gap: 12px; font: 600 12px var(--mono); color: #a5b4fc; }
.mode-xp { position: relative; height: 16px; border-radius: 8px; background: #0b1024; border: 1px solid #24304d; overflow: hidden; }
.mode-xp i { display: block; height: 100%; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 50%, #fff)); }
.mode-xp span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 10px var(--mono); color: #fff; text-shadow: 0 1px 2px #000; }
.mode-cta { align-self: flex-start; margin-top: 4px; padding: 6px 14px; border-radius: 8px; font: 900 13px var(--mono); letter-spacing: .1em;
  background: var(--c); color: #fff; text-shadow: 0 1px 0 #0006; box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 55%, #000); }
.mode:hover .mode-cta, .mode.sel .mode-cta { animation: ms-cta .8s ease-in-out infinite; }
.mode.cleared .mode-cta { background: #fbbf24; color: #1d1300; box-shadow: 0 4px 0 #b45309; }
.mode.cleared::after { content: "CLEARED"; position: absolute; top: 14px; right: -34px; transform: rotate(35deg); padding: 3px 40px;
  background: #fbbf24; color: #1d1300; font: 900 11px var(--mono); letter-spacing: .1em; }
.mode.soon { cursor: default; filter: grayscale(.85) brightness(.7); }
.mode.soon .mode-cta { background: #334155; box-shadow: 0 4px 0 #1e293b; }
.mode.locked .mode-cta { background: #334155; box-shadow: 0 4px 0 #1e293b; color: #fde68a; }
.mode-lock { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px; text-align: center; padding: 18px;
  background: #050816cc; backdrop-filter: blur(2px); font-size: 40px; opacity: 0; transition: opacity .2s; }
.mode-lock span { font: 600 12px/1.4 system-ui, sans-serif; color: #fde68a; }
.mode.locked:hover .mode-lock, .mode.locked.sel .mode-lock { opacity: 1; }
.mode.locked::before { content: "🔒"; position: absolute; top: 12px; right: 14px; font-size: 20px; }
.ms-help { margin: 26px 0 0; text-align: center; color: var(--dim); font-size: 12px; } .ms-help kbd { margin: 0 2px; }
@keyframes ms-float { 50% { transform: translateY(-5px); } }
@keyframes ms-pulse { 50% { box-shadow: 0 0 0 4px #22c55e33, 0 0 24px #22c55e55; } }
@keyframes ms-shine { from { left: -60%; } to { left: 130%; } }
@keyframes ms-cta { 50% { transform: translateY(-2px); } }

/* ---------------------------------------------------------------- language: EN | VI toggle, translation badges */
.lang-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line2); border-radius: 999px; background: var(--panel); font: 600 12px var(--mono); }
.lang-toggle button { background: transparent; border: 0; color: var(--dim); padding: 3px 9px; border-radius: 999px; cursor: pointer; font: inherit; }
.lang-toggle button:hover { color: var(--txt); }
.lang-toggle button.on { background: var(--acc); color: #fff; }
.lang-toggle .lt-sep { color: var(--line2); }
.login-lang { align-self: flex-end; margin-bottom: -6px; }
.lang-badge { font: 600 10px var(--mono); padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line2); background: var(--panel2); color: var(--mut); white-space: nowrap; letter-spacing: .3px; }
.lang-badge.partial { color: #fcd34d; border-color: #5f4b12; background: #2b2410; }
.mode-top .lang-badge { margin-left: auto; margin-right: 8px; align-self: center; }
.lang-note { font-size: 13px; color: var(--mut); background: var(--panel); border: 1px dashed var(--line2); border-radius: 10px; padding: 8px 12px; margin: 0 0 14px; }
.result .en-note { display: block; font-size: 12px; color: var(--dim); margin: 6px 0 0; font-style: italic; }

/* ================================================================ gaming theme (original design)
   Applies to the "browse" screens (home, course world map), the top bar and the login screen.
   The lab / question screen (body.mode-lab) deliberately stays clean and readable. */
:root { --neon: #8b5cf6; --neon2: #22d3ee; --game: italic 900 1em/1 Impact, "Arial Black", "Segoe UI Black", sans-serif; }

/* top bar: neon edge, glowing logo, arcade wordmark */
.topbar { position: relative; z-index: 3; background: linear-gradient(180deg, #121a35, #0b1022); border-bottom: 0; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--neon) 20%, var(--neon2) 50%, var(--neon) 80%, transparent);
  box-shadow: 0 0 12px #8b5cf6aa; }
.brand > span:last-child { font: var(--game); font-size: 21px; letter-spacing: .04em; }
.brand b { background: linear-gradient(180deg, #a5f3fc, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-right: .16em; margin-right: -.06em; }   /* italic overhang: let the clipped gradient reach the slanted "m" */
.logo { background: linear-gradient(135deg, #7c3aed, #06b6d4); box-shadow: 0 0 0 2px #ffffff14, 0 0 14px #8b5cf699; animation: gt-logo 4s ease-in-out infinite; }
body.mode-lab .topbar::after { opacity: .45; box-shadow: none; }      /* calmer while solving */
body.mode-lab .logo { animation: none; }

/* browse screens: dark arcade backdrop with a slowly scrolling neon grid */
body.mode-browse #app { background: radial-gradient(900px 500px at 15% -10%, #4c1d9533, transparent 60%),
  radial-gradient(800px 500px at 100% 0%, #0e749033, transparent 60%), var(--bg); }
body.mode-browse #app::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: linear-gradient(#8b5cf61a 1px, transparent 1px), linear-gradient(90deg, #8b5cf61a 1px, transparent 1px);
  background-size: 44px 44px; animation: gt-grid 14s linear infinite;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%); }
body.mode-browse .view, body.mode-browse .term-pane, body.mode-browse .splitter { position: relative; z-index: 1; }

/* chunky arcade buttons on browse screens only */
body.mode-browse .btn.primary { background: linear-gradient(180deg, #8b5cf6, #6d28d9); border: 0; border-radius: 10px;
  font: 900 14px var(--mono); letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 4px 0 #3b1a7a, 0 0 18px #8b5cf655; }
body.mode-browse .btn.primary:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 5px 0 #3b1a7a, 0 0 26px #8b5cf688; text-decoration: none; }
body.mode-browse .btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #3b1a7a; }
body.mode-browse .section-title { font: var(--game); font-size: 18px; letter-spacing: .06em; text-transform: uppercase; color: #c4b5fd;
  text-shadow: 0 0 12px #8b5cf666; }

/* course page = world map, tinted with the course colour (--c) */
.wp-hero { position: relative; padding: 22px 24px; border-radius: 20px; overflow: hidden; flex-wrap: wrap;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--c) 30%, transparent), transparent 60%), #10172cee;
  border: 2px solid color-mix(in srgb, var(--c) 55%, #24304d);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 14%, transparent), 0 18px 50px #0008; }
.wp-hero::after { content: ""; position: absolute; top: -50%; bottom: -50%; left: -40%; width: 30%; transform: rotate(20deg); pointer-events: none;
  background: linear-gradient(90deg, transparent, #ffffff14, transparent); animation: gt-shine 6s ease-in-out infinite; }
.wp-hero .icon { background: color-mix(in srgb, var(--c) 22%, #0b1024); border: 2px solid var(--c); font-size: 54px;
  box-shadow: 0 0 24px color-mix(in srgb, var(--c) 45%, transparent); animation: ms-float 3s ease-in-out infinite; }
.wp-kicker { font: 800 12px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: color-mix(in srgb, var(--c) 55%, #e0e7ff); }
.wp-hero h1 { font: var(--game); font-size: clamp(30px, 4vw, 44px); letter-spacing: .03em; margin: 6px 0 2px;
  background: linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--c) 40%, #fff) 60%, var(--c) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 #0b1024); }
.wp-xp { margin-top: 12px; max-width: 460px; }
.wp-xp .progress { height: 14px; border-radius: 8px; background: #0b1024; border: 1px solid #ffffff1a; }
.wp-xp .progress i { background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 45%, #fff)); box-shadow: 0 0 12px var(--c); }
.wp-xp .prog-row span { font: 700 12px var(--mono); color: #e0e7ff; }
body.mode-browse .btn.primary.wp-play { position: relative; z-index: 1; padding: 14px 22px; font-size: 16px; background: var(--c);
  box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 50%, #000), 0 0 24px color-mix(in srgb, var(--c) 55%, transparent);
  animation: ms-cta 1s ease-in-out infinite; }
.wp-hero.cleared { border-color: #fbbf24; }
.wp-hero.cleared::before { content: "CLEARED ★"; position: absolute; top: 16px; right: -40px; transform: rotate(35deg); padding: 3px 46px; z-index: 2;
  background: #fbbf24; color: #1d1300; font: 900 11px var(--mono); letter-spacing: .1em; }
.world-page details.concepts { background: #10172ccc; border: 1px solid color-mix(in srgb, var(--c) 35%, #24304d); }
.world-page details.concepts > summary { font: 800 13px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: #e0e7ff; }
.world-page .module { background: #10172cdd; border: 1px solid #24304d; border-left: 4px solid color-mix(in srgb, var(--c) 70%, #24304d);
  transition: border-color .15s, box-shadow .2s; }
.world-page .module:hover { border-color: color-mix(in srgb, var(--c) 60%, #24304d); box-shadow: 0 0 22px color-mix(in srgb, var(--c) 22%, transparent); }
.world-page .module-head .num { width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--c) 25%, #0b1024);
  border: 2px solid var(--c); color: #fff; font: 900 14px var(--mono); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 40%, transparent); }
.world-page .module-head h3 { font: 800 16px system-ui, sans-serif; letter-spacing: .01em; }
.mod-bar { width: 110px; height: 8px; border-radius: 6px; background: #0b1024; border: 1px solid #ffffff14; overflow: hidden; flex: none; }
.mod-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--c, var(--acc)), color-mix(in srgb, var(--c, var(--acc)) 45%, #fff)); }
.world-page .module-head .count { font: 700 12px var(--mono); min-width: 52px; text-align: right; }
.world-page .module.cleared { border-left-color: #fbbf24; }
.world-page .module.cleared .num { border-color: #fbbf24; box-shadow: 0 0 12px #f59e0b88; }
.world-page .module.cleared .count { color: #fbbf24; }
.world-page .prow { transition: background .12s, padding-left .12s; }
.world-page .prow:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 18%, transparent), transparent 70%); padding-left: 24px; }
.world-page .prow:hover .pid { color: color-mix(in srgb, var(--c) 60%, #fff); }
/* solved lab: a green "cleared" check badge (clear at a glance, distinct from the empty circle of unsolved labs) */
.world-page .st { width: 22px; height: 22px; }
.world-page .st.done { background: linear-gradient(180deg, #4ade80, #16a34a); border: 2px solid #86efac; color: #fff;
  box-shadow: 0 0 0 3px #22c55e33, 0 0 10px #22c55e88; }
.world-page .st.done::after { content: ""; width: 5px; height: 10px; margin-top: -2px; border: solid #fff; border-width: 0 3px 3px 0;
  transform: rotate(45deg); filter: drop-shadow(0 1px 0 #14532d); }
.world-page .prow:has(.st.done) .pt { color: #bbf7d0; }
@media (max-width: 700px) { .mod-bar { display: none; } }

/* login: "press start" */
.login-page { background: radial-gradient(900px 600px at 50% -10%, #4c1d95aa, transparent 65%),
  radial-gradient(700px 500px at 50% 120%, #0e7490aa, transparent 60%), #070a17; }
.login-page::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .55;
  background-image: linear-gradient(#8b5cf622 1px, transparent 1px), linear-gradient(90deg, #8b5cf622 1px, transparent 1px);
  background-size: 44px 44px; animation: gt-grid 14s linear infinite; }
.login-card { position: relative; background: #10172cf0; border: 2px solid #8b5cf6; box-shadow: 0 0 0 5px #8b5cf622, 0 0 50px #8b5cf655, 0 30px 80px #000a; }
.login-card .brand.big > span:last-child { font-size: 38px; }
.login-card .btn.primary { background: linear-gradient(180deg, #8b5cf6, #6d28d9); border: 0; font: 900 15px var(--mono); letter-spacing: .14em;
  text-transform: uppercase; box-shadow: 0 4px 0 #3b1a7a, 0 0 20px #8b5cf666; animation: ms-cta 1.2s ease-in-out infinite; }
.login-card .btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #3b1a7a; animation: none; }

@keyframes gt-logo { 50% { box-shadow: 0 0 0 2px #ffffff14, 0 0 22px #22d3eeaa; } }
@keyframes gt-grid { to { background-position: 0 44px, 44px 0; } }
@keyframes gt-shine { 0%, 70% { left: -40%; } 100% { left: 130%; } }

@media (prefers-reduced-motion: reduce) {
  body.mode-browse #app::before, .login-page::before, .logo, .wp-hero::after, .wp-hero .icon,
  body.mode-browse .btn.primary.wp-play, .login-card .btn.primary { animation: none !important; }
}

/* ---------- solution: Terminal | Solve in VS Code (steps generated by vssolution.js) ---------- */
.sol-tabs { display: inline-flex; gap: 2px; margin: 8px 0 4px; padding: 2px; background: #070a14; border: 1px solid var(--line); border-radius: 8px; }
.sol-tabs button { background: none; border: 0; color: var(--mut); font: 600 12px system-ui, sans-serif; padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.sol-tabs button.on { background: var(--panel2); color: var(--txt); }
.sol-tabs button:hover { color: var(--txt); }
.vs-intro { display: flex; gap: 12px; align-items: center; margin: 8px 0 12px; padding: 10px 12px; border-radius: 10px;
  background: #0f1a33; border: 1px solid #1e3a6a; color: #cbd5e1; font-size: 13px; }
.vs-intro > div { flex: 1; }
.vs-intro kbd { font-size: 10px; }
.vs-step { margin: 10px 0; padding: 10px 12px 4px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.vs-file { border-left: 3px solid #22d3ee; }
.vs-cmd { border-left: 3px solid #a78bfa; }
.vs-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.vs-n { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); color: var(--acc2); font: 800 12px var(--mono); }
.vs-how { margin: 4px 0 0 30px; font-size: 12px; color: var(--mut); }
.vs-notes { margin: 6px 0 0 30px; font-size: 13px; color: #cbd5e1; }
.vs-notes p { margin: 2px 0; }

/* ---------- 🧹 Start fresh on each row of the question list ---------- */
.prow-fresh { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; font: 600 12px system-ui, sans-serif;
  color: #fcd34d; background: #2b241080; border: 1px solid #5f4b12; border-radius: 999px; cursor: pointer; opacity: .35; filter: grayscale(.7);
  transition: opacity .15s, background .15s, border-color .15s, filter .15s; }
.drawer-body .prow-fresh .lbl { display: none; }                  /* narrow drawer: icon only */
.drawer-body .prow-fresh { padding: 0 7px; }
.prow-fresh.used { opacity: .75; filter: none; }                 /* solved / attempted: there is something to clean */
.prow:hover .prow-fresh { opacity: .8; filter: none; }
.prow-fresh:hover, .prow-fresh:focus-visible { opacity: 1 !important; background: #3a2a0a; border-color: var(--warn); color: #fde68a; outline: none; }
.prow-fresh:disabled { cursor: progress; }
.prow-fresh.spin { animation: prow-sweep .5s ease-in-out infinite alternate; opacity: 1; }
@keyframes prow-sweep { from { transform: rotate(-20deg); } to { transform: rotate(20deg); } }
.prow:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }

/* ---------- "Start fresh" pop-up: a broom sweeps, cleaned items pop in and get swept away (original design) ---------- */
.cln { position: fixed; inset: 0; z-index: 106; display: grid; place-items: center; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, #2b241099, #05060ccc 70%); animation: fun-in .2s ease-out; }
.cln.out { animation: fun-out .32s ease-in forwards; }
.cln-card { position: relative; overflow: hidden; min-width: min(360px, 90vw); max-width: min(480px, 92vw); padding: 22px 26px 16px;
  border-radius: 20px; background: #141a33f2; border: 2px solid #f5a524; text-align: center;
  box-shadow: 0 0 0 6px #f5a5242e, 0 30px 80px #000a; animation: fun-pop .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.cln-broom { position: absolute; top: 12px; left: -60px; font-size: 44px; animation: cln-sweep 1.3s .15s ease-in-out both; }
.cln-title { margin: 52px 0 12px; font: italic 900 26px/1.1 Impact, "Arial Black", sans-serif; letter-spacing: .04em; color: #fde68a;
  text-shadow: 0 0 16px #f5a52488, 0 3px 0 #3a1d00; }
.cln-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.cln-list li { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px;
  background: #0b1024; border: 1px solid #2f3d60; font-size: 14px; color: #e5e9f2;
  animation: cln-item .35s calc(.45s + var(--i) * .26s) cubic-bezier(.2, 1.5, .4, 1) both,
             cln-swept .5s calc(.95s + var(--i) * .26s) ease-in both; }
.cln-ic { font-size: 18px; width: 24px; text-align: center; }
.cln-poof { position: absolute; right: 10px; opacity: 0; animation: cln-poof .6s calc(.95s + var(--i) * .26s) ease-out both; }
.cln-none { color: var(--mut) !important; animation: cln-item .35s .45s cubic-bezier(.2, 1.5, .4, 1) both !important; }
.cln-sub { margin-top: 14px; color: #86efac; font-weight: 700; font-size: 14px; animation: vic-up .4s calc(.7s + var(--i) * .26s) both; }
.cln-skip { margin-top: 8px; color: var(--dim); font-size: 11px; }
.cln.calm *, .cln.calm { animation: none !important; }
.cln.calm .cln-broom { left: 50%; transform: translateX(-50%); }
@keyframes cln-sweep { 0% { left: -60px; transform: rotate(-30deg); } 25% { transform: rotate(20deg); } 50% { transform: rotate(-20deg); }
  75% { transform: rotate(20deg); } 100% { left: calc(50% - 22px); transform: rotate(0); } }
@keyframes cln-item { from { opacity: 0; transform: translateX(-30px) scale(.9); } }
@keyframes cln-swept { to { opacity: .45; text-decoration: line-through; transform: translateX(6px); filter: grayscale(1); } }
@keyframes cln-poof { 0% { opacity: 0; transform: scale(.4); } 40% { opacity: 1; transform: scale(1.3); } 100% { opacity: 0; transform: translateX(20px) scale(1.6); } }
.cln-list li.cln-done { border-color: #166534; background: #0d2a18; color: #bbf7d0;
  animation: cln-item .35s calc(.45s + var(--i) * .26s) cubic-bezier(.2, 1.5, .4, 1) both; }
.cln-ok { margin-left: auto; color: #4ade80; font-weight: 900; }

/* ================================================================ performance: smooth scrolling
   Continuous animations must only change `transform` / `opacity`, on their own compositor layer, so
   the browser never repaints the page (or the scroller above them) on every frame. */

/* backdrop grid: move the layer (GPU) instead of animating background-position (full-screen repaint) */
body.mode-browse #app::before { top: -44px; animation: gt-grid-move 14s linear infinite; will-change: transform; }
.login-page::before { top: -44px; animation: gt-grid-move 14s linear infinite; will-change: transform; }
@keyframes gt-grid-move { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, 44px, 0); } }
/* the scroller gets its own layer, so scrolling never repaints the animated backdrop under it */
.view { will-change: scroll-position; }

/* course header shine: translate instead of animating `left` (layout + paint every frame) */
.wp-hero::after { left: 0; transform: translateX(-200%) rotate(20deg); animation: gt-shine-move 6s ease-in-out infinite; will-change: transform; }
@keyframes gt-shine-move { 0%, 70% { transform: translateX(-200%) rotate(20deg); } 100% { transform: translateX(480%) rotate(20deg); } }

/* glows: pulse the opacity of a pre-drawn shadow instead of animating box-shadow (repaint each frame) */
.logo { position: relative; animation: none; }
.logo::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 22px #22d3eeaa; opacity: 0; animation: gt-glow 4s ease-in-out infinite; will-change: opacity; }
body.mode-lab .logo::after { animation: none; }
.ms-resume { position: relative; animation: none; }
.ms-resume::after { content: ""; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 4px #22c55e33, 0 0 24px #22c55e55; opacity: 0; animation: gt-glow 2s ease-in-out infinite; will-change: opacity; }
.setup-callout.needed { position: relative; animation: none; }
.setup-callout.needed::after { content: ""; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 4px #f5a52433, 0 0 26px #f5a52455; opacity: 0; animation: gt-glow 1.6s ease-in-out infinite; will-change: opacity; }
#setupBtn.setup-needed { animation: sc-scale 1.6s ease-in-out infinite; box-shadow: 0 0 0 4px #f5a52433; }
@keyframes gt-glow { 50% { opacity: 1; } }
@keyframes sc-scale { 50% { transform: scale(1.04); } }

/* Mochi: own layer and paint containment, and no CSS drop-shadow filter (it re-rasterises the animated
   SVG every frame); the SVG already draws its own ground shadow */
.mochi { will-change: transform; contain: layout style; }
.mo-svg { filter: none; }

/* pulsing buttons and floating icons: hint the compositor */
body.mode-browse .btn.primary.wp-play, .wp-hero .icon, .ms-avatar, .mode.sel .mode-cta, .mode:hover .mode-cta { will-change: transform; }

@media (prefers-reduced-motion: reduce) {
  .logo::after, .ms-resume::after, .setup-callout.needed::after, #setupBtn.setup-needed,
  body.mode-browse #app::before, .login-page::before, .wp-hero::after { animation: none !important; }
}

/* "Show solution" peek: small laughing faces bounce out of the button (transform/opacity only) */
.peek-pop { position: fixed; z-index: 60; font-size: 20px; line-height: 1; pointer-events: none;
  transform: translate(-50%, -50%) scale(.3); opacity: 0; will-change: transform, opacity;
  animation: peek-pop 1.1s cubic-bezier(.2, .9, .3, 1.2) forwards; }
@keyframes peek-pop {
  0%   { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  15%  { opacity: 1; }
  45%  { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1); }
  65%  { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 9px)) scale(1); opacity: 1; }
  80%  { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 3px)) scale(1); }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 12px)) scale(.9); opacity: 0; }
}

/* Next question after a pass: bright, glowing and nudging, eager to be clicked.
   Only transform/opacity animate (the glow is a pre-drawn shadow whose opacity pulses). */
#nextBtn.success { position: relative; background: linear-gradient(135deg, #16a34a, #22c55e); border-color: #4ade80;
  color: #fff; font-weight: 800; text-shadow: 0 1px 0 #0004; animation: next-nudge 2.6s ease-in-out infinite; will-change: transform; }
#nextBtn.success::after { content: ""; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 3px #4ade8070, 0 0 24px 6px #22c55eb0; opacity: .25; animation: next-glow 1.3s ease-in-out infinite;
  will-change: opacity; }
#nextBtn.success:hover { animation: none; transform: scale(1.06); }
#nextBtn.success:hover::after { opacity: 1; animation: none; }
@keyframes next-glow { 50% { opacity: 1; } }
@keyframes next-nudge {
  0%, 62%, 100% { transform: translateX(0) scale(1); }
  70% { transform: translateX(4px) scale(1.05); }
  78% { transform: translateX(0) scale(1); }
  86% { transform: translateX(4px) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  #nextBtn.success, #nextBtn.success::after { animation: none; }
  #nextBtn.success::after { opacity: .8; }
}

/* ---------------- accounts: sign-in / create-account tabs, admin page, shared-machine notices */
.auth-tabs { display: flex; gap: 4px; padding: 4px; margin: 6px 0 4px; border-radius: 10px; background: #0b1020; border: 1px solid var(--line); }
.auth-tabs button { flex: 1; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--mut); font-weight: 600; cursor: pointer; }
.auth-tabs button.on { background: linear-gradient(135deg, #4f46e5, #0891b2); color: #fff; }
.ok-msg { color: #4ade80; min-height: 0; margin: 4px 0 0; }
.ok-msg:empty { display: none; }
.btn.danger { border-color: #ef444466; color: #fca5a5; background: transparent; }
.btn.danger:hover { background: #ef444422; }
.admin-btn.has-pending { border-color: #f59e0b; color: #fde68a; box-shadow: 0 0 0 2px #f59e0b33; }
.admin-page h1 { margin: 0 0 6px; }
.admin-scroll { overflow-x: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--mut); background: #ffffff06; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr.st-pending td { background: #f59e0b0d; }
.admin-table tr.st-disabled td { opacity: .6; }
.admin-acts { display: flex; gap: 6px; }
.shared-note, .env-note { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 12px 0; border-radius: 12px; line-height: 1.5; }
.shared-note { background: #0ea5e914; border: 1px solid #0ea5e955; }
.env-note { background: #f59e0b14; border: 1px solid #f59e0b77; }
.shared-note > div, .env-note .env-text { flex: 1; }
.env-note .btn { flex-shrink: 0; }
@media (max-width: 640px) { .shared-note, .env-note { flex-direction: column; align-items: stretch; } }

/* change password page */
.pw-form { display: flex; flex-direction: column; gap: 8px; max-width: 380px; margin-top: 14px; }
.pw-form label { font-size: 13px; color: var(--mut); margin-top: 4px; }
.pw-form input { background: var(--bg); border: 1px solid var(--line2); color: var(--txt); border-radius: 8px; padding: 10px 12px; font-size: 15px; }
.pw-form input:focus { outline: 2px solid var(--acc); border-color: transparent; }
.pw-form .pw-acct { font-weight: 600; }
.pw-form .err-line { color: #fca5a5; font-size: 13px; }
.pw-form .err-line:empty { display: none; }
.pw-form .btn { align-self: flex-start; margin-top: 6px; }
