/* ==========================================================================
   Neft Teacher — 6th-Grade Math Intervention
   Shared styles for the hub + every topic page.
   Palette mirrors the curriculum hub (ACCESS Practice Lab — light/academic).
   ========================================================================== */

:root {
  color-scheme: light;
  --navy: #0f315a;
  --teal: #176b87;
  --teal-light: rgba(23, 107, 135, 0.13);
  --green: #236d5d;
  --green-light: rgba(35, 109, 93, 0.14);
  --amber: #9a6215;
  --amber-light: rgba(154, 98, 21, 0.14);
  --cream: #dde9e4;
  --ink: #111827;
  --muted: #334155;
  --line: rgba(15, 49, 90, 0.22);
  --card: #fffdf7;
  --paper: #ffffff;
  --surface-2: #edf4ee;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 24px rgba(15, 49, 90, 0.14);
  --shadow-hover: 0 14px 36px rgba(15, 49, 90, 0.22);
  --maxw: 1120px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 10% -8%, rgba(65, 123, 154, 0.22) 0%, transparent 58%),
    radial-gradient(960px 500px at 100% 0%, rgba(63, 143, 116, 0.2) 0%, transparent 52%),
    var(--cream);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--teal);
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #0f315a;
  border-bottom: 3px solid #d5982d;
  box-shadow: 0 8px 24px rgba(15, 49, 90, 0.25);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
}
.topbar .brand {
  font-weight: 800;
  color: #fffaf0;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.topbar nav {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.topbar nav a {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 250, 240, 0.86);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.topbar nav a:hover,
.topbar nav a:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

/* ---------- Hero ---------- */
.hero {
  padding: 54px 0 36px;
}
.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  background: var(--teal-light);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
}
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  line-height: 1.08;
  margin: 0 0 14px;
  letter-spacing: -0.025em;
  color: var(--navy);
}
.hero p.lede {
  font-size: clamp(1.02rem, 1.6vw, 1.2rem);
  color: var(--muted);
  max-width: 64ch;
  margin: 0 0 24px;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 0.12s,
    box-shadow 0.18s,
    background 0.18s;
}
.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.btn-ghost {
  background: var(--paper);
  color: var(--navy);
  border-color: var(--line);
}
.btn-ghost:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.btn-sm {
  padding: 9px 14px;
  font-size: 0.86rem;
}

/* ---------- Stat strip ---------- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 14px 0 6px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat b {
  display: block;
  font-size: 1.7rem;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.stat span {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Section headings ---------- */
section.block {
  padding: 30px 0;
}
.section-head {
  margin: 0 0 22px;
}
.section-head h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  margin: 6px 0 8px;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.section-head p {
  color: var(--muted);
  margin: 0;
  max-width: 70ch;
}

/* ====================== PUBLISHER COMPONENTS ====================== */
.masthead {
  background: linear-gradient(160deg, #12325b 0%, #15487f 55%, #1c5f95 100%);
  color: #fff;
  border-bottom: 4px solid var(--green);
}
.masthead .wrap {
  padding: 46px 22px 40px;
}
.masthead .kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #bfe3ff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.masthead h1 {
  font-size: clamp(2rem, 4.6vw, 3.15rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  color: #fff;
  max-width: 18ch;
}
.masthead p.sub {
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  color: rgba(255, 255, 255, 0.88);
  max-width: 58ch;
  margin: 0 0 24px;
}
.masthead .hero-cta .btn-primary {
  background: #fffaf0;
  color: var(--navy);
}
.masthead .hero-cta .btn-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}
.masthead .hero-cta .btn-ghost:hover {
  border-color: #fff;
  color: #fff;
}
.masthead .stat-strip {
  margin-top: 28px;
}
.masthead .stat {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}
.masthead .stat b {
  color: #fff;
}
.masthead .stat span {
  color: rgba(255, 255, 255, 0.8);
}

