/* Sparkle UI layer. Tokens live in base.css; colours arrive from the theme. */

/* ===== boot =============================================================== */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: var(--s4); color: var(--text-muted); }
.boot__spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 5px solid var(--tone-2); border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== shell: bottom tabs on phones, a left rail from 900px ================ */
.shell { min-height: 100dvh; }

.main {
  padding: 0 var(--gutter) calc(var(--nav-h) + var(--s6) + env(safe-area-inset-bottom));
  min-width: 0;
}
.page { max-width: var(--content-max); margin: 0 auto; }
.main--focus { padding-bottom: var(--s7); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; gap: var(--s1);
  padding: var(--s2) var(--s2) calc(var(--s2) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -6px 24px color-mix(in srgb, var(--text) 10%, transparent); /* floats over content */
}
.nav__brand { display: none; }
.nav__item {
  flex: 1; min-width: 0; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--text-muted);
  font-family: var(--font-display); font-weight: 500; font-size: var(--fs-xs); white-space: nowrap; padding: 0;
  cursor: pointer; position: relative;
  transition: background 0.18s, color 0.18s, transform 0.18s var(--ease-spring);
}
.nav__item:active { transform: scale(0.94); }
.nav__item.is-active { background: var(--primary-soft); color: var(--text); font-weight: 600; }
.nav__item.is-active .icon { color: var(--text); }
.nav__badge {
  position: absolute; top: 4px; left: 50%; margin-left: 8px;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--secondary); color: var(--on-secondary);
  font-size: 0.75rem; font-weight: 800; line-height: 20px; text-align: center;
}

@media (min-width: 900px) {
  .shell:not(.shell--focus) { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .main { padding-bottom: var(--s8); }
  .nav {
    position: sticky; top: 0; left: auto; right: auto; bottom: auto;
    height: 100dvh; flex-direction: column; justify-content: flex-start; gap: var(--s2);
    padding: var(--s5) var(--s4);
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    box-shadow: none;
  }
  .nav__brand {
    display: flex; align-items: center; gap: var(--s3);
    margin: 0 var(--s2) var(--s5);
    font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg);
  }
  .nav__brand img { width: 48px; height: 48px; object-fit: contain; }
  .nav__item {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start;
    gap: var(--s3); min-height: var(--tap); padding: 0 var(--s4);
    font-size: var(--fs-md);
  }
  .nav__badge { position: static; margin: 0 0 0 auto; }
}

/* ===== top bar ============================================================= */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4) 0 var(--s3);
  background: var(--bg);
  max-width: var(--content-max); margin: 0 auto;
}
.topbar__title {
  flex: 1; min-width: 0; margin: 0;
  font-size: var(--fs-lg); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__stats { display: flex; gap: var(--s2); align-items: center; }

.stat {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 var(--s3) 0 var(--s2);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-sm);
  white-space: nowrap;
}
.stat--hearts.is-empty { color: var(--text-muted); }
.stat--hearts.is-empty .icon { opacity: 0.4; }

.icon-btn {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--radius-pill);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: transform 0.16s var(--ease-spring), background 0.16s;
}
@media (hover: hover) { .icon-btn:hover { background: var(--surface-alt); } }
.icon-btn:active { transform: scale(0.9); }

@media (max-width: 480px) { .topbar--sub .stat--streak, .topbar--sub .stat--xp { display: none; } }
@media (max-width: 420px) {
  .stat { padding: 0 var(--s2) 0 6px; }
  .topbar__stats { gap: 6px; }
}

/* ===== buttons: flat colour with a solid edge you press down =============== */
.btn {
  min-height: var(--tap); padding: 12px 26px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  border: 0; border-radius: var(--radius-pill);
  background: var(--primary); color: var(--primary-text);
  box-shadow: 0 var(--edge) 0 var(--primary-edge);
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); letter-spacing: 0.01em;
  cursor: pointer; text-align: center;
  transition: transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out), background 0.16s;
}
@media (hover: hover) { .btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 calc(var(--edge) + 2px) 0 var(--primary-edge); } }
.btn:active:not(:disabled) { transform: translateY(var(--edge)); box-shadow: 0 0 0 var(--primary-edge); }
.btn:disabled { background: var(--tone-2); color: var(--text-muted); box-shadow: none; cursor: not-allowed; }
.btn--ghost { background: var(--surface); color: var(--text); box-shadow: 0 var(--edge) 0 var(--tone-3); }
@media (hover: hover) { .btn--ghost:hover:not(:disabled) { box-shadow: 0 calc(var(--edge) + 2px) 0 var(--tone-3); } }
.btn--ghost:active:not(:disabled) { box-shadow: 0 0 0 var(--tone-3); }
.btn--sm { min-height: 44px; padding: 8px 18px; font-size: var(--fs-sm); }
.btn--block { width: 100%; }
.btn--danger { background: var(--danger); color: var(--on-danger); box-shadow: 0 var(--edge) 0 color-mix(in srgb, var(--danger) 70%, #000); }

/* ===== headings and text ================================================== */
.screen { padding-bottom: var(--s5); animation: rise 0.4s var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.section-title { font-size: var(--fs-xl); margin: var(--s6) 0 var(--s2); }
.section-title:first-child { margin-top: var(--s4); }
.section-sub { color: var(--text-muted); margin-bottom: var(--s4); max-width: 60ch; }
.footer-note { color: var(--text-muted); font-size: var(--fs-xs); text-align: center; padding: var(--s6) 0 var(--s2); }

/* ===== home: the stage ===================================================== */
.stage { display: grid; gap: var(--s5); margin-top: var(--s2); }
.stage__art {
  position: relative; overflow: hidden;
  min-height: 268px;
  border-radius: var(--radius-xl);
  background-color: var(--hero);
  background-image: var(--hero-image, none);
  background-size: cover; background-position: center bottom;
}
.stage__mascot {
  position: absolute; left: 50%; bottom: -6px;
  width: min(62%, 280px); aspect-ratio: 1; object-fit: contain;
  transform: translateX(-50%);
  filter: drop-shadow(0 10px 0 rgba(0, 0, 0, 0.12));
  animation: bob 4.2s ease-in-out infinite;
  transform-origin: 50% 100%;
}
@keyframes bob {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-0.8deg); }
  50% { transform: translateX(-50%) translateY(-10px) rotate(0.8deg); }
}
.stage__copy { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: var(--s2); }
.stage__title { font-size: var(--fs-hero); font-weight: 700; margin: 0; }
.stage__sub { color: var(--text-muted); font-size: var(--fs-lg); line-height: 1.35; margin: 0 0 var(--s3); max-width: 28ch; }
.stage__actions { display: grid; gap: var(--s3); width: 100%; max-width: 520px; }

.big-cta {
  min-height: 84px; padding: 14px 24px 14px 18px;
  justify-content: flex-start; gap: var(--s4);
  border-radius: var(--radius-lg); text-align: left;
}
.big-cta__play {
  width: 52px; height: 52px; flex: 0 0 52px; display: grid; place-items: center;
  border-radius: 50%; background: var(--primary-text); color: var(--primary);
}
.big-cta__play .icon { margin-left: 3px; }
.big-cta__text { display: grid; line-height: 1.2; min-width: 0; }
.big-cta__label { font-size: var(--fs-lg); font-weight: 700; }
.big-cta__sub { font-family: var(--font-body); font-weight: 700; font-size: var(--fs-sm); opacity: 0.8; }

@media (min-width: 900px) {
  .stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--s7); align-items: stretch; margin-top: var(--s4); }
  .stage__art { order: 2; min-height: 460px; }
  .stage__copy { order: 1; padding: var(--s5) 0; }
  .stage__mascot { width: min(60%, 340px); }
}

