/* Adaptive Programming Lab
   Visual idea, "Source": the code is the picture. The interface is a quiet, precise instrument in cool
   neutrals and ink; colour comes from the four languages and from what the learner does (right, wrong,
   streak). The one bold element on each screen is real code from the lesson, set large in an editor panel.
   Type: Instrument Sans for everything you read, JetBrains Mono only for code. */

/* ------------------------------------------------------------------ tokens */
:root {
  --font-ui: "Instrument Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-ui);
  --font-code: "JetBrains Mono", "Cascadia Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* language colours (also used for Nova and charts) */
  --sky: #2f63e0;          /* Python */
  --flame: #d79b00;        /* JavaScript */
  --aurora: #0b7d68;       /* SQL, and right answers (white text on it passes WCAG AA) */
  --lingon: #c23a5f;       /* HTML & CSS, and wrong answers */
  --grape: #6b4fd8;        /* memory checks */
  --reward: #ef7d17;       /* streaks, XP and combos: the one warm colour (fills) */
  --reward-text: #a84f00;  /* the same colour for text and icons on light backgrounds */

  /* code panels: deep ink in both themes */
  --code-bg: #161b26;
  --code-line: #273042;
  --code-text: #e6eaf2;
  --code-dim: #8390a8;
  --code-out: #11151e;
  --code-slot: #202838;
  --code-slot-line: #5b6884;
  --code-pick: #1f3a6e;
  --code-ok: #10463b;
  --code-bad: #4f1d2b;
  --code-now: #262f45;

  --r-s: 6px;
  --r-m: 10px;
  --r-l: 14px;
  --r-xl: 18px;
  --bar-h: 72px;
  --rail-w: 232px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

[data-theme="day"] {
  color-scheme: light;
  --bg: #f3f4f7;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --line: #dfe3ea;
  --line-2: #c9cfd9;
  --text: #171c27;
  --text-2: #525b6c;
  --text-3: #5c6474;
  --ember: #171c27;        /* the action colour: ink */
  --ember-deep: #000000;
  --ember-ink: #ffffff;
  --accent-text: #2f63e0;
  --ok-text: #0b7a62;
  --bad-text: #b8304f;
  --info-text: #2552c4;
  --ok-bg: #e2f4ee;
  --bad-bg: #fbe7ec;
  --info-bg: #e6edfc;
  --warn-bg: #fdf1dc;
  --shade: 0 16px 40px rgba(23, 28, 39, .12);
  --logo-ink: #ffffff;
}

[data-theme="night"] {
  color-scheme: dark;
  --bg: #14171d;
  --bg-2: #181c23;
  --surface: #1c2028;
  --surface-2: #252a34;
  --line: #2e3440;
  --line-2: #3d4452;
  --text: #edf0f5;
  --text-2: #aab2c0;
  --text-3: #8c95a5;
  --ember: #edf0f5;
  --ember-deep: #c4cad4;
  --ember-ink: #14171d;
  --accent-text: #8fb0ff;
  --ok-text: #4fd1ae;
  --bad-text: #ff8aa4;
  --info-text: #9bb8ff;
  --ok-bg: #133a33;
  --bad-bg: #42202b;
  --info-bg: #1e2b4c;
  --warn-bg: #3d3120;
  --shade: 0 16px 40px rgba(0, 0, 0, .45);
  --logo-ink: #14171d;
  --reward-text: #f59e4b;
}

/* language colours: --accent is the colour itself, --accent-ink text on it, --accent-text readable text */
[data-accent="sky"] { --accent: var(--sky); --accent-ink: #fff; --accent-text: #2a59cc; }
[data-accent="flame"] { --accent: var(--flame); --accent-ink: #1f1600; --accent-text: #8d6400; }
[data-accent="aurora"] { --accent: var(--aurora); --accent-ink: #fff; --accent-text: #0b7a62; }
[data-accent="lingon"] { --accent: var(--lingon); --accent-ink: #fff; --accent-text: #b8304f; }
[data-theme="night"] [data-accent="sky"] { --accent: #4f7ff0; --accent-ink: #0b1020; --accent-text: #8fb0ff; }
[data-theme="night"] [data-accent="flame"] { --accent: #e6ad1f; --accent-text: #f2c55a; }
[data-theme="night"] [data-accent="aurora"] { --accent: #19ad90; --accent-ink: #04221b; --accent-text: #4fd1ae; }
[data-theme="night"] [data-accent="lingon"] { --accent: #e0577c; --accent-ink: #1a0710; --accent-text: #ff8aa4; }

html { font-size: 16px; }
html[data-size="s"] { font-size: 15px; }
html[data-size="l"] { font-size: 18px; }

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.012em; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
.page > h2 { margin: 22px 0 10px; }
/* Number keys pick an answer on wide screens with a keyboard */
@media (hover: hover) and (min-width: 700px) {
  .opts .opt[data-n]::after { content: attr(data-n); margin-left: auto; align-self: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--text-2); font-size: .74rem; font-weight: 700; display: inline-grid; place-items: center; }
}
h3 { font-size: 1.12rem; }
h4 { font-size: 1rem; }
p { text-wrap: pretty; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--info-text); }
svg { display: block; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--ember); color: var(--ember-ink); }

.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-l { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.md p + p { margin-top: .7em; }
.md code, .inline-code {
  font-family: var(--font-code);
  font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .08em .36em;
  white-space: pre-wrap;
  word-break: break-word;
}
.md strong { font-weight: 700; color: var(--text); }

/* ------------------------------------------------------------------ boot */
.boot { height: 100%; display: grid; place-content: center; justify-items: center; gap: 16px; }
.boot-mark { width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 50% 60%, var(--flame), var(--ember) 60%, transparent 62%); animation: glow 1.6s ease-in-out infinite; }
.boot-text { color: var(--text-2); }
@keyframes glow { 50% { transform: scale(1.12); filter: brightness(1.15); } }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 0; border-radius: var(--r-m);
  background: var(--surface-2); color: var(--text);
  font-weight: 600; text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18);
  transition: transform .08s var(--ease), filter .15s, background .15s;
  user-select: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .18); }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn--primary { background: var(--ember); color: var(--ember-ink); box-shadow: inset 0 -4px 0 var(--ember-deep); }
.btn--primary:active { box-shadow: inset 0 -1px 0 var(--ember-deep); }
.btn--ok { background: var(--aurora); color: #06281e; box-shadow: inset 0 -4px 0 #2fae84; }
.btn--bad { background: var(--lingon); color: #fff; box-shadow: inset 0 -4px 0 #c33757; }
.btn--ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn--ghost:active { box-shadow: inset 0 0 0 2px var(--line); }
.btn--quiet { background: transparent; box-shadow: none; color: var(--text-2); padding: 0 12px; }
.btn--quiet:hover { color: var(--text); background: var(--surface-2); }
.btn--block { width: 100%; }
.btn--lg { min-height: 56px; font-size: 1.06rem; padding: 0 28px; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--info-text); text-decoration: underline; text-underline-offset: 3px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-weight: 600; font-size: .92rem; color: var(--text);
}
.pill svg { width: 18px; height: 18px; }
.pill--streak svg { color: var(--ember); }
.pill--xp svg { color: #8d6400; }
[data-theme="night"] .pill--xp svg { color: #f2c55a; }
[data-theme="day"] .pill--xp svg { color: #c98700; }
.pill.is-dim { color: var(--text-3); }
.pill.is-dim svg { color: var(--text-3); }

.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--text-2);
}
.tag svg { width: 14px; height: 14px; }
.tag--solo { background: var(--info-bg); color: var(--info-text); }
.tag--ok { background: var(--ok-bg); color: var(--ok-text); }
.tag--warn { background: var(--warn-bg); color: var(--accent-text); }

.glyph {
  display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 12px;
  background: var(--accent, var(--ember)); color: var(--accent-ink, var(--ember-ink));
  font-family: var(--font-code); font-weight: 700; font-size: .9rem; flex: none;
}
.glyph--lg { min-width: 56px; height: 56px; border-radius: 16px; font-size: 1.1rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; }
.card--flat { background: transparent; }
.divider { height: 1px; background: var(--line); border: 0; margin: 4px 0; }

.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--ember), var(--flame)); transition: width .4s var(--ease); }
.bar--ok > i { background: var(--aurora); }
.bar--thin { height: 6px; }

/* ------------------------------------------------------------------ shell */
.shell { height: 100%; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.rail {
  display: flex; flex-direction: column; gap: 6px; padding: 20px 14px;
  background: var(--bg-2); border-right: 1px solid var(--line); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--text); text-decoration: none; }
.brand svg { width: 38px; height: 38px; }
.brand b { font-size: 1.16rem; font-weight: 800; letter-spacing: -.02em; }
.brand b span { color: var(--accent-text); }
.rail-link {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: var(--r-m);
  color: var(--text-2); text-decoration: none; font-weight: 600; position: relative;
}
.rail-link svg { width: 24px; height: 24px; flex: none; }
.rail-link:hover { background: var(--surface); color: var(--text); }
.rail-link.is-on { background: var(--surface); color: var(--text); box-shadow: inset 3px 0 0 var(--ember); }
.rail-link .dot { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--ember); color: var(--ember-ink); font-size: .78rem; font-weight: 700; display: grid; place-items: center; }
.rail-foot { margin-top: auto; padding: 12px 10px 0; color: var(--text-3); font-size: .78rem; }

.main { min-width: 0; height: 100%; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.page { width: 100%; max-width: 720px; margin: 0 auto; padding: 24px 20px 48px; }
.page--wide { max-width: 1060px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 1.6rem; }

.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.course-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 12px 4px 4px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-weight: 700;
}
.course-btn svg { width: 18px; height: 18px; color: var(--text-2); }

@media (max-width: 899px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .rail {
    grid-row: 2; flex-direction: row; justify-content: space-around; gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); overflow: visible;
  }
  .brand, .rail-foot { display: none; }
  .rail-link { flex: 1 1 0; flex-direction: column; gap: 2px; min-height: 56px; padding: 6px 2px; font-size: .74rem; justify-content: center; }
  .rail-link.is-on { background: transparent; box-shadow: none; color: var(--accent-text); }
  .rail-link .dot { position: absolute; top: 4px; left: calc(50% + 8px); margin: 0; min-width: 18px; height: 18px; font-size: .68rem; }
  .page { padding: 16px 16px 32px; }
}

/* ------------------------------------------------------------------ sheets and toasts */
#layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#layer > * { pointer-events: auto; }
.backdrop { position: absolute; inset: 0; background: rgba(3, 14, 17, .62); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease-out; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92%; display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shade);
  animation: rise .24s var(--ease);
}
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 6px 22px; }
.sheet-head h2 { font-size: 1.25rem; flex: 1; }
.sheet-body { padding: 10px 22px 20px; overflow-y: auto; }
.sheet-foot { padding: 12px 22px calc(18px + env(safe-area-inset-bottom)); display: flex; gap: 10px; border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: var(--r-xl); border-bottom: 1px solid var(--line); max-height: 88%; }
  .sheet--wide { max-width: 760px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(28px); opacity: 0; } }

.toasts { position: absolute; left: 0; right: 0; top: 14px; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: min(92vw, 460px); padding: 10px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shade); font-weight: 500; font-size: .92rem;
  animation: drop .28s var(--ease);
}
.toast svg { width: 20px; height: 20px; flex: none; color: var(--flame); }
.toast.is-out { opacity: 0; transform: translateY(-8px); transition: .25s; }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }

