/* Dark color mode. Every rule is scoped to html[data-theme="dark"] so the light theme stays untouched. */
html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #212121;
  --surface: #2f2f2f;
  --soft: #2a2a2a;
  --ink: #ececec;
  --muted: #b4b4b4;
  --line: #424242;
  --blue: #ececec;
  --blue-soft: rgba(255, 255, 255, .16);
  --success: #7fd7a8;
  --success-soft: rgba(64, 190, 120, .16);
  --error: #ff9d8f;
  --error-soft: rgba(255, 110, 90, .16);
}
html[data-theme="dark"] :focus-visible { outline-color: #ececec; }
html[data-theme="dark"] .site-header { background: rgba(33, 33, 33, .88); }
html[data-theme="dark"] .brand-wordmark { filter: brightness(0) invert(1); opacity: .92; }
html[data-theme="dark"] .nav-item:hover { background: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .nav-item[aria-current="page"] { background: rgba(255, 255, 255, .12); }
html[data-theme="dark"] .nav-count { background: rgba(255, 110, 90, .18); }
html[data-theme="dark"] .course-catalog h1,
html[data-theme="dark"] .course-heading h1,
html[data-theme="dark"] .cell-course > h1,
html[data-theme="dark"] .course-catalog #catalog-title { color: var(--ink); }
html[data-theme="dark"] .course-tile { border-color: #424242; }
html[data-theme="dark"] .course-tile:hover { box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
html[data-theme="dark"] .cell-tile { background: rgba(255, 255, 255, .14); color: #e6e6e6; }
html[data-theme="dark"] .ferment-tile { background: rgba(255, 255, 255, .07); color: #d9d9d9; }
html[data-theme="dark"] .course-symbol i {
  border-color: rgba(255, 255, 255, .35);
  background: radial-gradient(ellipse at 30% 24%, rgba(255, 255, 255, .22), rgba(255, 255, 255, .35) 58%, rgba(0, 0, 0, .45));
  box-shadow: inset 0 0 18px rgba(255, 255, 255, .25);
}
html[data-theme="dark"] .fermentation-visual { background: #2a2a2a; }
html[data-theme="dark"] .course-segment,
html[data-theme="dark"] .type-tabs { background: rgba(255, 255, 255, .07); }
html[data-theme="dark"] .course-segment a { color: var(--muted); }
html[data-theme="dark"] .course-segment a[aria-current="page"] { background: rgba(255, 255, 255, .14); color: #e0e0e0; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .plant-banner,
html[data-theme="dark"] .note { background: var(--soft); }
html[data-theme="dark"] .plant-banner h2 { color: var(--ink); }
html[data-theme="dark"] .plant-banner p { color: var(--muted); }
html[data-theme="dark"] .note .btn { background: rgba(255, 255, 255, .1); }
html[data-theme="dark"] .btn { background: rgba(255, 255, 255, .09); color: #ececec; }
html[data-theme="dark"] .btn:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
html[data-theme="dark"] .btn.primary { background: #f5f5f5; color: #171717; }
html[data-theme="dark"] .btn.primary:hover { background: #ffffff; }
html[data-theme="dark"] .btn.hero-secondary { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: var(--blue); }
html[data-theme="dark"] .btn.hero-secondary:hover { background: rgba(255, 255, 255, .12); }
html[data-theme="dark"] .btn.star.active { background: rgba(255, 255, 255, .18); color: #e6e6e6; }
html[data-theme="dark"] .type-tab:hover { background: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .type-tab[aria-pressed="true"] { border-color: rgba(255, 255, 255, .16); box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .option.correct { border-color: rgba(127, 215, 168, .45); }
html[data-theme="dark"] .option.incorrect { border-color: rgba(255, 157, 143, .45); }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .practice-card { border-color: #424242; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
html[data-theme="dark"] .unit-number { color: #c4c4c4; }
html[data-theme="dark"] .meter { background: rgba(255, 255, 255, .12); }
html[data-theme="dark"] .meter span { background: #ececec; }
html[data-theme="dark"] .round-history strong { color: #d9d9d9; }
html[data-theme="dark"] .option { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .entry input,
html[data-theme="dark"] .entry textarea,
html[data-theme="dark"] .filter-select { border-color: #4a4a4a; background: #1a1a1a; }
html[data-theme="dark"] .practice .problem-actions {
  background: rgba(47, 47, 47, .82);
  box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .6);
}
html[data-theme="dark"] .palette-grid button.seen { background: rgba(255, 255, 255, .14); }
html[data-theme="dark"] .study-media { background: #2a2a2a; }
html[data-theme="dark"] .tank-figure img,
html[data-theme="dark"] .book-figure img { background: #f2f3f5; }
html[data-theme="dark"] .book-figure img { border-color: #4a4a4a; }
html[data-theme="dark"] .book-evidence { background: rgba(255, 255, 255, .08); border-color: #424242; }
html[data-theme="dark"] .book-evidence-head span,
html[data-theme="dark"] .plant-ppt-item h4,
html[data-theme="dark"] .plant-ppt-study .study-unit-body h3 { color: #cfcfcf; }
html[data-theme="dark"] .book-evidence-head cite,
html[data-theme="dark"] .book-figure figcaption,
html[data-theme="dark"] .plant-ppt-source,
html[data-theme="dark"] .book-evidence-note,
html[data-theme="dark"] .book-evidence blockquote cite { color: #a3a3a3; }
html[data-theme="dark"] .book-evidence blockquote { color: #e0e0e0; }
html[data-theme="dark"] .plant-ppt-item p { color: #d4d4d4; }
html[data-theme="dark"] .option-breakdown dt.is-picked { color: #e0e0e0; }
html[data-theme="dark"] .study-intro { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .course-count { background: rgba(255, 255, 255, .14); }
html[data-theme="dark"] .fcf-still i { box-shadow: inset 0 -4px 14px rgba(255, 255, 255, .18), 0 8px 14px rgba(0, 0, 0, .35); }
html[data-theme="dark"] .fcf-still i::before { background: #ececec; box-shadow: .75em 0 #ececec; }
html[data-theme="dark"] .catalog-spark-warm { color: #e08a6d; }
html[data-theme="dark"] .catalog-spark-blue { color: #b4b4b4; }
html[data-theme="dark"] .catalog-card { background: linear-gradient(145deg, #2f2f2f 36%, #262626); }
html[data-theme="dark"] .catalog-card:hover,
html[data-theme="dark"] .learning-action:hover { box-shadow: 0 5px 24px rgba(0, 0, 0, .5); }
html[data-theme="dark"] .unit-progress,
html[data-theme="dark"] .unit-progress::-webkit-progress-bar { background: rgba(255, 255, 255, .12); }
html[data-theme="dark"] .unit-progress::-webkit-progress-value,
html[data-theme="dark"] .unit-progress::-moz-progress-bar { background: #ececec; }
html[data-theme="dark"] .course-critter-footer {
  border-color: rgba(255, 255, 255, .14);
  background: linear-gradient(155deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .06));
  box-shadow: 0 22px 50px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .12);
}
html[data-theme="dark"] .course-critter-footer .fcf-word { color: #b4b4b4; }
html[data-theme="dark"] .course-critter-footer .fcf-name { color: #ececec; }
html[data-theme="dark"] .course-critter-footer .fcf-tag { color: #a3a3a3; }
html[data-theme="dark"] .course-critter-footer .fcf-ct { color: #b4b4b4; }
html[data-theme="dark"] .course-critter-footer .fcf-link { color: #e0e0e0; }
html[data-theme="dark"] .memory-curve { --mc-accent: #b4b4b4; --mc-accent-soft: rgba(255, 255, 255, .14); }
html[data-theme="dark"] .memory-curve::before {
  background:
    radial-gradient(58% 70% at 10% 18%, rgba(255, 255, 255, .05), transparent 72%),
    radial-gradient(55% 72% at 52% 6%, rgba(255, 255, 255, .05), transparent 74%),
    radial-gradient(48% 68% at 94% 28%, rgba(255, 255, 255, .04), transparent 72%);
}
html[data-theme="dark"] .mc-tone-warm { --mc-accent: #e08a6d; }
html[data-theme="dark"] .mc-tone-blue { --mc-accent: #b4b4b4; }
html[data-theme="dark"] .memory-curve-eyebrow { color: #b4b4b4; }
html[data-theme="dark"] .memory-curve h2 { color: #f0f0f0; }
html[data-theme="dark"] .memory-curve-sub { color: #b4b4b4; }
html[data-theme="dark"] .memory-curve-quote-by { color: #a3a3a3; }
html[data-theme="dark"] .memory-curve-source { color: #a3a3a3; }
html[data-theme="dark"] .mc-kpi {
  --mc-accent-soft: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .14);
  background:
    radial-gradient(120% 110% at 100% 0%, var(--mc-accent-soft), transparent 58%),
    linear-gradient(165deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .04));
  box-shadow: 0 14px 32px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .14);
}
html[data-theme="dark"] .mc-kpi:hover { box-shadow: 0 20px 40px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .14); }
html[data-theme="dark"] .mc-kpi-label { color: #a3a3a3; }
html[data-theme="dark"] .mc-kpi-value { color: #f0f0f0; }
html[data-theme="dark"] .mc-kpi-suffix { color: #b4b4b4; }
html[data-theme="dark"] .mc-kpi-hint { color: #a3a3a3; }
html[data-theme="dark"] .mc-badge-down { color: #ff9d8f; background: rgba(255, 110, 90, .16); }
html[data-theme="dark"] .mc-badge-up { color: #7fd7a8; background: rgba(64, 190, 120, .16); }
html[data-theme="dark"] .mc-kpi-dot { box-shadow: 0 0 0 3px rgba(47, 47, 47, .92), 0 0 10px currentColor; }
html[data-theme="dark"] .mc-nodes {
  border-color: rgba(255, 255, 255, .14);
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 12px 30px -14px rgba(0, 0, 0, .6);
}
html[data-theme="dark"] .mc-nodes-label { color: #b4b4b4; }
html[data-theme="dark"] .mc-node {
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 6px 14px -8px rgba(0, 0, 0, .6);
  color: #ececec;
}
html[data-theme="dark"] .mc-node small { color: #b4b4b4; }
html[data-theme="dark"] .mc-node-now {
  background: linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .16));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4), 0 6px 14px -8px rgba(255, 255, 255, .5);
  color: #ffffff;
}
html[data-theme="dark"] .mc-node-now small { color: #ffffff; }
html[data-theme="dark"] .mc-nodes i { background: linear-gradient(90deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, .15)); }
html[data-theme="dark"] .coach {
  color: #ececec;
  background: linear-gradient(135deg, #2f2f2f, #262626);
  border-color: #424242;
}
html[data-theme="dark"] .coach h2,
html[data-theme="dark"] .coach h3,
html[data-theme="dark"] .coach h1 { color: var(--ink); }
html[data-theme="dark"] .coach p { color: #c4c4c4; }
html[data-theme="dark"] .coach-head span,
html[data-theme="dark"] .coach small,
html[data-theme="dark"] .coach-note { color: #a3a3a3; }
html[data-theme="dark"] .coach-topics article { background: #2f2f2f; border-color: #424242; }
html[data-theme="dark"] .coach-topics article .btn { color: #e0e0e0; }
html[data-theme="dark"] .coach p.coach-stage { color: #cfcfcf; }
html[data-theme="dark"] .coach-note textarea,
html[data-theme="dark"] .reason-prompt textarea { border-color: #525252; }
html[data-theme="dark"] .coach-feedback { background: rgba(255, 255, 255, .14); }
html[data-theme="dark"] .reason-prompt { color: #d4d4d4; }
html[data-theme="dark"] .reason-prompt summary { color: #cfcfcf; }
html[data-theme="dark"] body[data-course="fermentation"],
html[data-theme="dark"] body[data-course="plant"] {
  background:
    radial-gradient(1100px 680px at 4% -12%, #2a2a2a 0%, transparent 58%),
    radial-gradient(900px 640px at 102% 12%, #262626 0%, transparent 54%),
    radial-gradient(900px 620px at 52% 108%, #2b2b2b 0%, transparent 56%),
    #212121;
}
html[data-theme="dark"] body[data-course="fermentation"] { --amb-a: #2e2e2e; --amb-b: #2a2a2a; --amb-c: #2b2b2b; }
html[data-theme="dark"] body[data-course="plant"] { --amb-a: #2a2a2a; --amb-b: #2e2e2e; --amb-c: #2b2b2b; }
html[data-theme="dark"] body[data-course="fermentation"] .panel,
html[data-theme="dark"] body[data-course="plant"] .panel,
html[data-theme="dark"] body[data-course="fermentation"] .practice-card,
html[data-theme="dark"] body[data-course="plant"] .practice-card {
  background-image: linear-gradient(150deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .035));
  background-color: rgba(47, 47, 47, .72);
  border-color: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 13px 34px rgba(0, 0, 0, .4);
}
html[data-theme="dark"] body[data-course="fermentation"] .panel:hover,
html[data-theme="dark"] body[data-course="plant"] .panel:hover,
html[data-theme="dark"] body[data-course="fermentation"] .practice-card:hover,
html[data-theme="dark"] body[data-course="plant"] .practice-card:hover { border-color: rgba(255, 255, 255, .2); }
html[data-theme="dark"] body[data-course="fermentation"] .study-intro,
html[data-theme="dark"] body[data-course="plant"] .study-intro {
  background-image: linear-gradient(150deg, rgba(47, 47, 47, .9), rgba(42, 42, 42, .85));
}
html[data-theme="dark"] body[data-course="fermentation"] .dashboard-metrics .dash-metric:not(.dash-primary),
html[data-theme="dark"] body[data-course="plant"] .dashboard-metrics .dash-metric:not(.dash-primary),
html[data-theme="dark"] body[data-course="fermentation"] .dash-continue,
html[data-theme="dark"] body[data-course="plant"] .dash-continue {
  background-image: linear-gradient(150deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .04));
  background-color: rgba(47, 47, 47, .72);
  border-color: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 11px 28px rgba(0, 0, 0, .38);
}
html[data-theme="dark"] body[data-course="fermentation"] .option,
html[data-theme="dark"] body[data-course="plant"] .option {
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
html[data-theme="dark"] body[data-course="fermentation"] .option:has(:checked),
html[data-theme="dark"] body[data-course="plant"] .option:has(:checked),
html[data-theme="dark"] body[data-course="fermentation"] .option:hover,
html[data-theme="dark"] body[data-course="plant"] .option:hover { background: rgba(255, 255, 255, .12); }
html[data-theme="dark"] body[data-course="fermentation"] .option.correct,
html[data-theme="dark"] body[data-course="plant"] .option.correct { background: rgba(64, 190, 120, .18); }
html[data-theme="dark"] body[data-course="fermentation"] .option.incorrect,
html[data-theme="dark"] body[data-course="plant"] .option.incorrect { background: rgba(255, 110, 90, .18); }
html[data-theme="dark"] .seg-indicator {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 4px 14px rgba(0, 0, 0, .4);
}
html[data-theme="dark"] .set-row { border-top-color: #3a3a3a; }
html[data-theme="dark"] .set-copy small,
html[data-theme="dark"] .set-note,
html[data-theme="dark"] .set-profile-head small { color: #a3a3a3; }
html[data-theme="dark"] .set-seg { background: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .set-seg-btn { color: #d4d4d4; }
html[data-theme="dark"] .set-seg-btn.is-on { background: rgba(255, 255, 255, .16); color: #ffffff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .avatar-tile { border-color: #424242; background: #2f2f2f; }
html[data-theme="dark"] .avatar-tile:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .avatar-tile.is-on { box-shadow: inset 0 0 0 1px #ececec; }
html[data-theme="dark"] .avatar-tile:focus-visible { outline-color: #ececec; }
html[data-theme="dark"] .avatar-check { background: #525252; }
html[data-theme="dark"] .set-name { color: #d4d4d4; }
html[data-theme="dark"] .set-name input { border-color: #4a4a4a; color: var(--ink); background: #1a1a1a; }
html[data-theme="dark"] .set-name input:focus { outline-color: #ececec; }
html[data-theme="dark"] .review-card { border-color: #424242; background: #2f2f2f; }
html[data-theme="dark"] .review-card p,
html[data-theme="dark"] .review-course-head span,
html[data-theme="dark"] .review-soon li small { color: #a3a3a3; }
html[data-theme="dark"] .review-stems li { border-color: #4a4a4a; background: #262626; color: #d4d4d4; }
html[data-theme="dark"] .review-soon li strong { color: #e0e0e0; }
html[data-theme="dark"] .boot-bar { background: rgba(255, 255, 255, .14); }
html[data-theme="dark"] .boot-bar::after { background: linear-gradient(90deg, transparent, #b4b4b4, transparent); }
html[data-theme="dark"] .boot-shell small { color: #b4b4b4; }

/* Sidebar (desktop rail, tablet drawer and phone full-screen menu). */
html[data-theme="dark"] #study-sidebar {
  --sb-line: #424242;
  --sb-ink: #d9d9d9;
  --sb-muted: #b4b4b4;
  --sb-hover: rgba(255, 255, 255, .08);
  --sb-active-bg: rgba(255, 255, 255, .18);
  --sb-active-ink: #ffffff;
  background: #171717;
}
html[data-theme="dark"] .sb-avatar { background: #424242; color: #d9d9d9; }
html[data-theme="dark"] .sb-item:hover { color: #f5f5f5; }
html[data-theme="dark"] .sb-badge-warn { background: rgba(255, 110, 90, .18); color: #ff9d8f; }
html[data-theme="dark"] .sb-badge-blue { background: rgba(255, 255, 255, .18); color: #ffffff; }
html[data-theme="dark"] .sb-pop { background: #2f2f2f; box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
html[data-theme="dark"] .sb-pop a { color: #d9d9d9; }
html[data-theme="dark"] .sidebar-close { background: rgba(255, 255, 255, .1); color: #ececec; }
html[data-theme="dark"] .sb-avatar-slot:empty::before { background: linear-gradient(140deg, #525252, #6b6b6b); }
@media (max-width: 1023px) {
  html[data-theme="dark"] .mobile-bar { background: rgba(33, 33, 33, .84); border-bottom-color: rgba(255, 255, 255, .1); }
  html[data-theme="dark"] .mobile-bar button,
  html[data-theme="dark"] .mobile-bar a { color: #ececec; }
  html[data-theme="dark"] #study-sidebar { border-color: rgba(255, 255, 255, .12); }
  html[data-theme="dark"] body.menu-open .menu-shade:not([hidden]) { background: rgba(0, 0, 0, .55); }
}
@media (max-width: 767px) {
  html[data-theme="dark"] #study-sidebar {
    background: linear-gradient(168deg, rgba(23, 23, 23, .92), rgba(23, 23, 23, .78));
    color: #d9d9d9;
  }
  html[data-theme="dark"] #study-sidebar .sidebar-close { background: rgba(255, 255, 255, .1); color: #ececec; }
  html[data-theme="dark"] #study-sidebar .sb-user-main { color: #ececec; }
  html[data-theme="dark"] #study-sidebar .sb-group::before { color: #b4b4b4; }
  html[data-theme="dark"] #study-sidebar .sb-sep { background: rgba(255, 255, 255, .1); }
  html[data-theme="dark"] #study-sidebar .sb-item { color: #d9d9d9; }
  html[data-theme="dark"] #study-sidebar .sb-item:hover { background: rgba(255, 255, 255, .08); color: #f5f5f5; }
  html[data-theme="dark"] #study-sidebar .sb-item[aria-current="page"] { background: rgba(255, 255, 255, .2); color: #ffffff; }
  html[data-theme="dark"] #study-sidebar .sb-bottom .sb-trigger { color: #ececec; }
  html[data-theme="dark"] #study-sidebar .sb-bottom > .sb-item { background: rgba(255, 255, 255, .1); }
  html[data-theme="dark"] #study-sidebar .sb-pop { background: rgba(27, 32, 39, .92); box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
  html[data-theme="dark"] #study-sidebar .sb-pop a { color: #d9d9d9; }
  html[data-theme="dark"] #study-sidebar .sb-pop a:hover { background: rgba(255, 255, 255, .08); }
  html[data-theme="dark"] #study-sidebar .sb-pop .sb-sep { background: rgba(255, 255, 255, .1); }
  html[data-theme="dark"] #study-sidebar .sb-pop-id strong { color: #ececec; }
  html[data-theme="dark"] #study-sidebar .sb-pop-id small { color: #b4b4b4; }
}
@media (max-width: 767px) and (prefers-reduced-transparency: reduce) {
  html[data-theme="dark"] #study-sidebar { background: #171717; }
  html[data-theme="dark"] #study-sidebar .sb-pop { background: #2f2f2f; }
}
@media (min-width: 1024px) {
  html[data-theme="dark"] #study-sidebar {
    background: linear-gradient(168deg, rgba(23, 23, 23, .92), rgba(23, 23, 23, .78));
    border-right-color: rgba(255, 255, 255, .1);
    color: #d9d9d9;
  }
  html[data-theme="dark"] #study-sidebar .sb-top { border-bottom-color: rgba(255, 255, 255, .1); }
  html[data-theme="dark"] #study-sidebar .sb-bottom { border-top-color: rgba(255, 255, 255, .1); }
  html[data-theme="dark"] #study-sidebar .sb-user-main { color: #ececec; }
  html[data-theme="dark"] #study-sidebar .sb-group::before { color: #b4b4b4; }
  html[data-theme="dark"] #study-sidebar .sb-sep { background: rgba(255, 255, 255, .1); }
  html[data-theme="dark"] #study-sidebar .sb-item { color: #d9d9d9; }
  html[data-theme="dark"] #study-sidebar .sb-item:hover { background: rgba(255, 255, 255, .08); color: #f5f5f5; }
  html[data-theme="dark"] #study-sidebar .sb-item[aria-current="page"] { background: rgba(255, 255, 255, .2); color: #ffffff; }
  html[data-theme="dark"] #study-sidebar .sb-group-trigger { color: #d9d9d9; }
  html[data-theme="dark"] #study-sidebar .sb-group-trigger:hover { background: rgba(255, 255, 255, .08); color: #f5f5f5; }
  html[data-theme="dark"] #study-sidebar .sb-group-trigger.sb-active { background: rgba(255, 255, 255, .2); color: #ffffff; }
  html[data-theme="dark"] #study-sidebar .sb-quick { color: #d9d9d9; }
  html[data-theme="dark"] #study-sidebar .sb-quick:hover { background: rgba(255, 255, 255, .08); color: #f5f5f5; }
  html[data-theme="dark"] #study-sidebar .sb-quick[aria-current="page"] { background: rgba(255, 255, 255, .2); color: #ffffff; }
  html[data-theme="dark"] #study-sidebar .sb-quick::after { background: rgba(27, 32, 39, .95); border-color: rgba(255, 255, 255, .1); color: #ececec; }
  html[data-theme="dark"] #study-sidebar .sb-fly { background: linear-gradient(168deg, #171717, #1a1a1a); border-color: rgba(255, 255, 255, .1); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
  html[data-theme="dark"] #study-sidebar .sb-fly-head { color: #b4b4b4; }
  html[data-theme="dark"] #study-sidebar .sb-pop { background: linear-gradient(168deg, #171717, #1a1a1a); border-color: rgba(255, 255, 255, .1); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
  html[data-theme="dark"] #study-sidebar .sb-pop a { color: #d9d9d9; }
  html[data-theme="dark"] #study-sidebar .sb-pop a:hover { background: rgba(255, 255, 255, .08); }
  html[data-theme="dark"] #study-sidebar .sb-pop-id strong { color: #ececec; }
  html[data-theme="dark"] #study-sidebar .sb-pop-id small { color: #b4b4b4; }
}
@media (min-width: 1024px) and (prefers-reduced-transparency: reduce) {
  html[data-theme="dark"] #study-sidebar { background: #171717; }
  html[data-theme="dark"] #study-sidebar .sb-fly { background: #2f2f2f; }
  html[data-theme="dark"] #study-sidebar .sb-pop { background: #2f2f2f; }
}

/* Glass folders. */
html[data-theme="dark"] .gf-root { --gf-ink: #ececec; --gf-ink-soft: rgba(230, 232, 236, .6); color: #ececec; }
html[data-theme="dark"] .gf-shadow { background: rgba(0, 0, 0, .5); }
html[data-theme="dark"] .gf-back { background: linear-gradient(180deg, #3a3a3a 0%, #262626 100%); }
html[data-theme="dark"] .gf-back-sheen {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .12) 0%, rgba(255, 255, 255, 0) 22%),
    radial-gradient(120% 80% at 80% 0%, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0) 60%);
}
html[data-theme="dark"] .gf-back-rim path { stroke: rgba(255, 255, 255, .22); }
html[data-theme="dark"] .gf-front-rim stop { stop-color: #c4c4c4; }
html[data-theme="dark"] .gf-sheet {
  background: linear-gradient(180deg, #3a3a3a 0%, #2f2f2f 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    0 0 0 .5px rgba(255, 255, 255, .08),
    0 10px 26px -8px rgba(0, 0, 0, .6);
}
html[data-theme="dark"] .gf-root[data-open] .gf-sheet:hover,
html[data-theme="dark"] .gf-root[data-open] .gf-sheet:focus-visible {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 0 0 .5px rgba(255, 255, 255, .08), 0 22px 40px -12px rgba(0, 0, 0, .7);
}
html[data-theme="dark"] .gf-sheet-name { color: #ececec; }
html[data-theme="dark"] .gf-sheet-meta { color: rgba(230, 232, 236, .55); }
html[data-theme="dark"] .gf-lines i { background: rgba(230, 232, 236, .12); }
html[data-theme="dark"] .gf-lines i:first-child { background: rgba(230, 232, 236, .2); }
html[data-theme="dark"] .gf-tint {
  background: linear-gradient(180deg, rgba(255, 255, 255, .08) 0%, rgba(23, 23, 23, .55) 42%, rgba(23, 23, 23, .94) 100%);
}
html[data-theme="dark"] .gf-spec {
  background: radial-gradient(260px 200px at calc(50% + var(--gf-px) * 46%) calc(30% + var(--gf-py) * 40%), rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 70%);
}
html[data-theme="dark"] .gf-root[data-soon] .gf-meta { color: rgba(230, 232, 236, .45); }

/* Study desk / dashboard. */
html[data-theme="dark"] .study-desk { --desk-border: #424242; --desk-blue: #e0e0e0; background: #212121; color: #ececec; }
html[data-theme="dark"] .study-desk .nav-item[aria-current=page] { background: rgba(255, 255, 255, .18); color: #ffffff; }
html[data-theme="dark"] .dashboard-title h1 { color: var(--ink); }
html[data-theme="dark"] .dashboard-title p,
html[data-theme="dark"] .dash-continue p { color: #a3a3a3; }
html[data-theme="dark"] .dash-metric { background: #2f2f2f; color: #d9d9d9; }
html[data-theme="dark"] .dash-continue { background: #2f2f2f; }
html[data-theme="dark"] .study-desk .coach { background: #2f2f2f; }
html[data-theme="dark"] .study-desk .coach-topics article { background: #2f2f2f; }
html[data-theme="dark"] .study-desk .coach-topics article .btn { background: #3a3a3a; border-color: #4a4a4a; }
html[data-theme="dark"] .coach .question-illustration,
html[data-theme="dark"] .item-insight,
html[data-theme="dark"] .response-diagnosis,
html[data-theme="dark"] .point-checks { border-color: #424242; background: #2f2f2f; color: #d9d9d9; }
html[data-theme="dark"] .coach .question-illustration figure,
html[data-theme="dark"] .lookup-answer figure { color: #d9d9d9; }
html[data-theme="dark"] .lookup-filters :is(input, select) { border-color: #4a4a4a; background: #1a1a1a; }
html[data-theme="dark"] .lookup-question small { color: #cfcfcf; }
html[data-theme="dark"] .option-breakdown dd { color: #d4d4d4; }
html[data-theme="dark"] .correction-field summary { color: #cfcfcf; }
html[data-theme="dark"] .correction-field textarea { border-color: #525252; }
html[data-theme="dark"] .profile p { color: #a3a3a3; }
html[data-theme="dark"] .slot { border-color: #424242; background: #2f2f2f; }
html[data-theme="dark"] .slot small { color: #a3a3a3; }
@media (min-width: 1024px) {
  html[data-theme="dark"] .study-desk .site-header { background: #171717; }
}

/* Legal pages. */
html[data-theme="dark"] .legal-disclaimer { color: #b4b4b4; }
html[data-theme="dark"] .legal-tab { border-color: #424242; background: rgba(255, 255, 255, .06); color: #d9d9d9; }
html[data-theme="dark"] .legal-tab:hover { background: rgba(255, 255, 255, .1); }
html[data-theme="dark"] .legal-tab.is-active { background: #f5f5f5; color: #171717; }
html[data-theme="dark"] .legal-lead { color: #c4c4c4; }
html[data-theme="dark"] .legal-section h2 { color: var(--ink); }
html[data-theme="dark"] .legal-section p,
html[data-theme="dark"] .legal-section ul { color: #d9d9d9; }
html[data-theme="dark"] .legal-section strong { color: #f5f5f5; }
html[data-theme="dark"] .legal-foot { color: #b4b4b4; }
html[data-theme="dark"] .legal-foot a { color: #e0e0e0; }

@media (max-width: 900px) {
  html[data-theme="dark"] body[data-course="fermentation"] .option,
  html[data-theme="dark"] body[data-course="plant"] .option { background: rgba(255, 255, 255, .08); }
}

/* Reduced-transparency fallbacks. */
@media (prefers-reduced-transparency: reduce) {
  html[data-theme="dark"] .mc-nodes { background: #2f2f2f; }
  html[data-theme="dark"] .seg-indicator { background: #3a3a3a; }
  html[data-theme="dark"] body[data-course="fermentation"] .panel,
  html[data-theme="dark"] body[data-course="plant"] .panel,
  html[data-theme="dark"] body[data-course="fermentation"] .practice-card,
  html[data-theme="dark"] body[data-course="plant"] .practice-card,
  html[data-theme="dark"] body[data-course="fermentation"] .dashboard-metrics .dash-metric:not(.dash-primary),
  html[data-theme="dark"] body[data-course="plant"] .dashboard-metrics .dash-metric:not(.dash-primary),
  html[data-theme="dark"] body[data-course="fermentation"] .dash-continue,
  html[data-theme="dark"] body[data-course="plant"] .dash-continue { background: #2f2f2f; }
  html[data-theme="dark"] body[data-course="fermentation"] .option,
  html[data-theme="dark"] body[data-course="plant"] .option { background: #2f2f2f; }
}
