:root {
  --bg: #f3f0e9;
  --paper: #fbfaf6;
  --glass: rgba(var(--surface-rgb), 0.64);
  --glass-strong: rgba(var(--surface-rgb), 0.82);
  --ink: #25221e;
  --muted: #716c64;
  --faint: #a49d92;
  --line: rgba(128, 119, 106, 0.2);
  --line-strong: rgba(108, 98, 83, 0.32);
  --accent: #687465;
  --accent-dark: #645452;
  --tea: #d5c0a4;
  --latte: #ebe1d2;
  --milk: #fffaf0;
  --blush: #ead4cc;
  --butter: #f1e1b9;
  --blue-gray: #dce2e3;
  --shadow: 0 22px 55px rgba(48, 42, 33, 0.11);
  --soft-shadow: 0 10px 30px rgba(48, 42, 33, 0.07);
  --english: #b56f70;
  --math: #687c63;
  --reading: #b08834;
  --science: #557b8d;
  /* RGB triplets so themes can retint shared surfaces without touching alpha */
  --surface-rgb: 255, 255, 252;
  --surface-alt-rgb: 244, 240, 232;
  --shine-rgb: 255, 255, 255;
  /* Soft pastel chip/button tints (kept as triplets so dark mode can retint). */
  --tint-green-rgb: 232, 238, 231;
  --tint-amber-rgb: 235, 225, 210;
  --tint-rose-rgb: 234, 212, 204;
  --tint-butter-rgb: 241, 225, 185;
}

/* ------------------------------------------------------------------ */
/* Dark theme: override the structural neutrals + surface tints only.  */
/* Decorative/subject pastels and self-contained colored chips keep    */
/* their own values so their hard-coded text stays readable.           */
/* ------------------------------------------------------------------ */
[data-theme="dark"] {
  --bg: #15140f;
  --paper: #1e1c17;
  --glass: rgba(34, 32, 27, 0.64);
  --glass-strong: rgba(34, 32, 27, 0.86);
  --ink: #f1ede4;
  --muted: #b3ac9f;
  --faint: #847d70;
  --line: rgba(214, 205, 190, 0.16);
  --line-strong: rgba(214, 205, 190, 0.26);
  --accent: #9bb08f;
  --accent-dark: #aebfa3;
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.5);
  --soft-shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
  /* Retint the shared glass surfaces to a warm dark and dim the edge shine. */
  --surface-rgb: 44, 41, 35;
  --surface-alt-rgb: 38, 35, 30;
  --shine-rgb: 150, 144, 132;
  /* Pastel chip tints become deep, muted versions of the same hue. */
  --tint-green-rgb: 44, 56, 47;
  --tint-amber-rgb: 60, 52, 35;
  --tint-rose-rgb: 66, 44, 41;
  --tint-butter-rgb: 62, 54, 32;
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 74% 10%, rgba(70, 66, 58, 0.35), transparent 30%),
    radial-gradient(circle at 24% 0%, rgba(155, 176, 143, 0.08), transparent 34%),
    linear-gradient(180deg, #1b1914 0%, var(--bg) 62%, #100f0b 100%);
}

[data-theme="dark"] .soft-backdrop {
  background:
    radial-gradient(circle at 82% 18%, rgba(80, 76, 66, 0.22), transparent 24%),
    radial-gradient(circle at 54% 54%, rgba(60, 56, 48, 0.28), transparent 42%),
    linear-gradient(145deg, rgba(40, 38, 32, 0.4), rgba(20, 19, 14, 0.5));
}

/* Primary action: lift onto a clearly-lit accent in dark for contrast. */
[data-theme="dark"] .primary-button {
  color: #15140f;
  background: var(--accent);
  border-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.4);
}

/* Text colours hard-coded for light cards must lighten on dark surfaces. */
[data-theme="dark"] .passage,
[data-theme="dark"] .answer-note strong {
  color: var(--ink);
}

[data-theme="dark"] .answer-note small,
[data-theme="dark"] .ai-tutor-source {
  color: var(--muted);
}

[data-theme="dark"] .topic-pill.mastered,
[data-theme="dark"] .done-pill,
[data-theme="dark"] .completed-button,
[data-theme="dark"] .correct-note strong,
[data-theme="dark"] .correct-note small,
[data-theme="dark"] .correct-note span,
[data-theme="dark"] .ai-tutor-header span,
[data-theme="dark"] .ai-tutor-tab,
[data-theme="dark"] .ai-tutor-next {
  color: #a9c4a3;
}

[data-theme="dark"] .topic-pill.weak,
[data-theme="dark"] .topic-pill.needs-practice,
[data-theme="dark"] .danger-button {
  color: #e3a99c;
}

[data-theme="dark"] .topic-pill.light-review {
  color: #e6c98a;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 74% 10%, rgba(var(--shine-rgb), 0.62), transparent 30%),
    radial-gradient(circle at 24% 0%, rgba(213, 192, 164, 0.18), transparent 34%),
    linear-gradient(180deg, #f8f6f0 0%, var(--bg) 62%, #eee7dc 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

.soft-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 82% 18%, rgba(var(--shine-rgb), 0.44), transparent 24%),
    radial-gradient(circle at 54% 54%, rgba(var(--surface-rgb), 0.5), transparent 42%),
    linear-gradient(145deg, rgba(var(--shine-rgb), 0.5), rgba(213, 192, 164, 0.16));
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 24px 20px;
  border-right: 1px solid var(--line);
  background: rgba(var(--surface-rgb), 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(var(--shine-rgb), 0.65);
  border-radius: 8px;
  color: var(--accent-dark);
  background:
    linear-gradient(145deg, rgba(var(--shine-rgb), 0.82), rgba(var(--surface-alt-rgb), 0.42)),
    var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(var(--shine-rgb), 0.86),
    var(--soft-shadow);
  font-weight: 900;
}

.brand-kicker,
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  max-width: 174px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.16rem;
  font-weight: 700;
  line-height: 1.18;
}

.nav-list {
  display: grid;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.45);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.74);
}

.nav-button,
.ghost-button,
.primary-button,
.choice-button,
.topic-pill,
.mini-button {
  border: 1px solid transparent;
  border-radius: 8px;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.nav-button {
  width: 100%;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 760;
}

.nav-button:hover,
.nav-button.active {
  color: var(--ink);
  background: rgba(var(--surface-rgb), 0.72);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.86);
}

.streak-card {
  --streak-color: #ff7a18;
  --streak-glow: rgba(255, 122, 24, 0.55);
  display: flex;
  gap: 7px;
  align-items: center;
  align-self: flex-start;
  margin-top: auto;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--streak-color) 40%, rgba(177, 149, 102, 0.28));
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.82), rgba(var(--tint-amber-rgb), 0.58)),
    var(--glass);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--streak-color) 16%, transparent), var(--soft-shadow);
  transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

.streak-card--hidden {
  display: none !important;
}

.streak-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--streak-color) 14%, rgba(var(--surface-rgb), 0.62));
  box-shadow: 0 0 10px var(--streak-glow);
  font-size: 0.95rem;
  transform-origin: center 70%;
  animation: streak-flicker 2.6s ease-in-out infinite;
  transition: background 0.5s ease, box-shadow 0.5s ease;
}

.streak-card span {
  display: block;
  min-width: 1ch;
  color: var(--streak-color);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  transition: color 0.5s ease;
}

.streak-card--shimmer .streak-card span {
  background: linear-gradient(100deg, #f5b301, #ff7a18, #ff4d8d, #9b4dff, #f5b301);
  background-size: 280% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: streak-shimmer 3s linear infinite;
}

@keyframes streak-flicker {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.06) rotate(-2deg); }
  50% { transform: scale(0.97) rotate(1.5deg); }
  75% { transform: scale(1.04) rotate(-1deg); }
}

@keyframes streak-shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 280% 50%; }
}

