/* =========================================================================
   Roadschool — Kid UI styles
   Aesthetic: warm "road-trip adventure". Sunny paper, chunky rounded cards,
   big tactile buttons, a sense of a journey down an open road. Built for
   8-10 year-olds on a phone: big tap targets, low text density, large type.

   Token discipline borrowed from the repo design-system skill:
   - type scale, 4/8/12/16/24/32 spacing rhythm
   - semantic color tokens, WCAG 2.2 AA contrast, always-visible focus rings
   ========================================================================= */

/* ---- Fonts (distinctive, not system defaults) ----
   Fredoka = friendly rounded display; Nunito = warm, highly legible body. */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@600;700;800&display=swap');

:root {
  /* --- Color tokens (sunny road-trip palette; all text pairings >= AA) --- */
  --sky:        #fdf3e3;   /* warm paper background */
  --sky-2:      #ffe9c7;   /* lower-sky gradient stop */
  --road:       #3a3a52;   /* deep asphalt — primary text */
  --road-soft:  #5a5a78;   /* secondary text */
  --sun:        #ff9f1c;   /* primary accent (orange) */
  --sun-deep:   #e8590c;   /* pressed / strong accent — AA on white */
  --grass:      #2a9d56;   /* success green — AA on white */
  --grass-deep: #1d7a41;
  --sky-blue:   #2d7dd2;   /* links / info — AA on white */
  --berry:      #d6336c;   /* gentle "try again" (not harsh red) */
  --card:       #ffffff;
  --card-edge:  #f0d9b5;   /* warm card border */
  --focus:      #1b6fd6;   /* high-contrast focus ring */

  /* per-subject color chips */
  --c-math:    #ff9f1c;
  --c-ela:     #2d7dd2;
  --c-science: #2a9d56;
  --c-social:  #d6336c;

  /* --- Type scale: 12/14/16/20/24/32 + a couple kid-sized display steps --- */
  --t-xs: 0.75rem;  --t-sm: 0.875rem; --t-md: 1rem;
  --t-lg: 1.25rem;  --t-xl: 1.5rem;   --t-2xl: 2rem;
  --t-3xl: 2.75rem; --t-4xl: 3.5rem;

  /* --- Spacing rhythm: 4/8/12/16/24/32(/48/64) --- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-6: 24px; --s-8: 32px; --s-12: 48px; --s-16: 64px;

  --radius:    20px;
  --radius-lg: 28px;
  --shadow:    0 6px 0 rgba(58,58,82,0.12), 0 12px 28px rgba(58,58,82,0.14);
  --shadow-sm: 0 4px 0 rgba(58,58,82,0.10), 0 8px 16px rgba(58,58,82,0.10);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 700;
  color: var(--road);
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-2) 100%);
  background-attachment: fixed;
  /* subtle dotted road-map texture */
  background-image:
    radial-gradient(circle at 1px 1px, rgba(58,58,82,0.05) 1px, transparent 0),
    linear-gradient(180deg, var(--sky) 0%, var(--sky-2) 100%);
  background-size: 24px 24px, 100% 100%;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

/* The rolling "road" hill that anchors every screen */
body::after {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 88px;
  background:
    repeating-linear-gradient(90deg, #ffd166 0 28px, transparent 28px 56px) center 0/auto 6px no-repeat,
    var(--road);
  border-top: 6px solid #2a2a3d;
  border-radius: 50% 50% 0 0 / 80px 80px 0 0;
  z-index: 0;
  pointer-events: none;
}

/* =========================== Layout shell =========================== */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  padding: var(--s-6) var(--s-4) 120px;
  min-height: 100dvh;
}

.screen { animation: rise .4s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

[hidden] { display: none !important; }

/* =========================== Brand header =========================== */
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-8);
}
.brand .logo {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  font-size: 1.9rem;
  background: var(--sun);
  border: 4px solid #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transform: rotate(-6deg);
}
.brand h1 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: var(--t-xl);
  margin: 0;
  letter-spacing: -0.01em;
}
.brand .tag { display: block; font-size: var(--t-xs); color: var(--road-soft); font-weight: 700; }

