/* ==========================================================================
   Age-9 Home Learning — Readability-First Stylesheet
   Warm paper tokens, Google Fonts (Lexend + Atkinson Hyperlegible),
   56ch prose measure, split-pane reading, 48px+ touch targets.
   ========================================================================== */

:root {
  --ink: #23211E;
  --muted: #57534A;
  --line: #D5CFC1;
  --line-strong: #B9B1A0;
  --faint: #EAE5D9;
  --bg: #F4F1EA;
  --card: #FFFDF8;
  --surface: #FFFFFF;
  --hl: #FFF4CC;
  --brand: #233554;
  --good: #23784A;
  --good-bg: #DDF1E5;
  --good-ink: #1C603B;
  --warn: #A3303F;
  --warn-bg: #FBEAEA;
  --amber-bg: #FFF4D6;
  --amber-ink: #7A5A00;
  --c: #2F64A8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 6px rgba(35, 33, 30, .06);
  --shadow-lg: 0 10px 28px rgba(35, 33, 30, .14);
  --head: "Lexend", "Atkinson Hyperlegible", "Verdana", "Segoe UI", system-ui, sans-serif;
  --body: "Lexend", "Atkinson Hyperlegible", "Verdana", "Segoe UI", system-ui, sans-serif;
  --r-size: 1.12rem;
  --r-lh: 1.8;
  --r-ls: 0.014em;
  --r-ws: 0.05em;
  font-size: 18px;
}

/* Child Reading Comfort Preferences */
html[data-tint="mint"] {
  --bg: #EDF3EE;
  --card: #F7FBF8;
  --line: #C7DACB;
  --faint: #E1EEE4;
  --hl: #DFF3E4;
}
html[data-tint="white"] {
  --bg: #F2F4F7;
  --card: #FFFFFF;
  --line: #D0D7E2;
  --faint: #E7ECF3;
  --hl: #E8F1FC;
}
html[data-font="hyper"] {
  --body: "Atkinson Hyperlegible", "Lexend", "Verdana", "Segoe UI", system-ui, sans-serif;
  --head: "Atkinson Hyperlegible", "Lexend", "Verdana", "Segoe UI", system-ui, sans-serif;
}
html[data-size="sm"] { --r-size: 1.02rem; }
html[data-size="md"] { --r-size: 1.12rem; }
html[data-size="lg"] { --r-size: 1.24rem; }
html[data-space="airy"] { --r-lh: 2.05; --r-ls: 0.022em; --r-ws: 0.08em; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.62;
  letter-spacing: 0.008em;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--head);
  line-height: 1.28;
  margin: 1.4em 0 .55em;
  color: var(--ink);
  font-weight: 700;
}
h1 { font-size: 1.65rem; margin-top: .3em; }
h2 { font-size: 1.28rem; }
h3 { font-size: 1.08rem; }
a { color: var(--brand); text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.tnum { font-variant-numeric: tabular-nums; }
.loading { padding: 3.5rem 1rem; text-align: center; color: var(--muted); }
.glyph { font-family: "Segoe UI Symbol", "Segoe UI Emoji", "Noto Emoji", "Apple Color Emoji", sans-serif; }
[hidden] { display: none !important; }

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem 1rem 5.5rem;
}
main.wide {
  max-width: 1180px;
}

