/* ============================================================
   QASMT Prep — Practice Portal
   Design direction: calm academic / trustworthy edu-portal.
   Dark navy sidebar, light airy main, teal + amber accents,
   subject colour-coding, soft depth. Built to feel intentional.
   Type pairing: Fraunces (self-hosted, headings) + system sans (body —
   also gives native Hangul rendering via Malgun Gothic).
   ============================================================ */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-latin-var.woff2") format("woff2");
  font-weight: 600 700; /* variable — one file covers both weights */
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand / structure */
  --navy:      #0f2a43;
  --navy-2:    #143a5c;
  --navy-3:    #1d4a72;
  --brand:     #1d6fb8;
  --teal:      #12b5a5;
  --amber:     #f5a524;

  /* Surfaces & ink */
  --bg:        #eef2f8;
  --bg-2:      #e6ecf5;
  --surface:   #ffffff;
  --surface-2: #f7f9fc;
  --ink:       #16232f;
  --ink-2:     #3d4d5c;
  --muted:     #6b7c8d;
  --line:      #e2e8f1;
  --line-2:    #d5deea;

  /* Semantic status colours.
     NOTE: --green/--yellow/--red/--brand must stay in sync with QP.colors in
     assets/ui.js (JS needs literal values for inline-SVG chart fills).
     Subject colours live in build-data.mjs (bundled into data.js) only. */
  --green:     #16a34a;
  --green-bg:  #dcfce7;
  --red:       #dc2626;
  --red-bg:    #fee2e2;
  --yellow:    #d97706;
  --yellow-bg: #fef3c7;

  /* Geometry */
  --header-h:  64px;
  --side-w:    248px;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(16,42,67,.06), 0 8px 24px rgba(16,42,67,.08);
  --shadow-lg: 0 12px 40px rgba(16,42,67,.16);
  --ease:      cubic-bezier(.16,1,.3,1);

  /* Spacing rhythm (use these, not ad-hoc pixel values) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 14px;
  --space-4: 22px;
  --space-5: 36px;
  --space-6: 56px;

  --font: "Segoe UI", system-ui, -apple-system, "Malgun Gothic", sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;

  /* Focus ring (keyboard navigation) */
  --focus-ring: 0 0 0 3px rgba(29,111,184,.35);
}

::selection { background: rgba(18,181,165,.22); }

/* visible keyboard-focus for every interactive element */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* screen-reader-only utility */
.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;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }

/* ============================================================
   APP SHELL — grid: header spans top, sidebar left, main right
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  grid-template-rows: var(--header-h) 1fr auto;
  grid-template-areas: "header header" "sidebar main" "foot foot";
  min-height: 100vh;
}

/* ---------- HEADER ---------- */
.app-header {
  grid-area: header;
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(16,42,67,.02);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--navy), var(--navy-3));
  color: var(--teal); font-family: var(--serif); font-size: 22px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: -.2px; }
.brand-text em { font-style: normal; font-size: 11.5px; color: var(--muted); }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.header-target {
  font-size: 12.5px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 999px; display: flex; align-items: center; gap: 7px;
}
.header-target .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(18,181,165,.18); }
.header-target strong { color: var(--navy); }
.student-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(150deg, var(--brand), var(--teal));
}
.student-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }

.hamburger { display: none; background: none; border: 0; cursor: pointer; padding: 6px; flex-direction: column; gap: 4px; }
.hamburger span { width: 22px; height: 2.5px; background: var(--navy); border-radius: 2px; }