.routine {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.routine .rstep {
  padding: 22px 20px;
  border-right: 1px solid var(--line);
}
.routine .rstep:last-child {
  border-right: none;
}
.routine .rnum {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
}
.routine .rstep h4 {
  margin: 6px 0 4px;
  color: var(--navy);
  font-size: 1.05rem;
}
.routine .rstep p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.product-system,
.quality-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
.product-card,
.quality-grid article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.product-card span,
.quality-grid b {
  display: inline-block;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.product-card p,
.quality-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.quality-grid h3 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 1rem;
}

.architecture-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.arch-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: var(--radius);
  padding: 18px 18px 18px 54px;
  box-shadow: var(--shadow);
}
.arch-card .arch-num {
  position: absolute;
  left: 16px;
  top: 18px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--surface-2);
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 900;
}
.arch-card h3 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 1rem;
}
.arch-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.evidence-table td {
  min-width: 220px;
}

.sos-wrap {
  overflow-x: auto;
}
.sos {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.sos thead th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.sos tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  vertical-align: middle;
}
.sos tbody tr:last-child td {
  border-bottom: none;
}
.sos tbody tr:hover {
  background: var(--surface-2);
}
.sos .sos-topic {
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.sos .sos-topic:hover {
  color: var(--teal);
}
.sos .sos-std {
  font-weight: 700;
  color: var(--teal);
  white-space: nowrap;
  font-size: 0.82rem;
}
.sos .sos-go {
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.glance {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: 8px 0 4px;
}
.glance .g-main {
  padding: 26px 28px;
  border-right: 1px solid var(--line);
}
.glance .g-side {
  padding: 26px 28px;
  background: var(--surface-2);
}
.glance .g-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent, var(--teal));
  margin: 0 0 6px;
}
.glance .g-objective {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.4;
  margin: 0 0 20px;
}
.glance .g-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.glance .g-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
}
.g-launch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}
.g-launch h4 {
  margin: 0 0 5px;
  color: var(--accent, var(--teal));
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.g-launch p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.glance h4.g-sub {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.vocab-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}
.vocab-list li {
  padding: 7px 0;
  border-bottom: 1px dotted var(--line);
  font-size: 0.9rem;
}
.vocab-list li:last-child {
  border-bottom: none;
}
.vocab-list b {
  color: var(--navy);
}
.materials-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}
.materials-list li {
  padding: 5px 0 5px 22px;
  position: relative;
  color: var(--muted);
}
.materials-list li::before {
  content: "▪";
  position: absolute;
  left: 6px;
  color: var(--accent, var(--teal));
}
.mission-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 14px;
}
.mission-strip article {
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(255, 253, 247, 0.88)),
    var(--surface-2);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent, var(--teal));
  border-radius: var(--radius);
  padding: 17px;
  box-shadow: var(--shadow);
}
.mission-strip span,
.move-card span,
.clinic-card span,
.anchor-label {
  display: inline-block;
  color: var(--accent, var(--teal));
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.mission-strip h3 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 1.02rem;
}
.mission-strip p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.move-grid,
.clinic-grid,
.lesson-path,
.pathway-grid,
.task-columns,
.concept-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.move-card,
.clinic-card,
.support-note,
.lesson-card,
.pathway-card,
.task-card,
.publisher-note {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.publisher-note {
  background: linear-gradient(135deg, rgba(21, 72, 127, 0.08), rgba(44, 125, 107, 0.08));
  border-left: 5px solid var(--accent, var(--teal));
}
.publisher-note-soft {
  margin-top: 14px;
  background: var(--card);
}
.publisher-note span,
.task-card span,
.lesson-card span,
.pathway-card span,
.concept-step span,
.mini-lesson span {
  display: inline-block;
  color: var(--accent, var(--teal));
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.publisher-note p {
  margin: 0;
  color: var(--navy);
  font-size: 1.04rem;
  font-weight: 750;
}
.move-card h4,
.lesson-card h4,
.pathway-card h4,
.task-card h4,
.concept-step h4,
.mini-lesson h4,
.lesson-bridge h4 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 0.98rem;
}
.move-card p,
.clinic-card p,
.support-note p,
.pathway-card p,
.task-card p,
.concept-step p,
.mini-lesson p,
.lesson-bridge p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.concept-step {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent, var(--teal));
  border-radius: var(--radius);
  padding: 16px;
}
.mini-lesson-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.mini-lesson {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.mini-num {
  display: grid;
  place-items: center;
  min-height: 92px;
  border-radius: var(--radius-sm);
  background: var(--accent, var(--teal));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}
.mini-objective {
  color: var(--navy) !important;
  font-weight: 800;
}
.mini-lesson dl {
  display: grid;
  grid-template-columns: minmax(120px, 0.34fr) 1fr;
  gap: 7px 12px;
  margin: 12px 0 0;
}
.mini-lesson dt {
  color: var(--navy);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mini-lesson dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.lesson-bridge {
  margin-top: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: var(--radius);
  padding: 18px;
}
.lesson-card {
  background: var(--card);
}
.lesson-card dl {
  margin: 0;
}
.lesson-card dt {
  color: var(--navy);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 10px;
}
.lesson-card dd {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.pathway-card {
  border-left: 5px solid var(--accent, var(--teal));
}
.task-columns > div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.task-columns h4 {
  margin: 0 0 8px;
  color: var(--navy);
}
.task-columns ul,
.task-columns ol,
.criteria-list,
.print-notebook ul,
.print-notebook ol {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}
.rubric {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.rubric th,
.rubric td {
  text-align: left;
  vertical-align: top;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}
.rubric th {
  width: 210px;
  color: var(--navy);
  background: var(--surface-2);
}
.rubric tr:last-child th,
.rubric tr:last-child td {
  border-bottom: none;
}
.mini-print-map {
  margin-top: 8px;
}
.print-notebook {
  display: grid;
  gap: 12px;
}
.print-notebook h3 {
  margin: 0;
  color: var(--navy);
}
.print-notebook p {
  margin: 0;
  color: var(--muted);
}
.blank-lines {
  min-height: 220px;
  margin: 14px 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 30px,
    rgba(20, 34, 58, 0.18) 31px
  );
}
.fidelity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.fidelity-grid label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow);
}
.fidelity-grid input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
  flex: 0 0 auto;
}
.support-note p + p {
  margin-top: 8px;
}
.anchor-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 16px;
}
.anchor-board > div {
  background: var(--card);
  padding: 16px;
}
.anchor-board p {
  margin: 0;
  color: var(--ink);
  font-weight: 650;
}
.conference-script {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: var(--radius);
  padding: 18px;
}
.conference-script h4 {
  margin: 0 0 8px;
  color: var(--navy);
}
.conference-script ol {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}
@media (max-width: 720px) {
  .glance {
    grid-template-columns: 1fr;
  }
  .glance .g-main {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .g-launch {
    grid-template-columns: 1fr;
  }
  .architecture-grid,
  .mission-strip,
  .anchor-board,
  .product-system,
  .quality-grid,
  .concept-map,
  .fidelity-grid {
    grid-template-columns: 1fr;
  }
  .mini-lesson,
  .mini-lesson dl {
    grid-template-columns: 1fr;
  }
  .mini-num {
    min-height: auto;
    padding: 12px;
  }
}

/* ---------- Hub toolbar: search + filter + progress ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hub-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.search-box {
  flex: 1;
  min-width: 220px;
}
.search-box input {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}
.search-box input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.filter-chip {
  appearance: none;
  font-family: inherit;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  border-radius: var(--radius-sm); /* rectangles, not pills */
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}
.filter-chip:hover,
.filter-chip:focus-visible {
  border-color: var(--teal);
  color: var(--teal);
  outline: none;
}
.filter-chip[aria-pressed="true"] {
  background: var(--teal-light);
  border-color: var(--teal);
  color: var(--teal);
}
.recent-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--navy);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  box-shadow: var(--shadow);
}
.recent-chip:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.topic-progress {
  margin: 0 0 12px;
}
.pstatus {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.ps-new {
  color: var(--muted);
  background: var(--surface-2);
}
.ps-progress {
  color: var(--amber);
  background: var(--amber-light);
}
.ps-mastered {
  color: var(--green);
  background: var(--green-light);
}
.pbar {
  display: block;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.pbar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent, var(--teal));
  transition: width 0.4s;
}