/* today tiles */
.today { display: grid; gap: var(--s3); grid-template-columns: 1fr; margin-top: var(--s6); }
@media (min-width: 640px) { .today { grid-template-columns: repeat(3, 1fr); } }
.tile {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4) var(--s5); min-height: 96px;
  border-radius: var(--radius-md); background: var(--surface);
}
.tile__figure { flex: 0 0 64px; width: 64px; height: 64px; display: grid; place-items: center; position: relative; }
.tile__figure img { width: 64px; height: 64px; object-fit: contain; }
.tile__value { display: block; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); line-height: 1.05; }
.tile__label { display: block; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.3; }
.tile__body { min-width: 0; }
.ring { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring__track { stroke: var(--tone-2); }
.ring__fill { stroke: var(--primary-edge); stroke-linecap: round; transition: stroke-dashoffset 0.9s var(--ease-out); }
.ring + .tile__ringlabel { position: absolute; inset: 0; display: grid; place-items: center; }
.tile--streak .icon { width: 52px; height: 52px; }
.tile--reward .tile__figure img { filter: none; }
.tile--reward.is-locked .tile__figure img { filter: grayscale(1); opacity: 0.55; }

.meter { height: 12px; border-radius: var(--radius-pill); background: var(--tone-2); overflow: hidden; margin-top: var(--s2); }
.meter span { display: block; height: 100%; background: var(--success); border-radius: var(--radius-pill); transition: width 0.7s var(--ease-out); }
.meter--primary span { background: var(--primary-edge); }

/* two feature cards: review + trail */
.pair { display: grid; gap: var(--s3); margin-top: var(--s3); }
@media (min-width: 760px) { .pair { grid-template-columns: 1fr 1fr; } }
.feature {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4); min-height: 112px; width: 100%;
  border: 0; border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); text-align: left; cursor: pointer;
  transition: transform 0.18s var(--ease-out), background 0.18s;
}
@media (hover: hover) { .feature:hover { transform: translateY(-3px); background: var(--surface-alt); } }
.feature:active { transform: scale(0.985); }
.feature__art { flex: 0 0 96px; width: 96px; height: 80px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-alt); }
.feature__badge {
  flex: 0 0 64px; width: 64px; height: 64px; display: grid; place-items: center;
  border-radius: var(--radius-md); background: var(--secondary-soft); color: var(--secondary);
}
.feature__title { display: block; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg); line-height: 1.2; }
.feature__sub { display: block; color: var(--text-muted); font-size: var(--fs-sm); margin-top: 2px; }

/* ===== trail =============================================================== */
.unit-block { margin: var(--s6) 0 var(--s7); }
.unit-head {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4) var(--s5); border-radius: var(--radius-lg);
  background: var(--hero); color: var(--hero-text);
}
.unit-head__icon { flex: 0 0 56px; width: 56px; height: 56px; }
.unit-head__icon img { width: 100%; height: 100%; object-fit: contain; }
.unit-head__name { margin: 0; font-size: var(--fs-lg); }
.unit-head__meta { font-size: var(--fs-sm); opacity: 0.85; }

.unit-body { display: block; }
.trail-side { display: none; }
@media (min-width: 900px) {
  .unit-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s6); align-items: start; }
  .trail-side {
    display: block; position: sticky; top: 96px; margin-top: var(--s5); overflow: hidden;
    border-radius: var(--radius-lg); background: var(--surface);
  }
  .trail-side__art { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
  .trail-side__body { padding: var(--s4) var(--s5) var(--s5); }
  .trail-side__kicker { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-sm); color: var(--secondary); }
  .trail-side h3 { font-size: var(--fs-lg); margin: 2px 0 var(--s2); }
  .trail-side p { color: var(--text-muted); font-size: var(--fs-sm); margin: 0; }
}
.path { position: relative; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); padding: var(--s5) 0; max-width: 760px; margin: 0 auto; }
.path__line { position: absolute; left: 0; top: var(--s5); width: 100%; height: calc(100% - var(--s5) * 2); overflow: visible; pointer-events: none; }
.path__line path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.path__rail { stroke: var(--tone-3); stroke-width: 6; stroke-dasharray: 1 14; }
.path__done { stroke: var(--success); stroke-width: 6; }
.node {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--s2);
  width: 100%; aspect-ratio: 100 / 160; padding: 6% 2% 0; min-width: 0;
  border: 0; background: transparent; color: var(--text); cursor: pointer;
}
.node__badge {
  width: 66%; aspect-ratio: 1; flex: none;
  position: relative; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface); color: var(--text-muted);
  box-shadow: 0 6px 0 var(--tone-3);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl);
  transition: transform 0.14s var(--ease-out), box-shadow 0.14s var(--ease-out);
}
@media (hover: hover) { .node:hover .node__badge { translate: 0 -3px; } }
.node:active .node__badge { translate: 0 6px; box-shadow: 0 0 0 var(--tone-3); }
.node .icon { width: 48%; height: 48%; }
.node__body { display: grid; justify-items: center; width: 80%; text-align: center; line-height: 1.2; padding: 0 2px; }
.node__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(0.78rem, 2.6vw, 0.95rem); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.node__meta { color: var(--text-muted); font-size: var(--fs-xs); }
.node__stars { display: none; }

