:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-strong: #fbfbfc;
  --ink: #111111;
  --muted: #5f5f67;
  --line: #d7d7dc;
  --accent: #381850;
  --accent-dark: #241030;
  --gold: #604870;
  --red: #4b4b4b;
  --shadow: 0 18px 45px rgba(17, 17, 17, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.contrast {
  --bg: #050505;
  --surface: #111111;
  --surface-strong: #1d1d20;
  --ink: #ffffff;
  --muted: #c9c9cf;
  --line: #3d3d44;
  --shadow: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 28px;
  background: rgba(244, 244, 245, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

body.contrast .topbar {
  background: rgba(5, 5, 5, 0.9);
}

.brand,
.main-nav,
.hero-actions,
.filters,
.problem-meta {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  background: white;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.brand-mark img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.main-nav {
  gap: 8px;
}

.main-nav a,
.icon-button,
.filter,
.text-button,
.primary-action,
.secondary-action {
  border-radius: 8px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.main-nav a {
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 700;
}

.main-nav a:hover {
  color: var(--ink);
  background: rgba(56, 24, 80, 0.08);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  cursor: pointer;
}

.hero {
  position: relative;
  min-height: calc(100vh - 68px);
  overflow: hidden;
  display: grid;
  align-items: center;
  padding: 8vh 28px 18vh;
}

.hero-image,
.hero-shade {
  position: absolute;
  inset: 0;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-shade {
  background: linear-gradient(90deg, rgba(17, 17, 17, 0.85), rgba(17, 17, 17, 0.52) 42%, rgba(17, 17, 17, 0.08));
}

.hero-content {
  position: relative;
  width: min(680px, 100%);
  color: white;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #d6ccd9;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(3rem, 8vw, 6.7rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

.hero-copy {
  max-width: 580px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.55;
}

.hero-actions {
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  font-weight: 850;
}

.primary-action {
  color: white;
  background: var(--accent);
}

.secondary-action {
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.42);
}

.dashboard-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.core-concept-section {
  padding: clamp(34px, 6vw, 76px) 28px clamp(58px, 8vw, 104px);
  background: var(--bg);
}

.core-map {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 58px) 0 0;
}

body.contrast .core-map {
  background: transparent;
}

.core-map-heading {
  margin-bottom: clamp(28px, 4vw, 46px);
  text-align: center;
}

.core-map-heading .eyebrow {
  margin-bottom: 8px;
}

.core-map-heading h2 {
  font-size: clamp(2.1rem, 4vw, 4rem);
  font-family: inherit;
  font-weight: 800;
  line-height: 1.1;
}

.core-topic-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: minmax(168px, auto);
  column-gap: clamp(18px, 2.5vw, 30px);
  row-gap: clamp(22px, 3.5vw, 38px);
  align-items: stretch;
}

.core-topic-card {
  display: grid;
  place-items: center;
  min-height: 168px;
  padding: 24px 28px;
  color: #111111;
  font-family: inherit;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 6px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.core-topic-card:visited {
  color: #111111;
}

body.contrast .core-topic-card {
  color: #ffffff;
  background: var(--surface-strong);
  border-color: var(--line);
  border-top-color: #8a6aad;
  box-shadow: none;
}

.core-topic-card span {
  display: block;
  font-size: clamp(1.28rem, 1.8vw, 1.7rem);
  font-family: inherit;
  font-weight: 800;
  line-height: 1.16;
}

.core-topic-card:hover,
.core-topic-card:focus-visible {
  border-color: var(--accent);
  background: #fbfbfc;
  box-shadow: 0 24px 50px rgba(56, 24, 80, 0.18);
  outline: none;
  transform: translateY(-4px);
}

.core-topic-card.top-left {
  grid-column: 1 / span 4;
}

.core-topic-card.top-center {
  grid-column: 5 / span 4;
}

.core-topic-card.top-right {
  grid-column: 9 / span 4;
}

.core-topic-card.bottom-left {
  grid-column: 2 / span 4;
}

.core-topic-card.bottom-right {
  grid-column: 8 / span 4;
}

.contact-section {
  padding: 0 28px clamp(54px, 7vw, 86px);
  background: var(--bg);
}

.contact-shell {
  display: grid;
  grid-template-columns: minmax(240px, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(22px, 4vw, 46px);
  align-items: start;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding-top: clamp(32px, 5vw, 54px);
  border-top: 1px solid var(--line);
}

.contact-shell h2 {
  max-width: 12ch;
}

.contact-grid {
  display: grid;
  gap: 14px;
}

.contact-card {
  display: grid;
  gap: 8px;
  min-height: 98px;
  padding: 20px 22px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

a.contact-card {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

a.contact-card:hover,
a.contact-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 22px 46px rgba(56, 24, 80, 0.16);
  outline: none;
  transform: translateY(-3px);
}

.contact-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.contact-card strong {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.2;
}

.stat,
.streak {
  min-height: 112px;
  padding: 24px 28px;
  background: var(--surface);
}

.stat strong {
  display: block;
  font-size: 2.2rem;
  line-height: 1;
}

.stat span,
.streak span {
  color: var(--muted);
  font-weight: 750;
}

.streak {
  display: grid;
  align-content: center;
  gap: 12px;
}

progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
}

progress::-webkit-progress-bar {
  background: #d8d8de;
}

progress::-webkit-progress-value {
  background: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 28px;
  padding: 42px 28px;
}

.topic-panel,
.lesson-panel,
.problem-view {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topic-panel {
  align-self: start;
  padding: 22px;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading.wide {
  max-width: 980px;
}

.topic-list,
.problem-list,
.choice-grid {
  display: grid;
  gap: 10px;
}

.topic-card,
.subtopic-card,
.problem-card {
  width: 100%;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.topic-card.active,
.subtopic-card.active,
.problem-card.active,
.filter.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(56, 24, 80, 0.16);
}

.topic-card strong,
.subtopic-card strong,
.problem-card strong {
  display: block;
  margin-bottom: 6px;
}

.topic-card small {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.topic-card span,
.subtopic-card span,
.problem-card span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.topic-card em,
.subtopic-card em {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 850;
}

.archive-course-card {
  margin-top: 10px;
  color: #111111;
  background: #f1f1f3;
  border-color: #b8b8c0;
}

.archive-course-card.active,
.archive-course-card:hover {
  background: #ffffff;
  border-color: #381850;
  box-shadow: inset 0 0 0 2px rgba(56, 24, 80, 0.18);
}

.archive-course-card em {
  color: #241030;
}

.lesson-panel {
  padding: 26px;
}

.lesson-header,
.example-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.level-chip,
.problem-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  color: var(--accent-dark);
  background: rgba(56, 24, 80, 0.12);
  border: 1px solid rgba(56, 24, 80, 0.2);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.lesson-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(260px, 1.1fr);
  gap: 16px;
  margin-top: 26px;
}

.video-surface,
.article-surface,
.example-strip,
.solution-box {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.video-surface {
  min-height: 250px;
  display: grid;
  align-content: end;
  gap: 20px;
  padding: 20px;
  color: white;
  background:
    linear-gradient(160deg, rgba(17, 17, 17, 0.95), rgba(56, 24, 80, 0.34)),
    repeating-linear-gradient(45deg, transparent, transparent 22px, rgba(255, 255, 255, 0.08) 22px, rgba(255, 255, 255, 0.08) 24px);
}

.video-surface .eyebrow {
  color: #ded6e4;
}

.play-button {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: var(--accent-dark);
  background: #f7f7f8;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.article-surface {
  padding: 20px;
}

.article-surface ul {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.45;
}

.example-strip {
  margin-top: 16px;
  padding: 18px;
}

.text-button,
.filter {
  min-height: 38px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 800;
}

.answer-line {
  margin: 14px 0 0;
  padding: 14px 18px;
  color: var(--accent-dark);
  background: rgba(56, 24, 80, 0.1);
  border-radius: 8px;
  font-weight: 760;
}

.practice-band {
  padding: 46px 28px 64px;
  border-top: 1px solid var(--line);
}

.filters {
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.pool-tools {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(240px, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.pool-tools label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.pool-tools select,
.pool-tools input {
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.problem-layout {
  display: grid;
  grid-template-columns: minmax(260px, 390px) minmax(0, 1fr);
  gap: 22px;
}

.problem-list {
  align-content: start;
  max-height: 650px;
  overflow: auto;
  padding-right: 4px;
}

.problem-view {
  min-height: 430px;
  padding: 26px;
}

.problem-meta {
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

#problemPrompt {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.choice-grid {
  margin-top: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice {
  min-height: 48px;
  padding: 12px 14px;
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.choice.correct {
  border-color: var(--accent);
  background: rgba(56, 24, 80, 0.12);
}

.choice.wrong {
  border-color: var(--red);
  background: rgba(75, 75, 75, 0.1);
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  width: fit-content;
  padding: 0 16px;
  color: white;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 850;
}

.archive-panel {
  display: grid;
  gap: 20px;
}

.archive-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.archive-filter {
  min-height: 42px;
  padding: 0 14px;
  color: var(--ink);
  font-weight: 850;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.archive-filter.active {
  color: #111111;
  background: #ffffff;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(56, 24, 80, 0.14);
}

.archive-layout {
  grid-template-columns: minmax(220px, 310px) minmax(0, 1fr);
}

.archive-view {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.archive-view #archiveProblemTags {
  color: var(--muted);
  line-height: 1.45;
}

.archive-image-button {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: zoom-in;
}

.archive-question-image {
  display: block;
  width: 100%;
  max-height: 640px;
  object-fit: contain;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.archive-answer-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.archive-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.archive-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
  align-items: stretch;
}

.archive-choice.selected {
  box-shadow: none;
}

.archive-choice.eliminated {
  opacity: 0.58;
}

.archive-choice.correct .archive-choice-main {
  background: #f1f1f3;
  border-color: rgba(56, 24, 80, 0.48);
}

.archive-choice.wrong .archive-choice-main {
  background: rgba(75, 75, 75, 0.1);
  border-color: rgba(75, 75, 75, 0.46);
}

.archive-choice-main,
.archive-rule-out,
.primary-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
}

.archive-choice-main {
  min-height: 48px;
  padding: 12px 14px;
  color: var(--ink);
  font-size: 1.15rem;
  text-align: left;
  background: var(--surface);
}

.archive-choice.selected .archive-choice-main {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(56, 24, 80, 0.16);
}

.archive-choice.eliminated .archive-choice-main {
  text-decoration: line-through;
}

.archive-rule-out {
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface-strong);
}

.primary-button {
  padding: 0 16px;
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.archive-choice-main:disabled,
.archive-rule-out:disabled,
.primary-button:disabled {
  cursor: default;
}

.primary-button:disabled {
  opacity: 0.62;
}

.archive-submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.archive-feedback {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.archive-feedback.correct {
  color: #241030;
}

.archive-feedback.wrong {
  color: #4b4b4b;
}

.archive-solution-panel {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.archive-solution-panel h4,
.archive-solution-panel p {
  margin: 0;
}

.archive-solution-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.archive-solution-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.image-modal {
  width: min(1180px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  padding: 0;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

.image-modal::backdrop {
  background: rgba(17, 17, 17, 0.66);
}

.image-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.image-modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.image-modal img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 132px);
  padding: 18px;
  object-fit: contain;
  background: white;
}

@media (max-width: 760px) {
  .archive-layout {
    grid-template-columns: 1fr;
  }

  .archive-choice-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 761px) and (max-width: 1120px) {
  .archive-choice-grid {
    grid-template-columns: 1fr;
  }
}

.secondary-source {
  color: var(--accent-dark);
  background: rgba(56, 24, 80, 0.1);
  border: 1px solid rgba(56, 24, 80, 0.22);
}

.solution-box {
  margin-top: 20px;
  padding: 16px;
  color: var(--muted);
  line-height: 1.5;
}

.lecture-modal {
  width: min(760px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

.lecture-modal::backdrop {
  background: rgba(17, 17, 17, 0.58);
}

.lecture-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.lecture-player {
  display: grid;
  place-items: center;
  min-height: 220px;
  margin: 22px;
  color: white;
  background:
    radial-gradient(circle at 32% 38%, rgba(124, 90, 166, 0.5), transparent 28%),
    linear-gradient(135deg, var(--accent-dark), #26202d);
  border-radius: 8px;
}

.lesson-launcher {
  position: relative;
  width: 100%;
  border: 0;
  cursor: pointer;
  text-align: center;
}

.lesson-launcher small {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 850;
}

.lesson-launcher:hover,
.lesson-launcher:focus-visible {
  outline: 3px solid rgba(56, 24, 80, 0.28);
  outline-offset: 3px;
}

.lecture-player span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  color: var(--accent-dark);
  background: #f7f7f8;
  border-radius: 999px;
  font-weight: 900;
}

.lecture-modal ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0 32px 28px 46px;
  color: var(--muted);
  line-height: 1.55;
}

.topic-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 28px;
  align-items: end;
  padding: 54px 28px 36px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topic-hero h1 {
  max-width: 900px;
  color: var(--ink);
  font-size: clamp(2.6rem, 7vw, 5.8rem);
}

.topic-hero p:not(.eyebrow) {
  max-width: 820px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.topic-overview {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: baseline;
  padding: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topic-overview strong {
  font-size: 2rem;
}

.topic-overview span {
  color: var(--muted);
  font-weight: 800;
}

.course-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 28px;
  padding: 34px 28px;
}

.course-sidebar,
.course-main,
.learning-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.course-sidebar {
  align-self: start;
  padding: 20px;
}

.subtopic-list {
  display: grid;
  gap: 10px;
}

.course-main {
  padding: 26px;
}

.learning-card {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 24px;
  padding: 18px;
  box-shadow: none;
}

.lecture-player.compact {
  min-height: 210px;
  margin: 0;
}

.lesson-body {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.58;
}

.lesson-body p {
  margin: 0;
}

.lesson-body section {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.lesson-body h4 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
}

.formula-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px 14px 12px 34px;
  color: var(--ink);
  background: rgba(56, 24, 80, 0.08);
  border: 1px solid rgba(56, 24, 80, 0.18);
  border-radius: 8px;
  font-weight: 760;
}

.lesson-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 12px 16px 12px 34px;
  color: var(--ink);
  background: rgba(245, 245, 247, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lesson-list li {
  padding-left: 2px;
}

.lesson-modal {
  width: min(1040px, calc(100vw - 28px));
}

.modal-lesson-grid {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
}

.modal-player {
  min-height: 320px;
  margin: 0;
  align-self: start;
}

.math-fallback {
  display: inline-flex;
  align-items: center;
  gap: 0.08em;
  vertical-align: middle;
}

.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
  margin: 0 0.12em;
  transform: translateY(-0.03em);
}

.math-frac-top,
.math-frac-bottom {
  display: block;
  padding: 0 0.16em;
  font-size: 0.76em;
  white-space: nowrap;
}

.math-frac-top {
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 0.08em;
}

.math-frac-bottom {
  padding-top: 0.08em;
}

@media (max-width: 860px) {
  .topbar {
    padding: 0 16px;
  }

  .main-nav {
    display: none;
  }

  .hero {
    min-height: 86vh;
    padding: 8vh 18px 14vh;
  }

  .hero-shade {
    background: linear-gradient(90deg, rgba(17, 17, 17, 0.9), rgba(17, 17, 17, 0.58));
  }

  .dashboard-band,
  .workspace,
  .lesson-grid,
  .problem-layout,
  .pool-tools,
  .topic-hero,
  .course-layout,
  .learning-card,
  .modal-lesson-grid,
  .contact-shell {
    grid-template-columns: 1fr;
  }

  .workspace,
  .practice-band,
  .course-layout,
  .topic-hero,
  .contact-section {
    padding-inline: 16px;
  }

  .contact-shell h2 {
    max-width: none;
  }

  .lesson-header,
  .example-strip {
    display: grid;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .core-concept-section {
    padding-inline: 16px;
  }

  .core-map {
    padding: 30px 18px 34px;
    border-width: 4px;
  }

  .core-map-heading {
    margin-bottom: 28px;
  }

  .core-topic-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: 16px;
  }

  .core-topic-card,
  .core-topic-card.top-left,
  .core-topic-card.top-center,
  .core-topic-card.top-right,
  .core-topic-card.bottom-left,
  .core-topic-card.bottom-right {
    grid-column: 1;
    min-height: 112px;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 3rem;
  }

  .dashboard-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat,
  .streak {
    padding: 18px;
  }
}