/* ---------- Topic card grid ---------- */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.topic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition:
    transform 0.14s,
    box-shadow 0.2s,
    border-color 0.2s;
  overflow: hidden;
}
.topic-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--accent, var(--teal));
}
.topic-card:hover,
.topic-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent, var(--teal));
  outline: none;
}
.topic-card .icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 12px;
}
.topic-card .std {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent, var(--teal));
  background: color-mix(in srgb, var(--accent, var(--teal)) 14%, var(--paper));
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.topic-card h3 {
  margin: 0 0 8px;
  font-size: 1.18rem;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.topic-card p {
  margin: 0 0 14px;
  font-size: 0.92rem;
  color: var(--muted);
  flex: 1;
}
.topic-card .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.topic-card .chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
}
.topic-card .go {
  font-weight: 800;
  color: var(--accent, var(--teal));
  font-size: 0.9rem;
}

/* ---------- "How it works" steps ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  counter-reset: step;
}
.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  margin-bottom: 12px;
}
.step h4 {
  margin: 0 0 6px;
  color: var(--navy);
}
.step p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- Banner / callout ---------- */
.callout {
  background: linear-gradient(135deg, var(--navy), var(--teal));
  color: #fff;
  border-radius: var(--radius);
  padding: 30px 28px;
  box-shadow: var(--shadow);
}
.callout h2 {
  margin: 0 0 8px;
  color: #fff;
}
.callout p {
  margin: 0 0 18px;
  color: rgba(255, 255, 255, 0.9);
  max-width: 62ch;
}
.callout .btn-primary {
  background: #fffaf0;
  color: var(--navy);
}

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding: 26px 0 50px;
  color: var(--muted);
  font-size: 0.86rem;
}
.site-foot a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}

