:root {
  color-scheme: light;
  --ink: #17222f;
  --muted: #607080;
  --line: #d8e1e8;
  --paper: #ffffff;
  --surface: #f5f8fb;
  --navy: #12324a;
  --accent: #0f766e;
  --accent-dark: #0a5651;
  --gold: #bb7d23;
  --rose: #b13f55;
  --soft: #edf5f4;
  --focus: #f4cb61;
  --shadow: 0 18px 46px rgba(18, 50, 74, 0.13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(18, 50, 74, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(18, 50, 74, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, #f7fbfb 0%, #eef5fb 52%, #fff8ea 100%);
  background-size: 44px 44px, 44px 44px, auto;
  font-family: "Sora", Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

button, input, select { font: inherit; }

.button, button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 13px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

.button:hover, button:hover { border-color: var(--accent); transform: translateY(-1px); }
.primary { color: white; background: var(--accent); border-color: var(--accent); }
.primary:hover { background: var(--accent-dark); }
.ghost { background: transparent; }
.light { background: rgba(255, 255, 255, 0.86); color: var(--navy); }

.app-shell[hidden] { display: none !important; }

body:not([data-pathway]) .app-shell { display: none; }

.pathway-gate {
  min-height: 100vh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: hidden;
}

.pathway-gate[hidden] { display: none !important; }

#modularGateBackBtn {
  justify-self: center;
  margin-top: 6px;
  min-height: 38px;
  padding: 9px 18px;
}

.pathway-panel {
  width: min(760px, calc(100vw - 44px));
  display: grid;
  gap: 24px;
  padding: 40px 34px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.96);
  box-shadow: var(--shadow);
  text-align: center;
}

.pathway-hero {
  display: grid;
  gap: 18px;
  justify-items: center;
}

.teacher-avatar {
  width: 168px;
  height: 168px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(18, 50, 74, 0.18)),
    #fff;
  border: 1px solid rgba(18, 50, 74, 0.12);
  box-shadow: 0 12px 26px rgba(18, 50, 74, 0.10);
  color: var(--navy);
  overflow: hidden;
}

.teacher-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.teacher-name {
  margin: 0;
  font-size: clamp(28px, 4.4vw, 40px);
  line-height: 1.1;
  color: var(--navy);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.pathway-note {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  max-width: 42ch;
}

.pathway-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pathway-choice {
  min-width: 0;
  min-height: 130px;
  padding: 24px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244, 248, 251, 0.94));
  color: var(--ink);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 7px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(18, 50, 74, 0.08);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.pathway-choice strong {
  font-size: 25px;
  font-weight: 700;
}

.pathway-choice span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  max-width: 18ch;
  font-weight: 700;
}

.pathway-choice.linear {
  border-color: rgba(15, 118, 110, 0.20);
}

.pathway-choice.modular {
  border-color: rgba(187, 125, 35, 0.24);
}

.pathway-choice:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(18, 50, 74, 0.12);
}

.sync-status {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.mode-badge {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.10);
  border: 1px solid rgba(15, 118, 110, 0.18);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.locked-download {
  border: 1px dashed rgba(18, 50, 74, 0.28);
  background: rgba(255,255,255,0.92);
  color: var(--muted);
  min-height: 42px;
  font-weight: 800;
}

.locked-download:hover {
  border-color: rgba(18, 50, 74, 0.34);
  transform: none;
}

.toast-layer {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(18, 50, 74, 0.96);
  color: #fff;
  box-shadow: 0 12px 30px rgba(18, 50, 74, 0.2);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: rgba(15, 118, 110, 0.96);
}

.toast.info {
  background: rgba(18, 50, 74, 0.96);
}

button:focus-visible, .button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 22px rgba(18, 50, 74, 0.07);
}

.brand-block { min-width: 0; }
.brand { display: flex; gap: 8px; align-items: center; min-width: 0; font-size: 21px; font-weight: 800; line-height: 1.1; letter-spacing: 0; }
.brand-title { min-width: 0; overflow-wrap: break-word; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 29px;
  min-width: 54px;
  border-radius: 6px;
  color: #fff;
  background: var(--navy);
  font-size: 14px;
}
.teacher { margin-top: 3px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }

.shell {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 78px;
  display: grid;
  gap: 12px;
}

