:root {
  color-scheme: light;
  --md-sys-color-primary: #415f91;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d6e3ff;
  --md-sys-color-on-primary-container: #284777;
  --md-sys-color-secondary: #565f71;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #dae2f9;
  --md-sys-color-on-secondary-container: #3e4759;
  --md-sys-color-tertiary: #705575;
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-background: #f9f9ff;
  --md-sys-color-on-background: #191c20;
  --md-sys-color-surface: #f9f9ff;
  --md-sys-color-surface-container-low: #f2f3fa;
  --md-sys-color-surface-container: #edefF6;
  --md-sys-color-surface-container-high: #e7e8ef;
  --md-sys-color-surface-container-highest: #e1e2e9;
  --md-sys-color-on-surface: #191c20;
  --md-sys-color-on-surface-variant: #44474e;
  --md-sys-color-outline: #74777f;
  --md-sys-color-outline-variant: #c4c6d0;
  --md-sys-color-success: #246b3c;
  --md-sys-color-success-container: #a8f5b9;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 999px;
  --shadow-1: 0 8px 28px rgba(36, 48, 70, 0.10);
  --shadow-2: 0 18px 56px rgba(36, 48, 70, 0.16);
  --motion: 180ms cubic-bezier(.2, 0, 0, 1);
  --shell: 1180px;
}