/* ==========================================================================
   TOPIC PAGE
   ========================================================================== */
.topic-hero {
  padding: 40px 0 10px;
}
.topic-hero .crumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 14px;
}
.topic-hero .crumb a {
  text-decoration: none;
  font-weight: 600;
}
.topic-hero .icon {
  font-size: 2.6rem;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin: 22px 0 0;
}
.tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
  padding: 11px 18px;
  cursor: pointer;
}
.tab[aria-selected="true"] {
  color: var(--navy);
  background: var(--card);
  border-color: var(--line);
  box-shadow: 0 -3px 0 var(--accent, var(--teal)) inset;
}
.tab:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
/* Shareable "open this activity in its own tab" link (built by the engine). */
.tab-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin: 12px 0 0;
  padding: 7px 13px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-light);
  border: 1px solid rgba(32, 95, 166, 0.22);
  border-radius: 999px;
  text-decoration: none;
}
.tab-open:hover,
.tab-open:focus-visible {
  background: rgba(32, 95, 166, 0.14);
  border-color: var(--teal);
  outline: none;
}
.panel {
  display: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.panel.active {
  display: block;
}
.panel h3 {
  color: var(--navy);
  margin-top: 0;
}

/* Practice / game / diagnostic shared widget */
.qcard {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.qcard .prompt {
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
  margin: 8px 0 18px;
  min-height: 1.2em;
}
.qcard .opts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 460px;
  margin: 0 auto;
}
.opt {
  appearance: none;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition:
    transform 0.1s,
    border-color 0.15s,
    background 0.15s;
}
.opt:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}
.opt.correct {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
}
.opt.wrong {
  border-color: #c0392b;
  background: rgba(192, 57, 43, 0.08);
  color: #c0392b;
}
.qmeta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.9rem;
}
.qbar {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 4px 0 16px;
}
.qbar > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal), var(--green));
  transition: width 0.3s;
}
.feedback {
  min-height: 1.5em;
  font-weight: 700;
  margin-top: 14px;
}
.feedback.ok {
  color: var(--green);
}
.feedback.no {
  color: #c0392b;
}
.result {
  text-align: center;
  padding: 18px;
}
.result .score {
  font-size: 3rem;
  font-weight: 800;
  color: var(--navy);
}

