/* ─────────────────────────────────────────────────────────────
   GED Tutor — design system (adapted from Throughline design)
   ───────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;1,6..72,400;1,6..72,500&family=Geist:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Accent — warm terracotta */
  --accent-h:      24 65% 52%;
  --accent:        hsl(var(--accent-h));
  --accent-soft:   hsl(var(--accent-h) / .14);
  --accent-line:   hsl(var(--accent-h) / .35);
  --accent-ink:    hsl(var(--accent-h) / .85);

  /* Paper tones */
  --paper:         oklch(0.975 0.012 80);
  --paper-2:       oklch(0.955 0.015 75);
  --paper-3:       oklch(0.93  0.018 72);

  /* Ink (text) levels */
  --ink:           oklch(0.22  0.025 70);
  --ink-2:         oklch(0.34  0.022 70);
  --ink-3:         oklch(0.50  0.020 70);
  --ink-4:         oklch(0.68  0.015 70);

  /* Lines / borders */
  --line:          oklch(0.86  0.012 70);
  --line-strong:   oklch(0.78  0.014 70);

  /* Semantic */
  --good:          oklch(0.55 0.13 145);
  --good-soft:     oklch(0.55 0.13 145 / .12);
  --good-ink:      oklch(0.32 0.10 145);
  --bad:           oklch(0.55 0.18 28);
  --bad-soft:      oklch(0.55 0.18 28 / .10);
  --bad-ink:       oklch(0.36 0.14 28);

  /* Legacy aliases — keep admin pages working */
  --bg:            var(--paper);
  --card:          #ffffff;
  --text:          var(--ink);
  --muted:         var(--ink-3);
  --primary:       hsl(var(--accent-h));
  --primary-dark:  hsl(24 65% 40%);
  --danger:        var(--bad);
  --success:       var(--good);
  --border:        var(--line);
  --badge-bg:      var(--accent-soft);
  --badge-text:    var(--accent-ink);

  /* Fonts */
  --serif: 'Newsreader', ui-serif, 'Iowan Old Style', Georgia, serif;
  --sans:  'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Radii */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px;

  /* Layout */
  --pad-x:  clamp(20px, 4.5vw, 72px);
  --col:    1100px;

  /* Transitions */
  --t-fast: 140ms; --t-mid: 240ms;

  /* Shadows */
  --shadow-sm: 0 1px 0 oklch(0.95 0.012 80 / .6) inset, 0 1px 2px oklch(0.2 0.02 70 / .06);
  --shadow-md: 0 1px 0 oklch(0.95 0.012 80 / .7) inset, 0 8px 28px oklch(0.2 0.02 70 / .10);
}

/* ─────────────────────────────────────────────────────────────
   Base
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

em { font-style: italic; }
sup { font-size: .55em; vertical-align: super; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
h1 { font-size: clamp(38px, 5.5vw, 76px); line-height: 1.04; }
h2 { font-size: clamp(24px, 3vw, 40px); line-height: 1.12; }
h3 { font-size: 21px; line-height: 1.2; }
h4 { font-size: 16px; font-family: var(--sans); font-weight: 600; }
p  { margin: 0; color: var(--ink-2); text-wrap: pretty; }

.mono { font-family: var(--mono); font-feature-settings: "tnum"; letter-spacing: .01em; font-size: .82em; }
.muted { color: var(--ink-3); }
.kicker {
  display: inline-block;
  font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
}
.dot-sep { color: var(--ink-4); margin: 0 .25em; }

/* ─────────────────────────────────────────────────────────────
   Navbar
   ───────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in oklab, var(--paper) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--col); margin: 0 auto;
  padding: 13px var(--pad-x);
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--ink); font-family: var(--serif); font-size: 18px;
  letter-spacing: -.01em; text-decoration: none; font-weight: 400;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark { color: var(--accent); display: inline-flex; }
.nav-links { display: flex; gap: 4px; justify-self: center; }
.nav-links a, .nav-links button {
  background: transparent; border: 0;
  padding: 7px 13px;
  color: var(--ink-2); font-family: var(--sans);
  font-size: 13.5px; font-weight: 500; border-radius: 999px;
  text-decoration: none; cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav-links a:hover, .nav-links button:hover {
  color: var(--ink); background: var(--paper-2); text-decoration: none;
}
.nav-right { display: flex; gap: 8px; align-items: center; }
/* legacy: keep direct .navbar a styles for any pages that use them */
.navbar .nav-auth a { margin-left: 10px; }