[data-accent="teal"] { --md-sys-color-primary: #006a67; --md-sys-color-on-primary: #fff; --md-sys-color-primary-container: #9cf2ed; --md-sys-color-on-primary-container: #00504e; --md-sys-color-tertiary: #4a6362; }
[data-accent="violet"] { --md-sys-color-primary: #6750a4; --md-sys-color-on-primary: #fff; --md-sys-color-primary-container: #e9ddff; --md-sys-color-on-primary-container: #4f378b; --md-sys-color-tertiary: #7d5260; }
[data-accent="coral"] { --md-sys-color-primary: #9c4236; --md-sys-color-on-primary: #fff; --md-sys-color-primary-container: #ffdad4; --md-sys-color-on-primary-container: #7d2b21; --md-sys-color-tertiary: #77574f; }

[data-theme="dark"] {
  color-scheme: dark;
  --md-sys-color-background: #111318; --md-sys-color-on-background: #e2e2e9; --md-sys-color-surface: #111318;
  --md-sys-color-surface-container-low: #191b20; --md-sys-color-surface-container: #1d1f24; --md-sys-color-surface-container-high: #282a2f; --md-sys-color-surface-container-highest: #33353a;
  --md-sys-color-on-surface: #e2e2e9; --md-sys-color-on-surface-variant: #c4c6d0; --md-sys-color-outline: #8e9099; --md-sys-color-outline-variant: #44474e;
  --md-sys-color-primary: #aac7ff; --md-sys-color-on-primary: #0a305f; --md-sys-color-primary-container: #284777; --md-sys-color-on-primary-container: #d6e3ff;
  --md-sys-color-secondary: #bec6dc; --md-sys-color-on-secondary: #283141; --md-sys-color-secondary-container: #3e4759; --md-sys-color-on-secondary-container: #dae2f9;
  --md-sys-color-error: #ffb4ab; --md-sys-color-error-container: #93000a; --md-sys-color-success: #8bd99f; --md-sys-color-success-container: #14532d;
}
[data-theme="dark"][data-accent="teal"] { --md-sys-color-primary: #80d5d1; --md-sys-color-on-primary: #003735; --md-sys-color-primary-container: #00504e; --md-sys-color-on-primary-container: #9cf2ed; }
[data-theme="dark"][data-accent="violet"] { --md-sys-color-primary: #cfbcff; --md-sys-color-on-primary: #381e72; --md-sys-color-primary-container: #4f378b; --md-sys-color-on-primary-container: #e9ddff; }
[data-theme="dark"][data-accent="coral"] { --md-sys-color-primary: #ffb4a8; --md-sys-color-on-primary: #5f160e; --md-sys-color-primary-container: #7d2b21; --md-sys-color-on-primary-container: #ffdad4; }

@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    color-scheme: dark;
    --md-sys-color-background: #111318; --md-sys-color-on-background: #e2e2e9; --md-sys-color-surface: #111318;
    --md-sys-color-surface-container-low: #191b20; --md-sys-color-surface-container: #1d1f24; --md-sys-color-surface-container-high: #282a2f; --md-sys-color-surface-container-highest: #33353a;
    --md-sys-color-on-surface: #e2e2e9; --md-sys-color-on-surface-variant: #c4c6d0; --md-sys-color-outline: #8e9099; --md-sys-color-outline-variant: #44474e;
    --md-sys-color-primary: #aac7ff; --md-sys-color-on-primary: #0a305f; --md-sys-color-primary-container: #284777; --md-sys-color-on-primary-container: #d6e3ff;
    --md-sys-color-secondary: #bec6dc; --md-sys-color-on-secondary: #283141; --md-sys-color-secondary-container: #3e4759; --md-sys-color-on-secondary-container: #dae2f9;
    --md-sys-color-error: #ffb4ab; --md-sys-color-error-container: #93000a; --md-sys-color-success: #8bd99f; --md-sys-color-success-container: #14532d;
  }
  [data-theme="system"][data-accent="teal"] { --md-sys-color-primary: #80d5d1; --md-sys-color-on-primary: #003735; --md-sys-color-primary-container: #00504e; --md-sys-color-on-primary-container: #9cf2ed; }
  [data-theme="system"][data-accent="violet"] { --md-sys-color-primary: #cfbcff; --md-sys-color-on-primary: #381e72; --md-sys-color-primary-container: #4f378b; --md-sys-color-on-primary-container: #e9ddff; }
  [data-theme="system"][data-accent="coral"] { --md-sys-color-primary: #ffb4a8; --md-sys-color-on-primary: #5f160e; --md-sys-color-primary-container: #7d2b21; --md-sys-color-on-primary-container: #ffdad4; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background var(--motion), color var(--motion);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
svg { display: block; }

.shell { width: min(calc(100% - 32px), var(--shell)); margin: 0 auto; }
.page { min-height: calc(100vh - 150px); padding-block: 38px 72px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 70%, transparent);
  background: color-mix(in srgb, var(--md-sys-color-background) 92%, transparent);
  backdrop-filter: blur(18px);
}
.topbar__inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 780; letter-spacing: -0.02em; }
.brand__mark { width: 42px; height: 42px; border-radius: 15px; display: grid; place-items: center; color: var(--md-sys-color-on-primary); background: var(--md-sys-color-primary); }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.nav__link { padding: 10px 14px; border-radius: var(--radius-full); color: var(--md-sys-color-on-surface-variant); transition: background var(--motion), color var(--motion); }
.nav__settings { display: inline-flex; align-items: center; gap: 7px; }
.nav__link:hover, .nav__link:focus-visible { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); outline: none; }
.role-chip, .status { display: inline-flex; align-items: center; width: fit-content; border-radius: var(--radius-full); padding: 4px 9px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }
.status--live { background: var(--md-sys-color-success-container); color: var(--md-sys-color-success); }

.button { border: 0; border-radius: var(--radius-full); min-height: 44px; padding: 10px 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-weight: 720; transition: transform var(--motion), box-shadow var(--motion), background var(--motion), color var(--motion); }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .icon-button:focus-visible, .mini-link:focus-visible { outline: 3px solid color-mix(in srgb, var(--md-sys-color-primary) 55%, transparent); outline-offset: 2px; }
.button--primary { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); box-shadow: var(--shadow-1); }
.button--primary:hover { box-shadow: var(--shadow-2); }
.button--secondary { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.button--ghost { background: transparent; color: var(--md-sys-color-on-surface); }
.button--ghost:hover { background: var(--md-sys-color-surface-container-high); }
.button--wide { width: 100%; }
.button--small { min-height: 36px; padding: 6px 14px; font-size: .88rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-form { display: inline; margin: 0; }
.hidden-form { display: none; }

.hero { min-height: 420px; display: grid; grid-template-columns: 1.12fr .88fr; align-items: center; gap: 48px; padding: 52px; border-radius: var(--radius-xl); background: radial-gradient(circle at 88% 20%, color-mix(in srgb, var(--md-sys-color-primary) 14%, transparent), transparent 38%), var(--md-sys-color-surface-container-low); overflow: hidden; border: 1px solid var(--md-sys-color-outline-variant); }
.hero h1, .article-hero h1, .dashboard-head h1, .form-page h1, .error-page h1, .settings-head h1 { margin: 8px 0 16px; font-size: clamp(2.35rem, 5.2vw, 4.8rem); line-height: 1.02; letter-spacing: -.05em; }
.hero h1 { max-width: 760px; }
.hero__visual { min-width: 0; }
.hero__visual svg { width: 100%; height: auto; filter: drop-shadow(0 24px 50px rgba(0,0,0,.22)); }
.svg-surface { fill: var(--md-sys-color-surface-container-high); }
.svg-primary { fill: var(--md-sys-color-primary); }
.svg-secondary { fill: var(--md-sys-color-secondary-container); }
.svg-muted { fill: var(--md-sys-color-outline-variant); }
.svg-check { fill: none; stroke: var(--md-sys-color-primary); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { color: var(--md-sys-color-primary); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 800; }
.lead { color: var(--md-sys-color-on-surface-variant); font-size: clamp(1.02rem, 1.8vw, 1.22rem); max-width: 740px; }
.muted { color: var(--md-sys-color-on-surface-variant); }

.section { margin-top: 72px; }
.stats-strip { margin-top: 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--radius-lg); background: var(--md-sys-color-outline-variant); }
.stats-strip > div { padding: 22px; display: grid; text-align: center; background: var(--md-sys-color-surface-container-low); }
.stats-strip strong { font-size: 2rem; color: var(--md-sys-color-primary); }
.stats-strip span, .course-meta { color: var(--md-sys-color-on-surface-variant); font-size: .82rem; }
.course-meta { width: fit-content; padding: 5px 10px; border-radius: var(--radius-full); background: var(--md-sys-color-surface-container-highest); }
.course-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.course-tags--hero { margin-top: 18px; }
.filter-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 18px; scrollbar-width: thin; }
.filter-chip { flex: 0 0 auto; padding: 9px 14px; border-radius: var(--radius-full); background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface-variant); border: 1px solid var(--md-sys-color-outline-variant); font-size: .88rem; font-weight: 680; }
.filter-chip:hover, .filter-chip--active { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); border-color: transparent; }
.section__head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section__head h2 { margin: 4px 0 0; font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -.035em; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card, .panel, .content-block, .question-card, .score-card, .lesson-card, .list-card { background: var(--md-sys-color-surface-container); border: 1px solid var(--md-sys-color-outline-variant); }
.card { min-height: 235px; padding: 24px; border-radius: var(--radius-lg); display: flex; flex-direction: column; transition: transform var(--motion), background var(--motion), border-color var(--motion); }
.card:hover { transform: translateY(-3px); background: var(--md-sys-color-surface-container-high); border-color: color-mix(in srgb, var(--md-sys-color-primary) 40%, var(--md-sys-color-outline-variant)); }
.card h3, .list-card h3, .lesson-card h3, .panel h3 { margin: 10px 0 8px; letter-spacing: -.02em; }
.card p, .list-card p { color: var(--md-sys-color-on-surface-variant); }
.card__icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 15px; color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.card__icon--large { width: 56px; height: 56px; border-radius: 20px; margin-bottom: 18px; }
.text-link { margin-top: auto; color: var(--md-sys-color-primary); font-weight: 760; }
.split-section { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.stack { display: grid; gap: 12px; }
.list-card { border-radius: var(--radius-md); padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.list-card h3, .list-card p { margin: 0; }
.list-card p { margin-top: 5px; }
.icon-button { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); font-weight: 900; transition: transform var(--motion); }
.icon-button:hover { transform: translateX(2px); }
.empty-state { padding: 28px; border: 1px dashed var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface-variant); border-radius: var(--radius-lg); background: var(--md-sys-color-surface-container-low); }

.auth-layout { min-height: 68vh; display: grid; place-items: center; }
.auth-card { width: min(100%, 500px); padding: 34px; border-radius: var(--radius-xl); background: var(--md-sys-color-surface-container); border: 1px solid var(--md-sys-color-outline-variant); box-shadow: var(--shadow-2); }
.auth-card h1 { margin: 4px 0 4px; font-size: 2.3rem; letter-spacing: -.04em; }
.auth-switch { margin: 22px 0 0; color: var(--md-sys-color-on-surface-variant); text-align: center; }
.auth-switch a { color: var(--md-sys-color-primary); font-weight: 700; }
.form-stack { display: grid; gap: 18px; }
.auth-card .form-stack { margin-top: 24px; }
.field { display: grid; gap: 8px; color: var(--md-sys-color-on-surface-variant); font-size: .92rem; font-weight: 650; }
.field input, .field textarea, .field select, .role-form select {
  width: 100%; border: 1px solid var(--md-sys-color-outline); background: var(--md-sys-color-surface-container-low); color: var(--md-sys-color-on-surface); outline: none; transition: border-color var(--motion), box-shadow var(--motion), background var(--motion);
}
.field input, .field select, .role-form select { min-height: 52px; border-radius: var(--radius-full); padding: 0 18px; }
.field textarea { min-height: 130px; resize: vertical; border-radius: var(--radius-lg); padding: 16px 18px; }
.field input:focus, .field textarea:focus, .field select:focus, .role-form select:focus { border-color: var(--md-sys-color-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent); background: var(--md-sys-color-surface-container-high); }
.switch-field { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; width: fit-content; }
.switch-field input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control { width: 52px; height: 32px; border-radius: var(--radius-full); border: 2px solid var(--md-sys-color-outline); background: var(--md-sys-color-surface-container-highest); position: relative; transition: all var(--motion); }
.switch-control::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: var(--md-sys-color-outline); top: 4px; left: 5px; transition: all var(--motion); }
.switch-field input:checked + .switch-control { background: var(--md-sys-color-primary); border-color: var(--md-sys-color-primary); }
.switch-field input:checked + .switch-control::after { transform: translateX(19px); background: var(--md-sys-color-on-primary); }
.switch-field input:focus-visible + .switch-control { outline: 3px solid color-mix(in srgb, var(--md-sys-color-primary) 45%, transparent); outline-offset: 3px; }

.notice { margin-bottom: 20px; border-radius: var(--radius-md); padding: 14px 18px; background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); border: 1px solid color-mix(in srgb, var(--md-sys-color-secondary) 30%, transparent); }
.notice--success { background: var(--md-sys-color-success-container); color: var(--md-sys-color-success); }
.notice--error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-error); }