.node--current .node__badge {
  transform: scale(1.14);
  background: var(--primary); color: var(--primary-text); box-shadow: 0 7px 0 var(--primary-edge);
}
.node--current .node__badge::before {
  content: ""; position: absolute; inset: 0;
  border-radius: 50%; border: 4px solid var(--primary);
  animation: pulse 2s var(--ease-out) infinite;
}
.node--current .icon { width: 48%; height: 48%; }
@keyframes pulse { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.5); opacity: 0; } }
.node__start {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  padding: 4px 14px; border-radius: var(--radius-pill);
  background: var(--text); color: var(--bg);
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-sm);
  animation: nudge 1.6s ease-in-out infinite;
}
@keyframes nudge { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-5px); } }
.node--done .node__badge { background: var(--success); color: var(--on-success); box-shadow: 0 6px 0 color-mix(in srgb, var(--success) 65%, #000); }
.node--boss .node__badge { transform: scale(1.14); background: var(--secondary); color: var(--on-secondary); box-shadow: 0 7px 0 color-mix(in srgb, var(--secondary) 65%, #000); }
.node--boss.node--done .node__badge { background: var(--success); box-shadow: 0 7px 0 color-mix(in srgb, var(--success) 65%, #000); }

/* ===== lesson player ====================================================== */
.lesson { padding-top: var(--s2); max-width: var(--content-max); margin: 0 auto; }
.lesson__bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4) 0 var(--s3); background: var(--bg);
}
.lesson__progress { flex: 1; height: 18px; border-radius: var(--radius-pill); background: var(--tone-2); overflow: hidden; }
.lesson__progress span {
  display: block; height: 100%; min-width: 18px; border-radius: var(--radius-pill);
  background: var(--success);
  transition: width 0.5s var(--ease-out);
  position: relative;
}
.lesson__progress span::after {
  content: ""; position: absolute; left: 10px; right: 10px; top: 4px; height: 4px;
  border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.35);
}
.lesson__count { color: var(--text-muted); font-family: var(--font-display); font-weight: 600; font-size: var(--fs-sm); min-width: 48px; text-align: right; }

.lesson__side { display: contents; }
.lesson__scene {
  margin: 0 0 var(--s3); overflow: hidden; border-radius: var(--radius-lg);
  background: var(--surface); animation: rise 0.5s var(--ease-out) both;
}
.lesson__scene-img { display: block; width: 100%; height: 210px; object-fit: cover; }

.mascot-strip { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.mascot-strip__img {
  width: 84px; height: 84px; flex: 0 0 84px; object-fit: contain;
  transform-origin: 50% 100%;
}
.mascot-strip__img.is-happy { animation: cheer 0.7s var(--ease-spring); }
.mascot-strip__img.is-wrong { animation: shake 0.45s ease-in-out; }
@keyframes cheer { 0% { transform: scale(1) rotate(0); } 35% { transform: scale(1.18) rotate(-8deg) translateY(-6px); } 100% { transform: scale(1) rotate(0); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px) rotate(-4deg); } 75% { transform: translateX(8px) rotate(4deg); } }
.mascot-strip__bubble {
  position: relative; flex: 1; min-width: 0;
  padding: var(--s3) var(--s4); border-radius: var(--radius-md);
  background: var(--surface); font-weight: 700; font-size: var(--fs-sm); line-height: 1.4;
}
.mascot-strip__bubble::before {
  content: ""; position: absolute; left: -7px; top: 50%; margin-top: -8px;
  width: 16px; height: 16px; background: inherit; transform: rotate(45deg); border-radius: 3px;
}
.mascot-strip__bubble.is-wrong { background: var(--danger-soft); }

@media (min-width: 960px) {
  .lesson {
    display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
    grid-template-areas: "bar bar" "stage side" "comic comic";
    grid-template-rows: auto auto auto;
    column-gap: var(--s6); row-gap: var(--s3); align-items: start;
  }
  .lesson__bar { grid-area: bar; }
  .lesson__side { grid-area: side; position: sticky; top: 92px; display: grid; gap: var(--s3); align-self: start; min-width: 0; }
  .lesson__scene { margin: 0; }
  /* leaves room under the picture for its caption and Hooty on a short laptop screen */
  .lesson__scene-img { height: auto; aspect-ratio: 16 / 10; max-height: max(180px, calc(100vh - 360px)); }
  .mascot-strip { margin: var(--s2) 0 0; }
  .lesson__stage { grid-area: stage; }
  .lesson__comic { grid-area: comic; }
}

.lesson__comic {
  margin: var(--s5) 0 0; padding: var(--s3); overflow: hidden;
  border-radius: var(--radius-xl); background: var(--surface);
  animation: rise 0.6s var(--ease-out) both;
}
.lesson__comic[hidden] { display: none; }
.lesson__comic-img { display: block; width: 100%; height: auto; border-radius: var(--radius-lg); }

/* ===== activities ========================================================= */
.activity {
  background: var(--surface); border-radius: var(--radius-xl);
  padding: var(--s5); animation: rise 0.4s var(--ease-out) both;
}
.activity__prompt { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; margin-bottom: var(--s5); }
.activity__actions { margin-top: var(--s5); display: flex; gap: var(--s3); flex-wrap: wrap; }
.activity__note { margin: var(--s3) 0 0; color: var(--text-muted); font-size: var(--fs-sm); }

/* tactile answer tile, shared by every choosable thing */
.options { display: grid; gap: var(--s3); }
.option, .match-item, .order-chip, .label-chip, .tf-btn {
  background: var(--surface); color: var(--text);
  border: 2px solid var(--tone-3);
  box-shadow: 0 3px 0 var(--tone-3);
  transition: transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out), border-color 0.12s, background 0.12s;
  cursor: pointer;
}
@media (hover: hover) { .option:hover:not(:disabled), .match-item:hover, .order-chip:hover, .label-chip:hover, .tf-btn:hover:not(:disabled) { border-color: var(--text); } }
.option:active:not(:disabled), .match-item:active, .order-chip:active, .label-chip:active, .tf-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 transparent; }

.option {
  display: flex; align-items: center; gap: var(--s4);
  width: 100%; min-height: var(--tap); padding: 14px var(--s4);
  border-radius: var(--radius-md); text-align: left; font-weight: 700;
}
.option:disabled { cursor: default; }
.option__key {
  width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center;
  border-radius: 50%; background: var(--tone-2);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm);
}
.option__text { flex: 1; line-height: 1.35; }
.option--correct, .tf-btn--correct, .match-item--matched, .label-target--filled {
  background: var(--success-soft); border-color: var(--success); box-shadow: 0 3px 0 var(--success);
}
.option--correct .option__key { background: var(--success); color: var(--on-success); }
.option--wrong, .tf-btn--wrong, .match-item--wrong {
  background: var(--danger-soft); border-color: var(--danger); box-shadow: 0 3px 0 var(--danger);
}
.option--wrong .option__key { background: var(--danger); color: var(--on-danger); }

.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.tf-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 120px; border-radius: var(--radius-lg);
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg);
}
.tf-btn__icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; font-size: 0; }
.tf-btn:first-child .tf-btn__icon { background: var(--success); color: var(--on-success); }
.tf-btn:last-child .tf-btn__icon { background: var(--danger); color: var(--on-danger); }
.tf-btn__icon .icon { width: 28px; height: 28px; }

.input-row { display: flex; gap: var(--s3); flex-wrap: wrap; }
.text-input {
  flex: 1 1 200px; min-width: 0; min-height: var(--tap); padding: 12px var(--s4);
  border-radius: var(--radius-md); border: 2px solid var(--tone-3);
  background: var(--bg); color: var(--text); font-weight: 700;
}
.text-input:focus { outline: none; border-color: var(--text); }
.text-input::placeholder { color: var(--text-muted); font-weight: 600; }
.text-input--wide { flex-basis: 100%; }
.text-input--correct { border-color: var(--success); background: var(--success-soft); }
.text-input--wrong { border-color: var(--danger); background: var(--danger-soft); }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.match-col { display: grid; gap: var(--s3); align-content: start; }
.match-item { min-height: 64px; padding: var(--s3) var(--s4); border-radius: var(--radius-md); text-align: left; font-weight: 700; line-height: 1.3; }
.match-item--selected { border-color: var(--text); background: var(--primary-soft); }
.match-item--matched { cursor: default; }
.match-item--wrong { animation: shake 0.4s ease-in-out; }

.order-answer {
  min-height: 72px; display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4);
  padding: var(--s3); border-radius: var(--radius-md); background: var(--bg);
}
.order-pool { display: flex; flex-wrap: wrap; gap: var(--s2); }
.order-chip, .label-chip {
  min-height: 48px; padding: 8px var(--s4); border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: var(--s2); font-weight: 700;
}
.order-chip--placed { border-color: var(--text); }
.order-chip--correct { border-color: var(--success); background: var(--success-soft); box-shadow: 0 3px 0 var(--success); }
.order-chip--wrong { border-color: var(--danger); background: var(--danger-soft); box-shadow: 0 3px 0 var(--danger); }
.order-num { width: 26px; height: 26px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 0.8rem; font-weight: 800; }

.label-stage { position: relative; border-radius: var(--radius-md); overflow: hidden; margin-bottom: var(--s4); background: var(--bg); }
.label-stage__img { display: block; width: 100%; height: auto; }
.label-target {
  position: absolute; transform: translate(-50%, -50%); min-width: 80px; min-height: 44px; padding: 4px 8px;
  border-radius: var(--radius-sm); border: 2px dashed var(--text); background: var(--surface); color: var(--text); cursor: pointer;
}
.label-target--filled { border-style: solid; }
.label-target--wrong { border-color: var(--danger); background: var(--danger-soft); }
.label-target__text { font-size: var(--fs-xs); font-weight: 800; }
.label-bar { display: flex; flex-wrap: wrap; gap: var(--s2); }
.label-chip--selected { border-color: var(--text); background: var(--primary-soft); }
.label-chip--placed { opacity: 0.35; }

.listen-row { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.speak-btn {
  display: inline-flex; align-items: center; gap: var(--s3); min-height: 60px; padding: 12px 26px;
  border: 0; border-radius: var(--radius-pill); background: var(--secondary); color: var(--on-secondary);
  box-shadow: 0 var(--edge) 0 color-mix(in srgb, var(--secondary) 65%, #000);
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); cursor: pointer;
}
.speak-btn:active { transform: translateY(var(--edge)); box-shadow: none; }
.speak-btn__icon { width: 24px; height: 24px; background: currentColor; clip-path: polygon(0 40%, 25% 40%, 45% 15%, 55% 15%, 55% 85%, 45% 85%, 25% 60%, 0 60%); }

.flashcard { width: 100%; min-height: 220px; border: 0; background: transparent; padding: 0; cursor: pointer; perspective: 1200px; position: relative; }
.flashcard__face {
  backface-visibility: hidden; border-radius: var(--radius-lg); padding: var(--s6) var(--s5); min-height: 220px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: var(--s3); text-align: center;
  transition: transform 0.55s var(--ease-out);
}
.flashcard__face--front { background: var(--bg); }
.flashcard__face--back { position: absolute; inset: 0; transform: rotateY(180deg); background: var(--primary-soft); }
.flashcard.is-flipped .flashcard__face--front { transform: rotateY(-180deg); }
.flashcard.is-flipped .flashcard__face--back { transform: rotateY(0); }
.flashcard__prompt, .flashcard__answer { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; }
.flashcard__hint { color: var(--text-muted); font-size: var(--fs-sm); }

.concept-card__title { font-size: var(--fs-xl); margin-bottom: var(--s3); }
.concept-card__img { width: 100%; border-radius: var(--radius-md); margin-bottom: var(--s4); }
.concept-card__body { font-size: var(--fs-md); line-height: 1.65; }
.concept-card__points { margin: var(--s3) 0 0; padding-left: 22px; }
.concept-card__points li { margin-bottom: 6px; }
.concept-card__note {
  margin: var(--s4) 0 0; padding: var(--s3) var(--s4); border-radius: var(--radius-md);
  background: var(--primary-soft); font-size: var(--fs-sm); line-height: 1.55;
}

.video-wrap { margin-bottom: var(--s4); }
.video-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius-md); background: #000; }
.video-note, .media-caption { color: var(--text-muted); font-size: var(--fs-sm); margin: var(--s2) 0 0; }
.media-img { width: 100%; border-radius: var(--radius-md); }

