@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/fredoka-latin.woff2') format('woff2');
}

/* Every text/background pair below meets WCAG AA (4.5:1 text, 3:1 UI). */
:root {
  --bg: #fff8ec;
  --surface: #ffffff;
  --ink: #2b2140;
  --ink-soft: #574d66;
  --line: #e6d6bb;
  /* Outline for interactive controls: >= 3:1 against white and the page background. */
  --control: #857a99;
  --grape: #5b2fc4;
  --grape-dark: #3f1f8f;
  --grape-tint: #efe8ff;
  --sun: #ffc93c;
  --sun-dark: #b37c00;
  --sun-tint: #fff1c7;
  --teal: #0b7364;
  --teal-dark: #06554a;
  --teal-tint: #dcf5ef;
  --coral: #b8222f;
  --coral-dark: #8a1620;
  --coral-tint: #ffe3e3;
  --leaf: #1a6f35;
  --leaf-tint: #ddf6e3;
  --sky: #1f5bbf;
  --sky-tint: #e2edff;
  --focus: #1a1033;
  --radius: 22px;
  --font: 'Fredoka', ui-rounded, 'SF Pro Rounded', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image: radial-gradient(circle at 10% 0%, #ffe9c2 0, transparent 40%),
    radial-gradient(circle at 100% 20%, #efe3ff 0, transparent 35%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 700;
}
h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
}
h2 {
  font-size: clamp(1.4rem, 3.5vw, 1.8rem);
}
h1:focus {
  outline: none;
}
p {
  margin: 0 0 1em;
}
a {
  color: var(--grape);
  text-underline-offset: 3px;
}
:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
  border-radius: 8px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
}
.skip-link:focus {
  top: 12px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 3px solid var(--line);
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.45rem;
  margin-right: auto;
  min-height: 44px;
}
.brand svg {
  width: 38px;
  height: 38px;
  flex: none;
}
.brand span b {
  color: var(--grape);
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.site-nav a:hover {
  background: var(--grape-tint);
}
.site-nav a[aria-current='page'] {
  background: var(--grape);
  color: #fff;
}

/* ---------- Layout ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
main:focus {
  outline: none;
}
.site-footer {
  text-align: center;
  padding: 18px 16px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.site-footer a {
  color: var(--ink-soft);
}
.stack > * + * {
  margin-top: 16px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.center {
  text-align: center;
}
.muted {
  color: var(--ink-soft);
}
.narrow {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin-bottom: 8px;
  font-weight: 600;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.big-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.big-choice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 190px;
  padding: 24px;
  border-radius: var(--radius);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 8px 0 var(--shade);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  position: relative;
  overflow: hidden;
}
.big-choice:hover {
  transform: translateY(-3px);
  box-shadow: 0 11px 0 var(--shade);
}
.big-choice:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 var(--shade);
}
.big-choice .emoji {
  font-size: 3.2rem;
  line-height: 1;
}
.big-choice strong {
  font-size: 1.9rem;
  line-height: 1.1;
}
.big-choice span {
  font-size: 1.1rem;
}
.big-choice.math {
  background: var(--grape);
  --shade: var(--grape-dark);
}
.big-choice.spelling {
  background: var(--teal);
  --shade: var(--teal-dark);
}
.big-choice::after {
  content: '';
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  width: 100%;
  min-height: 112px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 3px solid var(--control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--control);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  text-decoration: none;
}
.mode-btn:hover {
  border-color: var(--grape);
  box-shadow: 0 5px 0 var(--grape);
}
.mode-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--grape);
}
.mode-btn .emoji {
  font-size: 2rem;
  line-height: 1.1;
}
.mode-btn strong {
  font-size: 1.25rem;
}
.mode-btn span {
  font-size: 0.98rem;
  color: var(--ink-soft);
}
.mode-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Buttons ---------- */
.btn {
  --bgc: var(--grape);
  --shade: var(--grape-dark);
  --fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  min-width: 52px;
  padding: 10px 22px;
  border: 0;
  border-radius: 16px;
  background: var(--bgc);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  font-size: 1.15rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--shade);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--shade);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-lg {
  min-height: 64px;
  font-size: 1.35rem;
  padding: 12px 30px;
}
.btn-sun {
  --bgc: var(--sun);
  --shade: var(--sun-dark);
  --fg: var(--ink);
}
.btn-teal {
  --bgc: var(--teal);
  --shade: var(--teal-dark);
}
.btn-danger {
  --bgc: var(--coral);
  --shade: var(--coral-dark);
}
.btn-ghost {
  --bgc: var(--surface);
  --shade: var(--control);
  --fg: var(--ink);
  border: 3px solid var(--control);
}
.btn-small {
  min-height: 44px;
  font-size: 1rem;
  padding: 6px 14px;
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--shade);
}
.btn-block {
  width: 100%;
}

