/* ============================================================
   Skillzify v2 — shared stylesheet
   Dark mode default · CSS variables · fully responsive
   Redesign v2 (16 Nov 2026): a compact, engineered system —
   deeper navy base, the indigo→purple→cyan brand gradient
   rationed to the logo, primary CTAs, progress and the heatmap;
   flat 1px borders, sharp 10px/8px/6px radii, tight spacing,
   small type, dense grids. Same hooks, same behaviour —
   a new face on every page.
   ============================================================ */

:root {
  /* Dark theme (default) */
  --bg: #070b1a;
  --bg-soft: #0b1126;
  --card: #121a3a;
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #eef1ff;
  --muted: #98a1c4;
  --primary: #6c7bff;
  --primary-2: #9d6bff;
  --accent: #22d3ee;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --gradient: linear-gradient(135deg, #6c7bff 0%, #9d6bff 55%, #22d3ee 130%);
  /* Flat, tight shadow: a hairline inset + one short drop, no glow. */
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 28px -16px rgba(2, 4, 12, 0.7);
  --radius: 10px;
  --nav-h: 52px;
  --code-bg: #0b1128;
  /* Aliases for page code */
  --surface: var(--card);
  --surface-2: var(--bg-soft);
  --line: var(--card-border);
  --line-2: rgba(255, 255, 255, 0.17);
  --r-lg: 12px;
  --r-md: 8px;
  --r-sm: 6px;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;
  /* Heatmap intensity ramp (gradient family, teal-cyan end) */
  --heat-0: var(--bg-soft);
  --heat-1: rgba(108, 123, 255, 0.35);
  --heat-2: rgba(108, 123, 255, 0.6);
  --heat-3: rgba(157, 107, 255, 0.8);
  --heat-4: #22d3ee;
}

[data-theme="light"] {
  --bg: #f3f5fe;
  --bg-soft: #e9edfa;
  --card: #ffffff;
  --card-border: rgba(18, 24, 51, 0.1);
  --text: #131a33;
  --muted: #59638a;
  /* Light-theme text colours, darkened to WCAG AA 4.5:1 (Wave 2, Nov 2026).
     Before -> after on --bg #f3f5fe / white card / --bg-soft #e9edfa:
     --primary #6c7bff 3.26/3.55 -> #545cd0 5.05/5.50/4.70;
     --accent #22d3ee 1.66/1.81 -> #056a82 5.69/6.19/5.30;
     --success #34d399 1.92 -> #0f7a44 4.97/5.40/4.62;
     --warning #fbbf24 1.67 -> #8a5c00 5.34/5.81/4.97;
     --danger #f87171 2.77 -> #c92a2a 5.02/5.46/4.67.
     Dark theme already passes for all five; --muted (5.40 light / 7.68
     dark) needed no change. The console keeps bright text via the
     [data-theme="light"] .console exception below: it sits on dark
     --code-bg in both themes, where these darkened values would fail. */
  --primary: #545cd0;
  --accent: #056a82;
  --success: #0f7a44;
  --warning: #8a5c00;
  --danger: #c92a2a;
  --shadow: 0 1px 2px rgba(10, 15, 34, 0.05), 0 10px 24px -14px rgba(10, 15, 34, 0.13);
  --code-bg: #101737;
  --line-2: rgba(18, 24, 51, 0.2);
  --heat-0: #e4e8f7;
  --heat-1: rgba(108, 123, 255, 0.3);
  --heat-2: rgba(108, 123, 255, 0.55);
  --heat-3: rgba(157, 107, 255, 0.75);
  --heat-4: #0899b8;
}