/* ------------------------------------------------------------------ code */
.code {
  margin: 0; padding: 14px 16px; border-radius: var(--r-m); background: var(--code-bg); color: var(--code-text);
  font-family: var(--font-code); font-size: .92rem; line-height: 1.6; overflow-x: auto; white-space: pre; tab-size: 4;
  border: 1px solid var(--code-line); -webkit-overflow-scrolling: touch;
}
.code code { font: inherit; }
.code-wrap { display: grid; gap: 0; }
.code-wrap .code { border-radius: var(--r-m) var(--r-m) 0 0; }
.code-wrap .code:only-child { border-radius: var(--r-m); }
.out {
  margin: 0; padding: 10px 16px 12px; background: var(--code-out); color: var(--code-text); border: 1px solid var(--code-line); border-top: 0;
  border-radius: 0 0 var(--r-m) var(--r-m); font-family: var(--font-code); font-size: .88rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.out::before { content: attr(data-label); display: block; font-family: var(--font-ui); font-size: .72rem; font-weight: 600; color: var(--code-dim); margin-bottom: 2px; }
.out.is-error { color: #ff9db1; }
.out--solo { border-top: 1px solid var(--code-line); border-radius: var(--r-m); }
.tk { color: #ff9e64; } .ts { color: #86e8c4; } .tn { color: #ffc86b; } .tc { color: #6f9391; font-style: italic; }
.tf { color: #7cccf8; } .tb { color: #f79ab0; } .to { color: #b8cfc9; } .tt { color: #ff9e64; } .ta { color: #ffc86b; }
.tp { color: #7cccf8; } .ti { color: #f2f6f2; }

.preview-frame { width: 100%; height: 200px; border: 1px solid var(--line); border-radius: var(--r-m); background: #fff; }
.preview-label { font-size: .78rem; font-weight: 600; color: var(--text-3); margin: 10px 0 4px; }

.result-table { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--surface); border-radius: var(--r-m); overflow: hidden; }
.result-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); }
.result-table th { text-align: left; padding: 8px 12px; background: var(--surface-2); font-family: var(--font-code); font-weight: 700; font-size: .82rem; color: var(--text-2); white-space: nowrap; }
.result-table td { padding: 7px 12px; border-top: 1px solid var(--line); font-family: var(--font-code); white-space: nowrap; }
.result-table td.is-null { color: var(--text-3); font-style: italic; }
.result-table td.is-num { text-align: right; }
.result-note { font-size: .78rem; color: var(--text-3); padding: 6px 2px 0; }

/* ------------------------------------------------------------------ learn: today and trail */
.today { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.ring { width: 76px; height: 76px; position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .ring-bg { stroke: var(--surface-2); }
.ring .ring-fg { stroke: var(--ember); stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }
.ring.is-full .ring-fg { stroke: var(--aurora); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-weight: 700; font-size: .95rem; line-height: 1.1; }
.ring-label small { display: block; font-weight: 500; font-size: .66rem; color: var(--text-2); }

.memory-card { display: flex; align-items: center; gap: 14px; background: linear-gradient(120deg, color-mix(in srgb, var(--ember) 22%, var(--surface)), var(--surface) 70%); border-color: color-mix(in srgb, var(--ember) 45%, var(--line)); }
.memory-card svg.art { width: 48px; height: 48px; flex: none; }

.trail { position: relative; margin-top: 8px; padding-bottom: 40px; }
.camp { position: relative; padding: 26px 0 6px; }
.camp-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); position: relative; z-index: 2; }
.camp-head .camp-art { width: 54px; height: 54px; flex: none; }
.camp-head h2 { font-size: 1.14rem; }
.camp-count { margin-left: auto; font-weight: 700; font-size: .9rem; color: var(--text-2); white-space: nowrap; }
.camp-num { font-size: .8rem; font-weight: 600; color: var(--accent-text); }
.camp-path { position: relative; height: var(--h); margin-top: 6px; }
.camp-path > svg.path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.camp-path .trees { position: absolute; inset: 0; pointer-events: none; }
.camp-path .trees svg { position: absolute; }
.node { position: absolute; width: 168px; margin-left: -84px; display: grid; justify-items: center; gap: 6px; text-align: center; z-index: 1; }
.node-btn {
  width: 78px; height: 78px; border-radius: 50%; border: 0; display: grid; place-items: center; position: relative;
  background: var(--surface-2); color: var(--text-3); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .22), 0 0 0 6px var(--bg);
  transition: transform .12s var(--ease);
}
.node-btn svg { width: 34px; height: 34px; }
.node-btn:hover { transform: translateY(-2px); }
.node-btn:active { transform: translateY(2px); }
.node--open .node-btn { background: var(--ember); color: var(--ember-ink); box-shadow: inset 0 -5px 0 var(--ember-deep), 0 0 0 6px var(--bg), 0 0 0 9px color-mix(in srgb, var(--ember) 45%, transparent); }
.node--open .node-btn::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--ember); opacity: 0; animation: ping 2.2s ease-out infinite; }
.node--done .node-btn { background: linear-gradient(160deg, var(--flame), var(--ember)); color: #3a1a02; box-shadow: inset 0 -5px 0 var(--ember-deep), 0 0 0 6px var(--bg), 0 0 26px color-mix(in srgb, var(--ember) 55%, transparent); }
.node--done.is-due .node-btn { box-shadow: inset 0 -5px 0 var(--ember-deep), 0 0 0 6px var(--bg), 0 0 0 9px var(--sky); }
.node-label { font-size: .86rem; font-weight: 600; line-height: 1.25; color: var(--text); max-width: 160px; background: var(--bg); padding: 2px 8px; border-radius: 8px; }
.node--locked .node-label { color: var(--text-3); }
.node .nova-here { position: absolute; top: -8px; left: calc(50% + 34px); width: 58px; height: 58px; pointer-events: none; animation: bob 2.8s ease-in-out infinite; }
.node.is-left .nova-here { left: auto; right: calc(50% + 34px); }
@keyframes ping { 0% { transform: scale(.9); opacity: .7; } 70%, 100% { transform: scale(1.25); opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-5px); } }

.flames { display: inline-flex; gap: 3px; }
.flames svg { width: 15px; height: 15px; color: var(--surface-2); }
.flames svg.is-on { color: var(--ember); }
.flames--lg svg { width: 24px; height: 24px; }
[data-theme="day"] .flames svg { color: #cfdcd8; }
[data-theme="day"] .flames svg.is-on { color: var(--ember-deep); }

.aside-cards { display: grid; gap: 14px; }
.learn-grid { display: grid; gap: 28px; }
@media (min-width: 1180px) {
  .learn-grid { grid-template-columns: minmax(0, 600px) 320px; justify-content: center; align-items: start; }
  .learn-grid .aside-cards { position: sticky; top: 24px; }
  .learn-grid .only-narrow { display: none; }
}
@media (max-width: 1179px) { .learn-grid .only-wide { display: none; } }

/* ------------------------------------------------------------------ player */
.player:focus { outline: none; }
.player { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
.player-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; max-width: 860px; width: 100%; margin: 0 auto; }
.player-progress { flex: 1; height: 14px; border-radius: 999px; background: var(--surface); position: relative; overflow: visible; }
.player-progress > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--ember-deep), var(--ember), var(--flame)); transition: width .45s var(--ease); min-width: 14px; }
.player-progress > i::after { content: ""; position: absolute; right: -4px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%; background: radial-gradient(circle, #fff6d8 0 22%, var(--flame) 24% 48%, transparent 50%); filter: drop-shadow(0 0 6px var(--flame)); }
.player-count { font-size: .82rem; font-weight: 600; color: var(--text-2); min-width: 44px; text-align: right; }
.player-stage { overflow-y: auto; overflow-x: hidden; padding: 6px 18px 28px; }
.stage { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; animation: stage-in .26s var(--ease); }
@keyframes stage-in { from { opacity: 0; transform: translateX(18px); } }
.stage h2 { font-size: 1.32rem; }
.stage .prompt { font-size: 1.08rem; font-weight: 500; }
.stage-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.player-bar { border-top: 1px solid var(--line); background: var(--bg-2); padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
.player-bar-in { max-width: 720px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.player-bar .btn--primary, .player-bar .btn--ok { flex: 1 1 160px; }
.help-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: var(--r-m); border: 0; background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 2px var(--line); position: relative; }
.help-btn svg { width: 22px; height: 22px; color: var(--flame); }
[data-theme="day"] .help-btn svg { color: #c98700; }
.help-btn[disabled] { opacity: .55; cursor: not-allowed; }
.help-btn.is-calling { box-shadow: inset 0 0 0 2px var(--flame); animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-3px); } }
.help-note { font-size: .8rem; color: var(--text-3); max-width: 720px; margin: 8px auto 0; }

/* feedback */
.feedback { max-width: 720px; margin: 0 auto 12px; padding: 14px 16px; border-radius: var(--r-l); display: grid; gap: 6px; animation: rise .22s var(--ease); }
.feedback.is-ok { background: var(--ok-bg); color: var(--text); }
.feedback.is-bad { background: var(--bad-bg); }
.feedback.is-info { background: var(--info-bg); }
.feedback-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; }
.feedback.is-ok .feedback-title { color: var(--ok-text); }
.feedback.is-bad .feedback-title { color: var(--bad-text); }
.feedback.is-info .feedback-title { color: var(--info-text); }
.feedback-title svg { width: 22px; height: 22px; }
.feedback .xp { margin-left: auto; font-size: .86rem; font-weight: 700; color: var(--accent-text); }
.feedback .answer { font-family: var(--font-code); font-size: .9rem; background: rgba(0, 0, 0, .18); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; overflow-x: auto; }
[data-theme="day"] .feedback .answer { background: rgba(255, 255, 255, .7); }

/* options */
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 54px; padding: 12px 16px;
  border-radius: var(--r-m); border: 2px solid var(--line); background: var(--surface); color: var(--text); font-weight: 500;
  transition: border-color .12s, background .12s, transform .08s;
}
.opt:hover { border-color: var(--text-3); }
.opt:active { transform: scale(.99); }
.opt .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--text-3); flex: none; display: grid; place-items: center; }
.opt .mark svg { width: 14px; height: 14px; opacity: 0; }
.opt--code .opt-text { font-family: var(--font-code); font-size: .92rem; white-space: pre-wrap; word-break: break-word; }
.opt.is-picked { border-color: var(--sky); background: var(--info-bg); }
.opt.is-picked .mark { border-color: var(--sky); background: var(--sky); }
.opt.is-right { border-color: var(--aurora); background: var(--ok-bg); }
.opt.is-right .mark { border-color: var(--aurora); background: var(--aurora); color: #06281e; }
.opt.is-right .mark svg, .opt.is-wrong .mark svg { opacity: 1; }
.opt.is-wrong { border-color: var(--lingon); background: var(--bad-bg); }
.opt.is-wrong .mark { border-color: var(--lingon); background: var(--lingon); color: #fff; }
.opt.is-off { opacity: .5; pointer-events: none; }
.opt[disabled] { cursor: default; }

.answer-box { display: grid; gap: 6px; }
.answer-box label { font-size: .86rem; font-weight: 600; color: var(--text-2); }
.answer-input {
  width: 100%; min-height: 54px; padding: 12px 14px; border-radius: var(--r-m); border: 2px solid var(--line);
  background: var(--code-bg); color: var(--code-text); font-family: var(--font-code); font-size: .95rem; line-height: 1.6; resize: vertical;
}
.answer-input:focus { outline: none; border-color: var(--sky); }
.answer-input.is-right { border-color: var(--aurora); }
.answer-input.is-wrong { border-color: var(--lingon); }

/* fill */
.slot {
  display: inline-block; min-width: 3.2em; min-height: 1.75em; padding: 0 .5em; margin: 0 .12em; vertical-align: baseline;
  border-radius: 7px; border: 2px dashed var(--code-slot-line); background: var(--code-slot); color: var(--code-text);
  font: inherit; line-height: 1.55; text-align: center; cursor: pointer;
}
.slot.is-next { border-color: var(--flame); box-shadow: 0 0 0 3px rgba(255, 194, 75, .22); }
.slot.is-filled { border-style: solid; border-color: var(--sky); background: var(--code-pick); }
.slot.is-right { border-style: solid; border-color: var(--aurora); background: var(--code-ok); }
.slot.is-wrong { border-style: solid; border-color: var(--lingon); background: var(--code-bad); animation: shake .3s; }
.bank { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 46px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--surface-2); color: var(--text);
  font-family: var(--font-code); font-size: .95rem; font-weight: 500; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .22), inset 0 0 0 1px var(--line);
  transition: transform .08s; white-space: pre;
}
.chip:active { transform: translateY(2px); }
.chip.is-used { opacity: .25; pointer-events: none; box-shadow: inset 0 0 0 1px var(--line); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* order */
.order-box { display: grid; gap: 8px; }
.order-target { min-height: 64px; padding: 10px; border-radius: var(--r-m); background: var(--code-bg); border: 1px solid var(--code-line); display: grid; gap: 8px; align-content: start; }
.order-target:empty::before { content: "Tap the lines below in the right order"; color: var(--code-dim); font-size: .88rem; padding: 12px 6px; }
.order-tray { display: grid; gap: 8px; }
.order-label { font-size: .82rem; font-weight: 600; color: var(--text-3); }
.pline {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 46px; padding: 6px 8px 6px 14px; text-align: left;
  border-radius: 10px; border: 0; background: var(--surface-2); color: var(--text); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2), inset 0 0 0 1px var(--line);
  font-family: var(--font-code); font-size: .92rem; white-space: pre; overflow-x: auto;
}
.order-target .pline { background: var(--code-line); color: var(--code-text); box-shadow: inset 0 0 0 1px var(--code-line); }
.pline code { flex: 1; font: inherit; }
.pline .n { color: var(--code-dim); width: 1.4em; flex: none; font-size: .8rem; }
.pline .move { width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--code-dim); display: grid; place-items: center; flex: none; }
.pline .move:hover { background: rgba(255, 255, 255, .08); color: var(--code-text); }
.pline .move svg { width: 18px; height: 18px; }
.pline.is-right { box-shadow: inset 0 0 0 2px var(--aurora); }
.pline.is-wrong { box-shadow: inset 0 0 0 2px var(--lingon); }

/* spot */
.spot { border-radius: var(--r-m); background: var(--code-bg); border: 1px solid var(--code-line); padding: 8px; display: grid; gap: 4px; overflow-x: auto; }
.spot-line { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 12px; border-radius: 8px; border: 2px solid transparent; background: transparent; color: var(--code-text); font-family: var(--font-code); font-size: .92rem; text-align: left; white-space: pre; width: 100%; }
.spot-line .n { color: var(--code-dim); width: 1.4em; text-align: right; flex: none; font-size: .82rem; }
.spot-line:hover { background: var(--code-slot); }
.spot-line.is-picked { border-color: var(--sky); background: var(--code-pick); }
.spot-line.is-right { border-color: var(--aurora); background: var(--code-ok); }
.spot-line.is-wrong { border-color: var(--lingon); background: var(--code-bad); }
.spot-line[disabled] { cursor: default; }