/* ===== feedback sheet: slides up from the bottom, Continue is always there = */
.sheet {
  position: sticky; bottom: var(--s3); z-index: 15; margin-top: var(--s5);
  padding: var(--s4) var(--s5) var(--s5); border-radius: var(--radius-lg);
  animation: sheet-in 0.4s var(--ease-spring) both;
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet--correct { background: var(--success-soft); }
.sheet--wrong { background: var(--danger-soft); }
.sheet__head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2); }
.sheet__mark { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 50%; }
.sheet--correct .sheet__mark { background: var(--success); color: var(--on-success); }
.sheet--wrong .sheet__mark { background: var(--danger); color: var(--on-danger); }
.sheet__mark .icon { width: 22px; height: 22px; }
.sheet__title { margin: 0; font-size: var(--fs-lg); }
.sheet--correct .sheet__title { color: var(--success); }
.sheet--wrong .sheet__title { color: var(--danger); }
.sheet__body { margin: 0 0 var(--s3); font-size: var(--fs-md); line-height: 1.5; }
.sheet .activity__actions { margin-top: var(--s2); }
.sheet .btn { width: 100%; }
.sheet--correct .btn { background: var(--success); color: var(--on-success); box-shadow: 0 var(--edge) 0 color-mix(in srgb, var(--success) 65%, #000); }
.sheet--wrong .btn { background: var(--danger); color: var(--on-danger); box-shadow: 0 var(--edge) 0 color-mix(in srgb, var(--danger) 65%, #000); }

/* ===== celebration ======================================================== */
.celebrate {
  text-align: center; padding: var(--s6) var(--s5) var(--s5);
  border-radius: var(--radius-xl); background: var(--surface);
  animation: rise 0.5s var(--ease-out) both;
}
.celebrate__art { width: 200px; height: 200px; object-fit: contain; margin: 0 auto var(--s2); display: block; animation: cheer 0.9s var(--ease-spring) both, float 4s 0.9s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.celebrate__title { font-size: var(--fs-xl); }
.celebrate__body { color: var(--text-muted); margin-bottom: var(--s4); }
.xp-pill {
  display: inline-flex; align-items: center; gap: var(--s2); margin-bottom: var(--s4);
  padding: 8px 22px; border-radius: var(--radius-pill);
  background: var(--primary); color: var(--primary-text); box-shadow: 0 var(--edge) 0 var(--primary-edge);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg);
  animation: pop 0.6s 0.25s var(--ease-spring) both;
}
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.celebrate__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); margin: 0 0 var(--s5); }
.celebrate__stat { padding: var(--s3); border-radius: var(--radius-md); background: var(--bg); }
.celebrate__stat b { display: block; font-family: var(--font-display); font-size: var(--fs-lg); }
.celebrate__stat span { color: var(--text-muted); font-size: var(--fs-xs); }
.unlock {
  display: flex; align-items: center; gap: var(--s4); margin: 0 auto var(--s5); max-width: 420px;
  padding: var(--s3) var(--s5) var(--s3) var(--s3); border-radius: var(--radius-lg); background: var(--primary-soft); text-align: left;
  animation: pop 0.7s 0.5s var(--ease-spring) both;
}
.unlock img { width: 72px; height: 72px; flex: 0 0 72px; }
.unlock b { display: block; font-family: var(--font-display); font-size: var(--fs-md); }
.unlock span { font-size: var(--fs-sm); color: var(--text-muted); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -18px; width: 10px; height: 16px; border-radius: 3px; animation: fall 1.8s cubic-bezier(0.3, 0.7, 0.6, 1) forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: 0.2; } }
.sparkles { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.sparkles i {
  position: absolute; width: 12px; height: 12px; background: var(--primary-edge);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: twinkle 1.3s ease-in-out forwards;
}
@keyframes twinkle { 0% { opacity: 0; transform: scale(0.2); } 40% { opacity: 1; transform: scale(1.3); } 100% { opacity: 0; transform: scale(0.4); } }

/* ===== practice =========================================================== */
.review-card {
  display: grid; gap: var(--s4); justify-items: start;
  padding: var(--s6); border-radius: var(--radius-xl); background: var(--surface);
}
.review-card__count { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-hero); line-height: 1; }
.review-card__label { color: var(--text-muted); font-size: var(--fs-lg); margin: 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { padding: 6px var(--s4); border-radius: var(--radius-pill); background: var(--secondary-soft); color: var(--text); font-weight: 700; font-size: var(--fs-sm); }
.chip b { color: var(--secondary); }
.empty {
  display: grid; justify-items: center; gap: var(--s3); text-align: center;
  padding: var(--s7) var(--s5); border-radius: var(--radius-xl); background: var(--surface); color: var(--text-muted);
}
.empty img { width: 140px; height: 140px; object-fit: contain; }
.empty p { margin: 0; max-width: 36ch; font-size: var(--fs-md); }

/* ===== rewards + worlds =================================================== */
.reward-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.reward { display: grid; justify-items: center; gap: var(--s2); padding: var(--s5) var(--s3) var(--s4); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.reward__art { width: 100px; height: 100px; object-fit: contain; }
.reward.is-new .reward__art { animation: pop 0.7s var(--ease-spring) both; }
.reward__name { font-family: var(--font-display); font-weight: 600; }
.reward__need { color: var(--text-muted); font-size: var(--fs-xs); }
.reward.is-locked { background: var(--tone-1); }
.reward.is-locked .reward__art { filter: grayscale(1) brightness(0.9); opacity: 0.35; }
.reward.is-locked .reward__name { color: var(--text-muted); }

.theme-grid { display: grid; gap: var(--s4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .theme-grid { grid-template-columns: 1fr 1fr; } }
.theme-card {
  display: block; width: 100%; padding: 0; overflow: hidden; text-align: left; cursor: pointer;
  border: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  box-shadow: 0 var(--edge) 0 var(--tone-3);
  transition: transform 0.18s var(--ease-out);
}
@media (hover: hover) { .theme-card:hover { transform: translateY(-3px); } }
.theme-card.is-active { box-shadow: 0 0 0 4px var(--text), 0 calc(var(--edge) + 4px) 0 var(--text); }
.theme-card__art { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; display: block; }
.theme-card__body { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); }
.theme-card__text { flex: 1; min-width: 0; }
.theme-card__name { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg); }
.theme-card__desc { color: var(--text-muted); font-size: var(--fs-sm); }
.theme-card__tick { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--text); color: var(--bg); }

/* ===== grown-ups ========================================================== */
.stat-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: var(--s3); }
.stat-card { padding: var(--s4) var(--s5); border-radius: var(--radius-md); background: var(--surface); }
.stat-card__value { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 700; line-height: 1.1; }
.stat-card__label { color: var(--text-muted); font-size: var(--fs-sm); }
.stat-card__note { color: var(--text-muted); font-size: var(--fs-sm); margin-top: 2px; }
.week__sum { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--s3) !important; }
.week__bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s2); align-items: end; }
.week__day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.week__bar { width: 100%; max-width: 40px; height: 72px; border-radius: 10px; background: var(--bg); display: flex; align-items: flex-end; overflow: hidden; }
.week__bar span { display: block; width: 100%; border-radius: 10px; background: var(--text-muted); opacity: .45; }
.week__day.is-met .week__bar span { background: var(--primary); opacity: 1; }
.week__name { font-size: var(--fs-sm); color: var(--text-muted); }
.week__day.is-today .week__name { color: var(--text); font-weight: 700; }
.unit-list { border-radius: var(--radius-lg); background: var(--surface); padding: var(--s2) var(--s5); }
.unit-row { display: flex; align-items: center; gap: var(--s4); padding: var(--s4) 0; }
.unit-row + .unit-row { border-top: 2px solid var(--tone-1); }
.unit-row__name { flex: 1 1 110px; font-weight: 800; }
.unit-row .meter { flex: 2 1 110px; margin: 0; }
.unit-row__pct { color: var(--text-muted); font-size: var(--fs-sm); min-width: 48px; text-align: right; font-weight: 700; }
.privacy-note { display: flex; gap: var(--s3); align-items: center; padding: var(--s4) var(--s5); border-radius: var(--radius-md); background: var(--success-soft); font-size: var(--fs-sm); margin-bottom: var(--s4); }