/* ================================================================== top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(18, 28, 45, .14);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: .5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem 1.1rem;
}
.topbar .brand {
  color: #fff;
  font-family: var(--head);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-size: 1rem;
  margin-right: .4rem;
}
.brand-badge {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  background: #4A82C9;
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  display: inline-grid;
  place-items: center;
}
.nav-main, .nav-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
}
.nav-main { margin-right: auto; }
.topbar nav a {
  color: rgba(255, 255, 255, .88);
  text-decoration: none;
  padding: .42rem .8rem;
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 500;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  transition: background-color 140ms ease, color 140ms ease;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.topbar nav a.on { background: rgba(255, 255, 255, .22); color: #fff; font-weight: 700; }
.nav-sub a { font-size: .84rem; padding: .35rem .72rem; opacity: .9; }
.nav-sub a.nav-parent { background: rgba(255, 255, 255, .1); }
.nav-sub a.nav-parent.on { background: rgba(255, 255, 255, .24); }

/* ================================================================== basics */
.card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  box-shadow: var(--shadow);
}
.card.error { border-left: 6px solid var(--warn); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: .68rem 1.35rem;
  min-height: 46px;
  font: 700 .96rem var(--head);
  text-decoration: none;
  cursor: pointer;
  transition: transform 100ms ease, opacity 140ms ease, background-color 140ms ease;
}
.btn:hover:not(:disabled) { opacity: .93; }
.btn:active:not(:disabled) { transform: scale(.99); }
.btn.accent { background: var(--c); }
.btn.good { background: var(--good); }
.btn.big { font-size: 1.06rem; padding: .82rem 1.75rem; min-height: 52px; }
.btn.sm { font-size: .86rem; padding: .45rem 1rem; min-height: 38px; }
.btn.ghost { background: var(--card); color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.btn.danger { background: var(--card); color: var(--warn); box-shadow: inset 0 0 0 2px var(--warn); }
.btn:disabled { opacity: .45; cursor: default; }

.row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.row.between { justify-content: space-between; }

.field { display: block; margin: .9rem 0; }
.field > span { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .95rem; }
.field.inline { display: flex; align-items: center; gap: .65rem; }
.field.inline > span { margin: 0; }

input, textarea, select { font: inherit; color: var(--ink); }
input:not([type=radio]):not([type=checkbox]), textarea, select {
  width: 100%;
  padding: .68rem .85rem;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  line-height: 1.55;
}
textarea { resize: vertical; }
input[type=number] { width: 7.5rem; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent);
}
input:disabled, textarea:disabled {
  background: var(--bg);
  border-color: var(--line);
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  opacity: 1;
}
input[type=radio], input[type=checkbox] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--c);
  margin: 0 .45rem 0 0;
  vertical-align: -.22rem;
}
fieldset { border: 0; padding: 0; margin: .85rem 0; display: flex; flex-wrap: wrap; gap: .45rem 1rem; }
legend { font-weight: 700; padding: 0; margin-bottom: .35rem; width: 100%; font-size: .92rem; }

.error-text {
  color: var(--warn);
  background: var(--warn-bg);
  border-radius: 10px;
  padding: .6rem .85rem;
  font-weight: 600;
  font-size: .92rem;
  margin-top: .75rem;
}

/* Password input with Show/Hide toggle */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { padding-right: 4.8rem; min-height: 52px; font-size: 1.05rem; }
.pw-toggle {
  position: absolute;
  right: .45rem;
  border: 0;
  background: var(--faint);
  color: var(--ink);
  font: 700 .8rem var(--head);
  padding: .42rem .75rem;
  border-radius: 8px;
  cursor: pointer;
}
.pw-toggle:hover { background: var(--line); }

/* Login card */
.login { max-width: 440px; margin: 3rem auto; padding: 1.8rem; }
.login-head { display: flex; align-items: center; gap: .85rem; margin-bottom: .8rem; }
.login-badge {
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  background: #2F64A8;
  color: #fff;
  font: 700 1.45rem var(--head);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.login-head h1 { margin: 0; font-size: 1.5rem; }
.login-head p { margin: .1rem 0 0; font-size: .88rem; color: var(--muted); }
.login .btn.big { width: 100%; margin-top: .4rem; }

/* Toast & Tooltip */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: .75rem 1.25rem;
  border-radius: 12px;
  max-width: 92vw;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  font-size: .92rem;
}
.tip {
  position: absolute;
  z-index: 60;
  background: var(--card);
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  padding: .5rem .75rem;
  font-size: .85rem;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  max-width: 270px;
}

/* Friendly Modal & Peek Drawer */
dialog.modal, dialog.peek-drawer {
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  padding: 1.5rem;
  max-width: 480px;
  width: calc(100vw - 2rem);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(20, 24, 34, .52); backdrop-filter: blur(2px); }