/* editor */
.editor { position: relative; border-radius: var(--r-m); background: var(--code-bg); border: 2px solid var(--code-line); overflow: hidden; }
.editor:focus-within { border-color: var(--sky); }
.editor-scroll { position: relative; overflow: auto; max-height: 46vh; min-height: 132px; }
.editor-hl, .editor-ta {
  margin: 0; padding: 14px 16px; border: 0; font-family: var(--font-code); font-size: .95rem; line-height: 1.6; tab-size: 4;
  white-space: pre; word-wrap: normal; overflow-wrap: normal; letter-spacing: 0; word-spacing: 0;
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; font-kerning: none;
}
/* The coloured copy must use exactly the same font as the textarea, or the caret drifts away from the letters. */
.editor-hl code, .editor-hl span { font: inherit; font-style: normal; letter-spacing: 0; }
.editor-hl { color: var(--code-text); pointer-events: none; min-height: 132px; }
.editor-ta { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; background: transparent; color: transparent; caret-color: var(--flame); outline: none; overflow: hidden; -webkit-text-fill-color: transparent; }
.editor-ta::selection { background: rgba(108, 197, 247, .35); }
.keys { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: var(--code-out); border-top: 1px solid var(--code-line); }
.keys button { min-width: 44px; height: 44px; padding: 0 10px; border-radius: 8px; border: 0; background: var(--code-slot); color: var(--code-text); font-family: var(--font-code); font-size: .9rem; flex: none; }
.keys button:active { background: var(--code-pick); }
@media (hover: hover) and (pointer: fine) { .keys { display: none; } }
.run-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tests { display: grid; gap: 6px; }
.test { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }
.test svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.test.is-ok svg { color: var(--ok-text); }
.test.is-bad svg { color: var(--bad-text); }
.diff { display: grid; gap: 8px; }
.diff > div { display: grid; gap: 2px; }
.diff b { font-size: .78rem; color: var(--text-3); font-weight: 600; }
.diff pre { margin: 0; font-family: var(--font-code); font-size: .86rem; padding: 8px 10px; border-radius: 8px; background: rgba(0, 0, 0, .2); white-space: pre-wrap; word-break: break-word; }
[data-theme="day"] .diff pre { background: rgba(255, 255, 255, .7); }

/* trace */
.trace { display: grid; gap: 10px; }
.trace-code { border-radius: var(--r-m); background: var(--code-bg); border: 1px solid var(--code-line); padding: 8px 0; overflow-x: auto; font-family: var(--font-code); font-size: .92rem; line-height: 1.6; }
.trace-line { display: flex; gap: 12px; padding: 1px 16px 1px 8px; white-space: pre; border-left: 4px solid transparent; color: var(--code-text); }
.trace-line .n { color: var(--code-dim); width: 1.6em; text-align: right; flex: none; font-size: .82rem; }
.trace-line.is-now { background: var(--code-now); border-left-color: var(--flame); }
.trace-line.is-done { opacity: .7; }
.trace-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.trace-panel { border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); padding: 10px 12px; min-height: 84px; }
.trace-panel h4 { font-size: .78rem; color: var(--text-3); font-weight: 600; margin-bottom: 6px; }
.var { display: flex; align-items: center; gap: 8px; font-family: var(--font-code); font-size: .9rem; padding: 2px 0; }
.var b { font-weight: 500; color: var(--text-2); }
.var span { padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.var.is-new span { border-color: var(--flame); background: var(--warn-bg); animation: pop .3s var(--ease); }
.trace-out { font-family: var(--font-code); font-size: .9rem; white-space: pre-wrap; word-break: break-word; min-height: 1.5em; }
.trace-nav { display: flex; align-items: center; gap: 10px; }
.trace-nav .where { flex: 1; text-align: center; font-size: .86rem; color: var(--text-2); }
@keyframes pop { from { transform: scale(.8); } }
@media (max-width: 520px) { .trace-panels { grid-template-columns: 1fr; } }

/* confidence */
.conf { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.conf-btn { display: grid; justify-items: center; gap: 6px; padding: 12px 4px 10px; border-radius: var(--r-m); border: 2px solid var(--line); background: var(--surface); color: var(--text); font-size: .78rem; font-weight: 600; line-height: 1.2; text-align: center; transition: transform .1s, border-color .12s; }
.conf-btn svg { width: 40px; height: 40px; }
.conf-btn:hover { border-color: var(--flame); transform: translateY(-2px); }
.conf-btn.is-picked { border-color: var(--flame); background: var(--warn-bg); }
.solo-card { text-align: center; display: grid; gap: 14px; justify-items: center; padding-top: 8px; }
.solo-card .nova { width: 96px; height: 96px; }
.solo-card h2 { font-size: 1.4rem; }
.solo-card .conf { width: 100%; }

/* help */
.help-kind { display: flex; align-items: center; gap: 12px; }
.help-kind .nova { width: 54px; height: 54px; flex: none; }
.help-kind h3 { font-size: 1.1rem; }
.help-text { font-size: 1.02rem; padding: 14px 16px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); position: relative; }
.why { font-size: .84rem; color: var(--text-2); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-m); padding: 10px 12px; }
.why summary { cursor: pointer; font-weight: 600; color: var(--text); }
.why-probs { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.explain-box textarea { width: 100%; min-height: 96px; padding: 12px 14px; border-radius: var(--r-m); border: 2px solid var(--line); background: var(--surface); resize: vertical; }
.explain-box textarea:focus { outline: none; border-color: var(--sky); }
.starters { display: flex; flex-wrap: wrap; gap: 8px; }
.starters button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: .84rem; color: var(--text-2); }
.starters button:hover { color: var(--text); border-color: var(--text-3); }
.worked-step { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; animation: rise .25s var(--ease); }
.worked-step .num { width: 32px; height: 32px; border-radius: 50%; background: var(--ember); color: var(--ember-ink); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.worked-step h4 { font-size: 1rem; margin-bottom: 4px; }
.worked-step .code { margin-top: 8px; }
.problem { padding: 12px 14px; border-radius: var(--r-m); background: var(--info-bg); font-weight: 500; }

/* summary */
.summary { text-align: center; justify-items: center; padding-top: 12px; }
.summary .nova { width: 132px; height: 132px; }
.summary h1 { font-size: 1.8rem; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.tile { padding: 14px 8px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 2px; justify-items: center; }
.tile b { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.tile span { font-size: .78rem; color: var(--text-2); line-height: 1.25; }
.tile--xp b { color: var(--accent-text); }
.note-card { width: 100%; text-align: left; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); }
.note-card svg.ic { width: 26px; height: 26px; flex: none; color: var(--ember); margin-top: 2px; }
.note-card h4 { margin-bottom: 2px; }
.badge-pop { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 16px; border-radius: var(--r-l); background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--flame) 50%, transparent); }
.badge-pop .medal { width: 46px; height: 46px; flex: none; }
.check-list { width: 100%; display: grid; gap: 8px; text-align: left; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); }
.check-row svg.state { width: 24px; height: 24px; flex: none; }
.check-row.is-ok svg.state { color: var(--ok-text); }
.check-row.is-bad svg.state { color: var(--bad-text); }
.check-row .grow b { display: block; font-size: .95rem; }

/* ------------------------------------------------------------------ me / insights */
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head .nova { width: 84px; height: 84px; flex: none; }
.profile-head h1 { font-size: 1.5rem; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .stat-row { grid-template-columns: repeat(2, 1fr); } .tiles { grid-template-columns: repeat(3, 1fr); } }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 -4px; }
.section-title h2 { font-size: 1.2rem; }
.insight-grid { display: grid; gap: 14px; }
@media (min-width: 900px) { .insight-grid { grid-template-columns: 1fr 1fr; } .insight-grid .span-2 { grid-column: span 2; } }
[data-theme="night"] { --chart: #6f93f3; --chart-soft: #2c3a5e; }
[data-theme="day"] { --chart: #2f63e0; --chart-soft: #cfdbf8; }
.chart { display: block; width: 100%; max-width: 460px; height: auto; margin: 0 auto; overflow: visible; }
.chart text { font-family: var(--font-ui); fill: var(--text-2); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart .axis { stroke: var(--text-3); stroke-width: 1; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .goal { stroke: var(--text-2); stroke-width: 1; }
.chart .ref { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.chart .col { fill: var(--chart-soft); }
.chart .col.is-mark, .chart .col:hover { fill: var(--chart); }
.chart--solid .col { fill: var(--chart); }
.chart .col.is-zero { fill: var(--line); }
.chart .v { fill: var(--text); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.ref-key { height: 2px; width: 14px; border-radius: 2px; background: var(--text); vertical-align: 3px; }
.meter { display: grid; gap: 6px; }
.meter-top { display: flex; align-items: baseline; gap: 10px; font-size: .92rem; }
.meter-top span:first-child { flex: 1; font-weight: 500; }
.meter-top b { font-variant-numeric: tabular-nums; }
.meter-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter-track i { display: block; height: 100%; border-radius: 999px; background: var(--chart); }
.empty > svg { width: 56px; height: 56px; color: var(--text-3); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: .92rem; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.empty { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 18px 12px; color: var(--text-2); }
.empty svg { width: 64px; height: 64px; }
.skill { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.skill:first-child { border-top: 0; }
.skill b { font-size: .94rem; font-weight: 600; }
.skill .bar { grid-column: 1 / -1; }
.skill .when { font-size: .78rem; color: var(--text-3); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.badge { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 14px 8px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); }
.badge .medal { width: 56px; height: 56px; }
.badge b { font-size: .86rem; line-height: 1.2; }
.badge span { font-size: .74rem; color: var(--text-2); line-height: 1.3; }
.badge:not(.is-earned) .medal { filter: grayscale(1); opacity: .35; }
.badge:not(.is-earned) b { color: var(--text-3); }

/* ------------------------------------------------------------------ settings */
.set-group { display: grid; gap: 2px; }
.set-group > h2 { font-size: 1.06rem; margin: 18px 4px 8px; }
.set-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-bottom-width: 0; }
.set-row:first-of-type { border-radius: var(--r-l) var(--r-l) 0 0; }
.set-row:last-of-type { border-radius: 0 0 var(--r-l) var(--r-l); border-bottom-width: 1px; }
.set-row:only-of-type { border-radius: var(--r-l); }
.set-row .grow b { display: block; font-weight: 600; }
.set-row .grow span { display: block; font-size: .84rem; color: var(--text-2); }
.set-row > .grow { flex: 1 1 220px; min-width: 0; }
.set-row--col { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2); border: 2px solid var(--line); transition: .18s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-3); transition: .18s var(--ease); }
.switch input:checked + i { background: var(--ember); border-color: var(--ember); }
.switch input:checked + i::after { transform: translateX(22px); background: #fff; }
.switch input:focus-visible + i { outline: 3px solid var(--sky); outline-offset: 2px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { white-space: nowrap; min-height: 36px; padding: 0 12px; border-radius: 9px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: .86rem; }
.seg button.is-on { background: var(--ember); color: var(--ember-ink); }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .9rem; }
.input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r-m); border: 2px solid var(--line); background: var(--surface); }
.input:focus { outline: none; border-color: var(--sky); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; padding: 0; background: var(--c); }
.swatch.is-on { border-color: var(--text); box-shadow: 0 0 0 3px var(--bg-2) inset; }
.callout { padding: 12px 14px; border-radius: var(--r-m); background: var(--info-bg); font-size: .9rem; }
.callout--warn { background: var(--warn-bg); }
.refs { font-size: .84rem; color: var(--text-2); display: grid; gap: 6px; padding-left: 18px; margin: 0; }

/* ------------------------------------------------------------------ playground */
.lab { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.lab > *, .lab-grid > * { min-width: 0; }
.lab-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.lab-tabs::-webkit-scrollbar { display: none; }
.lab-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 6px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 600; flex: none; }
.lab-tab .glyph { min-width: 32px; height: 32px; border-radius: 9px; font-size: .78rem; }
.lab-tab.is-on { border-color: var(--accent); }
.pool-report { margin: 0; padding: 12px; max-height: 360px; overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-m); font-family: var(--font-code); font-size: .8rem; white-space: pre-wrap; }
.lab-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 1000px) { .lab-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.lab .editor-scroll { max-height: 52vh; min-height: 240px; }
.lab .editor-hl { min-height: 240px; }
.lab-out { min-height: 120px; }
.schema { display: grid; gap: 8px; font-size: .86rem; }
.schema details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px 12px; }
.schema summary { cursor: pointer; font-family: var(--font-code); font-weight: 700; }
.schema ul { margin: 8px 0 2px; padding-left: 18px; font-family: var(--font-code); color: var(--text-2); }

/* ------------------------------------------------------------------ welcome */
.welcome { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; }
.welcome-in { min-height: 100%; max-width: 620px; margin: 0 auto; padding: 28px 20px 32px; display: grid; grid-template-rows: auto 1fr auto; gap: 20px; }
.welcome-dots { display: flex; gap: 6px; justify-content: center; }
.welcome-dots i { width: 28px; height: 6px; border-radius: 999px; background: var(--surface-2); }
.welcome-dots i.is-on { background: var(--ember); }
.welcome-body { display: grid; gap: 18px; align-content: center; }
.welcome-body .nova { width: 148px; height: 148px; margin: 0 auto; }
.hero-title { font-size: clamp(2.1rem, 7vw, 3.1rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.04; text-align: center; }
.hero-title em { font-style: normal; color: var(--ember); }
.hero-sub { text-align: center; color: var(--text-2); font-size: 1.08rem; max-width: 30em; margin: 0 auto; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--r-l); border: 2px solid var(--line); background: var(--surface); color: var(--text); transition: border-color .12s, transform .08s; }
.choice:hover { border-color: var(--text-3); }
.choice.is-on { border-color: var(--ember); background: color-mix(in srgb, var(--ember) 12%, var(--surface)); }
.choice b { display: block; font-size: 1.02rem; }
.choice span.sub { display: block; font-size: .86rem; color: var(--text-2); }
.choice svg.ic { width: 30px; height: 30px; flex: none; color: var(--accent-text); }
.how { display: grid; gap: 12px; }
.how-row { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; }
.how-row .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--ember); }
.how-row .ic svg { width: 24px; height: 24px; }
.how-row b { display: block; }
.how-row span { font-size: .9rem; color: var(--text-2); }