@keyframes streak-appear {
  0% { opacity: 0; transform: translateY(6px) scale(0.7); }
  60% { transform: translateY(0) scale(1.12); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.streak-appear {
  animation: streak-appear 0.55s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

@keyframes streak-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

.streak-bump {
  animation: streak-bump 0.4s ease;
}

.streak-card small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
}

.main {
  min-height: 0;
  padding: 34px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  max-width: 1180px;
  margin: 0 auto 24px;
}

.topbar h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 3.2vw, 3.35rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.topbar-actions,
.daily-actions,
.section-actions,
.select-row,
.session-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.topbar-actions {
  justify-content: flex-end;
}

.ghost-button,
.primary-button,
.mini-button {
  min-height: 42px;
  padding: 10px 15px;
  font-weight: 850;
}

.ghost-button {
  color: var(--ink);
  background: rgba(var(--surface-rgb), 0.52);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.82);
}

.primary-button {
  color: #fffdf8;
  background: #645452;
  border-color: rgba(39, 48, 42, 0.1);
  box-shadow: 0 14px 24px rgba(100, 84, 82, 0.2);
}

.mini-button {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--accent-dark);
  background: rgba(var(--tint-green-rgb), 0.72);
  border-color: rgba(87, 106, 91, 0.14);
}

.primary-button:hover,
.ghost-button:hover,
.mini-button:hover,
.choice-button:hover {
  transform: translateY(-1px);
}

.view {
  display: none;
  max-width: 1180px;
  margin: 0 auto;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
}

.planner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  gap: 18px;
  align-items: start;
}

.planner-main {
  display: grid;
  gap: 18px;
}

.daily-panel,
.next-step,
.focus-card,
.question-panel,
.rail-panel,
.card,
.study-module {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.78), rgba(var(--surface-alt-rgb), 0.56)),
    var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(var(--shine-rgb), 0.78),
    var(--shadow);
  backdrop-filter: blur(16px);
}

.next-step,
.card {
  position: relative;
  overflow: hidden;
}

.next-step::before,
.card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  content: "";
  background: var(--section-accent, var(--accent));
}

.section-english {
  --section-accent: var(--english);
}

.section-math {
  --section-accent: var(--math);
}

.section-reading {
  --section-accent: var(--reading);
}

.section-science {
  --section-accent: var(--science);
}

.next-step {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  padding: 24px 26px 24px 30px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.88), rgba(var(--surface-alt-rgb), 0.64)),
    var(--glass);
}

.next-step h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 2.5vw, 2.6rem);
  line-height: 1.05;
}

.next-step p:not(.eyebrow) {
  max-width: 560px;
  margin: 10px 0 0;
  line-height: 1.55;
}

.next-step-actions {
  display: grid;
  gap: 10px;
  min-width: 190px;
}

.next-step-meter {
  justify-self: end;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 850;
}

.daily-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 24px;
  min-height: 260px;
  padding: 30px;
  overflow: hidden;
}

.daily-copy h3,
.focus-card h3,
.section-heading h3,
.rail-panel h3,
.card h3,
.complete-card h3 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: 0;
}

.daily-copy h3,
.section-heading h3,
.focus-card h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.daily-copy h3 {
  max-width: 650px;
  font-size: clamp(2rem, 4vw, 4.15rem);
}

.daily-copy p:not(.eyebrow),
.focus-card p,
.muted {
  color: var(--muted);
}

.daily-copy p:not(.eyebrow) {
  max-width: 590px;
  margin: 16px 0 22px;
  font-size: 1rem;
  line-height: 1.65;
}

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

.daily-metrics > div:not(.goal-line),
.momentum-row > div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.52);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.75);
}

.daily-metrics span,
.momentum-row strong {
  display: block;
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1;
}

.daily-metrics small,
.momentum-row span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.goal-line {
  padding: 4px 0;
}

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

.section-heading h3 {
  max-width: 640px;
  font-size: clamp(1.55rem, 2.3vw, 2.45rem);
}

.dashboard-heading {
  padding: 2px 2px 6px;
}

.planner-main > section:not(.goal-dashboard) .dashboard-heading h3 {
  max-width: 560px;
  font-size: clamp(1.55rem, 2.2vw, 2.35rem);
  line-height: 1.08;
}

.heading-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.study-module {
  display: grid;
  gap: 14px;
  min-height: 180px;
  padding: 20px 20px 20px 24px;
}

.goal-dashboard {
  display: grid;
  gap: 16px;
}

.goal-summary-card,
.goal-section-card,
.goal-trend-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.78), rgba(var(--surface-alt-rgb), 0.56)),
    var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(var(--shine-rgb), 0.78),
    var(--soft-shadow);
}

.goal-summary-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.goal-summary-card > div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.5);
}

.goal-summary-card strong {
  font-size: 1.18rem;
  line-height: 1.18;
}

.goal-summary-card span,
.goal-section-card p,
.goal-trend-card small {
  color: var(--muted);
  line-height: 1.45;
}

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

.goal-section-card {
  position: relative;
  display: grid;
  gap: 14px;
  overflow: hidden;
  padding: 18px 18px 18px 22px;
}

.goal-section-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  content: "";
  background: var(--section-accent, var(--accent));
}

.goal-section-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.goal-section-card h4 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
}

.goal-stat-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
}

.goal-stat-grid > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.5);
}

.goal-stat-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.goal-stat-grid strong {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.goal-weakness {
  margin: 0;
}

.goal-card-actions {
  margin-top: auto;
}

.goal-trend-card {
  padding: 16px;
}

.goal-trend-bars {
  display: grid;
  gap: 12px;
}

.goal-trend-bars > div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: center;
}

.goal-trend-bars span,
.goal-trend-bars small {
  font-size: 0.82rem;
  font-weight: 800;
}

.module-topline,
.module-score {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.module-topline span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 900;
}

.section-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--section-accent, var(--accent));
}

.module-topline small,
.module-score span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.module-score {
  align-items: baseline;
}

.module-score strong {
  font-size: 1.35rem;
}

.progress-bar {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: rgba(128, 119, 106, 0.14);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a79c91, #645452);
}

.topic-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.topic-pill {
  padding: 7px 10px;
  color: var(--accent-dark);
  background: rgba(var(--tint-green-rgb), 0.75);
  border-color: rgba(87, 106, 91, 0.08);
  font-size: 0.8rem;
  font-weight: 850;
}

.topic-pill.weak {
  color: #7e4d43;
  background: rgba(var(--tint-rose-rgb), 0.78);
}

.topic-pill.needs-practice {
  color: #7e4d43;
  background: rgba(var(--tint-rose-rgb), 0.58);
}

.topic-pill.light-review {
  color: #705721;
  background: rgba(var(--tint-butter-rgb), 0.78);
}

.topic-pill.mastered {
  color: #4d5b4f;
  background: rgba(var(--tint-green-rgb), 0.78);
}

.section-actions {
  margin-top: auto;
}

.diagnostic-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.diagnostic-preview,
.diagnostic-banner {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.diagnostic-preview > div,
.diagnostic-banner {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.36);
}

.diagnostic-preview strong,
.diagnostic-banner strong {
  display: block;
  margin-bottom: 8px;
}

.diagnostic-preview p,
.diagnostic-banner span {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

/* Compact instructional banner — a slim note, not a chunky card.
   Tightens the title-to-text gap and turns the label into an accent eyebrow. */
.diagnostic-banner {
  gap: 3px;
  margin: 14px 0;
  padding: 11px 15px;
}
.diagnostic-banner strong {
  margin-bottom: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.diagnostic-banner span {
  font-size: 0.9rem;
}

.diagnostic-focus-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.diagnostic-focus-list li {
  display: grid;
  gap: 2px;
  padding: 10px 11px;
  border: 1px solid rgba(128, 119, 106, 0.16);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.54);
}

.diagnostic-focus-list span,
.diagnostic-empty {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1.35;
}

.diagnostic-focus-list strong {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.32;
}

.diagnostic-more {
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: baseline;
}

.diagnostic-empty {
  margin: 0;
}

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

.skill-map-preview,
.category-progress,
.category-block {
  display: grid;
  gap: 12px;
}

.skill-group,
.category-block,
.category-progress {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.78), rgba(var(--surface-rgb), 0.54)),
    rgba(var(--surface-rgb), 0.52);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.72);
}

.skill-group-header,
.category-block-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.skill-group-header strong,
.category-block-header h4 {
  margin: 0;
  color: var(--ink);
}

.skill-group-header span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.planner-rail {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 14px;
}

.rail-panel,
.focus-card,
.card {
  padding: 22px 22px 22px 26px;
}

.card-header h3 {
  display: inline-flex;
  gap: 9px;
  align-items: center;
}

.rail-panel h3 {
  margin-bottom: 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
}

.progress-panel {
  display: grid;
  gap: 14px;
}

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

.progress-summary strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.3rem;
  line-height: 0.95;
}