.modal h3 { margin: 0 0 .5rem; font-size: 1.25rem; }
.modal p { margin: 0 0 1rem; color: var(--muted); line-height: 1.6; }
.modal-pills { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 1.2rem; }
.modal-pill {
  border: 1.5px solid #E3C372;
  background: var(--amber-bg);
  color: var(--amber-ink);
  border-radius: 999px;
  padding: .38rem .85rem;
  font: 700 .86rem var(--head);
  cursor: pointer;
}
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; }

dialog.peek-drawer {
  max-width: 680px;
  max-height: 84vh;
  overflow-y: auto;
  padding: 1.25rem 1.4rem;
}
.peek-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .75rem;
  margin-bottom: .9rem;
  border-bottom: 1.5px solid var(--line);
}
.peek-head h3 { margin: 0; font-size: 1.1rem; color: var(--c); }

/* ================================================================== Today & Lesson Cards */
.hero-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-left: 8px solid var(--c);
  border-radius: 20px;
  padding: 1.5rem 1.7rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
}
.hero-info { display: grid; gap: .3rem; max-width: 34rem; }
.hero-eyebrow {
  justify-self: start;
  padding: .2rem .75rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 12%, var(--card));
  color: var(--c);
  font: 700 .78rem var(--head);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.hero-info h1 { margin: .2rem 0 0; font-size: 1.6rem; }
.hero-info p { margin: 0; color: var(--muted); font-size: .95rem; }

.journey-bar {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.35rem;
  margin: 1.2rem 0 1.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .9rem 1.5rem;
}
.journey-copy strong { display: block; font-size: 1rem; }
.journey-copy span { font-size: .88rem; color: var(--muted); }
.journey-meter { flex: 1 1 200px; max-width: 260px; display: grid; gap: .3rem; }
.j-track { height: 11px; border-radius: 999px; background: var(--faint); overflow: hidden; }
.j-fill { height: 100%; border-radius: 999px; background: var(--good); transition: width 300ms ease; }
.streak-pill {
  background: var(--good-bg);
  color: var(--good-ink);
  border-radius: 999px;
  padding: .25rem .8rem;
  font: 700 .82rem var(--head);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin: 1.6rem 0 .75rem;
}
.section-head h2 { margin: 0; }

.lcard {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-top: 6px solid var(--c);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  box-shadow: var(--shadow);
  min-width: 0;
  transition: transform 120ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.lcard:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(35, 33, 30, .1); }