/* ---------- SIDEBAR ---------- */
.app-sidebar {
  grid-area: sidebar;
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h));
  background: linear-gradient(180deg, var(--navy), #0c2136);
  color: #c9d6e5;
  display: flex; flex-direction: column;
  padding: 16px 12px;
  z-index: 30;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 10px;
  color: #b7c6d8; font-size: 14.5px; font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.nav-item .ic { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #eaf1f8; }
.nav-item.active {
  background: linear-gradient(100deg, rgba(18,181,165,.22), rgba(29,111,184,.18));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.nav-item.active .ic { opacity: 1; stroke: var(--teal); }

.side-foot { margin-top: auto; display: flex; gap: 10px; padding: 10px 6px 4px; }
.side-stat {
  flex: 1; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
  border-radius: 11px; padding: 10px; text-align: center;
}
.side-stat strong { display: block; font-size: 19px; color: #fff; }
.side-stat span { font-size: 10.5px; color: #90a3b8; text-transform: uppercase; letter-spacing: .5px; }

.sidebar-scrim { display: none; }

/* ---------- MAIN ---------- */
.app-main {
  grid-area: main;
  padding: 30px clamp(18px, 3.5vw, 48px) 64px;
  max-width: 1180px;
  width: 100%;
}
.loading { color: var(--muted); padding: 40px 0; }

/* ---------- FOOTER (persistent legal notice) ---------- */
.app-foot {
  grid-area: foot;
  background: var(--navy);
  color: #9fb3c8;
  padding: 22px clamp(18px, 3.5vw, 48px);
  display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.app-foot .foot-disclaimer { margin: 0; font-size: 11.5px; line-height: 1.6; max-width: 90ch; color: #8ca2ba; }
.app-foot .foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.app-foot .foot-links a { color: #c9d6e5; font-size: 12.5px; font-weight: 600; }
.app-foot .foot-links a:hover { color: #fff; text-decoration: underline; }
.app-foot .foot-copy { margin: 0; font-size: 11px; color: #6f849b; }

/* ============================================================
   SHARED PRIMITIVES
   ============================================================ */
.page-head { margin-bottom: var(--space-4); }
.page-head h1 { margin: 0 0 6px; font-family: var(--serif); font-weight: 600; font-size: clamp(23px, 2.5vw, 32px); letter-spacing: -.3px; color: var(--navy); text-wrap: balance; }
.page-head p { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 62ch; text-wrap: pretty; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--teal); margin-bottom: 8px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: var(--space-5) 0 var(--space-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease),
              background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
  background: var(--surface-2); color: var(--ink); border-color: var(--line-2);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary { background: linear-gradient(120deg, var(--brand), #1f8ac9); color: #fff; border-color: transparent; }
.btn-primary:hover { box-shadow: 0 8px 20px rgba(29,111,184,.32); }
.btn-teal { background: linear-gradient(120deg, var(--teal), #0ea89a); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: var(--red-bg); background: #fff; }
.btn-danger:hover { background: var(--red-bg); }
.btn-lg { padding: 14px 26px; font-size: 15.5px; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-green { background: var(--green-bg); color: #15803d; }
.pill-red { background: var(--red-bg); color: #b91c1c; }
.pill-yellow { background: var(--yellow-bg); color: #b45309; }
.pill-grey { background: var(--bg-2); color: var(--ink-2); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--navy), var(--navy-3) 70%, #245a86);
  color: #eaf2fa; border-radius: 18px; padding: 30px 32px;
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(18,181,165,.35), transparent 65%); pointer-events: none;
}
.hero h1 { margin: 0 0 8px; font-family: var(--serif); font-weight: 600; font-size: clamp(23px, 2.7vw, 32px); letter-spacing: -.3px; text-wrap: balance; }
.hero p { margin: 0; max-width: 60ch; color: #b9cde0; font-size: 14.5px; text-wrap: pretty; }
.hero .hero-cta { margin-top: 20px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-primary { background: var(--teal); }
.hero .btn-ghost { color: #eaf2fa; border-color: rgba(255,255,255,.25); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat .stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat .stat-value { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-top: 4px; color: var(--navy); }
.stat .stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat .stat-bar { position: absolute; left: 0; bottom: 0; height: 4px; width: var(--w,0%); background: var(--c, var(--brand)); transition: width .6s var(--ease); }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.subject-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 12px; transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), opacity .18s var(--ease);
  border-top: 3px solid var(--sc, var(--brand));
}
.subject-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.subject-card[disabled] { opacity: .5; cursor: default; }
.subject-card[disabled]:hover { transform: none; box-shadow: var(--shadow); }
.subject-card .sc-top { display: flex; align-items: center; gap: 12px; }
.subject-card .sc-icon {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  background: var(--sca, #eef); color: var(--sc, var(--brand));
}
.subject-card .sc-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.subject-card h3 { margin: 0; font-size: 16.5px; color: var(--navy); }
.subject-card .sc-meta { font-size: 12.5px; color: var(--muted); }
.subject-card .sc-progress { font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; }
.subject-card .track { height: 7px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.subject-card .track > i { display: block; height: 100%; width: var(--w,0%); background: var(--sc, var(--brand)); border-radius: 99px; }

/* ============================================================
   RESOURCE (5-Parts) BUTTONS
   ============================================================ */
.parts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.part-btn {
  display: flex; flex-direction: column; gap: 10px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--pc, var(--brand));
  border-radius: var(--radius); padding: 20px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), opacity .18s var(--ease); color: var(--ink);
}
.part-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.part-btn .pb-top { display: flex; align-items: center; justify-content: space-between; }
.part-btn .pb-num { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--pc, var(--brand)); opacity: .5; }
.part-btn h3 { margin: 0; font-size: 17px; color: var(--navy); }
.part-btn p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.part-btn .pb-go { margin-top: 4px; font-size: 12.5px; font-weight: 700; color: var(--pc, var(--brand)); display: flex; align-items: center; gap: 5px; }

.links-list { display: grid; gap: 10px; }
.link-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), opacity .16s var(--ease);
}
.link-row:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.link-row .lr-ic { width: 36px; height: 36px; border-radius: 9px; background: var(--bg-2); display: grid; place-items: center; color: var(--brand); flex-shrink: 0; }
.link-row .lr-body { flex: 1; min-width: 0; }
.link-row .lr-body strong { display: block; font-size: 14.5px; color: var(--navy); }
.link-row .lr-body span { font-size: 12.5px; color: var(--muted); }
.link-row .lr-arrow { color: var(--muted); }

/* Rendered markdown (strategy docs) */
.doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 40px); box-shadow: var(--shadow); }
.doc h1, .doc h2, .doc h3, .doc h4 { color: var(--navy); line-height: 1.25; }
.doc h1 { font-family: var(--serif); font-weight: 600; font-size: 27px; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 2px solid var(--line); }
.doc h2 { font-family: var(--serif); font-weight: 600; font-size: 21px; margin: 30px 0 12px; }
.doc h3 { font-size: 16.5px; margin: 22px 0 8px; }
.doc h4 { font-size: 14.5px; margin: 18px 0 6px; }
.doc p { color: var(--ink-2); margin: 10px 0; }
.doc ul, .doc ol { color: var(--ink-2); padding-left: 22px; }
.doc li { margin: 5px 0; }
.doc strong { color: var(--ink); }
.doc code { background: var(--bg-2); padding: 2px 6px; border-radius: 5px; font-size: .9em; color: var(--navy); }
.doc blockquote { margin: 14px 0; padding: 12px 18px; border-left: 4px solid var(--teal); background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--ink-2); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.doc a { color: var(--brand); text-decoration: underline; }
.doc .table-wrap { overflow-x: auto; margin: 16px 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.doc th, .doc td { border: 1px solid var(--line-2); padding: 9px 12px; text-align: left; vertical-align: top; }
.doc th { background: var(--surface-2); color: var(--navy); font-weight: 700; }
.doc tr:nth-child(even) td { background: var(--surface-2); }

.doc-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* ============================================================
   TEST SELECTION
   ============================================================ */
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.set-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); cursor: pointer; transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), opacity .18s var(--ease);
  display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--sc, var(--brand));
}
.set-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.set-card .set-n { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.set-card h3 { margin: 0; font-size: 16px; color: var(--navy); }
.set-card .set-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.set-card .set-best { margin-top: auto; font-size: 12.5px; }

.subject-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.subject-tab {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: transform .16s var(--ease), box-shadow .16s var(--ease), background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), opacity .16s var(--ease);
}
.subject-tab:hover { border-color: var(--sc); }
.subject-tab.active { background: var(--sc, var(--navy)); color: #fff; border-color: transparent; }

/* Origin groups on the Take-a-Test page (Edutest core / US / UK style) */
.origin-head { display: flex; align-items: center; gap: 13px; margin: 30px 0 14px; }
.origin-head .oh-flag { font-size: 12px; font-weight: 800; letter-spacing: .5px; color: #fff; background: var(--muted); padding: 6px 9px; border-radius: 8px; line-height: 1; }
.origin-head.og-edutest .oh-flag { background: var(--teal); }
.origin-head.og-bank .oh-flag { background: #d97706; }
.origin-head.og-us .oh-flag { background: #3b82f6; }
.origin-head.og-uk .oh-flag { background: #6366f1; }
.origin-head h2 { margin: 0; font-size: 17px; color: var(--navy); display: flex; align-items: center; gap: 9px; }
.origin-head .oh-count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg-2); padding: 2px 10px; border-radius: 999px; }
.origin-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.set-basis { font-size: 11.5px; color: var(--teal); font-weight: 600; margin: -4px 0 2px; }

/* ============================================================
   QUIZ RUNNER
   ============================================================ */
.quiz-wrap { max-width: 1120px; }
.quiz-bar {
  position: sticky; top: calc(var(--header-h) + 0px); z-index: 20;
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 18px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.quiz-bar .qb-title { font-weight: 700; color: var(--navy); font-size: 15px; }
.quiz-bar .qb-title span { color: var(--muted); font-weight: 500; font-size: 13px; }
.quiz-bar .qb-progress { flex: 1; height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.quiz-bar .qb-progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--teal)); width: 0; transition: width .3s var(--ease); }
.timer {
  display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 16px; color: var(--navy);
  background: var(--surface-2); border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px;
}
.timer svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.timer.warn { color: var(--yellow); border-color: var(--yellow-bg); background: var(--yellow-bg); }
.timer.danger { color: var(--red); border-color: var(--red-bg); background: var(--red-bg); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.quiz-layout { display: grid; grid-template-columns: 1fr 210px; gap: 20px; align-items: start; }

.q-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.q-passage {
  padding: 22px 26px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  /* No inner scroll — the passage expands to full height and the page's own
     scroll bar handles it (avoids a separate scroll region near the passage). */
}
.q-passage .qp-title { font-family: var(--serif); font-size: 18px; color: var(--navy); margin: 0 0 6px; }
.q-passage .qp-type { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--teal); font-weight: 700; margin-bottom: 10px; }
.q-passage p { color: var(--ink-2); margin: 0 0 10px; font-size: 14.5px; line-height: 1.65; }
.q-passage.poem p { white-space: pre-wrap; font-style: italic; }

.q-body { padding: 26px; }
.q-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.q-num { font-size: 13px; font-weight: 700; color: var(--muted); }
.q-topic { font-size: 11.5px; }
.q-stem { font-size: 17px; color: var(--ink); line-height: 1.55; margin-bottom: 8px; font-weight: 500; }
.q-figure { margin: 14px 0; padding: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; display: inline-block; }
.q-figure svg { width: 300px; max-width: 100%; height: auto; display: block; }

.options { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.option {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1.5px solid var(--line-2); border-radius: 11px; cursor: pointer;
  background: var(--surface); transition: transform .14s var(--ease), box-shadow .14s var(--ease), background-color .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease), opacity .14s var(--ease); text-align: left; width: 100%;
}
.option:hover { border-color: var(--brand); background: #f6faff; }
.option .opt-key {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--bg-2); color: var(--ink-2); transition: transform .14s var(--ease), box-shadow .14s var(--ease), background-color .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease), opacity .14s var(--ease);
}
.option .opt-text { font-size: 15px; color: var(--ink); }
.option .opt-text svg { width: 150px; max-width: 100%; height: auto; vertical-align: middle; display: block; }
.option.selected { border-color: var(--brand); background: #eaf4ff; box-shadow: inset 0 0 0 1px var(--brand); }
.option.selected .opt-key { background: var(--brand); color: #fff; }

.q-actions { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.q-actions .spacer { flex: 1; }
.flag-btn { display: inline-flex; align-items: center; gap: 7px; background: none; border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 14px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.flag-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.flag-btn.on { color: var(--amber); border-color: var(--amber); background: #fff8ec; }
.flag-btn.on svg { fill: var(--amber); }

/* Question navigator */
.q-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; position: sticky; top: calc(var(--header-h) + 74px); }
.q-nav h4 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.q-nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.q-dot {
  aspect-ratio: 1; border-radius: 8px; border: 1.5px solid var(--line-2); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: transform .14s var(--ease), box-shadow .14s var(--ease), background-color .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease), opacity .14s var(--ease);
  display: grid; place-items: center; position: relative;
}
.q-dot:hover { border-color: var(--brand); }
.q-dot.answered { background: var(--navy); color: #fff; border-color: var(--navy); }
.q-dot.current { outline: 3px solid rgba(29,111,184,.35); border-color: var(--brand); }
.q-dot.flagged::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; background: var(--amber); border-radius: 50%; border: 1.5px solid #fff; }
.q-nav .qn-legend { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--muted); }
.q-nav .qn-legend span { display: flex; align-items: center; gap: 7px; }
.q-nav .qn-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.q-nav .submit-wrap { margin-top: 16px; }

/* keyboard-shortcut hint (desktop only — pointless on touch) */
.qn-keys { margin-top: 13px; padding-top: 11px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--muted); line-height: 1.9; }
.qn-keys kbd {
  display: inline-block; min-width: 17px; text-align: center;
  background: var(--bg-2); border: 1px solid var(--line-2); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 4px; font-family: inherit; font-size: 10.5px; color: var(--ink-2);
}
@media (hover: none) and (pointer: coarse) { .qn-keys { display: none; } }

/* ============================================================
   RESULTS REPORT
   ============================================================ */
.save-warn {
  background: var(--yellow-bg); border: 1px solid #f2d38b; color: #92600a;
  border-radius: var(--radius-sm); padding: 13px 16px; font-size: 13.5px;
  margin-bottom: 16px; line-height: 1.5;
}

.result-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px 32px; box-shadow: var(--shadow-lg); margin-bottom: 22px;
  border-top: 5px solid var(--rc, var(--brand));
}
.score-ring { position: relative; width: 132px; height: 132px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .sr-num { position: absolute; inset: 0; display: grid; place-items: center; flex-direction: column; }
.score-ring .sr-num b { font-size: 34px; font-weight: 800; color: var(--navy); line-height: 1; }
.score-ring .sr-num small { font-size: 12px; color: var(--muted); }
.result-hero .rh-body h1 { margin: 0 0 4px; font-family: var(--serif); font-weight: 600; font-size: 25px; color: var(--navy); }
.result-hero .rh-body .rh-sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.result-hero .verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.result-hero .verdict .big-pill { font-size: 14px; padding: 8px 16px; }

.result-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.rstat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.rstat .rs-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.rstat .rs-value { font-size: 22px; font-weight: 800; color: var(--navy); margin-top: 3px; }

.benchmark-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 22px; }
.benchmark-box h3 { margin: 0 0 4px; font-size: 15px; color: var(--navy); }
.benchmark-box .bm-note { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.bm-track { position: relative; height: 34px; background: var(--bg-2); border-radius: 10px; overflow: hidden; }
.bm-track .bm-fill { height: 100%; border-radius: 10px; transition: width .7s var(--ease); }
.bm-track .bm-marker { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--navy); }
.bm-track .bm-marker::after { content: attr(data-label); position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.bm-legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }

.topic-breakdown { display: grid; gap: 10px; }
.topic-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; }
.topic-row .tr-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.topic-row .tr-track { grid-column: 1 / -1; height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.topic-row .tr-track > i { display: block; height: 100%; border-radius: 99px; }
.topic-row .tr-score { font-size: 13px; font-weight: 700; }

.review-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.review-item .ri-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; cursor: pointer; }
.review-item .ri-badge { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; font-weight: 800; font-size: 15px; color: #fff; }
.review-item .ri-badge.ok { background: var(--green); }
.review-item .ri-badge.no { background: var(--red); }
.review-item .ri-badge.skip { background: var(--muted); }
.review-item .ri-q { flex: 1; }
.review-item .ri-q .ri-num { font-size: 12px; color: var(--muted); font-weight: 700; }
.review-item .ri-q .ri-stem { font-size: 14.5px; color: var(--ink); margin-top: 2px; }
.review-item .ri-chev { color: var(--muted); transition: transform .2s var(--ease); }
.review-item.open .ri-chev { transform: rotate(180deg); }
.review-body { display: none; padding: 0 20px 20px 58px; }
.review-item.open .review-body { display: block; }
.review-figure { margin: 8px 0 14px; }
.review-figure svg { width: 260px; max-width: 100%; height: auto; }
.ans-line { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 7px; }
.ans-line.correct { background: var(--green-bg); color: #15803d; }
.ans-line.your-wrong { background: var(--red-bg); color: #b91c1c; }
.ans-line .al-key { font-weight: 800; }
.explain-box { margin-top: 12px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.explain-box .eb-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--teal); margin-bottom: 6px; }
.explain-box p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.explain-box.why-wrong .eb-label { color: var(--red); }

.review-filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

/* ============================================================
   HISTORY
   ============================================================ */
.hist-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.hist { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
table.hist th { text-align: left; padding: 13px 16px; background: var(--surface-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--line); }
table.hist td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
table.hist tr:last-child td { border-bottom: 0; }
table.hist tr.clickable { cursor: pointer; }
table.hist tr.clickable:hover td { background: var(--surface-2); }
.subject-dot { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.subject-dot i { width: 10px; height: 10px; border-radius: 50%; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state svg { width: 54px; height: 54px; stroke: var(--line-2); fill: none; stroke-width: 1.5; margin-bottom: 14px; }
.empty-state h3 { color: var(--ink-2); margin: 0 0 6px; }

/* ============================================================
   MISTAKE NOTEBOOK (오답노트)
   ============================================================ */
.subject-tab .tab-badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px;
}
.subject-tab.active .tab-badge { background: rgba(255,255,255,.28); }
.mistake-item .ri-stem { font-weight: 500; }
.mistake-item .ri-badge { position: relative; overflow: visible; }
/* the small ×2 / ×3 that appends next to the ✕ when wrong again in a retake */
.ri-badge .rb-count { position: absolute; top: -7px; right: -9px; background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 800; padding: 1px 4px; border-radius: 7px; border: 1.5px solid #fff; line-height: 1.2; }

.mistake-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.mistake-subtabs { display: inline-flex; gap: 4px; background: var(--bg-2); padding: 4px; border-radius: 10px; }
.subtab { padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: transform .14s var(--ease), box-shadow .14s var(--ease), background-color .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease), opacity .14s var(--ease); }
.subtab b { margin-left: 5px; opacity: .7; }
.subtab:hover { color: var(--ink); }
.subtab.active { background: var(--surface); color: var(--navy); box-shadow: var(--shadow); }

.retake-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(120deg, #7c2d12, #b45309); color: #fff; border-radius: 18px; padding: 26px 30px; box-shadow: var(--shadow-lg); }
.retake-hero .rt-big { font-size: 44px; font-weight: 800; line-height: 1; }
.retake-hero .rt-lbl { font-size: 14px; color: #fde8cf; margin-top: 4px; }
.retake-hero .btn-primary { background: #fff; color: #9a3412; }
.retake-hero .btn-primary:hover { box-shadow: 0 8px 20px rgba(0,0,0,.25); }

/* ============================================================
   PROGRESS PAGE, CHARTS, BADGES
   ============================================================ */
/* unread-style badge on the Retake Mistakes nav item */
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; display: inline-grid; place-items: center; box-shadow: 0 0 0 2px rgba(220,38,38,.25); }

/* clickable profile chip → Progress */
a.student-chip { text-decoration: none; color: inherit; padding: 4px 10px 4px 4px; border-radius: 999px; transition: background .15s var(--ease); }
a.student-chip:hover { background: var(--surface-2); }
.chip-chev { color: var(--muted); flex-shrink: 0; }

/* extra mistake-card states */
.review-item .ri-badge.learn { background: var(--yellow); }
.mistake-item.is-mastered { opacity: .82; }

/* range tabs (Week / Month / 3mo / 6mo / 1yr) */
.range-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.range-tab { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); transition: transform .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), opacity .15s var(--ease); }
.range-tab:hover { border-color: var(--brand); }
.range-tab.active { background: var(--navy); color: #fff; border-color: transparent; }

/* charts */
.chart-card { padding: 18px 18px 14px; margin-bottom: 6px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-empty { color: var(--muted); font-size: 14px; padding: 30px 8px; text-align: center; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-axlbl { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.ch-rowlbl { fill: var(--ink-2); font-size: 12.5px; font-family: var(--font); }
.ch-target { stroke: var(--teal); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .75; }
.ch-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-track { fill: var(--bg-2); }
.ch-barval { font-size: 12.5px; font-weight: 700; font-family: var(--font); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.chart-legend .lg-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.chart-legend .lg-item i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.chart-legend .lg-item b { color: var(--navy); margin-left: 2px; }

code.uuid { font-size: 12px; background: var(--bg-2); padding: 2px 6px; border-radius: 5px; color: var(--ink-2); cursor: help; }

.learn-block {
  margin-top: 16px; border: 1px solid #c9ebe6;
  background: linear-gradient(180deg, #f1fbf9, #f6fcff);
  border-radius: 12px; padding: 16px 18px;
}
.learn-concept { display: flex; gap: 9px; align-items: center; font-weight: 700; color: var(--navy); font-size: 15px; margin-bottom: 14px; }
.learn-concept .lc-ic { font-size: 17px; }

.wordgroup { margin-bottom: 14px; }
.wordgroup:last-of-type { margin-bottom: 0; }
.wg-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--teal); margin-bottom: 4px; }
.wg-note { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; font-style: italic; }
.wg-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; }
.wordcard { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; }
.wordcard b { display: block; color: var(--navy); font-size: 14.5px; margin-bottom: 1px; }
.wordcard span { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }

.learn-practice { margin-top: 16px; border-top: 1px dashed #bfe4de; padding-top: 14px; }
.learn-practice .btn.open { background: var(--navy); }
.practice-wrap { margin-top: 14px; display: grid; gap: 12px; }
.practice-item { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.practice-stem { font-size: 14.5px; color: var(--ink); margin-bottom: 11px; line-height: 1.5; }
.practice-opts { display: flex; flex-direction: column; gap: 7px; }
.practice-opt {
  display: flex; align-items: center; gap: 11px; text-align: left; width: 100%;
  background: var(--surface-2); border: 1.5px solid var(--line-2); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; cursor: pointer; transition: transform .14s var(--ease), box-shadow .14s var(--ease), background-color .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease), opacity .14s var(--ease); color: var(--ink);
}
.practice-opt:hover { border-color: var(--teal); }
.practice-opt .po-key { width: 24px; height: 24px; border-radius: 6px; background: var(--bg-2); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.practice-item.answered .practice-opt { cursor: default; }
.practice-item.answered .practice-opt:hover { border-color: var(--line-2); }
.practice-opt.correct { background: var(--green-bg); border-color: var(--green); color: #15803d; }
.practice-opt.correct .po-key { background: var(--green); color: #fff; }
.practice-opt.correct:hover { border-color: var(--green); }
.practice-opt.wrong { background: var(--red-bg); border-color: var(--red); color: #b91c1c; }
.practice-opt.wrong .po-key { background: var(--red); color: #fff; }
.practice-explain { margin-top: 11px; padding: 10px 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.practice-explain .pe-tag { font-weight: 700; color: var(--teal); margin-right: 6px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-scrim { position: fixed; inset: 0; background: rgba(15,42,67,.5); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); max-width: 440px; width: 100%; padding: 26px; animation: modal-in .22s var(--ease); }
.modal h3 { margin: 0 0 8px; font-family: var(--serif); font-weight: 600; color: var(--navy); font-size: 20px; }
.modal p { color: var(--ink-2); font-size: 14.5px; margin: 0 0 20px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ============================================================
   ACCOUNT · CONSENT · CHILD WELCOME
   ============================================================ */
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; max-width: 640px; margin-bottom: var(--space-3);
}
.auth-lede { margin: 0 0 16px; font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }
.auth-note {
  background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--teal);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; color: var(--ink-2);
  margin-bottom: 18px; line-height: 1.55;
}
.auth-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.auth-msg { margin-top: 12px; font-size: 13.5px; color: var(--muted); min-height: 1.2em; }
.auth-msg.err { color: var(--red); font-weight: 600; }

.fld { display: block; margin-bottom: 14px; }
.fld > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.fld input, .fld select {
  width: 100%; max-width: 340px; padding: 11px 13px; font: inherit; font-size: 15px;
  border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.fld input:focus, .fld select:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); }
#authCode { font-variant-numeric: tabular-nums; letter-spacing: 4px; font-size: 20px; font-weight: 700; }

.acct-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.acct-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.acct-email { font-size: 15px; color: var(--navy); font-weight: 600; }

.consent-card .notice-box {
  max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 16px 18px; margin-bottom: 16px; font-size: 13.5px;
}
.consent-card .notice-box h1 { font-size: 18px; margin-top: 0; }
.consent-card .notice-box h2 { font-size: 15px; }
.consent-summary {
  background: #f1fbf9; border: 1px solid #c9ebe6; border-radius: var(--radius-sm);
  padding: 14px 18px; margin-bottom: 18px;
}
.consent-summary h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--teal); }
.consent-summary ul { margin: 0; padding-left: 18px; }
.consent-summary li { font-size: 13.5px; color: var(--ink-2); margin: 5px 0; line-height: 1.5; }
.chk { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: 14px; color: var(--ink-2); line-height: 1.5; cursor: pointer; }
.chk input { margin-top: 3px; width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--brand); }
.consent-version { font-size: 11.5px; color: var(--muted); margin: 4px 0 14px; }

.child-welcome { max-width: 520px; margin: 40px auto; text-align: center; }
.child-welcome .cw-emoji { font-size: 54px; }
.child-welcome h1 { font-family: var(--serif); font-weight: 600; color: var(--navy); margin: 6px 0 20px; }
.child-welcome .cw-points { text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 22px; }
.child-welcome .cw-points p { margin: 0 0 12px; font-size: 15px; color: var(--ink-2); line-height: 1.6; }
.child-welcome .cw-points p:last-child { margin-bottom: 0; }
.child-welcome .fld { text-align: left; }
.child-welcome .fld input { max-width: none; }

/* ============================================================
   TOASTS — transient feedback (role=status)
   ============================================================ */
.toast-wrap {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--navy); color: #eaf2fa; padding: 11px 18px; border-radius: 10px;
  box-shadow: var(--shadow-lg); font-size: 14px; max-width: min(92vw, 480px);
  animation: toast-in .25s var(--ease);
}
.toast.err { background: #7f1d1d; }
.toast.ok  { background: #14532d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 920px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .quiz-layout { grid-template-columns: 1fr; }
  .q-nav { position: static; order: -1; }
  /* auto-fill keeps touch targets ≥38px all the way down to 320px */
  .q-nav-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
  .result-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}
@media (max-width: 760px) {
  :root { --side-w: 0px; }
  .app-shell { grid-template-columns: 1fr; grid-template-areas: "header" "main" "foot"; }
  .hamburger { display: flex; }
  .app-sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 268px;
    transform: translateX(-100%); transition: transform .28s var(--ease);
    box-shadow: var(--shadow-lg); padding-top: 20px;
  }
  body.nav-open .app-sidebar { transform: translateX(0); }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(15,42,67,.45); z-index: 25; }
  .header-target { display: none; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
  .stat-row { grid-template-columns: 1fr; }
  .student-name { display: none; }
  .app-main { padding: 20px 14px 50px; }
  /* quiz top bar wraps: title+timer first row, progress second */
  .quiz-bar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .quiz-bar .qb-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .quiz-bar .qb-progress { order: 3; flex-basis: 100%; }
  .quiz-bar #qbCount { order: 4; }
  .timer { padding: 6px 10px; font-size: 14.5px; }
  .q-body { padding: 18px 16px; }
  .q-passage { padding: 16px 16px; }
  .hero { padding: 24px 20px; }
  .retake-hero { padding: 20px 18px; }
  .result-hero { padding: 20px 16px; }
}

/* ============================================================
   REDUCED MOTION — respect the user's OS setting
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   PRINT — results reports & strategy guides on paper
   ============================================================ */
@media print {
  .app-header, .app-sidebar, .sidebar-scrim, .hamburger,
  .btn, .review-filters, .hero-cta, .nav-badge, .range-tabs,
  .doc-toolbar, .toast-wrap, .modal-scrim, .q-nav { display: none !important; }
  .app-shell { display: block; }
  .app-main { max-width: none; padding: 0; }
  body { background: #fff; }
  /* print every answer explanation, expanded */
  .review-body { display: block !important; padding-left: 20px; }
  .review-item, .card, .stat, .rstat, .benchmark-box, .doc, .topic-row, .table-wrap {
    box-shadow: none !important; border-color: #ccc !important;
  }
  .review-item, .rstat, .topic-row, .wordcard { break-inside: avoid; }
  .hero, .retake-hero { background: #fff !important; color: #000 !important; box-shadow: none !important; border: 1px solid #ccc; }
  .hero p { color: #333; }
  a { color: inherit; }
}