/* ===== settings =========================================================== */
.settings { border-radius: var(--radius-lg); background: var(--surface); padding: var(--s2) var(--s5); }
.setting-row { display: flex; align-items: center; gap: var(--s4); min-height: 72px; }
.setting-row + .setting-row { border-top: 2px solid var(--tone-1); }
.setting-row__label { flex: 1; font-weight: 800; }
.setting-row__hint { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; display: block; }
.switch {
  position: relative; width: 64px; height: 38px; flex: 0 0 64px; border: 0; border-radius: var(--radius-pill);
  background: var(--tone-3); cursor: pointer; transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); transition: transform 0.25s var(--ease-spring);
}
.switch.is-on { background: var(--success); }
.switch.is-on::after { transform: translateX(26px); }
.range { width: 150px; accent-color: var(--text); }
.setting-row .text-input { flex: 0 1 160px; }

.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 72px); transform: translate(-50%, -16px);
  padding: var(--s3) var(--s5); border-radius: var(--radius-pill);
  background: var(--text); color: var(--bg); font-weight: 800; font-size: var(--fs-sm);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s var(--ease-spring);
  z-index: 80; width: max-content; max-width: min(90vw, 460px); text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }


/* ===== small phones ======================================================= */
@media (max-width: 420px) {
  .match-item { padding: var(--s3); font-size: var(--fs-sm); }
  .activity { padding: var(--s4); border-radius: var(--radius-lg); }
  .tile { padding: var(--s3) var(--s4); }
  .celebrate__stats { grid-template-columns: 1fr 1fr 1fr; }
}

.xp-pill .icon path { fill: var(--primary-text); stroke: var(--primary-text); }

/* ===== tap-a-word ========================================================= */
.term {
  display: inline; margin: -10px -2px; padding: 10px 2px; border: 0; border-radius: 0; background: none;
  color: inherit; font: inherit; line-height: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--primary-edge); text-decoration-thickness: 2px;
  text-underline-offset: 3px; text-decoration-skip-ink: none; transition: text-decoration-color 0.15s;
}
@media (hover: hover) { .term:hover { text-decoration-color: var(--primary); } }
.term:focus-visible { outline-offset: 2px; }
.term-pop { position: fixed; inset: 0; z-index: 90; display: grid; align-items: end; justify-items: center; }
.term-pop__scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--text) 45%, transparent); animation: fade 0.2s both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.term-pop__card {
  position: relative; width: min(560px, 100%); padding: var(--s5) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0; background: var(--surface);
  animation: sheet-in 0.35s var(--ease-spring) both;
}
.term-pop__word { font-size: var(--fs-xl); margin: 0 0 var(--s2); }
.term-pop__meaning { font-size: var(--fs-lg); line-height: 1.4; margin: 0 0 var(--s3); }
.term-pop__example { color: var(--text-muted); margin: 0 0 var(--s3); }
.term-pop__src { color: var(--text-muted); font-size: var(--fs-xs); margin: 0 0 var(--s4); }
.term-pop__actions { display: flex; gap: var(--s3); justify-content: flex-end; flex-wrap: wrap; }
@media (min-width: 720px) {
  .term-pop { align-items: center; }
  .term-pop__card { border-radius: var(--radius-xl); padding-bottom: var(--s5); }
}

/* ===== easy reading + key-word highlighter ================================ */
.concept-card__body { max-width: 62ch; font-size: 1.125rem; line-height: 1.7; }
.concept-card__body p { margin: 0 0 var(--s3); }
.concept-card__points { max-width: 62ch; font-size: 1.0625rem; line-height: 1.6; }
.activity__prompt, .sheet__body { line-height: 1.45; }
.key { background: none; color: inherit; font-weight: 800; }
body.hl-on .key {
  background: var(--primary); color: var(--primary-text);
  padding: 0.04em 0.28em; border-radius: 6px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.icon-btn--hl[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); }

/* ===== picture captions + credits ========================================= */
.lesson__scene-cap { display: grid; gap: 2px; padding: var(--s2) var(--s4) var(--s3); font-size: var(--fs-xs); line-height: 1.4; color: var(--text-muted); }
.lesson__scene-cap span { color: var(--text); font-size: var(--fs-sm); font-weight: 700; }
.credit-link { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }
.credit-list { margin: 0 0 var(--s4); padding-left: 20px; font-size: var(--fs-sm); line-height: 1.6; }
.lesson__scene-img { background: var(--surface-alt); }

/* ===== Hooty, painted: tall figure on the stage, head-and-shoulders in the strip ===== */
.stage__mascot { width: auto; height: 94%; max-width: 70%; aspect-ratio: auto; object-fit: contain; object-position: 50% 100%; filter: none; bottom: 0; }
.mascot-strip__img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; background: var(--surface); }
.celebrate__art { width: auto; height: 240px; }
.empty img { width: auto; height: 190px; }
.nav__brand img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: 50% 50%; background: var(--bg); }

.term-hint { display: flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s3); padding: var(--s2) var(--s3); border-radius: var(--radius-md); background: var(--primary-soft); font-size: var(--fs-sm); font-weight: 700; }
.stage__art { background-position: center; }

/* ===== concept card as a conversation with Hooty ============================ */
.lesson:has(.activity--concept) .mascot-strip { display: none; }
.concept-talk { display: flex; align-items: flex-start; gap: var(--s3); margin: var(--s3) 0 var(--s4); }
.concept-talk__face { width: 84px; height: 84px; flex: 0 0 84px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); transform-origin: 50% 50%; }
.concept-talk__face.is-talk { animation: cheer 0.5s var(--ease-spring); }
.concept-talk__col { flex: 1; min-width: 0; }
.concept-talk__bubble {
  position: relative; min-height: 5.5em; padding: var(--s3) var(--s4); border-radius: var(--radius-lg);
  background: var(--primary-soft);
}
.concept-talk__bubble::before {
  content: ""; position: absolute; left: -7px; top: 34px; width: 16px; height: 16px;
  background: inherit; transform: rotate(45deg); border-radius: 3px;
}
.concept-line { animation: rise 0.35s var(--ease-out) both; }
.concept-talk__bubble .concept-card__body p { margin: 0; }
.concept-talk__bubble .concept-card__note { margin: 0; padding: 0; background: none; }
.concept-line__lead { margin: 0 0 var(--s2); font-weight: 800; }
.concept-talk__dots { display: flex; gap: 6px; justify-content: center; margin-top: var(--s3); }
.concept-talk__dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary-edge); transition: background 0.2s; }
.concept-talk__dots span.is-on { background: var(--primary-edge); }

/* ===== touch targets: inline words and credit links get a roomy hit area ==== */
.credit-link { display: inline-block; padding: 12px 0; }
.nav__item { margin: 0 2px; }
.btn--sm { min-height: 48px; }