/* Game canvas */
.game-stage {
  position: relative;
  background: #0f2034;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-width: 720px;
  margin: 0 auto;
}
.game-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.game-hud {
  position: absolute;
  inset: 10px 14px auto;
  display: flex;
  justify-content: space-between;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  background: rgba(15, 32, 52, 0.72);
  color: #fff;
  padding: 20px;
}
.game-overlay h3 {
  color: #fff;
}

/* Worksheet */
.ws-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.worksheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px;
  box-shadow: var(--shadow);
  color: #111827;
}
.ws-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 3px solid var(--navy);
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.ws-header h2 {
  margin: 0;
  color: var(--navy);
}
.ws-name {
  font-size: 0.9rem;
  color: #334155;
}
.ws-problems {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 30px;
  counter-reset: prob;
}
.ws-problem {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dotted var(--line);
  font-size: 1.02rem;
  color: #111827;
}
.ws-problem::before {
  counter-increment: prob;
  content: counter(prob) ".";
  font-weight: 800;
  color: var(--teal);
}
.ws-answer {
  margin-left: auto;
  min-width: 90px;
  border-bottom: 1.5px solid var(--ink);
}
.answer-key {
  margin-top: 18px;
  background: var(--amber-light);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  padding: 18px 22px;
  color: #111827;
}
.answer-key h3 {
  margin: 0 0 8px;
  color: var(--amber);
}
.answer-key ol {
  columns: 3;
  margin: 0;
  font-size: 0.9rem;
}

/* Quiz links */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.quiz-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface-2);
}
.quiz-card h4 {
  margin: 0 0 6px;
  color: var(--navy);
}
.quiz-card .who {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal);
}
.quiz-card p {
  font-size: 0.86rem;
  color: var(--muted);
}
.quiz-pending {
  font-size: 0.82rem;
  color: var(--amber);
  font-weight: 700;
}

/* Level supports */
.levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.level {
  border-left: 4px solid var(--accent, var(--teal));
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}
.level h4 {
  margin: 0 0 6px;
  color: var(--navy);
}
.level p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .stat-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .ws-problems {
    grid-template-columns: 1fr;
  }
  .qcard .opts {
    grid-template-columns: 1fr;
  }
  /* Comfortable tap target for the dense "go ->" links in the standards list. */
  .sos .sos-go {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 4px 8px;
  }
}

/* Print: worksheet only */
@media print {
  .topbar,
  .topic-hero,
  .tabs,
  .ws-actions,
  .site-foot,
  .panel:not(.print-target) {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .panel.print-target {
    display: block;
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .answer-key {
    break-before: page;
  }
}

/* ---------- Worked examples (Learn tab) ---------- */
.worked {
  display: grid;
  gap: 16px;
}
.worked .we {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
.worked .we-head {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.worked .we-tag {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, var(--teal));
  background: color-mix(in srgb, var(--accent, var(--teal)) 12%, white);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
}
.worked .we-body {
  padding: 16px 18px;
}
.worked ol.we-steps {
  margin: 0 0 12px;
  padding-left: 22px;
}
.worked ol.we-steps li {
  padding: 4px 0;
  color: var(--ink);
}
.worked .we-answer {
  font-weight: 800;
  color: var(--green);
  background: var(--green-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: inline-block;
}

/* two worksheets stacked */
.worksheet + .worksheet {
  margin-top: 22px;
}
.ws-variant {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, var(--teal));
}

/* ---------- Read-aloud button ---------- */
.speak-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 0.95rem;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 8px;
  line-height: 1;
  transition:
    transform 0.1s,
    border-color 0.15s;
}
.speak-btn:hover {
  transform: scale(1.1);
  border-color: var(--teal);
}

/* ---------- Flashcards ---------- */
.flashcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.flashcard {
  perspective: 1000px;
  height: 150px;
  cursor: pointer;
  border: none;
  background: none;
}
.flashcard .fc-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}
.flashcard.flipped .fc-inner {
  transform: rotateY(180deg);
}
.fc-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  box-shadow: var(--shadow);
}
.fc-front {
  background: var(--card);
  flex-direction: column;
  gap: 10px;
}
.fc-term {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
}
.fc-back {
  background: linear-gradient(160deg, var(--navy), var(--teal));
  color: #fff;
  transform: rotateY(180deg);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
}
.flashcard:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* ---------- "I can" checklist ---------- */
.ican-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ican-list li {
  padding: 10px 0;
  border-bottom: 1px dotted var(--line);
}
.ican-list label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}
.ican-list input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--green);
}

