:root {
  color-scheme: dark;
  --forest: #102c25;
  --forest-dark: #0b211c;
  --forest-light: #254b39;
  --ink: #18392c;
  --cream: #fff7e5;
  --cream-deep: #f4e5c7;
  --gold: #f4c65a;
  --gold-soft: #f4dda1;
  --muted: #c4d3c3;
  --border: #718064;
  --display: Georgia, 'Times New Roman', serif;
  --body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 22px; }
body {
  margin: 0;
  color: var(--cream);
  background: radial-gradient(ellipse at 50% 8%, #234734 0, #102d24 42%, var(--forest-dark) 86%);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, a, summary { touch-action: manipulation; }
a { color: inherit; text-underline-offset: .23em; }
button { -webkit-appearance: none; appearance: none; }
img { max-width: 100%; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; }
h1, h2 { letter-spacing: -.035em; }
h2 { font-size: clamp(1.7rem, 3.1vw, 2.35rem); }
h3 { font-size: 1.3rem; }
p + p { margin-top: .75em; }
::selection { color: #132b20; background: var(--gold); }
:focus-visible { outline: 3px solid #ffe39b; outline-offset: 4px; }
.food-card :focus-visible, .guide :focus-visible, .restart-dialog :focus-visible {
  outline-color: #286947;
}
.shell { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--cream);
  color: var(--ink);
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; outline-color: var(--gold); }

/* Familiar Sweetland identity, with tools kept outside the play area. */
.masthead { border-bottom: 1px solid #d9bf7040; background: #0b211c70; }
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding-block: 10px;
}
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; text-decoration: none; }
.brand img { display: block; width: 35px; height: 43px; object-fit: contain; }
.brand b { display: block; color: var(--gold-soft); font: 700 1.4rem/1 var(--display); }
.brand small {
  display: block;
  margin-top: 6px;
  color: #d6ddcc;
  font-size: .59rem;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.header-actions, .header-actions nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.header-actions a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 9px; font-size: .82rem; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid #8d9877;
  border-radius: 10px;
  padding: 10px 17px;
  color: var(--cream);
  background: #15362b;
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, transform .15s;
}
.button:hover:not(:disabled) { border-color: #f3d48b; background: #2a4d3b; }
.button.primary, .primary.button {
  border-color: #ffdf94;
  color: #203624;
  background: var(--gold);
  box-shadow: 0 3px 0 #8b6b2c;
}
.button.primary:hover:not(:disabled) { background: #ffda84; transform: translateY(-1px); }
.button.primary:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 #8b6b2c; }
.button.secondary { border-color: #95a182; background: #17382c; }
.button.quiet { border-color: #6b7a60; background: transparent; padding-inline: 12px; font-weight: 600; }
.button[aria-pressed='true']:not(.primary) { color: var(--gold-soft); border-color: var(--gold); background: #35482e; }
.button:disabled { opacity: .58; box-shadow: none; }
.eyebrow { color: var(--gold-soft); font-size: .7rem; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }

/* Welcome and challenge selection. */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  min-height: 350px;
  margin-block: 25px 20px;
  padding: 34px 43px;
  overflow: hidden;
  border: 1px solid #ad9560;
  border-radius: 23px;
  background: #173d2b url('assets/hero.webp') 50% 58% / cover no-repeat;
  box-shadow: 0 15px 35px #06181066;
}
.hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: '';
  background: linear-gradient(90deg, #0c281ff5 0%, #133426ee 38%, #183b29a3 72%, #17362780);
}
.hero::after { content: ''; position: absolute; inset: 8px; pointer-events: none; border: 1px solid #f5df9c40; border-radius: 16px; }
.hero-copy { position: relative; z-index: 1; }
.hero h1 { margin-top: 12px; font-size: clamp(2.7rem, 5.5vw, 4.5rem); line-height: 1.02; }
.hero h1 em, .hero h1 span { color: var(--gold); font-style: normal; }
.lede { max-width: 40ch; margin-top: 17px; color: #f4efdc; font-size: 1.03rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-top: 18px; color: #eee8ca; font-size: .79rem; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta b { color: var(--gold); }
.hero-cards { position: relative; width: 100%; max-width: 355px; height: 292px; justify-self: end; }
.hero-character {
  position: absolute;
  top: 3px;
  left: 13px;
  width: 49%;
  padding: 7px;
  overflow: hidden;
  border: 1px solid #fff1bb;
  border-radius: 14px;
  color: var(--ink);
  background: #ffe9bb;
  box-shadow: 0 11px 23px #06190f80, 0 0 0 2px #947440;
  transform: rotate(-9deg);
}
.hero-character img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: contain; border-radius: 9px; }
.hero-character figcaption, .hero-character > span { display: block; padding-block: 4px 1px; font: 700 .9rem var(--display); text-align: center; }
.hero-example {
  position: absolute;
  z-index: 1;
  top: 47px;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 55%;
  min-height: 177px;
  padding: 14px 12px;
  border: 1px solid #ffeec5;
  border-radius: 14px;
  background: linear-gradient(140deg, #fff9e9, #f4e2b7);
  box-shadow: 0 10px 23px #06190f80, 0 0 0 2px #947440;
  color: var(--ink);
  text-align: center;
  transform: rotate(8deg);
}
.hero-example small { font-size: .6rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.hero-example strong { color: #28583b; font: 700 2.2rem/1 var(--display); }
.hero-example span { font-size: .75rem; }
.hero-example .food-art { width: 65px; height: 65px; }
.intro-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 23px 1px 15px; }
.intro-strip h2 { font-size: 1.7rem; }
.intro-strip p { color: var(--muted); font-size: .89rem; }
.intro-strip > span { display: inline-flex; align-items: center; gap: 9px; color: #e7e9cf; font-size: .86rem; }
.intro-strip b { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #a89c68; border-radius: 50%; color: var(--gold-soft); background: #263e2d; font: 700 .95rem var(--display); }
.level-heading { margin-block: 27px 14px; }
.level-heading h2 { margin-top: 6px; font-size: 1.85rem; }
.level-heading p:last-child { margin-top: 8px; color: var(--muted); font-size: .86rem; }
.level-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.level-card {
  position: relative;
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr);
  gap: 6px 12px;
  min-height: 140px;
  padding: 18px;
  border: 1px solid #81916e;
  border-radius: 15px;
  background: linear-gradient(145deg, #264533, #16352a);
  color: var(--cream);
  text-align: left;
  transition: background-color .15s, border-color .15s, transform .15s;
}
.level-card:hover { border-color: #e3c378; transform: translateY(-2px); }
.level-card.selected, .level-card[aria-pressed='true'] { background: linear-gradient(145deg, #425135, #293c2b); border-color: var(--gold); box-shadow: inset 0 -3px 0 #d4a944, 0 5px 15px #071a1240; }
.level-icon { display: grid; place-items: center; grid-row: 1 / 3; width: 41px; height: 45px; border: 1px solid #b7aa70; border-radius: 12px; color: var(--gold); background: #183025; font: 700 1.4rem var(--display); }
.level-name { align-self: end; font: 700 1.25rem var(--display); }
.level-description { color: #d8dfca; font-size: .81rem; line-height: 1.4; }
.level-progress { grid-column: 2; margin-top: 4px; color: var(--gold-soft); font-size: .74rem; font-weight: 650; }
.start-row { display: flex; flex-wrap: wrap; align-items: center; gap: 13px 19px; margin: 18px 0 27px; }
.start-row .primary { min-width: 215px; padding: 13px 25px; font-size: 1rem; }
.start-row p, .start-row > span { color: var(--muted); font-size: .83rem; }

/* A compact game board, with warm paper cards and a clear question area. */
#game { margin-block: 24px; padding: 25px; border: 1px solid #7e8a67; border-radius: 21px; background: linear-gradient(135deg, #234633, #123327 70%); box-shadow: 0 13px 30px #051b1040; }
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.game-title h2 { margin-top: 6px; font-size: 1.8rem; }
.game-title p { margin-top: 5px; color: var(--muted); font-size: .8rem; }
.game-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.game-actions .button { min-height: 42px; font-size: .8rem; }
.progress-track { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 21px 0 18px; padding: 0; list-style: none; }
.progress-step { position: relative; display: flex; justify-content: center; align-items: center; gap: 6px; min-width: 0; padding: 8px 5px; border: 1px solid #7d8a6c; border-radius: 9px; background: #102d23; color: #d3dbc9; font-size: .75rem; text-align: center; }
.progress-step strong, .progress-step > span:first-child { color: #f0d18c; font-weight: 750; }
.progress-step small { display: block; font-size: .68rem; }
.progress-step.done { color: #1b3d2a; border-color: #d9ce9a; background: #d8e4b8; }
.progress-step.done strong, .progress-step.done > span:first-child { color: #1b3d2a; }
.progress-step.current { color: #fff3ce; border-color: var(--gold); background: #405034; box-shadow: inset 0 -2px 0 var(--gold); }
.round-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 15px; margin-bottom: 11px; color: #d1dccc; font-size: .78rem; }
.round-meta strong { color: var(--gold-soft); }
.round-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .98fr); align-items: start; gap: 22px; }
.round-prompt { grid-column: 1 / -1; min-width: 0; }
.cards-area, .answer-area { min-width: 0; }
.cards-area > .food-card { max-width: 440px; margin-inline: auto; }
.food-card { position: relative; min-width: 0; padding: 14px; border: 1px solid #d6b772; border-radius: 15px; background: var(--cream); color: var(--ink); box-shadow: 0 5px 12px #061b163b; }
.food-top { display: grid; grid-template-columns: 105px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 90px; margin-bottom: 10px; }
.food-art { width: 100%; aspect-ratio: 1; background-color: var(--cream); background-image: url('assets/food-atlas.png'); background-size: 400% 300%; background-position: var(--food-x, 0%) var(--food-y, 0%); background-repeat: no-repeat; border-radius: 10px; }
.food-title { min-width: 0; }
.food-title h3 { font-size: 1.35rem; line-height: 1.1; }
.food-title .practice-tag + h3 { margin-top: 7px; }
.food-title p { margin-top: 5px; color: #4b5c44; font-size: .76rem; }
.practice-tag { display: inline-block; margin-top: 7px; padding: 3px 7px; border: 1px solid #c6b995; border-radius: 5px; color: #65572e; background: #f7ecd0; font-size: .65rem; line-height: 1.3; font-weight: 750; letter-spacing: .035em; }
.nutrition-table { width: 100%; border-collapse: collapse; font-size: .86rem; line-height: 1.35; font-variant-numeric: tabular-nums; }
.nutrition-table caption { padding-bottom: 6px; color: #5d6249; font-size: .72rem; font-weight: 650; text-align: left; }
.nutrition-table th { text-align: left; font-weight: 600; }
.nutrition-table td { text-align: right; }
.nutrition-table th, .nutrition-table td { padding: 9px 8px; border-bottom: 1px solid #d8cba9; }
.nutrition-table thead th { background: #eae6cd; color: #3f563e; font-size: .73rem; font-weight: 750; }
.nutrition-table thead th:last-child { text-align: right; }
.nutrition-table tbody tr:last-child th, .nutrition-table tbody tr:last-child td { border-bottom: 0; }
.nutrition-table tbody th { width: 60%; }
.nutrition-table .sugar-row th { padding-left: 18px; font-weight: 400; }
.label-choice { display: inline-flex; justify-content: center; align-items: center; min-width: 83px; min-height: 45px; padding: 7px 10px; border: 1px solid #8a9a74; border-radius: 8px; color: #244c32; background: #fdfbf0; font-weight: 750; font-variant-numeric: tabular-nums; }
.label-choice:hover:not(:disabled) { border-color: #45744d; background: #e8efcf; }
.label-choice.selected, .label-choice.correct { border: 2px solid #387044; color: #173a25; background: #d7e7b9; }
.label-choice.incorrect { border: 2px solid #9a762b; color: #60471a; background: #fff0be; }
.label-choice:disabled { opacity: 1; }
.nutrition-table tr.correct { background: #dfeacb; }
.nutrition-table tr.incorrect { background: #fff0ca; }
.portion-band { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; margin-top: 11px; padding: 10px 12px; border: 1px solid #bdcca0; border-radius: 9px; background: #e7eed6; color: #2b5033; font-size: .8rem; }
.portion-band strong { font-size: 1.12rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.portion-band span { min-width: 0; }
.portion-band small { grid-column: 1 / -1; color: #526249; font-size: .7rem; line-height: 1.4; }
.pack-table { table-layout: fixed; }
.pack-table tbody th, .pack-table thead th:first-child { width: 34%; }
.pack-table thead th:not(:first-child) { width: 22%; text-align: right; }
.pack-table th, .pack-table td { padding: 9px 4px; }
.pack-table thead th { font-size: .69rem; line-height: 1.35; vertical-align: bottom; }
.pack-table tbody th { font-size: .79rem; overflow-wrap: anywhere; }
.pack-table tbody td { font-size: .82rem; white-space: nowrap; }
.calculation-line { margin-top: 10px; padding: 9px 11px; border-radius: 8px; background: #f0e5c7; color: #4d512f; font-size: .8rem; font-variant-numeric: tabular-nums; }
.calculation-line strong { color: #204d30; }
.two-foods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.two-foods > .food-card { width: 100%; margin: 0; }
.two-foods .food-card { padding: 11px; }
.two-foods .food-top { grid-template-columns: 1fr; gap: 5px; margin-bottom: 10px; }
.two-foods .food-art { width: 105px; max-width: 100%; margin-inline: auto; }
.two-foods .food-title h3 { font-size: 1.12rem; }
.two-foods .food-title p { font-size: .72rem; }
.two-foods .practice-tag { font-size: .6rem; }
.two-foods .nutrition-table { font-size: .76rem; }
.two-foods .nutrition-table th, .two-foods .nutrition-table td { padding: 7px 3px; }
.two-foods .nutrition-table thead th { font-size: .65rem; }
.two-foods .nutrition-table .sugar-row th { padding-left: 8px; }
.two-foods .portion-band { align-items: start; flex-direction: column; gap: 1px; padding: 8px; font-size: .72rem; }
.two-foods .portion-band strong { font-size: 1rem; }
.two-foods .calculation-line { padding: 8px; font-size: .72rem; }
.sum-help { margin-top: 12px; padding: 10px 12px; border: 1px solid #8c9970; border-radius: 8px; background: #16392b; color: #e8efd7; font-size: .85rem; }
.answer-area > :first-child { margin-top: 0; }
.question-title { margin-top: 3px; font-size: clamp(1.45rem, 2.5vw, 1.95rem); line-height: 1.18; }
.question-copy { margin-top: 10px; color: #dbe4cf; font-size: .92rem; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 19px; }
.answer-choice { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 94px; padding: 13px 7px; border: 1px solid #c2ad70; border-radius: 12px; color: var(--ink); background: linear-gradient(145deg, #fff7e5, #f4e4bd); box-shadow: 0 3px 0 #7e734d; transition: background-color .15s, border-color .15s, transform .15s; }
.answer-choice strong { font-size: 1.7rem; line-height: 1.1; font-weight: 750; font-variant-numeric: tabular-nums; }
.answer-choice strong small { font-size: .61em; font-weight: 600; }
.answer-choice span { color: #53613e; font-size: .7rem; line-height: 1.25; }
.answer-choice .choice-letter { position: absolute; top: 7px; left: 9px; color: #766b4a; font-size: .65rem; font-weight: 700; }
.answer-choice:hover:not(:disabled) { border-color: #ffe9a7; background: #ffedba; transform: translateY(-2px); }
.answer-choice:focus-visible { outline-offset: 5px; }
.answer-choice.correct, .answer-choice[aria-pressed='true'] { border: 2px solid #add78b; color: #183b22; background: #dcebbf; box-shadow: 0 3px 0 #597741; }
.answer-choice.incorrect { border: 2px solid #f4ca6c; color: #5c431a; background: #ffecc1; box-shadow: 0 3px 0 #8c6a2c; }
.answer-choice:disabled { opacity: 1; }
.round-feedback { margin-top: 14px; border-radius: 10px; font-size: .88rem; }
.round-feedback:empty { display: none; }
.round-feedback.success, .round-feedback .success { padding: 12px 14px; border: 1px solid #a5c17d; border-radius: 10px; color: #f1f8dd; background: #2f5538; }
.round-feedback.try-again, .round-feedback .try-again { padding: 12px 14px; border: 1px solid #bda05e; border-radius: 10px; color: #fff0c6; background: #4c482a; }
.round-feedback strong { display: block; margin-bottom: 4px; }
.retry-note { margin-top: 7px; color: #ebdfb9; font-size: .78rem; }
.calculation-reminder { margin-top: 15px; padding: 10px 12px; border-left: 3px solid #d5b362; border-radius: 0 8px 8px 0; color: #e5e5c9; background: #102b224d; font-size: .81rem; line-height: 1.6; }
.calculation-reminder strong { color: var(--gold-soft); }
.practice-reminder { margin-top: 16px; color: #c7d2b9; font-size: .73rem; text-align: center; }
.helper-box { display: grid; grid-template-columns: 55px minmax(0, 1fr); align-items: center; gap: 11px; margin-top: 16px; padding: 11px 12px; border: 1px solid #7b8f69; border-radius: 12px; background: #102f2466; }
.helper-avatar { width: 55px; height: 61px; overflow: hidden; border: 1px solid #d8c28a; border-radius: 10px; background: #ffedcf; }
.helper-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 26%; }
.helper-text { font-size: .8rem; line-height: 1.45; color: #e0e6d4; }
.helper-text strong { color: var(--gold-soft); }
.round-friend { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 13px; margin-top: 17px; padding: 10px 13px 10px 10px; border: 1px solid #7b8f69; border-radius: 13px; background: #102d225c; }
.round-friend > img { display: block; width: 76px; height: 109px; border: 2px solid #e5d2a0; border-radius: 9px; object-fit: contain; background: #fff1d5; }
.round-friend strong { display: block; color: var(--gold-soft); font-family: var(--display); font-size: 1.05rem; }
.round-friend p { margin-top: 5px; color: #dde6d1; font-size: .81rem; line-height: 1.5; }
.round-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 15px; }
.hint-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 11px; border: 1px solid #8a9b76; border-radius: 8px; background: #193b2d; color: #f0e3b5; font-size: .8rem; font-weight: 650; }
.hint-button:hover { background: #31513b; border-color: #d7bb72; }
#next-button { margin-left: auto; min-width: 142px; }
.working-box { margin-top: 13px; border: 1px solid #8b9b72; border-radius: 10px; color: #e9edd5; background: #14382a; font-size: .82rem; }
.working-box summary { padding: 11px 13px; cursor: pointer; font-weight: 650; }
.working-box[open] summary, .working-box details[open] summary { border-bottom: 1px solid #6e845a; }
.working-box > p, .working-box > div, .working-box details > p { margin: 0; padding: 12px 14px; }
.working-box ol { padding: 0 17px 10px 34px; }
.working-box li + li { margin-top: 6px; }
.working-box li > span { display: block; margin-top: 3px; }
.equation { color: var(--gold-soft); font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.7; overflow-wrap: anywhere; }

/* A full finish that rewards the completed practice, including hints and retries. */
#finish { margin-block: 25px; }
.finish-card { position: relative; isolation: isolate; padding: 33px 25px; overflow: hidden; border: 1px solid #b69d60; border-radius: 22px; background: #183d2a url('assets/hero.webp') center 55% / cover no-repeat; box-shadow: 0 12px 30px #06181066; text-align: center; }
.finish-card::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(#0c2c20e6, #143b29ef); }
.finish-card h2 { margin-top: 9px; color: var(--gold-soft); font-size: clamp(2rem, 4vw, 3rem); }
.finish-card > p { max-width: 54ch; margin: 13px auto 0; color: #e6edda; }
.finish-art { display: flex; justify-content: center; align-items: end; gap: 9px; max-width: 490px; margin: 22px auto; }
.finish-art img { width: 18%; height: auto; aspect-ratio: 2 / 2.8; object-fit: cover; border: 3px solid #fff0c9; border-radius: 12px; background: #fff1d5; box-shadow: 0 5px 11px #07190c70; }
.finish-art img:nth-child(1) { transform: rotate(-7deg); }
.finish-art img:nth-child(2) { transform: translateY(-9px) rotate(-3deg); }
.finish-art img:nth-child(3) { transform: translateY(-18px); }
.finish-art img:nth-child(4) { transform: translateY(-9px) rotate(3deg); }
.finish-art img:nth-child(5) { transform: rotate(7deg); }
.completion-stat { display: inline-flex; align-items: center; gap: 12px; margin-top: 9px; padding: 10px 20px; border: 1px solid #cebc83; border-radius: 12px; color: var(--gold-soft); background: #123727; font-weight: 700; }
.completion-stat strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.badge-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.badge-row > * { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid #b3bb84; border-radius: 30px; color: #e7edc9; background: #284a33; font-size: .78rem; }
.finish-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.finish-card .earned-badge { display: inline-flex; padding: 10px 18px; border: 1px solid #d5bb75; border-radius: 30px; color: var(--gold-soft); background: #244632; font-weight: 750; font-size: .94rem; }
.finish-card .finish-note { margin-top: 17px; font-size: .79rem; }

/* Parent and educator information stays readable and separate from the task cards. */
.guide { margin-block: 28px 20px; padding: 28px; border: 1px solid #d7b66e; border-radius: 20px; color: #253d2c; background: radial-gradient(ellipse at top left, #fff9ed, #f5e8ce); }
.guide .eyebrow { color: #6d582a; }
.guide-heading { display: block; }
.guide-heading h2 { margin-top: 6px; }
.guide-heading > p:last-child { max-width: 77ch; margin-top: 12px; font-size: .93rem; }
.guide > p { margin-top: 13px; max-width: 86ch; font-size: .93rem; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 23px; }
.guide-card { min-width: 0; padding: 0 0 0 13px; border-left: 2px solid #d0b16d; }
.guide-card h3 { margin-bottom: 8px; font-size: 1.15rem; }
.guide-card p, .guide-card li { font-size: .84rem; }
.guide ul, .guide ol { padding-left: 23px; }
.guide li + li { margin-top: 7px; }
.guide a { color: #225336; font-weight: 650; }
.guide .formula { margin-block: 18px; padding: 14px 17px; border: 1px solid #b9bd8e; border-radius: 10px; background: #e9edd6; color: #254f30; font-size: .95rem; font-weight: 700; line-height: 1.65; text-align: center; }
.guide details { margin-top: 14px; border: 1px solid #c6b68e; border-radius: 10px; background: #fffcf33d; }
.guide summary { min-height: 48px; padding: 12px 15px; color: #2b4c32; cursor: pointer; font-size: .9rem; font-weight: 750; }
.guide details > div { padding: 3px 17px 17px; font-size: .87rem; }
.guide details > p { margin: 0; padding: 3px 17px 17px; font-size: .87rem; }
.guide details > ul, .guide details > ol { margin: 2px 17px 17px; font-size: .87rem; }
.guide table { width: 100%; margin-block: 13px; border-collapse: collapse; font-size: .84rem; text-align: left; }
.guide th, .guide td { padding: 9px 10px; border-bottom: 1px solid #cebf9c; vertical-align: top; }
.guide th { color: #355237; background: #ece7d2; }
.review-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid #bbaa7d; color: #625b3f; font-size: .79rem; line-height: 1.55; }
.review-note strong { color: #3e573b; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-block: 10px 28px; color: #bfcfb9; font-size: .75rem; }
.footer-inner a { min-height: 40px; display: inline-flex; align-items: center; }
.footer-inner strong { color: var(--gold-soft); font-weight: 650; }
.restart-dialog { width: min(430px, calc(100% - 32px)); padding: 25px; border: 1px solid #b4995f; border-radius: 17px; color: var(--ink); background: var(--cream); box-shadow: 0 20px 70px #0008; }
.restart-dialog::backdrop { background: #05170ec7; backdrop-filter: blur(3px); }
.restart-dialog h2 { font-size: 1.8rem; }
.restart-dialog p { margin-top: 12px; font-size: .94rem; }
.restart-dialog .dialog-actions, .restart-dialog form { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.restart-dialog .button.secondary { background: #e4e9d0; color: #264632; border-color: #8f9d77; }

@media (max-width: 900px) {
  .shell { width: calc(100% - 34px); }
  .header-actions .button { padding-inline: 9px; font-size: .77rem; }
  .hero { min-height: 330px; padding: 30px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .hero h1 { font-size: clamp(2.6rem, 6vw, 3.8rem); }
  .hero-cards { height: 275px; }
  .hero-character { width: 51%; left: 3px; }
  .hero-example { top: 41px; width: 57%; min-height: 155px; padding-inline: 9px; }
  .hero-example strong { font-size: 2.1rem; }
  .level-card { padding: 15px 12px; grid-template-columns: 33px minmax(0, 1fr); gap: 7px; }
  .level-icon { width: 32px; height: 37px; border-radius: 9px; font-size: 1.1rem; }
  .level-name { font-size: 1.16rem; }
  #game { padding: 20px; }
  .round-layout { gap: 17px; }
  .food-top { grid-template-columns: 85px minmax(0, 1fr); gap: 9px; }
  .food-title h3 { font-size: 1.22rem; }
  .two-foods { gap: 8px; }
  .two-foods .food-card { padding: 8px; }
  .two-foods .food-art { width: 80px; }
  .two-foods .food-title h3 { font-size: 1.04rem; }
  .two-foods .nutrition-table { font-size: .7rem; }
  .two-foods .nutrition-table th { width: 67%; }
  .guide { padding: 23px; }
  .guide-grid { gap: 13px; }
}

@media (max-width: 700px) {
  .header-inner { flex-wrap: wrap; gap: 4px 10px; padding-block: 10px 7px; }
  .brand b { font-size: 1.3rem; }
  .header-actions { flex: 1 1 auto; gap: 4px; }
  .header-actions a { font-size: .76rem; padding-inline: 6px; }
  .hero { padding: 24px; gap: 13px; min-height: 300px; }
  .hero h1 { font-size: clamp(2.35rem, 6.8vw, 3.2rem); }
  .lede { font-size: .94rem; }
  .hero-meta { font-size: .74rem; gap: 5px 10px; }
  .hero-cards { height: 252px; }
  .hero-character { top: 16px; width: 59%; padding: 5px; }
  .hero-example { top: 58px; width: 64%; min-height: 130px; padding: 12px 7px; gap: 6px; }
  .hero-example small { font-size: .58rem; }
  .hero-example strong { font-size: 1.8rem; }
  .hero-example span { font-size: .69rem; }
  .hero-example .food-art { width: 55px; height: 55px; }
  .intro-strip { align-items: flex-start; flex-direction: column; gap: 6px; }
  .level-grid { gap: 9px; }
  .level-card { display: flex; flex-direction: column; min-height: 163px; gap: 7px; padding: 13px 12px; }
  .level-name { align-self: auto; }
  .level-icon { width: 31px; height: 32px; }
  .level-description { font-size: .76rem; }
  .level-progress { margin-top: auto; font-size: .69rem; }
  .round-layout { grid-template-columns: 1fr; gap: 21px; }
  .cards-area > .food-card { max-width: none; }
  .food-top { grid-template-columns: 85px minmax(0, 1fr); min-height: 70px; }
  .food-card { padding: 12px 15px; }
  .nutrition-table th, .nutrition-table td { padding-block: 7px; }
  .food-title h3 { font-size: 1.35rem; }
  .two-foods { gap: 12px; }
  .two-foods .food-card { padding: 12px; }
  .two-foods .food-top { grid-template-columns: 75px minmax(0, 1fr); gap: 7px; }
  .two-foods .food-art { width: 75px; }
  .two-foods .food-title h3 { font-size: 1rem; }
  .two-foods .nutrition-table { font-size: .79rem; }
  .two-foods .nutrition-table thead th { font-size: .7rem; }
  .two-foods .portion-band { flex-direction: row; align-items: center; }
  .two-foods .calculation-line { font-size: .79rem; }
  .question-title { font-size: 1.7rem; }
  .question-copy { margin-top: 7px; }
  .choice-grid { margin-top: 15px; }
  .answer-choice { min-height: 80px; }
  .helper-box { margin-top: 14px; }
  .guide-grid { grid-template-columns: 1fr; gap: 18px; }
  .guide-card h3 { margin-bottom: 6px; }
  .guide-card p, .guide-card li { font-size: .9rem; }
  .footer-inner { justify-content: center; text-align: center; }
}

@media (max-width: 480px) {
  .shell { width: calc(100% - 24px); }
  .header-inner { justify-content: center; padding-block: 10px 6px; }
  .brand { margin-right: auto; gap: 8px; }
  .brand img { width: 29px; height: 34px; }
  .brand b { font-size: 1.17rem; }
  .brand small { margin-top: 4px; font-size: .51rem; letter-spacing: .12em; }
  .header-actions { width: 100%; justify-content: space-between; margin-top: 5px; gap: 4px; }
  .header-actions nav { justify-content: flex-start; gap: 4px; }
  .header-actions .button { min-height: 40px; padding: 7px 9px; font-size: .72rem; }
  .header-actions a { min-height: 40px; font-size: .73rem; }
  .hero { grid-template-columns: minmax(0, 1fr) 90px; min-height: 0; margin-block: 14px 17px; padding: 23px 17px; gap: 24px; border-radius: 17px; }
  .hero::before { background: linear-gradient(90deg, #0c281ff5, #133426ee 65%, #173627b3); }
  .hero::after { inset: 5px; border-radius: 12px; }
  .hero .eyebrow { font-size: .59rem; letter-spacing: .1em; }
  .hero h1 { font-size: clamp(2.05rem, 8vw, 2.7rem); margin-top: 10px; }
  .lede { font-size: .88rem; margin-top: 13px; }
  .hero-meta { margin-top: 13px; font-size: .7rem; }
  /* Reserve the full height of the two overlapping cards, including the example label. */
  .hero-cards { height: 275px; }
  .hero-character { top: 0; left: -13px; width: 95px; padding: 4px; border-radius: 9px; transform: rotate(-9deg); }
  .hero-character img { border-radius: 5px; }
  .hero-character figcaption, .hero-character > span { font-size: .65rem; }
  .hero-example { top: 100px; right: -2px; width: 100px; min-height: 91px; padding: 8px 5px; gap: 4px; border-radius: 9px; transform: rotate(7deg); }
  .hero-example small { font-size: .51rem; letter-spacing: .02em; }
  .hero-example strong { font-size: 1.45rem; }
  .hero-example span { font-size: .6rem; }
  .hero-example .food-art { display: none; }
  .intro-strip { margin-top: 19px; }
  .intro-strip h2 { font-size: 1.5rem; }
  .intro-strip p { font-size: .82rem; }
  .level-grid { grid-template-columns: 1fr; gap: 9px; }
  .level-card { display: grid; grid-template-columns: 36px minmax(0, 1fr); min-height: 0; padding: 13px; gap: 3px 11px; border-radius: 12px; }
  .level-icon { grid-row: 1 / 4; align-self: center; width: 35px; height: 40px; }
  .level-name { font-size: 1.18rem; }
  .level-description { font-size: .79rem; }
  .level-progress { grid-column: 2; margin-top: 2px; font-size: .72rem; }
  .start-row { gap: 12px; margin-top: 15px; }
  .start-row .primary { width: 100%; }
  .start-row p, .start-row > span { width: 100%; font-size: .79rem; text-align: center; }
  #game { padding: 15px 12px; margin-block: 14px; border-radius: 16px; }
  .game-top { gap: 11px; align-items: start; }
  .game-title .eyebrow { font-size: .61rem; letter-spacing: .11em; }
  .game-title h2 { margin-top: 5px; font-size: 1.45rem; }
  .game-title p { font-size: .73rem; }
  .game-actions { gap: 5px; flex-direction: column; align-items: stretch; }
  .game-actions .button { min-height: 39px; padding: 7px 9px; font-size: .71rem; }
  .progress-track { gap: 5px; margin-block: 17px 15px; }
  .progress-step { padding: 7px 2px; font-size: .66rem; border-radius: 7px; }
  .progress-step { flex-direction: column; gap: 2px; }
  .progress-step small { font-size: .59rem; }
  .round-meta { font-size: .72rem; margin-bottom: 10px; }
  .round-layout { gap: 18px; }
  .food-card { padding: 11px; border-radius: 12px; }
  .food-top { grid-template-columns: 75px minmax(0, 1fr); gap: 10px; min-height: 65px; margin-bottom: 7px; }
  .food-title h3 { font-size: 1.22rem; }
  .food-title p { font-size: .72rem; }
  .practice-tag { margin-top: 5px; font-size: .62rem; }
  .nutrition-table { font-size: .82rem; }
  .nutrition-table thead th { font-size: .7rem; }
  .nutrition-table th, .nutrition-table td { padding-inline: 6px; }
  .nutrition-table .sugar-row th { padding-left: 13px; }
  .label-choice { min-width: 77px; min-height: 45px; }
  .portion-band { padding: 9px 10px; font-size: .76rem; }
  .portion-band strong { font-size: 1.05rem; }
  .question-title { font-size: 1.5rem; }
  .question-copy { font-size: .86rem; }
  .choice-grid { gap: 9px; }
  .answer-choice { min-height: 78px; padding: 11px 5px; border-radius: 10px; }
  .answer-choice strong { font-size: 1.55rem; }
  .answer-choice span { font-size: .65rem; }
  .round-feedback { font-size: .82rem; }
  .helper-box { grid-template-columns: 44px minmax(0, 1fr); gap: 9px; padding: 9px; }
  .helper-avatar { width: 44px; height: 53px; border-radius: 8px; }
  .helper-text { font-size: .77rem; }
  .round-friend { grid-template-columns: 62px minmax(0, 1fr); gap: 11px; padding: 9px; margin-top: 14px; }
  .round-friend > img { width: 62px; height: 91px; }
  .round-friend strong { font-size: 1rem; }
  .round-friend p { font-size: .78rem; }
  .round-bottom { gap: 8px; margin-top: 12px; }
  .round-bottom .button, .hint-button { min-height: 45px; font-size: .79rem; }
  #next-button { min-width: 125px; }
  .two-foods { grid-template-columns: 1fr; gap: 12px; }
  .two-foods .food-card { padding: 11px; }
  .two-foods .food-top { display: grid; grid-template-columns: 75px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 0; }
  .two-foods .food-art { width: 75px; }
  .two-foods .food-title h3 { font-size: 1.22rem; }
  .two-foods .food-title p { font-size: .72rem; }
  .two-foods .practice-tag { padding: 3px 7px; font-size: .62rem; }
  .two-foods .nutrition-table { font-size: .82rem; }
  .two-foods .nutrition-table thead th { font-size: .7rem; }
  .two-foods .nutrition-table th, .two-foods .nutrition-table td { padding: 7px 6px; }
  .two-foods .nutrition-table .sugar-row th { padding-left: 13px; }
  .two-foods .portion-band { gap: 2px 12px; padding: 9px 10px; font-size: .76rem; }
  .two-foods .portion-band strong { font-size: 1.05rem; }
  .two-foods .calculation-line { padding: 9px 11px; font-size: .8rem; }
  .nutrition-table.pack-table th, .nutrition-table.pack-table td { padding: 8px 3px; }
  .nutrition-table.pack-table tbody th { width: 34%; font-size: .77rem; }
  .nutrition-table.pack-table tbody td { font-size: .8rem; }
  .nutrition-table.pack-table thead th { font-size: .66rem; }
  .sum-help { font-size: .78rem; padding: 9px 10px; }
  .working-box { font-size: .79rem; }
  #finish { margin-block: 16px; }
  .finish-card { padding: 26px 16px; border-radius: 17px; }
  .finish-card h2 { font-size: 2rem; }
  .finish-card > p { font-size: .87rem; }
  .finish-art { gap: 5px; margin-block: 25px 16px; }
  .finish-art img { border-width: 2px; border-radius: 8px; }
  .finish-actions { gap: 9px; }
  .finish-actions .button { flex: 1 1 130px; }
  .completion-stat { padding: 8px 15px; font-size: .85rem; }
  .guide { margin-top: 20px; padding: 19px 16px; border-radius: 16px; }
  .guide-heading h2 { font-size: 1.62rem; }
  .guide > p { font-size: .87rem; }
  .guide .formula { padding: 12px; font-size: .85rem; }
  .guide-grid { margin-top: 17px; }
  .guide-card p, .guide-card li { font-size: .84rem; }
  .guide summary { padding: 12px; font-size: .84rem; }
  .guide details > div { padding-inline: 12px; font-size: .82rem; }
  .guide details > p { padding-inline: 12px; font-size: .82rem; }
  .guide table { font-size: .76rem; }
  .guide th, .guide td { padding: 8px 5px; }
  .review-note { font-size: .74rem; }
  .footer-inner { gap: 3px; padding-block: 9px 22px; font-size: .7rem; }
}

@media (max-width: 360px) {
  .hero { grid-template-columns: minmax(0, 1fr) 73px; padding-inline: 14px; }
  .hero h1 { font-size: 1.97rem; }
  .hero-character { left: -11px; width: 82px; }
  .hero-example { top: 88px; right: -1px; width: 85px; }
  .hero-example strong { font-size: 1.3rem; }
  .hero-cards { height: 265px; }
  .hero .lede { font-size: .83rem; }
  .two-foods { grid-template-columns: 1fr; }
  .two-foods .food-card { padding: 11px; }
  .two-foods .food-top { display: grid; grid-template-columns: 65px minmax(0, 1fr); gap: 8px; }
  .two-foods .food-art { width: 65px; }
  .two-foods .food-title h3 { font-size: 1.15rem; }
  .two-foods .practice-tag { font-size: .61rem; }
  .two-foods .nutrition-table { font-size: .8rem; }
  .two-foods .nutrition-table thead th { font-size: .7rem; }
  .two-foods .portion-band { flex-direction: row; align-items: center; font-size: .74rem; }
  .two-foods .calculation-line { font-size: .77rem; }
  .progress-step { font-size: .61rem; }
  .progress-step small { font-size: .55rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media print {
  body { color: #18392c; background: white; }
  .masthead, #welcome, #game, #finish, footer, dialog, .skip-link { display: none !important; }
  .shell { width: 100%; }
  .guide { margin: 0; padding: 0; border: 0; background: white; }
  .guide details > * { display: block !important; }
}