.quick-stats, .filters, .teacher-card, .study-card, .progress-card, .mistake-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(18, 50, 74, 0.08);
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  text-align: center;
  overflow: hidden;
}

.quick-stats div {
  padding: 12px 8px;
  border-right: 1px solid var(--line);
}

.quick-stats div:last-child { border-right: 0; }
.quick-stats strong { display: block; font-size: 22px; color: var(--accent-dark); }
.quick-stats span { display: block; color: var(--muted); font-size: 12px; }

.study-card, .progress-card, .mistake-card {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.mistake-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mistake-card-head .panel-title { margin: 0; }

.mistake-card-head button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.mistake-summary {
  display: grid;
  gap: 8px;
}

.mistake-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mistake-summary button {
  display: grid;
  gap: 3px;
  justify-items: start;
  min-height: 58px;
  padding: 9px 10px;
  border-color: rgba(177, 63, 85, 0.28);
  background: #fff8fa;
  text-align: left;
}

.mistake-summary strong {
  color: var(--ink);
  font-size: 12px;
}

.mistake-summary span {
  color: var(--rose);
  font-size: 11px;
  font-weight: 700;
}

.timer-face {
  position: relative;
  width: 118px;
  height: 118px;
  margin: 0 auto;
}

.timer-face svg {
  width: 118px;
  height: 118px;
  transform: rotate(-90deg);
}

.timer-track, .timer-ring {
  fill: none;
  stroke-width: 9;
}

.timer-track { stroke: #edf2f5; }
.timer-ring {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 300ms ease;
}

.timer-face strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--navy);
  font-size: 22px;
}

.timer-controls,
.timer-presets {
  display: grid;
  gap: 8px;
}

.timer-controls { grid-template-columns: 1fr 1fr; }
.timer-presets { grid-template-columns: repeat(3, 1fr); }

.timer-presets button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

.topic-progress {
  display: grid;
  gap: 10px;
}

.topic-progress-row {
  display: grid;
  gap: 5px;
}

.topic-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.topic-progress-head strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.topic-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f5;
}

.topic-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.filters {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.panel-title {
  margin: 0 0 2px;
  color: var(--navy);
  font-size: 15px;
}

.filters label, .sort-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filters input, .filters select, .sort-label select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #fff;
}

.filter-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.filter-buttons button:last-child { grid-column: 1 / -1; }

.teacher-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  border-top: 4px solid var(--gold);
}

.card-label {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.teacher-card strong { color: var(--ink); font-size: 16px; }
.teacher-card a { color: var(--accent-dark); font-weight: 700; text-decoration: none; }
.teacher-card .enroll-link {
  margin-top: 4px;
  min-height: 36px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.content {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.content-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.94);
  box-shadow: 0 10px 30px rgba(18, 50, 74, 0.07);
}

.head-tools {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.layout-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f9fb;
}

.layout-toggle button {
  min-height: 34px;
  min-width: 62px;
  border-color: transparent;
  background: transparent;
}

.layout-toggle button.active {
  color: #fff;
  background: var(--navy);
}

h1 { margin: 0; font-size: clamp(30px, 4vw, 54px); line-height: 1.04; letter-spacing: 0; }
h2 { margin: 0; font-size: 22px; letter-spacing: 0; }
p { margin: 4px 0 0; color: var(--muted); }

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 18px;
  align-items: stretch;
  min-width: 0;
  padding: 22px;
  border: 1px solid rgba(18, 50, 74, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(18, 50, 74, 0.96), rgba(15, 118, 110, 0.93)),
    #12324a;
  color: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 14px;
  min-width: 0;
  max-width: 860px;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy p {
  max-width: 740px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 16px;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.hero-actions > * { min-width: 0; }

.hero-card {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
}

.hero-card-head {
  display: grid;
  gap: 2px;
}

.hero-card-head span { color: rgba(255,255,255,0.74); font-size: 12px; font-weight: 700; }
.hero-card-head strong { font-size: 20px; }

.hero-preview {
  display: grid;
  gap: 8px;
}

.preview-item {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  min-height: 78px;
  padding: 8px;
  border-radius: 7px;
  background: rgba(255,255,255,0.92);
  color: var(--ink);
}

.preview-item img {
  width: 74px;
  height: 60px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.preview-item strong { display: block; font-size: 12px; }
.preview-item span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.25; }

.hero-contact {
  display: grid;
  gap: 4px;
  padding-top: 4px;
  color: rgba(255,255,255,0.82);
  font-size: 13px;
}

.hero-contact strong { color: #fff; font-size: 15px; }
.hero-contact a { color: #fff; font-weight: 800; text-decoration: none; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.feature-card {
  display: grid;
  gap: 7px;
  min-height: 154px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 10px 30px rgba(18, 50, 74, 0.07);
}

.feature-kicker {
  color: var(--rose);
  font-size: 12px;
  font-weight: 800;
}

.feature-card strong { color: var(--navy); font-size: 17px; }
.feature-card p { line-height: 1.45; }

.download-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.92fr);
  gap: 16px;
  align-items: center;
  min-width: 0;
  padding: 16px;
  border: 1px solid #e3d1a6;
  border-radius: 8px;
  background: #fffaf0;
  box-shadow: 0 10px 30px rgba(187, 125, 35, 0.12);
}

.download-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.download-actions a,
.download-actions button {
  min-height: 42px;
  min-width: 0;
  border: 1px solid #e2c582;
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}

.download-actions a:hover,
.download-actions button:hover {
  border-color: var(--gold);
}

.progress-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.92fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 16px;
  border: 1px solid #cfe3df;
  border-radius: 8px;
  background: #f2fbf8;
  box-shadow: 0 10px 30px rgba(15, 118, 110, 0.09);
}