/* ===== big screens: the lesson grows with the window instead of floating at the top == */
@media (min-width: 960px) {
  .lesson { max-width: 1240px; padding-top: var(--s4); column-gap: var(--s7); }
  .lesson .activity { padding: var(--s6); }
  .lesson .activity__prompt { font-size: 1.75rem; }
  .lesson .option { min-height: 68px; font-size: 1.1875rem; padding: 16px var(--s5); }
  .lesson .option__key { width: 40px; height: 40px; flex-basis: 40px; }
  .lesson .concept-card__title { font-size: 2.25rem; }
  .lesson .concept-card__body { font-size: 1.375rem; line-height: 1.6; max-width: none; }
  .lesson .concept-card__points { font-size: 1.25rem; max-width: none; }
  .concept-talk { gap: var(--s5); margin: var(--s5) 0; }
  .concept-talk__face { width: 112px; height: 112px; flex-basis: 112px; }
  .concept-talk__bubble { min-height: 9em; padding: var(--s5); }
  .concept-talk__bubble::before { top: 46px; }
  .lesson .activity__actions .btn { min-height: 64px; font-size: 1.25rem; }
}
@media (min-width: 1600px) {
  .lesson { max-width: 1480px; }
  .lesson .activity__prompt { font-size: 2rem; }
  .lesson .concept-card__body { font-size: 1.5rem; }
}
@media (min-width: 960px) and (min-height: 760px) {
  .lesson__stage, .lesson__side { margin-top: clamp(0px, 7vh, 96px); }
}

/* ===== notches and short landscape phones ================================== */
.main { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
@media (max-height: 480px) and (orientation: landscape) {
  .lesson { display: grid; grid-template-columns: minmax(0, 1fr) 150px; column-gap: var(--s4); grid-template-areas: "bar bar" "stage mascot"; align-items: start; }
  .lesson__bar { grid-area: bar; }
  .lesson__stage { grid-area: stage; }
  .lesson__side { display: contents; }
  .lesson__scene { display: none; }
  .mascot-strip { grid-area: mascot; flex-direction: column; align-items: stretch; margin: 0; }
  .mascot-strip__img { align-self: center; width: 64px; height: 64px; flex-basis: 64px; }
  .lesson .activity { padding: var(--s4); }
  .concept-talk__face { width: 56px; height: 56px; flex-basis: 56px; }
  .concept-talk__bubble { min-height: 0; padding: var(--s3); }
  .nav { transform: scale(0.9); transform-origin: bottom center; }
}
@media (max-width: 340px) {
  .lesson__bar { gap: var(--s2); }
  .concept-talk__face { width: 60px; height: 60px; flex-basis: 60px; }
  .btn { padding-left: var(--s3); padding-right: var(--s3); }
}
@media (max-height: 480px) and (orientation: landscape) { .lesson .activity__actions { flex-wrap: nowrap; margin-top: var(--s3); } .lesson .activity__actions .btn--block { flex: 1; width: auto; } }

/* the avatar art is pre-padded, so centre it: no clipped hair */
.mascot-strip__img, .concept-talk__face { object-position: 50% 50%; }
.node--current .node__body, .node--boss .node__body { margin-top: 7%; }
.node__meta { font-size: 0.72rem; line-height: 1.25; }

/* ===== reading: hook, passage, read-along, finished notes =================== */
.hook { display: flex; gap: var(--s4); align-items: flex-start; margin: var(--s3) 0; }
.hook__face { width: 84px; height: 84px; flex: 0 0 84px; border-radius: 50%; object-fit: cover; background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); }
.hook__bubble { position: relative; flex: 1; padding: var(--s4) var(--s5); border-radius: var(--radius-lg); background: var(--primary-soft); }
.hook__bubble::before { content: ""; position: absolute; left: -7px; top: 34px; width: 16px; height: 16px; background: inherit; transform: rotate(45deg); border-radius: 3px; }
.hook__lead { margin: 0 0 var(--s2); font-weight: 800; color: var(--text-muted); }
.hook__text { margin: 0; font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; line-height: 1.35; }
.hook__hint { color: var(--text-muted); font-size: var(--fs-sm); margin: var(--s3) 0 0; }
.passage__kicker { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-sm); color: var(--secondary); text-transform: uppercase; letter-spacing: 0.08em; }
.passage__title { font-size: var(--fs-xl); margin: 2px 0 var(--s4); }
.passage__body { max-width: 60ch; font-size: 1.1875rem; line-height: 1.8; }
.passage__body p { margin: 0 0 var(--s4); }
.rw.is-now { background: var(--primary); color: var(--primary-text); border-radius: 4px; box-shadow: 0 0 0 2px var(--primary); }
.finished { margin: var(--s4) 0 0; padding: var(--s4); border-radius: var(--radius-md); background: var(--primary-soft); text-align: left; }
.finished__bar { height: 10px; margin-top: var(--s3); border-radius: 999px; background: var(--surface); overflow: hidden; }
.finished__bar span { display: block; height: 100%; background: var(--success); border-radius: inherit; }
.in-book { margin: var(--s3) 0 0; font-weight: 700; text-align: left; }
@media (min-width: 960px) { .passage__body { font-size: 1.375rem; } .hook__text { font-size: 1.75rem; } .hook__face { width: 112px; height: 112px; flex-basis: 112px; } }
.lesson:has(.activity--hook, .activity--passage) .mascot-strip { display: none; }

/* every line in Hooty's bubble reads at the same size and weight: paragraphs, key points and the closing tip */
.concept-talk__bubble .concept-card__note,
.concept-talk__bubble .concept-card__points { font-size: 1.125rem; line-height: 1.7; font-weight: inherit; color: inherit; max-width: none; }
@media (min-width: 960px) {
  .concept-talk__bubble .concept-card__note,
  .concept-talk__bubble .concept-card__points { font-size: 1.375rem; line-height: 1.6; }
}
.activity--concept .activity__actions .btn--block, .activity--hook .activity__actions .btn--block, .activity--passage .activity__actions .btn--block { flex: 1 1 100%; }
.activity__actions .btn[hidden] { display: none; }

/* a stray double-tap should not paint the title blue */
.concept-card__title, .concept-talk__face, .btn, .passage__title, .hook__lead { user-select: none; -webkit-user-select: none; }

/* ===== subject pills (Social Science | Science ...) ========================= */
/* One swipeable row that bleeds to the screen edges, so five books never push the lesson below the fold. */
.subject-tabs {
  display: flex; gap: var(--s2); flex-wrap: nowrap; margin: var(--s2) calc(var(--gutter) * -1) var(--s3);
  padding: 2px var(--gutter) 6px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - 28px), transparent 100%);
}
.subject-tabs::-webkit-scrollbar { display: none; }
.subject-tab {
  flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap;
  min-height: 44px; padding: 0 var(--s4); border: 2px solid var(--tone-3); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--text); box-shadow: 0 3px 0 var(--tone-3);
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); cursor: pointer;
}
.subject-tab.is-on { background: var(--primary); border-color: var(--primary-edge); box-shadow: 0 3px 0 var(--primary-edge); color: var(--primary-text); }

/* sections with no "Up next" card use the full width */
@media (min-width: 900px) { .unit-body--plain { grid-template-columns: minmax(0, 1fr); } }
.unit-head__icon { display: grid; place-items: center; }
.unit-head__icon .icon { width: 34px; height: 34px; }

.lesson.is-finished .lesson__scene,
.lesson.is-finished .mascot-strip { display: none; }

/* first-run "what should Hooty call you?" card */
.name-card { margin: var(--s4) 0; padding: var(--s4); border-radius: var(--radius-lg, 24px); background: var(--surface); display: grid; gap: var(--s3); }
.name-card__ask { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); }

/* ===== tablets (iPad) ======================================================
   Portrait iPads (744 to 834 wide, and a 13" Pro at 1024) were getting the phone layout stretched
   across the screen: very long lines, a thin cropped picture, and half the page empty. They now get a
   centred reading column, a larger picture, bigger type and bigger touch targets. Landscape iPads
   (1133 wide and up) already use the two-column desktop layout above. */