/* ---------- Family letter ---------- */
.family-letter {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  margin-top: 22px;
  line-height: 1.6;
}
.family-letter p {
  margin: 0 0 12px;
}

/* ---------- Progress dashboard ---------- */
.prog-dash {
  display: grid;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.pd-row {
  display: grid;
  grid-template-columns: 1.3fr 2fr auto;
  align-items: center;
  gap: 14px;
  padding: 6px 0;
  border-bottom: 1px dotted var(--line);
}
.pd-row:last-child {
  border-bottom: none;
}
.pd-name {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.92rem;
}
.pd-bar {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.pd-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--green));
}
.pd-pct {
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}
.cert-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.cert-actions input {
  flex: 1;
  min-width: 220px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
}

/* ---------- Certificate (screen-hidden, print-only) ---------- */
.certificate {
  display: none;
}
.certificate .cert-inner {
  border: 6px double var(--navy);
  border-radius: 12px;
  padding: 48px 40px;
  text-align: center;
  background: #fff;
}
.cert-kicker {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 14px;
}
.cert-title {
  font-size: 2.4rem;
  color: var(--navy);
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}
.cert-pres {
  color: var(--muted);
  margin: 0;
}
.cert-name {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink);
  border-bottom: 2px solid var(--line);
  display: inline-block;
  padding: 4px 30px 10px;
  margin: 8px 0 18px;
}
.cert-body {
  color: var(--ink);
  max-width: 48ch;
  margin: 0 auto 14px;
}
.cert-list {
  columns: 2;
  text-align: left;
  max-width: 60ch;
  margin: 0 auto 24px;
  font-weight: 600;
  color: var(--navy);
}
.cert-foot {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

@media print {
  body.printing-cert .topbar,
  body.printing-cert main > section,
  body.printing-cert .site-foot {
    display: none !important;
  }
  body.printing-cert .certificate {
    display: block;
  }
}

/* ==========================================================================
   Reduced motion — honor the OS/browser "reduce motion" setting.
   Strips decorative transitions, transforms, and the 3D flashcard flip so the
   UI stays calm for motion-sensitive users (the game is user-initiated).
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* Hover lifts and the card flip rely on transform — neutralize them. */
  .btn:hover,
  .topic-card:hover,
  .topic-card:focus-visible,
  .opt:hover,
  .speak-btn:hover {
    transform: none !important;
  }
  .flashcard .fc-inner,
  .flashcard.flipped .fc-inner {
    transition: none !important;
  }
}