/* ---------- Accent color themes (work in dark + light) ---------- */
[data-accent="ocean"] {
  --primary: #22d3ee; --primary-2: #38bdf8;
  --accent: #6c7bff;
  --gradient: linear-gradient(135deg, #22d3ee 0%, #38bdf8 55%, #6c7bff 130%);
}
[data-accent="sunset"] {
  --primary: #fb923c; --primary-2: #f472b6;
  --accent: #fbbf24;
  --gradient: linear-gradient(135deg, #fb923c 0%, #f472b6 55%, #fbbf24 130%);
}
[data-accent="forest"] {
  --primary: #34d399; --primary-2: #22d3ee;
  --accent: #a3e635;
  --gradient: linear-gradient(135deg, #34d399 0%, #22d3ee 55%, #a3e635 130%);
}
[data-accent="amethyst"] {
  --primary: #9d6bff; --primary-2: #e879f9;
  --accent: #6c7bff;
  --gradient: linear-gradient(135deg, #9d6bff 0%, #e879f9 55%, #6c7bff 130%);
}
[data-accent="rose"] {
  --primary: #fb7185; --primary-2: #f472b6;
  --accent: #fda4af;
  --gradient: linear-gradient(135deg, #fb7185 0%, #f472b6 55%, #fda4af 130%);
}
/* default "indigo" uses the :root values — no override needed */

/* Light theme + accent: the accent blocks above override --primary and
   --accent after the light block, so each accent needs its own darkened
   pair for AA text on light surfaces (all >= 4.5:1 on --bg, white card
   and --bg-soft; white button text on each is also >= 4.5:1).
   --success/--warning/--danger are not overridden by accents, so the
   light-block values above already cover them under every accent. */
[data-theme="light"][data-accent="ocean"] { --primary: #056a82; --accent: #545cd0; }
[data-theme="light"][data-accent="sunset"] { --primary: #92400e; --accent: #8a5c00; }
[data-theme="light"][data-accent="forest"] { --primary: #0e7a4a; --accent: #456e0e; }
[data-theme="light"][data-accent="amethyst"] { --primary: #6d28d9; --accent: #545cd0; }
[data-theme="light"][data-accent="rose"] { --primary: #be123c; --accent: #9f1239; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  /* Faint brand mesh at the top corners, derived from the active
     accent so themes stay coherent. */
  background-image:
    radial-gradient(820px 400px at 85% -60px, color-mix(in srgb, var(--primary-2) 13%, transparent), transparent 62%),
    radial-gradient(680px 360px at -80px 120px, color-mix(in srgb, var(--primary) 13%, transparent), transparent 60%);
  background-repeat: no-repeat;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease, color 0.3s ease;
}

main { flex: 1; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

::selection { background: color-mix(in srgb, var(--primary) 45%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Slim branded scrollbars */
html { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::-webkit-scrollbar-track { background: transparent; }

/* Inline SVG line icons (site icon set: 24px grid, 1.8 stroke) */
svg.ic { display: inline-block; vertical-align: -3px; flex: none; }

/* ---------- Layout ---------- */
.container { width: min(1180px, 94%); margin: 0 auto; }
.section { padding: 44px 0; }
.section-title { font-size: clamp(1.3rem, 2.6vw, 1.75rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.section-sub { color: var(--muted); max-width: 620px; margin-top: 8px; font-size: 0.94rem; line-height: 1.55; }
.center { text-align: center; }
.center .section-sub { margin-left: auto; margin-right: auto; }
/* Eyebrow: the small mono label that sits above section titles */
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  background: color-mix(in srgb, var(--primary) 9%, transparent);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
}

/* ---------- Nav ---------- */
#site-nav {
  position: sticky; top: 0; z-index: 100;
}
.nav {
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}
.nav-inner {
  width: min(1560px, 97%); margin: 0 auto; height: var(--nav-h);
  display: flex; align-items: center; gap: clamp(8px, 1.2vw, 16px); min-width: 0;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.08rem; letter-spacing: -0.01em; color: var(--text); white-space: nowrap; flex: none; }
.brand:hover { text-decoration: none; }
.brand img { height: clamp(26px, 2.6vw, 31px); width: auto; display: block; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; min-width: 0; }
.nav-links a {
  color: var(--muted); font-weight: 600; font-size: 0.86rem; white-space: nowrap;
  padding: 6px 10px; border-radius: 6px; transition: 0.15s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav-links a.active { color: var(--text); background: color-mix(in srgb, var(--primary) 17%, transparent); }

/* ---------- Navbar dropdowns (single-source nav.js) ---------- */
.nav-drop { position: relative; }
.nav-drop-btn {
  color: var(--muted); font-weight: 600; font-size: 0.86rem; font-family: inherit; white-space: nowrap;
  padding: 6px 10px; border-radius: 6px; border: 0; background: transparent;
  cursor: pointer; transition: 0.15s; display: inline-flex; align-items: center; gap: 5px;
}
.nav-drop-btn:hover, .nav-drop.open .nav-drop-btn { color: var(--text); background: var(--bg-soft); }
.nav-drop-btn.active-parent { color: var(--text); background: color-mix(in srgb, var(--primary) 17%, transparent); }
.nav-drop-btn .caret { font-size: 0.66rem; transition: transform 0.2s; }
.nav-drop.open .nav-drop-btn .caret { transform: rotate(180deg); }
.nav-menu {
  position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%) translateY(-4px);
  min-width: 172px; background: var(--bg-soft); border: 1px solid var(--card-border);
  border-radius: 8px; box-shadow: var(--shadow); padding: 4px;
  opacity: 0; visibility: hidden; transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 200;
}
.nav-drop:hover .nav-menu, .nav-drop.open .nav-menu {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
.nav-menu a {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: 5px; white-space: nowrap; font-size: 0.83rem;
}
.nav-menu a .mi { font-size: 0.9rem; }

/* ---------- Card dropdowns (profile Achievements + passport Proof of work) ----------
   Same idiom as the navbar dropdowns (nav.js): click toggles, outside
   click / Escape closes (focus returns to the button), arrow keys move
   between items with wrap. Right-aligned inside the card head so the
   menu never overflows the card on mobile; the menu anchors to the
   card-head (not the button) so it drops below the whole header and
   never covers the title, even when the title wraps on mobile. */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: nowrap; position: relative; }
.card-head h2 { margin: 0; flex: 1 1 auto; min-width: 0; }
.card-drop { position: static; flex: none; }
.card-drop-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; border-radius: 7px; border: 1px solid var(--card-border);
  background: var(--card); color: var(--text); font-family: inherit; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: 0.15s;
}
.card-drop-btn:hover, .card-drop.open .card-drop-btn { border-color: var(--primary); }
.card-drop-btn .caret { font-size: 0.66rem; transition: transform 0.2s; }
.card-drop.open .card-drop-btn .caret { transform: rotate(180deg); }
.card-menu {
  position: absolute; top: calc(100% + 5px); right: 0;
  min-width: 188px; max-width: calc(100vw - 48px);
  background: var(--bg-soft); border: 1px solid var(--card-border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 5px;
  opacity: 0; visibility: hidden; transform: translateY(-3px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 50;
}
.card-drop.open .card-menu { opacity: 1; visibility: visible; transform: none; }
.card-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 9px;
  width: 100%; padding: 7px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; text-align: left; white-space: nowrap;
}
.card-menu button:hover, .card-menu button:focus-visible { background: var(--card); }
.card-menu button .tick { opacity: 0; color: var(--accent); }
.card-menu button[aria-checked="true"] .tick { opacity: 1; }
.card-menu .menu-sep { height: 1px; background: var(--card-border); margin: 5px 4px; }
.nav-actions { display: flex; align-items: center; gap: clamp(6px, 0.7vw, 10px); flex: none; }
#account-link { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.icon-btn {
  border: 1px solid var(--card-border); background: var(--card); color: var(--text);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
  transition: border-color 0.15s ease;
}
.icon-btn:hover { border-color: var(--primary); }
.hamburger { display: none; }

/* ---------- AI status dot (wired by nav.js -> SkillzifyAI.attachStatus) ----------
   An 8px dot at the leading edge of .nav-actions: green = AI ready,
   amber = waking up / thinking / degraded, grey = offline or idle.
   It carries no text — the full label lives in the title attribute
   (hover tooltip) and aria-label — so it can never truncate, wrap, or
   push anything out of the bar, and it stays visible at every width. */
.ai-status-pill {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: #6b7280; /* idle/offline grey until ai.js paints a state */
}
.ai-status-pill.pulse { animation: ai-dot-pulse 1.2s ease-in-out infinite; }
@keyframes ai-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (max-width: 1280px) {
  .brand { font-size: 1.02rem; }
  .nav-links a, .nav-drop-btn { font-size: 0.84rem; }
}

/* ---------- Theme picker ---------- */
.theme-picker-wrap { position: relative; display: inline-flex; }
.theme-picker {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 200;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 12px; min-width: 204px;
  box-shadow: var(--shadow); display: none;
}
.theme-picker.open { display: block; }
.theme-picker h4 { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.theme-picker h4:not(:first-child) { margin-top: 12px; }
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: all .15s; padding: 0;
}
.swatch:hover { transform: scale(1.12); }
.swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text); }
.mode-row { display: flex; gap: 6px; }
.mode-btn {
  flex: 1; padding: 7px; border-radius: 7px; border: 1px solid var(--card-border);
  background: transparent; color: var(--muted); cursor: pointer; font-size: .8rem; font-weight: 600;
}
.mode-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Screen-reader-only heading (P2-63): pages whose visible title is
   an h2 or is injected by JS still need a real <h1> in the outline. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Buttons ---------- */
/* P2-61: .btn-primary is the alias of .btn — the 6 call sites use
   "btn btn-primary", so primary actions keep the gradient even if
   .btn is ever restyled neutral. */
.btn, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 18px; border-radius: 8px; font-weight: 600; font-size: 0.9rem;
  border: none; cursor: pointer; transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  color: #fff; background: var(--gradient);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--line-2);
  box-shadow: none;
}
.btn-ghost:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; border-radius: 6px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- Hero ---------- */
.hero {
  padding: 42px 0 36px;
  background:
    radial-gradient(640px 300px at 15% 0%, rgba(108, 123, 255, 0.18), transparent 60%),
    radial-gradient(540px 280px at 85% 10%, rgba(34, 211, 238, 0.11), transparent 60%);
}
.hero-grid { display: grid; grid-template-columns: 1.02fr 0.98fr; gap: 30px; align-items: center; }
.hero h1 { font-size: clamp(1.85rem, 3.6vw, 2.6rem); line-height: 1.08; letter-spacing: -0.03em; font-weight: 800; }
.hero h1 .grad { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; font-size: 0.66rem; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 11px;
  background: color-mix(in srgb, var(--primary) 8%, transparent); margin-bottom: 14px;
}
.hero p.lead { color: var(--muted); font-size: 1rem; line-height: 1.6; margin: 14px 0 20px; max-width: 500px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.hero-card .code-window { margin-top: 0; }
.code-window {
  background: var(--code-bg); border-radius: 8px; overflow: hidden; margin-top: 14px;
  border: 1px solid var(--card-border); text-align: left;
}
.code-window .cw-bar { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,.08); align-items: center; }
.cw-dot { width: 9px; height: 9px; border-radius: 50%; }
.code-window pre { padding: 12px 14px; overflow-x: auto; font-size: 0.82rem; }
.code-window code { font-family: "JetBrains Mono", "Fira Code", Consolas, monospace; color: #cdd6ff; line-height: 1.6; }
.tok-k { color: #9d6bff; } .tok-s { color: #7ee0a3; } .tok-c { color: #5b648c; font-style: italic; } .tok-f { color: #22d3ee; }

/* ---------- Features ---------- */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 26px; grid-auto-rows: 1fr; }
/* Equal-size rule (Vikas, 16 Nov 2026): within a section every card is
   the SAME size — grid rows are equal height (grid-auto-rows: 1fr),
   each card fills its row as a flex column and its footer link pins
   to the bottom, so no card ends higher or lower than its neighbours
   and no stretched card shows an empty bottom. */
.grid-4 > .card { display: flex; flex-direction: column; }
.grid-4 > .card > .card-link { margin-top: auto; padding-top: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 26px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 18px; }
/* Card-stretch rule (Vikas, 16 Nov 2026): a card stretched by its row
   must not end in a big empty bottom — it either sizes to its content
   (align-items:start grids) or fills the height with real content, its
   footer action pinned to the bottom. Two-up cards take the fill:
   the action row sits at the card's foot, never floating mid-card. */
.grid-2 > .card { display: flex; flex-direction: column; }
.grid-2 > .card > .btn-row, .grid-2 > .card > .card-link { margin-top: auto; padding-top: 10px; }
.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 16px; position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
/* Signature: a short gradient tick on the card's left edge, lit on hover */
.card::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px;
  border-radius: 2px; background: var(--gradient); opacity: 0; transition: opacity 0.15s ease;
}
.card:hover { box-shadow: var(--shadow); border-color: var(--line-2); }
.card:hover::before { opacity: 1; }
.card .icon {
  width: 38px; height: 38px; border-radius: 9px; margin-bottom: 10px;
  display: grid; place-items: center; font-size: 1.15rem;
  background: color-mix(in srgb, var(--primary) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 26%, transparent);
  color: var(--primary);
}
.card .icon svg { width: 20px; height: 20px; }
.card h3 { font-size: 1.02rem; margin-bottom: 5px; letter-spacing: -0.01em; }
/* P2-63: the community form titles were promoted h3 -> h2; keep
   their card-heading size. */
.comm-form h2 { font-size: 1.02rem; margin-bottom: 5px; }
.card p { color: var(--muted); font-size: 0.88rem; line-height: 1.55; }
.card .card-link { display: inline-block; margin-top: 10px; font-weight: 700; font-size: 0.85rem; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 24px; }
.stat { text-align: center; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 30px 16px; }
.stats .stat { padding: 14px 10px; }
.stat .num { font-size: 1.55rem; font-weight: 800; line-height: 1.15; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }

/* ---------- CTA banner ---------- */
.cta-banner {
  background: var(--gradient); border-radius: 14px; padding: 30px 28px; text-align: center;
  color: #fff; margin-top: 44px; box-shadow: var(--shadow);
}
.cta-banner h2 { font-size: clamp(1.35rem, 2.8vw, 1.8rem); margin-bottom: 8px; }
.cta-banner p { opacity: 0.92; margin-bottom: 18px; font-size: 0.94rem; }
.cta-banner .btn { background: #fff; color: #3b3bd4; box-shadow: none; }

/* ---------- Footer ---------- */
footer { margin-top: 44px; background: var(--bg-soft); }
footer::before { content: ""; display: block; height: 2px; background: var(--gradient); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; gap: 22px; padding: 26px 0 16px; }
.footer-grid h4 { margin-bottom: 9px; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text); }
.footer-grid a { display: block; color: var(--muted); font-size: 0.86rem; margin-bottom: 5px; transition: color 0.15s ease, transform 0.15s ease; }
.footer-grid a:hover { color: var(--text); transform: translateX(2px); }
.footer-brand img { height: 32px; width: auto; margin-bottom: 10px; }
.footer-brand p { color: var(--muted); font-size: 0.86rem; max-width: 34ch; }
.footer-social { display: flex; gap: 8px; margin-top: 14px; }
.footer-social a { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-bottom: 0; border: 1px solid var(--card-border); border-radius: 50%; color: var(--muted); }
.footer-social a:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-2px); }
.footer-social svg { width: 15px; height: 15px; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--card-border); padding: 12px 0; color: var(--muted); font-size: 0.8rem; }
.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--text); }

/* ---------- Learn page ---------- */
.lesson {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.lesson h3 { font-size: 1.05rem; }
.lesson.done h3 { text-decoration: line-through; color: var(--muted); }
.lesson .explain { color: var(--muted); margin: 8px 0 12px; font-size: 0.92rem; }
.lesson-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.progress-wrap { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.progress-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.progress-row .lbl { width: 118px; font-size: 0.84rem; font-weight: 600; flex-shrink: 0; }
.bar { flex: 1; height: 7px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gradient); border-radius: 999px; transition: width 0.4s ease; }
.pct { width: 52px; text-align: right; font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Compiler ---------- */
.panel { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; }
.panel h3 { margin-bottom: 10px; font-size: 0.98rem; }
.CodeMirror { border-radius: 8px; border: 1px solid var(--card-border); font-size: 15px; height: 380px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
select, input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea {
  background: var(--bg-soft); border: 1px solid var(--card-border); color: var(--text);
  border-radius: 7px; padding: 8px 11px; font-size: 0.88rem; font-family: inherit; width: 100%;
}
input[type="search"]::placeholder, input[type="text"]::placeholder, textarea::placeholder { color: var(--muted); }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
/* Keep browser autofill from flashing a white background on dark theme */
input:-webkit-autofill, textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-soft) inset;
  transition: background-color 9999s ease-in-out 0s;
}
label.field-lbl { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
.console {
  background: var(--code-bg); color: #d7deff; border-radius: 8px; padding: 12px;
  font-family: "JetBrains Mono", Consolas, monospace; font-size: 0.84rem;
  min-height: 140px; max-height: 320px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--card-border); margin-top: 10px;
}
.console .err { color: var(--danger); }
.console .ok-meta { color: var(--success); }
.ai-box { background: var(--bg-soft); border: 1px solid var(--card-border); border-radius: 8px; padding: 12px; margin-top: 10px; font-size: 0.88rem; max-height: 380px; overflow-y: auto; }
.ai-box h4 { margin-bottom: 6px; color: var(--accent); }
.ai-box ul { padding-left: 18px; }
.ai-box li { margin-bottom: 5px; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
details.settings { margin-top: 12px; border: 1px solid var(--card-border); border-radius: 8px; padding: 10px 12px; }
details.settings summary { cursor: pointer; font-weight: 700; font-size: 0.88rem; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; align-items: start; }
/* Two-column dashboard rows — collapses to one column on mobile (no inline styles!).
   align-items:start — paired cards hug their content instead of stretching
   to the taller card and ending in an empty bottom (card-stretch rule). */
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; align-items: start; }
.dash-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; }
.dash-card .big { font-size: 1.85rem; font-weight: 800; line-height: 1.15; }
.ring-wrap { display: flex; align-items: center; gap: 14px; }
.run-item { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--card-border); font-size: 0.84rem; }
.run-item:last-child { border-bottom: none; }
.badge { padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge.ok { background: rgba(52,211,153,.15); color: var(--success); }
.badge.fail { background: rgba(248,113,113,.15); color: var(--danger); }

/* ---------- Learning paths ---------- */
.path-card2 { --pc: #6c7bff; display: flex; flex-direction: column; gap: 8px; border-top: 3px solid var(--pc); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.path-card2:hover { transform: translateY(-2px); }
.path-card2::before { display: none; }
.path-card2 h3 { margin: 0; font-size: 1.02rem; }
.path-top { display: flex; align-items: center; justify-content: space-between; }
.path-tile { width: 40px; height: 40px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; background: var(--pc); background: linear-gradient(135deg, var(--pc), color-mix(in srgb, var(--pc) 62%, #000)); border: 1px solid var(--card-border); }
.path-tile.lg { width: 56px; height: 56px; font-size: 1.8rem; border-radius: 12px; flex: none; }
.path-level { border: 1px solid var(--pc); color: var(--pc); background: transparent; }
.path-meta { font-size: 0.84rem; color: var(--muted); margin: 0; }
.path-bar { margin: 2px 0; }
.path-card2 .bar { flex: none; }
.path-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.path-foot .pct { width: auto; white-space: nowrap; }
.continue-hero { --pc: #6c7bff; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-left: 3px solid var(--pc); margin-bottom: 14px; }
.continue-hero h3 { font-size: 1.1rem; }
.ch-actions { display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
#path-pills { margin: 2px 0 14px; }
.path-hero { --pc: #6c7bff; display: flex; gap: 14px; align-items: center; margin: 14px 0; }
.up-next { --pc: #6c7bff; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-left: 3px solid var(--pc); margin-bottom: 14px; }
.up-next.done { border-left-color: #2ecc71; }
.path-timeline { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.tl-step { display: flex; gap: 10px; align-items: flex-start; padding: 7px 6px; border-radius: 8px; position: relative; }
.tl-step:not(:last-child)::before { content: ""; position: absolute; left: 19px; top: 37px; bottom: -4px; width: 2px; background: var(--card-border); }
.tl-step.done:not(:last-child)::before { background: #2ecc71; }
.tl-dot { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.78rem; background: var(--card); border: 2px solid var(--card-border); color: var(--muted); z-index: 1; }
.tl-step.done .tl-dot { background: rgba(46,204,113,.15); border-color: #2ecc71; color: #2ecc71; }
.tl-step.current { background: rgba(108,123,255,.07); }
.tl-step.current .tl-dot { border-color: var(--pc, #6c7bff); color: var(--pc, #6c7bff); }
.tl-body { display: flex; flex-direction: column; gap: 1px; padding-top: 4px; }
.tl-body a { font-weight: 600; color: var(--text); text-decoration: none; }
.tl-body a:hover { color: var(--primary); }
.tl-step.done .tl-body a { text-decoration: line-through; color: var(--muted); }
@media (max-width: 720px) {
  .path-hero { flex-direction: column; }
  .continue-hero { flex-direction: column; align-items: flex-start; }
}

/* ---------- Projects ---------- */
.proj-card2 { --pc: #6c7bff; display: flex; flex-direction: column; gap: 8px; border-top: 3px solid var(--pc); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; text-decoration: none; color: inherit; }
.proj-card2:hover { transform: translateY(-2px); color: inherit; }
.proj-card2::before { display: none; }
.proj-card2 h3 { margin: 0; font-size: 1rem; }
.proj-skills { margin: 0; font-size: 0.8rem; }
.proj-open { font-weight: 700; font-size: 0.86rem; color: var(--pc, #6c7bff); }
.proj-card2:hover .proj-open { text-decoration: underline; }
#proj-pills { margin: 2px 0 14px; }
.proj-steps { margin: 8px 0 0 18px; display: grid; gap: 6px; }
.proj-steps code, .proj-card2 code { font-size: 0.85em; }
.proj-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
/* Detail views: even gaps between the stacked cards. Both detail
   pages render their cards as adjacent siblings and .card itself
   carries no margin, so the cards touched each other. The list grids
   already have gap; only the detail stacks needed this. */
#projects-list > .card + .card { margin-top: 14px; }
#practice-detail > * + * { margin-top: 14px; }
#practice-detail > #compare-box:empty { margin-top: 0; }
/* Empty result boxes must not reserve space: :empty stops matching
   the moment content is injected, so the boxes reappear on use. */
#practice-detail #hint-box:empty, #practice-detail #tutor-box:empty,
#practice-detail #solution-box:empty, #practice-detail #predict-msg:empty,
#practice-detail #ex-results:empty { display: none; }
#drill-card #drill-status:empty, #drill-card #my-drills:empty { display: none; }

/* ---------- About ---------- */
.about-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 18px; text-align: center; }
.about-stats .stat { padding: 12px 6px; text-align: center; }
.about-stats .num { font-size: 1.4rem; }
.link-card { display: block; text-decoration: none; color: inherit; transition: transform .15s ease, box-shadow .15s ease; }
.link-card:hover { transform: translateY(-2px); color: inherit; }
.link-card .card-link { font-weight: 700; color: var(--primary); }
/* Card-style anchors must not inherit the global a:hover underline */
.link-card:hover, .proj-card2:hover, .path-card2:hover, .pin-card:hover { text-decoration: none; }

/* ---------- Path enrollment ---------- */
.badge-enrolled { background: rgba(52,211,153,.15); color: #34d399; border: 1px solid rgba(52,211,153,.35); }
/* Light theme: #34d399 is 1.92:1 on a white card — same darkened green
   as the light --success above (4.86:1 on its tinted background). */
[data-theme="light"] .badge-enrolled { color: #0f7a44; }
.badge-unlock { background: rgba(34,211,238,.12); color: var(--accent); border: 1px solid rgba(34,211,238,.35); }
.badge-locked { background: rgba(148,163,184,.1); color: var(--muted); border: 1px solid var(--card-border); }
.path-actions { display: inline-flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.linklike { background: none; border: none; padding: 0; color: var(--muted); font-size: .78rem; font-family: inherit; cursor: pointer; text-decoration: underline; }
.linklike:hover { color: var(--text); }
.enroll-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; padding: 10px 14px; background: var(--bg-soft); border: 1px solid var(--card-border); border-radius: 8px; }
.enroll-bar.is-on { border-color: rgba(52,211,153,.35); }
.enroll-bar .hint { margin: 0; flex: 1; min-width: 200px; }
.node.is-path { border-style: dashed; border-color: var(--accent); }
@media (max-width: 720px) { .about-stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Contact ---------- */
#c-topics { margin-top: 4px; }
.faq { display: grid; gap: 8px; margin-top: 12px; }
.faq details { background: var(--card); border: 1px solid var(--card-border); border-radius: 8px; padding: 10px 14px; }
.faq summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 0.92rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.1rem; color: var(--primary); flex: none; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--muted); margin: 8px 0 2px; font-size: 0.9rem; }

/* ---------- Account drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(4,6,18,.62); backdrop-filter: blur(2px); z-index: 200; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: absolute; top: 0; right: 0; height: 100dvh; width: min(360px, 94vw); background: var(--card); border-left: 1px solid var(--card-border); box-shadow: -18px 0 50px rgba(0,0,0,.45); transform: translateX(105%); transition: transform .3s cubic-bezier(.32,.72,.35,1); display: flex; flex-direction: column; }
.drawer-backdrop.open .drawer { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--card-border); flex: none; }
.drawer-head h3, .drawer-head h2 { margin: 0; font-size: 1.02rem; }
.drawer-body { padding: 16px; overflow-y: auto; flex: 1; }
.drawer-section { margin-bottom: 20px; }
.drawer-section:last-child { margin-bottom: 0; }
.drawer-section > h4 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; }
.drawer-email { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--card-border); border-radius: 8px; padding: 9px 11px; margin-bottom: 10px; font-size: 0.86rem; overflow: hidden; }
.drawer-email strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer .form-group { margin-bottom: 12px; }
.drawer .field-lbl { margin-top: 0; }
.drawer input, .drawer textarea { width: 100%; }

/* ---------- Forms / auth ---------- */
.form-card { max-width: 420px; margin: 28px auto; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 24px; box-shadow: var(--shadow); }
.form-card h2 { margin-bottom: 5px; font-size: 1.2rem; }
.form-card .sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 16px; }
.form-group { margin-bottom: 12px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-tabs button { flex: 1; padding: 8px; border-radius: 7px; border: 1px solid var(--card-border); background: var(--bg-soft); color: var(--muted); font-weight: 700; cursor: pointer; font-size: 0.88rem; }
.auth-tabs button.active { background: var(--gradient); color: #fff; border-color: transparent; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(120px);
  background: var(--card); border: 1px solid var(--card-border); color: var(--text);
  padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); z-index: 999;
  transition: transform 0.3s ease; font-weight: 600; font-size: 0.86rem; max-width: 90%;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

/* ---------- Misc ---------- */
.page-hero {
  padding: 28px 0 4px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 5%, transparent), transparent 78%);
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 6px;
}
.kbd { background: var(--bg-soft); border: 1px solid var(--card-border); border-radius: 5px; padding: 1px 6px; font-size: 0.78rem; font-family: monospace; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.list-check { list-style: none; margin-top: 12px; }
.list-check li { padding: 6px 0 6px 26px; position: relative; color: var(--muted); }
.list-check li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 800; }

/* ---------- Responsive ---------- */
/* ---------- Nav collapse (moved up from the 960px block) ----------
   Below ~1200px the full desktop row (7 links + account + theme
   buttons) no longer fits any laptop/tablet width, so the links move
   into the slide-down panel and the hamburger appears. The bar itself
   never wraps: every label is nowrap (see above), so no item can ever
   split across two lines. */
@media (max-width: 1200px) {
  /* --- nav collapses to hamburger here: 9 links overflow the bar below this width --- */
  .nav-inner { gap: 8px; }
  .brand { font-size: 1rem; }
  .brand img { height: 28px; }
  .nav-links {
    position: fixed; top: var(--nav-h); right: 0; left: 0; flex-direction: column; align-items: stretch;
    background: var(--bg-soft); border-bottom: 1px solid var(--card-border);
    padding: 8px 4%; gap: 2px; display: none;
    max-height: calc(100dvh - var(--nav-h)); overflow-y: auto;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 12px; min-height: 48px; display: flex; align-items: center; }
  /* Dropdowns become expandable sections inside the open menu */
  .nav-drop { width: 100%; }
  .nav-drop-btn { width: 100%; justify-content: space-between; padding: 10px 12px; font-size: 0.95rem; min-height: 48px; }
  .nav-menu {
    position: static; transform: none; opacity: 1; visibility: visible;
    box-shadow: none; border: 0; border-radius: 0; background: transparent;
    padding: 0 0 0 10px; display: none; min-width: 0;
  }
  .nav-drop:hover .nav-menu { opacity: 1; visibility: visible; transform: none; }
  .nav-drop.open .nav-menu { display: block; }
  .nav-menu a { padding: 7px 10px; font-size: 0.88rem; min-height: 48px; align-items: center; }
  .hamburger { display: inline-flex; }
  /* P1-5: #account-link is the site's ONLY login/logout UI (auth.js
     renders the Login link / Logout button into it). It used to be
     display:none here, so mobile users could neither sign in nor
     sign out. Keep it in the bar when the nav collapses; the greeting
     name is hidden at ≤720px (see below) so the Logout button fits. */
}
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }

}
@media (max-width: 720px) {
  .grid-4, .grid-3, .grid-2, .dash-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-auto-rows: auto; }
  /* P1-5: on phones hide only the "👋 Name" greeting inside #account-link
     so the bar still fits — the Login link / Logout button stay visible. */
  #account-link > span { display: none; }
  .dash-grid-2 { grid-template-columns: 1fr; }
  /* Dashboard mobile polish */
  .dash-card .big { font-size: 1.6rem; }
  .ring-wrap { flex-wrap: wrap; }
  .next-card { padding: 12px; }
  .next-actions { align-items: stretch; width: 100%; }
  .next-actions .btn { text-align: center; }
  .run-item { flex-wrap: wrap; }
  .section { padding: 36px 0; }
  .hero { padding: 30px 0 24px; }
}

/* ============================================================
   Learn path — advanced progressive learning system
   ============================================================ */
.learn-hero { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; }
.xp-card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 10px 16px; display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow); position: relative; overflow: visible;
}
.xp-num { font-size: 1.35rem; font-weight: 800; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.xp-lvl { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.xp-bar { width: 130px; height: 6px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin-top: 5px; }
.xp-bar > span { display: block; height: 100%; background: var(--gradient); border-radius: 999px; transition: width 0.5s ease; }
.xp-pop {
  position: absolute; top: -8px; right: 12px; font-weight: 800; font-size: 0.95rem; color: var(--warning);
  animation: xp-float 1.6s ease-out forwards; pointer-events: none; white-space: nowrap;
}
@keyframes xp-float { 0% { opacity: 0; transform: translateY(8px) scale(0.8); } 20% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-34px) scale(1); } }

/* ---------- Track path ---------- */
.track-section { margin: 30px 0 4px; }
.track-head { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.track-head .t-icon { font-size: 1.35rem; }
.track-head h2 { font-size: 1.12rem; }
.track-head .t-desc { color: var(--muted); font-size: 0.85rem; }
.track-head .t-pct { margin-left: auto; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Dashboard: next-step hero + level pill ---------- */
.next-card {
  margin-bottom: 14px; padding: 14px 18px; border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 13%, var(--card)), var(--card));
  border: 1px solid var(--card-border); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between;
}
.next-card .cc-title { font-size: 1.15rem; font-weight: 800; margin-top: 3px; }
.next-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.next-quick { display: flex; gap: 7px; align-items: center; font-size: 0.84rem; color: var(--muted); }
.next-quick a { color: var(--muted); font-weight: 600; }
.next-quick a:hover { color: var(--text); }
.level-pill {
  display: inline-block; font-size: 0.8rem; font-weight: 800; color: #fff;
  background: var(--gradient); border-radius: 999px; padding: 4px 12px;
  box-shadow: var(--shadow);
}
.sync-chip {
  display: inline-block; font-size: 0.76rem; font-weight: 700; color: var(--muted);
  background: var(--card); border: 1px solid var(--card-border); border-radius: 999px;
  padding: 3px 10px; margin-left: 6px; vertical-align: middle; white-space: nowrap;
}
/* ---------- Dashboard: weak spots ---------- */
.weak-summary { font-size: 0.9rem; margin: 0 0 10px; }
.weak-row { padding: 7px 0; border-bottom: 1px solid var(--card-border); }
.weak-row:last-child { border-bottom: 0; }
.weak-row .weak-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 5px; }
.weak-row .lbl { font-weight: 700; }
/* The global .pct is 52px, sized for a bare percentage, but weak-row
   labels carry more ("8% · Starting out" on profile, "1/1 · 100%" on the
   dashboard), so the label must size to its content and never shrink
   below it — otherwise the nowrap text spills up to 49px past the card's
   right edge and gets clipped. Scoped to the two cards that render weak
   rows — the profile topic-mastery card (#profile-mastery-topics) and
   the dashboard weak-spots card (#dash-topic-acc, which wraps both its
   top-3 rows and its show-all rest rows) — and nowhere else, so no other
   .pct label is affected. */
#profile-mastery-topics .weak-row .pct, #dash-topic-acc .weak-row .pct { width: auto; flex-shrink: 0; font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.weak-row .bar { margin: 0 0 5px; }
.weak-row.is-weak .bar span { background: linear-gradient(90deg, #f87171, #fb923c); }
.weak-link { font-size: 0.82rem; font-weight: 700; }
.weak-chip { display: inline-block; padding: 2px 9px; border: 1px solid var(--card-border); border-radius: 999px; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
/* ---------- Practice page ---------- */
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--card-border); background: var(--card); color: var(--muted);
  font: inherit; font-size: 0.83rem; font-weight: 600; cursor: pointer; transition: 0.15s;
}
.pill:hover { color: var(--text); border-color: var(--primary); }
.pill.active { color: #fff; background: var(--gradient); border-color: transparent; }
.pill .pill-n { font-size: 0.74rem; opacity: 0.8; font-variant-numeric: tabular-nums; }
.pill.active .tp-dot { box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.tp-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.tp-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; line-height: 1.4; }
.tp-row .tp-label { min-width: 118px; font-weight: 600; font-size: 0.87rem; display: flex; align-items: center; gap: 6px; }
.tp-row .bar { flex: 1; margin: 0; }
.tp-row .pct { min-width: 52px; text-align: right; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ex-card { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.ex-card:hover { transform: translateY(-2px); }
@media (max-width: 720px) { .tp-row .tp-label { min-width: 100px; font-size: 0.82rem; } }
/* ---------- Collapsible cards (dashboard runs, profile feed) ---------- */
.coll-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; background: none; border: 0; color: inherit; font: inherit;
  cursor: pointer; padding: 0; text-align: left;
}
.coll-title { font-size: 1.02rem; font-weight: 800; }
.coll-caret { color: var(--muted); font-size: 1.05rem; line-height: 1; transition: transform .2s ease; }
.collapsible .coll-body { display: none; }
.collapsible.open .coll-body { display: block; }
.collapsible.open .coll-caret { transform: rotate(180deg); }
/* ---------- Learn page: accordion tracks + search + continue ---------- */
button.track-head {
  width: 100%; background: none; border: 0; font: inherit; color: inherit;
  text-align: left; cursor: pointer; border-radius: 8px; padding: 7px 10px; margin: 0 -10px 2px;
  transition: background 0.15s;
}
button.track-head:hover { background: var(--card); }
.track-head .t-text { display: flex; flex-direction: column; gap: 1px; }
.track-head .t-name { font-size: 1.12rem; font-weight: 800; }
.track-head .t-count {
  font-size: 0.74rem; font-weight: 700; color: var(--muted);
  border: 1px solid var(--card-border); border-radius: 999px; padding: 2px 9px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.track-head .t-chev { color: var(--muted); font-size: 1.05rem; transition: transform 0.25s ease; }
.track-map-link { display: inline-block; font-size: 0.8rem; color: var(--muted); margin: 0 0 4px 10px; }
.track-map-link:hover { color: var(--text); }
.track-section.collapsed .t-chev { transform: rotate(-90deg); }
.track-section.collapsed .path { display: none; }
.track-section .path { animation: trackIn 0.3s ease; }
@keyframes trackIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.continue-card {
  margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 15%, var(--card)), var(--card));
  border: 1px solid var(--card-border); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.continue-card .cc-label { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); width: 100%; }
.continue-card .cc-title { font-size: 1.08rem; font-weight: 800; flex: 1; min-width: 200px; }
.continue-card .cc-num {
  display: inline-block; font-size: 0.82rem; color: #fff;
  background: var(--gradient); border-radius: 999px; padding: 2px 9px; margin-right: 7px; vertical-align: 2px;
}
.continue-card .cc-done { font-size: 1rem; font-weight: 700; }
.search-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 8px; padding: 2px 4px 2px 12px;
}
.search-row .search-ico { font-size: 1rem; }
#lesson-search {
  flex: 1; background: transparent; border: 0; outline: 0; color: var(--text);
  font: inherit; font-size: 0.92rem; padding: 8px 6px; box-shadow: none;
}
/* #lesson-search removes its own outline, so the row carries the focus
   ring instead (same border + ring as the global input :focus style). */
.search-row:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
#lesson-search::placeholder { color: var(--muted); }
/* Redesign v2: the journey is a left-rail timeline — a slim node on a
   vertical progress line, label beside it — instead of the old centred
   winding path. learn.js draws the SVG line through the node centres
   from live geometry, so the line follows the new layout on its own. */
.path { position: relative; padding: 10px 0 6px 4px; }
.path-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.path-svg .p-base { fill: none; stroke: var(--card-border); stroke-width: 3; stroke-linecap: round; }
.path-svg .p-prog { fill: none; stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.node-row { position: relative; z-index: 1; display: flex; flex-direction: row; align-items: center; margin: 0; padding: 5px 8px; border-radius: 8px; transform: none; }
.node-row:hover { background: var(--bg-soft); }
.node {
  width: 42px; height: 42px; flex: none; border-radius: 50%; border: 2px solid var(--card-border);
  background: var(--card); color: var(--text); font-size: 1.05rem; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.node:hover:not(:disabled) { transform: scale(1.08); }
.node:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.node.is-done { background: linear-gradient(135deg, #fbbf24, #f59e0b); border-color: #fbbf24; color: #3a2b00; }
.node.is-current { background: var(--gradient); border-color: transparent; color: #fff; animation: node-pulse 2.2s infinite; }
.node.is-locked { background: var(--bg-soft); color: var(--muted); cursor: not-allowed; filter: grayscale(0.7); opacity: 0.65; }
@keyframes node-pulse { 0% { box-shadow: 0 0 0 0 rgba(108,123,255,0.55); } 70% { box-shadow: 0 0 0 12px rgba(108,123,255,0); } 100% { box-shadow: 0 0 0 0 rgba(108,123,255,0); } }
.node-label { margin-left: 12px; font-size: 0.88rem; color: var(--muted); font-weight: 600; text-align: left; line-height: 1.35; }
.node-label strong { color: var(--text); }
.node-row.is-current .node-label { color: var(--text); }
.mini-xp { color: var(--warning); font-weight: 800; }
.track-locked {
  background: var(--card); border: 1px dashed var(--card-border); border-radius: var(--radius);
  padding: 26px 20px; text-align: center; color: var(--muted); margin: 10px 0 24px;
}
.track-locked .big { font-size: 1.9rem; margin-bottom: 8px; }
.track-locked h3 { color: var(--text); margin-bottom: 6px; }

/* ---------- Lesson modal ---------- */
.lm-kicker { font-size: 0.76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 4px 0 8px; }
.lesson-page {
  max-width: 780px; margin: 0 auto; padding: 24px 30px 22px;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 12px; box-shadow: var(--shadow);
}
@media (max-width: 720px) { .lesson-page { padding: 18px 16px 24px; } }
.lesson-page h2 { font-size: 1.5rem; letter-spacing: -0.01em; margin-bottom: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--card-border); }
.lesson-crumb { display: flex; align-items: center; gap: 7px; font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.lesson-crumb a { color: var(--muted); }
.lesson-crumb a:hover { color: var(--text); }
.lesson-crumb .crumb-cur { color: var(--text); font-weight: 600; }
.unlock-badge { display: inline-block; background: rgba(34, 211, 238, 0.12); border: 1px dashed var(--accent); color: var(--accent); border-radius: 999px; padding: 1px 9px; font-size: 0.72rem; letter-spacing: 0.02em; }
.lesson-actions { display: flex; gap: 7px; flex-wrap: wrap; margin: 12px 0 4px; }
.lesson-locked { text-align: center; padding: 36px 16px; }
.lesson-locked .big { font-size: 2.2rem; margin-bottom: 6px; }
.lesson-path-cta { margin-top: 14px; text-align: left; }
.lesson-done-note { background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.35); color: var(--text); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
a.node, a.node:hover { text-decoration: none; }
.lm-explain { color: var(--muted); font-size: 0.94rem; }
.lm-points { margin: 10px 0 4px; }
.lm-sec { margin: 17px 0 4px; font-size: 1.05rem; }
.cw-title { margin-left: auto; font-size: 0.72rem; color: #5b648c; font-family: monospace; }
.tok-n { color: #fbbf24; }

/* ---------- Quiz ---------- */
.quiz-q { background: var(--card); border: 1px solid var(--card-border); border-radius: 8px; padding: 12px 13px; margin: 8px 0; }
.quiz-q h4 { margin-bottom: 8px; font-size: 0.92rem; }
.quiz-opt {
  display: block; width: 100%; text-align: left; background: var(--bg-soft);
  border: 1px solid var(--card-border); color: var(--text); border-radius: 7px;
  padding: 8px 11px; margin: 6px 0; cursor: pointer; font-size: 0.88rem; font-family: inherit;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--primary); transform: translateX(2px); }
.quiz-opt.correct { background: rgba(52,211,153,0.15); border-color: var(--success); }
.quiz-opt.wrong { background: rgba(248,113,113,0.12); border-color: var(--danger); }
.quiz-opt:disabled { cursor: default; }
.quiz-why { font-size: 0.82rem; color: var(--muted); margin-top: 8px; display: none; line-height: 1.5; }
.quiz-why.show { display: block; }

/* ---------- Challenge ---------- */
.challenge { background: var(--card); border: 1px solid var(--card-border); border-radius: 8px; padding: 12px 13px; margin: 8px 0; transition: border-color 0.3s ease; }
.challenge.done { border-color: var(--success); }
.ch-prompt { font-weight: 600; margin: 6px 0 10px; }
.blank-row { display: flex; gap: 8px; margin-top: 10px; }
.blank-row input { flex: 1; }
.blank-row .btn { flex-shrink: 0; }
.ch-feedback { margin-top: 8px; font-weight: 600; font-size: 0.9rem; min-height: 1.4em; }
.ch-ok { color: var(--success); }
.ch-bad { color: var(--danger); }
.ch-hint { margin-top: 8px; font-size: 0.84rem; color: var(--muted); }
.ch-hint summary { cursor: pointer; font-weight: 600; }

/* ---------- Modal footer ---------- */
.lm-complete {
  position: sticky; bottom: 0; margin-top: 20px; padding: 14px 0 4px;
  background: linear-gradient(transparent, var(--card) 45%);
  display: flex; gap: 10px; align-items: center;
}
.lm-complete .btn { flex: 1; }
.lm-nav { display: flex; gap: 7px; }

/* ---------- Confetti ---------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 1000; overflow: hidden; }
.confetti-piece { position: fixed; top: -24px; border-radius: 2px; animation: confetti-fall 1.9s ease-in forwards; }
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(112vh) rotate(720deg); opacity: 0.6; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .node.is-current { animation: none; }
  .confetti-piece, .xp-pop { display: none; }
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ============================================================
   Mobile usability
   ============================================================ */
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; } /* safety net: never allow sideways scrolling */
button, a, .quiz-opt, .quiz-opt *, .node, .auth-tabs button {
  touch-action: manipulation; /* remove tap delay */
  -webkit-tap-highlight-color: transparent;
}

/* Prevent iOS Safari auto-zoom when tapping inputs (needs >= 16px) */
@media (max-width: 1024px) {
  select, input[type="text"], input[type="email"], input[type="password"], textarea { font-size: 16px; }
  .CodeMirror { font-size: 16px; }
}

@media (max-width: 720px) {
  /* --- page rhythm --- */
  .page-hero { padding: 22px 0 2px; }
  .footer-grid { grid-template-columns: 1fr; gap: 18px; padding: 24px 0 14px; }
  .panel { padding: 12px; }
  .lesson { padding: 14px 12px; }
  .dash-card { padding: 14px; }
  .form-card { padding: 20px 16px; margin: 20px auto; }
  .cta-banner { padding: 26px 18px; }
  .hero-cta .btn { flex: 1 1 150px; } /* big, thumb-friendly CTAs */
  .code-window pre { font-size: 0.8rem; padding: 11px; }
  /* Touch targets stay >= 48px on phones even in the compact system */
  .btn { min-height: 48px; }
  .pill { min-height: 48px; }
  .icon-btn { width: 48px; height: 48px; }
  .card-drop-btn { min-height: 48px; }
  .footer-social a { width: 48px; height: 48px; }
  .node { width: 48px; height: 48px; }
  .card-menu button { min-height: 48px; }
  .mode-btn { min-height: 48px; }
  .swatch { width: 40px; height: 40px; }

  /* --- compiler: big Run/Clear on mobile --- */
  .toolbar #run-btn { flex: 1 1 0; padding: 12px 10px; font-size: 0.92rem; }
  .toolbar .kbd { display: none; } /* no Ctrl key on phones */
  .CodeMirror { height: 300px; } /* editor doesn't hog the whole screen */
  .console { font-size: 0.82rem; }

  /* --- learn path --- */
  .track-head { flex-wrap: wrap; row-gap: 5px; }
  .node-label { font-size: 0.85rem; }
  .xp-card { padding: 9px 12px; gap: 10px; }
  .xp-bar { width: 100px; }
  .xp-num { font-size: 1.25rem; }
  .quiz-opt { padding: 14px 13px; } /* easier to tap (>= 48px rows) */
  .blank-row { flex-wrap: wrap; }
  .blank-row .btn { flex: 1 1 100%; }

  /* --- misc --- */
  .toast { width: calc(100% - 32px); max-width: none; text-align: center; }
  .footer-brand img { height: 30px; width: auto; }
}

/* ============ Profile, palette, achievements ============ */
.profile-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.profile-head #profile-avatar svg { box-shadow: 0 4px 18px rgba(108,123,255,.35); }
.dash-card.stat { display: flex; gap: 10px; align-items: center; }
/* P2-60 scoped the compact .stat padding to .stats-row only; the profile
   stat cards restore their own padding here, scoped to #profile-stats,
   so the home stats and practice stats keep theirs. */
#profile-stats .dash-card.stat { padding: 14px 8px; text-align: center; }
.stat-ico { font-size: 1.35rem; }
.pin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 10px; }
.pin-card { display: flex; gap: 8px; align-items: center; background: var(--bg-soft); border: 1px solid var(--card-border); border-radius: 8px; padding: 9px 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .88rem; position: relative; }
.pin-card:hover { border-color: var(--primary); }
.pin-ico { font-size: 1.1rem; }
.pin-x { position: absolute; top: 5px; right: 5px; font-size: .68rem; opacity: .5; }
.pin-x:hover { opacity: 1; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 10px; }
.ach { background: var(--bg-soft); border: 1px solid var(--card-border); border-radius: 8px; padding: 9px 6px; text-align: center; opacity: .45; filter: grayscale(.6); }
.ach.on { opacity: 1; filter: none; border-color: rgba(255, 200, 60, .45); }
.ach-ico { font-size: 1.4rem; display: block; }
.ach-name { font-size: .74rem; font-weight: 700; display: block; margin-top: 4px; }
.ach-prog { font-size: .7rem; color: var(--muted); display: block; margin-top: 3px; font-variant-numeric: tabular-nums; }
.ach-bar { display: block; height: 4px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.ach-bar > span { display: block; height: 100%; background: var(--gradient); border-radius: 999px; }

.feed { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.feed-item { display: flex; gap: 8px; align-items: baseline; padding: 7px 2px; border-bottom: 1px solid var(--card-border); font-size: .88rem; }
.feed-item time { margin-left: auto; white-space: nowrap; }

/* command palette (Cmd+K) */
.palette-backdrop { position: fixed; inset: 0; background: rgba(4,6,18,.6); backdrop-filter: blur(3px); z-index: 200; display: flex; justify-content: center; padding-top: 12vh; }
.palette { width: min(620px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--card-border); border-radius: 10px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.5); max-height: 60vh; display: flex; flex-direction: column; }
.palette input { background: transparent; border: 0; border-bottom: 1px solid var(--card-border); color: var(--text); font-size: 0.98rem; padding: 12px 14px; font-family: inherit; box-shadow: none; }
.palette-list { overflow-y: auto; padding: 6px; }
.palette-item { display: flex; gap: 9px; align-items: center; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: .9rem; color: var(--text); }
.palette-item .p-ico { font-size: 1rem; }
.palette-item .p-kind { margin-left: auto; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.palette-item.active { background: rgba(108,123,255,.16); }
.palette-empty { padding: 18px; text-align: center; color: var(--muted); }

/* mastery bar (segmented, language-share style) */
.mastery-bar { display: flex; height: 9px; border-radius: 6px; overflow: hidden; margin: 8px 0 5px; background: var(--bg-soft); }
.mastery-bar span { display: block; height: 100%; }
.mastery-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.mastery-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

/* reference page */
.ref-layout { display: grid; grid-template-columns: 208px 1fr; gap: 16px; align-items: start; }
.ref-sidebar { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; background: var(--card); border: 1px solid var(--card-border); border-radius: 8px; padding: 8px; }
.ref-sidebar input { width: 100%; box-sizing: border-box; background: var(--bg-soft); border: 1px solid var(--card-border); color: var(--text); border-radius: 6px; padding: 7px 9px; font-size: .84rem; margin-bottom: 6px; }
.ref-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 9px 4px 3px; font-weight: 700; }
.ref-group-head { display: flex; align-items: center; gap: 5px; width: 100%; background: none; border: none; padding: 0; font: inherit; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; cursor: pointer; text-align: left; }
.ref-group-head:hover { color: var(--text); }
.ref-caret { font-size: .62rem; transition: transform .15s ease; }
.ref-group.collapsed .ref-caret { transform: rotate(-90deg); }
.ref-group.collapsed .ref-group-items { display: none; }
.ref-group-items { display: grid; }
.ref-group-head .pill-n { margin-left: auto; font-size: .7rem; opacity: .75; }
.ref-crumb { margin: 0 0 3px; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; }
.ref-related { margin-top: 14px; }
.ref-related h4 { margin: 0 0 6px; font-size: .88rem; }
.rel-chip { font-size: .76rem; padding: 4px 9px; }
.ref-prevnext { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ref-link { display: block; padding: 5px 8px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .86rem; cursor: pointer; }
.ref-link:hover, .ref-link.active { background: rgba(108,123,255,.14); }
.ref-card { background: var(--card); border: 1px solid var(--card-border); border-radius: 10px; padding: 16px; }
.ref-card h2 { margin-top: 0; }
.ref-card code.sig { background: var(--bg-soft); padding: 6px 9px; border-radius: 6px; display: inline-block; font-size: .9rem; }
.ref-example { background: var(--bg-soft); border-radius: 8px; padding: 11px; margin-top: 10px; }
.ref-example pre { margin: 0 0 8px; white-space: pre-wrap; font-size: .85rem; }
.try-row { display: flex; gap: 7px; margin-top: 7px; }
@media (max-width: 820px) { .ref-layout { grid-template-columns: 1fr; } .ref-sidebar { position: static; max-height: 220px; } }
/* ---- Reference v2: overview, detail depth, runner ---- */
.ref-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; align-items: start; }
.ref-ov-card { background: var(--bg-soft); border: 1px solid var(--card-border); border-radius: 8px; padding: 12px; }
.ref-ov-card h3 { margin: 0 0 5px; font-size: 0.95rem; display: flex; align-items: center; gap: 7px; }
.ref-ov-card .pill-n { font-size: .7rem; opacity: .75; }
.ref-ov-card .pill-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.ref-ov-browse { margin-top: 3px; }
.ref-title-row { display: flex; align-items: flex-start; gap: 8px; }
.ref-title-row h2 { flex: 1; margin: 0; }
.ref-fav { background: none; border: 0; font-size: 19px; color: #f5b301; cursor: pointer; padding: 2px 5px; line-height: 1; }
.ref-fav:hover { transform: scale(1.15); }
.ref-level { font-size: .64rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
.ref-level-beginner { background: rgba(46,204,113,.15); color: #2ecc71; }
.ref-level-intermediate { background: rgba(241,196,15,.14); color: #f1c40f; }
.ref-level-advanced { background: rgba(157,107,255,.16); color: #9d6bff; }
.ref-params { margin-top: 10px; }
.ref-params h4, .ref-output h4 { margin: 0 0 6px; font-size: .88rem; }
.ref-params ul { margin: 0; padding-left: 17px; line-height: 1.65; }
.ref-params code { background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; font-size: .86rem; }
.ref-returns { margin-top: 10px; }
.ref-output { background: #0d1117; border: 1px solid var(--card-border); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.ref-output h4 { color: #2ecc71; }
.ref-output pre { margin: 0; white-space: pre-wrap; font-size: .85rem; color: #e6edf3; }
.ref-run-out { background: #0d1117; color: #e6edf3; border: 1px solid var(--card-border); border-radius: 8px; padding: 10px 12px; margin-top: 8px; white-space: pre-wrap; font-size: .85rem; }
.ref-run-status { margin: 6px 0 0; }
.ref-pitfall { margin-top: 10px; background: rgba(241,196,15,.1); border: 1px solid rgba(241,196,15,.35); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: .88rem; }
.ref-lesson { margin-top: 10px; }
.ref-link.kbd { background: rgba(108,123,255,.28); }
.ref-match { font-size: .78rem; }
@media (max-width: 820px) { .ref-overview { grid-template-columns: 1fr; } }

/* ================= Practice Mode ================= */
.ex-card { display: block; text-decoration: none; color: inherit; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.ex-card:hover { transform: translateY(-2px); text-decoration: none; }
.ex-card.mini { padding: 11px; }
.ex-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.ex-card h3 { margin: 4px 0; font-size: 0.98rem; }
.ex-kind { color: var(--muted); font-size: .8rem; margin: 3px 0 8px; }
.ex-diff { color: #f5b301; letter-spacing: 1.5px; font-size: .8rem; }
.badge-done { background: rgba(46, 204, 113, .15); color: #2ecc71; border: 1px solid rgba(46,204,113,.4); }
.badge-try { background: rgba(241, 196, 15, .12); color: #f1c40f; border: 1px solid rgba(241,196,15,.4); white-space: nowrap; }
.code-editor { width: 100%; min-height: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; line-height: 1.55; background: #0d1117; color: #e6edf3; border: 1px solid var(--card-border); border-radius: 8px; padding: 11px; resize: vertical; tab-size: 4; }
.code-editor:focus { outline: 2px solid var(--accent); outline-offset: -1px; box-shadow: none; }
pre.code { background: #0d1117; color: #e6edf3; border: 1px solid var(--card-border); border-radius: 8px; padding: 11px; overflow-x: auto; font-size: .84rem; line-height: 1.6; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.opt-list { display: grid; gap: 6px; margin-top: 10px; }
.opt-btn { text-align: left; justify-content: flex-start; font-family: ui-monospace, monospace; }
.opt-btn.sel { background: var(--gradient); color: #fff; border-color: transparent; }
.test-list { display: grid; gap: 6px; }
.test { border: 1px solid var(--card-border); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; font-size: .86rem; }
.test.pass { border-color: rgba(46,204,113,.5); background: rgba(46,204,113,.07); }
.test.fail { border-color: rgba(231,76,60,.5); background: rgba(231,76,60,.07); }
.test code { background: rgba(127,140,141,.15); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
p.pass { color: #2ecc71; font-weight: 700; }
p.fail { color: #e74c3c; font-weight: 600; }
.hint-box-p { background: var(--card); border-left: 3px solid var(--accent); padding: 8px 11px; border-radius: 0 6px 6px 0; margin: 7px 0; }
.daily-inner { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.daily-inner h3 { margin: 5px 0; }
.stats-row .stat { text-align: center; padding: 14px 8px; }
.stat-n { display: block; font-size: 1.3rem; font-weight: 800; }
.stat-l { font-size: .76rem; color: var(--muted); }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.filter-bar select, .filter-bar input[type="text"] { background: var(--card); color: var(--text); border: 1px solid var(--card-border); border-radius: 6px; padding: 7px 10px; font-size: .86rem; width: auto; }
/* The global input rule sets width: 100% — without these the select
   and search each take a full row. Search grows; the rest stay put. */
.filter-bar select { flex: none; }
.filter-bar input[type="text"] { flex: 1; min-width: 200px; }
.filter-bar .checkline { flex: none; white-space: nowrap; }
.input-sm { background: var(--card); color: var(--text); border: 1px solid var(--card-border); border-radius: 6px; padding: 5px 7px; font-size: .82rem; }
.checkline { display: inline-flex; align-items: center; gap: 5px; font-size: .86rem; color: var(--muted); }
@media (max-width: 720px) { .stats-row { grid-template-columns: repeat(2, 1fr); } .daily-inner { flex-direction: column; align-items: flex-start; } }

/* ---------- Concept map (System 4 of 4) ---------- */
/* All selectors are .cmap- prefixed and scoped under #map-root.
   NEVER a bare node-class rule here — the flowchart proved a bare
   node selector leaks into Mermaid's <g> elements. */
#map-root .cmap-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
#map-root .cmap-search { flex: 1; min-width: 200px; background: var(--card); color: var(--text); border: 1px solid var(--card-border); border-radius: 7px; padding: 8px 11px; font: inherit; font-size: 0.9rem; }
#map-root .cmap-legend { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; }
#map-root .cmap-legend span { display: inline-flex; align-items: center; gap: 5px; }
#map-root .cmap-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--card-border); background: var(--card); }
#map-root .cmap-dot.cmap-state-done { background: linear-gradient(135deg, #fbbf24, #f59e0b); border-color: #fbbf24; }
#map-root .cmap-dot.cmap-state-current { background: var(--gradient); border-color: transparent; }
#map-root .cmap-dot.cmap-state-open { background: rgba(108, 123, 255, 0.3); border-color: var(--accent); }
#map-root .cmap-dot.cmap-state-locked { background: var(--bg-soft); opacity: 0.65; }
#map-root .cmap-dot.cmap-state-weak { background: #fb923c; border-color: #ea580c; }
#map-root .cmap-dot.cmap-state-rusty { background: #a16207; border-color: #854d0e; }
#map-root .cmap-edge-sample { display: inline-block; width: 20px; border-top: 2px dashed #8ea2ff; vertical-align: middle; }
#map-root .cmap-crumb { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; color: var(--muted); }
#map-root .cmap-secpath { position: relative; display: flex; gap: 16px; align-items: flex-start; padding: 14px 4px 26px; overflow: visible; }
#map-root .cmap-lessonpath { position: relative; display: flex; flex-direction: column; align-items: center; padding: 12px 0; overflow: visible; }
#map-root .cmap-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
#map-root .cmap-edge-seq { fill: none; stroke: #7c8cff; stroke-opacity: 0.45; stroke-width: 2.5; stroke-linecap: round; }
#map-root .cmap-edge-cross { fill: none; stroke: #8ea2ff; stroke-width: 2; stroke-dasharray: 7 6; opacity: 0.75; }
#map-root .cmap-secnode, #map-root .cmap-lessonnode { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; cursor: pointer; font: inherit; color: var(--text); background: var(--card); border: 2px solid var(--card-border); box-shadow: var(--shadow); transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease; }
#map-root .cmap-secnode { flex: 1 1 0; min-width: 104px; border-radius: var(--radius); padding: 11px 8px; }
#map-root .cmap-lessonnode { width: min(560px, 92%); border-radius: 8px; padding: 7px 11px; margin: 5px 0; flex-direction: row; justify-content: flex-start; text-align: left; }
#map-root a.cmap-lessonnode, #map-root a.cmap-lessonnode:hover { text-decoration: none; }
#map-root .cmap-secnode:hover:not(:disabled), #map-root .cmap-lessonnode:hover:not(:disabled) { transform: translateY(-2px); }
#map-root .cmap-secnode:focus-visible, #map-root .cmap-lessonnode:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#map-root .cmap-sec-ico { font-size: 1.4rem; line-height: 1; }
#map-root .cmap-sec-name { font-weight: 800; font-size: 0.92rem; }
#map-root .cmap-sec-meta { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
#map-root .cmap-sec-band { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; background: var(--bg-soft); color: var(--muted); white-space: nowrap; }
#map-root .cmap-sec-lock { font-size: 0.76rem; color: var(--muted); line-height: 1.4; }
#map-root .cmap-lesson-ico { font-size: 1rem; width: 22px; text-align: center; flex: none; }
#map-root .cmap-lesson-num { font-weight: 800; color: var(--muted); width: 24px; flex: none; }
#map-root .cmap-lesson-title { font-weight: 600; font-size: 0.88rem; line-height: 1.35; }
#map-root .cmap-state-done { background: linear-gradient(135deg, #fbbf24, #f59e0b); border-color: #fbbf24; color: #3a2b00; }
#map-root .cmap-state-done .cmap-sec-meta, #map-root .cmap-state-done .cmap-lesson-num { color: rgba(58, 43, 0, 0.75); }
#map-root .cmap-state-current { background: var(--gradient); border-color: transparent; color: #fff; animation: cmap-pulse 2.2s infinite; }
#map-root .cmap-state-open { border-color: var(--accent); background: linear-gradient(135deg, rgba(108, 123, 255, 0.16), rgba(108, 123, 255, 0.05)), var(--card); }
#map-root .cmap-state-current .cmap-sec-meta, #map-root .cmap-state-current .cmap-lesson-num { color: rgba(255, 255, 255, 0.85); }
#map-root .cmap-state-locked { background: var(--bg-soft); color: var(--muted); cursor: not-allowed; filter: grayscale(0.7); opacity: 0.65; }
#map-root .cmap-state-weak { border-color: #ea580c; background: linear-gradient(135deg, rgba(251, 146, 60, 0.25), rgba(251, 146, 60, 0.08)), var(--card); }
#map-root .cmap-state-rusty { border-color: #854d0e; border-style: dashed; background: linear-gradient(135deg, rgba(161, 98, 7, 0.28), rgba(161, 98, 7, 0.08)), var(--card); }
#map-root .cmap-band-mastered .cmap-sec-band { background: rgba(52, 211, 153, 0.2); color: #34d399; }
#map-root .cmap-band-solid .cmap-sec-band { background: rgba(34, 211, 238, 0.15); color: #22d3ee; }
#map-root .cmap-band-building .cmap-sec-band { background: rgba(251, 191, 36, 0.18); color: #fbbf24; }
#map-root .cmap-band-starting .cmap-sec-band { background: rgba(248, 113, 113, 0.18); color: #f87171; }
/* Light theme: the bright band colours are 1.5–2.6:1 on their tinted
   backgrounds over a white card. Darkened to the same AA values as the
   light tokens above (4.69 / 5.59 / 5.27 / 4.56:1 on their tints;
   solid uses #056a82, since #067a94 is 4.49:1 on its pale tint). */
[data-theme="light"] #map-root .cmap-band-mastered .cmap-sec-band { color: #0f7a44; }
[data-theme="light"] #map-root .cmap-band-solid .cmap-sec-band { color: #056a82; }
[data-theme="light"] #map-root .cmap-band-building .cmap-sec-band { color: #8a5c00; }
[data-theme="light"] #map-root .cmap-band-starting .cmap-sec-band { color: #c92a2a; }
#map-root .cmap-dim { opacity: 0.25; }
#map-root .cmap-focus { outline: 2px solid var(--accent); outline-offset: 2px; }
#map-root .cmap-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
#map-root .cmap-stat { flex: 1 1 140px; background: var(--card); border: 1px solid var(--card-border); border-radius: 8px; padding: 8px 11px; display: flex; flex-direction: column; gap: 1px; }
#map-root .cmap-stat-val { font-weight: 800; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
#map-root .cmap-stat-lbl { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
#map-root .cmap-lesson-title { flex: 1; }
#map-root .cmap-lesson-review { flex: none; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.03em; color: #ea580c; border: 1px solid #ea580c; border-radius: 999px; padding: 1px 7px; white-space: nowrap; opacity: 0; transition: opacity 0.15s ease; }
#map-root .cmap-lessonnode:hover .cmap-lesson-review, #map-root .cmap-lessonnode:focus-visible .cmap-lesson-review, #map-root .cmap-lessonnode:focus-within .cmap-lesson-review { opacity: 1; }
#map-root .cmap-hint { margin-top: 5px; }
@keyframes cmap-pulse { 0% { box-shadow: 0 0 0 0 rgba(108, 123, 255, 0.55); } 70% { box-shadow: 0 0 0 12px rgba(108, 123, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(108, 123, 255, 0); } }
@media (prefers-reduced-motion: reduce) {
  #map-root .cmap-state-current { animation: none; }
  #map-root .cmap-secnode, #map-root .cmap-lessonnode { transition: none; }
}
@media (max-width: 720px) {
  #map-root .cmap-secpath { flex-direction: column; gap: 12px; }
  #map-root .cmap-secnode { width: 100%; }
  #map-root .cmap-lessonpath { padding: 12px; }
  #map-root .cmap-lessonnode { width: 100%; }
}

/* ============================================================
   Shared components: subject strip, Problem of the Day,
   difficulty pills, data tables, activity heatmap,
   skill-track rows, leaderboard — all on the tokens above.
   ============================================================ */

/* ---------- Subject strip (homepage, under the nav) ---------- */
.subject-strip {
  display: flex; overflow-x: auto; scrollbar-width: none;
  background: var(--bg-soft); border-bottom: 1px solid var(--card-border);
}
.subject-strip::-webkit-scrollbar { display: none; }
.subject-strip a {
  flex: 0 0 auto; padding: 7px 12px; font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.02em; color: var(--muted); border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.subject-strip a:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--primary); }

/* ---------- Problem of the Day card (practice) ---------- */
.potd-card { position: relative; overflow: hidden; }
.potd-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--gradient);
  width: auto; border-radius: 0; opacity: 1;
}
.potd-eyebrow {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.68rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary);
}

/* ---------- Difficulty pills (text + colour, never colour alone) ---------- */
.pill-diff {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.03em; border: 1px solid transparent;
}
.diff-easy { background: rgba(52, 211, 153, 0.13); color: var(--success); border-color: rgba(52, 211, 153, 0.35); }
.diff-med { background: rgba(251, 191, 36, 0.12); color: var(--warning); border-color: rgba(251, 191, 36, 0.35); }
.diff-hard { background: rgba(248, 113, 113, 0.12); color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }

/* ---------- Activity heatmap (dashboard) ---------- */
.heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.heatmap {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 10px);
  gap: 3px; width: max-content;
}
.heat-cell { width: 10px; height: 10px; border-radius: 2px; background: var(--heat-0); }
.heat-cell.l1 { background: var(--heat-1); }
.heat-cell.l2 { background: var(--heat-2); }
.heat-cell.l3 { background: var(--heat-3); }
.heat-cell.l4 { background: var(--heat-4); }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 0.7rem; color: var(--muted); margin-top: 7px; }
.heat-legend .heat-cell { width: 8px; height: 8px; }

/* ---------- Skill-track rows (dashboard) ---------- */
.track-row {
  background: var(--bg-soft); border: 1px solid var(--card-border); border-radius: var(--r-md);
  padding: 8px 11px; margin-top: 8px;
}
.track-row .bar { flex: 1; }

/* ---------- Leaderboard (community full table / dashboard rank) ---------- */
.lb-list { display: flex; flex-direction: column; }
.lb-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border-bottom: 1px solid var(--card-border); border-radius: var(--r-sm);
}
.lb-row:last-child { border-bottom: none; }
.lb-row.me { background: color-mix(in srgb, var(--primary) 12%, transparent); border: 1px solid var(--primary); }
.lb-rank { font-family: var(--font-mono); font-weight: 700; font-size: 0.8rem; color: var(--muted); width: 28px; flex: none; text-align: center; }
.lb-row:nth-child(1) .lb-rank { color: var(--warning); }
.lb-row:nth-child(2) .lb-rank { color: var(--text); }
.lb-row:nth-child(3) .lb-rank { color: var(--accent); }
.lb-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--gradient); color: #fff; font-weight: 800; font-size: 0.72rem;
}
.lb-name { font-weight: 700; font-size: 0.88rem; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name:hover { text-decoration: none; color: var(--primary); }
.lb-meta { font-size: 0.72rem; color: var(--muted); }
.lb-xp { margin-left: auto; font-family: var(--font-mono); font-weight: 700; font-size: 0.84rem; flex: none; }
.lb-pinned { border-top: 2px solid var(--line-2); margin-top: 5px; padding-top: 5px; }
.lb-empty { color: var(--muted); font-size: 0.88rem; padding: 10px 2px; }
.rank-card-num { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.rank-card-num .grad { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Site Controls offline screen (site-gate.js) ----------
   The takeover shown when the admin switches a page (or the whole
   site) OFF. It is a standalone screen, so it keeps the dark brand
   look in every theme: deep-navy backdrop with soft indigo /
   purple / cyan glows, one centred card, an amber OFFLINE pill,
   the page's own alert message, links to pages still ON, and the
   auto-return note. The .so-banner is the admin's bypass strip. */
.so-overlay {
  position: fixed; inset: 0; z-index: 99990; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 28px 18px;
  background:
    radial-gradient(620px 420px at 16% 8%, rgba(108, 123, 255, 0.20), transparent 62%),
    radial-gradient(720px 480px at 86% 94%, rgba(34, 211, 238, 0.13), transparent 62%),
    radial-gradient(520px 340px at 84% 10%, rgba(157, 107, 255, 0.13), transparent 60%),
    #070b1a;
}
.so-card {
  width: 100%; max-width: 540px; text-align: center;
  background: #121a3a; border: 1px solid rgba(139, 152, 255, 0.22);
  border-radius: 18px; padding: 38px 34px 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.so-logo { display: block; width: 74px; height: 74px; margin: 0 auto; }
.so-pill {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.10);
  color: #fbbf24; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.22em;
}
.so-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; flex: none;
  animation: so-pulse 1.8s ease-in-out infinite;
}
@keyframes so-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0); }
}
.so-title { margin: 20px 0 0; font-size: 1.66rem; font-weight: 800; line-height: 1.25; color: #eef1ff; }
.so-grad { background: linear-gradient(92deg, #6c7bff, #9d6bff 55%, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.so-msg { margin: 14px auto 0; max-width: 430px; font-size: 1.05rem; font-weight: 600; line-height: 1.5; color: #dbe1ff; }
.so-sub { margin: 10px auto 0; max-width: 430px; font-size: 0.9rem; line-height: 1.55; color: #98a1c4; }
.so-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 24px; }
.so-foot {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin-top: 26px; padding-top: 18px; border-top: 1px solid rgba(139, 152, 255, 0.16);
  font-size: 0.83rem; line-height: 1.5; color: #98a1c4;
}
.so-spinner {
  flex: none; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(139, 152, 255, 0.3); border-top-color: #22d3ee;
  animation: so-spin 1s linear infinite;
}
@keyframes so-spin { to { transform: rotate(360deg); } }
.so-brand { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.28em; color: #7984ad; }
.so-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 99991;
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 14px; text-align: center;
  background: rgba(30, 24, 6, 0.92); border-bottom: 1px solid rgba(251, 191, 36, 0.45);
  color: #fcd34d; font-size: 0.85rem; font-weight: 600;
}
.so-banner a { color: #fde68a; font-weight: 700; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
  .so-dot, .so-spinner { animation: none; }
}

/* ============================================================
   Visual Upgrade + Performance Layer v3 (24 Nov 2026)
   Appended, override-only: richer graphics and depth on the
   existing hooks, zero layout/behaviour changes. Card grids
   keep the equal-height rule; every animation is disabled
   under prefers-reduced-motion (see the block at the end).
   ============================================================ */

/* --- Richer page atmosphere: layered aurora + fine grid --- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 480px at 88% -80px, color-mix(in srgb, var(--primary-2) 16%, transparent), transparent 62%),
    radial-gradient(760px 420px at -100px 22%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 60%),
    radial-gradient(640px 380px at 55% 108%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(color-mix(in srgb, var(--text) 3.5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 3.5%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 30%, transparent 75%);
}

/* --- Headings & gradient text --- */
.grad, .section-title .grad {
  background: var(--gradient); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.eyebrow { letter-spacing: .14em; font-weight: 700; }
.section-title { letter-spacing: -0.02em; }

/* --- Cards: glass depth + hover lift (transform only = cheap) --- */
.card, .hero-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--text) 4%, var(--card)), var(--card));
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
a.card:hover, .card-link:hover .card, .home-grid .card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--card-border));
  box-shadow: 0 2px 0 rgba(255,255,255,.05) inset, 0 22px 44px -18px rgba(2,4,12,.75);
}

/* --- Buttons: gradient sheen sweep on primary --- */
.btn-primary, .chip-grad {
  background: var(--gradient); position: relative; overflow: hidden; isolation: isolate;
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.35) 50%, transparent 60%);
  transform: translateX(-120%); transition: transform .6s ease;
}
.btn-primary:hover::after { transform: translateX(120%); }
.btn { transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.btn:active { transform: translateY(1px) scale(.99); }

/* --- Hero & code window: framed glow --- */
.hero .code-window, .code-window {
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--card-border));
  box-shadow: 0 30px 60px -24px rgba(2,4,12,.8), 0 0 0 1px rgba(255,255,255,.03) inset,
              0 0 64px -18px color-mix(in srgb, var(--primary-2) 45%, transparent);
}
.cta-banner {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--card)), color-mix(in srgb, var(--primary-2) 12%, var(--card)));
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--card-border));
}
.stat .num {
  background: var(--gradient); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* --- Polish: selection, scrollbar, focus --- */
::selection { background: color-mix(in srgb, var(--primary) 55%, transparent); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
html { scrollbar-color: color-mix(in srgb, var(--primary) 55%, var(--bg-soft)) var(--bg); }

/* --- Performance: skip off-screen rendering work --- */
.section, .home-grid, .faq { content-visibility: auto; contain-intrinsic-size: auto 600px; }
img { content-visibility: auto; }

/* --- Reduced motion: kill the new motion too --- */
@media (prefers-reduced-motion: reduce) {
  .card, .hero-card, .btn, .btn-primary::after { transition: none !important; }
  a.card:hover, .card-link:hover .card, .home-grid .card:hover { transform: none; }
}

/* ============================================================
   Graphics Polish — Wave 4 (25 Nov 2026)
   Appended, override-only, on the existing v3 hooks. No layout
   or behaviour changes; every new rule is colour, border,
   transform or opacity only, and the new hover motion is
   disabled under prefers-reduced-motion (see the block below).
   ============================================================ */

/* --- Shared .chip: three pages defined it locally (index,
   admin, compiler) but review.js renders .chip spans on Learn
   and Dashboard, where no definition existed — unstyled text.
   This global base matches admin's de facto definition; the
   page-local blocks load later, so their own chip looks are
   untouched. Theme tokens only, so it works in light + dark. --- */
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; color: var(--muted);
  background: var(--bg-soft); border: 1px solid var(--card-border);
  white-space: nowrap;
}
.chip.ok { color: var(--success); }
.chip.warn { color: var(--warning); }
.chip.bad { color: var(--danger); }
/* Hover only where a chip is actually interactive (a/button);
   static status pills stay still. Transform/colour only. */
a.chip:hover, button.chip:hover {
  color: var(--text); border-color: var(--primary); text-decoration: none;
  transform: translateY(-1px);
}
/* Non-interactive pill chips share the .pill hover treatment
   only when they are buttons (reference .rel-chip already is a
   .pill button, so it inherits .pill:hover); plain spans keep
   their quiet look. */

/* --- Empty states: one centred treatment. .palette-empty
   (command palette) and the compiler's .empty-note were already
   centred with breathing room; .lb-empty (leaderboard, used on
   Dashboard + Community) was left-aligned with 2px side padding.
   Centring it matches its siblings; loading text reads the same. --- */
.lb-empty { text-align: center; padding: 14px 10px; }

/* --- Light theme: v3 restyled .cta-banner (index, about) to a
   pale tinted card but kept the base white text — white on
   near-white in light theme (~1.4:1). Dark theme keeps the v3
   tint (white text is legible on the dark card); light theme
   restores the brand gradient behind the white text, as before v3. --- */
[data-theme="light"] .cta-banner { background: var(--gradient); }

/* --- Reduced motion: kill the Wave 4 hover motion too --- */
@media (prefers-reduced-motion: reduce) {
  a.chip:hover, button.chip:hover { transform: none; }
}

/* --- Wave 5 utilities: deduped from verbatim-repeated inline styles.
   Single-class utilities, appended last so they win equal-specificity
   ties (e.g. .pt-24 over .section's padding, .m-0 over .hint's margin). --- */
.pt-24 { padding-top: 24px; }
.pt-0 { padding-top: 0; }
.mt-8 { margin-top: 8px; }
.m-0 { margin: 0; }
.c-text { color: var(--text); }

/* --- Session 2, Wave 1 (28 Nov 2026): light-theme badge contrast.
   .badge-done #2ecc71 / .badge-try #f1c40f pass on dark (8.1/10.2:1)
   but fail on light surfaces (2.1/1.7:1). Light theme reuses the
   Wave-2 success/warning tokens (>=4.9:1 on bg and card). --- */
[data-theme="light"] .badge-done { color: #0f7a44; border-color: rgba(15, 122, 68, .45); }
[data-theme="light"] .badge-try { color: #8a5c00; border-color: rgba(138, 92, 0, .45); }