@media (min-width: 700px) and (max-width: 959px), (min-width: 960px) and (orientation: portrait) {
  .lesson { display: block; max-width: 820px; padding-top: var(--s5); }
  .lesson__side { display: contents; }
  .lesson__scene { margin: 0 0 var(--s5); }
  .lesson__scene-img { height: auto; aspect-ratio: 16 / 10; max-height: 34vh; }
  .mascot-strip { display: none; }
  .lesson__stage { margin-top: 0; }
  /* a question has to fit on the screen with its options, so its picture is shorter than a reading card's */
  .lesson:not(:has(.activity--concept, .activity--hook, .activity--passage)) .lesson__scene-img { max-height: 24vh; }
  .lesson .activity { padding: var(--s6); }
  .lesson .activity__prompt { font-size: 1.625rem; }
  .lesson .option { min-height: 64px; font-size: 1.1875rem; padding: 16px var(--s5); }
  .lesson .option__key { width: 40px; height: 40px; flex-basis: 40px; }
  .lesson .concept-card__title { font-size: 2rem; }
  .lesson .concept-card__body { font-size: 1.3125rem; line-height: 1.6; max-width: none; }
  .lesson .concept-card__points { font-size: 1.1875rem; max-width: none; }
  .concept-talk { gap: var(--s5); margin: var(--s5) 0; }
  .concept-talk__face { width: 100px; height: 100px; flex-basis: 100px; }
  .concept-talk__bubble { min-height: 8em; padding: var(--s5); }
  .concept-talk__bubble::before { top: 40px; }
  .passage__body { font-size: 1.3125rem; }
  .hook__text { font-size: 1.625rem; }
  .lesson .activity__actions .btn { min-height: 60px; font-size: 1.1875rem; }
  .lesson .activity__actions .btn--sm { min-height: 56px; padding-inline: var(--s5); }
  .stage__actions { max-width: none; }
}
@media (min-width: 700px) and (max-width: 899px) {
  .stage__art { aspect-ratio: 16 / 9; max-height: 46vh; min-height: 0; }
}
@media (min-width: 960px) and (orientation: portrait) {
  .lesson { max-width: 920px; }
}

/* ===== iPad / iOS Safari details ============================================
   Tapping a field must not zoom the page (iOS zooms any input under 16px), taps must not wait for a
   possible double-tap zoom, and the page must not be pulled sideways. */
.text-input, select.text-input { font-size: max(16px, 1em); }
button, a, input, select, label, summary, [role="button"], [role="tab"], [role="switch"], .option, .match-item, .order-chip, .label-chip, .node { touch-action: manipulation; }
.credit-note { color: var(--text-muted); font-size: var(--fs-xs); }

/* class chips sit above the subject pills: smaller and quieter, so the subject stays the main choice */
.tabs-block .subject-tabs { margin-bottom: 0; }
.tabs-block { margin-bottom: var(--s3); }
.grade-tab { min-height: 36px; padding: 0 var(--s4); font-size: var(--fs-sm); box-shadow: 0 2px 0 var(--tone-3); }
.grade-tab.is-on { background: var(--text); border-color: var(--text); box-shadow: 0 2px 0 var(--text); color: var(--bg); }

