/* Sketch Academy — design tokens first, then components.
   Motion follows a few rules: ease-out for anything entering, exact properties
   (never `transition: all`), press feedback on every pressable thing, hover
   effects only on fine pointers, and reduced motion keeps opacity only. */
:root {
  --paper: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --ink: #17171a;
  --ink-2: #3d3d44;
  --muted: #6e6c75;
  --faint: #a3a1a8;
  --ring: rgba(23, 23, 26, 0.08);
  --ring-strong: rgba(23, 23, 26, 0.16);
  --accent: #2a5bd7;
  --accent-soft: rgba(42, 91, 215, 0.09);
  --good: #16803c;
  --good-soft: rgba(22, 128, 60, 0.1);
  --bad: #c2341d;
  --bad-soft: rgba(194, 52, 29, 0.09);
  --hint: #fff4d6;
  --hint-ink: #5c4700;

  --lvl-none: transparent;
  --lvl-attempted: #f2a091;
  --lvl-familiar: #f4c34f;
  --lvl-proficient: #86a9f2;
  --lvl-mastered: #2a3f9e;

  --shadow-1: 0 0 0 1px var(--ring), 0 1px 2px rgba(23, 23, 26, 0.04);
  --shadow-2: 0 0 0 1px var(--ring), 0 2px 4px rgba(23, 23, 26, 0.04), 0 8px 24px rgba(23, 23, 26, 0.06);
  --shadow-pop: 0 0 0 1px var(--ring), 0 12px 32px rgba(23, 23, 26, 0.14), 0 2px 6px rgba(23, 23, 26, 0.06);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}
/* Colors follow the device unless the learner picks Light or Dark (data-theme
   on <html>, set by theme.js and the script in index.html). */
:root[data-theme="dark"] {
  --paper: #121214;
  --surface: #1b1b1f;
  --surface-2: #17171a;
  --ink: #f1f0ee;
  --ink-2: #cfcdd3;
  --muted: #9b99a1;
  --faint: #6a6870;
  --ring: rgba(255, 255, 255, 0.08);
  --ring-strong: rgba(255, 255, 255, 0.18);
  --accent: #7ea2ff;
  --accent-soft: rgba(126, 162, 255, 0.12);
  --good: #4cc477;
  --good-soft: rgba(76, 196, 119, 0.12);
  --bad: #ff7a64;
  --bad-soft: rgba(255, 122, 100, 0.12);
  --hint: #2e2810;
  --hint-ink: #f3d98a;
  --lvl-mastered: #6f8cff;
  --shadow-1: 0 0 0 1px var(--ring);
  --shadow-2: 0 0 0 1px var(--ring), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 0 0 1px var(--ring-strong), 0 16px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121214;
    --surface: #1b1b1f;
    --surface-2: #17171a;
    --ink: #f1f0ee;
    --ink-2: #cfcdd3;
    --muted: #9b99a1;
    --faint: #6a6870;
    --ring: rgba(255, 255, 255, 0.08);
    --ring-strong: rgba(255, 255, 255, 0.18);
    --accent: #7ea2ff;
    --accent-soft: rgba(126, 162, 255, 0.12);
    --good: #4cc477;
    --good-soft: rgba(76, 196, 119, 0.12);
    --bad: #ff7a64;
    --bad-soft: rgba(255, 122, 100, 0.12);
    --hint: #2e2810;
    --hint-ink: #f3d98a;
    --lvl-mastered: #6f8cff;
    --shadow-1: 0 0 0 1px var(--ring);
    --shadow-2: 0 0 0 1px var(--ring), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 0 0 1px var(--ring-strong), 0 16px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
p { max-width: 65ch; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.75rem, 3.2vw, 2.25rem); letter-spacing: -0.025em; font-weight: 700; }
h2 { font-size: 1.15rem; letter-spacing: -0.015em; font-weight: 650; }
h3 { font-size: 1rem; letter-spacing: -0.01em; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.num, .stat, .big-num, .best, .vb-time, .score-ring span { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 max(20px, calc((100vw - 1120px) / 2));
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  box-shadow: 0 1px 0 var(--ring);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.logo-mark {
  display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 8px; background: var(--ink); color: var(--paper);
  font-size: 15px; transform: rotate(-6deg);
}
.search { flex: 1; max-width: 380px; margin-left: 8px; }
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px; border: 0; border-radius: 10px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m14 14-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px 50%;
  box-shadow: var(--shadow-1); color: var(--ink); font: inherit;
  transition: box-shadow 150ms ease;
}
.search input:focus { outline: none; box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
#stats { display: flex; gap: 2px; }
.stat { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border-radius: 8px; font-weight: 600; font-size: 0.88rem; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-1); font-size: 1rem; }

/* Subjects popover grows from its trigger (top-left). */
.subjects-menu {
  position: absolute; top: calc(100% + 6px); left: max(20px, calc((100vw - 1120px) / 2));
  width: min(1080px, calc(100vw - 40px)); max-height: min(70vh, 640px); overflow: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px 16px;
  padding: 22px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-pop);
  transform-origin: top left;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), visibility 0s linear 180ms;
}
.subjects-menu:not([data-open]) { opacity: 0; transform: scale(0.97) translateY(-4px); visibility: hidden; pointer-events: none; }
.subjects-menu[data-open] { transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
.menu-col { display: flex; flex-direction: column; gap: 1px; font-size: 0.88rem; }
.menu-col a { padding: 4px 8px; margin: 0 -8px; border-radius: 6px; color: var(--ink-2); }
.menu-subject { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--ink) !important; margin-bottom: 4px !important; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); flex-shrink: 0; }

main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; }
.route-enter { animation: route-in 200ms var(--ease-out) both; }
@keyframes route-in { from { opacity: 0; } }
.foot { max-width: 1120px; margin: 0 auto; padding: 32px 20px 48px; color: var(--faint); font-size: 0.8rem; }
.foot a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border: 0; border-radius: 10px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1);
  font: inherit; font-size: 0.9rem; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}