/* course picker rows */
.course-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px; border-radius: var(--r-l); border: 2px solid var(--line); background: var(--surface); color: var(--text); }
.course-row.is-on { border-color: var(--accent); }
.course-row .grow b { display: block; font-size: 1.04rem; }
.course-row .grow span { display: block; font-size: .84rem; color: var(--text-2); }
.unit-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.unit-list li { display: flex; gap: 12px; align-items: baseline; }
.unit-list li b { font-size: .95rem; }
.unit-list .n { font-family: var(--font-code); color: var(--accent-text); font-weight: 700; flex: none; }
.goal-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

/* certificate */
.cert { background: #fffdf6; color: #17333a; border-radius: 16px; padding: 28px 24px; text-align: center; border: 6px double #d9a441; display: grid; gap: 10px; justify-items: center; }
.cert h2 { font-size: 1.5rem; color: #17333a; }
.cert .name { font-size: 1.7rem; font-weight: 800; color: #b04a09; }
.cert .nova { width: 84px; height: 84px; }
.cert p { color: #3d5a5f; }
/* The share panel sits on the cream certificate: use light-theme colours there in every theme. */
.cert-share { --surface: #ffffff; --surface-2: #f4efe1; --text: #17333a; --text-2: #3d5a5f; --text-3: #5d7478; --line: #e5dcc4; --line-2: #d9cfb3; color: #17333a; }
.cert-share .input { background: #fff; color: #17333a; border-color: #d9cfb3; }
.cert-share .btn--ghost, .cert-share .btn--quiet { color: #17333a; border-color: #d9cfb3; background: #fff; }

/* confetti canvas */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* spark burst on correct answers */
.burst { position: absolute; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--flame); animation: burst .6s var(--ease) forwards; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

@media print {
  body { overflow: visible; background: #fff; }
  .shell, .player, #layer .sheet-head .icon-btn, .sheet-foot, .cert-share { display: none !important; }
  .backdrop { position: static; background: none; }
  .sheet { box-shadow: none; border: 0; max-height: none; }
}

/* ------------------------------------------------------------------ motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
}
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }

/* phones: keep the trail close to the top */
@media (max-width: 1179px) { .learn-grid .only-narrow { display: none; } }
@media (max-width: 520px) {
  .node .nova-here { width: 44px; height: 44px; top: -4px; left: calc(50% + 30px); }
  .node.is-left .nova-here { right: calc(50% + 30px); }
  .today { grid-template-columns: auto 1fr; gap: 12px; }
}

/* two-line wordmark: "Adaptive" over "Programming Lab" */
.brand svg { flex: none; }
.brand b { display: block; font-size: 1.02rem; line-height: 1.15; white-space: nowrap; }
.brand b span { display: block; }

/* Nova explains an error */
.nova-explain { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-m); background: var(--info-bg); border: 1px solid color-mix(in srgb, var(--sky) 35%, transparent); }
.nova-explain .nova-mini { width: 40px; height: 40px; flex: none; }
.nova-explain b { color: var(--info-text); }

/* ================================================================== "Source" layer
   Quiet chrome, precise type, colour only where it means something. Loaded last, so it wins. */

body { font-size: 1rem; line-height: 1.55; font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { font-family: var(--font-ui); letter-spacing: -.018em; }
h1 { font-size: 2rem; font-weight: 650; line-height: 1.12; letter-spacing: -.028em; }
h2 { font-size: 1.25rem; font-weight: 620; }
h3 { font-size: 1rem; font-weight: 620; }
::selection { background: color-mix(in srgb, var(--sky) 28%, transparent); color: inherit; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

.boot-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--text); animation: boot 1.2s ease-in-out infinite; }
@keyframes boot { 50% { opacity: .35; } }

/* buttons */
.btn {
  min-height: 44px; padding: 0 18px; border-radius: var(--r-m); font-weight: 600; letter-spacing: -.005em;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2); box-shadow: none;
  transition: background .15s, border-color .15s, opacity .15s, transform .08s;
}
.btn:hover { filter: none; background: var(--surface-2); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn--primary { background: var(--ember); color: var(--ember-ink); border-color: var(--ember); box-shadow: none; text-shadow: none; }
.btn--primary:hover { background: var(--ember); opacity: .88; }
.btn--primary:active { box-shadow: none; }
.btn--accent { background: var(--accent, var(--ember)); color: var(--accent-ink, var(--ember-ink)); border-color: transparent; }
.btn--accent:hover { background: var(--accent, var(--ember)); opacity: .9; }
.btn--ok { background: var(--aurora); color: #fff; border-color: var(--aurora); box-shadow: none; }
.btn--ok:hover { background: var(--aurora); opacity: .9; }
.btn--bad { background: var(--lingon); color: #fff; border-color: var(--lingon); box-shadow: none; }
.btn--ghost { background: transparent; }
.btn--lg { min-height: 50px; padding: 0 24px; font-size: 1.02rem; }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: .9rem; }

.pill { background: var(--surface); border: 1px solid var(--line); box-shadow: none; font-weight: 600; padding: 5px 11px; }
.pill--streak svg { color: var(--reward-text); }
.pill--xp svg { color: #8d6400; }
[data-theme="night"] .pill--xp svg { color: #f2c55a; }
.glyph { border-radius: 8px; font-weight: 700; }
.glyph--lg { border-radius: 12px; }
.card { border-radius: var(--r-l); box-shadow: none; }
.bar { height: 6px; background: var(--surface-2); }
.bar > i { background: var(--accent, var(--sky)); }
.tag { border-radius: 6px; font-weight: 600; }
.flames svg.is-on { color: var(--reward-text); }

/* rail */
.rail { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; gap: 2px; }
.brand { color: var(--text); padding: 4px 8px 22px; }
.brand svg { width: 34px; height: 34px; color: var(--text); }
.brand b { font-size: 1rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.brand b span { color: var(--text-2); font-weight: 500; }
.rail-link { border-radius: 8px; padding: 9px 12px; color: var(--text-2); font-weight: 500; }
.rail-link svg { width: 20px; height: 20px; }
.rail-link:hover { background: var(--surface-2); color: var(--text); }
.rail-link.is-on { background: var(--surface-2); color: var(--text); font-weight: 600; box-shadow: none; }
.rail-link .dot { background: var(--grape); color: #fff; }
.main { background: var(--bg); }

.course-btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-m); box-shadow: none; }

/* ------------------------------------------------------------------ Learn */
.learn-grid { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 28px; align-items: start; }
@media (max-width: 1080px) { .learn-grid { grid-template-columns: minmax(0, 1fr); } }
.learn-main { display: grid; gap: 18px; min-width: 0; }
.learn-main .topbar { margin-bottom: 0; }

.next {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center;
  padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
}
.next--done { grid-template-columns: 1fr; }
.next-text { min-width: 0; }
.next-where { color: var(--accent-text); font-weight: 600; font-size: .9rem; }
.next-title { font-size: clamp(1.75rem, 2.6vw, 2.35rem); font-weight: 650; letter-spacing: -.032em; line-height: 1.08; margin: 6px 0 14px; text-wrap: balance; }
.next-line { color: var(--text-2); }
.next-goals { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--text-2); font-size: .95rem; }
.next-goals li { position: relative; padding-left: 18px; }
.next-goals li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.next-goals .md, .next-goals p { margin: 0; }
.next-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.next-time { color: var(--text-3); font-size: .88rem; }
.goal { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.goal-text { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.goal-text b { font-weight: 650; }
.goal-text span { color: var(--text-2); font-size: .88rem; }
.goal-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.goal-bar i { display: block; height: 100%; border-radius: inherit; background: var(--reward); transition: width .6s var(--ease); }

.showcase { margin: 0; background: var(--code-bg); border: 1px solid #252e40; border-radius: var(--r-l); overflow: hidden; box-shadow: 0 24px 48px -24px rgba(16, 20, 30, .55); min-width: 0; }
.showcase-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--code-line); color: var(--code-dim); font-family: var(--font-code); font-size: .76rem; }
.showcase-dots { display: inline-flex; gap: 6px; }
.showcase-dots i { width: 9px; height: 9px; border-radius: 50%; background: #343d50; }
.showcase .code-wrap { border: 0; border-radius: 0; background: transparent; margin: 0; }
.showcase pre.code { font-size: 1rem; line-height: 1.65; padding: 18px 20px; background: transparent; margin: 0; min-height: 3.3em; }
.showcase pre.out { margin: 0; border-radius: 0; border-top: 1px solid var(--code-line); }
.showcase pre.out.is-arrived { animation: arrive .35s var(--ease); }
.showcase .table-wrap, .showcase table { margin: 0; }
.showcase .result-table, .showcase .table-wrap { background: var(--surface); }
@keyframes arrive { from { opacity: 0; transform: translateY(4px); } }
code.is-typing::after { content: ""; display: inline-block; width: .55em; height: 1.1em; margin-left: 1px; vertical-align: -.18em; background: var(--accent, #6b93f2); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
@media (max-width: 860px) {
  .next { grid-template-columns: minmax(0, 1fr); padding: 20px; gap: 20px; }
}

.notices { display: grid; gap: 10px; }
.notice { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.notice h3 { font-size: 1rem; }
.notice p { color: var(--text-2); font-size: .9rem; margin-top: 2px; }
.notice svg.art { width: 42px; height: 42px; flex: none; }
.notice-ic { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--reward) 14%, var(--surface)); color: var(--reward-text); }
.notice-ic svg { width: 22px; height: 22px; }
.notice.is-locked { opacity: .7; }
[data-theme="night"] { --memory-soft: #2b2650; }

.map-head { display: flex; align-items: baseline; gap: 12px; margin-top: 14px; }
.map-head h2 { font-size: 1.25rem; }
.map-head span { color: var(--text-3); font-size: .9rem; }
.map { display: grid; gap: 14px; }
.unit { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.unit-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 20px 12px; }
.unit-n { font-size: 2rem; font-weight: 650; letter-spacing: -.05em; line-height: 1; color: var(--accent); min-width: 2.2ch; }
.unit.is-later .unit-n { color: var(--line-2); }
.unit-text h2 { font-size: 1.1rem; }
.unit-text p { color: var(--text-2); font-size: .9rem; margin-top: 2px; }
.unit-side { display: grid; justify-items: end; gap: 6px; }
.unit-count { font-size: .84rem; color: var(--text-2); white-space: nowrap; }
.unit-bar { width: 88px; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.unit-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.unit-test { padding: 0 20px 10px 76px; }
.lrows { list-style: none; margin: 0; padding: 2px 0 10px; position: relative; }
.lrows::before { content: ""; position: absolute; left: 31px; top: 20px; bottom: 30px; width: 2px; background: var(--line); }
.lrow-btn {
  width: 100%; display: grid; grid-template-columns: 24px 40px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 20px; background: none; border: 0; text-align: left; color: var(--text); font: inherit; cursor: pointer;
}
.lrow-btn:hover { background: var(--surface-2); }
.lrow-dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); display: grid; place-items: center; }
.lrow-dot svg { width: 14px; height: 14px; }
.lrow--done .lrow-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lrow--open .lrow-dot { border-color: var(--accent); }
.lrow--open .lrow-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.lrow.is-here .lrow-dot { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 20%, transparent); }
.lrow--locked .lrow-dot { background: var(--surface-2); border-color: var(--line); }
.lrow.is-here { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.lrow-num { color: var(--text-3); font-size: .84rem; }
.lrow-title { font-weight: 520; min-width: 0; }
.lrow--locked .lrow-title { color: var(--text-3); }
.lrow-tag { margin-left: 8px; font-size: .72rem; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); vertical-align: 1px; }
.lrow-meta { display: flex; align-items: center; gap: 8px; }
.kept { display: inline-flex; gap: 3px; }
.kept i { width: 14px; height: 5px; border-radius: 3px; background: var(--surface-2); }
.kept i.is-on { background: var(--accent); }
.lrow-due { color: var(--grape); background: var(--memory-soft, #ebe6fb); font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.lrow-go { background: var(--ember); color: var(--ember-ink); font-size: .8rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.lrow-lock svg { width: 16px; height: 16px; color: var(--text-3); }
@media (max-width: 560px) {
  .unit-head { grid-template-columns: auto minmax(0, 1fr); padding: 16px 16px 10px; gap: 12px; }
  .unit-side { grid-column: 2; justify-items: start; grid-auto-flow: column; align-items: center; }
  .unit-n { font-size: 1.6rem; }
  .lrow-btn { grid-template-columns: 24px minmax(0, 1fr) auto; padding: 10px 16px; }
  .lrow-num { display: none; }
  .lrows::before { left: 27px; }
  .unit-test { padding: 0 16px 10px; }
}

.side { display: grid; gap: 12px; position: sticky; top: 24px; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; display: grid; gap: 10px; }
.side-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.side-row span { color: var(--text-2); font-size: .9rem; }
.side-row b { font-size: 1.05rem; font-weight: 650; }
.side-card p { color: var(--text-3); font-size: .84rem; }
.side-how ol { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--text-2); font-size: .88rem; }
.side-how b { color: var(--text); }

/* ------------------------------------------------------------------ lesson player */
.player { background: var(--surface); }
.player-top { padding: 14px 16px; }
.player-progress { height: 8px; background: var(--surface-2); box-shadow: none; }
.player-progress > i { background: var(--aurora); min-width: 8px; }
.player-progress > i::after { display: none; }
.player-combo { display: none; align-items: center; gap: 5px; color: var(--reward-text); font-weight: 700; font-size: .84rem; background: color-mix(in srgb, var(--reward) 12%, var(--surface)); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.player-combo.is-on { display: inline-flex; }
.player-combo svg { width: 15px; height: 15px; }
.player-combo.is-bump { animation: bump .35s var(--ease); }
@keyframes bump { 40% { transform: scale(1.18); } }
.player-stage .stage { padding-top: 8px; }
.stage h2 { font-size: 1.45rem; font-weight: 650; letter-spacing: -.025em; }
.player-bar { background: var(--surface); border-top: 1px solid var(--line); box-shadow: none; }
.feedback { border-radius: 12px; box-shadow: none; }
.chip { border-radius: 8px; background: var(--surface); box-shadow: none; border: 1px solid var(--line-2); }
.chip:hover { border-color: var(--text-3); }
.chip:active { transform: translateY(1px); }
.chip.is-used { box-shadow: none; }
.pline { border-radius: 8px; background: var(--surface); box-shadow: none; border: 1px solid var(--line-2); }
.worked-step .num { background: var(--text); color: var(--surface); }
.note-card svg.ic { color: var(--sky); }
.switch input:checked + i { background: var(--aurora); border-color: var(--aurora); }
.seg button.is-on { background: var(--ember); color: var(--ember-ink); }
.choice.is-on { border-color: var(--text); background: var(--surface-2); }
.welcome-dots i.is-on { background: var(--text); }
.how-row .ic { color: var(--sky); }

/* Me */
.stat-row .tile b { font-size: 1.9rem; font-weight: 650; letter-spacing: -.03em; }
.badge .medal { filter: grayscale(1); opacity: .35; }
.badge.is-earned .medal { filter: none; opacity: 1; }

/* ------------------------------------------------------------------ Quick fire */
.qf { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(14, 17, 24, .72); backdrop-filter: blur(4px); }
.qf:focus { outline: none; }
.qf-card { position: relative; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 20px; padding: 28px; box-shadow: var(--shade); animation: arrive .25s var(--ease); }
.qf-x { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); cursor: pointer; }
.qf-x:hover { background: var(--surface-2); }
.qf-x svg { width: 20px; height: 20px; }
.qf-badge { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--reward); color: #fff; }
.qf-badge svg { width: 28px; height: 28px; }
.qf-intro h2 { font-size: 1.9rem; font-weight: 650; letter-spacing: -.03em; margin: 16px 0 6px; }
.qf-intro > p { color: var(--text-2); max-width: 52ch; }
.qf-rules { list-style: none; padding: 0; margin: 18px 0 20px; border-top: 1px solid var(--line); }
.qf-rules li { padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text-2); }
.qf-rules b { color: var(--text); }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface-2); font: 600 .78rem var(--font-ui); color: var(--text); }
.qf-best { font-weight: 650; color: var(--reward-text); margin-bottom: 16px; }
.qf-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center; margin: -6px 0 18px; }
.qf-top .qf-x { position: static; }
.qf-timer { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.qf-timer i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--accent, var(--sky)); transition: width .1s linear; }
.qf.is-last .qf-timer i { background: var(--lingon); }
.qf-time { color: var(--text-2); font-weight: 600; min-width: 34px; text-align: right; }
.qf-score { font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; min-width: 56px; text-align: right; }
.qf-score.is-pop { animation: bump .3s var(--ease); }
.qf-prompt { font-weight: 550; margin-bottom: 10px; }
.qf-opts { display: grid; gap: 8px; margin-top: 14px; }
.qf-opt { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.qf-opt:hover:not(:disabled) { border-color: var(--text-2); }
.qf-opt:disabled { cursor: default; }
.qf-key { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: .8rem; font-weight: 650; }
.qf-out { font-family: var(--font-code); font-size: .92rem; white-space: pre-wrap; word-break: break-word; }
.qf-opt.is-right { border-color: var(--aurora); background: var(--ok-bg); }
.qf-opt.is-right .qf-key { background: var(--aurora); color: #fff; }
.qf-opt.is-wrong { border-color: var(--lingon); background: var(--bad-bg); animation: shake .3s; }
.qf-combo { display: block; margin-top: 14px; min-height: 24px; font-weight: 700; color: var(--text-2); text-align: center; }
.qf-combo.is-x2 { color: var(--reward-text); }
.qf-combo.is-x3 { color: var(--bad-text); }
.qf-end { text-align: center; }
.qf-label { color: var(--text-2); font-weight: 600; }
.qf-final { font-size: 4.6rem; font-weight: 700; letter-spacing: -.05em; line-height: 1; margin: 6px 0 4px; }
.qf-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0 14px; }
.qf-stats div { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.qf-stats dt { color: var(--text-3); font-size: .8rem; }
.qf-stats dd { margin: 2px 0 0; font-weight: 700; font-size: 1.15rem; }
.qf-note { color: var(--text-3); font-size: .88rem; }
.qf-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
@media (max-width: 560px) { .qf-card { padding: 20px 16px; } .qf-final { font-size: 3.6rem; } }
[data-motion="off"] .qf-card, [data-motion="off"] .player-combo.is-bump, [data-motion="off"] .qf-score.is-pop { animation: none; }
.next { align-items: stretch; }
.next-text { align-self: center; }
.showcase { display: flex; flex-direction: column; align-self: stretch; }
.showcase .code-wrap { flex: 1; display: flex; flex-direction: column; }
.showcase pre.code { flex: 1; font-size: 1.12rem; padding: 22px 24px; display: flex; align-items: center; }
.showcase pre.out { font-size: .95rem; padding: 14px 24px; }
@media (max-width: 860px) { .showcase pre.code { font-size: 1rem; padding: 18px 18px; min-height: 0; } }

/* research database panel */
.rdb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rdb-signin { display: grid; gap: 10px; max-width: 420px; }
.rdb-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 10px; }
@media (max-width: 640px) { .rdb-form { grid-template-columns: 1fr; } }
.rdb-create { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.rdb-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rdb-table td { vertical-align: middle; }
textarea.input { padding: 10px 14px; min-height: 0; line-height: 1.5; }

/* lesson recap and notes */
.recap { text-align: left; background: var(--surface-2); border-radius: var(--r-l); padding: 16px 18px; display: grid; gap: 8px; }
.recap h4, .notes-goals h4 { font-size: .95rem; }
.recap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.recap-list li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; color: var(--text-2); }
.recap-list li svg { width: 18px; height: 18px; color: var(--aurora); margin-top: 3px; }
.recap-list .md, .recap-list p { margin: 0; }
.notes { display: grid; gap: 18px; }
.notes-goals { background: var(--surface-2); border-radius: var(--r-l); padding: 14px 16px; display: grid; gap: 8px; }
.note-block .stage { animation: none; padding: 0; box-shadow: none; background: none; }
.note-block + .note-block { border-top: 1px solid var(--line); padding-top: 18px; }
.side-link { color: var(--accent-text); font-weight: 600; font-size: .9rem; text-decoration: none; }
.side-link:hover { text-decoration: underline; }

/* method page */
.method { max-width: 780px; }
.method-lead { color: var(--text-2); font-size: 1.05rem; max-width: 60ch; margin-top: 8px; }
.method-list { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 0; }
.method-item { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; padding: 22px 0; border-top: 1px solid var(--line); }
.method-n { font-size: 1.5rem; font-weight: 650; letter-spacing: -.04em; color: var(--text-3); line-height: 1.2; }
.method-body { display: grid; gap: 8px; max-width: 64ch; }
.method-body h2 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; }
.method-body h2 svg { width: 20px; height: 20px; color: var(--sky); flex: none; }
.method-body p { color: var(--text-2); }
.method-body .method-does { color: var(--text); font-weight: 520; }
.method-refs summary { cursor: pointer; color: var(--text-3); font-size: .86rem; font-weight: 600; }
.method-refs ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-3); font-size: .84rem; display: grid; gap: 4px; }
.method-research { margin-top: 12px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); display: grid; gap: 10px; max-width: 72ch; }
.method-research p { color: var(--text-2); }
@media (max-width: 560px) { .method-item { grid-template-columns: 1fr; gap: 6px; } }
.rdb-balance { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.rdb-bal { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-m); }
.rdb-bal b { text-transform: capitalize; }
.rdb-bal span { color: var(--text-2); font-size: .86rem; }
.rdb-status tr.is-flagged td { background: color-mix(in srgb, var(--warn-bg) 70%, transparent); }
.method .page-head { display: block; } .method .page-head h1 { font-size: 2.3rem; letter-spacing: -.035em; }
.summary .recap { justify-self: stretch; width: 100%; }

/* accessibility: headings keep their visual size where the level changed */
h1.step-title { font-size: 1.4rem; font-weight: 650; letter-spacing: -.02em; }
.notice h2.notice-title { font-size: 1rem; font-weight: 620; letter-spacing: -.01em; }
.h3 { font-size: 1rem; font-weight: 620; letter-spacing: -.01em; }
.h4 { font-size: .95rem; font-weight: 620; }

/* Nova, the chatbot tutor */
.tutor-fab { position: fixed; right: 20px; bottom: 20px; z-index: 25; width: 60px; height: 60px; padding: 0; border: 0; border-radius: 20px; background: var(--surface); box-shadow: 0 10px 28px rgba(16, 20, 30, .22); cursor: pointer; transition: transform .15s var(--ease); }
.tutor-fab:hover { transform: translateY(-2px); }
.tutor-fab svg { width: 100%; height: 100%; display: block; }
.tutor-fab.is-open { transform: scale(.92); }
body:has(.player) .tutor-fab, body:has(.player) .tutor-panel, body:has(.qf) .tutor-fab, body:has(.welcome) .tutor-fab, body:has(.qf) .tutor-panel { display: none; }
.tutor-panel { position: fixed; right: 20px; bottom: 92px; z-index: 26; width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shade); overflow: hidden; animation: arrive .2s var(--ease); }
.tutor-panel[hidden] { display: none; }
.tutor-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--line); }
.tutor-head .grow { display: grid; line-height: 1.25; }
.tutor-head span:not(.tutor-mark) { color: var(--text-2); font-size: .8rem; }
.tutor-mark svg { width: 34px; height: 34px; display: block; }
.tutor-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tutor-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: .93rem; line-height: 1.5; }
.tutor-msg p, .tutor-msg .md > * { margin: 0; }
.tutor-msg .md > * + * { margin-top: 6px; }
.tutor-msg pre { font-size: .82rem; background: var(--code-bg); color: var(--code-text); padding: 8px 10px; border-radius: 8px; overflow-x: auto; }
.tutor-msg--assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.tutor-msg--user { align-self: flex-end; background: var(--ember); color: var(--ember-ink); border-bottom-right-radius: 4px; }
.tutor-msg.is-error { background: var(--bad-bg); }
.tutor-dots { display: inline-flex; gap: 4px; }
.tutor-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: dot 1s infinite ease-in-out; }
.tutor-dots i:nth-child(2) { animation-delay: .15s; } .tutor-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-4px); opacity: .5; } }
.tutor-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.tutor-chip { border: 1px solid var(--line-2); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 11px; font: inherit; font-size: .82rem; cursor: pointer; }
.tutor-chip:hover { background: var(--surface-2); }
.tutor-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.tutor-input { flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 12px; font: inherit; font-size: .93rem; background: var(--surface); color: var(--text); max-height: 120px; }
.tutor-input:focus { outline: none; border-color: var(--sky); }
.tutor-send { min-width: 40px; padding: 0 10px; }
.tutor-note { margin: 0; padding: 0 14px 8px; color: var(--text-3); font-size: .78rem; }
.tutor-note:empty { display: none; }
.tutor-empty { padding: 20px 18px; display: grid; gap: 12px; align-content: start; }
@media (max-width: 720px) {
  .tutor-fab { bottom: calc(var(--bar-h) + 40px + env(safe-area-inset-bottom, 0px)); right: 14px; width: 54px; height: 54px; }
  .tutor-panel { right: 8px; left: 8px; width: auto; bottom: calc(var(--bar-h) + 102px); height: min(560px, calc(100vh - var(--bar-h) - 126px)); }
}
[data-motion="off"] .tutor-panel, [data-motion="off"] .tutor-dots i { animation: none; }
.account-mode { font-size: 1.1rem; }
.account-form .input { min-height: 46px; }
.welcome-account { margin-top: 14px; }