/* a diagram is shown whole, never cropped to the photo banner */
.lesson__scene-img--diagram { height: auto; aspect-ratio: 16 / 10; object-fit: contain; background: #fff7e8; }

/* ===== Maths: worked examples and visual models ============================================= */
.model-fig { margin: var(--s3) 0 var(--s4); }
.model { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.worked__kicker { margin: 0 0 var(--s2); color: var(--secondary, #c0267c); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; font-size: var(--fs-sm); }
.worked__problem { margin: 0 0 var(--s3); font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg); line-height: 1.35; }
.worked__steps { list-style: none; margin: var(--s3) 0; padding: 0; display: grid; gap: var(--s2); counter-reset: step; }
.worked__step { counter-increment: step; position: relative; padding: var(--s3) var(--s4) var(--s3) 56px; border-radius: var(--radius-md); background: var(--primary-soft); line-height: 1.5; }
.worked__step::before { content: counter(step); position: absolute; left: 14px; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--primary-text); font-weight: 800; }
.worked__step.is-new { animation: rise 0.35s var(--ease-out) both; }
.worked__answer { margin: var(--s3) 0; padding: var(--s3) var(--s4); border-radius: var(--radius-md); background: var(--success-soft); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); }
.sheet__steps { margin: var(--s3) 0 0; padding-left: 1.3em; line-height: 1.5; }
.sheet__why { margin: var(--s2) 0 0; font-weight: 700; }
@media (min-width: 700px) { .worked__problem { font-size: 1.5rem; } .worked__step { font-size: 1.1875rem; } }

/* the first second: Hooty and a gentle bar, not a spinner */
.boot__art { width: min(62vw, 260px); height: auto; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-xl, 28px); }
.boot__name { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 2rem; color: var(--text); }
.boot__note { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.boot__bar { width: 160px; height: 8px; border-radius: 99px; background: var(--tone-2, #e6dbe6); overflow: hidden; }
.boot__bar span { display: block; width: 40%; height: 100%; border-radius: 99px; background: var(--primary, #ffc533); animation: boot-slide 1.1s ease-in-out infinite alternate; }
@keyframes boot-slide { from { transform: translateX(-20%); } to { transform: translateX(170%); } }

/* a worked example has its own picture: on phones and portrait tablets the topic picture and Hooty's strip would push it off screen */
@media (max-width: 959px), (orientation: portrait) {
  .lesson:has(.activity--worked) .lesson__scene,
  .lesson:has(.activity--worked) .mascot-strip,
  .lesson:has(.activity--explore) .lesson__scene,
  .lesson:has(.activity--explore) .mascot-strip,
  .lesson:has(.activity--explain) .mascot-strip { display: none; }
}

/* school-style practice */
.case-box { margin: 0 0 var(--s4); padding: var(--s4); border-radius: var(--radius-md); background: var(--surface-alt, #f7eff6); border-left: 6px solid var(--primary); }
.case-box__text { margin: 0; line-height: 1.6; }
.activity__prompt { white-space: pre-line; }
.explain__box { width: 100%; display: block; min-height: 130px; resize: vertical; line-height: 1.5; font-weight: 500; }
.explain__reveal { margin-top: var(--s4); padding: var(--s4); border-radius: var(--radius-md); background: var(--success-soft); }
.explain__head { margin: 0 0 var(--s2); font-family: var(--font-display); font-size: var(--fs-md); }
.explain__answer { margin: 0 0 var(--s4); line-height: 1.6; }
.explain__points { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.explain__points label { display: flex; gap: var(--s3); align-items: flex-start; min-height: 44px; cursor: pointer; line-height: 1.45; }
.explain__points input { width: 24px; height: 24px; flex: 0 0 24px; accent-color: var(--success); }

/* explorables: a simulation with sliders and self-ticking challenges */
.explore__stage { display: block; width: 100%; height: auto; border-radius: var(--radius-md); background: #fff7e8; margin: var(--s2) 0; touch-action: pan-y; }
.explore__say { min-height: 3em; margin: var(--s2) 0; font-weight: 700; line-height: 1.4; }
.explore__control { display: block; margin: var(--s3) 0; }
.explore__label { display: flex; justify-content: space-between; gap: var(--s3); font-weight: 700; font-size: var(--fs-sm); }
.explore__val { font-family: var(--font-display); font-size: var(--fs-lg); color: var(--text); }
.explore__range { width: 100%; height: 44px; accent-color: var(--primary); }
.explore__tasks { list-style: none; padding: 0; margin: var(--s3) 0; display: grid; gap: var(--s2); }
.explore__task { display: flex; gap: var(--s3); padding: var(--s3); border-radius: var(--radius-md); background: var(--primary-soft); line-height: 1.45; }
.explore__task.is-done { background: var(--success-soft); }
.explore__mark { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: var(--primary-text); font-weight: 800; }
.explore__task.is-done .explore__mark { background: var(--success); color: var(--on-success); }
.explore__ask { display: block; font-weight: 700; }
.explore__then { display: block; margin-top: 4px; font-weight: 500; animation: rise .3s var(--ease-out) both; }
.explore__done { margin: var(--s2) 0; padding: var(--s3); border-radius: var(--radius-md); background: var(--success-soft); font-weight: 700; }
.growth-card { margin: var(--s4) 0; padding: var(--s4); border-radius: var(--radius-lg); background: var(--surface); } .growth-card p { margin: 0; line-height: 1.5; }
.growth-list { margin: 0 0 var(--s2); padding-left: 1.2em; line-height: 1.5; } .growth-note { color: var(--text-muted); font-size: var(--fs-sm); }

/* ===== PC ===================================================================
   Nothing to show beside the card (a finished lesson, or a reading card with no picture): centre it instead of leaving an empty column. */
@media (min-width: 960px) and (orientation: landscape) and (min-height: 481px) {
  .lesson.is-finished,
  .lesson:not(:has(.lesson__scene)):has(.activity--concept, .activity--hook, .activity--passage) { display: block; max-width: 880px; }
  .lesson.is-finished .lesson__side { display: none; }
  .lesson.is-finished .lesson__stage { margin-top: var(--s3); }
  /* the next-lesson button should not need a scroll on a laptop */
  .celebrate__art { height: clamp(90px, 18vh, 240px); }
  .celebrate__stats { margin-bottom: var(--s3); }
}

/* a scrollbar in the app's own colours, on devices with a mouse (touch screens keep their overlay bars) */
@media (hover: hover) and (pointer: fine) {
  html { scrollbar-gutter: stable; }
  ::-webkit-scrollbar { width: 14px; height: 14px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--primary); border: 3px solid transparent; border-radius: 99px; background-clip: padding-box; }
  ::-webkit-scrollbar-thumb:hover { background: var(--primary-edge); border: 3px solid transparent; background-clip: padding-box; }
  ::-webkit-scrollbar-corner { background: transparent; }
  @supports not selector(::-webkit-scrollbar) {
    html { scrollbar-color: var(--primary) transparent; }
  }
}

/* a finished lesson on a PC: one clear next step, the rest side by side so everything fits without scrolling */
@media (min-width: 960px) and (orientation: landscape) {
  .celebrate .in-book { text-align: center; }
  .celebrate .activity__actions { flex-wrap: wrap; }
  .celebrate .activity__actions .btn--block { flex: 1 1 0; width: auto; min-width: 0; }
  .celebrate .activity__actions .btn--primary { flex: 1 1 100%; }
}
/* the next step stays on screen however much there is to read above it */
@media (min-width: 960px) and (orientation: landscape) {
  .celebrate .activity__actions { position: sticky; bottom: 0; z-index: 2; padding: var(--s3) 0; background: var(--surface); }
}
.sheet .term-hint { display: none; } /* the same hint is already on the card above */

.empty__next { display: grid; gap: var(--s3); width: 100%; max-width: 460px; margin: var(--s4) auto 0; }

/* ===== phones held sideways =================================================
   Height is what runs out. The tabs move to a thin rail at the side, the top of the page tightens up, Start stays on the
   first screen, and all the answers of a question fit together in two columns. */
@media (max-height: 500px) and (orientation: landscape) {
  .shell:not(.shell--focus) { display: grid; grid-template-columns: calc(76px + env(safe-area-inset-left)) minmax(0, 1fr); }
  .nav {
    position: sticky; top: 0; left: auto; right: auto; bottom: auto; width: auto; height: 100dvh;
    flex-direction: column; justify-content: center; gap: 2px;
    padding: var(--s1) 4px var(--s1) max(4px, env(safe-area-inset-left));
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0; box-shadow: none; transform: none;
  }
  .nav__brand { display: none; }
  .nav__item { flex: 1 1 0; max-height: 68px; min-height: 44px; flex-direction: column; justify-content: center; gap: 0; padding: 0; font-size: 0.6875rem; }
  .nav__badge { position: absolute; top: 2px; left: 50%; margin: 0 0 0 8px; }
  .main { padding-bottom: var(--s4); }
  .main--focus { padding-bottom: var(--s3); }
  .topbar { padding: var(--s2) 0 var(--s1); }
  .tabs-block { display: flex; gap: var(--s2); align-items: center; margin-bottom: var(--s2); min-width: 0; }
  .tabs-block .subject-tabs { margin: 0; padding: 2px 0 6px; min-width: 0; }
  .tabs-block .subject-tabs:first-child { flex: 0 1 auto; max-width: 42%; }
  .tabs-block .subject-tabs:last-child { flex: 1 1 0; }
  .subject-tab { min-height: 40px; padding: 0 var(--s3); font-size: var(--fs-sm); }
  .stage { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s4); align-items: center; margin-top: 0; }
  .stage__art { order: 2; min-height: 0; height: calc(100dvh - 130px); max-height: 300px; aspect-ratio: auto; }
  .stage__copy { order: 1; padding: 0; gap: var(--s1); }
  .stage__title { font-size: 1.75rem; }
  .stage__sub { font-size: var(--fs-md); margin-bottom: var(--s2); }
  .big-cta { min-height: 64px; padding: 8px 16px 8px 10px; }
  .big-cta__play { width: 44px; height: 44px; flex-basis: 44px; }
  .today { margin-top: var(--s4); grid-template-columns: repeat(3, 1fr); }

  .lesson { display: block; max-width: none; padding-top: 0; }
  .lesson__bar { padding-block: var(--s1); }
  .lesson__scene, .mascot-strip { display: none; }
  .lesson__stage { margin-top: 0; }
  .lesson .activity { padding: var(--s3) var(--s4); }
  .lesson .activity__prompt { font-size: 1.25rem; margin-bottom: var(--s2); }
  .lesson .options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .lesson .option { min-height: 52px; padding: 6px var(--s3); font-size: 1rem; }
  .lesson .option__key { width: 30px; height: 30px; flex-basis: 30px; }
  .lesson .concept-card__title { font-size: 1.375rem; }
  .lesson .concept-card__body, .passage__body { font-size: 1.0625rem; }
  .lesson .activity__actions .btn { min-height: 48px; font-size: 1rem; }
  .worked__problem { font-size: 1.125rem; }
  .sheet { padding: var(--s2) var(--s3); }
  .sheet__head { margin-bottom: 0; }
  .sheet .activity__actions { margin-top: var(--s1); }
  .celebrate__art { height: 90px; }
  .celebrate .activity__actions { flex-wrap: wrap; }
  .celebrate .activity__actions .btn--block { flex: 1 1 40%; width: auto; }
  .empty img { height: 90px; }
}
@media (max-height: 500px) and (orientation: landscape) { .tabs-block .subject-tabs { mask-image: none; -webkit-mask-image: none; } }

/* fun facts */
.lesson:has(.activity--funfact) .mascot-strip { display: none; }
.fun-fact { margin: 0 0 var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius-md); background: var(--primary-soft); text-align: left; line-height: 1.5; }

/* a family's own book */
.addbook { max-width: 640px; }
.addbook__card { display: grid; gap: var(--s3); margin-top: var(--s3); padding: var(--s5); border-radius: var(--radius-lg); background: var(--surface); }
.addbook__card > * { margin: 0; }
.addbook__file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.addbook__status { min-height: 1.5em; font-weight: 700; }
.addbook__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.addbook .finished__bar span { width: 0; transition: width 0.2s; }
.addbook .finished__bar[hidden] { display: none; }
.grade-tab--add { border-style: dashed; background: transparent; box-shadow: none; }

/* ===== choose your guide ====================================================== */
.guide-picker { display: flex; gap: var(--s3); }
.guide-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--s2) var(--s3); min-width: 88px; border-radius: var(--radius-lg); border: 3px solid transparent; background: var(--surface-alt, var(--surface)); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.guide-pick img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--bg); }
.guide-pick.is-on { border-color: var(--primary); background: var(--primary-soft, var(--surface)); }
.guide-pick:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }

/* Hooty's pale feathers need a darker scene: a night wash over the painting, and a soft warm glow behind the owl */
.stage__art--night { position: relative; isolation: isolate; }
.stage__art--night::before, .stage__art--night::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.stage__art--night::before { background: linear-gradient(180deg, #34207a 0%, #4a2d8c 42%, #245a4e 100%); mix-blend-mode: multiply; opacity: 0.74; }
.stage__art--night::after { background: radial-gradient(ellipse 58% 52% at 50% 64%, rgba(255, 205, 110, 0.40), rgba(255, 205, 110, 0) 72%); }
.stage__art--night .stage__mascot { z-index: 1; }