.progress-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  overflow: hidden;
  border: 1px solid #cfe3df;
  border-radius: 8px;
  background: #fff;
}

.progress-summary div {
  padding: 12px 8px;
  text-align: center;
  border-right: 1px solid #cfe3df;
}

.progress-summary div:last-child { border-right: 0; }
.progress-summary strong { display: block; color: var(--accent-dark); font-size: 21px; }
.progress-summary span { color: var(--muted); font-size: 12px; }

.overall-progress {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.overall-progress div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfecea;
}

.overall-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 240ms ease;
}

.bank-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.95fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.96);
  box-shadow: 0 10px 30px rgba(18, 50, 74, 0.07);
}

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

.bank-buttons button {
  display: grid;
  justify-items: start;
  min-height: 76px;
  padding: 12px;
  text-align: left;
}

.bank-buttons button.active {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.bank-buttons strong {
  font-size: 15px;
}

.bank-buttons span {
  color: var(--muted);
  font-size: 12px;
}

.bank-buttons button.active span {
  color: rgba(255,255,255,0.78);
}

.practice-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(237, 245, 244, 0.95);
  box-shadow: 0 10px 30px rgba(18, 50, 74, 0.07);
}

.practice-panel a {
  min-height: 36px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
}

.topic-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
}

.topic-chip {
  flex: 0 0 auto;
  border-color: var(--line);
  background: var(--soft);
}

.topic-chip.active {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.modular-unit-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid #e2d6ae;
  border-radius: 8px;
  background: #fffaf1;
  box-shadow: 0 10px 30px rgba(187, 125, 35, 0.10);
}

.modular-unit-panel[hidden] { display: none !important; }

.modular-unit-panel .eyebrow {
  margin-bottom: 4px;
}

.modular-unit-panel h2 {
  margin: 0;
  color: var(--navy);
  font-size: 22px;
}

.modular-unit-panel p {
  margin: 4px 0 0;
  color: var(--muted);
}

.modular-unit-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.modular-unit-buttons button {
  min-width: 112px;
  border: 1px solid #e2c582;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
}

.modular-unit-buttons button.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.question-grid.list-view {
  grid-template-columns: 1fr;
}

.question-card {
  display: grid;
  grid-template-rows: auto 245px auto;
  gap: 9px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 10px 26px rgba(18, 50, 74, 0.08);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.question-grid.list-view .question-card {
  grid-template-columns: minmax(190px, 0.75fr) minmax(260px, 1.2fr) minmax(170px, 0.45fr);
  grid-template-rows: auto;
  align-items: stretch;
}

.question-grid.list-view .thumb {
  min-height: 155px;
}

.question-grid.list-view .card-actions {
  align-content: center;
}

.question-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.42);
  box-shadow: 0 16px 32px rgba(18, 50, 74, 0.12);
}

.question-card.selected {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}

.question-card.solved {
  background: #fbfdfb;
}