.progress-summary span {
  max-width: 120px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.3;
  text-align: right;
}

.daily-lessons-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.daily-lessons-heading .eyebrow {
  margin: 0;
}

.daily-plan-note {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.25;
  text-align: right;
}

.daily-lesson-groups {
  display: grid;
  gap: 10px;
}

.daily-section-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.5);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.72);
}

.daily-section-group summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.daily-section-group summary::-webkit-details-marker {
  display: none;
}

.daily-section-group summary > span {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.daily-section-group summary strong {
  font-size: 0.95rem;
  line-height: 1.2;
}

.daily-section-group summary small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.daily-section-group summary em {
  color: var(--muted);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.daily-section-group[open] summary {
  border-bottom: 1px solid rgba(128, 119, 106, 0.14);
  background: rgba(var(--surface-rgb), 0.42);
}

.daily-section-group.complete {
  opacity: 0.72;
}

.daily-section-group.complete summary strong {
  color: var(--muted);
}

.daily-lesson-list {
  gap: 0;
}

.daily-lesson-list li {
  border-width: 0 0 1px;
  border-radius: 0;
  background: rgba(var(--surface-rgb), 0.24);
  box-shadow: none;
}

.daily-lesson-list li:last-child {
  border-bottom: 0;
}

.daily-lesson-list li.next-lesson {
  background:
    linear-gradient(90deg, rgba(var(--tint-green-rgb), 0.62), rgba(var(--surface-rgb), 0.36));
}

.daily-lesson-list li.next-lesson .todo-check {
  border-color: rgba(63, 75, 66, 0.22);
  background: rgba(var(--tint-green-rgb), 0.9);
}

.quiet-panel {
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.66), rgba(var(--tint-amber-rgb), 0.36)),
    var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(var(--shine-rgb), 0.72),
    var(--soft-shadow);
}

.momentum-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.plan-list,
.todo-list,
.stats-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-list li,
.todo-list li,
.stats-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.5);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.72);
}

.review-grid {
  align-items: start;
}

.review-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, auto);
  align-items: end;
  gap: 18px;
}

.review-hero-card .section-actions {
  grid-column: 1 / -1;
  margin-top: 0;
}

.review-hero-card .review-priority-summary {
  grid-column: 1 / -1;
  margin: 0;
}

.review-hero-status {
  display: grid;
  gap: 4px;
  justify-items: end;
  align-self: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.56);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.review-hero-status strong {
  color: var(--ink);
  font-size: 1rem;
}

.review-panel {
  display: grid;
  gap: 18px;
}

.review-panel.is-empty {
  opacity: 0.88;
}

.review-panel-header {
  display: grid;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(128, 119, 106, 0.16);
}

.review-panel-header h3 {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.2;
}

.review-panel-header .muted {
  margin: 0;
}

.review-panel-action {
  justify-self: start;
}

.review-empty-actions {
  margin-top: -4px;
}

.review-list {
  gap: 12px;
}

.review-list li {
  min-height: 72px;
  padding: 14px 14px 14px 16px;
}

.review-list li > span {
  min-width: 0;
}

.review-list .muted {
  display: inline-block;
  margin-top: 3px;
  line-height: 1.35;
}

.todo-list li {
  justify-content: flex-start;
}

.todo-list li > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.todo-list li.complete {
  opacity: 0.68;
}

.todo-list li.complete strong {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(100, 84, 82, 0.34);
}

.done-pill {
  color: #4d5b4f;
  background: rgba(var(--tint-green-rgb), 0.78);
  border-color: rgba(87, 106, 91, 0.14);
}

.completed-button {
  color: #4d5b4f;
  background: rgba(var(--tint-green-rgb), 0.74);
  border-color: rgba(87, 106, 91, 0.14);
  cursor: default;
  opacity: 1;
}

.todo-check {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-dark);
  background: rgba(var(--surface-rgb), 0.6);
  font-size: 0.84rem;
  font-weight: 900;
}

.big-stat {
  margin: 10px 0 4px;
  font-size: 2.4rem;
  font-weight: 900;
}

.focus-card {
  max-width: 780px;
  padding: 28px;
}

.focus-card h3 {
  max-width: 590px;
  font-size: clamp(1.55rem, 2.4vw, 2.35rem);
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.account-profile-card,
.account-settings-card,
.account-sync-card {
  max-width: none;
}

.account-sync-card {
  grid-column: 1 / -1;
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
}

.auth-form .account-actions {
  grid-column: 1 / -1;
}

.sync-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.56);
  color: var(--muted);
  font-weight: 800;
}

.sync-conflict-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(126, 77, 67, 0.22);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.7);
}

.sync-conflict-panel p {
  margin: 0;
}

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

.onboarding-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
}

.onboarding-form input,
.onboarding-form select {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(var(--surface-rgb), 0.84);
  font-weight: 800;
  text-transform: none;
}

.onboarding-form input:disabled {
  color: rgba(34, 31, 29, 0.42);
  background: rgba(var(--surface-alt-rgb), 0.5);
}

.checkbox-field {
  align-content: end;
  grid-template-columns: 18px 1fr;
  gap: 10px !important;
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.55);
  text-transform: none !important;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: #645452;
}

.onboarding-form .account-actions {
  grid-column: 1 / -1;
  align-items: center;
}

.save-note {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.account-actions {
  margin-top: 18px;
}

.account-diagnostics {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.danger-button {
  color: #7e4d43;
  border-color: rgba(126, 77, 67, 0.22);
  background: rgba(var(--surface-rgb), 0.62);
}

.select-row {
  margin-top: 22px;
}

.practice-topic-list {
  margin-top: 18px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}

.mode-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.74), rgba(var(--surface-alt-rgb), 0.5)),
    var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(var(--shine-rgb), 0.76),
    var(--soft-shadow);
}

.mode-card h4 {
  margin: 0;
  font-size: 1.1rem;
}

.mode-card .primary-button,
.mode-card .ghost-button {
  align-self: end;
}

.primary-mode {
  border-color: rgba(100, 84, 82, 0.24);
}

.bank-heading {
  margin-top: 28px;
}

.compact-heading h3 {
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.topic-section {
  display: grid;
  gap: 12px;
}

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

.topic-card {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.86), rgba(var(--surface-rgb), 0.7)),
    rgba(var(--surface-rgb), 0.64);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.78);
}

.topic-card h4 {
  margin: 0 0 6px;
  font-size: 1.08rem;
}

.topic-card-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.topic-card-stats span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(var(--surface-rgb), 0.5);
  font-size: 0.78rem;
  font-weight: 800;
}

.topic-card .primary-button {
  justify-self: start;
}

select {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(var(--surface-rgb), 0.82);
  font-weight: 750;
}

.session-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.meta-chip {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(var(--surface-rgb), 0.55);
  font-size: 0.82rem;
  font-weight: 850;
}

.session-timer-chip {
  color: var(--accent-dark);
  background: rgba(var(--tint-amber-rgb), 0.58);
}

.question-panel {
  max-width: 900px;
  padding: 28px;
  margin: 0 auto;
}

.passage {
  margin: 0 0 22px;
  padding: 18px 20px;
  border: 1px solid rgba(104, 116, 101, 0.18);
  border-left: 4px solid rgba(104, 116, 101, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.66), rgba(var(--surface-alt-rgb), 0.42)),
    rgba(var(--surface-rgb), 0.48);
  color: #2d2a24;
  line-height: 1.72;
}

.passage p {
  margin: 0 0 12px;
}

.passage p:last-child {
  margin-bottom: 0;
}

.passage-credit {
  margin: 14px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(104, 116, 101, 0.22);
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.5;
  color: rgba(45, 42, 36, 0.62);
}

.data-table {
  width: 100%;
  margin: 12px 0 0;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.48);
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th {
  color: var(--accent-dark);
  background: rgba(var(--tint-amber-rgb), 0.44);
  font-weight: 850;
}

.science-figure-wrap {
  margin: 14px 0 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(var(--surface-rgb), 0.55);
}

.science-figure {
  width: 100%;
  height: auto;
  display: block;
}

.science-figure .fig-title {
  font-size: 12.5px;
  font-weight: 800;
  fill: var(--accent-dark);
}