/* ---------- Forms ---------- */
label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
.hint {
  display: block;
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.98rem;
  margin-bottom: 8px;
}
input[type='text'],
input[type='email'],
input[type='search'],
textarea,
select {
  width: 100%;
  font: inherit;
  font-size: 1.2rem;
  color: var(--ink);
  background: var(--surface);
  border: 3px solid var(--control);
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 52px;
}
textarea {
  min-height: 220px;
  line-height: 1.6;
  resize: vertical;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--grape);
  outline: 4px solid var(--focus);
  outline-offset: 2px;
}
input[aria-invalid='true'] {
  border-color: var(--coral);
}
.field + .field {
  margin-top: 18px;
}
.form-error {
  background: var(--coral-tint);
  color: var(--coral-dark);
  border: 3px solid var(--coral);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 600;
}
.form-error:empty {
  display: none;
}
.notice {
  background: var(--sun-tint);
  border: 3px solid var(--sun);
  border-radius: 14px;
  padding: 12px 16px;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
legend {
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 10px;
  padding: 0;
}

/* ---------- Times-table chips ---------- */
.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
}
.chip {
  min-height: 64px;
  border-radius: 16px;
  border: 3px solid var(--control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--control);
  touch-action: manipulation;
  transition: transform 0.08s ease;
}
.chip small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.chip[aria-pressed='true'] {
  background: var(--grape);
  border-color: var(--grape-dark);
  color: #fff;
  box-shadow: 0 4px 0 var(--grape-dark);
}
.chip[aria-pressed='true'] small {
  color: #fff;
}
.chip:active {
  transform: translateY(3px);
}
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}
.segmented .chip {
  font-size: 1.1rem;
  min-height: 52px;
  padding: 0 18px;
}

/* ---------- Play screen ---------- */
.play {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}
.play-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.progress-bar {
  flex: 1;
  height: 18px;
  border-radius: 999px;
  background: #e9dcc6;
  overflow: hidden;
}
.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--sun), #ff9f43);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.counter {
  font-weight: 600;
  min-width: 4.5em;
  text-align: right;
}
.timer {
  font-weight: 700;
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
  min-width: 3.5em;
}

.question {
  background: var(--surface);
  border: 4px solid var(--line);
  border-radius: 28px;
  padding: 28px 16px;
  margin-bottom: 18px;
  box-shadow: 0 8px 0 var(--line);
}
.question .big {
  font-size: clamp(3rem, 14vw, 5.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.question .sub {
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin-top: 8px;
}

.answer-input {
  font-size: clamp(2rem, 9vw, 3rem) !important;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.05em;
  max-width: 420px;
  margin: 0 auto;
  display: block;
  min-height: 76px !important;
  border-radius: 20px !important;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 360px;
  margin: 16px auto 0;
}
.keypad button {
  min-height: 64px;
  font: inherit;
  font-size: 1.8rem;
  font-weight: 700;
  border-radius: 16px;
  border: 3px solid var(--control);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--control);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.keypad button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--control);
}
.keypad .go {
  background: var(--leaf);
  border-color: #124f26;
  color: #fff;
  box-shadow: 0 4px 0 #124f26;
  font-size: 1.3rem;
}