.question-card.mistake {
  border-color: rgba(177, 63, 85, 0.44);
  box-shadow: inset 0 0 0 1px rgba(177, 63, 85, 0.18);
}

.card-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
}

.topic-name {
  margin-top: 3px;
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.25;
}

.meta-line {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.status-line {
  margin-top: 5px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef2f3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pill.done {
  color: #fff;
  background: #25734f;
}

.pill.warn {
  color: #fff;
  background: var(--rose);
}

.thumb {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfbfa;
}

.thumb img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.card-actions button[data-action="solution"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.card-actions button[data-action="solution"]:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.viewer-dialog {
  width: min(1100px, 96vw);
  max-height: 94vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

.viewer-dialog::backdrop { background: rgba(20, 27, 35, 0.58); }

.viewer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

#viewerMeta { color: var(--muted); font-size: 13px; margin-top: 3px; }
#viewerImage { display: block; width: 100%; max-height: 82vh; object-fit: contain; background: white; }
.solution-dialog {
  width: min(880px, 96vw);
}

.mock-dialog {
  width: min(760px, 96vw);
}

.mock-body {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: #fff;
}

.mock-unit {
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 14px 16px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mock-unit strong {
  font-size: 17px;
}

.mock-unit span {
  color: var(--muted);
  font-size: 13px;
}

.mock-unit:hover {
  border-color: var(--accent);
}
.solution-body {
  padding: 18px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  background: #fff;
}
.solution-body p {
  margin: 0 0 14px;
  color: var(--ink);
}
.solution-body .solution-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  margin-bottom: 12px;
  border-radius: 999px;
  padding: 3px 9px;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
}
.solution-body .solution-empty {
  color: var(--muted);
}
.print-area { display: none; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; padding: 10px; }
  .sidebar { position: static; }
  .content { order: -1; }
  .hero-panel, .download-panel, .bank-panel, .progress-panel { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .content-head { align-items: stretch; flex-direction: column; }
  .head-tools { align-items: stretch; flex-direction: column; }
  .question-grid.list-view .question-card { grid-template-columns: 1fr; }
  .practice-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pathway-actions { grid-template-columns: 1fr; }
  .modular-unit-panel { grid-template-columns: 1fr; }
  .modular-unit-buttons { justify-content: stretch; }
  .modular-unit-buttons button { flex: 1 1 0; }
  .teacher-avatar { width: 140px; height: 140px; }
}

@media (max-width: 680px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .brand { align-items: flex-start; font-size: 19px; }
  .top-actions, .hero-actions { display: grid; grid-template-columns: 1fr; }
  .hero-panel { padding: 16px; }
  .hero-copy p, .feature-card p, .download-panel p, .hero-contact span { overflow-wrap: anywhere; }
  .download-actions, .bank-buttons { grid-template-columns: 1fr; }
  .progress-summary { grid-template-columns: repeat(2, 1fr); }
  .filter-buttons { grid-template-columns: 1fr; }
  .question-grid { grid-template-columns: 1fr; }
  .quick-stats { grid-template-columns: repeat(2, 1fr); }
  .practice-panel { grid-template-columns: 1fr; }
  .pathway-gate { padding: 14px; }
  .pathway-panel { width: calc(100vw - 28px); max-width: none; padding: 28px 18px; gap: 24px; }
  .pathway-choice { min-height: 96px; }
  .teacher-name { font-size: 24px; }
  .toast-layer { right: 12px; left: 12px; bottom: 12px; }
  .toast { max-width: none; width: 100%; }
}

@media (max-width: 420px) {
  .topbar { padding: 12px; }
  .shell { padding: 8px; }
  .brand { font-size: 18px; }
  h1 { font-size: 28px; }
  .hero-panel { padding: 12px; }
  .pathway-choice span { max-width: 100%; }
  .preview-item { grid-template-columns: 64px minmax(0, 1fr); }
  .preview-item img { width: 64px; }
  .teacher-avatar { width: 120px; height: 120px; border-radius: 50%; }
}

@media print {
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block; }
  .print-question { page-break-after: always; padding: 12mm; font-family: Arial, Helvetica, sans-serif; }
  .print-question h2 { font-size: 16pt; margin: 0 0 5mm; }
  .print-question img { width: 100%; max-height: 245mm; object-fit: contain; }
}
