:root {
  color-scheme: light;
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-soft: #f0eee8;
  --surface-blue: #fff0e9;
  --ink: #191a1e;
  --ink-soft: #4f525a;
  --muted: #70737c;
  --line: #e5e0d7;
  --line-strong: #d7d0c5;
  --accent: #e85e32;
  --accent-dark: #b83f1d;
  --accent-soft: #fff0e9;
  --success: #237a4b;
  --success-soft: #eaf6ef;
  --warning: #93601d;
  --warning-soft: #fff4dd;
  --danger: #b64245;
  --danger-soft: #fff0f0;
  --shadow-sm: 0 2px 10px rgba(45, 38, 30, 0.045);
  --shadow-md: 0 12px 32px rgba(45, 38, 30, 0.075);
  --radius-lg: 20px;
  --radius-md: 15px;
  --radius-sm: 10px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --nav-height: 68px;
  --max-width: 1120px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

/* Owner-only curriculum pilot */
.curriculum-entry,
.course-hero,
.course-section-list,
.course-final-card,
.course-reading-head,
.course-article,
.course-section-actions {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e6e9ef);
  border-radius: 22px;
  padding: 20px;
  margin-bottom: 16px;
}

.curriculum-entry { background: linear-gradient(145deg, #fff8f2, #fff); border-color: #f3c9b8; }
.curriculum-entry h2, .course-hero h1, .course-reading-head h1 { margin: 4px 0 8px; }
.curriculum-entry p, .course-hero p, .course-reading-head p, .course-final-card p { color: var(--muted, #667085); line-height: 1.55; }
.curriculum-entry .primary-button, .course-hero .primary-button { width: 100%; margin-top: 14px; }
.course-progress { display: grid; gap: 8px; margin: 18px 0; }
.course-progress > span { font-size: 14px; color: var(--muted, #667085); }
.course-section-list { padding: 8px; overflow: hidden; }
.course-section-list .section-heading { padding: 12px 12px 8px; }
.course-section-row { width: 100%; min-height: 72px; display: grid; grid-template-columns: 38px minmax(0, 1fr) 24px; align-items: center; gap: 12px; border: 0; border-top: 1px solid var(--line, #e6e9ef); padding: 12px; background: transparent; color: inherit; text-align: left; }
.course-section-row strong, .course-section-row small { display: block; }
.course-section-row strong { line-height: 1.35; overflow-wrap: anywhere; }
.course-section-row small { color: var(--muted, #667085); margin-top: 5px; }
.course-section-number { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: #fff1ea; color: #c54f28; font-weight: 800; }
.course-final-card { display: grid; gap: 14px; }
.course-reading-page, .course-reading-page > *, .course-page, .course-page > * { min-width: 0; max-width: 100%; }
.course-article { font-size: 1rem; line-height: 1.7; overflow-wrap: anywhere; }
.course-article :is(h1, h2, h3, h4, h5, h6) { margin: 28px 0 10px; line-height: 1.25; }
.course-article p { margin: 0 0 16px; }
.course-article blockquote { margin: 20px 0; padding: 14px 16px; border-left: 4px solid #f26a3d; border-radius: 0 14px 14px 0; background: #fff5f0; }
.course-article ol, .course-article ul { padding-left: 22px; }
.course-table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--line, #e6e9ef); border-radius: 14px; }
.course-table-wrap table { width: 100%; min-width: min(27.5rem, 100%); border-collapse: collapse; font-size: 14px; }
.course-table-wrap th, .course-table-wrap td { padding: 11px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line, #e6e9ef); }
.course-table-wrap th { background: #f7f8fa; }
.course-figure { margin: 22px 0; }
.course-figure button { display: block; width: 100%; padding: 0; border: 0; border-radius: 16px; overflow: hidden; background: #eef1f5; }
.course-figure img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.course-figure figcaption { color: var(--muted, #667085); font-size: 13px; line-height: 1.45; margin-top: 8px; }
.course-image-anchor { display: block; height: 1px; }
.course-section-actions { display: grid; gap: 10px; }
.course-image-dialog { width: min(100vw, 960px); max-width: 100vw; max-height: 100dvh; padding: 12px; border: 0; border-radius: 16px; }
.course-image-dialog::backdrop { background: rgb(0 0 0 / .8); }
.course-dialog-viewport { overflow: auto; max-height: 76vh; overscroll-behavior: contain; }
.course-dialog-zoom { display: grid; place-items: center; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.course-dialog-zoom img { display: block; max-width: 100%; max-height: 76vh; margin: auto; object-fit: contain; }
.course-dialog-zoom.is-enlarged { width: 220%; cursor: zoom-out; }
.course-dialog-zoom.is-enlarged img { width: 100%; max-height: none; }
.course-dialog-close { position: sticky; z-index: 1; top: 0; display: block; margin: 0 0 6px auto; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #31343b; color: white; font-size: 26px; }
.course-image-dialog p { margin: 10px 4px 2px; color: #344054; overflow-wrap: anywhere; }

@media (max-width: 380px) {
  .course-hero, .course-reading-head, .course-article, .course-section-actions, .curriculum-entry { padding: 16px; border-radius: 18px; }
  .course-section-row { grid-template-columns: 34px minmax(0, 1fr) 20px; gap: 9px; padding: 11px 8px; }
  .course-article { font-size: 1rem; }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(232, 94, 50, 0.32);
  outline-offset: 3px;
}

button:not(:disabled),
a {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.loading-screen,
.error-screen {
  display: grid;
  min-height: 100vh;
  place-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: var(--ink-soft);
}

.loading-screen p,
.error-screen p {
  margin: 0;
  font-size: 1rem;
}

.loading-mark,
.brand-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: var(--accent);
  box-shadow: 0 7px 16px rgba(232, 94, 50, 0.2);
}

.loading-mark::before {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  content: "";
}

.loading-mark::after {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.loading-mark {
  animation: pulse 1.4s ease-in-out infinite;
}

.content-state {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.content-state.is-error {
  justify-content: space-between;
  border-color: rgba(182, 66, 69, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
}

.content-state-spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: content-spin 700ms linear infinite;
}

@keyframes content-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 430px) {
  .content-state.is-error {
    align-items: stretch;
    flex-direction: column;
  }

  .content-state.is-error .secondary-button {
    width: 100%;
  }
}

.quiz-setup-page,
.quiz-session-page {
  max-width: 760px;
  margin: 0 auto;
}

.quiz-resume-card,
.quiz-builder-card,
.quiz-question-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.quiz-resume-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding: var(--space-4);
}

.quiz-resume-card h2,
.quiz-resume-card p {
  margin: 0;
}

.quiz-resume-card h2 {
  margin-top: 5px;
  font-size: 1.05rem;
}

.quiz-builder-card {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.quiz-field {
  display: grid;
  gap: 8px;
}

.quiz-field > span,
.quiz-count-picker legend {
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 800;
}

.quiz-field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 40px 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.quiz-count-picker {
  margin: 0;
  padding: 0;
  border: 0;
}

.quiz-count-picker > div {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.quiz-count-picker .count-option {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-weight: 800;
}

.quiz-count-picker .count-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.quiz-builder-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink-soft);
}

.quiz-builder-summary strong {
  color: var(--ink);
}

.quiz-start-button {
  width: 100%;
}

.quiz-builder-note,
.quiz-error {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

.quiz-builder-note {
  color: var(--muted);
}

.quiz-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}

.quiz-question-card {
  min-height: 330px;
  padding: 24px;
}

.quiz-question-card.is-loading {
  display: grid;
  min-height: 260px;
  place-content: center;
  justify-items: center;
  gap: var(--space-3);
  color: var(--muted);
}

.quiz-question-card h2 {
  margin: 0 0 22px;
  font-size: clamp(1.2rem, 3.4vw, 1.55rem);
  line-height: 1.35;
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-option {
  display: grid;
  grid-template-columns: 34px 1fr;
  min-height: 54px;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.quiz-option > span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-weight: 800;
}

.quiz-option strong {
  font-size: 0.96rem;
  line-height: 1.35;
}

.quiz-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz-option.is-selected > span {
  background: var(--accent);
  color: #fff;
}

.quiz-navigation {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  gap: 10px;
  margin-top: var(--space-4);
}

.quiz-result-list {
  display: grid;
  gap: var(--space-4);
  margin: 14px 0 0;
  padding-left: 22px;
}

.quiz-result-list li {
  padding: 0 0 var(--space-4) 4px;
  border-bottom: 1px solid var(--line);
}

.quiz-result-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.quiz-result-list h3,
.quiz-result-list p {
  margin: 0;
}

.quiz-result-list h3 {
  margin-bottom: 10px;
  font-size: 1rem;
  line-height: 1.4;
}

.quiz-result-list p {
  margin-top: 5px;
  font-size: 0.9rem;
}

.quiz-result-list .is-wrong { color: var(--danger); }
.quiz-result-list .is-correct { color: var(--success); }
.quiz-result-list small { display: block; margin-top: 8px; color: var(--muted); line-height: 1.4; }

@media (max-width: 430px) {
  .quiz-builder-card,
  .quiz-question-card {
    padding: 16px;
  }

  .quiz-resume-card {
    align-items: stretch;
    flex-direction: column;
  }

  .quiz-resume-card .primary-button {
    width: 100%;
  }

  .quiz-question-card {
    min-height: 300px;
  }

  .quiz-navigation {
    grid-template-columns: 0.8fr 1.2fr;
  }
}

@keyframes pulse {
  50% { transform: scale(0.9); opacity: 0.72; }
}

.app-shell {
  width: min(100%, var(--max-width));
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 20px calc(var(--nav-height) + 52px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}

.brand-button,
.topbar-back,
.topbar-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 4px 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-copy span {
  color: var(--muted);
  font-size: 0.75rem;
}

.topbar-back,
.topbar-action {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease;
}

.topbar-back:hover,
.topbar-action:hover {
  background: var(--surface);
  color: var(--ink);
}

.topbar-action {
  color: var(--accent-dark);
}

.page {
  padding-top: 18px;
}

.page-intro {
  margin-bottom: 27px;
}

.home-page {
  padding-top: 34px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(230px, 0.65fr);
  align-items: end;
  gap: 32px;
  margin-bottom: 42px;
}

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

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.035em;
}

h1 {
  max-width: 690px;
  font-size: clamp(2.15rem, 5vw, 4.25rem);
  line-height: 0.99;
}

h2 {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.08;
}

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

.intro-copy {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 1.06rem;
  line-height: 1.55;
}

.disclaimer {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.55;
}

.badge-row,
.meta-row,
.topic-meta,
.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.badge.neutral {
  background: var(--surface-soft);
  color: var(--ink-soft);
}

.badge.empty {
  background: var(--warning-soft);
  color: var(--warning);
}

.section-block {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}

.section-heading p,
.page-subtitle {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}

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

.subject-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.subject-card:hover {
  border-color: rgba(55, 87, 213, 0.35);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.subject-icon {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 15px;
  background: var(--surface-blue);
  color: var(--accent);
}

.subject-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.card-arrow {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
}

.last-topic {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
}

.last-topic-copy {
  min-width: 0;
}

.last-topic-copy p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.4;
}

.text-button,
.link-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.text-button:hover,
.link-button:hover {
  background: var(--accent-soft);
}

.subject-head,
.topic-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 30px;
}

.subject-head-copy,
.topic-head-copy {
  min-width: 0;
}

.subject-head h1,
.topic-head h1 {
  max-width: 820px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.03;
}

.page-stat {
  display: grid;
  min-width: 154px;
  gap: 4px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.page-stat strong {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.page-stat span {
  color: var(--muted);
  font-size: 0.78rem;
}

.chapter-list {
  display: grid;
  gap: 12px;
}

.chapter {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
}

.chapter-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px 20px 14px;
}

.chapter-heading-button {
  width: 100%;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background 160ms ease;
}

.chapter-heading-button:hover {
  background: var(--surface-blue);
}

.chapter-heading-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 4px;
}

.chapter-heading-copy strong {
  font-size: 1.05rem;
  line-height: 1.25;
}

.chapter-heading-copy span {
  color: var(--muted);
  font-size: 0.8rem;
}

.chapter-arrow {
  width: 32px;
  height: 32px;
  background: var(--surface-soft);
  color: var(--accent-dark);
}

.chapter-number {
  display: inline-grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 900;
}

.chapter-heading h2 {
  font-size: 1.05rem;
  line-height: 1.25;
}

.chapter-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.topic-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 0 10px 10px;
}

.topic-card {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 13px 14px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

button.topic-card:hover {
  border-color: var(--line-strong);
  background: #fff;
  transform: translateY(-1px);
}

.topic-card.is-empty {
  color: var(--muted);
  background: #f8f9fc;
}

.topic-card-copy {
  min-width: 0;
}

.topic-number {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.topic-card h3 {
  font-size: 0.96rem;
  line-height: 1.32;
}

.topic-card-count {
  display: grid;
  min-width: 70px;
  flex: 0 0 auto;
  justify-items: end;
  gap: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: right;
}

.topic-card-count strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.topic-card.is-empty .topic-card-count strong {
  color: var(--muted);
}

.chapter-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 30px;
}

.chapter-page-copy {
  min-width: 0;
}

.chapter-page-copy h1 {
  max-width: 820px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.03;
}

.chapter-eyebrow {
  margin-top: 17px;
  margin-bottom: 8px;
}

.chapter-progress-panel {
  display: grid;
  gap: 15px;
  margin-top: 16px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.chapter-progress-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.chapter-progress-heading h2 {
  font-size: 1.25rem;
}

.chapter-progress-heading > span {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.chapter-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  color: var(--muted);
  font-size: 0.78rem;
}

.chapter-stat-row strong {
  color: var(--ink);
  font-size: 1rem;
}

.chapter-topic-list {
  display: grid;
  gap: 9px;
}

.chapter-topic-row {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  width: 100%;
  padding: 14px 15px 14px 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button.chapter-topic-row:hover {
  border-color: rgba(55, 87, 213, 0.35);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.chapter-topic-row.is-empty {
  color: var(--muted);
  background: #f8f9fc;
}

.chapter-topic-copy {
  min-width: 0;
}

.chapter-topic-copy h3 {
  font-size: 0.97rem;
  line-height: 1.32;
}

.chapter-topic-meta {
  display: grid;
  min-width: 96px;
  flex: 0 0 auto;
  justify-items: end;
  gap: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: right;
}

.chapter-topic-meta strong {
  color: var(--ink);
  font-size: 1.03rem;
}

.chapter-topic-row.is-empty .chapter-topic-meta strong {
  color: var(--muted);
}

.progress-subject-list,
.progress-chapter-list {
  display: grid;
  gap: 12px;
}

.progress-subject-card,
.progress-chapter-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.progress-subject-card:hover,
.progress-chapter-card:hover {
  border-color: rgba(55, 87, 213, 0.35);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.progress-subject-card {
  display: grid;
  gap: 22px;
  padding: 20px;
}

.progress-subject-card-head,
.progress-chapter-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.progress-subject-card-head > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-subject-card h2 {
  font-size: 1.15rem;
}

.progress-subject-card-stats,
.progress-chapter-card-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-subject-card-stats strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.progress-chapter-card {
  display: grid;
  gap: 17px;
  padding: 17px 18px;
}

.progress-chapter-card-top > div {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 11px;
}

.progress-chapter-card h3 {
  font-size: 1rem;
  line-height: 1.3;
}

.progress-chapter-card-bottom span:first-child {
  color: var(--ink-soft);
  font-weight: 750;
}

.progress-empty-note {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.86rem;
}

.weak-home-list {
  display: grid;
  gap: 8px;
}

.weak-home-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.weak-home-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.weak-home-row strong {
  font-size: 0.92rem;
}

.weak-home-row span {
  color: var(--muted);
  font-size: 0.78rem;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 15px;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 15px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(calc(100% - 30px), 520px);
  margin: 0 auto;
  padding: 6px;
  border: 1px solid rgba(213, 221, 234, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 10px 28px rgba(35, 48, 79, 0.14);
  backdrop-filter: blur(14px);
}

.bottom-nav-item {
  display: grid;
  min-height: 50px;
  place-items: center;
  gap: 2px;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.bottom-nav-item .icon {
  width: 18px;
  height: 18px;
}

.bottom-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.topic-intro-meta {
  margin-top: 14px;
}

.topic-head .page-stat {
  min-width: 128px;
}

.filter-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.progress-panel {
  margin-top: 16px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.progress-panel .section-heading {
  margin-bottom: 15px;
}

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

.progress-stat {
  display: grid;
  min-width: 0;
  min-height: 82px;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border-radius: 13px;
  background: var(--surface-soft);
}

.progress-stat strong {
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.progress-stat span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.progress-stat.success {
  background: var(--success-soft);
  color: var(--success);
}

.progress-stat.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.filter-label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.segment {
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 8px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.79rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.segment span {
  color: var(--muted);
  font-size: 0.75rem;
}

.segment.active {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}

.segment.active span {
  color: var(--accent);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 15px;
}

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

.progress-action {
  width: 100%;
  text-align: center;
}

.mode-card,
.setup-card,
.empty-state,
.summary-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.mode-card {
  display: grid;
  min-height: 181px;
  align-content: space-between;
  gap: 22px;
  padding: 20px;
}

.mode-card h2 {
  font-size: 1.16rem;
}

.mode-card p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.mode-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  margin-bottom: 15px;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-blue);
  color: var(--accent);
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 850;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 7px 15px rgba(55, 87, 213, 0.18);
}

.primary-button:hover {
  background: var(--accent-dark);
  box-shadow: 0 10px 20px rgba(55, 87, 213, 0.22);
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-button:hover {
  background: #ffe2e2;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.text-button:disabled {
  opacity: 0.48;
}

.setup-card {
  margin-top: 15px;
  padding: 20px;
}

.setup-card h2 {
  font-size: 1.3rem;
}

.setup-card > p {
  margin: 8px 0 18px;
  color: var(--ink-soft);
  font-size: 0.91rem;
  line-height: 1.45;
}

.count-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 17px;
}

.count-option {
  display: grid;
  min-height: 72px;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.count-option strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.count-option.active {
  border-color: var(--accent);
  background: var(--surface-blue);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.count-option.active strong {
  color: var(--accent-dark);
}

.setup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 25px 20px;
}

.empty-state h2 {
  font-size: 1.15rem;
}

.empty-state p {
  max-width: 600px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.91rem;
  line-height: 1.5;
}

.session-page,
.summary-page,
.result-page {
  max-width: 820px;
  margin: 0 auto;
}

.session-topbar {
  max-width: 820px;
  margin: 0 auto;
}

.session-topbar .topbar-back,
.session-topbar .topbar-action {
  min-width: 86px;
}

.session-topbar .topbar-action {
  justify-content: flex-end;
}

.session-progress-copy {
  display: grid;
  min-width: 0;
  max-width: 48%;
  justify-items: center;
  gap: 2px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.session-progress-copy span {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 200ms ease;
}

.session-intro {
  margin: 28px 0 13px;
}

.session-intro h1 {
  max-width: 740px;
  font-size: clamp(1.55rem, 4vw, 2.45rem);
  line-height: 1.08;
}

.question-card {
  margin-top: 15px;
  padding: clamp(20px, 4vw, 35px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.question-label {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-text {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.17rem, 3vw, 1.6rem);
  font-weight: 720;
  line-height: 1.42;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.answer-panel {
  margin-top: 25px;
  padding: 17px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 4px 13px 13px 4px;
  background: var(--surface-blue);
}

.answer-label {
  margin: 0 0 7px;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.answer-text {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.question-action {
  display: flex;
  margin-top: 27px;
  justify-content: flex-start;
}

.question-card .primary-button {
  min-width: 170px;
}

.choice-block {
  margin-top: 26px;
}

.choice-prompt {
  margin: 0 0 11px;
  color: var(--ink-soft);
  font-size: 0.91rem;
  font-weight: 800;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.choice-button {
  display: inline-flex;
  min-height: 50px;
  flex: 1 1 150px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 850;
}

.choice-button:hover {
  border-color: var(--accent);
  background: var(--surface-blue);
}

.choice-button.unknown:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.choice-button.correct:hover {
  border-color: var(--success);
  background: var(--success-soft);
}

.session-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
}

.session-footer .text-button {
  color: var(--ink-soft);
}

.summary-card,
.result-card {
  margin-top: 21px;
  padding: clamp(22px, 5vw, 34px);
}

.summary-card h1,
.result-card h1 {
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1;
}

.summary-subtitle {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
  line-height: 1.5;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 26px 0 21px;
}

.summary-stat {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 13px;
  background: var(--surface-soft);
}

.summary-stat strong {
  font-size: 1.5rem;
  letter-spacing: -0.04em;
}

.summary-stat span {
  color: var(--muted);
  font-size: 0.76rem;
}

.summary-stat.success {
  background: var(--success-soft);
  color: var(--success);
}

.summary-stat.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.summary-note {
  margin: 0;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--surface-blue);
  color: var(--accent-dark);
  font-size: 0.83rem;
  line-height: 1.45;
}

.summary-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 21px;
}

.result-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 20px;
  color: var(--accent-dark);
}

.result-score strong {
  font-size: clamp(3rem, 11vw, 5rem);
  letter-spacing: -0.08em;
  line-height: 0.92;
}

.result-score span {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 800;
}

.result-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 25px;
}

.result-detail div {
  display: grid;
  gap: 3px;
  padding: 14px;
  border-radius: 13px;
  background: var(--surface-soft);
}

.result-detail strong {
  font-size: 1.22rem;
}

.result-detail span {
  color: var(--muted);
  font-size: 0.78rem;
}

.wrong-list {
  display: grid;
  gap: 9px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
}

.wrong-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.wrong-item p {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.45;
  white-space: pre-wrap;
}

.wrong-item small {
  display: block;
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.no-errors {
  margin: 15px 0 0;
  padding: 14px;
  border-radius: 13px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.9rem;
  line-height: 1.45;
}

.icon {
  display: inline-block;
  width: 19px;
  height: 19px;
  vertical-align: middle;
}

@media (max-width: 760px) {
  .app-shell {
    padding-right: 15px;
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
    padding-left: 15px;
  }

  .topbar {
    min-height: 68px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .home-page {
    padding-top: 24px;
  }

  .home-intro {
    grid-template-columns: 1fr;
    gap: 17px;
    margin-bottom: 30px;
  }

  h1 {
    font-size: clamp(2.15rem, 11vw, 3.2rem);
  }

  .intro-copy {
    margin-top: 14px;
    font-size: 1rem;
  }

  .subject-grid,
  .mode-grid,
  .progress-actions,
  .topic-list {
    grid-template-columns: 1fr;
  }

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

  .progress-stat {
    min-height: 74px;
  }

  .last-topic {
    align-items: flex-start;
    flex-direction: column;
  }

  .last-topic .text-button {
    padding-left: 0;
  }

  .subject-head,
  .topic-head,
  .chapter-page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 22px;
  }

  .page-stat {
    width: 100%;
    min-width: 0;
  }

  .topic-head .page-stat {
    width: auto;
    min-width: 130px;
  }

  .chapter-page-head .page-stat {
    width: auto;
    min-width: 145px;
  }

  .chapter-heading {
    align-items: flex-start;
    padding: 16px 15px 12px;
  }

  .chapter-heading-button {
    padding-right: 12px;
    padding-left: 15px;
  }

  .chapter-topic-row {
    align-items: flex-start;
    padding: 14px 13px 14px 14px;
  }

  .chapter-topic-meta {
    min-width: 82px;
  }

  .chapter-progress-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .chapter-progress-heading > span {
    text-align: left;
  }

  .weak-home-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .weak-home-row .secondary-button {
    width: 100%;
  }

  .topic-list {
    padding-right: 8px;
    padding-left: 8px;
  }

  .topic-card {
    min-height: 73px;
  }

  .filter-panel {
    padding: 14px;
  }

  .segmented {
    gap: 3px;
  }

  .segment {
    min-height: 55px;
    padding-right: 4px;
    padding-left: 4px;
    font-size: 0.73rem;
  }

  .segment span {
    font-size: 0.7rem;
  }

  .count-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .count-option {
    min-height: 76px;
    padding-right: 5px;
    padding-left: 5px;
  }

  .session-topbar .topbar-back,
  .session-topbar .topbar-action {
    min-width: 68px;
    padding-right: 6px;
    padding-left: 6px;
    font-size: 0.78rem;
  }

  .session-progress-copy {
    font-size: 0.75rem;
  }

  .question-card {
    padding: 21px 18px;
  }

  .choice-button {
    flex-basis: 100%;
  }

  .summary-stats {
    gap: 6px;
  }

  .summary-stat {
    padding: 11px 9px;
  }

  .summary-stat strong {
    font-size: 1.3rem;
  }

  .summary-stat span {
    font-size: 0.7rem;
  }

  .summary-actions .primary-button,
  .summary-actions .secondary-button,
  .result-actions .primary-button,
  .result-actions .secondary-button {
    width: 100%;
  }
}

@media (min-width: 761px) {
  .page {
    padding-top: 30px;
  }

  .topic-page,
  .subject-page {
    padding-bottom: 30px;
  }
}

/* Popalos visual system */
.brand-mark {
  width: 38px;
  height: 38px;
  color: #fff;
}

.brand-symbol {
  width: 32px;
  height: 32px;
}

.brand-copy strong {
  font-size: 1rem;
  font-weight: 850;
}

.brand-copy span {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.page {
  padding-top: var(--space-3);
}

.home-page {
  padding-top: var(--space-4);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.35rem);
  line-height: 1.02;
}

h2 {
  font-size: clamp(1.22rem, 2.4vw, 1.65rem);
  line-height: 1.14;
}

.eyebrow,
.section-kicker {
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}

.home-intro {
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, 0.5fr);
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
  padding: var(--space-4) 0 var(--space-2);
}

.home-intro h1 {
  max-width: 630px;
  margin-top: var(--space-3);
}

.intro-copy {
  max-width: 560px;
  margin-top: var(--space-3);
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.5;
}

.disclaimer {
  padding-left: var(--space-4);
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.section-block {
  margin-top: var(--space-6);
}

.section-heading {
  margin-bottom: var(--space-3);
}

.badge {
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.subject-grid {
  gap: var(--space-3);
}

.subject-card {
  border-radius: var(--radius-md);
  box-shadow: none;
}

.subject-card:hover,
.progress-subject-card:hover,
.progress-chapter-card:hover {
  border-color: rgba(232, 94, 50, 0.35);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.subject-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.card-arrow {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
}

.subject-head,
.topic-head,
.chapter-page-head {
  margin-bottom: var(--space-6);
}

.subject-head h1,
.topic-head h1,
.chapter-page-copy h1 {
  margin-top: var(--space-3);
  font-size: clamp(1.75rem, 4.5vw, 2.85rem);
  line-height: 1.08;
}

.page-intro {
  margin-bottom: var(--space-6);
}

.page-intro h1 {
  font-size: clamp(1.8rem, 5vw, 2.7rem);
}

.page-stat {
  min-width: 132px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.chapter-list {
  gap: var(--space-3);
}

.chapter {
  border-radius: var(--radius-md);
  background: var(--surface);
}

.chapter-heading {
  padding: 15px 16px 12px;
}

.chapter-heading-button:hover {
  background: var(--accent-soft);
}

.chapter-number {
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.chapter-arrow {
  background: transparent;
  color: var(--ink-soft);
}

.topic-list {
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0 16px 8px;
}

.topic-card {
  min-height: 66px;
  padding: 12px 0;
  border-width: 0 0 1px;
  border-color: var(--line);
  border-radius: 0;
  background: transparent;
}

.topic-card:last-child {
  border-bottom: 0;
}

button.topic-card:hover {
  border-color: var(--line);
  background: transparent;
  transform: none;
}

.topic-card.is-empty {
  color: var(--ink-soft);
  background: transparent;
  opacity: 0.72;
}

.topic-number {
  color: var(--accent-dark);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.chapter-page-head {
  display: block;
}

.chapter-progress-panel {
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: 0 2px var(--space-2);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chapter-progress-heading {
  align-items: baseline;
}

.chapter-progress-heading h2 {
  font-size: 1rem;
}

.chapter-progress-heading > span {
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
}

.chapter-stat-row {
  gap: 6px 16px;
  font-size: 0.78rem;
}

.filter-panel {
  padding: 6px;
  border: 0;
  border-radius: 13px;
  background: var(--surface-soft);
  box-shadow: none;
}

.filter-label {
  padding: 4px 6px 0;
  margin-bottom: 6px;
  font-size: 0.76rem;
}

.segmented {
  gap: 3px;
  padding: 0;
  background: transparent;
}

.segment {
  min-height: 44px;
  padding: 6px;
  border-radius: 9px;
  font-size: 0.75rem;
}

.segment.active {
  color: var(--accent-dark);
  box-shadow: 0 1px 5px rgba(45, 38, 30, 0.08);
}

.progress-track {
  height: 6px;
  background: #e8e3da;
}

.progress-track span {
  background: var(--accent);
}

.chapter-actions {
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
}

.chapter-action-grid .primary-button {
  grid-column: 1 / -1;
}

.chapter-topic-list {
  gap: 0;
  border-top: 1px solid var(--line);
}

.chapter-topic-row {
  min-height: 70px;
  padding: 13px 2px;
  border-width: 0 0 1px;
  border-color: var(--line);
  border-radius: 0;
  background: transparent;
}

button.chapter-topic-row:hover {
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

.chapter-topic-row.is-empty {
  color: var(--ink-soft);
  background: transparent;
  opacity: 0.74;
}

.progress-subject-list,
.progress-chapter-list {
  gap: var(--space-3);
}

.progress-subject-card,
.progress-chapter-card {
  box-shadow: none;
}

.progress-subject-card {
  gap: var(--space-4);
  padding: var(--space-4);
}

.progress-subject-card-stats {
  gap: 5px 16px;
}

.progress-subject-card .progress-track {
  height: 5px;
}

.progress-chapter-card {
  gap: var(--space-3);
  padding: 15px 16px;
}

.progress-panel {
  padding: var(--space-4);
  box-shadow: none;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 46px;
  border-radius: 11px;
}

.primary-button {
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(232, 94, 50, 0.18);
}

.primary-button:hover {
  background: var(--accent-dark);
  box-shadow: 0 8px 17px rgba(232, 94, 50, 0.2);
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.mode-card,
.setup-card,
.empty-state,
.summary-card,
.result-card {
  box-shadow: none;
}

.bottom-nav {
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: none;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  margin: 0;
  padding: 6px max(12px, calc((100% - 520px) / 2)) env(safe-area-inset-bottom);
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -5px 18px rgba(45, 38, 30, 0.06);
  backdrop-filter: blur(12px);
}

.bottom-nav-item {
  min-height: 50px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.69rem;
}

.bottom-nav-item.active {
  background: transparent;
  color: var(--accent-dark);
}

.bottom-nav-item.active .icon {
  padding: 3px;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: var(--accent-soft);
}

.session-shell {
  padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom));
}

.session-topbar {
  min-height: 58px;
  padding: 7px 0;
}

.session-progress-line {
  margin-top: 0;
}

.session-progress-copy {
  max-width: none;
  color: var(--ink);
  font-size: 0.86rem;
}

.session-intro {
  margin: 18px 0 10px;
}

.session-intro h1 {
  max-width: 100%;
  font-size: clamp(1.15rem, 4vw, 1.5rem);
  line-height: 1.28;
}

.session-chapter {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.session-context {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.question-card {
  margin-top: var(--space-3);
  padding: clamp(22px, 5vw, 32px);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 28px rgba(45, 38, 30, 0.065);
}

.question-label,
.answer-label {
  margin-bottom: var(--space-3);
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: none;
}

.question-text {
  font-size: clamp(1.14rem, 3.8vw, 1.48rem);
  font-weight: 680;
  line-height: 1.48;
}

.answer-panel {
  margin-top: var(--space-6);
  padding: var(--space-4);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

.answer-label {
  color: var(--accent-dark);
}

.answer-text {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 560;
}

.choice-button.unknown {
  border-color: #e9c9ca;
  background: var(--danger-soft);
  color: var(--danger);
}

.choice-button.correct {
  border-color: #c9e2d4;
  background: var(--success-soft);
  color: var(--success);
}

.session-footer {
  min-height: 48px;
}

.previous-button:disabled {
  opacity: 0.32;
}

@media (max-width: 760px) {
  .app-shell {
    padding-right: 14px;
    padding-bottom: calc(var(--nav-height) + 44px + env(safe-area-inset-bottom));
    padding-left: 14px;
  }

  .session-shell {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 60px;
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .home-page {
    padding-top: 8px;
  }

  .home-intro {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding-top: var(--space-2);
  }

  .home-intro h1 {
    max-width: 390px;
    font-size: clamp(2rem, 10vw, 2.65rem);
  }

  .disclaimer {
    padding-left: var(--space-3);
  }

  .section-block {
    margin-top: 20px;
  }

  .subject-head,
  .topic-head,
  .chapter-page-head {
    gap: var(--space-3);
    margin-bottom: 18px;
  }

  .subject-head h1,
  .topic-head h1,
  .chapter-page-copy h1 {
    font-size: clamp(1.68rem, 8vw, 2.25rem);
  }

  .topic-list {
    padding: 0 14px 6px;
  }

  .chapter-heading {
    padding: 14px;
  }

  .chapter-progress-heading {
    align-items: baseline;
    flex-direction: row;
  }

  .chapter-progress-heading > span {
    text-align: right;
  }

  .chapter-topic-row {
    padding: 13px 0;
  }

  .filter-panel {
    padding: 5px;
  }

  .segment {
    min-height: 46px;
    padding: 5px 3px;
    font-size: 0.7rem;
  }

  .progress-actions {
    grid-template-columns: 1fr;
  }

  .chapter-action-grid .primary-button {
    grid-column: auto;
  }

  .progress-panel {
    padding: 14px;
  }

  .session-topbar .topbar-back,
  .session-topbar .topbar-action {
    min-width: 78px;
    font-size: 0.78rem;
  }

  .session-page {
    padding-top: 6px;
  }

  .question-card {
    padding: 22px 18px;
  }

  .choice-row {
    flex-wrap: nowrap;
  }

  .choice-button {
    min-width: 0;
    flex-basis: 0;
    padding-right: 8px;
    padding-left: 8px;
  }
}

@media (max-width: 390px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand-copy span {
    font-size: 0.68rem;
  }

  .subject-card .badge {
    font-size: 0.68rem;
  }

  .chapter-progress-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .chapter-progress-heading > span {
    text-align: left;
  }

  .chapter-topic-meta,
  .topic-card-count {
    min-width: 76px;
  }

  .session-topbar .topbar-back,
  .session-topbar .topbar-action {
    min-width: 72px;
    padding-right: 3px;
    padding-left: 3px;
  }

  .session-topbar .topbar-back span {
    display: none;
  }

  .segment {
    font-size: 0.66rem;
  }
}

/* UX cleanup: clearer hierarchy and interaction language */

.home-intro {
  display: block;
  max-width: 720px;
  padding-bottom: 0;
}

.home-intro .disclaimer {
  max-width: 520px;
  margin: var(--space-3) 0 0;
  padding: 0;
  border: 0;
  color: var(--muted);
}

.home-page > .section-block:first-of-type {
  margin-top: var(--space-4);
}

.subject-card {
  display: flex;
  min-height: 0;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-align: left;
}

.subject-card-copy {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.subject-card-title {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.24;
}

.subject-card .subject-stats {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  text-wrap: balance;
}

.subject-card > .subject-icon,
.subject-card > .card-arrow {
  align-self: center;
  margin: 0;
}

.subject-card > .subject-icon {
  flex: 0 0 auto;
}

.card-arrow,
.row-chevron {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.card-arrow .icon,
.row-chevron .icon {
  width: 17px;
  height: 17px;
}

.subject-card:hover .card-arrow,
.chapter-heading-button:hover .chapter-arrow,
.topic-card:hover .row-chevron,
.chapter-topic-row:hover .row-chevron,
.progress-subject-card:hover .card-arrow,
.progress-chapter-card:hover .card-arrow {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.subject-card:active,
.chapter-heading-button:active,
button.topic-card:active,
button.chapter-topic-row:active,
.progress-subject-card:active,
.progress-chapter-card:active {
  transform: scale(0.992);
}

.subject-head-compact,
.topic-head-compact {
  display: block;
  margin-bottom: var(--space-4);
}

.subject-head-compact .page-subtitle,
.topic-head-compact .page-subtitle {
  margin-top: var(--space-2);
}

.chapter {
  overflow: hidden;
  border: 1px solid var(--line);
}

.chapter-heading {
  width: 100%;
  min-height: 72px;
  padding: 14px 16px;
  background: #fbfaf7;
}

.chapter-heading-button {
  transition: background 150ms ease, transform 100ms ease;
}

.chapter-heading-button:hover {
  background: var(--accent-soft);
}

.chapter-heading-copy strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.28;
}

.chapter-heading-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.chapter-arrow {
  background: var(--surface);
}

.topic-list {
  padding: 0 16px 6px 58px;
}

.topic-card {
  display: grid;
  width: 100%;
  min-height: 62px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: 11px 2px;
  text-align: left;
}

.topic-card-copy,
.chapter-topic-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.topic-card-copy strong,
.chapter-topic-copy strong,
.topic-card-copy h3,
.chapter-topic-copy h3 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.91rem;
  font-weight: 700;
  line-height: 1.34;
}

.topic-card-copy span,
.chapter-topic-copy span {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

button.topic-card:hover {
  background: rgba(255, 240, 233, 0.55);
}

.topic-card.is-empty {
  opacity: 0.72;
}

.chapter-page-head {
  margin-bottom: var(--space-3);
}

.chapter-eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
}

.chapter-page-copy h1,
.topic-head-copy h1 {
  overflow-wrap: anywhere;
}

.chapter-progress-panel {
  margin: 0 0 var(--space-3);
  padding: 0;
}

.chapter-progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.chapter-progress-heading > span {
  color: var(--muted);
}

.chapter-progress-heading > span.has-weak {
  color: var(--danger);
}

.filter-panel {
  margin-top: var(--space-3);
}

.chapter-actions {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
}

.progress-actions {
  gap: var(--space-2);
}

.progress-action.text-button {
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--ink-soft);
}

.chapter-topic-list {
  border-top: 1px solid var(--line);
}

.chapter-topic-row {
  display: grid;
  width: 100%;
  min-height: 64px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: 11px 2px;
  text-align: left;
}

button.chapter-topic-row:hover {
  background: rgba(255, 240, 233, 0.45);
}

.chapter-topic-row.is-filter-empty {
  color: var(--ink-soft);
}

.chapter-topic-row.is-filter-empty .chapter-topic-copy strong {
  color: var(--ink-soft);
}

.progress-panel {
  margin-top: var(--space-4);
  padding: var(--space-4) 0;
  border-width: 1px 0;
  border-color: var(--line);
  border-radius: 0;
  background: transparent;
}

.topic-progress-summary {
  display: grid;
  gap: var(--space-3);
}

.topic-progress-summary > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.topic-progress-summary h2 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 700;
}

.topic-progress-summary strong {
  color: var(--ink);
  font-size: 1.28rem;
  letter-spacing: -0.035em;
}

.topic-progress-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: var(--space-3);
}

.topic-progress-stat {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 9px 12px;
  border-left: 1px solid var(--line);
}

.topic-progress-stat:first-child {
  padding-left: 0;
  border-left: 0;
}

.topic-progress-stat span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.topic-progress-stat strong {
  color: var(--ink);
  font-size: 1.16rem;
}

.topic-progress-stat.success strong {
  color: var(--success);
}

.topic-progress-stat.danger strong {
  color: var(--danger);
}

.topic-actions .section-heading {
  margin-bottom: var(--space-2);
}

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

.topic-action-grid .primary-button {
  grid-column: 1 / -1;
}

.progress-subject-list,
.progress-chapter-list {
  gap: var(--space-2);
}

.progress-subject-card {
  gap: var(--space-3);
  padding: 14px 15px;
}

.progress-subject-card-head {
  align-items: center;
}

.progress-subject-card-stats {
  gap: 4px 14px;
  color: var(--muted);
  font-size: 0.78rem;
}

.progress-chapter-card {
  gap: var(--space-2);
  padding: 13px 14px;
}

.progress-subject-summary {
  margin-bottom: var(--space-3);
}

.progress-subject-summary h1 {
  margin: var(--space-3) 0 var(--space-2);
  overflow-wrap: anywhere;
  font-size: clamp(1.75rem, 4.5vw, 2.7rem);
}

.progress-subject-total {
  margin: 0 0 var(--space-3);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.progress-subject-actions {
  margin-top: var(--space-3);
}

.progress-empty-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.session-intro {
  margin: 14px 0 8px;
}

.session-intro h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.session-context {
  align-items: baseline;
  gap: 3px 6px;
  margin-top: 6px;
}

.question-card {
  margin-top: var(--space-2);
}

.choice-block {
  margin-top: var(--space-4);
}

.summary-card {
  max-width: 650px;
}

.summary-card h1 {
  margin-top: 0;
}

.summary-stat-total strong {
  font-size: 2.3rem;
}

.summary-note {
  color: var(--muted);
  font-size: 0.76rem;
}

.bottom-nav {
  isolation: isolate;
}

@media (max-width: 760px) {
  .home-intro {
    margin-bottom: var(--space-3);
  }

  .subject-card {
    padding: 13px 14px;
  }

  .topic-list {
    padding-right: 13px;
    padding-left: 49px;
  }

  .chapter-heading {
    min-height: 68px;
  }

  .chapter-progress-heading {
    align-items: baseline;
    flex-direction: row;
  }

  .topic-action-grid {
    grid-template-columns: 1fr;
  }

  .topic-action-grid .primary-button {
    grid-column: auto;
  }

  .session-intro h1 {
    font-size: clamp(1.08rem, 5vw, 1.35rem);
  }

  .session-context span {
    white-space: normal;
  }
}

@media (max-width: 390px) {
  .subject-card {
    gap: 10px;
  }

  .subject-icon {
    width: 38px;
    height: 38px;
  }

  .card-arrow,
  .row-chevron {
    width: 30px;
    height: 30px;
  }

  .topic-list {
    padding-left: 14px;
  }

  .chapter-number {
    width: 32px;
    height: 32px;
  }

  .chapter-progress-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .chapter-progress-heading > span {
    text-align: left;
  }

  .chapter-topic-row,
  .topic-card {
    gap: 9px;
  }
}

@media (max-width: 330px) {
  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .subject-card-title {
    font-size: 1rem;
  }

  .chapter-heading {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    gap: 9px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .segment {
    min-width: 0;
    font-size: 0.61rem;
    line-height: 1.2;
  }

  .session-topbar .topbar-back,
  .session-topbar .topbar-action {
    min-width: 64px;
    font-size: 0.73rem;
  }

  .session-intro h1 {
    font-size: 1.04rem;
  }

  .session-context {
    font-size: 0.73rem;
  }

  .question-card {
    padding: 19px 15px;
  }
}

/* Unified subject route */

.subject-route-summary {
  display: grid;
  max-width: 760px;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.subject-route-summary h1 {
  margin-top: var(--space-1);
  overflow-wrap: anywhere;
  font-size: clamp(1.85rem, 5vw, 3rem);
  line-height: 1.04;
}

.subject-route-catalog,
.subject-route-total,
.subject-route-weak {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.4;
}

.subject-route-catalog {
  color: var(--muted);
  font-size: 0.82rem;
}

.subject-route-total strong {
  color: var(--ink);
  font-size: 1.12rem;
}

.subject-route-weak {
  color: var(--danger);
  font-weight: 750;
}

.subject-route-actions {
  display: grid;
  gap: var(--space-3);
  max-width: 760px;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.subject-route-action-copy p {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}

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

.subject-action-grid > :only-child {
  grid-column: 1 / -1;
}

.subject-chapter-list {
  display: grid;
  gap: var(--space-2);
}

.subject-chapter-card {
  display: grid;
  width: 100%;
  min-height: 82px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}

.subject-chapter-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.subject-chapter-card:active {
  transform: scale(0.992);
}

.subject-chapter-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.subject-chapter-copy > strong {
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.3;
}

.subject-chapter-meta,
.subject-chapter-weak {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.subject-chapter-weak {
  color: var(--danger);
}

.subject-chapter-progress {
  height: 5px;
  margin-top: var(--space-1);
}

.subject-chapter-card.is-complete .subject-chapter-progress span {
  background: var(--success);
}

.subject-chapter-indicators {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.chapter-state-check {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
}

.chapter-state-check .icon {
  width: 16px;
  height: 16px;
}

.subject-chapter-card:hover .row-chevron {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

@media (max-width: 760px) {
  .subject-route-summary h1 {
    font-size: clamp(1.68rem, 8vw, 2.25rem);
  }

  .subject-action-grid {
    grid-template-columns: 1fr;
  }

  .subject-action-grid > :only-child {
    grid-column: auto;
  }

  .subject-chapter-card {
    padding-right: 12px;
    padding-left: 12px;
  }
}

@media (max-width: 390px) {
  .subject-route-actions {
    padding: 14px;
  }

  .subject-chapter-card {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 9px;
  }

  .subject-chapter-indicators {
    gap: 4px;
  }

  .chapter-state-check {
    width: 26px;
    height: 26px;
  }
}

/* Home and Progress information architecture */

.home-session-block {
  margin: 0 0 var(--space-6);
}

.home-session-card {
  border-color: rgba(232, 94, 50, 0.24);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.home-session-subject {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.35;
}

.home-reminder-block {
  margin: 0 0 var(--space-6);
}

.home-reminder-card {
  display: grid;
  width: 100%;
  min-height: 74px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}

.home-reminder-card:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: var(--shadow-md);
}

.home-reminder-card:active {
  transform: translateY(1px);
}

.home-reminder-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.home-reminder-icon .icon {
  width: 22px;
  height: 22px;
}

.home-reminder-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.home-reminder-copy strong {
  font-size: 0.96rem;
  line-height: 1.3;
}

.home-reminder-copy > span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.35;
}

.home-intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.home-proof-row {
  display: flex;
  max-width: 640px;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--space-4);
}

.home-proof-row span {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 88%, var(--background));
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.3;
}

.home-proof-row strong {
  color: var(--ink);
}

.daily-training-block {
  margin: 0 0 var(--space-6);
}

.daily-training-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: clamp(16px, 3vw, 22px);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--accent-soft) 58%, var(--surface));
  box-shadow: var(--shadow-sm);
}

.daily-training-copy {
  min-width: 0;
}

.daily-training-copy h2,
.daily-training-copy p {
  margin: 0;
}

.daily-training-copy p:last-child {
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}

.daily-training-card > .primary-button {
  min-width: 132px;
}

.daily-change-subject {
  grid-column: 1 / -1;
  width: fit-content;
  min-height: 34px;
  padding: 2px 0;
  font-size: 0.78rem;
}

.home-product-note {
  max-width: 620px;
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.home-product-note strong {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.home-product-note p {
  margin: 5px 0 0;
  font-size: 0.76rem;
  line-height: 1.5;
}

.saved-session-list {
  display: grid;
  gap: var(--space-2);
}

.saved-session-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.saved-session-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.saved-session-copy > span {
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.35;
}

.saved-session-copy h3,
.saved-session-copy p {
  margin: 0;
}

.saved-session-copy h3 {
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.3;
}

.saved-session-copy p {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.saved-session-copy strong {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.saved-session-actions {
  display: grid;
  min-width: 146px;
  gap: 5px;
}

.saved-session-actions .primary-button {
  min-height: 42px;
  padding: 10px 13px;
}

.saved-session-delete {
  min-height: 36px;
  color: var(--danger);
}

.session-delete-sheet > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.progress-attention-list {
  display: grid;
  gap: var(--space-2);
}

.progress-attention-row {
  display: grid;
  width: 100%;
  min-height: 68px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 13px 12px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: border-color 150ms ease, transform 100ms ease;
}

.progress-attention-row:hover {
  border-color: var(--line-strong);
}

.progress-attention-row:active {
  transform: scale(0.992);
}

.progress-attention-row:hover .row-chevron {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.progress-attention-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.progress-attention-copy strong {
  overflow-wrap: anywhere;
  font-size: 0.94rem;
  line-height: 1.32;
}

.progress-attention-copy span,
.progress-attention-count {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.progress-attention-count {
  color: var(--danger);
  font-weight: 750;
  white-space: nowrap;
}

.filter-panel-stack {
  display: grid;
  gap: 8px;
}

.filter-group {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.filter-group + .filter-group {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.filter-panel-stack .filter-label {
  padding: 0 4px;
  margin: 0;
}

.year-segmented .segment {
  font-variant-numeric: tabular-nums;
}

.question-source {
  margin: -2px 0 var(--space-3);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .home-session-block {
    margin-bottom: var(--space-4);
  }

  .home-session-card .primary-button {
    width: 100%;
  }

  .home-intro-actions .primary-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .saved-session-card {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .saved-session-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .progress-attention-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px var(--space-2);
  }

  .progress-attention-count {
    grid-column: 1;
  }

  .progress-attention-row .row-chevron {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

@media (hover: none), (pointer: coarse) {
  .subject-card:focus:not(:focus-visible) {
    outline: none;
  }

  .subject-card:hover {
    border-color: var(--line);
    box-shadow: none;
    transform: none;
  }

  .subject-card:hover .card-arrow {
    background: var(--surface-soft);
    color: var(--ink-soft);
  }

  .subject-card:active {
    border-color: var(--line-strong);
    transform: scale(0.992);
  }

  .subject-card:active .card-arrow {
    background: var(--accent-soft);
    color: var(--accent-dark);
  }
}

/* Question reports */

.question-support-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-4);
}

.question-report-button {
  min-height: 44px;
  padding: 8px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 3px;
}

.question-report-button:hover {
  color: var(--ink-soft);
}

.question-report-button:active {
  transform: translateY(1px);
}

.report-modal-open {
  overflow: hidden;
}

.report-modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px 0;
  background: rgba(38, 32, 27, 0.42);
  backdrop-filter: blur(3px);
}

.report-sheet {
  width: min(100%, 540px);
  max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
  overflow-y: auto;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  box-shadow: 0 -14px 45px rgba(45, 38, 30, 0.18);
  outline: none;
}

.report-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.report-sheet-head h2 {
  margin: 0;
  font-size: 1.24rem;
  line-height: 1.2;
}

.report-close {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink-soft);
}

.report-close .icon {
  width: 18px;
  height: 18px;
}

.report-type-list {
  display: grid;
  gap: 7px;
}

.report-type-option {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
}

.report-type-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.report-type-dot {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}

.report-type-option.is-selected .report-type-dot {
  border: 5px solid var(--accent);
}

.report-comment {
  display: grid;
  gap: 7px;
  margin-top: 15px;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 800;
}

.report-comment small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.report-comment textarea {
  width: 100%;
  min-height: 94px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.93rem;
  line-height: 1.45;
}

.report-comment textarea:focus-visible {
  border-color: var(--accent);
  outline: 3px solid color-mix(in srgb, var(--accent) 20%, transparent);
}

.report-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.4;
}

.reminder-sheet .report-sheet-head > div {
  min-width: 0;
}

.reminder-sheet .section-kicker {
  margin: 0 0 4px;
}

.reminder-explainer {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.reminder-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.reminder-toggle-row > span {
  display: grid;
  gap: 3px;
}

.reminder-toggle-row strong {
  font-size: 0.92rem;
  line-height: 1.3;
}

.reminder-toggle-row small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.reminder-switch {
  position: relative;
  width: 50px;
  height: 30px;
  flex: 0 0 auto;
  padding: 3px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 150ms ease;
}

.reminder-switch > span {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(45, 38, 30, 0.22);
  transition: transform 160ms ease;
}

.reminder-switch.is-on {
  background: var(--accent);
}

.reminder-switch.is-on > span {
  transform: translateX(20px);
}

.reminder-switch:disabled {
  opacity: 0.58;
}

.reminder-interval {
  min-width: 0;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.reminder-interval legend {
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.reminder-interval > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.reminder-interval-option {
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 800;
  transition: border-color 150ms ease, background 150ms ease, transform 100ms ease;
}

.reminder-interval-option:hover {
  border-color: var(--line-strong);
}

.reminder-interval-option:active {
  transform: translateY(1px);
}

.reminder-interval-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.reminder-delivery {
  margin-top: 15px;
  padding: 12px;
  border: 1px solid rgba(35, 122, 75, 0.18);
  border-radius: 12px;
  background: var(--success-soft);
  color: var(--success);
}

.reminder-delivery.needs-attention {
  border-color: rgba(147, 96, 29, 0.2);
  background: var(--warning-soft);
  color: var(--warning);
}

.reminder-delivery p,
.reminder-status {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.5;
}

.reminder-delivery .secondary-button {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  background: var(--surface);
}

.reminder-status {
  margin-top: 10px;
  color: var(--muted);
}

.reminder-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 16px;
}

.reminder-actions button {
  min-width: 0;
}

.report-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 16px;
}

.report-actions button {
  min-width: 0;
}

.subject-access-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.subject-access-status.is-full {
  justify-content: flex-start;
  border-color: rgba(35, 122, 75, 0.18);
  background: var(--success-soft);
  color: var(--success);
}

.subject-access-status > span {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
}

.subject-access-status strong,
.subject-access-status p {
  margin: 0;
}

.subject-access-status p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.subject-access-status .text-button {
  flex: 0 0 auto;
}

.access-gate-sheet > p {
  margin: 12px 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.access-offer {
  margin-top: 16px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--background);
}

.access-offer strong,
.access-offer p {
  margin: 0;
}

.access-offer ul {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  padding-left: 19px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}

.access-offer b {
  color: var(--ink);
}

.access-offer p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.access-purchase-note {
  margin: 12px 2px 0 !important;
  color: var(--muted) !important;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.45 !important;
}

.access-gate-actions {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.access-gate-actions button {
  width: 100%;
}

.question-card-loading {
  min-height: 210px;
}

.question-loading-status {
  display: flex;
  min-height: 112px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 700;
}

.question-loading-skeleton {
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.question-loading-skeleton span {
  display: block;
  height: 15px;
  border-radius: 999px;
  background: var(--line);
}

.question-loading-skeleton span:nth-child(2) {
  width: 86%;
}

.question-loading-skeleton span:nth-child(3) {
  width: 58%;
}

@media (max-width: 420px) {
  .subject-access-status {
    align-items: flex-start;
    flex-direction: column;
  }

  .subject-access-status.is-full {
    flex-direction: row;
  }

  .access-gate-sheet {
    padding-right: 15px;
    padding-left: 15px;
  }

  .access-gate-sheet .report-sheet-head {
    align-items: flex-start;
  }

  .daily-training-card {
    grid-template-columns: 1fr;
  }

  .daily-training-card > .primary-button,
  .daily-change-subject {
    width: 100%;
  }

  .daily-change-subject {
    grid-column: auto;
  }
}

.report-notice {
  position: fixed;
  z-index: 1100;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 16px;
  max-width: 420px;
  margin: 0 auto;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  font-weight: 750;
  text-align: center;
}

@media (min-width: 700px) {
  .report-modal-backdrop {
    align-items: center;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .report-sheet {
    padding: 22px;
    border-radius: 20px;
    box-shadow: 0 22px 65px rgba(45, 38, 30, 0.2);
  }
}

/* Home: keep the approved product hierarchy for every user state. */
.home-session-block {
  margin: var(--space-6) 0 0;
}

.home-personal-heading {
  align-items: center;
}

.home-session-card {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 15px;
  color: var(--ink);
  text-align: left;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}

.home-session-card:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: var(--shadow-md);
}

.home-session-card:active {
  transform: scale(0.994);
}

.home-session-card .last-topic-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.home-session-card .last-topic-copy > strong {
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.3;
}

.home-session-card .last-topic-copy > span:last-child {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.home-session-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.home-session-action .icon {
  width: 17px;
  height: 17px;
}

.home-weak-block,
.home-reminder-block {
  margin-top: var(--space-6);
  margin-bottom: 0;
}

@media (max-width: 760px) {
  .home-intro {
    margin-bottom: 20px;
    padding-top: 4px;
  }

  .home-intro h1 {
    margin-top: 12px;
    font-size: clamp(2rem, 10.5vw, 2.7rem);
    line-height: 1.02;
  }

  .intro-copy {
    margin-top: 12px;
    font-size: 0.94rem;
    line-height: 1.48;
  }

  .home-proof-row {
    gap: 6px;
    margin-top: 15px;
  }

  .home-proof-row span {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 0.71rem;
  }

  .home-intro-actions {
    margin-top: 15px;
  }

  .daily-training-block {
    margin-bottom: 20px;
  }

  .daily-training-card {
    padding: 15px;
    border-radius: var(--radius-md);
  }

  .daily-training-copy p:last-child {
    margin-top: 5px;
    font-size: 0.8rem;
  }

  .home-session-block,
  .home-weak-block,
  .home-reminder-block {
    margin-top: 20px;
  }

  .home-personal-heading {
    gap: 10px;
    margin-bottom: 10px;
  }

  .home-personal-heading > div {
    min-width: 0;
  }

  .home-personal-heading h2 {
    overflow-wrap: normal;
    font-size: 1.05rem;
    line-height: 1.2;
  }

  .home-personal-heading .text-button {
    flex: 0 0 auto;
    font-size: 0.78rem;
  }

  .home-session-card {
    align-items: center;
    flex-direction: initial;
    padding: 12px 13px;
  }

  .home-session-action {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 0.76rem;
  }

  .home-reminder-card {
    min-height: 64px;
    padding: 10px 12px;
  }

  .home-reminder-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }
}

@media (max-width: 520px) {
  .daily-training-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 11px;
  }

  .daily-training-copy {
    grid-column: 1 / -1;
  }

  .daily-training-card > .primary-button {
    grid-column: 2;
    grid-row: 2;
    width: auto;
    min-width: 108px;
    min-height: 42px;
    padding: 9px 12px;
  }

  .daily-change-subject {
    grid-column: 1;
    grid-row: 2;
    width: fit-content;
    min-height: 42px;
    padding-right: 4px;
    text-align: left;
    white-space: normal;
  }

  .home-session-action {
    padding-right: 8px;
    padding-left: 8px;
  }
}

@media (max-width: 350px) {
  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .home-intro h1 {
    font-size: 1.92rem;
  }

  .badge {
    max-width: 100%;
    font-size: 0.7rem;
    white-space: normal;
  }

  .home-session-card {
    gap: 7px;
  }

  .home-session-action {
    width: 36px;
    padding: 0;
    font-size: 0;
  }

  .home-session-action .icon {
    margin: 0;
  }
}

/* Subject preferences, profile and subject-bundle checkout */
.subject-card-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.subject-card-title-row .subject-card-title {
  min-width: 0;
}

.subject-access-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.subject-access-badge.is-limit {
  background: var(--warning-soft);
  color: var(--warning);
}

.subject-access-badge.is-temporary {
  background: var(--surface-soft);
  color: var(--muted);
}

.subject-catalog-access-note {
  max-width: 650px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.subject-card-wrap {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.subject-card-wrap.is-preferred {
  border-color: rgba(232, 94, 50, 0.3);
}

.subject-card-wrap .subject-card {
  width: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.subject-preference-toggle {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.subject-card-wrap.is-preferred .subject-preference-toggle {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.subject-preference-toggle .icon {
  width: 15px;
  height: 15px;
}

.profile-page,
.access-page {
  max-width: 820px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: var(--space-6);
}

.profile-avatar {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 17px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.profile-avatar .icon {
  width: 25px;
  height: 25px;
}

.profile-hero h1 {
  margin-top: 3px;
  font-size: clamp(1.65rem, 5vw, 2.35rem);
}

.profile-hero p:last-child {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.profile-card,
.access-value-card,
.access-subject-picker,
.access-checkout-card {
  margin-bottom: var(--space-4);
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.access-value-card {
  display: grid;
  gap: 15px;
  border-color: rgba(232, 94, 50, 0.18);
  background: #fffcfa;
}

.access-value-card h2 {
  margin-top: 3px;
  font-size: 1.12rem;
}

.access-value-card ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.access-value-card li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1.45;
}

.access-value-check {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--success);
}

.access-value-check .icon {
  width: 13px;
  height: 13px;
}

.access-value-term {
  margin: 0;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  line-height: 1.45;
}

.profile-card > .primary-button {
  width: 100%;
  margin-top: 16px;
}

.profile-access-empty,
.profile-access-active {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.profile-access-empty p,
.profile-access-active p,
.profile-muted {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.profile-access-active {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--success-soft);
  color: var(--success);
}

.profile-access-active > span {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: #fff;
}

.profile-access-active .icon {
  width: 16px;
  height: 16px;
}

.profile-access-active p {
  color: #3e7657;
}

.profile-subject-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-subject-chips span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 0.76rem;
  font-weight: 750;
}

.profile-subject-chips .icon {
  width: 15px;
  height: 15px;
  color: var(--accent-dark);
}

.profile-links {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.profile-links > button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.profile-links > button:last-child {
  border-bottom: 0;
}

.profile-links > button:hover {
  background: var(--surface-soft);
}

.profile-links > button > span:first-child {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.profile-links > button > span:nth-child(2) {
  display: grid;
  gap: 3px;
}

.profile-links small {
  color: var(--muted);
  font-size: 0.74rem;
}

.profile-links .icon {
  width: 17px;
  height: 17px;
}

.tariff-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 18px 0 10px;
}

.tariff-grid > div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.tariff-grid strong {
  font-size: 0.78rem;
}

.tariff-grid span {
  color: var(--accent-dark);
  font-size: 1.12rem;
  font-weight: 900;
}

.tariff-upgrade-note {
  margin: 0 0 var(--space-6);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.access-subject-picker > div:last-child {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.tariff-subject {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.tariff-subject:hover:not(:disabled),
.tariff-subject.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tariff-subject.is-owned {
  border-color: rgba(35, 122, 75, 0.28);
  background: var(--success-soft);
}

.tariff-subject:disabled:not(.is-owned) {
  opacity: 0.52;
}

.tariff-subject > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.tariff-subject strong {
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tariff-subject small {
  color: var(--muted);
  font-size: 0.7rem;
}

.tariff-check {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
}

.tariff-subject.is-selected .tariff-check {
  background: var(--accent);
  color: #fff;
}

.tariff-subject.is-owned .tariff-check {
  background: var(--success);
  color: #fff;
}

.tariff-check .icon {
  width: 15px;
  height: 15px;
}

.access-checkout-card {
  display: grid;
  gap: 14px;
  border-color: rgba(232, 94, 50, 0.26);
  background: #fff8f4;
}

.access-checkout-card > div:first-child {
  display: grid;
  gap: 2px;
}

.access-checkout-card > div:first-child > span,
.access-checkout-card small,
.access-terms,
.access-checkout-help {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.access-checkout-card > div:first-child > strong {
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}

.access-checkout-card .primary-button {
  width: 100%;
}

.access-support-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.access-support-link > span {
  color: var(--muted);
  font-size: 0.76rem;
}

.access-support-link .text-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 6px 0;
  color: var(--accent-dark);
  font-size: 0.77rem;
}

.access-terms {
  margin: 0;
}

.access-checkout-help {
  margin: -3px 0 0;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 760px) {
  .profile-card,
  .access-value-card,
  .access-subject-picker,
  .access-checkout-card {
    padding: 15px;
    border-radius: var(--radius-md);
  }

  .access-subject-picker > div:last-child {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .subject-card-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .subject-access-badge {
    max-width: 100%;
    white-space: normal;
  }

  .tariff-grid {
    gap: 6px;
  }

  .tariff-grid > div {
    padding: 10px 8px;
  }

  .tariff-grid strong {
    font-size: 0.68rem;
  }

  .tariff-grid span {
    font-size: 0.95rem;
  }

  .access-value-card {
    gap: 13px;
  }

  .access-value-card li {
    font-size: 0.77rem;
  }

  .access-support-link {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
  }

  .access-support-link .text-button {
    min-height: 36px;
    text-align: left;
  }

  .profile-links > button {
    min-height: 64px;
  }

  .bottom-nav-item {
    font-size: 0.64rem;
  }
}

/* Home learning hierarchy: resume first, daily practice second. */
.home-page.is-returning {
  padding-top: 6px;
}

.home-learning-stack {
  display: grid;
  gap: 18px;
  margin: 0 0 var(--space-6);
}

.home-learning-stack > .home-session-block,
.home-learning-stack > .daily-training-block {
  margin: 0;
}

.home-learning-stack.has-active-session .daily-training-card {
  padding: 14px 15px;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
}

.home-learning-stack.has-active-session .daily-training-copy h2 {
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.scheduled-review-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 var(--space-6);
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.scheduled-review-block h2,
.scheduled-review-block p {
  margin: 0;
}

.scheduled-review-block h2 {
  margin-top: 2px;
  font-size: 1.18rem;
}

.scheduled-review-block h2 + p,
.scheduled-review-block div > span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.scheduled-review-block .primary-button,
.scheduled-review-block .secondary-button {
  flex: 0 0 auto;
  min-height: 42px;
}

.daily-training-card > .secondary-button {
  min-width: 118px;
}

@media (max-width: 760px) {
  .home-page.is-returning {
    padding-top: 2px;
  }

  .home-learning-stack {
    gap: 18px;
    margin-bottom: 20px;
  }

  .home-learning-stack.has-active-session .daily-training-card {
    padding: 14px;
  }
}

@media (max-width: 520px) {
  .scheduled-review-block {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }

  .scheduled-review-block .primary-button,
  .scheduled-review-block .secondary-button {
    width: 100%;
  }

  .daily-training-card > .secondary-button {
    grid-column: 2;
    grid-row: 2;
    width: auto;
    min-width: 108px;
    min-height: 42px;
    padding: 9px 12px;
  }
}

@media (max-width: 350px) {
  .home-learning-stack {
    gap: 16px;
  }
}

/* Shared, compact activity chooser for subject, chapter and topic pages. */
.learning-hub {
  display: grid;
  gap: 14px;
  margin: 16px 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.learning-hub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.learning-hub-head .section-kicker {
  margin: 0 0 3px;
}

.learning-hub-head h2 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  line-height: 1.2;
}

.learning-format-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.learning-format-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.learning-format-switch button {
  min-height: 38px;
  padding: 7px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 750;
}

.learning-format-switch button.active {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: 0 1px 4px rgb(34 23 17 / 8%);
}

.learning-hub-body {
  display: grid;
  gap: 12px;
}

.learning-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.learning-primary {
  width: 100%;
  justify-content: center;
}

.learning-alternate-resume {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.learning-alternate-resume span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.learning-alternate-resume .secondary-button {
  min-height: 40px;
  padding: 8px 12px;
  white-space: nowrap;
}

.learning-options {
  border-top: 1px solid var(--line);
}

.learning-options > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 2px 0;
  color: var(--accent-dark);
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  font-weight: 750;
}

.learning-options > summary::-webkit-details-marker,
.compact-filter > summary::-webkit-details-marker {
  display: none;
}

.learning-options > summary strong {
  margin-left: auto;
  color: var(--text);
}

.learning-options > summary .icon {
  margin-left: auto;
  transition: transform 160ms ease;
}

.learning-options[open] > summary .icon {
  transform: rotate(90deg);
}

.learning-menu {
  display: grid;
  gap: 2px;
  padding-top: 6px;
}

.learning-menu-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 9px 2px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-weight: 700;
}

.quiz-count-options fieldset {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
}

.quiz-count-options legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.quiz-count-options fieldset button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 750;
}

.quiz-count-options fieldset button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.compact-filter-shell {
  margin: 12px 0 14px;
}

.compact-filter {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.compact-filter > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 9px 13px;
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  font-weight: 750;
}

.compact-filter-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-dark);
  font-size: 0.8rem;
}

.compact-filter-action .icon {
  transition: transform 160ms ease;
}

.compact-filter[open] .compact-filter-action .icon {
  transform: rotate(90deg);
}

.compact-filter-body {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.compact-filter-body > .filter-group:first-child {
  padding-top: 12px;
}

@media (max-width: 520px) {
  .learning-hub {
    gap: 12px;
    margin: 14px 0 18px;
    padding: 14px;
  }

  .learning-hub-head {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .learning-format-switch {
    width: 100%;
  }

  .learning-primary {
    min-height: 46px;
  }

  .learning-alternate-resume {
    grid-template-columns: 1fr;
  }

  .learning-alternate-resume .secondary-button {
    width: 100%;
  }

  .compact-filter-shell {
    margin: 10px 0 12px;
  }
}
.topic-access-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.topic-access-badge.is-free,
.topic-access-notice.is-free {
  color: #27643c;
  background: #eef8f1;
}

.subject-access-badge.is-free {
  color: #27643c;
  background: #eef8f1;
}

.topic-access-badge.is-partial,
.topic-access-notice.is-partial {
  color: #76561c;
  background: #fff7e6;
}

.topic-access-badge.is-locked,
.topic-access-notice.is-locked {
  color: var(--muted);
  background: var(--surface-soft, #f5f4f1);
}

.topic-access-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
}

.topic-access-notice span {
  color: inherit;
  font-size: 13px;
}

.owner-preview-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.owner-preview-card h2 {
  margin: 2px 0 4px;
}

.owner-preview-card p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* v47: one clear next step, compact catalog, and separated progress sources. */
.home-next-card {
  margin: 0 0 16px;
  padding: 20px;
  border: 1px solid rgba(242, 106, 61, 0.22);
  border-radius: 20px;
  background: linear-gradient(150deg, #fff 0%, #fff8f4 100%);
  box-shadow: 0 10px 28px rgba(58, 39, 29, 0.07);
}

.home-next-card h2 {
  margin: 4px 0 7px;
  font-size: clamp(22px, 6vw, 28px);
  line-height: 1.12;
}

.home-next-card > p:not(.section-kicker) {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.home-next-card .primary-button {
  width: 100%;
}

.home-next-card .text-button {
  display: block;
  margin: 12px auto 0;
}

.home-quick-actions,
.progress-subject-rows,
.attempt-history-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.home-quick-actions > button,
.progress-subject-row,
.attempt-history-row,
.subject-route-row {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}

.home-quick-actions > button:disabled {
  opacity: 0.6;
}

.home-quick-actions strong,
.progress-subject-row strong,
.attempt-history-row strong,
.subject-route-row strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
}

.home-quick-actions small,
.progress-subject-row small,
.attempt-history-row small,
.subject-route-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.quick-action-icon,
.subject-route-row-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}

.quick-action-icon svg,
.subject-route-row-icon svg {
  width: 20px;
  height: 20px;
}

.home-last-result {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: var(--surface-soft);
  text-align: left;
}

.home-last-result small,
.home-last-result strong {
  display: block;
}

.home-last-result small {
  margin-bottom: 4px;
  color: var(--muted);
}

.home-last-result > span:last-child {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.compact-intro {
  padding-bottom: 14px;
}

.subject-route-links {
  display: grid;
  gap: 10px;
}

.subject-route-row.is-free {
  border-color: rgba(34, 139, 94, 0.24);
}

.subject-route-row.is-free .subject-route-row-icon {
  color: #19764e;
  background: #eaf8f0;
}

.progress-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.progress-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.progress-tabs button.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(40, 32, 28, 0.08);
}

.progress-overview-card {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.progress-metric-grid,
.subject-progress-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.progress-metric-grid article,
.subject-progress-summary article {
  min-width: 0;
  padding: 12px 8px;
  border-radius: 13px;
  background: var(--surface-soft);
  text-align: center;
}

.progress-metric-grid strong,
.subject-progress-summary strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.progress-metric-grid span,
.subject-progress-summary span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.progress-context-note,
.result-review-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.quiz-selection-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.progress-overview-card > .text-button,
.progress-overview-card > .primary-button {
  margin-top: 14px;
}

.saved-sessions-link {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}

.saved-sessions-link > span:first-child {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}

.saved-sessions-link strong,
.saved-sessions-link small {
  display: block;
}

.saved-sessions-link small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.quick-start-card {
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.quick-start-card fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.quick-start-card legend {
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
}

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

.quick-subject-option {
  min-width: 0;
  min-height: 52px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
  text-align: left;
}

.quick-subject-option.is-selected {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.quick-subject-option > span:first-child {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}

.quick-format-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.quick-start-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--surface-soft);
  font-size: 13px;
}

.quick-start-summary strong {
  text-align: right;
}

.quick-start-card > .primary-button {
  width: 100%;
}

.progress-loading {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 140px;
  margin-bottom: 18px;
  color: var(--muted);
}

.subject-progress-summary {
  margin: 0 0 14px;
}

.attempt-history-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.attempt-status {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
}

.attempt-status.is-active {
  color: #a64924;
  background: var(--accent-soft);
}

.result-review-note {
  padding: 12px 14px;
  border-radius: 13px;
  color: #6f4a24;
  background: #fff7e6;
}

@media (max-width: 390px) {
  .home-next-card {
    padding: 18px;
  }

  .progress-metric-grid strong,
  .subject-progress-summary strong {
    font-size: 20px;
  }

  .progress-metric-grid span,
  .subject-progress-summary span {
    font-size: 11px;
  }

  .attempt-history-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .attempt-history-row > svg {
    display: none;
  }

  .quick-start-card {
    padding: 14px;
  }

  .quick-subject-option {
    font-size: 12px;
  }

  .segmented .segment {
    padding-inline: 5px;
    font-size: 12px;
  }
}