.dashboard-head { display: flex; justify-content: space-between; align-items: end; gap: 22px; padding: 36px; border-radius: var(--radius-xl); background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.dashboard-head h1 { font-size: clamp(2.5rem, 7vw, 5rem); }
.dashboard-head .eyebrow, .dashboard-head .lead { color: inherit; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.panel { padding: 24px; border-radius: var(--radius-lg); }
.welcome-panel { display: flex; gap: 20px; align-items: center; }
.admin-list { display: grid; gap: 4px; }
.admin-row { padding: 14px 0; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.admin-row:last-child { border-bottom: 0; }
.admin-row > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }
.mini-link { border: 0; background: transparent; padding: 0; color: var(--md-sys-color-primary); font-weight: 700; cursor: pointer; }
.mini-link--danger { color: var(--md-sys-color-error); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 690px; }
.data-table th, .data-table td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.data-table th { color: var(--md-sys-color-on-surface-variant); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.role-form { display: flex; gap: 8px; align-items: center; }
.role-form select { min-width: 120px; min-height: 38px; padding-inline: 12px; }

.settings-head { padding: 38px 42px; border-radius: var(--radius-xl); background: linear-gradient(135deg, var(--md-sys-color-primary-container), color-mix(in srgb, var(--md-sys-color-primary-container) 58%, var(--md-sys-color-surface-container))); color: var(--md-sys-color-on-primary-container); }
.settings-head h1 { font-size: clamp(2.3rem, 5vw, 4.4rem); }
.settings-head .eyebrow, .settings-head .lead { color: inherit; }
.settings-form { max-width: 940px; margin: 26px auto 0; display: grid; gap: 18px; }
.settings-group { margin: 0; padding: 26px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--radius-lg); background: var(--md-sys-color-surface-container); }
.settings-group legend { padding: 0 10px; display: grid; gap: 3px; }
.settings-group legend strong { font-size: 1.2rem; }
.choice-grid { display: grid; gap: 12px; margin-top: 8px; }
.choice-grid--themes { grid-template-columns: repeat(3, 1fr); }
.choice-grid--accents { grid-template-columns: repeat(4, 1fr); }
.choice-card { position: relative; min-width: 0; padding: 16px; display: grid; gap: 8px; border: 2px solid transparent; border-radius: var(--radius-md); background: var(--md-sys-color-surface-container-low); cursor: pointer; transition: border-color var(--motion), transform var(--motion), background var(--motion); }
.choice-card:hover { transform: translateY(-2px); background: var(--md-sys-color-surface-container-high); }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card:has(input:checked) { border-color: var(--md-sys-color-primary); background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.choice-card:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--md-sys-color-primary) 45%, transparent); outline-offset: 2px; }
.choice-card small { color: var(--md-sys-color-on-surface-variant); }
.choice-card:has(input:checked) small { color: inherit; opacity: .78; }
.choice-card--compact { display: flex; align-items: center; }
.theme-preview { height: 76px; padding: 12px; display: grid; grid-template-columns: 1fr 1.5fr; grid-template-rows: 14px 1fr; gap: 7px; border-radius: var(--radius-sm); border: 1px solid #c4c6d0; background: #f9f9ff; }
.theme-preview i { display: block; border-radius: 999px; background: #415f91; }
.theme-preview i:first-child { grid-column: 1 / -1; }
.theme-preview i:nth-child(2) { border-radius: 8px; background: #d6e3ff; }
.theme-preview i:nth-child(3) { border-radius: 8px; background: #e1e2e9; }
.theme-preview--dark { border-color: #44474e; background: #111318; }
.theme-preview--dark i { background: #aac7ff; }
.theme-preview--dark i:nth-child(2) { background: #284777; }
.theme-preview--dark i:nth-child(3) { background: #33353a; }
.theme-preview--system { background: linear-gradient(115deg, #f9f9ff 0 49.5%, #111318 50%); }
.accent-swatch { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.accent-swatch--blue { background: #415f91; }.accent-swatch--teal { background: #006a67; }.accent-swatch--violet { background: #6750a4; }.accent-swatch--coral { background: #9c4236; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

.article-hero { padding: 44px; border-radius: var(--radius-xl); background: var(--md-sys-color-surface-container-low); border: 1px solid var(--md-sys-color-outline-variant); }
.article-hero h1 { font-size: clamp(2.4rem, 7vw, 5.4rem); max-width: 930px; }
.article-hero .button-row, .article-hero > .button { margin-top: 20px; }
.content-block { margin-top: 20px; border-radius: var(--radius-lg); padding: 28px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.prose--reading { font-size: 1.05rem; line-height: 1.8; }
.reading-layout { max-width: 920px; margin: 0 auto; }
.lesson-list { display: grid; gap: 14px; }
.lesson-card { border-radius: var(--radius-lg); padding: 22px; display: grid; grid-template-columns: 50px 1fr; gap: 16px; }
.lesson-card--done { border-color: color-mix(in srgb, var(--md-sys-color-success) 55%, var(--md-sys-color-outline-variant)); }
.lesson-complete { margin-top: 18px; }
.progress-wrap { max-width: 520px; margin-top: 24px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--md-sys-color-on-surface-variant); }
.progress-track { height: 8px; overflow: hidden; border-radius: var(--radius-full); background: var(--md-sys-color-surface-container-highest); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary)); }
.progress-0 { width: 0; }.progress-25 { width: 25%; }.progress-50 { width: 50%; }.progress-75 { width: 75%; }.progress-100 { width: 100%; }
.lesson-number { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); font-weight: 800; }
.lesson-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lesson-title-row h3 { margin-top: 8px; }
.lesson-actions { margin-top: 18px; }

.quiz-form { display: grid; gap: 16px; margin-top: 28px; }
.question-card { margin: 0; border-radius: var(--radius-lg); padding: 24px; }
.question-card legend { padding: 0 8px; font-size: 1.08rem; font-weight: 760; }
.question-index { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 9px; border-radius: 50%; background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.answer-option { display: flex; align-items: flex-start; gap: 12px; margin-top: 10px; padding: 13px 15px; border-radius: var(--radius-md); background: var(--md-sys-color-surface-container-low); cursor: pointer; transition: background var(--motion), transform var(--motion); }
.answer-option:hover { background: var(--md-sys-color-surface-container-high); transform: translateX(2px); }
.answer-option input { accent-color: var(--md-sys-color-primary); margin-top: 4px; }
.answer-feedback { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-md); display: grid; gap: 4px; }
.answer-feedback--ok { background: var(--md-sys-color-success-container); color: var(--md-sys-color-success); }
.answer-feedback--bad { background: var(--md-sys-color-error-container); color: var(--md-sys-color-error); }
.score-card { margin-top: 22px; border-radius: var(--radius-xl); padding: 28px; }
.score-card__score { font-size: 4rem; line-height: 1; font-weight: 850; letter-spacing: -.06em; margin-top: 8px; color: var(--md-sys-color-primary); }

.form-page { max-width: 860px; margin: 0 auto; }
.form-page h1 { font-size: clamp(2.1rem, 6vw, 4rem); }
.editor-form { padding: 28px; }
.error-page { min-height: 62vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; max-width: 760px; }
.error-code { font-size: clamp(5rem, 18vw, 10rem); font-weight: 900; color: var(--md-sys-color-primary); line-height: .8; letter-spacing: -.08em; opacity: .9; }

.footer { border-top: 1px solid var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface-variant); }
.footer__inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: .9rem; }

@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; padding: 36px; }
  .hero__visual { max-width: 580px; }
  .card-grid, .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .split-section { grid-template-columns: 1fr; }
  .dashboard-head { align-items: flex-start; flex-direction: column; }
  .choice-grid--accents { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 650px) {
  .shell { width: min(calc(100% - 22px), var(--shell)); }
  .page { padding-block: 22px 54px; }
  .topbar__inner { align-items: center; padding-block: 10px; gap: 10px; }
  .brand > span:last-child, .role-chip, .nav > .nav__link:first-child { display: none; }
  .nav { gap: 2px; }
  .nav__link, .nav__settings { padding: 9px; }
  .nav__settings span { display: none; }
  .nav .button { min-height: 40px; padding-inline: 13px; }
  .hero { min-height: auto; padding: 26px; border-radius: var(--radius-lg); }
  .hero__visual { display: none; }
  .card-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: 1fr; }
  .section { margin-top: 52px; }
  .section__head { align-items: flex-start; flex-direction: column; }
  .auth-card { padding: 24px; border-radius: var(--radius-lg); }
  .article-hero { padding: 28px; border-radius: var(--radius-lg); }
  .lesson-card { grid-template-columns: 1fr; }
  .settings-head { padding: 28px; border-radius: var(--radius-lg); }
  .settings-group { padding: 18px; }
  .choice-grid--themes, .choice-grid--accents { grid-template-columns: 1fr; }
  .footer__inner { align-items: flex-start; flex-direction: column; justify-content: center; padding-block: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