.btn:active:not(:disabled), .choice:active:not(.locked), .course-card:active, .tab:active, .vb:active, .seg:active { transform: scale(0.97); }
.btn.primary { background: var(--ink); color: var(--paper); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.btn.accent { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.small { height: 30px; padding: 0 10px; font-size: 0.82rem; border-radius: 8px; }
.btn.big { height: 44px; padding: 0 20px; font-size: 0.95rem; border-radius: 12px; }
.btn.danger { color: var(--bad); }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 0.72rem; font-weight: 650; letter-spacing: 0.02em; text-transform: uppercase;
  background: var(--accent-soft); color: var(--accent);
}
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 24px; }
.notice { max-width: 560px; margin: 40px auto; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--ring-strong), 0 1px 2px rgba(23, 23, 26, 0.06); }
  .btn.primary:hover:not(:disabled) { opacity: 0.88; }
  .btn.ghost:hover:not(:disabled) { background: var(--ring); box-shadow: none; }
  .stat:hover, .menu-col a:hover { background: var(--ring); }
  .course-card:hover { box-shadow: var(--shadow-2); }
  .lesson-row:hover { box-shadow: 0 0 0 1px var(--ring-strong), 0 2px 8px rgba(23, 23, 26, 0.05); }
  .unit-card:hover { box-shadow: var(--shadow-2); }
  .search-hit:hover { background: var(--surface-2); }
  .choice:hover:not(.locked) { box-shadow: 0 0 0 1.5px var(--ring-strong); }
  .skill-row a:hover { transform: scale(1.12); }
}

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 40px; align-items: center; padding: 12px 0 40px; }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.2rem); letter-spacing: -0.035em; line-height: 1.04; max-width: 15ch; }
.hero p { color: var(--ink-2); font-size: 1.02rem; margin: 16px 0 22px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-art { min-height: 220px; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-2); background: #fffdf7; }
.hero-stats { display: flex; gap: 24px; margin-top: 28px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.4rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: 0.8rem; color: var(--muted); }
.subject-block { padding-top: 28px; }
.subject-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.subject-head h2 { display: flex; align-items: center; gap: 10px; }
.subject-head a.more { font-size: 0.85rem; color: var(--muted); }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.course-grid.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.course-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 16px 16px 14px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1);
  transition: box-shadow 200ms ease, transform 160ms var(--ease-out);
}
.course-card strong { font-weight: 650; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.unit-mini { margin: 6px 0 4px; padding-left: 16px; color: var(--muted); font-size: 0.84rem; }

/* ---------- Mastery ---------- */
.mbar { display: flex; height: 6px; border-radius: 99px; background: var(--ring); overflow: hidden; margin-top: 8px; }
.mbar span { height: 100%; }
.mbar-mastered { background: var(--lvl-mastered); }
.mbar-proficient { background: var(--lvl-proficient); }
.mbar-familiar { background: var(--lvl-familiar); }
.mbar-attempted { background: var(--lvl-attempted); }
.lvl { display: inline-block; width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; background: var(--lvl-none); box-shadow: inset 0 0 0 1.5px var(--ring-strong); transition: transform 160ms var(--ease-out); }
.lvl.big { width: 24px; height: 24px; border-radius: 6px; }
.lvl-attempted { background: var(--lvl-attempted); box-shadow: none; }
.lvl-familiar { background: var(--lvl-familiar); box-shadow: none; }
.lvl-proficient { background: var(--lvl-proficient); box-shadow: none; }
.lvl-mastered { background: var(--lvl-mastered); box-shadow: none; }
.lvl-label { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; background: var(--surface); box-shadow: var(--shadow-1); }
.lvl-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lvl-c, var(--faint)); }
.lvl-label.lvl-attempted { --lvl-c: var(--lvl-attempted); }
.lvl-label.lvl-familiar { --lvl-c: var(--lvl-familiar); }
.lvl-label.lvl-proficient { --lvl-c: var(--lvl-proficient); }
.lvl-label.lvl-mastered { --lvl-c: var(--lvl-mastered); }
.lvl-label.lvl-attempted, .lvl-label.lvl-familiar, .lvl-label.lvl-proficient, .lvl-label.lvl-mastered { background: var(--surface); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.78rem; color: var(--muted); align-items: center; margin-top: 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .lvl { width: 11px; height: 11px; border-radius: 3px; }

/* ---------- Breadcrumbs ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.84rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--faint); }

/* ---------- Course page ---------- */
.course-head { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; margin-bottom: 8px; }
.course-head h1 { margin-bottom: 6px; }
.challenge-card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: var(--r-lg);
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow-2);
  transition: transform 160ms var(--ease-out);
}
.challenge-card:active { transform: scale(0.98); }
.challenge-card span { font-size: 0.88rem; opacity: 0.75; }
.course-map { margin: 22px 0 6px; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); background: #fffdf7; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; margin-top: 18px; }
.unit-card { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); transition: box-shadow 200ms ease; }
.unit-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.unit-head .eyebrow { display: block; font-size: 0.74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.skill-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- Unit page ---------- */
.page-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.page-head .mbar { max-width: 420px; }
.lesson-list { display: flex; flex-direction: column; gap: 6px; }
.lesson-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 12px 12px 12px 16px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1);
  transition: box-shadow 200ms ease;
}
.lesson-row .lesson-title { font-weight: 600; letter-spacing: -0.005em; overflow-wrap: anywhere; }
.lesson-row .lesson-meta { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.assess-card {
  display: flex; gap: 14px; align-items: center; padding: 14px 16px; margin: 6px 0 12px; border-radius: var(--r);
  background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
  transition: transform 160ms var(--ease-out);
}
.assess-card:active { transform: scale(0.99); }
.assess-card .ac-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-1); font-size: 1.05rem; }
.assess-card .ac-text { display: flex; flex-direction: column; min-width: 0; }
.assess-card .ac-text span { font-size: 0.84rem; color: var(--muted); }
.assess-card.test { background: color-mix(in srgb, #7c5cf0 10%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #7c5cf0 26%, transparent); }
.assess-card .best { margin-left: auto; font-weight: 650; font-size: 0.85rem; color: var(--good); }
.unit-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 32px; }
.unit-nav .btn { max-width: 48%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Lesson page ---------- */
.lesson-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 14px; border-radius: 11px; background: var(--ring); }
.tab { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.tab.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.lesson-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
@media (max-width: 1180px) { .lesson-grid { grid-template-columns: 1fr; } .side { position: static !important; display: grid !important; grid-template-columns: 1fr 1fr; } }
.about { padding: 18px 0 0; }
.about h3 { margin-bottom: 6px; }
.about p { color: var(--ink-2); margin: 6px 0 12px; }
.side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 76px; }
.side .card { padding: 18px; }
.side .btn { width: 100%; }
.side .side-title { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.up-next { display: flex; flex-direction: column; gap: 2px; }
.up-next a { display: flex; gap: 8px; align-items: center; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; font-size: 0.88rem; color: var(--ink-2); }
.up-next a.cur { background: var(--ring); color: var(--ink); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .up-next a:hover { background: var(--ring); } }

/* ---------- Sketch explainer ---------- */
.video { border-radius: var(--r-lg); overflow: hidden; background: #f4f1e8; box-shadow: var(--shadow-2); color: #21242c; }
.video:fullscreen { display: flex; flex-direction: column; justify-content: center; border-radius: 0; background: #f4f1e8; }
.video:fullscreen .desk { flex: 1; aspect-ratio: auto; }
/* The desk: cream paper with a dot grid and a soft vignette. */
.desk {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background:
    radial-gradient(ellipse at center, rgba(255, 253, 245, 0) 55%, rgba(120, 105, 70, 0.14) 100%),
    radial-gradient(circle, rgba(60, 50, 30, 0.16) 1px, transparent 1.3px) 0 0 / 22px 22px,
    #f6f3ea;
}
.camera { position: absolute; inset: 0; transform-origin: 0 0; transition: transform 1100ms var(--ease-in-out); will-change: transform; }
.sheet-wrap { position: absolute; inset: 6% 9%; transform: rotate(var(--rot, 0deg)); filter: drop-shadow(0 10px 14px rgba(60, 45, 20, 0.18)) drop-shadow(0 1px 2px rgba(60, 45, 20, 0.2)); }
.sheet { position: absolute; inset: 0; display: grid; place-items: center; padding: 3% 4%; }
.sheet-graph { background: linear-gradient(rgba(70, 70, 70, 0.11) 1px, transparent 1px) 0 0 / 26px 26px, linear-gradient(90deg, rgba(70, 70, 70, 0.11) 1px, transparent 1px) 0 0 / 26px 26px, #f3eee2; }
.sheet-kraft { background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.18), transparent 60%), #d8c09a; }
.sheet-note { background: linear-gradient(160deg, #fff3b0, #f7e48c); }
.sheet-lined { background: linear-gradient(transparent 27px, rgba(80, 120, 200, 0.22) 28px) 0 14px / 100% 28px, #fbfaf5; }
.tape { position: absolute; width: 16%; height: 9%; background: rgba(236, 222, 186, 0.78); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.tape-l { top: -3%; left: 6%; transform: rotate(-8deg); }
.tape-r { top: -3%; right: 7%; transform: rotate(6deg); }
.video-sketch { width: 100%; height: 100%; display: grid; place-items: center; }
.video-sketch .frame, .video-sketch .canvas { background: transparent !important; box-shadow: none !important; border: 0 !important; padding: 0 !important; margin: 0 !important; width: auto; height: auto; min-height: 0 !important; overflow: visible; }
.video-sketch .canvas { display: grid; place-items: center; }
.video-sketch svg { min-width: 0 !important; max-width: none; max-height: none; display: block; }
.video-sketch svg > rect:first-of-type { fill: transparent; }
.video-sketch .stepper, .video-sketch .toolbar, .video-sketch .attribution { display: none !important; }
/* The pencil: its tip sits on the point being drawn. */
.pencil { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity 250ms ease; }
.pencil.on { opacity: 1; }
.pencil-body { position: absolute; left: 0; top: 0; display: flex; align-items: center; width: 230px; height: 13px; transform-origin: 0 50%; transform: rotate(-36deg) translateY(-50%); filter: drop-shadow(14px 18px 6px rgba(40, 30, 10, 0.22)); }
.pencil-tip { width: 22px; height: 13px; background: linear-gradient(90deg, #555 0 30%, #e9d3ae 30%); clip-path: polygon(0 50%, 100% 0, 100% 100%); }
.pencil-wood { flex: 1; height: 13px; border-radius: 0 2px 2px 0; background: linear-gradient(#3a3a3e, #121214 55%, #26262a); }
.pencil-band { position: absolute; left: 70px; width: 6px; height: 13px; background: #f5c518; }
.pencil-end { width: 8px; height: 13px; border-radius: 0 4px 4px 0; background: #2b2b2f; }
.big-play { position: absolute; inset: 0; margin: auto; width: 76px; height: 76px; border: 0; border-radius: 50%; background: #17171a; color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); transition: transform 160ms var(--ease-out); z-index: 4; }
.big-play .ic { margin-left: 4px; }
.big-play:active { transform: scale(0.95); }
/* Checkpoint card over the paper. */
.checkpoint { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(246, 243, 234, 0.55); backdrop-filter: blur(2px); animation: route-in 200ms var(--ease-out) both; }
.cp-card { width: min(460px, 86%); padding: 20px 22px; border-radius: 16px; background: #fff; box-shadow: 0 16px 40px rgba(40, 30, 10, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05); color: #17171a; }
.cp-eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #b8860b; margin-bottom: 6px; }
.cp-prompt { font-size: 1.05rem; margin-bottom: 14px; }
.cp-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-row .answer { flex: 1; min-width: 120px; width: auto; height: 40px; background: #f7f6f2; color: #17171a; }
.cp-fb { min-height: 20px; margin-top: 10px; font-size: 0.9rem; font-weight: 600; }
.cp-fb.good { color: #16803c; }
.cp-fb.bad { color: #c2341d; }
.video-caption { min-height: 54px; padding: 12px 18px; font-size: 0.98rem; line-height: 1.5; background: #fffdf7; box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.06); color: #2c2c33; }
.video-caption strong { margin-right: 4px; color: #17171a; }
.muted-cap { color: #8a877e; }
.cap-step { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 6px; background: #17171a; color: #fff; font-size: 0.74rem; font-weight: 650; vertical-align: 2px; }
.cap-words { font-size: 1.05rem; }
.cw { color: #8a877e; transition: color 120ms ease; }
.cw.said { color: #2c2c33; }
.cw.now { color: #17171a; text-decoration: underline; text-decoration-color: #f5c518; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.video-bar { display: flex; align-items: center; gap: 2px; height: 50px; padding: 0 10px; background: #17171a; color: #fff; }
.ic { display: inline-grid; place-items: center; line-height: 0; }
.vb { display: grid; place-items: center; height: 34px; min-width: 34px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: rgba(255, 255, 255, 0.85); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.vb.on { color: #fff; }
.vb.text { font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .vb:hover { background: rgba(255, 255, 255, 0.12); color: #fff; } }
.vb.play { width: 36px; height: 36px; border-radius: 50%; background: #fff; color: #17171a; }
.vb-status { font-size: 0.74rem; color: rgba(255, 255, 255, 0.6); white-space: nowrap; padding: 0 6px; font-variant-numeric: tabular-nums; }
.vb-voice { max-width: 130px; height: 30px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.1); color: #fff; font: inherit; font-size: 0.78rem; padding: 0 6px; }
.vb-track { flex: 1; display: flex; gap: 3px; padding: 0 10px; }
.vb-track .seg { flex: 1; height: 4px; padding: 0; border: 0; border-radius: 99px; background: rgba(255, 255, 255, 0.22); cursor: pointer; transition: background-color 250ms ease, transform 160ms var(--ease-out); }
.vb-track .seg.on { background: #f5c518; }
.vb-time { min-width: 44px; text-align: right; font-size: 0.8rem; opacity: 0.7; }
@media (max-width: 640px) { .vb-voice, .vb.text { display: none; } .pencil-body { width: 150px; } }

/* ---------- Assessments ---------- */
.assess-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.assess-title { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1.05rem; letter-spacing: -0.01em; min-width: 0; }
.dots { display: flex; gap: 4px; margin-left: auto; }
.qdot { width: 24px; height: 6px; border-radius: 99px; background: var(--ring-strong); transition: background-color 250ms ease; }
.qdot.cur { background: var(--ink); }
.qdot.ok { background: var(--good); }
.qdot.bad { background: var(--bad); }
.qdot.help { background: color-mix(in srgb, var(--good) 40%, var(--ring-strong)); }
.streak-run { font-weight: 650; font-size: 0.88rem; color: #d9480f; }
.assess-body { display: grid; gap: 14px; }
.question { max-width: 760px; padding: 28px; }
.q-skill { font-size: 0.74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.q-prompt { font-size: 1.18rem; line-height: 1.5; letter-spacing: -0.01em; margin: 4px 0 22px; max-width: 60ch; }
.answer-row { display: flex; align-items: center; gap: 10px; }
.answer {
  width: 240px; height: 48px; padding: 0 14px; border: 0; border-radius: 12px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--ring-strong); color: var(--ink);
  font: inherit; font-size: 1.15rem; font-variant-numeric: tabular-nums;
  transition: box-shadow 150ms ease;
}
.answer:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-soft); }
.answer.right { box-shadow: inset 0 0 0 2px var(--good); }
.answer.wrong { box-shadow: inset 0 0 0 2px var(--bad); }
.unit { font-weight: 600; color: var(--muted); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; gap: 12px; align-items: center; min-height: 52px; padding: 10px 14px; text-align: left;
  border: 0; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--ring); color: var(--ink);
  font: inherit; cursor: pointer;
  transition: box-shadow 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out);
}
.choice.locked { cursor: default; }
.choice.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.choice.right { background: var(--good-soft); box-shadow: inset 0 0 0 2px var(--good); }
.choice.wrong { background: var(--bad-soft); box-shadow: inset 0 0 0 2px var(--bad); }
.choice-letter { display: grid; place-items: center; width: 26px; height: 26px; flex-shrink: 0; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-1); font-weight: 650; font-size: 0.78rem; }
.feedback { min-height: 0; margin: 16px 0 0; }
.feedback:empty { margin: 0; }
.fb { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; animation: fb-in 220ms var(--ease-out) both; }
@keyframes fb-in { from { opacity: 0; transform: translateY(4px); } }
.fb strong { font-weight: 650; }
.fb.good { background: var(--good-soft); color: var(--good); }
.fb.bad { background: var(--bad-soft); color: var(--bad); }
.fb.info { background: var(--ring); color: var(--ink-2); }
.fb .explain { color: var(--ink-2); }
.hints { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.hints:empty { margin: 0; }
.hint { padding: 10px 14px; border-radius: 12px; background: var(--hint); color: var(--hint-ink); animation: fb-in 220ms var(--ease-out) both; }
.hint-sketch { border-radius: 12px; overflow: hidden; background: #fffdf7; box-shadow: var(--shadow-1); }
.hint-sketch .stepper { display: none !important; }
.q-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 24px; padding-top: 18px; box-shadow: 0 -1px 0 var(--ring); }
.q-actions .left, .q-actions .right { display: flex; gap: 4px; flex-wrap: wrap; }
.q-actions .right { margin-left: auto; }
.q-video:not(:empty) { margin-top: 18px; }
.pad { max-width: 760px; border-radius: var(--r-lg); overflow: hidden; background: #fffdf7; box-shadow: var(--shadow-2); }
.pad-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; background: var(--surface); box-shadow: 0 1px 0 var(--ring); color: var(--ink); font-size: 0.86rem; }

.summary { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.summary h2 { font-size: 1.5rem; letter-spacing: -0.02em; margin-top: 4px; }
.summary-chart { width: 100%; border-radius: var(--r); overflow: hidden; background: #fffdf7; box-shadow: var(--shadow-1); margin: 4px 0 8px; }
.changes { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; margin: 10px 0 4px; }
.change { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; }
.change:nth-child(odd) { background: var(--surface-2); }
.change-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.summary .q-actions { width: 100%; }

/* ---------- Tutor ---------- */
.tutor {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  width: min(380px, calc(100vw - 32px)); height: min(540px, calc(100vh - 92px));
  display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-pop);
  transform-origin: bottom right;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  @starting-style { opacity: 0; transform: scale(0.96) translateY(8px); }
}
.tutor-head { display: flex; align-items: center; gap: 6px; height: 52px; padding: 0 8px 0 16px; box-shadow: 0 1px 0 var(--ring); }
.tutor-head .x { margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; }
.tutor-list { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bubble { padding: 9px 13px; border-radius: 14px; max-width: 86%; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; }
.bubble.user { align-self: flex-end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; }
.bubble.assistant { align-self: flex-start; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ring); border-bottom-left-radius: 4px; }
.tutor-form { display: flex; gap: 8px; padding: 10px; box-shadow: 0 -1px 0 var(--ring); }
.tutor-form textarea { flex: 1; resize: none; font: inherit; font-size: 0.92rem; padding: 9px 11px; border: 0; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ring-strong); color: var(--ink); }
.tutor-form textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent); }
.tutor-form .btn { height: auto; }
.pad1 { padding: 18px; }

/* ---------- Profile ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 18px 0 8px; }
.stat-card { display: flex; flex-direction: column; gap: 2px; padding: 18px; color: var(--muted); font-size: 0.84rem; }
.big-num { color: var(--ink); font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; }
.section-title { margin: 36px 0 12px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px; border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--ring); opacity: 0.5; }
.badge.earned { opacity: 1; background: var(--surface); box-shadow: var(--shadow-1); }
.badge:not(.earned) .badge-icon { filter: grayscale(1); }
.badge strong { font-size: 0.9rem; font-weight: 650; }
.badge-icon { font-size: 1.6rem; margin-bottom: 6px; }
.activity { display: flex; flex-direction: column; }
.profile-chart { border-radius: var(--r-lg); overflow: hidden; background: #fffdf7; box-shadow: var(--shadow-1); }

/* ---------- Search ---------- */
.search-results { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.search-hit { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 2px 12px; align-items: center; padding: 10px 14px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); transition: background-color 150ms ease; }
.search-hit .tag { grid-row: span 2; justify-self: start; }
.search-empty { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.search-empty h2 { font-size: 1rem; margin: 14px 0 0; }
.search-empty a:not(.search-hit) { color: var(--accent); font-weight: 600; text-decoration: underline; }
.search-hit strong { font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Misc ---------- */
.loading { display: flex; align-items: center; gap: 10px; padding: 48px 20px; color: var(--muted); justify-content: center; font-size: 0.9rem; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ring-strong); border-top-color: var(--ink); animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 0.9rem; box-shadow: var(--shadow-pop);
  transform: translate(-50%, 0); opacity: 1;
  transition: opacity 400ms ease, transform 400ms ease;
  @starting-style { opacity: 0; transform: translate(-50%, 100%); }
}
.toast.out { opacity: 0; transform: translate(-50%, 100%); transition-duration: 250ms; }

/* Sketchy frames inside our cards: let the paper show. */
.sketchy { --sketchy-radius: 0; }
/* Sketches draw dark ink baked into the SVG, so their sheet stays paper-light in
   dark mode too. Sketchy reads these variables, and the site's dark theme would
   otherwise hand it a near-black --paper and leave loose text unreadable. */
.frame { --paper: #fffdf7; --line: #e7e2d6; --ink: #1d1d1f; --ink-soft: #5c5f66; color-scheme: light; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-property: opacity, background-color, color !important; }
  .btn:active, .choice:active, .course-card:active, .tab:active { transform: none !important; }
}

@media (max-width: 860px) {
  .lesson-grid, .course-head, .hero { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 640px) {
  .top { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .search { order: 5; flex-basis: 100%; max-width: none; margin: 0; }
  .top-right { min-width: 0; gap: 2px; } /* fits Review, counters, Log in, Sign up at 320px */
  main { padding: 18px 16px 60px; }
  .lesson-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .lesson-row .btn.ghost { display: none; }
  .answer { width: 100%; }
  .question { padding: 20px; }
  .dots { margin-left: 0; }
  .subjects-menu { left: 16px; width: calc(100vw - 32px); }
}

/* Charts and maps are for reading, not marking up. */
.summary-chart .toolbar, .profile-chart .toolbar, .course-map .toolbar, .hero-art .toolbar, .hint-sketch .toolbar { display: none !important; }
.summary-chart svg { min-width: 0 !important; width: 100%; max-height: 240px; }
.profile-chart svg { min-width: 0 !important; width: 100%; max-height: 360px; }

/* ================= Academy flows ================= */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; animation-timing-function: var(--ease-out); }
.route-enter { animation: none; }
.eyebrow { display: block; font-size: 0.74rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.section-title { margin: 40px 0 14px; }
.pad-l { padding: 22px 24px; margin: 18px 0; }
.pad-l h2 { margin-bottom: 12px; }
.stat .ic, .btn .ic { flex-shrink: 0; }
.stat { color: var(--ink-2); }

/* Course and unit pages: sidebar + main */
.with-nav { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; align-items: start; }
.nav-main { min-width: 0; }
.course-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 1px; max-height: calc(100vh - 96px); overflow: auto; padding-right: 4px; }
.cn-head { display: flex; align-items: center; gap: 8px; font-size: 1rem; letter-spacing: -0.01em; }
.cn-sub { margin: 2px 0 12px 16px; }
.cn-link { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); font-size: 0.88rem; transition: background-color 150ms ease; }
.cn-link.on { background: var(--surface); box-shadow: var(--shadow-1); color: var(--ink); font-weight: 600; }
.cn-unit { font-size: 0.7rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.cn-challenge { flex-direction: row; align-items: center; gap: 8px; margin-top: 8px; font-weight: 600; color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .cn-link:not(.on):hover { background: var(--ring); } }
.course-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 20px; align-items: center; }
.mastery-panel .mp-top { display: flex; align-items: baseline; gap: 8px; }
.mastery-panel .mp-top strong { font-size: 1.4rem; letter-spacing: -0.02em; }
.mastery-panel .mbar { height: 10px; margin: 10px 0 4px; }
.legend .num { margin-left: 2px; }

/* Up next */
.upnext-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-2); margin: 18px 0; }
.course-top .upnext-card { margin: 0; }
.un-eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.un-row { display: flex; align-items: center; gap: 12px; }
.un-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.un-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.un-text strong { overflow-wrap: anywhere; }
.dashboard .page-head { margin-bottom: 18px; }
.my-courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.my-course { padding: 20px; }
.mc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.my-course .upnext-card { box-shadow: none; padding: 12px 0 0; margin: 6px 0 0; background: transparent; }
.review-banner { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 14px 18px; border-radius: var(--r-lg); background: var(--ink); color: var(--paper); transition: transform 160ms var(--ease-out); }
.review-banner span:nth-child(2) { flex: 1; }
.review-banner:active { transform: scale(0.99); }

/* Course challenge */
.challenge-card { flex-direction: row; align-items: center; gap: 14px; margin-top: 18px; padding: 18px 20px; }
.challenge-card .cc-icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.12); }
.challenge-card .cc-text { display: flex; flex-direction: column; flex: 1; gap: 2px; }
.challenge-card .btn { background: var(--paper); color: var(--ink); box-shadow: none; }

/* Unit page lessons */
.skill-block { padding: 16px 18px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); }
.skill-block.soon { opacity: 0.6; }
.sb-head { display: flex; flex-direction: column; margin-bottom: 10px; }
.sb-num { font-size: 0.72rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.sb-items { display: flex; flex-direction: column; gap: 4px; }
.sb-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin: 0 -10px; border-radius: 10px; color: var(--ink); }
.sb-item > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sb-item strong { font-weight: 600; overflow-wrap: anywhere; }
.sb-icon { display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; background: var(--ring); color: var(--ink-2); }
.sb-icon.done { background: var(--good-soft); color: var(--good); }
.sb-item.practice .lvl { width: 30px; height: 30px; border-radius: 8px; }
@media (hover: hover) and (pointer: fine) { a.sb-item:hover { background: var(--surface-2); } }
.assess-card { margin: 4px 0 8px; }
.assess-card.soon { opacity: 0.55; }
.assess-card .btn { margin-left: auto; }
.assess-card .best + .btn { margin-left: 8px; }

/* Lesson page: playlist + player */
.lesson-layout { grid-template-columns: 270px minmax(0, 1fr); }
.playlist { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.pl-head { padding: 0 10px 10px; }
.pl-group { padding: 8px 10px; border-radius: 12px; }
.pl-group.cur { background: var(--surface); box-shadow: var(--shadow-1); }
.pl-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 4px; }
.pl-item { display: flex; align-items: center; gap: 8px; padding: 4px 8px; margin: 0 -8px; border-radius: 8px; font-size: 0.84rem; color: var(--ink-2); }
.pl-item.on { color: var(--accent); font-weight: 600; }
.pl-item .lvl { width: 14px; height: 14px; }
@media (hover: hover) and (pointer: fine) { a.pl-item:hover { background: var(--ring); } }
.lesson-layout .tabs { margin-top: 16px; }
.tab-body { padding: 4px 2px 8px; }
.tab-body h3 { margin: 6px 0; }
.transcript { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.tr-step { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: inherit; cursor: pointer; transition: background-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .tr-step:hover { background: var(--ring); } }
.next-skill { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: var(--r); box-shadow: var(--shadow-1); background: var(--surface); }
.next-skill strong { flex: 1; }

/* Exercises: focused layout with a sticky footer */
body.focus-mode .foot { padding-bottom: 110px; }
.exercise { max-width: 980px; margin: 0 auto; padding-bottom: 40px; }
.ex-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.ex-kind { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.ex-title { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
.ex-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; align-items: start; }
.ex-layout.solo { grid-template-columns: minmax(0, 1fr); }
.ex-layout .question { max-width: none; }
.help { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
.help-title { font-weight: 650; }
.help-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ring); color: var(--ink); font: inherit; font-size: 0.88rem; font-weight: 600; text-align: left; cursor: pointer; transition: background-color 150ms ease, transform 160ms var(--ease-out); }
.help-item:active:not(:disabled) { transform: scale(0.98); }
.help-item:disabled { opacity: 0.45; cursor: default; }
.ex-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.5) blur(12px); -webkit-backdrop-filter: saturate(1.5) blur(12px); box-shadow: 0 -1px 0 var(--ring); }
.ex-foot-inner { max-width: 1020px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ex-foot-left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ex-goal { font-weight: 600; font-size: 0.9rem; }
.ex-progress { display: flex; align-items: center; gap: 10px; }
.ex-progress .dots { margin: 0; }
.ex-count { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ex-foot-right { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.streak-run { display: inline-flex; align-items: center; gap: 4px; }

/* Profile */
.stat-card { gap: 4px; }
.sc-icon { color: var(--accent); }
.badge-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.badge:not(.earned) .badge-icon { background: var(--ring); color: var(--muted); filter: none; }
table.activity { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.activity th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 650; padding: 8px 10px; box-shadow: 0 1px 0 var(--ring); }
table.activity td { padding: 10px; box-shadow: 0 1px 0 var(--ring); vertical-align: middle; }
table.activity .lvl { width: 11px; height: 11px; vertical-align: -1px; }

.logo-mark .ic { color: var(--paper); }
.toast .ic { color: #f5c518; }

@media (max-width: 960px) {
  .with-nav, .lesson-layout { grid-template-columns: 1fr; }
  .course-nav, .playlist { position: static; max-height: none; }
  .course-nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .course-nav .cn-head, .course-nav .cn-sub { display: none; }
  .cn-link { flex-shrink: 0; max-width: 200px; }
  .playlist { order: 2; }
  .course-top { grid-template-columns: 1fr; }
  .ex-layout { grid-template-columns: 1fr; }
  .help { position: static; flex-direction: row; flex-wrap: wrap; }
  .help p { display: none; }
}
@media (max-width: 640px) {
  .ex-goal { display: none; }
  .ex-foot-right .btn.big { height: 40px; padding: 0 14px; }
  .my-courses { grid-template-columns: 1fr; }
  table.activity th:nth-child(2), table.activity td:nth-child(2) { display: none; }
}

/* ================= Accounts ================= */
.account-area { display: flex; align-items: center; gap: 6px; }
.theme-switching, .theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }
.theme-btn { width: 30px; padding: 0; justify-content: center; }
/* Phones: the header is full, so the theme choice lives in the Explore menu instead. */
.menu-theme { display: none; grid-column: 1 / -1; padding-bottom: 10px; border-bottom: 1px solid var(--ring); }
.theme-btn.with-label { width: auto; padding: 0 10px; gap: 8px; }
/* The icon is redrawn on every click; taps must land on the button so the menu's "click outside" check still sees it inside the menu. */
.theme-btn * { pointer-events: none; }
@media (max-width: 640px) { #theme-area { display: none; } .menu-theme { display: block; } }
.acct { position: relative; }
.avatar-btn { position: relative; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: var(--paper); font: inherit; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; transition: transform 160ms var(--ease-out); }
.avatar-btn:active { transform: scale(0.95); }
.sync-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--paper); background: var(--faint); }
.sync-dot.synced { background: var(--good); }
.sync-dot.syncing { background: #f5c518; }
.sync-dot.offline, .sync-dot.error { background: var(--bad); }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 230px; padding: 6px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-pop); transform-origin: top right; animation: menu-in 160ms var(--ease-out) both; }
@keyframes menu-in { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }
.am-head { display: flex; flex-direction: column; padding: 8px 10px 10px; box-shadow: 0 1px 0 var(--ring); margin-bottom: 4px; }
.acct-menu a, .acct-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .acct-menu a:hover, .acct-menu button:hover { background: var(--ring); } }

/* Dialog */
body.dlg-open { overflow: hidden; }
.dlg { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(15, 15, 18, 0.45); backdrop-filter: blur(3px); animation: route-in 200ms var(--ease-out) both; }
.dlg-panel { position: relative; width: min(420px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-pop); animation: dlg-in 220ms var(--ease-out) both; }
@keyframes dlg-in { from { opacity: 0; transform: scale(0.96) translateY(6px); } }
.dlg-x { position: absolute; right: 10px; top: 10px; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; }
.dlg-body { display: flex; flex-direction: column; gap: 12px; padding: 28px 26px 24px; }
.dlg-body.center { align-items: center; text-align: center; }
.dlg-body h2 { font-size: 1.35rem; letter-spacing: -0.02em; }
.dlg-body > .muted { margin: -4px 0 4px; }
.providers { display: flex; flex-direction: column; gap: 8px; }
.btn.provider { height: 44px; justify-content: center; gap: 10px; }
.btn.full { width: 100%; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--ring-strong); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form.narrow { max-width: 420px; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 0.84rem; font-weight: 600; color: var(--ink-2); }
.fld input, .sel { height: 42px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--ring-strong); color: var(--ink); font: inherit; font-size: 0.95rem; font-weight: 400; transition: box-shadow 150ms ease; }
.fld input:focus, .sel:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-soft); }
.form-error { padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 0.88rem; font-weight: 600; }
.ok-box { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--good-soft); color: var(--good); font-size: 0.9rem; }
.ok-box p { margin: 0; color: var(--ink-2); }
.linkish { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.linkish.right { align-self: flex-end; margin-top: -4px; }
.switch { margin: 4px 0 0; text-align: center; font-size: 0.88rem; color: var(--muted); }
.fine { margin: 0; font-size: 0.76rem; color: var(--faint); line-height: 1.45; }
.nudge-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.role-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.role { flex: 1; min-width: 110px; height: 40px; border: 0; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--ring-strong); color: var(--ink); font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; transition: box-shadow 150ms ease, background-color 150ms ease; }
.role.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }

/* Account page */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.acct-section { display: flex; flex-direction: column; gap: 12px; }
.acct-section h2 { margin-bottom: 2px; }
.acct-section h3 { margin-top: 4px; }
.acct-section hr { width: 100%; border: 0; height: 1px; background: var(--ring); margin: 6px 0; }
.btn.danger-solid { background: var(--bad); color: #fff; box-shadow: none; }
.plan-line { display: flex; align-items: center; gap: 10px; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 0.72rem; font-weight: 700; }
.pill.past_due { background: var(--bad-soft); color: var(--bad); }
.billing { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Premium */
.premium { max-width: 620px; margin: 0 auto; }
.page-head.center { align-items: center; text-align: center; }
.page-head.center p { margin: 0 auto; }
.premium-card { display: flex; flex-direction: column; gap: 18px; }
.perks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.perks li { display: flex; gap: 10px; align-items: flex-start; }
.perks .ic { color: var(--good); margin-top: 3px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border: 0; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--ring-strong); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: box-shadow 150ms ease, transform 160ms var(--ease-out); }
.plan:active { transform: scale(0.98); }
.plan.on { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.plan-name { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.plan-price { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; } .acct-grid { grid-template-columns: 1fr; } }

/* =================================================================
   Editorial pass: content sits on the paper. Structure comes from type,
   hairline rules and spacing, not boxes. Frames are kept only where they
   mean something: the video, dialogs, and selectable plan options.
   ================================================================= */
:root { --serif: "Newsreader", "Iowan Old Style", Georgia, serif; --rule: var(--ring-strong); }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2rem, 3.6vw, 2.75rem); letter-spacing: -0.015em; line-height: 1.08; margin: 4px 0 18px; }
.section-title { font-family: var(--serif); font-weight: 600; font-size: 1.45rem; letter-spacing: -0.01em; margin: 56px 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.section-title .count { font-family: var(--font); font-size: 0.85rem; font-weight: 500; }
main { padding-top: 36px; }
.crumbs { margin-bottom: 8px; }

/* Cards and notices become plain content */
.card { background: none; box-shadow: none; border-radius: 0; padding: 0; }
.card.notice, .empty { max-width: 520px; margin: 64px auto; text-align: center; align-items: center; }
/* A notice's heading is the page's h1 (one per page), but keeps the small card look. */
.notice > h1 { font-family: inherit; font-size: 1.15rem; font-weight: 650; letter-spacing: -0.015em; line-height: 1.15; margin: 0; }
.empty { display: flex; flex-direction: column; gap: 10px; padding: 48px 16px; }
.text-link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; cursor: pointer; transition: text-decoration-color 150ms ease; }
.text-link:hover { text-decoration-color: currentColor; }
.text-link.danger { color: var(--bad); font-size: 0.86rem; }
.muted.small, .small { font-size: 0.84rem; }

/* Home */
.hero { gap: 56px; padding: 8px 0 24px; }
.hero h1 { font-size: clamp(2.6rem, 5.4vw, 4rem); line-height: 1; letter-spacing: -0.025em; max-width: 12ch; }
.lede { font-size: 1.12rem; line-height: 1.55; color: var(--ink-2); max-width: 46ch; margin: 18px 0 24px; }
.hero-actions { align-items: center; gap: 18px; }
.hero-facts { margin-top: 22px; font-size: 0.9rem; }
.hero-art, .course-map { background: none !important; box-shadow: none !important; border-radius: 0; }
.hero-art .frame, .course-map .frame { background: transparent !important; box-shadow: none !important; }
/* The hover tooltip can extend below the drawing; don't clip it. */
.hero-art, .hero-art .frame, .hero-art .canvas { overflow: visible !important; }
.hero-art svg > rect:first-of-type, .course-map svg > rect:first-of-type, .profile-chart svg > rect:first-of-type, .summary-chart svg > rect:first-of-type { fill: transparent; }
.hero-art .stepper { display: none !important; }
/* In dark mode a see-through sheet leaves the sketch's dark ink on a dark page,
   so these sketches sit on their own paper card instead. */
:root[data-theme="dark"] .hero-art, :root[data-theme="dark"] .course-map, :root[data-theme="dark"] .summary-chart { background: #fffdf7 !important; border-radius: var(--r-lg); box-shadow: var(--shadow-1) !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-art, :root:not([data-theme="light"]) .course-map, :root:not([data-theme="light"]) .summary-chart { background: #fffdf7 !important; border-radius: var(--r-lg); box-shadow: var(--shadow-1) !important; }
}
.dashboard h1 { margin-bottom: 28px; }
.toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 36px 40px; }
.toc-group h3 { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; }
.toc-group ul { list-style: none; margin: 0; padding: 0; }
.toc-link { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--ring); color: var(--ink-2); font-size: 0.94rem; }
.toc-link:hover { color: var(--ink); }
.toc-meta { color: var(--faint); font-size: 0.8rem; white-space: nowrap; }
.my-courses { list-style: none; margin: 0; padding: 0; }
.my-courses > li { padding: 22px 0; border-top: 1px solid var(--rule); }
.my-courses > li:last-child { border-bottom: 1px solid var(--rule); }
.mc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.mc-title { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; }
.my-courses .mbar { margin: 12px 0 14px; max-width: 520px; }
.review-line { margin-top: 20px; color: var(--ink-2); }
.review-line a, .next-line a:not(.btn), .legend a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule); }

/* Mastery and next step, as lines of text */
.mastery-line { max-width: 560px; margin: 0 0 22px; }
.ml-text { margin: 0 0 8px; color: var(--ink-2); }
.ml-text strong { color: var(--ink); font-size: 1.05rem; }
.mastery-line .mbar { height: 6px; margin: 0; }
.mastery-line .legend { margin: 10px 0 0; font-size: 0.8rem; }
.next-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 8px; }
.next-title { font-weight: 600; }
.next-line .btn { margin-left: 6px; }

/* Course and unit navigation: plain text */
.with-nav { grid-template-columns: 220px minmax(0, 1fr); gap: 56px; }
.course-nav { gap: 0; font-size: 0.9rem; }
.cn-course { display: block; padding: 4px 0 12px; font-weight: 650; color: var(--ink); border-bottom: 1px solid var(--rule); margin-bottom: 8px; }
.cn-units { margin: 0; padding: 0 0 0 3ch; color: var(--faint); font-variant-numeric: tabular-nums; } /* room for "10." and "11." */
.cn-units li { padding: 5px 0; }
.cn-units a { color: var(--ink-2); }
.cn-units a.on, .cn-course.on { color: var(--ink); font-weight: 650; }
.cn-units a:hover { color: var(--ink); }
.cn-challenge { display: block; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); color: var(--ink-2); font-weight: 600; }
.cn-link, .cn-head, .cn-sub { display: none; }

/* Course page: numbered units with their skills */
.unit-list { margin: 32px 0 0; padding: 0; list-style: none; counter-reset: unit; border-top: 1px solid var(--rule); }
.unit-list > li { counter-increment: unit; display: grid; grid-template-columns: 40px minmax(0, 1fr); padding: 18px 0; border-bottom: 1px solid var(--rule); }
.unit-list > li::before { content: counter(unit); font-family: var(--serif); font-size: 1.3rem; color: var(--faint); line-height: 1.2; }
.ul-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ul-title { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.unit-list .skill-row { grid-column: 2; margin-top: 10px; gap: 4px; }
.unit-list .lvl { width: 16px; height: 16px; border-radius: 4px; }
.challenge-line { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 40px 0 0; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.challenge-line h2 { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; margin-bottom: 4px; }
.challenge-line p { margin: 0; }
.course-map { margin-top: 8px; }
.course-map svg { max-height: 300px; }

/* Unit page: one line per lesson */
.hint-line { margin: 0 0 18px; }
.lesson-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.lr { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--ring); }
.lr .lvl { width: 16px; height: 16px; border-radius: 4px; }
.lr-title { font-size: 1.02rem; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.lr.soon .lr-title { color: var(--faint); }
.lr-actions { display: flex; gap: 18px; font-size: 0.88rem; font-weight: 600; }
.lr-actions a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; }
.lr-actions a:hover { color: var(--ink); text-decoration-color: currentColor; }
.ar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px; padding: 16px 0 16px 14px; border-bottom: 1px solid var(--rule); box-shadow: inset 3px 0 0 var(--accent); }
.ar.test { box-shadow: inset 3px 0 0 #7c5cf0; }
.ar-title { font-weight: 650; }
.unit-nav { margin-top: 40px; font-weight: 600; font-size: 0.92rem; }
.unit-nav a { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); }
.unit-nav a:hover { color: var(--ink); }

/* Lesson page */
.lesson-layout { grid-template-columns: 220px minmax(0, 1fr); }
.playlist { gap: 0; font-size: 0.9rem; }
.pl-unit { display: block; padding: 4px 0 12px; margin-bottom: 8px; font-weight: 650; border-bottom: 1px solid var(--rule); }
.playlist ol { list-style: none; margin: 0; padding: 0; }
.playlist li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 6px 0; }
.playlist li .lvl { width: 10px; height: 10px; border-radius: 3px; }
.playlist li a { color: var(--ink-2); }
.playlist li.on a { color: var(--ink); font-weight: 650; }
.lesson-layout h1 { margin-bottom: 20px; }
.after-video { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; margin: 18px 0 8px; }
.tabs { display: flex; gap: 22px; padding: 0; margin: 28px 0 0; border-radius: 0; background: none; border-bottom: 1px solid var(--rule); }
.tab { height: auto; padding: 0 0 10px; border-radius: 0; background: none !important; box-shadow: none !important; color: var(--muted); font-size: 0.92rem; }
.tab.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink) !important; }
.tab-body { padding: 18px 0; max-width: 680px; }
.transcript { padding-left: 22px; }
.tr-step { padding: 8px 0; border-radius: 0; color: var(--ink-2); }

/* Exercises: the question sits on the paper */
.question { padding: 0 !important; }
.q-prompt { font-family: var(--serif); font-size: 1.5rem; line-height: 1.4; letter-spacing: -0.005em; margin: 6px 0 26px; }
.q-skill { margin-bottom: 8px; }
.choice { background: transparent; box-shadow: inset 0 0 0 1px var(--rule); }
.help { padding: 0 0 0 20px; border-radius: 0; background: none; box-shadow: inset 1px 0 0 var(--rule); }
.help-item { background: none; box-shadow: none; padding: 8px 0; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; }
.ex-head { padding-bottom: 14px; border-bottom: 1px solid var(--rule); margin-bottom: 28px; }
.ex-title { font-family: var(--serif); font-weight: 600; }
.summary { padding: 8px 0 !important; }
.summary h2 { font-family: var(--serif); font-size: 1.9rem; }
.summary-chart { background: none; box-shadow: none; }
.changes { border-top: 1px solid var(--rule); }
.change { border-radius: 0; padding: 12px 0; border-bottom: 1px solid var(--ring); }
.change:nth-child(odd) { background: none; }

/* Progress page */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stat-big { display: flex; flex-direction: column; gap: 2px; padding: 20px 18px 18px 0; }
.stat-big + .stat-big { padding-left: 18px; box-shadow: inset 1px 0 0 var(--ring); }
.stat-big strong { font-family: var(--serif); font-size: 2.2rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.stat-big span { font-size: 0.84rem; }
.badge-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 32px; }
.badge-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--ring); color: var(--faint); }
.badge-list li span { display: flex; flex-direction: column; }
.badge-list li strong { font-weight: 600; color: var(--muted); }
.badge-list li.earned { color: var(--accent); }
.badge-list li.earned strong { color: var(--ink); }

/* Subject page */
.course-list { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.course-list li { padding: 20px 0; border-bottom: 1px solid var(--rule); }
.cl-title { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.cl-units { margin: 6px 0 0; font-size: 0.88rem; line-height: 1.6; max-width: 80ch; }
.cl-progress { margin: 6px 0 0; font-size: 0.82rem; }

/* Search */
.search-results { gap: 0; border-top: 1px solid var(--rule); }
.search-hit { background: none; box-shadow: none; border-radius: 0; padding: 12px 0; border-bottom: 1px solid var(--ring); }
.search-hit:hover { background: none !important; }

/* Account and Premium: sections divided by rules */
.acct-grid { grid-template-columns: 1fr; gap: 0; max-width: 640px; }
.acct-section { padding: 28px 0 !important; border-top: 1px solid var(--rule); }
.acct-section h2 { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; }
.premium-card { padding: 0 !important; }
.premium .page-head h1 { margin-bottom: 8px; }

@media (max-width: 960px) {
  .with-nav, .lesson-layout { gap: 24px; }
  .course-nav { flex-direction: column; overflow: visible; }
  .cn-units { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; list-style: none; }
  .playlist { order: 2; margin-top: 24px; }
  .help { padding: 16px 0 0; box-shadow: inset 0 1px 0 var(--rule); flex-direction: row; gap: 18px; }
}
@media (max-width: 640px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat-big:nth-child(3) { padding-left: 0; box-shadow: none; }
  .stat-big:nth-child(n + 3) { border-top: 1px solid var(--ring); }
  .lr { grid-template-columns: 16px minmax(0, 1fr); }
  .lr-actions { grid-column: 2; }
  .ar { grid-template-columns: minmax(0, 1fr) auto; }
  .ar > .muted { grid-column: 1; grid-row: 2; }
  .challenge-line { flex-direction: column; align-items: flex-start; }
  .mc-title { font-size: 1.3rem; }
}
.my-courses { display: block; max-width: 720px; }
.section-title + .my-courses > li:first-child { border-top: 0; }
/* Phones and small tablets: one column, navigation after the content. */
@media (max-width: 960px) {
  .with-nav, .lesson-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .course-nav, .playlist { order: 2; position: static; max-height: none; padding-top: 24px; border-top: 1px solid var(--rule); }
  .cn-units { display: block; padding-left: 3ch; }
}
@media (max-width: 640px) {
  h1 { font-size: 2rem; }
  .hero h1 { font-size: 2.5rem; }
  .ul-row { flex-direction: column; gap: 2px; }
  .unit-list > li { grid-template-columns: 28px minmax(0, 1fr); }
}
/* The control bar always fits its width: the progress track gives way first. */
.video-bar { min-width: 0; overflow: hidden; }
.vb-track { min-width: 36px; }
.vb, .vb-status, .vb-time { flex-shrink: 0; }
@media (max-width: 640px) {
  .video-bar { gap: 0; padding: 0 6px; }
  .vb-status, .vb-time, .vb-voice, .vb.text, .vb[aria-label="Restart"] { display: none; }
  .vb { min-width: 32px; padding: 0 6px; }
  .vb-track { padding: 0 6px; }
}

/* Story videos: several sheets; only the one in front is visible. */
.sheet-wrap[data-hidden] { opacity: 0; visibility: hidden; }
.vb-track .seg.part-start { margin-left: 5px; }

/* Worked examples: Example 1 free, the rest Premium */
.examples { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.ex-label { margin-right: 6px; }
.ex-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 99px; background: transparent; box-shadow: inset 0 0 0 1px var(--rule); color: var(--ink-2); font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; transition: box-shadow 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out); }
.ex-chip:active { transform: scale(0.97); }
.ex-chip.on { background: var(--ink); color: var(--paper); box-shadow: none; }
.ex-chip.locked { color: var(--faint); }
.ex-chip .free { font-size: 0.7rem; font-weight: 700; color: var(--good); }
.ex-chip.on .free { color: #8fe0a8; }
.premium-tag { margin-left: 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
@media (hover: hover) and (pointer: fine) { .ex-chip:not(.on):hover { box-shadow: inset 0 0 0 1px var(--ink-2); } }

/* Calculator */
.ex-tools { display: flex; gap: 4px; }
.calc { position: fixed; right: 20px; bottom: 92px; z-index: 45; width: 300px; padding: 12px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-pop); transform-origin: bottom right; animation: dlg-in 200ms var(--ease-out) both; }
.calc-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 8px; font-size: 0.88rem; }
.calc-x { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.calc-screen { padding: 8px 10px; margin-bottom: 10px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ring); }
.calc-input { width: 100%; border: 0; background: none; color: var(--ink); font: inherit; font-size: 1.15rem; font-variant-numeric: tabular-nums; text-align: right; outline: none; }
.calc-result { min-height: 22px; text-align: right; color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.calc-result.err { color: var(--bad); font-size: 0.82rem; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.ck { height: 38px; border: 0; border-radius: 9px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ring); color: var(--ink); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: background-color 120ms ease, transform 120ms var(--ease-out); }
.ck:active { transform: scale(0.95); }
.ck.op { color: var(--accent); }
.ck.mode { font-size: 0.72rem; color: var(--muted); }
.ck.clear, .ck.del { color: var(--bad); }
.ck.eq { background: var(--ink); color: var(--paper); box-shadow: none; }
@media (hover: hover) and (pointer: fine) { .ck:hover { background: var(--ring); } .ck.eq:hover { opacity: 0.9; background: var(--ink); } }
@media (max-width: 640px) { .calc { left: 12px; right: 12px; width: auto; bottom: 84px; } .ex-tools .btn { padding: 0 8px; } }

/* The formula to remember, under the player: hairline-ruled, no card. */
.remember {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px;
  margin: 14px 0 4px; padding: 10px 0 10px 14px;
  box-shadow: inset 3px 0 0 var(--accent);
}
.rm-label { flex-basis: 100%; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.remember .katex { font-size: 1.35em; }
.remember > div { max-width: 100%; overflow-x: auto; }
.rm-what { color: var(--muted); font-size: 0.9rem; }

/* Pointer: a highlighter and tag that follow the narrator. */
.pointer-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.pointer-hl { fill: rgba(255, 210, 63, 0.42); mix-blend-mode: multiply; }
.pointer-ring { fill: none; stroke: #2a5bd7; stroke-width: 2; stroke-dasharray: 5 4; opacity: 0.8; }
.pointer-tag {
  position: absolute; z-index: 3; pointer-events: none; white-space: nowrap;
  font-family: Kalam, "Comic Sans MS", cursive; font-size: 14px; font-weight: 700; color: #2a5bd7;
  background: #fffdf7; padding: 1px 9px; border: 1.5px solid #2a5bd7; border-radius: 11px 9px 12px 8px;
  box-shadow: 2px 2px 0 rgba(42, 91, 215, 0.22);
}

/* What a lesson builds on, under its title. */
.builds-on { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: -4px 0 14px; font-size: 0.9rem; }
.bo-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.builds-on a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .builds-on a:hover { text-decoration-color: currentColor; } }

/* In-depth lessons: a long video with chapters. The progress track is one bar
   per chapter, as wide as the chapter is long. */
.video-seek { padding: 8px 14px 0; background: #17171a; }
.video.long .vb-time { text-align: left; padding-left: 8px; opacity: 0.85; }
.vb-track.chapters { gap: 3px; align-items: center; height: 18px; padding: 0; }
.vb-track .chap { position: relative; flex: 1 1 0; min-width: 4px; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.vb-track .chap::before, .chap-fill { content: ""; position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 99px; transition: height 150ms ease, margin-top 150ms ease; }
.vb-track .chap::before { right: 0; background: rgba(255, 255, 255, 0.22); }
.chap-fill { width: 0; background: #f5c518; transition: width 400ms linear, height 150ms ease, margin-top 150ms ease; }
.vb-track .chap.now::before, .vb-track .chap.now .chap-fill { height: 6px; margin-top: -3px; }
@media (hover: hover) and (pointer: fine) { .vb-track .chap:hover::before, .vb-track .chap:hover .chap-fill { height: 8px; margin-top: -4px; } }
.video.long .vb-time { min-width: 92px; }
/* Sketchy fades what a step isn't about until it can't be read. In a long
   video the earlier parts of a drawing stay readable; they only step back. */
.video.long .video-sketch .element.dim { opacity: 0.55 !important; }
/* Which chapter is playing, beside the time. It gives way first when the bar is narrow. */
.vb-chapter { flex: 1 1 0; min-width: 0; padding: 0 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.8rem; color: rgba(255, 255, 255, 0.7); }
/* Pick up where you left off, under the play button. */
.resume-pill { position: absolute; left: 50%; top: calc(50% + 56px); z-index: 4; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 7px; max-width: 86%; height: 34px; padding: 0 14px; border: 0; border-radius: 99px; background: #fffdf7; color: #17171a; font: inherit; font-size: 0.86rem; font-weight: 650; white-space: nowrap; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.06); transition: transform 160ms var(--ease-out); }
.resume-pill:active { transform: translateX(-50%) scale(0.97); }
.rp-where { overflow: hidden; text-overflow: ellipsis; font-weight: 500; color: #6b6960; }
.rp-where::before { content: "· "; }
.lesson-meta { display: flex; align-items: center; gap: 7px; margin: -6px 0 14px; color: var(--muted); font-size: 0.9rem; }
.lr-min { font-weight: 500; color: var(--muted); }
/* Chapters tab: time, title, length. */
.chapter-list { margin: 0; padding: 0; list-style: none; }
.chapter-list button { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: baseline; gap: 12px; width: 100%; padding: 10px 8px 10px 10px; border: 0; background: none; box-shadow: inset 0 -1px 0 var(--rule); color: var(--ink-2); font: inherit; text-align: left; cursor: pointer; }
.chapter-list li.on button { color: var(--ink); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent), inset 0 -1px 0 var(--rule); }
.ch-time { color: var(--accent); font-size: 0.86rem; font-weight: 600; }
.ch-len { font-size: 0.82rem; font-weight: 400; }
@media (hover: hover) and (pointer: fine) { .chapter-list button:hover { background: var(--ring); } }
/* The transcript of an in-depth lesson reads like an article. */
.transcript.long { display: block; padding: 0; }
.transcript.long section { margin-bottom: 22px; }
.transcript.long h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 1.1rem; }
.tr-chapter { display: inline-flex; align-items: baseline; gap: 10px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.transcript.long p { margin: 0; }
.transcript.long .tr-step { padding: 5px 0; line-height: 1.6; }
@media (max-width: 640px) {
  .video.long .vb-time { display: block; min-width: 0; font-size: 0.72rem; }
  .video-seek { padding: 8px 8px 0; }
  .vb-chapter { font-size: 0.72rem; padding: 0 6px; }
}