/* =========================== Big headings =========================== */
.h-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: var(--t-3xl);
  line-height: 1.05;
  margin: 0 0 var(--s-2);
  letter-spacing: -0.02em;
}
.h-sub {
  font-size: var(--t-lg);
  color: var(--road-soft);
  margin: 0 0 var(--s-8);
}

/* =========================== Name cards =========================== */
.kid-grid { display: grid; gap: var(--s-4); }

.kid-card {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  width: 100%;
  text-align: left;
  padding: var(--s-4) var(--s-6);
  font-family: 'Fredoka', sans-serif;
  font-size: var(--t-2xl);
  color: var(--road);
  background: var(--card);
  border: 4px solid var(--card-edge);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.kid-card:hover { transform: translateY(-3px) rotate(-0.5deg); border-color: var(--sun); }
.kid-card:active { transform: translateY(2px); box-shadow: var(--shadow-sm); }

.kid-avatar {
  width: 64px; height: 64px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 2rem;
  border-radius: 50%;
  background: var(--sun);
  color: #fff;
  border: 4px solid #fff;
  box-shadow: var(--shadow-sm);
}
.kid-card:nth-child(2n) .kid-avatar { background: var(--sky-blue); }
.kid-card:nth-child(3n) .kid-avatar { background: var(--grass); }
.kid-name { line-height: 1; }
.kid-grade { display: block; font-family: 'Nunito'; font-size: var(--t-sm); color: var(--road-soft); font-weight: 700; margin-top: var(--s-1); }

/* =========================== PIN pad =========================== */
.pin-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-6); }
.pin-head .kid-avatar { width: 56px; height: 56px; font-size: 1.7rem; }
.pin-head .pin-who { font-family: 'Fredoka'; font-size: var(--t-xl); }

.pin-dots { display: flex; gap: var(--s-4); justify-content: center; margin: var(--s-6) 0; }
.pin-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 4px solid var(--road-soft);
  background: transparent;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.pin-dot.filled { background: var(--sun); border-color: var(--sun-deep); transform: scale(1.12); }

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
  max-width: 22rem;
  margin: 0 auto;
}
.key {
  font-family: 'Fredoka', sans-serif;
  font-size: var(--t-2xl);
  color: var(--road);
  background: var(--card);
  border: 4px solid var(--card-edge);
  border-radius: var(--radius);
  min-height: 72px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .1s ease, background .1s ease;
}
.key:hover { background: #fff7ea; }
.key:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(58,58,82,0.1); }
.key.key-back { font-size: var(--t-xl); }
.key.key-go { background: var(--grass); color: #fff; border-color: var(--grass-deep); }
.key.key-go:hover { background: var(--grass-deep); }

/* shake animation for a wrong PIN */
.shake { animation: shake .5s; }
@keyframes shake {
  10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(4px); }
  30%,50%,70% { transform: translateX(-8px); } 40%,60% { transform: translateX(8px); }
}

/* =========================== Test picker =========================== */
.test-grid { display: grid; gap: var(--s-4); }
.test-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--s-6);
  background: var(--card);
  border: 4px solid var(--card-edge);
  border-left-width: 12px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease;
}
.test-card:hover { transform: translateY(-3px); }
.test-card:active { transform: translateY(2px); box-shadow: var(--shadow-sm); }
.test-card .t-title { font-family: 'Fredoka'; font-size: var(--t-xl); margin: 0 0 var(--s-2); }
.test-card .t-meta { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.chip {
  display: inline-block;
  font-size: var(--t-sm);
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fff3df;
  color: var(--sun-deep);
}
.chip.q { background: #eaf4ff; color: var(--sky-blue); }

/* =========================== Question screen =========================== */
.progress-wrap { margin-bottom: var(--s-6); }
.progress-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-2); font-size: var(--t-sm); color: var(--road-soft); }
.progress-bar {
  position: relative;
  height: 16px;
  background: #fff;
  border: 3px solid var(--card-edge);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  position: absolute; inset: 0 100% 0 0;
  background: linear-gradient(90deg, var(--sun), var(--sun-deep));
  border-radius: 999px;
  transition: right .4s cubic-bezier(.2,.9,.3,1.2);
}
/* little car that rides the progress bar */
.progress-car {
  position: absolute; top: -10px;
  transform: translateX(-50%);
  font-size: 1.4rem;
  transition: left .4s cubic-bezier(.2,.9,.3,1.2);
}