.science-figure .fig-axis {
  stroke: var(--ink, #3a3128);
  stroke-width: 1.4;
}

.science-figure .fig-grid {
  stroke: var(--line);
  stroke-width: 1;
  opacity: 0.55;
}

.science-figure .fig-tick {
  font-size: 10px;
  fill: var(--ink, #4a4034);
}

.science-figure .fig-axis-label {
  font-size: 11px;
  font-weight: 700;
  fill: var(--accent-dark);
}

.science-figure .fig-legend {
  font-size: 10.5px;
  fill: var(--ink, #4a4034);
}

.question-figure {
  margin: 6px auto 10px;
  max-width: 480px;
}

.figure-zoom {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}

.figure-zoom .science-figure-wrap {
  width: 100%;
}

.figure-zoom .math-figure-wrap {
  max-width: 360px;
  margin: 6px auto;
}

.figure-zoom-hint {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--muted, #8a7d66);
  margin-top: 3px;
}

.figure-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 18, 12, 0.62);
  cursor: zoom-out;
}

.figure-zoom-overlay.open {
  display: flex;
}

.figure-zoom-inner {
  position: relative;
  width: 100%;
  max-width: 720px;
  padding: 20px;
  border-radius: 16px;
  background: rgb(var(--surface-rgb));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  cursor: auto;
}

.figure-zoom-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(var(--surface-rgb), 0.95);
  color: var(--ink);
  cursor: pointer;
}

.figure-zoom-close:hover {
  background: rgba(var(--surface-alt-rgb), 0.95);
}

.figure-zoom-inner .science-figure {
  width: 100%;
  height: auto;
}

.figure-zoom-inner .math-figure-wrap {
  max-width: 100%;
}

.math-figure .fig-tick {
  font-size: 12px;
  font-weight: 600;
  fill: var(--ink, #3a3128);
}

.underlined-portion {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-color: var(--accent-dark);
}

.question-title {
  margin: 0 0 18px;
  max-width: 760px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.42rem;
  line-height: 1.42;
}

/* Rich prompt (intro + table + question). The intro reads as supporting text and
   the final line is the emphasized question. */
.question-stem p {
  margin: 0 0 10px;
  font-weight: 500;
}

.question-stem p:last-child {
  margin-bottom: 0;
  font-weight: 700;
}

.question-stem .data-table {
  margin: 12px 0 14px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.92rem;
}

.choices {
  display: grid;
  gap: 10px;
}

.choice-button {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 13px;
  color: var(--ink);
  background: rgba(var(--surface-rgb), 0.64);
  border-color: var(--line);
  text-align: left;
  line-height: 1.4;
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.72);
}

.choice-letter {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--accent-dark);
  background: rgba(var(--tint-green-rgb), 0.74);
  font-weight: 900;
}

/* Stacked fraction: numerator over denominator with a full-width bar, centered
   on the text baseline so it sits in line with the rest of the expression. */
.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  vertical-align: middle;
  text-align: center;
  margin: 0 0.16em;
  font-size: 0.9em;
  line-height: 1.08;
}

.math-frac-num {
  padding: 0 0.22em 0.04em;
  border-bottom: 1.3px solid currentColor;
}

.math-frac-den {
  padding: 0.04em 0.22em 0;
}

/* Radical: an SVG sign that stretches to the radicand's height and joins an
   overline (vinculum) running across the whole radicand. */
.math-sqrt {
  display: inline-flex;
  align-items: stretch;
  white-space: nowrap;
  vertical-align: middle;
}

.math-sqrt-svg {
  width: 0.62em;
  align-self: stretch;
  height: auto;
  flex: none;
  margin-right: -0.5px;
  overflow: visible;
}

.math-sqrt-rad {
  border-top: 1.4px solid currentColor;
  padding: 0.1em 0.26em 0.02em 0.14em;
}

/* Matrix: a real two-level grid wrapped in square brackets that stretch to the
   grid's height (used for matrices and column vectors in stems and choices). */
.math-matrix {
  display: inline-flex;
  align-items: stretch;
  vertical-align: middle;
  margin: 0 0.18em;
  line-height: 1.1;
}

.math-matrix .mm-br {
  width: 0.34em;
  align-self: stretch;
  border: 1.7px solid currentColor;
}

.math-matrix .mm-l {
  border-right: 0;
  border-radius: 3px 0 0 3px;
}

.math-matrix .mm-r {
  border-left: 0;
  border-radius: 0 3px 3px 0;
}

.math-matrix .mm-cells {
  display: grid;
  gap: 0.16em 0.7em;
  padding: 0.18em 0.42em;
  justify-items: center;
  align-items: center;
}

.math-matrix .mm-cell {
  white-space: nowrap;
}

/* Keep exponents (especially two-digit ones) compact and on the baseline. */
sup {
  font-size: 0.68em;
  line-height: 0;
  vertical-align: 0.62em;
}

.choice-button.correct {
  border-color: rgba(63, 75, 66, 0.42);
  background: rgba(var(--tint-green-rgb), 0.86);
}

.choice-button.selected {
  border-color: rgba(100, 84, 82, 0.52);
  background: rgba(var(--tint-amber-rgb), 0.84);
  box-shadow: inset 0 0 0 1px rgba(100, 84, 82, 0.18);
}

.choice-button.incorrect {
  border-color: rgba(126, 77, 67, 0.45);
  background: rgba(var(--tint-rose-rgb), 0.82);
}

.explanation {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.82), rgba(var(--surface-alt-rgb), 0.52)),
    var(--glass);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.7);
}

.explanation h4 {
  margin: 0 0 8px;
}

.explanation p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.6;
}

.answer-breakdown {
  display: grid;
  overflow: hidden;
  gap: 0;
  margin: 18px 0;
  border: 1px solid rgba(128, 119, 106, 0.18);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.66);
  box-shadow:
    inset 0 1px 0 rgba(var(--shine-rgb), 0.7),
    0 10px 24px rgba(52, 44, 38, 0.04);
}

/* ── Timed Mini-Set results review ─────────────────────────────────────────── */
.timed-result .big-stat { margin-bottom: 2px; }
.timed-review {
  margin-top: 22px;
  text-align: left;
}
.timed-review-head {
  margin: 0 0 12px;
}
.timed-review-clean {
  margin: 8px 0 0;
  color: var(--muted);
}
.review-item {
  text-align: left;
  padding: 16px 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(128, 119, 106, 0.18);
  border-radius: 10px;
  background: rgba(var(--surface-rgb), 0.6);
}
.review-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.review-item-tag {
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.review-item-time {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.review-item-time.slow {
  color: rgba(126, 77, 67, 0.95);
  font-weight: 600;
}
.review-item-stem {
  margin: 4px 0 10px;
  font-weight: 600;
  line-height: 1.4;
}
.review-answer-line {
  margin: 8px 0 4px;
  font-size: 0.9rem;
}
.review-wrong { color: rgba(126, 77, 67, 0.95); }
.review-right { color: rgba(63, 75, 66, 0.95); }
.review-passage {
  margin: 8px 0;
  font-size: 0.88rem;
}
.review-passage summary {
  cursor: pointer;
  color: var(--muted);
}

.answer-breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(128, 119, 106, 0.14);
  background: rgba(var(--surface-rgb), 0.7);
}

.answer-breakdown-header .eyebrow {
  margin: 0;
}

.answer-breakdown-header span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.answer-note {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(128, 119, 106, 0.12);
  background: rgba(var(--surface-rgb), 0.44);
}

.answer-note:last-child {
  border-bottom: 0;
}

.answer-note strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #5a514c;
  background: rgba(var(--surface-alt-rgb), 0.9);
  border: 1px solid rgba(128, 119, 106, 0.12);
  font-size: 0.86rem;
  line-height: 1;
}

.answer-note > div {
  display: grid;
  gap: 4px;
}

.answer-note small {
  color: #7b716b;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

.answer-note span {
  color: var(--muted);
  line-height: 1.5;
}

.correct-note {
  position: relative;
  background:
    linear-gradient(90deg, rgba(var(--tint-green-rgb), 0.78), rgba(var(--surface-rgb), 0.54));
}

.correct-note::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #6f826f;
  content: "";
}

.correct-note strong {
  color: #344738;
  background: rgba(var(--tint-green-rgb), 0.92);
  border-color: rgba(63, 75, 66, 0.18);
}

.correct-note small {
  color: #3f5d47;
}

.correct-note span {
  color: #4d5b4f;
}

.ai-tutor-mount[hidden] {
  display: none;
}