/* ─────────────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────────────── */
.btn-primary, .btn-ghost,
.btn, .btn-danger, .btn-success, .btn-sm {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-weight: 500;
  padding: 9px 17px; border-radius: 999px;
  font-size: 14px; letter-spacing: -.005em; line-height: 1;
  transition: transform var(--t-fast), background var(--t-fast),
              color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
  text-decoration: none;
}

/* Primary — dark */
.btn-primary {
  background: var(--ink); color: var(--paper);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { transform: translateY(-1px); color: var(--paper); text-decoration: none; }
.btn-primary:active { transform: none; }
.btn-primary.lg { padding: 13px 22px; font-size: 15px; }

/* Ghost / default */
.btn, .btn-ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn:hover, .btn-ghost:hover {
  background: var(--paper-2); text-decoration: none; color: var(--ink);
}
.btn.lg, .btn-ghost.lg { padding: 13px 20px; font-size: 15px; }

/* Danger */
.btn-danger {
  background: transparent; color: var(--bad);
  border: 1px solid var(--bad);
}
.btn-danger:hover { background: var(--bad-soft); text-decoration: none; color: var(--bad-ink); }

/* Success */
.btn-success {
  background: var(--good); color: #fff;
  border: 1px solid var(--good);
}
.btn-success:hover { opacity: .88; text-decoration: none; color: #fff; }

/* Small */
.btn-sm { padding: 5px 12px; font-size: 12.5px; }

/* Link button */
.link-btn {
  background: none; border: none;
  color: var(--accent-ink); cursor: pointer;
  padding: 0; font-size: inherit; font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────────────────────
   Page layout
   ───────────────────────────────────────────────────────────── */
.container {
  max-width: var(--col);
  margin: 32px auto;
  padding: 0 var(--pad-x);
}
.container.narrow { max-width: 560px; }
.page { max-width: var(--col); margin: 0 auto; padding: 0 var(--pad-x); }

.page-header, .page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

/* ─────────────────────────────────────────────────────────────
   Landing — hero
   ───────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: clamp(40px, 7vw, 88px) 0 clamp(40px, 6vw, 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: end;
}
.hero-meta {
  grid-column: 1 / -1;
  color: var(--ink-3);
  display: flex; align-items: center;
  letter-spacing: .12em; text-transform: uppercase; font-size: 10.5px;
  margin-bottom: 16px;
}
.hero-title { grid-column: 1; letter-spacing: -.025em; }
.hero-title em { font-style: italic; color: var(--accent-ink); }
.hero-lede {
  grid-column: 1; margin-top: 22px;
  font-size: clamp(16px, 1.4vw, 19px); max-width: 50ch;
  color: var(--ink-2); line-height: 1.55;
}
.hero-cta { grid-column: 1; margin-top: 26px; display: flex; gap: 10px; flex-wrap: wrap; }

.hero-figure { grid-column: 2; position: relative; min-height: 420px; align-self: stretch; }

/* Floating preview cards in hero */
.hf-card {
  position: absolute;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  padding: 16px;
}
.hf-1 { top: 0; left: 0; width: 78%; transform: rotate(-1.5deg); }
.hf-2 { top: 36%; right: 0; width: 65%; transform: rotate(1.2deg); }
.hf-3 {
  bottom: 0; left: 6%; width: 72%;
  transform: rotate(-.8deg);
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.hf-hd  { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 11px; }
.hf-eq  { margin: 12px 0 4px; font-family: var(--mono); font-size: 17px; color: var(--ink); }
.hf-sub { color: var(--ink-3); font-size: 11px; margin-top: 6px; }
.hf-progress { display: grid; gap: 6px; margin-bottom: 10px; }
.hf-bar { height: 6px; background: var(--paper-3); border-radius: 99px; overflow: hidden; }
.hf-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.hf-list { display: grid; gap: 5px; }
.hf-li {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--ink-3);
  padding: 3px 0; border-top: 1px dashed var(--line);
}
.hf-li:first-child { border-top: 0; }
.hf-li.done { color: var(--ink-2); }
.hf-li.now  { color: var(--ink); font-weight: 500; }
.hf-quiz-q  { color: oklch(0.78 0 0); font-size: 11px; }
.hf-answer  { margin-top: 10px; }
.hf-answer-ok {
  display: inline-flex; align-items: center; gap: 5px;
  color: oklch(0.85 0.12 145); font-size: 11px; font-family: var(--mono);
}

/* ─────────────────────────────────────────────────────────────
   Landing — stat strip
   ───────────────────────────────────────────────────────────── */
.strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 20px 0; margin: 24px 0 0;
}
.strip-stat {
  border-left: 1px dashed var(--line);
  padding: 4px 18px; display: grid; gap: 2px;
}
.strip-stat:first-child { border-left: 0; padding-left: 0; }
.strip-stat .big { font-size: 24px; font-family: var(--mono); color: var(--ink); }
.strip-stat .small { font-size: 12px; color: var(--ink-3); }

/* ─────────────────────────────────────────────────────────────
   Landing — section headers
   ───────────────────────────────────────────────────────────── */
.sec-hd {
  margin: clamp(52px, 8vw, 88px) 0 clamp(18px, 3vw, 32px);
  display: grid; gap: 10px; max-width: 58ch;
}
.sec-hd .kicker { margin-bottom: -2px; }
.sec-lede { font-size: clamp(15px, 1.2vw, 17px); color: var(--ink-2); line-height: 1.55; }
.sec-lede em { color: var(--accent-ink); }

/* ─────────────────────────────────────────────────────────────
   Landing — subject grid
   ───────────────────────────────────────────────────────────── */
.subj-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.subj {
  background: var(--paper); padding: 22px 20px 24px;
  display: grid; gap: 10px;
}
.subj h3 { font-size: 21px; }
.subj-num { font-size: 11px; color: var(--ink-4); letter-spacing: .12em; }
.subj-meta { color: var(--ink-3); font-size: 11px; }
.subj .striped { height: 88px; margin-top: 4px; }

/* Striped texture placeholder */
.striped {
  position: relative;
  display: flex; align-items: flex-end;
  padding: 10px; height: 100px;
  border-radius: var(--r-md); overflow: hidden;
  color: var(--ink-2); font-size: 11px; letter-spacing: .04em;
}
.striped::before {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    135deg, var(--accent-soft) 0 6px, transparent 6px 14px
  );
}
.striped > span { position: relative; z-index: 1; }

/* ─────────────────────────────────────────────────────────────
   Landing — how it works
   ───────────────────────────────────────────────────────────── */
.how-steps {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}
.how-steps li {
  border-bottom: 1px solid var(--line); border-right: 1px dashed var(--line);
  padding: 26px 24px 26px 0; display: grid; gap: 10px;
}
.how-steps li:nth-child(1) { padding-right: 28px; }
.how-steps li:nth-child(2) { padding-left: 28px; padding-right: 28px; }
.how-steps li:nth-child(3) { padding-left: 28px; border-right: 0; }
.step-n { font-size: 11px; color: var(--accent-ink); letter-spacing: .12em; }
.how-steps p { font-size: 14px; }
.how-steps em { color: var(--accent-ink); }

/* ─────────────────────────────────────────────────────────────
   Landing — testimonial
   ───────────────────────────────────────────────────────────── */
.testimonial {
  margin: clamp(52px, 8vw, 88px) 0 clamp(36px, 6vw, 72px);
  padding: clamp(28px, 5vw, 52px) 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: grid; gap: 16px; text-align: center;
}
.testimonial blockquote {
  font-family: var(--serif);
  font-size: clamp(20px, 2.4vw, 30px); line-height: 1.35;
  letter-spacing: -.012em; margin: 0 auto; max-width: 34ch;
  color: var(--ink);
}
.quote-mark { color: var(--accent); font-size: 1.4em; line-height: 0; vertical-align: -.18em; margin-right: .1em; }
.quote-attr { color: var(--ink-3); font-size: 12px; letter-spacing: .06em; }

/* ─────────────────────────────────────────────────────────────
   Landing — CTA band
   ───────────────────────────────────────────────────────────── */
.cta-band {
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px; padding: 26px 32px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r-xl); margin-bottom: 48px;
}
.cta-band h2 { color: var(--paper); font-size: clamp(22px, 2.5vw, 30px); }
.cta-band p { color: oklch(0.78 0 0); margin-top: 6px; font-size: 14px; }
.cta-band .btn-primary { background: var(--paper); color: var(--ink); }
.cta-band .btn-primary:hover { background: var(--paper-2); color: var(--ink); }