/* ==========================================================================
   Dark mode — honors the OS/browser color-scheme. Surfaces and ink flip to a
   calm dark palette; the printable "paper" components (worksheet, family
   letter) stay light with dark ink so they still read and print like
   documents. --navy is repurposed as a light heading ink here, so the few
   places that used it as a *background* are re-pinned to explicit brand blues.
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --navy: #dbeafe; /* light heading ink in dark mode */
    --teal: #7dd3fc;
    --teal-light: rgba(125, 211, 252, 0.18);
    --green: #6ee7b7;
    --green-light: rgba(110, 231, 183, 0.18);
    --cream: #0d1624;
    --ink: #f8fafc;
    --muted: #c4d2e2;
    --line: rgba(226, 232, 240, 0.2);
    --card: #182536;
    --paper: #1f2d3f;
    --surface-2: #243449;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.52);
    --shadow-hover: 0 14px 38px rgba(0, 0, 0, 0.68);
    --amber: #f4bf5f;
    --amber-light: rgba(244, 191, 95, 0.18);
  }
  body {
    background:
      radial-gradient(1200px 600px at 12% -8%, #14233a 0%, transparent 55%),
      radial-gradient(1000px 520px at 100% 0%, #102a25 0%, transparent 50%),
      var(--cream);
  }
  .topbar {
    background: #0b1726;
    border-bottom-color: #f4bf5f;
  }

  /* Re-pin the spots that used --navy as a background (now a light ink). */
  .skip-link {
    background: #1c5f95;
  }
  .btn-primary {
    background: #1f6fb2;
    color: #fff;
  }
  .step::before {
    background: #1f6fb2;
  }
  .callout {
    background: linear-gradient(135deg, #12325b, #1c5f95);
  }
  .fc-back {
    background: linear-gradient(160deg, #12325b, #1c5f95);
  }

  /* Literal-white interactive surfaces → dark surfaces. */
  .btn-ghost,
  .filter-chip,
  .recent-chip,
  .glance .g-pill,
  .speak-btn,
  .opt,
  .search-box input,
  .cert-actions input,
  .report-actions input {
    background: var(--surface-2);
    color: var(--ink);
  }
  .btn-ghost {
    color: var(--navy);
  }

  /* Printable "paper" components stay light with dark ink (screen + print). */
  .worksheet,
  .family-letter {
    background: #ffffff;
    color: #111827;
  }
  .worksheet h2,
  .family-letter h2,
  .ws-header h2 {
    color: #15487f;
  }
  .worksheet p,
  .worksheet li,
  .worksheet td,
  .worksheet dd,
  .worksheet .print-notebook p,
  .worksheet .print-notebook li,
  .family-letter p,
  .family-letter li {
    color: #111827;
  }
  .worksheet h3,
  .family-letter h3,
  .worksheet .print-notebook h3 {
    color: #15487f;
  }
  .worksheet .rubric,
  .worksheet .rubric td {
    color: #111827;
  }
  .worksheet .rubric th {
    color: #15487f;
    background: #edf4ee;
  }
  .topic-hero h1[style] {
    color: var(--navy) !important;
  }
  .topic-hero .eyebrow[style] {
    color: var(--teal) !important;
    background: var(--teal-light) !important;
  }
  .mission-strip article {
    background: var(--card);
    border-color: var(--line);
  }
  .ws-header {
    border-bottom-color: #15487f;
  }
  .ws-problem {
    color: #14223a;
    border-bottom-color: rgba(20, 34, 58, 0.18);
  }
  .ws-answer {
    border-bottom-color: #14223a;
  }
  .family-letter .vocab-list b {
    color: #15487f;
  }
}

/* ==========================================================================
   PREMIUM LAYER — XP/level/streak HUD, achievement wall, celebrations
   (toasts + confetti), Smart Review badge, and the printable progress
   report. Additive; honors reduced motion and dark mode via the variables
   already defined above.
   ========================================================================== */

/* ---------- Topbar HUD pill (level · XP · streak) ---------- */
.int-hud {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
  color: var(--navy);
  white-space: nowrap;
}
.int-hud + nav {
  margin-left: 14px;
}
.int-hud .ih-bar {
  width: 56px;
  height: 7px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.int-hud .ih-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--green));
  transition: width 0.5s ease;
}
.int-hud .ih-xp {
  color: var(--muted);
}
.int-hud .ih-streak {
  color: var(--amber);
}
@media (max-width: 640px) {
  .int-hud .ih-bar,
  .int-hud .ih-xp {
    display: none;
  }
}

/* ---------- Smart Review tab count badge ---------- */
.tab-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--amber);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  vertical-align: middle;
}