.ai-tutor {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 15px;
  border: 1px solid rgba(87, 106, 91, 0.18);
  border-left: 4px solid #6f826f;
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.78);
}

.ai-tutor-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.ai-tutor-header h5 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
}

.ai-tutor-header span {
  padding: 5px 8px;
  border: 1px solid rgba(87, 106, 91, 0.16);
  border-radius: 8px;
  color: #4c604f;
  background: rgba(var(--surface-rgb), 0.58);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.ai-tutor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ai-tutor-tab {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(87, 106, 91, 0.16);
  border-radius: 8px;
  color: #516053;
  background: rgba(var(--surface-rgb), 0.56);
  font-weight: 850;
}

.ai-tutor-tab.active {
  color: #fffdf8;
  background: #5f725f;
  border-color: rgba(63, 75, 66, 0.2);
}

.ai-tutor-lead,
.ai-tutor-loading,
.ai-tutor-next,
.ai-tutor-source {
  margin: 0;
}

.ai-tutor-points {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.ai-tutor-next {
  padding-top: 2px;
  color: #4d5b4f;
  line-height: 1.55;
}

.ai-tutor-source {
  color: #7b716b;
  font-size: 0.78rem;
  font-weight: 750;
}

.result-summary {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

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

.review-priority-summary span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(var(--surface-rgb), 0.55);
  font-size: 0.84rem;
  font-weight: 800;
}

.review-priority-summary strong {
  color: var(--ink);
  font-size: 1.7rem;
  line-height: 1;
}

.result-summary > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.5);
}

.result-summary p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.diagnostic-report {
  display: grid;
  gap: 16px;
  margin: 20px 0 0;
}

.diagnostic-report-hero,
.diagnostic-priority-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr);
  gap: 14px;
  align-items: stretch;
}

.level-card,
.diagnostic-report-grid > article,
.diagnostic-priority-panel > div,
.diagnostic-full-breakdown {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.56);
}

.level-card {
  display: grid;
  align-content: center;
  gap: 4px;
}

.level-card span,
.level-card small {
  color: var(--muted);
}

.level-card strong {
  font-size: 1.45rem;
  color: var(--accent-dark);
}

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

.diagnostic-report ul,
.diagnostic-report ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.diagnostic-report li {
  color: var(--ink);
  line-height: 1.4;
}

.diagnostic-report li span,
.diagnostic-priority-panel .muted {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.diagnostic-priority-panel h4 {
  margin: 4px 0 6px;
  font-size: 1.1rem;
}

.diagnostic-full-breakdown summary {
  cursor: pointer;
  font-weight: 850;
}

.diagnostic-breakdown-table {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.diagnostic-breakdown-table > div {
  display: grid;
  grid-template-columns: minmax(130px, 0.55fr) minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.diagnostic-breakdown-table span {
  color: var(--muted);
}

.lesson-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.lesson-list li span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.session-footer {
  justify-content: space-between;
  margin-top: 18px;
}

.confidence-tap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px solid rgba(var(--shine-rgb), 0.16);
  border-radius: 14px;
  background: rgba(var(--shine-rgb), 0.04);
}

.confidence-label {
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0.92;
}

.confidence-button {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(var(--shine-rgb), 0.22);
  background: transparent;
  color: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.confidence-button:hover {
  background: rgba(var(--shine-rgb), 0.08);
}

.confidence-button.selected {
  background: rgba(125, 211, 252, 0.22);
  border-color: rgba(125, 211, 252, 0.65);
  font-weight: 600;
}

.confidence-hint {
  font-size: 0.78rem;
  opacity: 0.6;
  margin-left: auto;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
  }

  .diagnostic-report-hero,
  .diagnostic-priority-panel,
  .diagnostic-report-grid {
    grid-template-columns: 1fr;
  }

  .diagnostic-breakdown-table > div {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    align-self: start;
    height: auto;
    gap: 14px;
    padding: 14px 18px;
  }

  .brand {
    align-items: center;
  }

  .brand h1 {
    max-width: none;
    font-size: 1rem;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-button {
    min-height: 38px;
    padding: 8px 10px;
    text-align: center;
  }

  .streak-card {
    margin-top: 0;
  }

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

  .account-layout {
    grid-template-columns: 1fr;
  }

  .planner-rail {
    position: static;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .next-step,
  .daily-panel,
  .section-heading,
  .heading-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    display: flex;
  }

  .daily-panel {
    display: flex;
    padding: 22px;
  }

  .section-heading h3 {
    font-size: 1.9rem;
  }

  .next-step {
    padding: 22px 20px 22px 24px;
  }

  .next-step-actions {
    min-width: 0;
  }

  .next-step-meter {
    justify-self: start;
  }

  .topbar-actions,
  .daily-actions,
  .section-actions,
  .session-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    display: none;
  }

  .primary-button,
  .ghost-button,
  .mini-button,
  select {
    width: 100%;
  }

  .module-grid,
  .section-grid,
  .goal-summary-card,
  .goal-section-grid,
  .review-hero-card,
  .review-priority-summary,
  .mode-grid,
  .topic-card-grid,
  .onboarding-form,
  .secondary-actions,
  .planner-rail,
  .momentum-row {
    grid-template-columns: 1fr;
  }

  .review-hero-status {
    justify-items: start;
  }

  .goal-trend-bars > div {
    grid-template-columns: 1fr;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding: 5px;
  }

  .nav-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 76px;
    padding: 8px 6px;
    font-size: 0.88rem;
  }

  .plan-list li,
  .stats-row {
    align-items: stretch;
    flex-direction: column;
  }

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

/* ── Section Test Launcher ── */
.section-test-launcher {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.82), rgba(var(--surface-alt-rgb), 0.58)),
    var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(var(--shine-rgb), 0.78),
    var(--soft-shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
  margin-bottom: 4px;
}

.section-test-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1fr);
  gap: 26px;
  align-items: start;
  padding: 28px 30px;
  border-right: 1px solid var(--line);
}

.section-test-intro h3 {
  margin: 0 0 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 2.2vw, 2.1rem);
  line-height: 1.1;
}

.section-test-intro p.muted { margin: 0; }

.section-test-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.test-option-button {
  display: grid;
  gap: 3px;
  min-height: 70px;
  padding: 12px 14px 12px 16px;
  border: 1px solid rgba(128, 119, 106, 0.2);
  border-left: 4px solid var(--section-accent, var(--accent));
  border-radius: 8px;
  color: var(--ink);
  background: rgba(var(--surface-rgb), 0.56);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.72);
  text-align: left;
}

.test-option-button:hover {
  transform: translateY(-1px);
  background: rgba(var(--surface-rgb), 0.78);
}

.test-option-button strong {
  font-size: 0.96rem;
  line-height: 1.2;
}

.test-option-button span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.section-test-history-panel {
  padding: 24px 22px;
  display: grid;
  gap: 12px;
  align-content: start;
  background: rgba(var(--surface-rgb), 0.3);
}

.test-history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.test-history-row:last-child { border-bottom: none; }
.test-history-row strong { color: var(--ink); }

/* ── Section Test Banner ── */
.section-test-banner {
  border: 1px solid var(--line);
  background: rgba(104, 116, 101, 0.06);
}

/* ── Section Test Score Report ── */
.section-test-report {
  display: grid;
  gap: 18px;
  margin: 16px 0;
}

.test-score-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb),0.62);
}

.test-score-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-right: 28px;
  border-right: 1px solid var(--line);
}

.test-score-num {
  display: block;
  font-size: 3.8rem;
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
}

.test-score-denom {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 700;
}

.test-goal-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 850;
}

.test-goal-badge.met {
  background: rgba(104,124,99,0.15);
  color: var(--math);
}

.test-goal-badge.gap {
  background: rgba(181,111,112,0.12);
  color: var(--english);
}

.test-score-raw {
  display: grid;
  gap: 3px;
}

.test-score-raw strong { font-size: 1.45rem; line-height: 1; }
.test-score-raw span { color: var(--muted); font-size: 0.88rem; }

.test-category-breakdown {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb),0.5);
  display: grid;
  gap: 8px;
}

.test-category-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.9rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.test-category-row:last-child { border-bottom: none; }

/* ── Diagnostic estimated score badge ── */
.estimated-score-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 850;
  background: rgba(176,136,52,0.12);
  color: var(--reading);
}