.feedback {
  min-height: 3.2em;
  margin: 14px 0 6px;
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.feedback.good {
  color: var(--leaf);
}
.feedback.bad {
  color: var(--coral-dark);
}
.feedback .pill {
  padding: 6px 16px;
  border-radius: 999px;
}
.feedback.good .pill {
  background: var(--leaf-tint);
}
.feedback.bad .pill {
  background: var(--coral-tint);
}

/* Flash card */
.flashcard {
  perspective: 1200px;
  margin: 0 auto 18px;
  max-width: 520px;
}
.flashcard button.card-face {
  width: 100%;
  min-height: 260px;
  border-radius: 28px;
  border: 4px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 8px 0 var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  touch-action: manipulation;
}
.flashcard.flipped button.card-face {
  background: var(--sun-tint);
  border-color: var(--sun);
  box-shadow: 0 8px 0 var(--sun-dark);
  animation: flip 0.35s ease;
}
@keyframes flip {
  0% {
    transform: rotateY(90deg);
  }
  100% {
    transform: rotateY(0);
  }
}
.flashcard .big {
  font-size: clamp(3rem, 14vw, 5.5rem);
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.flashcard .tap-hint {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* Letter tiles (scramble) */
.tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 76px;
  padding: 8px;
}
.tiles.answer {
  border: 3px dashed var(--control);
  border-radius: 18px;
  background: var(--surface);
  margin-bottom: 14px;
}
.tile {
  min-width: 58px;
  min-height: 58px;
  font: inherit;
  font-size: 1.8rem;
  font-weight: 700;
  border-radius: 14px;
  border: 3px solid var(--sun-dark);
  background: var(--sun);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--sun-dark);
  cursor: pointer;
  touch-action: manipulation;
}
.tile.placed {
  background: var(--grape-tint);
  border-color: var(--grape);
  box-shadow: 0 4px 0 var(--grape);
}
.tile:active {
  transform: translateY(3px);
}

.word-check {
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.word-check .miss {
  color: var(--coral-dark);
  text-decoration: underline wavy;
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

/* Results */
.stars {
  font-size: 3.6rem;
  letter-spacing: 6px;
  line-height: 1.2;
}
.stars .off {
  filter: grayscale(1);
  opacity: 0.3;
}
.score {
  font-size: 1.6rem;
  font-weight: 700;
}
.tricky-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 8px 0 16px;
}
.tricky-list li {
  background: var(--coral-tint);
  border: 2px solid var(--coral);
  border-radius: 999px;
  padding: 4px 14px;
  font-weight: 600;
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}
.confetti i {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 18px;
  border-radius: 3px;
  animation: fall 1.8s ease-in forwards;
}
@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}

/* ---------- Lists & tables ---------- */
.list-cards {
  display: grid;
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.list-card {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.list-card .grow {
  flex: 1;
  min-width: 180px;
}
.list-card h3 {
  margin: 0;
  font-size: 1.35rem;
}
.word-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.word-pills li {
  background: var(--teal-tint);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 1rem;
}

.table-wrap {
  overflow-x: auto;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
table.data {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.98rem;
}
table.data th,
table.data td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data thead th {
  background: #faf2e3;
  position: sticky;
  top: 0;
  white-space: nowrap;
}
table.data tbody tr:last-child td {
  border-bottom: 0;
}
.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}
.status.active {
  background: var(--leaf-tint);
  color: var(--leaf);
}
.status.deactivated {
  background: var(--coral-tint);
  color: var(--coral-dark);
}
.ua {
  max-width: 260px;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
}

/* Mastery grid */
table.mastery {
  border-collapse: separate;
  border-spacing: 4px;
  margin: 0 auto;
  font-variant-numeric: tabular-nums;
}
table.mastery th {
  font-weight: 700;
  min-width: 36px;
  height: 36px;
}
table.mastery td {
  width: 44px;
  height: 44px;
  text-align: center;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
}
.lvl-new {
  background: #f1ebe0;
  color: var(--ink-soft);
}
.lvl-tricky {
  background: var(--coral-tint);
  color: var(--coral-dark);
  outline: 2px solid var(--coral);
}
.lvl-learning {
  background: var(--sun-tint);
  color: #6b4a00;
}
.lvl-mastered {
  background: var(--leaf);
  color: #fff;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  list-style: none;
  padding: 0;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend .sw {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Dialog */
dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 24px;
  max-width: min(460px, calc(100vw - 32px));
  color: var(--ink);
  font-family: var(--font);
  box-shadow: 0 20px 60px rgba(30, 10, 60, 0.35);
}
dialog::backdrop {
  background: rgba(30, 16, 51, 0.55);
}

.loading {
  padding: 40px;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- Kid profiles ---------- */
.profile-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.profile-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 170px;
  padding: 18px 12px;
  border-radius: var(--radius);
  border: 3px solid var(--control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--control);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.profile-btn:hover,
.profile-btn[aria-current='true'] {
  border-color: var(--grape);
  box-shadow: 0 6px 0 var(--grape);
}
.profile-btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--grape);
}
.profile-btn strong {
  font-size: 1.4rem;
  overflow-wrap: anywhere;
}
.profile-avatar {
  font-size: 3.5rem;
  line-height: 1.1;
}
.profile-btn .pill {
  background: var(--grape-tint);
  color: var(--grape-dark);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.9rem;
}
.avatar-picker {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 10px;
}
.avatar-picker legend {
  font-weight: 700;
  margin-bottom: 8px;
  padding: 0;
}
.avatar-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.avatar-option > span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  font-size: 2rem;
  border-radius: 16px;
  border: 3px solid var(--control);
  background: var(--surface);
  cursor: pointer;
}
.avatar-option input:checked + span {
  border-color: var(--grape-dark);
  background: var(--grape-tint);
  box-shadow: 0 0 0 3px var(--grape);
}
.avatar-option input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.kid-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.kid-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 2px solid var(--line);
}
.kid-avatar {
  font-size: 1.8rem;
}
.kid-name {
  flex: 1;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ---------- Look & Learn ---------- */
.fact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px 16px;
}
.fact-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 1.5rem;
  padding: 6px 12px;
  border-radius: 14px;
  background: var(--sky-tint);
  font-variant-numeric: tabular-nums;
}
.fact-list b {
  color: var(--grape-dark);
}
.fact-answer {
  display: inline-block;
  min-width: 2.2em;
  text-align: right;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
}
button.fact-answer {
  min-height: 44px;
  min-width: 56px;
  text-align: center;
  border-radius: 12px;
  border: 3px solid var(--control);
  background: var(--surface);
  cursor: pointer;
}
button.fact-answer.is-hidden {
  background: var(--sun-tint);
  color: var(--ink-soft);
}

@media (max-width: 560px) {
  body {
    font-size: 1.05rem;
  }
  .brand {
    font-size: 1.25rem;
  }
  .site-nav {
    width: 100%;
  }
  .site-nav ul {
    justify-content: space-between;
  }
  .site-nav a {
    padding: 6px 10px;
    font-size: 1rem;
  }
  .site-nav a .nav-icon {
    display: none;
  }
  .site-nav a {
    max-width: 8em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .card {
    padding: 16px;
  }
  table.mastery {
    border-spacing: 2px;
  }
  table.mastery td,
  table.mastery th {
    width: 25px;
    min-width: 25px;
    height: 30px;
    font-size: 0.75rem;
    border-radius: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .confetti {
    display: none;
  }
}

@media (forced-colors: active) {
  .btn,
  .chip,
  .mode-btn,
  .profile-btn,
  .avatar-option > span,
  button.fact-answer,
  .tile,
  .keypad button {
    border: 2px solid ButtonText;
  }
  .chip[aria-pressed='true'],
  .avatar-option input:checked + span {
    outline: 3px solid Highlight;
  }
}