/* ================================================================== "Studio" layer (v2.0)
   Mimo-like: a deep ink-blue studio at night by default, one energetic mint action colour, vivid language colours,
   chunky tactile controls, a lesson path with glowing nodes, and quick feedback. Loaded last, so it wins. */

:root {
  --mint: #3ddc97; --mint-deep: #1fa66d; --mint-ink: #04140c;
  --violet: #8b7bff; --gold: #ffb547;
  --lang-python: #4f8cff; --lang-js: #f7d046; --lang-sql: #2ee6b6; --lang-web: #ff5c8a; --lang-java: #ff8a3d; --lang-c: #9b8cff; --lang-ai: #a3e635; --lang-ts: #4a8fe0; --lang-react: #61dafb; --lang-swift: #f05138; --lang-go: #00add8; --lang-rust: #dea584; --lang-kotlin: #c757bc; --lang-csharp: #b58cf0; --lang-fullstack: #7c83ff; --lang-git: #f1613c; --lang-dsa: #e879f9;
  --r-m: 12px; --r-l: 16px; --r-xl: 22px;
}

[data-theme="night"] {
  --bg: #0b0e1a; --bg-2: #0f1324; --surface: #151a30; --surface-2: #1c2240; --surface-3: #242b4f;
  --line: #262d52; --line-2: #343d6b;
  --text: #f3f5ff; --text-2: #aab2d6; --text-3: #949cc6;
  --ember: var(--mint); --ember-deep: var(--mint-deep); --ember-ink: var(--mint-ink);
  --accent-text: #8fb3ff;
  --ok-text: #4fe3a8; --bad-text: #ff8aa4; --info-text: #9bb8ff;
  --ok-bg: #0f3a2c; --bad-bg: #3d1a2a; --info-bg: #1a2550; --warn-bg: #3a2e14;
  --reward-text: var(--gold);
  --shade: 0 18px 44px rgba(0, 0, 0, .5);
  --glow: 0 0 0 6px color-mix(in srgb, var(--accent, var(--mint)) 22%, transparent), 0 10px 30px color-mix(in srgb, var(--accent, var(--mint)) 35%, transparent);
  --code-bg: #0e1222; --code-line: #232a4a; --code-out: #0a0d19;
  --logo-ink: #04140c;
}
[data-theme="day"] {
  --bg: #f4f6fb; --bg-2: #ffffff; --surface: #ffffff; --surface-2: #eef1f8; --surface-3: #e4e8f3;
  --line: #e1e5ef; --line-2: #cbd2e1;
  --ember: var(--mint); --ember-deep: var(--mint-deep); --ember-ink: var(--mint-ink);
  --glow: 0 0 0 6px color-mix(in srgb, var(--accent, var(--mint)) 20%, transparent), 0 10px 26px color-mix(in srgb, var(--accent, var(--mint)) 28%, transparent);
  --shade: 0 18px 40px rgba(20, 26, 50, .14);
}