/* ── Review overdue tag ── */
.overdue-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 850;
  background: rgba(181,111,112,0.14);
  color: var(--english);
  vertical-align: middle;
}

/* ── Full ACT Test launcher ── */
/* Calm vertical rhythm: (1) Full ACT hero, (2) Individual Sections,
   (3) Curated forms — separated by whitespace, not internal walls.
   The history rail only appears once the student has results. */
.section-test-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 30px;
  align-content: start;
  padding: 30px 34px;
  border-right: 1px solid var(--line);
}

/* No history yet → collapse to a single roomy column, no dividing wall. */
.section-test-launcher.no-history { grid-template-columns: 1fr; }
.section-test-launcher.no-history .section-test-intro { border-right: none; }

/* Hero — the primary action, visually elevated with a soft accent panel. */
.full-act-hero {
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: linear-gradient(140deg, rgba(104, 116, 101, 0.13), rgba(104, 116, 101, 0.03));
}

.full-act-block { min-width: 0; display: grid; gap: 12px; }

.full-act-block h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 2.1vw, 2rem);
  line-height: 1.12;
}

.full-act-start-btn {
  justify-self: start;
  margin-top: 4px;
  font-size: 0.95rem;
  padding: 12px 24px;
}

/* Shared tier wrapper for Individual Sections + Curated forms. */
.launcher-tier { min-width: 0; display: grid; align-content: start; }

/* Individual section shortcuts — one tidy row of four. */
.individual-sections-block .section-test-buttons.sections-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 6px;
}

/* Curated forms — one row of four. */
.curated-block .section-test-buttons.curated-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 6px;
}
.curated-card strong {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.curated-done {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.section-divider {
  width: 1px;
  background: var(--line);
  align-self: stretch;
  margin: 0 4px;
}

.small-note { font-size: 0.82rem; margin: 0 0 8px; }

.section-test-history-panel {
  padding: 20px 22px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.history-group { display: grid; gap: 8px; }

/* ── Between-section interstitial ── */
.full-test-interstitial .section-test-report { margin-top: 0; }

.full-test-progress-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.full-test-dot {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(var(--surface-rgb),0.5);
  text-align: center;
}

.full-test-dot.dot-done {
  border-color: transparent;
  background: rgba(104,124,99,0.12);
}

.full-test-dot.dot-active {
  border-width: 2px;
}

.full-test-dot.dot-active.section-english { border-color: var(--english); }
.full-test-dot.dot-active.section-math    { border-color: var(--math); }
.full-test-dot.dot-active.section-reading { border-color: var(--reading); }
.full-test-dot.dot-active.section-science { border-color: var(--science); }

.full-test-dot.dot-upcoming { opacity: 0.45; }

.dot-label { font-size: 0.78rem; font-weight: 750; color: var(--muted); }
.dot-score { font-size: 1.1rem; font-weight: 900; color: var(--ink); }

.full-test-next-info { margin: 12px 0 0; }

/* ── Final composite report ── */
.full-test-composite-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 10px 0 20px;
}

.full-test-section-scores {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.full-test-section-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px 12px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb),0.5);
  overflow: hidden;
}

.full-test-section-row::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: var(--section-accent, var(--accent));
}

.full-test-section-row strong { font-size: 1.2rem; }
.full-test-section-row .muted { font-size: 0.8rem; }

@media (max-width: 760px) {
  .section-test-launcher {
    grid-template-columns: 1fr;
  }
  .section-test-intro {
    grid-template-columns: 1fr;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 20px;
  }
  .section-test-buttons {
    grid-template-columns: 1fr;
  }
  .section-test-launcher.no-history .section-test-intro { border-bottom: none; }
  .full-act-hero {
    padding: 18px 20px;
  }
  .individual-sections-block .section-test-buttons.sections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .curated-block .section-test-buttons.curated-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .section-test-history-panel { padding: 16px 20px; }
  .test-score-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .test-score-main {
    align-items: flex-start;
    padding-right: 0;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
  }

  .section-divider { display: none; }
  .full-test-progress-row { grid-template-columns: repeat(2, 1fr); }
  .full-test-section-scores { grid-template-columns: 1fr; }
  .full-test-composite-row { flex-wrap: wrap; }
}

/* ─── Welcome modal ──────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37, 34, 30, 0.52);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  background-color: #fbfaf6;
  background-image: linear-gradient(145deg, rgb(var(--surface-rgb)), rgb(var(--surface-alt-rgb)));
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  padding: 2rem 2.25rem;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 32px 64px rgba(37, 34, 30, 0.22);
}

.modal-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.modal-brand-mark {
  margin: 0 auto 1rem;
}

.modal-header h2 {
  margin: 0 0 0.4rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
}

.modal-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.modal-step {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.modal-step-num {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.modal-step strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.1rem;
}

.modal-step .muted {
  font-size: 0.8rem;
  margin: 0;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* On-demand full-screen loading overlay (e.g. landing-page deep link warming
   the question bank on a cold first visit). */
.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--surface-alt-rgb), 0.72);
  backdrop-filter: blur(6px);
}

.app-loading-overlay[hidden] {
  display: none;
}

.app-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.app-loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: app-loading-spin 0.8s linear infinite;
}

.app-loading-text {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
}

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

@media (prefers-reduced-motion: reduce) {
  .app-loading-spinner { animation-duration: 2.4s; }
}

/* Subtle text link under the welcome buttons → opens the full Guide page. */
.welcome-guide-link {
  margin-top: 0.15rem;
  padding: 0.35rem;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: color 0.15s ease;
}

.welcome-guide-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

/* ─── Dashboard projected score card ────────────── */

.score-projection-panel {
  background:
    linear-gradient(145deg, rgba(104, 116, 101, 0.06), rgba(104, 116, 101, 0.02)),
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.78), rgba(var(--surface-alt-rgb), 0.56));
  border-color: rgba(104, 116, 101, 0.28);
}

.projected-score-row {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  margin: 0.4rem 0;
}

.projected-score-num {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
}

.projected-score-label {
  font-size: 1rem;
  color: var(--muted);
}

.projected-section-scores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 0.5rem 0;
}

.proj-section-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.3rem 0.2rem;
  border-radius: 6px;
  background: rgba(var(--surface-rgb), 0.5);
  border: 1px solid var(--line);
  font-size: 0.72rem;
  gap: 0.1rem;
}

.proj-section-row span:first-child {
  color: var(--muted);
  font-size: 0.68rem;
}

.proj-section-row span:last-child {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--section-accent, var(--accent));
}

.small-note {
  font-size: 0.72rem;
}

.access-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(104, 116, 101, 0.22);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.72);
  box-shadow: var(--soft-shadow);
}

.access-banner h3 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.access-banner .muted {
  margin: 0;
}

.access-banner.subtle {
  box-shadow: none;
  background: rgba(var(--surface-rgb), 0.5);
}

.account-access-notice {
  grid-column: 1 / -1;
  max-width: none;
  border-color: rgba(126, 77, 67, 0.22);
}

/* ─── Progress view bar chart ───────────────────── */

.activity-card {
  margin-bottom: 1.5rem;
  padding: 22px 26px 22px 30px;
}

.activity-card .card-header {
  margin-bottom: 0;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  margin-top: 1.1rem;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 5px;
  position: relative;
}

.bar-count {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1;
}

.bar-fill {
  width: 100%;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  opacity: 0.65;
}

.bar-label {
  font-size: 0.65rem;
  color: var(--faint);
  text-align: center;
  line-height: 1;
}

/* ─── Account pricing card ──────────────────────── */

.account-pricing-card {
  grid-column: 1 / -1;
  max-width: none;
}

.pricing-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 1rem 0;
  max-width: 360px;
}

.pricing-option {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  text-align: center;
  background: rgba(var(--surface-rgb), 0.5);
}

.pricing-option-featured {
  border-color: var(--accent);
  background: rgba(104, 116, 101, 0.05);
}

.pricing-plan-name {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.25rem;
  font-weight: 700;
}