/* ---------- Toast notifications (XP, level-up, badges) ---------- */
.int-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.int-toast {
  min-width: 220px;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  box-shadow: var(--shadow-hover);
  font-size: 0.92rem;
  opacity: 0;
  transform: translateX(28px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}
.int-toast.show {
  opacity: 1;
  transform: translateX(0);
}
.int-toast.it-level {
  border-left-color: var(--amber);
}
.int-toast.it-badge {
  border-left-color: #9333ea;
}
.int-toast.it-streak {
  border-left-color: #db2777;
}
.int-toast strong {
  color: var(--navy);
}

/* ---------- Confetti burst (decorative, reduced-motion off) ---------- */
.int-confetti {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  overflow: hidden;
}
.int-confetti > i {
  position: absolute;
  top: -14px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation-name: int-fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}
@keyframes int-fall {
  0% {
    opacity: 1;
    transform: translateY(-10vh) rotate(var(--rot, 0deg));
  }
  100% {
    opacity: 0.9;
    transform: translateY(108vh) rotate(calc(var(--rot, 0deg) + 540deg));
  }
}

/* ---------- Rewards section: XP panel + badge wall ---------- */
.xp-panel {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.xp-stat {
  text-align: center;
}
.xp-stat > b {
  display: block;
  font-size: 1.5rem;
  color: var(--navy);
  line-height: 1.1;
}
.xp-stat > span {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.xp-stat.xp-grow {
  text-align: left;
}
.xp-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.xp-bar {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.xp-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--green));
  transition: width 0.6s ease;
}
@media (max-width: 720px) {
  .xp-panel {
    grid-template-columns: 1fr 1fr;
  }
  .xp-stat.xp-grow {
    grid-column: 1 / -1;
  }
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 16px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
}
.badge.earned {
  border-color: color-mix(in srgb, var(--amber) 45%, var(--line));
  background: var(--amber-light);
  box-shadow: var(--shadow);
}
.badge.locked {
  opacity: 0.55;
  filter: grayscale(0.85);
}
.badge-ic {
  font-size: 2rem;
  line-height: 1;
}
.badge.locked .badge-ic {
  filter: grayscale(1);
}
.badge-name {
  font-weight: 800;
  color: var(--navy);
  font-size: 0.92rem;
}
.badge-desc {
  font-size: 0.74rem;
  color: var(--muted);
}

.report-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.report-actions input {
  flex: 1;
  min-width: 220px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
}

/* ---------- Printable progress report (screen-hidden, print-only) ---------- */
.report {
  display: none;
}
.report .report-inner {
  padding: 8px 4px;
}
.report-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 3px solid var(--navy);
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.rp-kicker {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 4px;
}
.rp-title {
  font-size: 1.9rem;
  color: var(--navy);
  margin: 0;
}
.rp-meta {
  text-align: right;
  color: var(--muted);
}
.rp-meta p {
  margin: 0;
}
.rp-meta strong {
  font-size: 1.15rem;
  color: var(--ink);
}
.rp-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.rp-summary > div {
  text-align: center;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.rp-summary b {
  display: block;
  font-size: 1.4rem;
  color: var(--navy);
}
.rp-summary span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.rp-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
  font-size: 0.9rem;
}
.rp-table th,
.rp-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.rp-table th {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.rp-st {
  font-weight: 800;
}
.rp-st.ps-mastered {
  color: var(--green);
}
.rp-st.ps-progress {
  color: var(--amber);
}
.rp-st.ps-new {
  color: var(--muted);
}
.rp-badges h3 {
  color: var(--navy);
  margin: 0 0 4px;
}
.rp-foot {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 12px;
  color: var(--muted);
  font-weight: 700;
}

@media print {
  body.printing-report .topbar,
  body.printing-report main > section,
  body.printing-report .site-foot,
  body.printing-report .int-toasts,
  body.printing-report .int-confetti {
    display: none !important;
  }
  body.printing-report .report {
    display: block;
  }
}