/* ─────────────────────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────────────────────── */
.footer, .foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px var(--pad-x);
  border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 12px;
  max-width: var(--col); margin: 0 auto;
}
.footer { display: block; text-align: center; padding: 20px var(--pad-x); }

/* ─────────────────────────────────────────────────────────────
   Cards / forms (admin + practice pages)
   ───────────────────────────────────────────────────────────── */
.card {
  background: var(--paper);
  padding: 24px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card label { display: block; margin-bottom: 14px; font-weight: 500; }
.card label.inline { display: flex; align-items: center; gap: 8px; font-weight: normal; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13.5px; color: var(--ink); }

input[type=text], input[type=email], input[type=password],
input[type=url], input[type=number], input[type=datetime-local],
textarea, select,
.card input[type=text], .card input[type=email], .card input[type=password],
.card input[type=url], .card input[type=number], .card input[type=datetime-local],
.card textarea, .card select {
  display: block; width: 100%; margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 14.5px; font-family: var(--sans);
  background: var(--paper); color: var(--ink);
  outline: none;
  transition: border-color var(--t-fast);
}
input:focus, textarea:focus, select:focus { border-color: var(--ink-3); }
.field-error { display: block; color: var(--bad); font-size: 0.84rem; margin-top: 4px; }

/* ─────────────────────────────────────────────────────────────
   Alerts
   ───────────────────────────────────────────────────────────── */
.alert {
  padding: 11px 15px;
  border-radius: var(--r-sm);
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-error   { background: var(--bad-soft);  color: var(--bad-ink);  border: 1px solid hsl(var(--bad) / .3); }
.alert-success { background: var(--good-soft); color: var(--good-ink); border: 1px solid hsl(var(--good) / .3); }

/* ─────────────────────────────────────────────────────────────
   Badge
   ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 9px;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 999px; font-size: 0.76rem; font-weight: 600;
}
.badge-success { background: var(--good-soft); color: var(--good-ink); }
.badge-info    { background: oklch(0.9 0.04 240 / .5); color: oklch(0.4 0.08 240); }
.badge-muted   { background: var(--paper-3); color: var(--ink-3); }

.empty { color: var(--muted); font-style: italic; margin: 24px 0; }
.empty-state { color: var(--ink-3); font-style: italic; margin: 32px 0; }

/* ─────────────────────────────────────────────────────────────
   Table
   ───────────────────────────────────────────────────────────── */
.table {
  width: 100%; border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
}
.table th, .table td {
  padding: 11px 14px; text-align: left;
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
.table th {
  background: var(--paper-2); font-size: 0.82rem;
  text-transform: uppercase; color: var(--ink-3); font-weight: 600;
  letter-spacing: .04em;
}
.table tr:last-child td { border-bottom: none; }

/* ─────────────────────────────────────────────────────────────
   Video grid
   ───────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.video-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
  color: var(--ink); text-decoration: none;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.video-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.video-card .thumb {
  aspect-ratio: 16/9;
  background: var(--ink) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600;
}
.video-card .card-body { padding: 14px; }
.video-card h3 { margin: 6px 0 4px; font-size: 1rem; font-family: var(--sans); font-weight: 600; }

/* ─────────────────────────────────────────────────────────────
   Video detail
   ───────────────────────────────────────────────────────────── */
.video-frame {
  position: relative; aspect-ratio: 16/9;
  background: #000; margin: 16px 0 24px;
  border-radius: var(--r-md); overflow: hidden;
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); }

/* ─────────────────────────────────────────────────────────────
   Stats
   ───────────────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-top: 20px;
}
.stat {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 22px; text-align: center;
}
.stat h2 { font-size: 2rem; margin: 0; color: var(--accent); font-family: var(--mono); font-weight: 400; }

/* ─────────────────────────────────────────────────────────────
   Homework answer block
   ───────────────────────────────────────────────────────────── */
.answer {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px;
  white-space: pre-wrap;
  font-family: var(--mono); font-size: 0.9rem;
}

/* ─────────────────────────────────────────────────────────────
   Filter bar
   ───────────────────────────────────────────────────────────── */
.filter-bar {
  margin: 16px 0; padding: 12px 16px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.filter-bar select {
  padding: 6px 10px; border: 1px solid var(--line);
  border-radius: var(--r-sm); font-size: 0.95rem;
  display: inline-block; width: auto;
}

/* ─────────────────────────────────────────────────────────────
   Practice page specifics
   ───────────────────────────────────────────────────────────── */
.hint {
  color: var(--ink-3); font-size: 13px; font-style: italic;
  background: var(--paper-2); border: 1px dashed var(--line);
  border-radius: var(--r-sm); padding: 8px 12px;
  margin: 8px 0 0;
}
.math-expr { margin: 12px 0; }

/* Subject cards (old style kept for any pages still using them) */
.subjects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; text-align: left;
}
.subject-card {
  background: var(--paper); border: 1px solid var(--line);
  padding: 16px; border-radius: var(--r-md);
}

/* ─────────────────────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero-figure { min-height: 340px; margin-top: 16px; grid-column: 1; }
  .strip { grid-template-columns: 1fr 1fr; gap: 14px 0; }
  .strip-stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .subj-grid { grid-template-columns: 1fr 1fr; }
  .how-steps { grid-template-columns: 1fr; }
  .how-steps li { border-right: 0 !important; padding: 20px 0 !important; }
  .cta-band { flex-direction: column; align-items: flex-start; gap: 16px; }
}
@media (max-width: 680px) {
  .nav-links { display: none; }
  .subj-grid { grid-template-columns: 1fr 1fr; }
  .strip { grid-template-columns: 1fr 1fr; }
  .hero-figure { display: none; }
}
@media (max-width: 500px) {
  .subj-grid { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────────────────
   Video list page — subject pill tabs
   ───────────────────────────────────────────────────────────── */
.pill-tab-bar {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.pill-tab {
  appearance: none; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 16px; font-family: var(--sans); font-size: 13.5px;
  font-weight: 500; color: var(--ink-2); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.pill-tab:hover { color: var(--ink); border-color: var(--ink-3); }
.pill-tab.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pill-tab .count { font-family: var(--mono); font-size: 11px; opacity: .7; margin-left: 4px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.vid-search-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
}
.vid-search-bar input {
  flex: 1; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; font-family: var(--sans);
  background: var(--paper); color: var(--ink);
  outline: none; display: block; width: auto;
  transition: border-color var(--t-fast);
}
.vid-search-bar input:focus { border-color: var(--ink-3); }
.vid-search-count { font-size: 12px; color: var(--ink-4); font-family: var(--mono); white-space: nowrap; }

.cat-section { margin-bottom: 36px; }
.cat-title {
  font-family: var(--serif); font-size: 20px; font-weight: 400;
  color: var(--ink); margin: 0 0 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 10px;
}
.cat-title .cat-count {
  font-family: var(--mono); font-size: 11px; color: var(--ink-4);
  font-weight: 400;
}
.no-results { color: var(--ink-3); font-style: italic; padding: 12px 0; font-size: 14px; }

/* ─────────────────────────────────────────────────────────────
   Lesson / video-detail page
   ───────────────────────────────────────────────────────────── */
.lesson-page { padding-top: 12px; padding-bottom: 80px; }

.lesson-crumbs {
  display: flex; gap: 6px; align-items: center;
  color: var(--ink-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: .12em;
  padding: 8px 0 20px;
  font-family: var(--mono);
}
.lesson-crumbs a { color: inherit; text-decoration: none; }
.lesson-crumbs a:hover { color: var(--ink); }
.lesson-crumbs .here { color: var(--ink); }
.lesson-crumbs .sep { color: var(--ink-4); }

.lesson-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px;
  gap: 40px; align-items: start;
}

/* left column header */
.lh { margin-bottom: 20px; }
.lh .kicker { display: block; margin-bottom: 8px; }
.lh h1 { font-size: clamp(30px, 4vw, 48px); margin: 0 0 14px; letter-spacing: -.022em; }
.lh-lede { font-size: 16px; max-width: 56ch; color: var(--ink-2); line-height: 1.58; }

/* video player */
.player {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; background: var(--paper);
  box-shadow: var(--shadow-md); margin-bottom: 0;
}
.player iframe {
  display: block; width: 100%; aspect-ratio: 16/9;
  border: none;
}
.player-fallback {
  aspect-ratio: 16/9; background: var(--paper-2);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; color: var(--ink-3);
}

/* tab bar */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--line);
  margin: 26px 0 18px;
}
.tab {
  appearance: none; background: 0; border: 0;
  padding: 11px 4px; margin-right: 24px;
  font-size: 13.5px; font-weight: 500; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; font-family: var(--sans);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* notes content */
.notes { line-height: 1.6; }
.notes h3 { font-size: 21px; margin-top: 22px; margin-bottom: 10px; }
.notes h3:first-child { margin-top: 0; }
.notes p { font-size: 16px; max-width: 64ch; }
.callout {
  margin: 18px 0; padding: 15px 18px;
  background: var(--accent-soft); border-radius: var(--r-md);
  display: grid; gap: 8px;
}
.callout-tag {
  color: var(--accent-ink); letter-spacing: .12em;
  text-transform: uppercase; font-size: 10.5px;
  font-family: var(--mono);
}
.callout p { color: var(--ink); }

.resources { display: grid; gap: 0; }
.res-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px dashed var(--line);
  color: var(--ink-2); text-decoration: none; font-size: 14.5px;
}
.res-row:hover { color: var(--ink); text-decoration: none; }
.res-row .small { color: var(--ink-4); margin-left: auto; }

/* right sidebar */
.lesson-side { display: grid; gap: 16px; position: sticky; top: 80px; }

/* practice / quiz panel */
.quiz {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px;
  display: grid; gap: 16px; box-shadow: var(--shadow-md);
}
.quiz-hd { display: flex; align-items: center; justify-content: space-between; }
.quiz-pips { display: flex; gap: 4px; }
.pip { width: 18px; height: 4px; background: var(--paper-3); border-radius: 99px; }
.pip.on  { background: var(--accent); }
.pip.now { background: var(--ink); }
.quiz-q {
  font-family: var(--serif); font-size: 18px; line-height: 1.35;
  letter-spacing: -.005em; color: var(--ink);
}
/* KaTeX display block inside the narrow sidebar — keep it contained */
.quiz-q .katex-display { margin: 6px 0 0; overflow-x: auto; text-align: left; }
.quiz-q .katex { font-size: 1.15em; }
.quiz-choices { display: grid; gap: 8px; }
.choice {
  appearance: none;
  display: grid; grid-template-columns: 22px 1fr auto;
  align-items: center; gap: 10px; text-align: left;
  padding: 11px 14px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-md);
  font: inherit; font-size: 14px; cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.choice:hover:not(:disabled) { border-color: var(--ink-3); }
.choice .choice-key { color: var(--ink-4); font-family: var(--mono); }
.choice.picked  { border-color: var(--ink); background: var(--paper-2); }
.choice.correct { border-color: var(--good); background: var(--good-soft); color: var(--good-ink); }
.choice.correct .choice-key { color: var(--good-ink); }
.choice.wrong   { border-color: var(--bad);  background: var(--bad-soft);  color: var(--bad-ink); }

.quiz-feedback { padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; line-height: 1.5; }
.quiz-feedback.good { background: var(--good-soft); color: var(--good-ink); }
.quiz-feedback.bad  { background: var(--bad-soft);  color: var(--bad-ink); }
.quiz-actions { display: flex; gap: 8px; }
.quiz-actions .btn-primary { flex: 1; justify-content: center; }

/* ask / tutor panel */
.ask {
  background: var(--ink); color: var(--paper);
  border-radius: var(--r-lg); padding: 16px;
  display: grid; gap: 10px;
}
.ask-hd { color: oklch(0.85 0 0); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-family: var(--mono); }
.ask-input {
  display: grid; grid-template-columns: 1fr 32px; gap: 6px; align-items: center;
  background: oklch(0.28 0.02 70);
  border-radius: var(--r-md); padding: 4px 4px 4px 12px;
}
.ask-input input {
  appearance: none; border: 0; background: transparent;
  color: var(--paper); font: inherit; font-size: 13.5px;
  padding: 8px 0; outline: none; display: block; width: auto;
}
.ask-input input::placeholder { color: oklch(0.7 0 0); }
.ask-send {
  appearance: none; border: 0; background: var(--accent); color: var(--paper);
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer;
  font-size: 14px;
}
.ask-hint { color: oklch(0.7 0 0); font-size: 11px; font-family: var(--mono); }

/* inline math chip */
.mq {
  font-family: var(--mono);
  background: var(--paper-2); padding: 1px 6px;
  border-radius: 4px; color: var(--ink); font-size: .9em;
}

/* lesson page responsive */
@media (max-width: 960px) {
  .lesson-grid { grid-template-columns: 1fr; }
  .lesson-side { position: static; }
}