.pricing-amount {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.pricing-period {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
  font-family: inherit;
}

.pricing-best-value {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.2rem;
}

.pricing-savings {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
}

.trial-signup {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.text-input {
  flex: 1;
  min-width: 180px;
  background: rgba(var(--surface-rgb), 0.7);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.55rem 0.8rem;
  color: var(--ink);
  font-size: 0.88rem;
  font-family: inherit;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(104, 116, 101, 0.15);
}

.text-input::placeholder {
  color: var(--faint);
}

.pricing-includes {
  font-size: 0.76rem;
  line-height: 1.6;
  margin-top: 0.25rem;
}

.trial-success {
  padding: 0.65rem 0.8rem;
  background: rgba(104, 116, 101, 0.08);
  border: 1px solid rgba(104, 116, 101, 0.2);
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 760px) {
  .modal-card { padding: 1.5rem; }
  .access-banner { flex-direction: column; align-items: stretch; }
  .account-pricing-card { grid-column: 1; }
  .account-sync-card { grid-column: 1; }
  .account-access-notice { grid-column: 1; }
  .auth-form { grid-template-columns: 1fr; }
  .pricing-options { max-width: 100%; }
  .trial-signup { flex-direction: column; align-items: stretch; }
  .text-input { min-width: unset; }
}

/* ─── Phone polish ──────────────────────────────── */
@media (max-width: 760px) {
  body {
    background:
      radial-gradient(circle at 70% 0%, rgba(var(--shine-rgb), 0.72), transparent 30%),
      linear-gradient(180deg, #f8f6f0 0%, var(--bg) 70%, #eee7dc 100%);
  }

  .sidebar {
    position: static;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 14px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(var(--surface-rgb), 0.96);
    backdrop-filter: blur(18px);
  }

  .brand {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    grid-column: 1;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-kicker {
    margin-bottom: 2px;
    font-size: 0.68rem;
  }

  .brand h1 {
    max-width: none;
    font-size: 0.94rem;
    line-height: 1.15;
  }

  .streak-card {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    padding: 7px 9px;
    box-shadow: none;
  }

  .streak-icon {
    width: 20px;
    height: 20px;
    font-size: 0.82rem;
  }

  .streak-card small {
    display: none;
  }

  .nav-list {
    grid-column: 1 / -1;
    margin: 0 -2px;
    border-radius: 8px;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    min-width: 84px;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.86rem;
  }

  .main {
    padding: 18px 14px 28px;
  }

  .topbar {
    margin-bottom: 18px;
  }

  .topbar h2 {
    font-size: 2.25rem;
  }

  .eyebrow {
    font-size: 0.68rem;
  }

  .focus-card,
  .question-panel,
  .rail-panel,
  .card,
  .study-module,
  .goal-summary-card,
  .goal-section-card,
  .goal-trend-card,
  .mode-card,
  .topic-card,
  .category-block,
  .category-progress,
  .section-test-launcher {
    box-shadow:
      inset 0 1px 0 rgba(var(--shine-rgb), 0.72),
      var(--soft-shadow);
  }

  .focus-card,
  .question-panel,
  .rail-panel,
  .card {
    padding: 18px;
  }

  .focus-card h3,
  .section-heading h3 {
    font-size: 1.9rem;
    line-height: 1.08;
  }

  .planner-main > section:not(.goal-dashboard) .dashboard-heading h3 {
    font-size: 1.6rem;
    line-height: 1.12;
  }

  .focus-card p:not(.eyebrow),
  .muted {
    line-height: 1.45;
  }

  .module-grid,
  .section-grid,
  .mode-grid,
  .topic-card-grid,
  .goal-section-grid,
  .goal-summary-card,
  .review-priority-summary,
  .planner-rail {
    gap: 12px;
  }

  .study-module,
  .mode-card,
  .topic-card {
    min-height: auto;
    padding: 16px;
  }

  .mode-card {
    gap: 12px;
  }

  .mode-card h4 {
    font-size: 1.08rem;
  }

  .mode-card .primary-button,
  .mode-card .ghost-button,
  .topic-card .primary-button {
    align-self: stretch;
    justify-self: stretch;
  }

  .primary-button,
  .ghost-button,
  .mini-button,
  .test-option-button,
  select {
    min-height: 46px;
  }

  .section-test-launcher {
    margin-top: 4px;
  }

  .section-test-intro {
    gap: 18px;
    padding: 18px;
  }

  .full-act-block h3,
  .section-test-intro h3 {
    font-size: 1.45rem;
  }

  .full-act-start-btn {
    white-space: normal;
  }

  .test-option-button {
    min-height: 62px;
  }

  .section-test-history-panel {
    padding: 16px 18px;
  }

  .review-panel {
    gap: 14px;
  }

  .review-list li,
  .plan-list li,
  .todo-list li,
  .stats-row {
    gap: 12px;
    padding: 13px;
  }

  .review-list .mini-button,
  .plan-list .mini-button {
    width: 100%;
  }

  .choice-button {
    min-height: 58px;
    padding: 12px;
  }

  .session-meta {
    gap: 6px;
    margin-bottom: 16px;
  }

  .meta-chip {
    padding: 6px 8px;
    font-size: 0.76rem;
  }

  .question-title {
    font-size: 1.22rem;
  }
}

@media (max-width: 430px) {
  .main {
    padding-inline: 12px;
  }

  .brand h1 {
    font-size: 0.86rem;
  }

  .nav-button {
    min-width: 78px;
    font-size: 0.82rem;
  }

  .topbar h2 {
    font-size: 2rem;
  }

  .focus-card h3,
  .section-heading h3 {
    font-size: 1.65rem;
  }

  .planner-main > section:not(.goal-dashboard) .dashboard-heading h3 {
    font-size: 1.42rem;
  }

  .module-score,
  .module-topline,
  .progress-summary,
  .goal-section-top,
  .category-block-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topic-pill {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .full-test-progress-row {
    grid-template-columns: 1fr;
  }
}

/* --- Practice topic-bank filter ------------------------------------------- */
/* These elements set their own display, which overrides the bare [hidden]
   attribute, so the filter needs explicit [hidden] rules to actually hide. */
.topic-card[hidden],
.category-block[hidden],
.topic-section[hidden],
.practice-filter-panel[hidden],
.practice-filter-empty[hidden],
.filter-count[hidden] {
  display: none !important;
}

.bank-heading {
  align-items: center;
}

.practice-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.practice-filter-toggle.is-active {
  background: rgba(var(--tint-green-rgb), 0.9);
  border-color: rgba(87, 106, 91, 0.32);
  color: var(--accent-dark);
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #645452;
  color: #fffdf8;
  font-size: 0.72rem;
  font-weight: 850;
}

.practice-filter-panel {
  display: grid;
  gap: 14px;
  margin: 4px 2px 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.82), rgba(var(--surface-alt-rgb), 0.55)),
    var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(var(--shine-rgb), 0.8),
    var(--soft-shadow);
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-label {
  flex: 0 0 96px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.filter-chip {
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(var(--surface-rgb), 0.6);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
}

.filter-chip.is-active {
  background: #645452;
  border-color: rgba(39, 48, 42, 0.12);
  color: #fffdf8;
}

.preset-chip {
  background: rgba(var(--tint-butter-rgb), 0.45);
  border-color: rgba(176, 136, 52, 0.24);
}

.preset-chip.is-active {
  background: #b08834;
  border-color: rgba(176, 136, 52, 0.4);
  color: #fffdf8;
}

.section-chip-english.is-active {
  background: var(--english);
  border-color: var(--english);
}
.section-chip-math.is-active {
  background: var(--math);
  border-color: var(--math);
}
.section-chip-reading.is-active {
  background: var(--reading);
  border-color: var(--reading);
}
.section-chip-science.is-active {
  background: var(--science);
  border-color: var(--science);
}

.filter-search {
  flex: 1 1 280px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(var(--surface-rgb), 0.82);
  color: var(--ink);
  font: inherit;
}

.filter-search:focus {
  outline: none;
  border-color: rgba(87, 106, 91, 0.4);
  box-shadow: 0 0 0 3px rgba(104, 116, 101, 0.14);
}

.filter-results {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.filter-sort-row .filter-select {
  min-width: 220px;
}

.filter-clear-button {
  margin-left: auto;
  min-height: 38px;
  padding: 8px 14px;
}

.practice-filter-empty {
  margin: 18px 2px;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(var(--surface-rgb), 0.4);
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.link-button {
  padding: 0 2px;
  border: none;
  background: none;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 850;
  text-decoration: underline;
  cursor: pointer;
}

/* Strength pill on each topic card */
.topic-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.topic-strength-pill {
  flex: 0 0 auto;
  text-transform: capitalize;
  white-space: nowrap;
}

.topic-strength-pill.new {
  color: var(--muted);
  background: rgba(var(--tint-amber-rgb), 0.7);
}

@media (max-width: 720px) {
  .filter-label {
    flex-basis: 100%;
  }
  .filter-clear-button {
    margin-left: 0;
  }
  .filter-sort-row .filter-select {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* ===========================================================================
   Streak milestone celebration (Duolingo / TikTok style overlay)
   =========================================================================== */
.streak-celebrate {
  --streak-color: #ff7a18;
  --streak-glow: rgba(255, 122, 24, 0.55);
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 34%, color-mix(in srgb, var(--streak-color) 24%, transparent), transparent 58%),
    linear-gradient(180deg, rgba(var(--surface-rgb), 0.9), rgba(var(--surface-alt-rgb), 0.93));
  -webkit-backdrop-filter: blur(7px) saturate(1.05);
  backdrop-filter: blur(7px) saturate(1.05);
  opacity: 0;
  transition: opacity 0.32s ease;
}

.streak-celebrate.is-open {
  opacity: 1;
}

.streak-celebrate.is-closing {
  opacity: 0;
}

.streak-confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.streak-celebrate__card {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  padding: 30px 28px 26px;
  text-align: center;
  border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--streak-color) 40%, rgba(177, 149, 102, 0.32));
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--streak-color) 14%, var(--paper)), var(--paper));
  box-shadow: 0 26px 60px rgba(48, 42, 33, 0.22), 0 0 48px var(--streak-glow);
  transform: scale(0.8);
  opacity: 0;
  transition: transform 0.42s cubic-bezier(0.22, 1.3, 0.36, 1), opacity 0.32s ease;
}

.is-open .streak-celebrate__card {
  transform: scale(1);
  opacity: 1;
}

.streak-celebrate__flame {
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  margin: 0 auto 6px;
}

.streak-celebrate__rays {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--streak-glow) 0%, transparent 62%);
  animation: streak-pulse 1.8s ease-in-out infinite;
}

.streak-celebrate__rays::before {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, transparent 0deg, color-mix(in srgb, var(--streak-color) 55%, transparent) 14deg, transparent 28deg,
      transparent 60deg, color-mix(in srgb, var(--streak-color) 55%, transparent) 74deg, transparent 88deg,
      transparent 120deg, color-mix(in srgb, var(--streak-color) 55%, transparent) 134deg, transparent 148deg,
      transparent 180deg, color-mix(in srgb, var(--streak-color) 55%, transparent) 194deg, transparent 208deg,
      transparent 240deg, color-mix(in srgb, var(--streak-color) 55%, transparent) 254deg, transparent 268deg,
      transparent 300deg, color-mix(in srgb, var(--streak-color) 55%, transparent) 314deg, transparent 328deg);
  opacity: 0.5;
  animation: streak-spin 9s linear infinite;
}