/* language colours: vivid fills with dark ink in both themes; readable text colour per theme */
[data-accent] { --accent-ink: #0b0e1a; }
[data-accent="sky"] { --accent: var(--lang-python); --accent-text: #2563eb; }
[data-accent="flame"] { --accent: var(--lang-js); --accent-text: #8a5a00; }
[data-accent="aurora"] { --accent: var(--lang-sql); --accent-text: #0f6b46; }
[data-accent="lingon"] { --accent: var(--lang-web); --accent-text: #c2185b; }
[data-accent="orange"] { --accent: var(--lang-java); --accent-text: #c2410c; }
[data-accent="violet"] { --accent: var(--lang-c); --accent-text: #5b4ad6; }
[data-accent="cyan"] { --accent: var(--lang-ai); --accent-ink: #0b0e1a; --accent-text: #4d7c0f; }
[data-accent="ts"] { --accent: var(--lang-ts); --accent-ink: #0b0e1a; --accent-text: #1d5fa8; }
[data-accent="react"] { --accent: var(--lang-react); --accent-ink: #0b0e1a; --accent-text: #0b6e88; }
[data-accent="swift"] { --accent: var(--lang-swift); --accent-ink: #0b0e1a; --accent-text: #b9361f; }
[data-accent="fullstack"] { --accent: var(--lang-fullstack); --accent-ink: #0b0e1a; --accent-text: #4347c9; }
[data-accent="git"] { --accent: var(--lang-git); --accent-ink: #0b0e1a; --accent-text: #b53a1a; }
[data-accent="dsa"] { --accent: var(--lang-dsa); --accent-ink: #0b0e1a; --accent-text: #a21caf; }
[data-accent="go"] { --accent: var(--lang-go); --accent-ink: #0b0e1a; --accent-text: #00718f; }
[data-accent="rust"] { --accent: var(--lang-rust); --accent-ink: #0b0e1a; --accent-text: #8a5a2b; }
[data-accent="kotlin"] { --accent: var(--lang-kotlin); --accent-ink: #0b0e1a; --accent-text: #97328d; }
[data-accent="csharp"] { --accent: var(--lang-csharp); --accent-ink: #0b0e1a; --accent-text: #6b3fb5; }
[data-theme="night"] [data-accent="sky"] { --accent: var(--lang-python); --accent-ink: #0b0e1a; --accent-text: #8fb3ff; }
[data-theme="night"] [data-accent="flame"] { --accent: var(--lang-js); --accent-ink: #0b0e1a; --accent-text: #f7d046; }
[data-theme="night"] [data-accent="aurora"] { --accent: var(--lang-sql); --accent-ink: #0b0e1a; --accent-text: #2ee6b6; }
[data-theme="night"] [data-accent="lingon"] { --accent: var(--lang-web); --accent-ink: #0b0e1a; --accent-text: #ff8fb0; }
[data-theme="night"] [data-accent="orange"] { --accent: var(--lang-java); --accent-ink: #0b0e1a; --accent-text: #ffa86b; }
[data-theme="night"] [data-accent="violet"] { --accent: var(--lang-c); --accent-ink: #0b0e1a; --accent-text: #b9adff; }
[data-theme="night"] [data-accent="cyan"] { --accent: var(--lang-ai); --accent-ink: #0b0e1a; --accent-text: #bef264; }
[data-theme="night"] [data-accent="ts"] { --accent: var(--lang-ts); --accent-ink: #0b0e1a; --accent-text: #9cc4f5; }
[data-theme="night"] [data-accent="react"] { --accent: var(--lang-react); --accent-ink: #0b0e1a; --accent-text: #8fe6fc; }
[data-theme="night"] [data-accent="swift"] { --accent: var(--lang-swift); --accent-ink: #0b0e1a; --accent-text: #ff9b85; }
[data-theme="night"] [data-accent="fullstack"] { --accent: var(--lang-fullstack); --accent-ink: #0b0e1a; --accent-text: #b3b8ff; }
[data-theme="night"] [data-accent="git"] { --accent: var(--lang-git); --accent-ink: #0b0e1a; --accent-text: #ff9a80; }
[data-theme="night"] [data-accent="dsa"] { --accent: var(--lang-dsa); --accent-ink: #0b0e1a; --accent-text: #f5b5fc; }
[data-theme="night"] [data-accent="go"] { --accent: var(--lang-go); --accent-ink: #0b0e1a; --accent-text: #6fdcf5; }
[data-theme="night"] [data-accent="rust"] { --accent: var(--lang-rust); --accent-ink: #0b0e1a; --accent-text: #f0c9a8; }
[data-theme="night"] [data-accent="kotlin"] { --accent: var(--lang-kotlin); --accent-ink: #0b0e1a; --accent-text: #eaa0e2; }
[data-theme="night"] [data-accent="csharp"] { --accent: var(--lang-csharp); --accent-ink: #0b0e1a; --accent-text: #d4bbfa; }

body { background: var(--bg); }
.main { background: radial-gradient(1200px 500px at 70% -200px, color-mix(in srgb, var(--violet) 12%, transparent), transparent 70%), var(--bg); }

/* chunky, tactile controls */
.btn { border-radius: 14px; border: 0; background: var(--surface-2); color: var(--text); box-shadow: inset 0 -3px 0 var(--line-2); font-weight: 700; transition: transform .08s, box-shadow .08s, filter .15s; }
.btn:hover { background: var(--surface-2); filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 var(--line-2); }
.btn--primary { background: var(--ember); color: var(--ember-ink); box-shadow: inset 0 -4px 0 var(--ember-deep); }
.btn--primary:hover { background: var(--ember); opacity: 1; filter: brightness(1.05); }
.btn--primary:active { box-shadow: inset 0 -1px 0 var(--ember-deep); }
.btn--accent { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--accent) 65%, #000); }
.btn--ok { background: var(--mint); color: var(--mint-ink); box-shadow: inset 0 -4px 0 var(--mint-deep); }
.btn--ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line-2); }
.btn--ghost:active { box-shadow: inset 0 0 0 2px var(--line-2); }
.btn[disabled] { filter: grayscale(.4); }

.card, .side-card, .notice, .unit, .next { background: var(--surface); border-color: var(--line); }
.rail { background: var(--bg-2); border-right-color: var(--line); }
.rail-link.is-on { background: color-mix(in srgb, var(--mint) 14%, var(--surface)); color: var(--text); }
.rail-link.is-on svg { color: var(--mint); }
.brand svg { color: var(--mint); }
.pill { background: var(--surface); border-color: var(--line); }
.pill--streak svg { color: #ff8a3d; }
.pill--xp svg { color: var(--gold); }
[data-theme="day"] .pill--xp svg { color: #8a5a00; }
[data-theme="day"] .pill--streak svg { color: #c2410c; }
.glyph { background: var(--accent, var(--mint)); color: var(--accent-ink, var(--mint-ink)); border-radius: 10px; }
.bar { background: var(--surface-3, var(--surface-2)); height: 8px; }
.bar > i { background: var(--accent, var(--mint)); }

/* next lesson panel: the hero */
.next { border: 0; background: linear-gradient(160deg, color-mix(in srgb, var(--accent, var(--mint)) 14%, var(--surface)), var(--surface) 55%); box-shadow: 0 1px 0 var(--line) inset; }
.next-goals li::before { background: var(--accent); border-radius: 50%; }
.goal-bar { background: var(--surface-3, var(--surface-2)); height: 8px; }
.goal-bar i { background: linear-gradient(90deg, var(--gold), #ff8a3d); }
.showcase { border-color: var(--code-line); box-shadow: 0 30px 60px -28px rgba(0, 0, 0, .7); }

/* ---------------------------------------------------------------- the lesson path */
.unit { border: 0; background: transparent; overflow: visible; }
.unit-head { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--violet))); color: var(--accent-ink); border-radius: var(--r-xl); padding: 18px 20px; box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.unit-head h2, .unit-head .unit-n { color: var(--accent-ink); }
.unit-head .unit-text p, .unit-head .unit-count { color: color-mix(in srgb, var(--accent-ink) 78%, transparent); }
.unit.is-later .unit-head { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -4px 0 var(--line-2); }
.unit.is-later .unit-head h2, .unit.is-later .unit-head .unit-n { color: var(--text); }
.unit.is-later .unit-head .unit-text p, .unit.is-later .unit-head .unit-count { color: var(--text-2); }
.unit-bar { background: color-mix(in srgb, var(--accent-ink) 22%, transparent); }
.unit-bar i { background: var(--accent-ink); }
.unit.is-later .unit-bar { background: var(--surface-3); }
.unit.is-later .unit-bar i { background: var(--text-2); }
.unit-test { padding: 12px 4px 0; }

.path { list-style: none; margin: 0; padding: 26px 0 30px; display: grid; justify-items: center; gap: 22px; position: relative; }
.pnode { --x: 0px; transform: translateX(var(--x)); display: grid; justify-items: center; gap: 8px; position: relative; width: 190px; }
.pnode + .pnode::before { content: ""; position: absolute; top: -24px; left: 50%; width: 6px; height: 26px; margin-left: -3px; border-radius: 3px; background: var(--line-2); transform: translateX(calc(var(--dx, 0px) * -.5)) skewX(calc(var(--dx, 0px) * -.4deg)); }
.pnode.pnode--done + .pnode::before { background: color-mix(in srgb, var(--accent) 70%, transparent); }
.pnode-btn { width: 74px; height: 70px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; position: relative;
  background: var(--surface-2); color: var(--text-3); box-shadow: inset 0 -6px 0 var(--line-2); transition: transform .1s var(--ease); }
.pnode-btn svg { width: 30px; height: 30px; }
.pnode-btn:hover { transform: translateY(-2px); }
.pnode-btn:active { transform: translateY(3px); box-shadow: inset 0 -2px 0 var(--line-2); }
.pnode--done .pnode-btn { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 -6px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.pnode--open .pnode-btn { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 -6px 0 color-mix(in srgb, var(--accent) 60%, #000), var(--glow); }
.pnode.is-here .pnode-btn::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid var(--accent); opacity: 0; animation: ping 2.2s ease-out infinite; }
.pnode-start { position: absolute; top: -40px; left: 50%; transform: translateX(-50%); background: var(--surface); color: var(--text); border: 2px solid var(--accent); border-radius: 12px; padding: 4px 12px; font-weight: 800; font-size: .82rem; letter-spacing: .02em; white-space: nowrap; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); animation: bob 2.6s ease-in-out infinite; }
.pnode-start::after { content: ""; position: absolute; bottom: -7px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--accent); border-bottom: 0; }
.pnode-label { text-align: center; font-size: .86rem; font-weight: 650; line-height: 1.25; color: var(--text); max-width: 190px; }
.pnode--locked .pnode-label { color: var(--text-3); font-weight: 550; }
.pnode-meta { display: flex; justify-content: center; min-height: 6px; }
.pnode-due { color: var(--violet); background: color-mix(in srgb, var(--violet) 16%, var(--surface)); font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
[data-theme="day"] .pnode-due { color: #5b4ad6; }
.pnode .kept i { width: 12px; height: 5px; background: var(--surface-3, var(--surface-2)); }
.pnode .kept i.is-on { background: var(--gold); }
.pnode-build .pnode-btn { width: 88px; height: 82px; border-radius: 26px; }
@media (max-width: 560px) { .pnode { width: 150px; } .pnode-label { max-width: 150px; font-size: .8rem; } }
[data-motion="off"] .pnode.is-here .pnode-btn::after, [data-motion="off"] .pnode-start { animation: none; }

/* ---------------------------------------------------------------- lesson player */
.player { background: var(--bg); }
.player-progress { height: 14px; background: var(--surface-2); }
.player-progress > i { background: linear-gradient(90deg, var(--mint-deep), var(--mint)); min-width: 14px; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .25); }
.player-bar { background: var(--bg); border-top: 2px solid var(--line); transition: background .2s; }
.player-bar:has(.feedback.is-ok) { background: var(--ok-bg); border-top-color: transparent; }
.player-bar:has(.feedback.is-bad) { background: var(--bad-bg); border-top-color: transparent; }
.player-bar:has(.feedback.is-info) { background: var(--info-bg); border-top-color: transparent; }
.player-bar .feedback { background: transparent; box-shadow: none; padding: 4px 0 10px; margin-bottom: 4px; animation: slideup .25s var(--ease); }
@keyframes slideup { from { transform: translateY(16px); opacity: 0; } }
.feedback-title { font-size: 1.25rem; font-weight: 800; }
.chip, .pline { background: var(--surface); border: 2px solid var(--line-2); box-shadow: inset 0 -3px 0 var(--line-2); border-radius: 12px; }
.chip:active, .pline:active { transform: translateY(2px); box-shadow: none; }
.stage h2 { font-size: 1.5rem; font-weight: 800; }
.player-combo { color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--surface)); }
[data-theme="day"] .player-combo { color: #8a5a00; }

/* answer cards (multiple choice) get the same tactile look */
.stage button.pick, .stage .opt, .stage .option, .stage .choice-btn { border-width: 2px; box-shadow: inset 0 -3px 0 var(--line-2); border-radius: 14px; }

/* summary */
.summary .tiles .tile { border-radius: var(--r-l); border: 2px solid var(--line); }
.tile--xp b { color: var(--gold); }

/* chatbot in the studio palette */
.tutor-fab { background: var(--surface-2); box-shadow: 0 10px 28px rgba(0, 0, 0, .35), inset 0 -3px 0 var(--line-2); }
.tutor-msg--user { background: var(--mint); color: var(--mint-ink); }
.pnode-start { left: 50%; transform: none; translate: -50% 0; }
.pnode + .pnode::before { transform: translateX(calc(var(--dx, 0px) * -.5)); }
.pnode + .pnode::before { display: none; }
.path { gap: 26px; }
.pnode.is-here { margin-top: 30px; }

/* progress charts */
.chart-card { gap: 12px; }
.hm-wrap { overflow-x: auto; }
.hm-svg { width: 100%; max-width: 640px; height: auto; display: block; }
.hm, .hm-legend i { fill: var(--surface-3, var(--surface-2)); }
.hm-0 { fill: var(--surface-3, var(--surface-2)); }
.hm-1 { fill: color-mix(in srgb, var(--mint) 30%, var(--surface-2)); }
.hm-2 { fill: color-mix(in srgb, var(--mint) 55%, var(--surface-2)); }
.hm-3 { fill: color-mix(in srgb, var(--mint) 80%, var(--surface-2)); }
.hm-4 { fill: var(--mint); }
.hm-legend { display: flex; align-items: center; gap: 5px; color: var(--text-3); font-size: .78rem; }
.hm-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.hm-legend i.hm-0 { background: var(--surface-3, var(--surface-2)); } .hm-legend i.hm-1 { background: color-mix(in srgb, var(--mint) 30%, var(--surface-2)); }
.hm-legend i.hm-2 { background: color-mix(in srgb, var(--mint) 55%, var(--surface-2)); } .hm-legend i.hm-3 { background: color-mix(in srgb, var(--mint) 80%, var(--surface-2)); }
.hm-legend i.hm-4 { background: var(--mint); }
.keep-bar { display: flex; height: 22px; border-radius: 999px; overflow: hidden; gap: 3px; }
.keep-seg { display: block; min-width: 8px; }
.keep-seg.is-learned, .keep-legend i.is-learned { background: var(--line-2); }
.keep-seg.is-day, .keep-legend i.is-day { background: var(--violet); }
.keep-seg.is-week, .keep-legend i.is-week { background: var(--gold); }
.keep-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; color: var(--text-2); font-size: .88rem; }
.keep-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
.keep-legend b { color: var(--text); margin-right: 4px; }
.acc-svg { width: 100%; height: auto; display: block; }
.acc-grid { stroke: var(--line); stroke-width: 1; }
.acc-line { fill: none; stroke: var(--mint); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.acc-dot { fill: var(--surface); stroke: var(--mint); stroke-width: 2.5; }
.skillmap { display: grid; gap: 8px; }
.sm-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(60px, 1.3fr) auto; gap: 10px; align-items: center; font-size: .86rem; }
.sm-title { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-bar { position: relative; height: 10px; border-radius: 999px; background: var(--surface-3, var(--surface-2)); overflow: hidden; }
.sm-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; }
.sm-done { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.sm-kept { background: var(--accent); }
.sm-n { color: var(--text-3); font-size: .8rem; }
[data-theme="day"] .hm-4, [data-theme="day"] .hm-legend i.hm-4 { fill: var(--mint-deep); background: var(--mint-deep); }
[data-theme="day"] .acc-line { stroke: var(--mint-deep); }
[data-theme="day"] .acc-dot { stroke: var(--mint-deep); }
.hm-svg { max-width: 470px; }
/* hover keeps each button's own colour (a plain .btn:hover must not repaint coloured buttons) */
.btn--primary:hover { background: var(--ember); }
.btn--ok:hover { background: var(--mint); opacity: 1; }
.btn--bad:hover { background: var(--lingon); }
.btn--accent:hover { background: var(--accent, var(--ember)); }
.btn--ghost:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }

/* sign in with Google, Apple or Facebook */
.social-signin:empty { display: none; }
.btn-social { width: 100%; justify-content: center; gap: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: inset 0 -3px 0 var(--line); }
.btn-social:hover { background: var(--surface-2, var(--surface)); }
.btn-social--apple { background: #000; color: #fff; border-color: #000; box-shadow: inset 0 -3px 0 #333; }
.btn-social--apple:hover { background: #1a1a1a; }
.social-mark { display: inline-flex; width: 18px; height: 18px; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: .8rem; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* course switcher: two columns when there is room (14 courses) */
.course-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .course-grid { grid-template-columns: 1fr 1fr; } .sheet:has(.course-grid) { max-width: 760px; } }

/* ---------------------------------------------------------------- Pro, paywall, tour, help and legal pages */
.pro-badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 800;
  letter-spacing: .06em; color: #1b1300; background: linear-gradient(135deg, var(--gold), #ffd98a); vertical-align: middle;
}
.pro-badge--sm { font-size: .62rem; padding: 1px 6px; margin-left: 8px; }
.pro-hero { display: grid; gap: 10px; justify-items: start; }
.pro-hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.12; letter-spacing: -.02em; }
.plan-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .plan-grid { grid-template-columns: 1fr 1fr; } }
.plan-card { position: relative; display: grid; gap: 8px; padding: 22px 20px 18px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); }
.plan-card.is-best { border: 2px solid var(--gold); box-shadow: 0 10px 30px color-mix(in srgb, var(--gold) 18%, transparent); }
.plan-card h3 { font-size: 1.05rem; }
.plan-flag { position: absolute; top: -12px; left: 18px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; color: #1b1300; background: var(--gold); }
.plan-price b { font-size: 2.2rem; letter-spacing: -.02em; }
.plan-price span { color: var(--text-2); }
.compare { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .compare { grid-template-columns: 1fr 1fr; } }
.compare .is-pro { border-color: var(--gold); }
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.feature-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .93rem; }
.feature-list li svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--text-3); }
.feature-list li.is-on svg { color: var(--mint); }
.faq { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style-position: outside; }
.faq > div, .faq > p { margin-top: 8px; color: var(--text-2); }
.callout--pro { background: color-mix(in srgb, var(--gold) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.plan-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-mini-btn {
  display: grid; gap: 2px; padding: 14px 12px; border-radius: var(--r-l); text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font: inherit;
}
.plan-mini-btn b { font-size: 1.3rem; }
.plan-mini-btn small { color: #1b1300; background: var(--gold); border-radius: 999px; padding: 1px 8px; justify-self: start; font-weight: 700; }
.plan-mini-btn.is-best { border: 2px solid var(--gold); }
.plan-mini-btn:hover, .plan-mini-btn:focus-visible { background: var(--surface-3); }
.rail-pro {
  display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 10px 12px; border-radius: var(--r-m);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem;
  background: color-mix(in srgb, var(--gold) 12%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
}
.rail-pro:hover, .rail-pro.is-on { background: color-mix(in srgb, var(--gold) 22%, transparent); }
.rail-pro + .rail-link--small { margin-top: 4px; }
.rail-link--small { font-size: .85rem; opacity: .85; }
.rail-pro ~ .rail-foot, .rail-link--small ~ .rail-foot { margin-top: 6px; }
@media (max-width: 899px) { .rail-pro, .rail-link--small { display: none; } }
.main--standalone { min-height: 100vh; }
#app.standalone { display: block; }
.legal { max-width: 760px; }
.legal h2 { font-size: 1.1rem; margin-top: 6px; }
.legal-sec { display: grid; gap: 8px; }
.legal-sec p, .legal > p { color: var(--text-2); line-height: 1.65; }
.legal-links { padding-top: 12px; border-top: 1px solid var(--line); }

/* guided tour */
.tour-layer { position: fixed; inset: 0; z-index: 1000; }
.tour-hole {
  position: fixed; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(4, 6, 14, .72), 0 0 0 3px var(--mint);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
}
.tour-bubble {
  position: fixed; display: grid; gap: 8px; padding: 16px 16px 12px; border-radius: var(--r-l);
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2); box-shadow: var(--shade);
}
.tour-title { font-size: 1.05rem; }
.tour-text { color: var(--text-2); font-size: .93rem; line-height: 1.5; }
.tour-foot { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.tour-count { font-size: .8rem; color: var(--text-3); }
[data-motion="off"] .tour-hole { transition: none; }
@media (prefers-reduced-motion: reduce) { .tour-hole { transition: none; } }
.pill--pro { text-decoration: none; font-weight: 800; letter-spacing: .06em; color: #1b1300; background: linear-gradient(135deg, var(--gold), #ffd98a); border: 0; }
.today h3 { margin-bottom: 8px; }
.today-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.today-item {
  width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px; border-radius: var(--r-m);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font: inherit; cursor: pointer;
}
.today-item:hover, .today-item:focus-visible { background: var(--surface-3); }
.today-item svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--mint); }
.today-item span { display: grid; gap: 2px; }
.today-item small { color: var(--text-3); font-size: .78rem; }

/* cheat sheet and glossary */
.map-head .map-sheet { margin-left: auto; }
.sheet-search { max-width: 360px; }
.sheet-entry { padding: 12px 14px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); }
details.sheet-entry > summary { list-style: none; cursor: pointer; }
details.sheet-entry > summary::-webkit-details-marker { display: none; }
.cs-head { display: grid; gap: 2px; }
details.sheet-entry[open] > summary { margin-bottom: 8px; }
.sheet-entry.is-todo, .sheet-entry.is-locked { opacity: .75; }
.sheet-entry.is-locked p svg { width: 14px; height: 14px; vertical-align: -2px; }
.sheet-example { margin-top: 10px; display: grid; gap: 6px; }
.sheet-example h4 { font-size: .9rem; color: var(--text-2); }
.glossary { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 10px 18px; margin: 0; }
.glossary dt { font-weight: 700; color: var(--accent-text, var(--text)); }
.glossary dd { margin: 0; color: var(--text-2); display: grid; gap: 2px; }
@media (max-width: 640px) { .glossary { grid-template-columns: 1fr; } .glossary dd { margin-bottom: 8px; } .sheet-search { max-width: none; width: 100%; } }

/* classroom */
.class-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.class-card { display: grid; gap: 6px; text-align: left; padding: 16px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); color: var(--text); font: inherit; cursor: pointer; }
.class-card:hover, .class-card:focus-visible { border-color: var(--mint); }
.class-code { font-family: var(--font-code, monospace); font-weight: 700; letter-spacing: .12em; padding: 2px 8px; border-radius: 8px; background: var(--surface-2); justify-self: start; }
.class-code--lg { font-size: 1.4rem; padding: 6px 14px; }
.class-code-input { width: 9ch; font-family: var(--font-code, monospace); letter-spacing: .12em; text-transform: uppercase; }
.class-joined { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.class-joined li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); }
.class-agree { align-items: flex-start; gap: 10px; }
.table-wrap { overflow-x: auto; border-radius: var(--r-l); border: 1px solid var(--line); }
.class-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.class-table th, .class-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.class-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); background: var(--surface-2); white-space: nowrap; }
.class-table tr:last-child td { border-bottom: 0; }
.pill-warn { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--warn-bg); font-weight: 700; }

/* your week (Me page) */
.week-card .wk-row { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.week-card .wk-row:last-of-type { border-bottom: 0; }
.wk-delta { font-size: .78rem; color: var(--text-3); min-width: 9ch; text-align: right; }
.wk-delta.is-up { color: var(--ok-text); }
.wk-delta.is-down { color: var(--text-3); }
.wk-goal { display: grid; gap: 8px; }
.wk-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wk-dots i { height: 10px; border-radius: 999px; background: var(--surface-3); }
.wk-dots i.is-on { background: var(--mint); }
.wk-dots i.is-freeze { background: #7cc4ff; }

/* daily challenge and mistake notebook rows */
.notice--daily .notice-ic { background: color-mix(in srgb, var(--sky) 16%, var(--surface)); color: var(--sky); }
.notice--daily.is-done .notice-ic { background: var(--ok-bg); color: var(--ok-text); }
.notice--notebook .notice-ic { background: color-mix(in srgb, var(--grape) 16%, var(--surface)); color: var(--grape); }

/* weekly leagues */
.league-hero { display: flex; align-items: center; gap: 18px; border-color: color-mix(in srgb, var(--lg) 45%, var(--line));
  background: linear-gradient(120deg, color-mix(in srgb, var(--lg) 12%, var(--surface)), var(--surface)); }
.league-hero h2 { font-size: 1.4rem; }
.league-me { display: grid; justify-items: end; }
.league-me b { font-size: 2rem; line-height: 1; letter-spacing: -.04em; }
.league-last { display: grid; gap: 2px; }
.league-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.league-row { display: grid; grid-template-columns: 2.2em 32px minmax(0, 1fr) 22px auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.league-row.is-me { background: color-mix(in srgb, var(--mint) 14%, var(--surface)); outline: 1px solid color-mix(in srgb, var(--mint) 45%, transparent); }
.league-rank { font-weight: 650; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.league-row.is-up .league-rank { color: var(--ok-text); }
.league-row.is-down .league-rank { color: var(--bad-text); }
.league-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .9rem; }
.league-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.league-daily svg { width: 18px; height: 18px; color: var(--flame); }
.league-xp { font-weight: 600; font-variant-numeric: tabular-nums; }
.league-line { display: flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 6px 10px; }
.league-line::after { content: ''; flex: 1; border-top: 1px dashed currentColor; opacity: .5; }
.league-line.is-up { color: var(--ok-text); }
.league-line.is-down { color: var(--bad-text); }
@media (max-width: 560px) {
  .league-hero { flex-wrap: wrap; }
  .league-row { grid-template-columns: 1.8em 28px minmax(0, 1fr) 18px auto; gap: 8px; padding: 8px 6px; }
  .league-dot { width: 28px; height: 28px; }
}

/* shareable certificates */
.cert-share { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); text-align: left; }
.cert-share .row { flex-wrap: wrap; gap: 8px; }
.verify-page .cert--verified { text-align: center; max-width: 560px; }
.verify-page .verified { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--ok-bg); color: var(--ok-text); font-weight: 600; font-size: .85rem; margin: 0 auto 6px; }
.verify-page .verified svg { width: 16px; height: 16px; }

/* welcome: the Back / Continue row stays in view on long steps (course list) */
.welcome-foot { position: sticky; bottom: 0; z-index: 1; padding: 12px 0 calc(4px + env(safe-area-inset-bottom, 0px)); margin-bottom: -16px;
  background: linear-gradient(to bottom, transparent, var(--bg) 30%); }

/* thin, themed scrollbars inside code boxes */
.editor-scroll, .code, pre.output, .tutor-log { scrollbar-width: thin; scrollbar-color: var(--code-line) transparent; }

/* Day theme: the mint action colour is only 1.8:1 on white, so mint text and icons on light surfaces use darker greens. */
[data-theme="day"] .hero-title em { color: #0b7a55; }
[data-theme="day"] .note-card svg.ic, [data-theme="day"] .today-item svg, [data-theme="day"] .feature-list li.is-on svg, [data-theme="day"] .how-row .ic { color: #0b7d68; }

/* ---- league emblems (js/lib/league-art.js) ---- */
.league-emblem-box { flex: none; display: grid; place-items: center; }
.league-emblem { display: block; overflow: visible; }
.league-ladder { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.league-step { display: grid; justify-items: center; gap: 4px; min-width: 60px; padding: 8px 6px; border-radius: var(--r-m); border: 1px solid transparent; color: var(--text-2); }
.league-step.is-current { border-color: color-mix(in srgb, var(--lg) 60%, var(--line)); background: color-mix(in srgb, var(--lg) 12%, var(--surface)); color: var(--text); font-weight: 700; }
.league-step.is-locked { color: var(--text-3); }
.league-last { display: flex; align-items: center; gap: 14px; }
.league-last-emblem { flex: none; display: grid; place-items: center; width: 56px; height: 56px; }
.league-last.is-up { border-color: color-mix(in srgb, var(--lg) 55%, var(--line)); background: linear-gradient(120deg, color-mix(in srgb, var(--lg) 16%, var(--surface)), var(--surface)); }
.league-last.is-up .league-emblem { animation: lg-pop .8s cubic-bezier(.2, 1.4, .4, 1) both; }
.league-last.is-up .league-last-emblem::after { content: ''; position: absolute; width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--lg); opacity: 0; animation: lg-ring 1.1s .25s ease-out both; pointer-events: none; }
.league-last-emblem { position: relative; }
@keyframes lg-pop { from { transform: scale(.4) rotate(-8deg); opacity: 0; } 60% { transform: scale(1.12) rotate(2deg); opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes lg-ring { from { transform: scale(.6); opacity: .8; } to { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .league-last.is-up .league-emblem, .league-last.is-up .league-last-emblem::after { animation: none; } }
[data-motion="off"] .league-last.is-up .league-emblem, [data-motion="off"] .league-last.is-up .league-last-emblem::after { animation: none; }

/* ===== learning coach, weekly goals and memory forecast ===== */
.notice--coach { align-items: flex-start; }
.notice--coach .notice-ic { background: color-mix(in srgb, var(--aurora) 16%, var(--surface)); color: var(--ok-text); }
.notice--coach.tone-nudge .notice-ic { background: color-mix(in srgb, var(--flame) 18%, var(--surface)); color: var(--text); }
.notice--coach.tone-cheer .notice-ic { background: var(--ok-bg); color: var(--ok-text); }
.notice--coach .coach-x { flex: none; padding: 6px; min-width: 36px; min-height: 36px; }
.notice--coach .coach-x svg { width: 16px; height: 16px; }
.goal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.goal { display: flex; align-items: center; gap: 12px; }
.goal .grow { display: grid; gap: 4px; }
.goal-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.goal-ic svg { width: 18px; height: 18px; }
.goal.is-done .goal-ic { background: var(--ok-bg); color: var(--ok-text); }
.goal-count { font-variant-numeric: tabular-nums; font-size: .85rem; font-weight: 600; color: var(--text-2); min-width: 3.2em; text-align: right; }
.goal.is-done .goal-count { color: var(--ok-text); }
.memory-head { gap: 28px; }
.memory-num { display: grid; }
.memory-num b { font-size: 2rem; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.memory-num span { color: var(--text-2); font-size: .85rem; }
.fc-wrap { max-width: 460px; }
.fc-chart .fc-line { fill: none; stroke: var(--aurora); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.fc-chart .fc-area { fill: color-mix(in srgb, var(--aurora) 14%, transparent); stroke: none; }
.fc-chart .fc-dot { fill: var(--aurora); stroke: var(--surface); stroke-width: 2; }
.fc-chart .fc-dot.is-soon { fill: var(--flame); }
.fade-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fade-list li { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: .92rem; }
.fade-list b { font-variant-numeric: tabular-nums; }
.coach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.coach-list li { display: grid; gap: 4px; justify-items: start; }
.coach-list p { color: var(--text-2); }
.coach-note { display: grid; gap: 8px; }
.coach-note:empty { display: none; }
.big { font-size: 1.6rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.goal-list > li { border: 0; padding: 0; margin: 0; }
.goals .goal-list { gap: 14px; }
.fc-wrap { width: 100%; max-width: 520px; }
.notice--coach { flex-wrap: wrap; }
.notice--coach .grow { flex: 1 1 200px; min-width: 0; }
@media (max-width: 520px) {
  .fade-list li { flex-wrap: wrap; row-gap: 2px; }
  .fade-list li .grow { flex: 1 1 100%; font-weight: 560; }
}

/* ===== learning paths and the course picker tabs ===== */
.picker-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); width: fit-content; }
.picker-tab { padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--text-2); background: transparent; min-height: 40px; }
.picker-tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .18); }
.paths { display: grid; gap: 12px; }
.path-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
.path-card h3 { font-size: 1.05rem; }
.path-card.is-done { border-color: var(--ok-text); }
.path-ic { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text); }
.path-ic svg { width: 22px; height: 22px; }
.path-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.path-step { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); text-align: left; min-height: 44px; }
.path-steps li.is-current .path-step { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.path-steps li.is-done .path-step { border-color: var(--ok-text); }
.path-step .glyph { min-width: 30px; height: 30px; font-size: .78rem; }
.path-step-name { display: grid; line-height: 1.2; }
.path-step-name b { font-size: .9rem; }
.path-arrow { display: inline-grid; color: var(--text-3); }
.path-arrow svg { width: 14px; height: 14px; }

/* ===== launch QA fixes ===== */
@media (max-width: 899px) {
  /* The later desktop padding made the six tabs wider than a phone. Keep them equal and narrow. */
  .rail-link { padding: 6px 2px; min-width: 0; border-radius: 10px; }
  .rail-link svg { width: 22px; height: 22px; }
}
@media (max-width: 899px) {
  .page { padding-bottom: 96px; } /* leave room so the Nova button never hides the last card */
}
.seg button, .btn--sm { min-height: 44px; }
.switch input { inset: -7px -4px; width: calc(100% + 8px); height: calc(100% + 14px); }
.legal-links a, .page .small.muted a[href^="#/"] { display: inline-block; padding: 12px 6px; }

/* ===== account forms: password field, forgot link, errors, email tips ===== */
.pw-field { display: flex; align-items: center; gap: 8px; }
.pw-field .input { flex: 1; min-width: 0; }
.pw-toggle { flex: none; min-width: 64px; min-height: 44px; }
.forgot-link { justify-self: start; padding-inline: 4px; }
.form-error { color: var(--bad-text); font-weight: 560; }
.tips { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }
.account-form .btn { min-height: 44px; }
.choice .glyph { flex: none; width: 54px; min-width: 54px; font-size: .8rem; white-space: nowrap; overflow: hidden; } /* same column for every course name */
.set-row--col > .grow { flex: 0 0 auto; } /* in a column the 220px basis became a tall empty gap */

/* Right and wrong are never shown by colour alone: gaps, ordered lines and spotted lines also get a mark. */
.slot.is-right::after, .pline.is-right > code::after, .spot-line.is-right > span:last-child::after { content: "\2713"; content: "\2713" / ""; margin-left: .6em; font-weight: 700; color: var(--ok-text); }
.slot.is-wrong::after, .pline.is-wrong > code::after, .spot-line.is-wrong > span:last-child::after { content: "\2715"; content: "\2715" / ""; margin-left: .6em; font-weight: 700; color: var(--bad-text); }

/* The on-screen keyboard is open: give the question as much room as possible. */
.player.kb-open .help-note, .player.kb-open .player-combo { display: none; }
.player.kb-open .player-top { padding-top: 4px; padding-bottom: 4px; }
.player.kb-open .player-bar { padding-top: 8px; padding-bottom: 8px; }

/* A long message under the question scrolls inside its own box, so the question and the buttons stay in view. */
.player-bar .feedback { max-height: 40vh; overflow-y: auto; overscroll-behavior: contain; }