.lcard.is-next { border: 2.5px solid var(--c); border-top-width: 6px; }
.lc-day { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.lc-title { font-family: var(--head); font-weight: 700; font-size: .96rem; line-height: 1.35; }
.lc-sub { font-size: .83rem; color: var(--muted); }
.badge {
  align-self: flex-start;
  margin-top: auto;
  padding-top: .15rem;
  font-size: .76rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .16rem .65rem;
  background: var(--faint);
  color: var(--muted);
}
.badge.draft { background: var(--amber-bg); color: var(--amber-ink); }
.badge.waiting { background: #E4ECF8; color: #24508A; }
.badge.marked { background: var(--good-bg); color: var(--good-ink); }
.week-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: .75rem; }

/* ================================================================== Term Map */
.term-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: .8rem 0 1.2rem;
}
.filter-bar { display: flex; flex-wrap: wrap; gap: .4rem; }
.fpill {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: .38rem .85rem;
  min-height: 38px;
  font: 600 .84rem var(--head);
  cursor: pointer;
}
.fpill.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.term-cols {
  display: grid;
  grid-template-columns: 5.2rem repeat(5, minmax(0, 1fr));
  gap: .6rem;
  padding: .45rem .6rem;
  font: 700 .78rem var(--head);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.term-row {
  display: grid;
  grid-template-columns: 5.2rem repeat(5, minmax(0, 1fr));
  gap: .6rem;
  padding: .55rem .6rem;
  margin-bottom: .5rem;
  border-radius: 16px;
  align-items: stretch;
}
.term-row.current-week {
  background: color-mix(in srgb, #2F64A8 9%, var(--bg));
  border: 2px solid color-mix(in srgb, #2F64A8 35%, var(--bg));
}
.term-w {
  font-family: var(--head);
  font-weight: 700;
  font-size: .92rem;
  align-self: center;
  color: var(--ink);
  display: grid;
  gap: .15rem;
}
.term-w small { font-size: .74rem; color: #2F64A8; font-weight: 700; }
.term .lcard { padding: .68rem .75rem; }
.term .lc-title { font-size: .88rem; line-height: 1.35; }
.term .lc-sub { display: none; }
.term .lc-day { display: none; }
.term .lcard.dim { opacity: .22; }
@media (max-width: 780px) {
  .term-cols { display: none; }
  .term-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .term-w { grid-column: 1 / -1; }
  .term .lc-day { display: block; }
}

/* ================================================================== Lesson Page */
.lhead {
  background: var(--c);
  color: #fff;
  border-radius: 20px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}
.lhead-main { min-width: 0; flex: 1 1 280px; }
.lhead h1 { margin: .25rem 0 .3rem; font-size: 1.55rem; color: #fff; }
.lh-top { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .9; }
.lh-sub { margin: 0; opacity: .92; font-size: .92rem; }
.lhead-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
  flex-shrink: 0;
}
.lh-chips { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: flex-end; }
.chip {
  background: rgba(255, 255, 255, .2);
  color: #fff;
  border-radius: 999px;
  padding: .24rem .78rem;
  font-size: .84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.chip.light { background: #fff; color: var(--c); }
.chip.warn { background: #FFE2E2; color: var(--warn); }
.chip.parent { background: #fff; color: var(--c); }
.lh-prog-track {
  width: 11.5rem;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .26);
  overflow: hidden;
}
.lh-prog-fill {
  height: 100%;
  border-radius: 999px;
  background: #8CE0A8;
  transition: width 240ms ease;
}
@media (max-width: 640px) {
  .lhead-status { align-items: flex-start; width: 100%; }
  .lh-chips { justify-content: flex-start; }
  .lh-prog-track { width: 100%; }
}

/* Child Reading Comfort Bar */
.comfort-bar {
  margin: .95rem 0 1rem;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: .55rem .9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem 1.1rem;
  font-size: .82rem;
}
.comfort-group { display: inline-flex; align-items: center; gap: .4rem; }
.comfort-label { font-weight: 700; color: var(--muted); }
.seg-mini {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface);
}
.seg-mini button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 700 .78rem var(--head);
  padding: .3rem .62rem;
  min-height: 32px;
  cursor: pointer;
}
.seg-mini button.on { background: var(--c); color: #fff; }
.tint-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  cursor: pointer;
  padding: 0;
}
.tint-dot.on { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 30%, transparent); }
.comfort-check {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.comfort-check input { width: 1.05rem; height: 1.05rem; margin: 0; }

/* Collapsible Grown-up Note */
details.note {
  margin: .85rem 0;
  background: #FBF4DF;
  border: 1.5px solid #E5D19B;
  border-left: 5px solid #D9A400;
  padding: .65rem 1rem;
  border-radius: 12px;
  font-size: .9rem;
  color: #4A3B12;
}
details.note summary { font-weight: 700; cursor: pointer; }
details.note p { margin: .45rem 0 0; line-height: 1.55; max-width: 62ch; }

/* Split-Pane Reading Layout */
.blocks { margin-top: .5rem; }
.lesson-single { max-width: 780px; }
.lesson-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-top: .7rem;
}
@media (min-width: 960px) {
  .lesson-split {
    grid-template-columns: minmax(0, 48%) minmax(0, 52%);
    gap: 1.6rem;
  }
  .split-ref {
    position: sticky;
    top: 4.5rem;
    max-height: calc(100vh - 5.4rem);
    overflow-y: auto;
    padding-right: .35rem;
  }
  .split-ref > .sec:first-child,
  .split-qs > .sec:first-child { margin-top: 0; }
}
.split-ref::-webkit-scrollbar { width: 7px; }
.split-ref::-webkit-scrollbar-thumb { background: rgba(35, 33, 30, .18); border-radius: 999px; }

/* Floating Mobile Peek Button */
.peek-fab {
  position: fixed;
  right: 1rem;
  bottom: 1.15rem;
  z-index: 30;
  background: var(--c);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: .7rem 1.15rem;
  font: 700 .9rem var(--head);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}
@media (min-width: 960px) { .peek-fab { display: none; } }

/* Section Banner */
.sec {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  background: color-mix(in srgb, var(--c) 11%, var(--card));
  color: var(--c);
  padding: .55rem .95rem;
  border-radius: 12px;
  margin: 1.5rem 0 .85rem;
  font-size: 1.02rem;
}
.sec-min { font-family: var(--body); font-weight: 500; font-size: .84rem; color: var(--muted); white-space: nowrap; }

/* Prose & Passage (Age-9 Readability Spec) */
.p { margin: .65rem 0; max-width: 60ch; line-height: 1.7; }
.p.body_s { font-size: .95rem; color: var(--muted); }
.blank {
  display: inline-block;
  width: 9rem !important;
  padding: .2rem .5rem !important;
  margin: .15rem .25rem;
  border-width: 0 0 2.5px !important;
  border-radius: 6px 6px 0 0 !important;
  background: color-mix(in srgb, var(--c) 8%, var(--surface)) !important;
}

.passage {
  background: var(--card);
  border: 2px solid var(--line);
  border-left: 6px solid var(--c);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  font-size: var(--r-size);
  line-height: var(--r-lh);
  letter-spacing: var(--r-ls);
  word-spacing: var(--r-ws);
  margin: .85rem 0;
  box-shadow: var(--shadow);
}
.passage-inner { max-width: 56ch; }
.passage h4 {
  margin: 0 0 .9rem;
  color: var(--c);
  font-size: 1.18em;
  line-height: 1.3;
  letter-spacing: 0;
}
.para-block {
  position: relative;
  padding: .42rem .55rem .42rem 2.1rem;
  margin: .55rem -.55rem;
  border-radius: 10px;
  transition: opacity 150ms ease, background-color 150ms ease;
}
.para-block.heading-only {
  padding-left: .55rem;
  font-weight: 700;
  color: var(--c);
  margin-top: 1rem;
}
.para-num {
  position: absolute;
  left: .45rem;
  top: .65rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 14%, var(--card));
  color: var(--c);
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  letter-spacing: 0;
  line-height: 1;
  user-select: none;
}
.para-subhead {
  display: block;
  font-weight: 700;
  color: var(--c);
  font-size: .96em;
  margin-bottom: .12rem;
  letter-spacing: 0.008em;
}
.passage .source { font-size: .85rem; color: var(--muted); margin-top: .8rem; letter-spacing: 0; }

/* Reading Ruler Spotlight */
.passage.ruler-on .para-block:not(.heading-only) { opacity: .44; cursor: pointer; }
.passage.ruler-on .para-block.is-focus {
  opacity: 1;
  background: var(--hl);
  box-shadow: inset 3px 0 0 #D99B00;
}
.ruler-hint {
  font-size: .78rem;
  font-weight: 600;
  color: var(--amber-ink);
  margin: 0 0 .6rem;
  letter-spacing: 0;
}

.info {
  background: color-mix(in srgb, var(--c) 7%, var(--card));
  border: 1.5px solid color-mix(in srgb, var(--c) 32%, var(--line));
  border-left: 6px solid var(--c);
  border-radius: var(--radius);
  padding: 1.05rem 1.25rem;
  margin: .9rem 0;
  font-size: var(--r-size);
  line-height: 1.72;
}
.info h4 { margin: 0 0 .4rem; color: var(--c); font-size: 1.05rem; }
.info p { margin: 0; max-width: 58ch; }

.table-wrap { overflow-x: auto; margin: .9rem 0; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); }
table.data { border-collapse: collapse; width: 100%; background: var(--card); font-size: .94rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { border-bottom: 1px solid var(--faint); border-right: 1px solid var(--faint); padding: .6rem .85rem; text-align: center; vertical-align: middle; }
table.data th:last-child, table.data td:last-child { border-right: 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data th { background: var(--c); color: #fff; font-weight: 700; }
table.data tr:nth-child(even) td { background: color-mix(in srgb, var(--bg) 55%, var(--card)); }
table.data input.cell { min-width: 5.5rem; padding: .35rem .5rem; text-align: center; }
table.log th, table.log td { text-align: left; }

.fig { margin: .9rem 0; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: .6rem; display: inline-block; max-width: 100%; }
.fig img { display: block; border-radius: 6px; }
@media (max-width: 600px) {
  .fig { display: block; overflow-x: auto; }
  .fig img { max-width: none; width: min(var(--w), 560px); }
}
textarea.work { margin: .6rem 0; border-style: dashed; min-height: 6.5rem; }

/* Focus Mode Question Stepper Bar (shown when Focus 1-by-1 is enabled) */
.focus-nav {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: .65rem .9rem;
  margin-bottom: .9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}
.q-dots { display: flex; flex-wrap: wrap; gap: .38rem; }
.q-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--faint);
  color: var(--ink);
  font: 700 .8rem var(--head);
  cursor: pointer;
}
.q-dot.done { background: var(--good); color: #fff; }
.q-dot.active { background: var(--c); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 28%, transparent); }
.focus-hidden { display: none !important; }
.focus-foot {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin: .9rem 0 1.2rem;
}

/* Question Cards */
.q {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem 1.2rem;
  margin: .9rem 0;
  box-shadow: var(--shadow);
}
.q-head { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: start; }
.q-n {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font: 700 .95rem var(--head);
  flex-shrink: 0;
}
.q-text {
  padding-top: .12rem;
  font-size: 1.04rem;
  line-height: 1.62;
  max-width: 58ch;
  font-weight: 500;
}
.q-pts { font-size: .8rem; font-weight: 600; color: var(--muted); white-space: nowrap; padding-top: .32rem; }
.q textarea.answer { margin-top: .75rem; font-size: 1.02rem; line-height: 1.65; }
.q .paper {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .5rem;
  font-size: .86rem;
  color: var(--muted);
  cursor: pointer;
  min-height: 36px;
}

/* Multiple Choice (48-52px touch cards with boxed letter chip) */
.opts { display: grid; gap: .55rem; margin: .85rem 0 0; }
.opt {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 52px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: .6rem .85rem;
  background: var(--surface);
  cursor: pointer;
  line-height: 1.45;
  transition: border-color 130ms ease, background-color 130ms ease;
}
.opt:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 5%, var(--surface)); }
.opt input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.opt .opt-letter {
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: var(--faint);
  color: var(--ink);
  font: 700 .9rem var(--head);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.opt:has(input:checked) {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 10%, var(--surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 18%, transparent);
}
.opt:has(input:checked) .opt-letter { background: var(--c); color: #fff; }
.opt:has(input:focus-visible) { outline: 3px solid var(--c); outline-offset: 2px; }
ol.opts.plain { padding-left: 2.2rem; display: grid; gap: .4rem; }

/* True / False (46px+ distinct pills) */
ol.tf { list-style: lower-alpha; padding-left: 1.5rem; margin: .85rem 0 0; display: grid; gap: .65rem; }
ol.tf li {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: .75rem .9rem;
  list-style-position: inside;
}
ol.tf li > span:first-child { display: block; margin-bottom: .55rem; line-height: 1.55; }
.tf-btns { display: flex; flex-wrap: wrap; gap: .55rem; }
.tf-btns label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  min-width: 5.5rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: .35rem 1.05rem;
  background: var(--card);
  font: 700 .9rem var(--head);
  cursor: pointer;
  transition: all 130ms ease;
}
.tf-btns label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tf-btns label:has(input[value="T"]:checked) { background: var(--good); border-color: var(--good); color: #fff; }
.tf-btns label:has(input[value="F"]:checked) { background: var(--warn); border-color: var(--warn); color: #fff; }
.tf-btns label:has(input:focus-visible) { outline: 3px solid var(--c); outline-offset: 2px; }

/* Math Drills (spacious 2-col cards, tabular numbers) */
.drill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: .65rem .85rem;
  margin-top: .85rem;
}
.drill-item {
  display: grid;
  grid-template-columns: 1fr 5.8rem;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
}
.drill-item .expr { font-size: 1.08rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.drill-item input {
  text-align: center;
  padding: .45rem .35rem !important;
  min-height: 46px;
  font-size: 1.08rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.drill-item .dmark { grid-column: 1 / -1; font-size: .82rem; font-weight: 700; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.drill-item .dmark:empty { display: none; }
.drill-item.right { background: #E7F5EC; border-color: #A7D8B9; }
.drill-item.right .dmark { color: var(--good); }
.drill-item.wrong { background: var(--warn-bg); border-color: #E8B4BA; }
.drill-item.wrong .dmark { color: var(--warn); }

.mark:empty { display: none; }
.mark { margin-top: .7rem; }
.got, .wait { display: inline-block; font-size: .86rem; font-weight: 700; border-radius: 999px; padding: .2rem .8rem; }
.got.full { background: var(--good-bg); color: var(--good-ink); }
.got.part { background: var(--amber-bg); color: var(--amber-ink); }
.got.none { background: var(--warn-bg); color: var(--warn); }
.wait { background: var(--faint); color: var(--muted); }

/* Reflection */
.refl {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin: 1.6rem 0 1.1rem;
  border: 2px dashed var(--line-strong);
  max-width: 780px;
}
.refl h3 { margin: 0 0 .25rem; }
.feel { display: flex; flex-wrap: wrap; gap: .55rem; margin: .7rem 0; }
.feel label {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: .3rem 1.05rem;
  font-weight: 600;
  cursor: pointer;
}
.feel label:has(input:checked) {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 10%, var(--surface));
  font-weight: 700;
}
.lesson-foot { margin: 1.4rem 0; display: grid; gap: .45rem; justify-items: start; }
.total { font-size: 1.25rem; font-variant-numeric: tabular-nums; }

/* ================================================================== Parent Marking */
.parent-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  align-items: start;
  margin-top: 1rem;
}
@media (min-width: 980px) {
  .parent-layout { grid-template-columns: minmax(0, 62%) minmax(0, 38%); }
  .parent-side { position: sticky; top: 4.5rem; }
}
.psum {
  margin: .85rem 0;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-left: 5px solid var(--c);
  padding: .75rem 1rem;
  border-radius: 12px;
  font-size: .88rem;
  line-height: 1.55;
}
.psum p { margin: .3rem 0; }
.pbox {
  background: #FFFBEF;
  border: 1.5px solid #E8D9A8;
  border-radius: 14px;
  padding: .85rem 1rem;
}
.pbox p { margin: .3rem 0; }
.keytext { font-size: .93rem; line-height: 1.55; }
.pmark { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-top: .55rem !important; }
.stepper { display: inline-flex; gap: .3rem; vertical-align: middle; }
.stepper button {
  min-width: 2.55rem;
  height: 2.55rem;
  border-radius: 10px;
  border: 2px solid var(--line-strong);
  background: #fff;
  font: 700 1rem var(--head);
  cursor: pointer;
}
.stepper button.on { background: var(--c); border-color: var(--c); color: #fff; }
.dmark .stepper button { min-width: 2.1rem; height: 2.1rem; font-size: .86rem; }
.dmark .key { color: var(--ink); font-weight: 500; }
.auto, .tag { font-size: .76rem; font-weight: 700; color: var(--muted); background: var(--faint); border-radius: 999px; padding: .15rem .6rem; }
.tag.needs { background: var(--amber-bg); color: var(--amber-ink); }
.scorebox { width: 100%; }
.scorebox h3 { margin: 0 0 .5rem; }
.scorebox .total { padding-bottom: .6rem; border-bottom: 1.5px solid #E8D9A8; margin-bottom: .8rem; }

.plist { display: grid; gap: .6rem; }
.prow {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  gap: .85rem;
  align-items: center;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-left: 6px solid var(--c);
  border-radius: 14px;
  padding: .85rem 1.05rem;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 110ms ease, box-shadow 130ms ease;
}
.prow:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(35, 33, 30, .1); }
.prow .pr-l { font-weight: 700; font-size: .84rem; color: var(--muted); }
.prow .pr-t { font-family: var(--head); font-weight: 700; font-size: 1rem; }
.prow .pr-s { font-size: .84rem; color: var(--muted); text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.mark-cta {
  display: inline-block;
  background: var(--c);
  color: #fff;
  border-radius: 999px;
  padding: .25rem .8rem;
  font: 700 .8rem var(--head);
}
@media (max-width: 640px) {
  .prow { grid-template-columns: 1fr; gap: .25rem; }
  .prow .pr-s { text-align: left; align-items: flex-start; }
}
select { max-width: 34rem; }

/* ================================================================== Progress & Log */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; margin: 1.1rem 0; }
.stat {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.2rem;
  display: grid;
  gap: .2rem;
  box-shadow: var(--shadow);
}
.stat .num { font-family: var(--head); font-size: 1.95rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .lab { color: var(--muted); font-size: .86rem; }

.chart-wrap {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: .85rem;
  box-shadow: var(--shadow);
}
.chart { width: 100%; height: auto; display: block; font-family: var(--body); }
.chart .grid { stroke: var(--faint); stroke-width: 1; }
.chart .axis { stroke: var(--ink); stroke-width: 1.2; }
.chart .target { stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 5 5; }
.chart .tick { fill: var(--muted); font-size: 13px; font-weight: 600; }
.chart .bar { fill: #2F64A8; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover, .chart .hit:focus { fill: rgba(47, 100, 168, .08); outline: none; }
.tableview { margin: .7rem 0 1.2rem; font-size: .9rem; }
.tableview summary { cursor: pointer; color: var(--brand); font-weight: 600; }

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .3rem;
  background: var(--faint);
  padding: .28rem;
  border-radius: 999px;
  margin-bottom: .8rem;
}
.seg button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: .42rem .95rem;
  min-height: 38px;
  font: 700 .86rem var(--head);
  color: var(--muted);
  cursor: pointer;
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(35, 33, 30, .12); }

.msg {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-left: 6px solid var(--c);
  border-radius: var(--radius);
  padding: .85rem 1.2rem 1rem;
  margin: .85rem 0;
  box-shadow: var(--shadow);
}
.msg h3 { margin: .2rem 0 .5rem; color: var(--c); }
.msrow {
  display: grid;
  grid-template-columns: 1fr 9.5rem 10rem;
  gap: .85rem;
  align-items: center;
  padding: .65rem 0;
  border-top: 1px solid var(--faint);
  font-size: .94rem;
}
.ms-desc { font-weight: 500; line-height: 1.45; }
.ms-code {
  display: inline-block;
  margin-top: .18rem;
  font-weight: 600;
  color: var(--muted);
  font-size: .74rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.ms-bar { outline: none; }
.track { position: relative; display: block; height: 12px; background: var(--faint); border-radius: 999px; }
.fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c); border-radius: 999px; }
.tick70 { position: absolute; left: 70%; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 2px; }
.ms-st { font-size: .86rem; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 680px) {
  .msrow { grid-template-columns: 1fr; gap: .4rem; }
  .ms-st { text-align: left; }
}

.subj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .45rem; vertical-align: middle; }
.day {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: .75rem 1.2rem .9rem;
  margin: .75rem 0;
}
.day h3 { margin: .2rem 0 .6rem; font-size: 1rem; }
.day ul {
  margin: 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--line);
  margin-left: .4rem;
  list-style: none;
  display: grid;
  gap: .45rem;
}
.day li { position: relative; font-size: .92rem; line-height: 1.5; }
.day li::before {
  content: "";
  position: absolute;
  left: -1.42rem;
  top: .45rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
}
.day .t { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; margin-right: .35rem; }

@media print {
  .topbar, .lesson-foot, .lh-chips, .lh-prog-track, .comfort-bar, .peek-fab, .focus-nav, .focus-foot { display: none !important; }
  body, .card, .q, .passage { background: #fff !important; box-shadow: none !important; }
  .lesson-split, .parent-layout { display: block !important; }
  .split-ref, .parent-side { position: static !important; max-height: none !important; overflow: visible !important; }
  .focus-hidden { display: block !important; }
}