.streak-celebrate__emoji {
  position: relative;
  z-index: 1;
  font-size: 80px;
  line-height: 1;
  filter: drop-shadow(0 6px 16px var(--streak-glow));
  transform-origin: center 75%;
  animation: streak-pop 0.6s cubic-bezier(0.22, 1.4, 0.36, 1) both, streak-flicker 2.4s ease-in-out 0.6s infinite;
}

.streak-celebrate__count {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-top: 2px;
}

.streak-celebrate__count span {
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  color: var(--streak-color);
  letter-spacing: -0.02em;
}

.is-shimmer .streak-celebrate__count span {
  background: linear-gradient(100deg, #f5b301, #ff7a18, #ff4d8d, #9b4dff, #2f7bff, #f5b301);
  background-size: 320% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: streak-shimmer 3s linear infinite;
}

.streak-celebrate__count small {
  font-size: 18px;
  font-weight: 800;
  color: var(--muted);
}

.streak-celebrate__title {
  margin: 10px 0 4px;
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--ink);
}

.streak-celebrate__sub {
  margin: 0 0 20px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: capitalize;
}

.streak-celebrate__btn {
  width: 100%;
  padding: 13px 18px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--streak-color) 88%, white), var(--streak-color));
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px var(--streak-glow);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.streak-celebrate__btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.streak-celebrate__btn:active {
  transform: translateY(0);
}

@keyframes streak-pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

@keyframes streak-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.12); opacity: 0.55; }
}

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

@media (prefers-reduced-motion: reduce) {
  .streak-icon,
  .streak-celebrate__rays,
  .streak-celebrate__rays::before,
  .streak-celebrate__emoji,
  .streak-appear,
  .streak-bump {
    animation: none !important;
  }
  .streak-celebrate__card { transition: opacity 0.2s ease; transform: none; }
}

/* ------------------------------------------------------------------ */
/* Guide page — always-available "how to use the app" walkthrough      */
/* ------------------------------------------------------------------ */
.guide-wrap {
  display: grid;
  gap: 22px;
}

.guide-hero {
  padding: 28px 30px;
}

.guide-hero h3 {
  margin: 6px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 2.4vw, 2.4rem);
  line-height: 1.05;
}

.guide-hero-lead {
  max-width: 640px;
  margin: 12px 0 0;
  line-height: 1.6;
}

.guide-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.guide-section {
  display: grid;
  gap: 14px;
}

/* Numbered routine steps */
.guide-steps {
  display: grid;
  gap: 12px;
}

.guide-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(var(--surface-rgb), 0.7), rgba(var(--surface-alt-rgb), 0.5)),
    var(--glass);
  box-shadow: inset 0 1px 0 rgba(var(--shine-rgb), 0.7);
}

.guide-step-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
  font-size: 0.9rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.guide-step-body strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.02rem;
}

.guide-step-body p {
  margin: 0;
  line-height: 1.55;
}

/* Page-by-page cards */
.guide-pages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.guide-page-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 20px 20px 24px;
}

.guide-page-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.guide-page-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.guide-page-card h4 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.guide-page-card p {
  flex: 1;
  margin: 0;
  line-height: 1.55;
}

.guide-page-card .mini-button {
  align-self: flex-start;
  margin-top: 2px;
}

/* Tips */
.guide-tip-list {
  margin: 14px 0 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 9px;
}

.guide-tip-list li {
  line-height: 1.55;
  color: var(--muted);
}

/* FAQ accordion */
.guide-faq {
  display: grid;
  gap: 10px;
}

.guide-faq-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(var(--surface-rgb), 0.55);
  overflow: hidden;
}

.guide-faq-item summary {
  cursor: pointer;
  padding: 15px 18px;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.guide-faq-item summary::-webkit-details-marker {
  display: none;
}

.guide-faq-item summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.guide-faq-item[open] summary::after {
  transform: rotate(45deg);
}

.guide-faq-item p {
  margin: 0;
  padding: 0 18px 16px;
  line-height: 1.6;
}

@media (max-width: 720px) {
  .guide-pages {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── Signup age gate / consent (COPPA) ──────────────────────────────────── */
.auth-signup-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0 4px;
  border-top: 1px solid var(--line);
}

.auth-consent-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.auth-consent-field input {
  margin-top: 3px;
  flex: 0 0 auto;
}

.auth-coppa-note {
  font-size: 0.8rem;
  margin: 0;
}

/* ── Out-of-space (localStorage quota) notice ───────────────────────────── */
.storage-quota-notice {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 2100;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(var(--surface-rgb), 0.98);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  font-size: 0.9rem;
  line-height: 1.4;
}

.storage-quota-notice[hidden] {
  display: none;
}

.storage-quota-dismiss {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.storage-quota-dismiss:hover {
  color: var(--ink);
}

/* ── Resume an interrupted diagnostic / full test ───────────────────────── */
.session-resume-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 2050;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
  max-width: min(620px, calc(100vw - 32px));
  padding: 14px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(var(--surface-rgb), 0.98);
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
}

.session-resume-text {
  font-size: 0.95rem;
  font-weight: 600;
}

.session-resume-actions {
  display: flex;
  gap: 8px;
}

/* ── Visible keyboard focus (WCAG 2.4.7) ────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.choice-button:focus-visible,
.nav-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .nav-button,
  .choice-button,
  .primary-button,
  .ghost-button {
    transition: none;
  }
}

/* ── Account: data rights (export / delete) ─────────────────────────────── */
.account-data-rights {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.08));
}
.account-data-rights .muted {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
}
.account-delete-button {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.35);
}
.account-delete-button:hover {
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.55);
}