.subject-tag {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-sm); font-weight: 800;
  padding: 4px 14px; border-radius: 999px;
  background: #fff; border: 3px solid var(--card-edge);
  margin-bottom: var(--s-4);
}
.subject-tag .dot { width: 12px; height: 12px; border-radius: 50%; }

.q-prompt {
  font-size: var(--t-2xl);
  font-family: 'Fredoka';
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 var(--s-8);
}

/* multiple choice */
.choices { display: grid; gap: var(--s-3); }
.choice {
  display: flex; align-items: center; gap: var(--s-4);
  width: 100%; text-align: left;
  padding: var(--s-4) var(--s-6);
  font-size: var(--t-xl);
  background: var(--card);
  border: 4px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .1s ease, border-color .1s ease, background .1s ease;
}
.choice:hover { border-color: var(--sun); }
.choice:active { transform: translateY(2px); }
.choice .bullet {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #fff3df; color: var(--sun-deep);
  font-family: 'Fredoka'; font-size: var(--t-lg);
}
.choice.selected { border-color: var(--sun); background: #fff7ea; }
.choice.correct { border-color: var(--grass); background: #e9f9ef; }
.choice.correct .bullet { background: var(--grass); color: #fff; }
.choice.wrong { border-color: var(--berry); background: #fdeef3; }
.choice.wrong .bullet { background: var(--berry); color: #fff; }
.choice[aria-disabled="true"] { cursor: default; }

/* numeric + short answer inputs */
.field { margin-bottom: var(--s-6); }
.field label { display: block; font-size: var(--t-md); color: var(--road-soft); margin-bottom: var(--s-2); }
.text-in, .num-in {
  width: 100%;
  font-family: 'Fredoka', sans-serif;
  font-size: var(--t-2xl);
  color: var(--road);
  padding: var(--s-4) var(--s-6);
  background: #fff;
  border: 4px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.text-in { font-size: var(--t-lg); }
textarea.text-in { resize: vertical; min-height: 96px; line-height: 1.4; }
.text-in:hover, .num-in:hover { border-color: var(--sun); }

/* feedback banner */
.feedback {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-6);
  border-radius: var(--radius);
  font-size: var(--t-lg);
  margin: var(--s-6) 0 0;
  animation: rise .35s ease both;
}
.feedback .emoji { font-size: 1.6rem; }
.feedback.good { background: #e9f9ef; color: var(--grass-deep); border: 3px solid var(--grass); }
.feedback.tryagain { background: #fdeef3; color: #a01a4a; border: 3px solid var(--berry); }
.feedback.neutral { background: #eaf4ff; color: #1b5a96; border: 3px solid var(--sky-blue); }

/* =========================== Buttons =========================== */
.btn {
  font-family: 'Fredoka', sans-serif;
  font-size: var(--t-xl);
  font-weight: 600;
  padding: var(--s-4) var(--s-8);
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease, background .1s ease;
}
.btn-primary { background: var(--sun); color: #fff; box-shadow: 0 5px 0 var(--sun-deep); }
.btn-primary:hover { background: #ffab3a; }
.btn-primary:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--sun-deep); }
.btn-go { background: var(--grass); color: #fff; box-shadow: 0 5px 0 var(--grass-deep); }
.btn-go:hover { background: #2bae5f; }
.btn-go:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--grass-deep); }
.btn-ghost {
  background: #fff; color: var(--road);
  border: 4px solid var(--card-edge);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: var(--sun); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.q-nav { display: flex; gap: var(--s-3); margin-top: var(--s-8); }
.q-nav .btn { flex: 1; }
.q-nav .btn-back { flex: 0 0 auto; }

/* =========================== Results screen =========================== */
.results { text-align: center; padding-top: var(--s-8); }
.results .trophy { font-size: 5rem; animation: pop .6s cubic-bezier(.2,.9,.3,1.4) both; }
@keyframes pop { 0% { transform: scale(0) rotate(-20deg); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.score-ring {
  width: 200px; height: 200px;
  margin: var(--s-6) auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--sun) var(--ring, 0%), #ffe9c7 0);
  border: 8px solid #fff;
  box-shadow: var(--shadow);
}
.score-inner {
  width: 150px; height: 150px;
  border-radius: 50%;
  background: #fff;
  display: grid; place-items: center; align-content: center;
}
.score-inner .big { font-family: 'Fredoka'; font-size: var(--t-4xl); line-height: 1; color: var(--sun-deep); }
.score-inner .of { font-size: var(--t-md); color: var(--road-soft); }
.results .praise { font-family: 'Fredoka'; font-size: var(--t-2xl); margin: var(--s-4) 0; }
.results .praise-sub { font-size: var(--t-lg); color: var(--road-soft); margin: 0 0 var(--s-8); }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px;
  width: 12px; height: 12px; border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .9; }
}

/* =========================== States =========================== */
.center-state { text-align: center; padding: var(--s-16) var(--s-4); }
.spinner {
  width: 56px; height: 56px; margin: 0 auto var(--s-4);
  border: 6px solid var(--card-edge);
  border-top-color: var(--sun);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center-state .msg { font-family: 'Fredoka'; font-size: var(--t-xl); }
.center-state .emoji { font-size: 3rem; display: block; margin-bottom: var(--s-3); }

/* =========================== Accessibility =========================== */
/* Always-visible, high-contrast focus ring on every interactive element */
:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
  border-radius: 8px;
}
.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;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* MathJax: keep inline math from blowing up line-height on small screens */
mjx-container { font-size: 100% !important; }

/* =========================================================================
   SHARED APP HEADER (kid app + parent dashboard)
   One bar, used everywhere: brand at left, context + actions at right.
   Built on the same tokens; small + sturdy so it works on a phone.
   ========================================================================= */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-8);
}
.app-header .brand { margin-bottom: 0; }
.app-header .brand .logo { width: 44px; height: 44px; font-size: 1.5rem; border-width: 3px; }
.app-header .brand h1 { font-size: var(--t-lg); }
.app-header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex: 0 0 auto;
}
.app-context {
  text-align: right;
  font-family: 'Fredoka', sans-serif;
  font-size: var(--t-sm);
  line-height: 1.15;
  color: var(--road-soft);
  max-width: 9rem;
}
.app-context strong { display: block; color: var(--road); font-size: var(--t-md); }

/* Compact pill button for header actions / quiet nav. */
.btn-sm {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: var(--t-sm);
  padding: var(--s-2) var(--s-4);
  border-radius: 999px;
  border: 3px solid var(--card-edge);
  background: #fff;
  color: var(--road);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .1s ease, border-color .1s ease, background .1s ease;
}
.btn-sm:hover { border-color: var(--sun); background: #fff7ea; }
.btn-sm:active { transform: translateY(2px); box-shadow: none; }

/* A low-emphasis text link (cross-area nav: "Grown-ups →", "← Kid sign-in") */
.quiet-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--t-sm);
  color: var(--road-soft);
  text-decoration: none;
  padding: var(--s-2) var(--s-3);
  border-radius: 999px;
}
.quiet-link:hover { color: var(--sky-blue); text-decoration: underline; }

/* Footer-ish row of cross-links, centered + airy. */
.nav-foot { text-align: center; margin-top: var(--s-12); }

/* =========================================================================
   PARENT DASHBOARD
   Same warm-paper world, but a touch more grown-up + data-dense: a "trip log"
   for the grown-ups. Wider shell, denser cards, a map-grid heatmap, and a
   hand-rolled SVG trend that reads like a road climbing a chart.
   ========================================================================= */
.app--parent { max-width: 44rem; }

/* ---- Passcode gate ---- */
.gate { max-width: 22rem; margin: var(--s-8) auto 0; text-align: center; }
.gate .lock {
  width: 72px; height: 72px; margin: 0 auto var(--s-4);
  display: grid; place-items: center;
  font-size: 2.2rem;
  background: var(--sun);
  color: #fff;
  border: 4px solid #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  transform: rotate(-6deg);
}
.gate .h-title { font-size: var(--t-2xl); }
.gate .h-sub { font-size: var(--t-md); margin-bottom: var(--s-6); }
.gate-form { display: grid; gap: var(--s-4); }
.passcode-in {
  width: 100%;
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-size: var(--t-2xl);
  letter-spacing: 0.4em;
  text-indent: 0.4em; /* compensate trailing letter-spacing for true centering */
  color: var(--road);
  padding: var(--s-4);
  background: #fff;
  border: 4px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.passcode-in:hover { border-color: var(--sun); }
.gate-error {
  font-size: var(--t-sm);
  color: #a01a4a;
  font-weight: 800;
  min-height: 1.2em;
  margin: 0;
}

/* ---- Overview: a card per kid ---- */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-3); margin-bottom: var(--s-6); flex-wrap: wrap;
}
.section-head .h-title { font-size: var(--t-2xl); margin: 0; }

.kid-cards { display: grid; gap: var(--s-4); }
@media (min-width: 34rem) { .kid-cards { grid-template-columns: 1fr 1fr; } }

.pcard {
  display: grid;
  gap: var(--s-3);
  text-align: left;
  width: 100%;
  padding: var(--s-6);
  background: var(--card);
  border: 4px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.pcard:hover { transform: translateY(-3px); border-color: var(--sun); }
.pcard:active { transform: translateY(2px); box-shadow: var(--shadow-sm); }
.pcard-top { display: flex; align-items: center; gap: var(--s-4); }
.pcard .kid-avatar { width: 52px; height: 52px; font-size: 1.6rem; }
.pcard:nth-child(2n) .kid-avatar { background: var(--sky-blue); }
.pcard:nth-child(3n) .kid-avatar { background: var(--grass); }
.pcard-name { font-family: 'Fredoka'; font-size: var(--t-xl); line-height: 1.1; }
.pcard-grade { display: block; font-family: 'Nunito'; font-size: var(--t-sm); color: var(--road-soft); font-weight: 700; }
.pcard-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.pcard-score { font-family: 'Fredoka'; font-size: var(--t-2xl); line-height: 1; }
.pcard-score small { font-size: var(--t-sm); color: var(--road-soft); font-weight: 700; }
.pcard-hint { font-size: var(--t-sm); color: var(--sky-blue); font-weight: 800; }

/* readiness "road sign" badge — words + color, never color alone */
.verdict {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: 'Fredoka', sans-serif; font-weight: 600;
  font-size: var(--t-sm);
  padding: 6px 14px;
  border-radius: 999px;
  border: 3px solid;
}
.verdict .vico { font-size: 1em; }
.verdict--not_ready  { background: #fdeef3; color: #a01a4a;       border-color: var(--berry); }
.verdict--approaching{ background: #fff3df; color: var(--sun-deep); border-color: var(--sun); }
.verdict--ready      { background: #e9f9ef; color: var(--grass-deep); border-color: var(--grass); }
.verdict--exceeds    { background: #eaf4ff; color: #1b5a96;        border-color: var(--sky-blue); }
.verdict--none       { background: #f1ece2; color: var(--road-soft); border-color: var(--card-edge); }

/* ---- Detail view ---- */
.detail-head {
  display: flex; align-items: center; gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.detail-head .kid-avatar { width: 56px; height: 56px; font-size: 1.7rem; }
.detail-head h2 { font-family: 'Fredoka'; font-size: var(--t-2xl); margin: 0; line-height: 1.05; }
.detail-head .grade { display: block; font-family: 'Nunito'; font-size: var(--t-sm); color: var(--road-soft); font-weight: 700; }

.panel {
  background: var(--card);
  border: 4px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--s-6);
  margin-bottom: var(--s-6);
}
.panel > h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: var(--t-lg);
  margin: 0 0 var(--s-2);
  display: flex; align-items: center; gap: var(--s-2);
}
.panel > .panel-sub { font-size: var(--t-sm); color: var(--road-soft); margin: 0 0 var(--s-4); }

/* ---- Skill-mastery heatmap (a "map grid") ---- */
.heat-subject { margin-bottom: var(--s-4); }
.heat-subject:last-child { margin-bottom: 0; }
.heat-subject-label {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: 'Fredoka'; font-size: var(--t-md);
  margin: 0 0 var(--s-2);
}
.heat-subject-label .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.heat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--s-2);
}
.heat-cell {
  text-align: left;
  padding: var(--s-3);
  border-radius: 14px;
  border: 3px solid rgba(58,58,82,0.12);
  min-height: 64px;
  display: flex; flex-direction: column; justify-content: space-between;
  cursor: default;
}
.heat-cell:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.heat-label {
  font-size: var(--t-xs); font-weight: 800; line-height: 1.15;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.heat-pct { font-family: 'Fredoka'; font-size: var(--t-lg); line-height: 1; }
.heat-frac { font-size: var(--t-xs); font-weight: 700; opacity: 0.85; }
/* color is decorative — every cell also shows the % + fraction as text */

/* ---- Trend chart (hand-rolled SVG) ---- */
.trend-wrap { width: 100%; overflow: visible; }
.trend-wrap svg { width: 100%; height: auto; display: block; }
.trend-empty {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-6); background: #fff7ea;
  border: 3px dashed var(--card-edge); border-radius: var(--radius);
  font-size: var(--t-sm); color: var(--road-soft);
}
.trend-empty .emoji { font-size: 1.6rem; }
.trend-legend { font-size: var(--t-xs); color: var(--road-soft); margin: var(--s-2) 0 0; }

/* ---- Weak skills drill-down ---- */
.weak-list { display: grid; gap: var(--s-3); }
.weak-item {
  border: 3px solid var(--card-edge);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.weak-item > summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  font-weight: 800;
}
.weak-item > summary::-webkit-details-marker { display: none; }
.weak-item > summary .caret { margin-left: auto; transition: transform .15s ease; color: var(--road-soft); }
.weak-item[open] > summary .caret { transform: rotate(90deg); }
.weak-item > summary:hover { background: #fff7ea; }
.weak-pct {
  flex: 0 0 auto;
  font-family: 'Fredoka'; font-size: var(--t-sm);
  padding: 3px 10px; border-radius: 999px;
  background: #fdeef3; color: #a01a4a;
}
.weak-sub-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.weak-body { padding: 0 var(--s-4) var(--s-4); }
.weak-body .res-head { font-size: var(--t-sm); color: var(--road-soft); margin: var(--s-2) 0; font-weight: 800; }
.res-list { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.res-link {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3); border-radius: 12px;
  border: 2px solid var(--card-edge); background: #fff;
  text-decoration: none; color: var(--road);
}
.res-link:hover { border-color: var(--sky-blue); background: #f5faff; }
.res-link .res-type {
  flex: 0 0 auto; font-size: var(--t-xs); font-weight: 800;
  padding: 2px 8px; border-radius: 999px;
  background: #eaf4ff; color: var(--sky-blue);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.res-link .res-title { font-weight: 800; line-height: 1.2; }
.res-link .res-src { display: block; font-size: var(--t-xs); color: var(--road-soft); font-weight: 700; }
.res-link .res-ext { margin-left: auto; color: var(--road-soft); flex: 0 0 auto; }
.weak-none {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4); background: #e9f9ef;
  border: 3px solid var(--grass); border-radius: var(--radius);
  color: var(--grass-deep); font-weight: 800;
}

/* ---- Report (markdown-ish render) ---- */
.report-body { font-size: var(--t-md); line-height: 1.5; }
.report-body h1, .report-body h2, .report-body h3 {
  font-family: 'Fredoka', sans-serif; line-height: 1.15; margin: var(--s-4) 0 var(--s-2);
}
.report-body h1 { font-size: var(--t-xl); }
.report-body h2 { font-size: var(--t-lg); }
.report-body h3 { font-size: var(--t-md); }
.report-body p { margin: 0 0 var(--s-3); }
.report-body ul, .report-body ol { margin: 0 0 var(--s-3); padding-left: var(--s-6); }
.report-body li { margin-bottom: var(--s-1); }
.report-body strong { color: var(--road); }
.report-body :first-child { margin-top: 0; }
.report-empty { font-size: var(--t-sm); color: var(--road-soft); }
.report-loading { font-size: var(--t-sm); color: var(--road-soft); }

/* ---- Report picker (chips for each completed check) ---- */
.report-picker {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.report-chip {
  display: flex; flex-direction: column; gap: 2px;
  min-height: 48px;
  padding: var(--s-2) var(--s-4);
  border: 3px solid var(--card-edge);
  border-radius: 14px;
  background: #fff; color: var(--road);
  text-align: left; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.report-chip:hover { border-color: var(--sun); background: #fff7ea; }
.report-chip:active { transform: translateY(1px); }
.report-chip:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.report-chip.is-active {
  border-color: var(--sun-deep);
  background: #fff3df;
}
.report-chip .rc-title { font-family: 'Fredoka', sans-serif; font-size: var(--t-md); line-height: 1.1; }
.report-chip .rc-meta { font-size: var(--t-xs); color: var(--road-soft); font-weight: 700; }
.report-chip.is-active .rc-meta { color: var(--sun-deep); }
/* the verdict badge sits above the summary text in the report body */
.report-body > .verdict { margin-bottom: var(--s-3); }

/* =========================================================================
   FIELD-TRIP POC ("you're in {place} → here's a lesson")
   Same warm road-trip world: enter a spot, generate a place-based lesson,
   answer 2 questions with a local self-check. Reuses .field/.text-in/.choice
   /.feedback/.subject-tag/.btn from above; these add the page-specific bits.
   ========================================================================= */

/* ---- the place-picker form ---- */
.ft-fields { display: grid; gap: var(--s-4); }
.ft-help { font-size: var(--t-sm); color: var(--road-soft); margin: var(--s-2) 0 0; font-weight: 700; }

/* one-tap quick-pick: a friendly dashed "road sign" */
.ft-quickpick {
  display: inline-flex; align-items: center; gap: var(--s-2);
  align-self: start;
  font-family: 'Fredoka', sans-serif; font-weight: 600;
  font-size: var(--t-md);
  color: var(--sun-deep);
  background: #fff3df;
  border: 3px dashed var(--sun);
  border-radius: 999px;
  padding: var(--s-2) var(--s-4);
  cursor: pointer;
  transition: transform .1s ease, background .1s ease;
}
.ft-quickpick:hover { background: #ffe9c7; }
.ft-quickpick:active { transform: translateY(2px); }

.ft-select {
  width: 100%;
  font-family: 'Fredoka', sans-serif;
  font-size: var(--t-lg);
  color: var(--road);
  padding: var(--s-3) var(--s-4);
  background: #fff;
  border: 4px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.ft-select:hover { border-color: var(--sun); }

.ft-hints { border: 3px solid var(--card-edge); border-radius: var(--radius); background: #fff; overflow: hidden; }
.ft-hints > summary {
  list-style: none; cursor: pointer; font-weight: 800;
  padding: var(--s-3) var(--s-4); color: var(--road-soft);
}
.ft-hints > summary::-webkit-details-marker { display: none; }
.ft-hints > summary::before { content: "⚙️ "; }
.ft-hints > summary:hover { background: #fff7ea; }
.ft-hints-body { padding: 0 var(--s-4) var(--s-4); display: grid; gap: var(--s-4); }
.ft-hints-body .field { margin-bottom: 0; }

.ft-subjects { border: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.ft-subjects legend { font-size: var(--t-md); color: var(--road-soft); font-weight: 800; padding: 0 0 var(--s-2); }
.ft-check {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-md); font-weight: 700;
  padding: var(--s-2) var(--s-3);
  border: 3px solid var(--card-edge); border-radius: 14px; background: #fff;
  cursor: pointer; min-height: 44px;
}
.ft-check input { width: 20px; height: 20px; accent-color: var(--sun); }
.ft-check:hover { border-color: var(--sun); }

.ft-make { width: 100%; }

/* ---- the rendered lesson ---- */
.ft-note {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-sm); font-weight: 800; color: var(--sun-deep);
  background: #fff3df; border: 3px dashed var(--sun);
  border-radius: var(--radius); padding: var(--s-3) var(--s-4);
  margin: 0 0 var(--s-4);
}
.ft-place { margin-bottom: var(--s-3); }
.ft-lesson-title { font-size: var(--t-2xl); margin-bottom: var(--s-3); }
.ft-objective { font-size: var(--t-lg); color: var(--road-soft); margin: 0 0 var(--s-8); line-height: 1.4; }

.ft-section-head {
  font-family: 'Fredoka', sans-serif; font-size: var(--t-xl);
  display: flex; align-items: center; gap: var(--s-2);
  margin: var(--s-8) 0 var(--s-3);
}
.ft-section-sub { font-size: var(--t-sm); color: var(--road-soft); margin: 0 0 var(--s-4); font-weight: 700; }

.ft-activities { display: grid; gap: var(--s-4); }
.ft-card {
  background: var(--card);
  border: 4px solid var(--card-edge);
  border-left-width: 12px;
  border-left-color: var(--sun);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--s-4) var(--s-6);
}
.ft-card-title { font-family: 'Fredoka', sans-serif; font-size: var(--t-lg); margin: 0 0 var(--s-2); }
.ft-card-detail { font-size: var(--t-md); line-height: 1.5; margin: 0; }

.ft-funfacts { display: grid; gap: var(--s-3); margin: 0; padding: 0; list-style: none; }
.ft-fact {
  position: relative;
  background: #eaf4ff; border: 3px solid var(--sky-blue);
  border-radius: 14px; padding: var(--s-3) var(--s-4) var(--s-3) var(--s-8);
  font-size: var(--t-md); line-height: 1.4; color: #1b5a96; font-weight: 700;
}
.ft-fact::before { content: "💡"; position: absolute; left: var(--s-3); top: var(--s-3); }

/* ---- fun questions (local self-check) ---- */
.ft-questions { display: grid; gap: var(--s-4); }
.ft-qcard { border-left-color: var(--grass); }
.ft-q-head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.ft-q-tag { margin: 0; }
.ft-q-skill { font-size: var(--t-xs); color: var(--road-soft); font-weight: 800; }
.ft-q-prompt { font-family: 'Fredoka', sans-serif; font-size: var(--t-lg); line-height: 1.3; margin: 0 0 var(--s-4); }
.ft-choices { display: grid; gap: var(--s-2); margin-bottom: var(--s-4); }
.ft-choice { font-size: var(--t-lg); padding: var(--s-3) var(--s-4); }
.ft-q-field { margin-bottom: var(--s-4); }
.ft-check-btn { font-size: var(--t-md); }
.ft-q-feedback { margin-top: var(--s-4); font-size: var(--t-md); }
