

/*
  Bambú Aula — Mi jardín v6.
  The shell has an explicit dynamic viewport height, rather than min-height only.
  There is ONE set of layout rules: no fixed 560/610px card or 820px cap.
  All garden geometry and the full-body panda come from the supplied HTML.
*/
:root {
  color-scheme: light;
  --paper: #fffef8;
  --ink: #164e3d;
  --muted: #506453;
  --soft: #e7efdf;
  --footer: #f3f6ee;
  --new-yellow: #ffd43b;
  --focus: #164e3d;
  font-family: "Trebuchet MS", ui-rounded, system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { height: 100%; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); }
a, button { color: inherit; font: inherit; -webkit-tap-highlight-color: transparent; }
a { text-decoration: none; }
button { cursor: pointer; }
:where(a, button):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -8rem; left: 1rem; z-index: 20;
  background: var(--ink); color: var(--paper); padding: 14px 18px;
}
.skip-link:focus { top: 1rem; }

/* Application shell. Both browser bars and window resizing are accounted for. */
.app {
  width: 100%;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--paper);
}
.app-header {
  display: flex;
  align-items: center;
  padding: calc(8px + env(safe-area-inset-top, 0px)) var(--page-gutter, clamp(16px,4vw,50px)) 8px;
  min-width: 0;
  background: var(--paper);
  border: 0;
}
.brand { display: inline-flex; align-items: center; gap: 7px; min-height: 48px; }
.brand .panda { display: block; width: 48px; height: 48px; flex: none; }
.brand-name { font-size: clamp(1.35rem, 2.25vw, 1.9rem); font-weight: 700; letter-spacing: -.055em; }
.brand-dot { color: var(--ink); }

/* Only the middle region scrolls if a large text size/very low height requires it. */
.content { min-width: 0; min-height: 0; overflow: auto; scroll-padding: 12px; }
.content:focus { outline: none; }
.garden-view {
  width: 100%; height: 100%;
  display: grid;
  grid-template-rows: auto minmax(7rem, 1fr) auto;
  border: 0; border-radius: 0; margin: 0; padding: 0;
  background: var(--paper); box-shadow: none;
}
.garden-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding: 8px var(--page-gutter, clamp(16px,4vw,50px)) 6px;
  border: 0; min-width: 0;
}
h1 {
  margin: 0; font-size: clamp(1.5rem, 2.65vw, 2.1rem);
  line-height: 1.2; letter-spacing: -.035em; font-weight: 700;
}
.ui-icon { display: block; width: 24px; height: 24px; flex: none; object-fit: contain; }

/* The SVG and the subject grid use exactly the same width, with no inner gutters. */
.garden-stage { position: relative; min-width: 0; min-height: 0; background: var(--paper); }
svg.garden { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: hidden; }
.subjects {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0; padding: 4px 0 10px; margin: 0; border: 0;
  background: var(--paper); min-width: 0; align-items: stretch;
}
.subject {
  display: flex; flex-direction: column; justify-content: flex-start; align-items: center;
  gap: 7px; min-width: 0; min-height: 52px; padding: 8px 1px 4px;
  font-size: clamp(.8125rem, 1.6vw, 1.0625rem); line-height: 1.2;
  font-weight: 700; color: var(--ink); text-align: center; border-radius: 8px;
}
.subject-name { max-width: 100%; overflow-wrap: anywhere; }
.subject:hover { background: var(--soft); }
.subject:hover .subject-name, .subject:focus-visible .subject-name { text-decoration: underline; text-underline-offset: 3px; }
.subject:focus-visible { outline-offset: -3px; }
.subject-dot { display: block; flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--subject-color); }

.app-footer { margin: 0; padding: 0; border: 0; background: var(--footer); }
.footer-nav {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(4px, 1vw, 14px);
  padding: 7px clamp(6px, 2vw, 28px) calc(7px + env(safe-area-inset-bottom, 0px));
}
.footer-link {
  min-width: 0; min-height: 58px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  padding: 6px 3px; border-radius: 10px;
  font-size: .875rem; line-height: 1.2; color: var(--muted); text-align: center;
}
.footer-link[aria-current="page"] { background: var(--soft); color: var(--ink); font-weight: 700; }
.footer-link[aria-current="page"] .nav-label { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.footer-link:hover { background: var(--soft); color: var(--ink); }

/* Original segment-by-segment growth. Existing stem sections are not stretched. */
.growth { transform-origin: 0 0; }
.sway { transform-origin: 0 0; animation: sway var(--sway-duration, 7s) ease-in-out var(--sway-delay) infinite; }
.leaf { transform-origin: 0 0; animation: unfurl .46s cubic-bezier(.25,.1,.25,1) var(--leaf-delay) both; }
.branch { animation: branch-in .34s ease-out var(--branch-delay, 1.5s) both; fill: none; stroke: #64b94b; stroke-width: 5; stroke-linecap: round; }
.internode { transform-origin: 0 0; animation: extend-segment var(--segment-duration) cubic-bezier(.36,0,.64,1) var(--segment-delay) both; }
.tip-lift { animation: raise-tip var(--segment-duration) cubic-bezier(.36,0,.64,1) var(--segment-delay) both; }
.node-ring { animation: node-appear .11s ease-out var(--node-delay) both; }
.leaf-breeze { transform-origin: 0 0; animation: leaf-flutter var(--flutter-duration) ease-in-out var(--flutter-delay) infinite; }
@keyframes unfurl {
  0% { opacity: 0; transform: scale(.04,.16) rotate(-12deg); }
  25% { opacity: 1; }
  65% { transform: scale(.65,.88) rotate(-3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes branch-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes extend-segment { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes raise-tip { from { transform: translateY(0); } to { transform: translateY(var(--rise)); } }
@keyframes node-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes sway {
  0%,100% { transform: rotate(0); }
  28% { transform: rotate(var(--sway-angle)); }
  65% { transform: rotate(calc(var(--sway-angle) * -.7)); }
  85% { transform: rotate(calc(var(--sway-angle) * .2)); }
}
@keyframes leaf-flutter {
  0%,100% { transform: rotate(0); }
  30% { transform: rotate(var(--flutter-angle)); }
  70% { transform: rotate(calc(var(--flutter-angle) * -.65)); }
}

/* The original final leaf is solid yellow. Only its light pulses, not its geometry. */
.new-content-leaf {
  fill: var(--new-yellow);
  stroke: none;
  filter: brightness(1)
    drop-shadow(0 0 5px rgba(255,193,25,.65))
    drop-shadow(0 0 11px rgba(255,213,59,.5));
  animation: unfurl .46s cubic-bezier(.25,.1,.25,1) var(--leaf-delay) both,
    new-content-shimmer 2.6s ease-in-out calc(var(--leaf-delay) + .48s) infinite;
}
.new-content-leaf-link { cursor: pointer; }
.leaf-hit-area { fill: transparent; stroke: none; pointer-events: all; }
/* A focus indicator is shown only during keyboard navigation, never as a leaf border. */
.leaf-focus-ring {
  fill: none; stroke: var(--focus); stroke-width: 3px; vector-effect: non-scaling-stroke;
  opacity: 0; pointer-events: none;
}
.new-content-leaf-link:focus-visible { outline: none; }
.new-content-leaf-link:focus-visible .leaf-focus-ring { opacity: 1; }
@keyframes new-content-shimmer {
  0%,100% {
    filter: brightness(1)
      drop-shadow(0 0 5px rgba(255,193,25,.65))
      drop-shadow(0 0 11px rgba(255,213,59,.5));
  }
  50% {
    filter: brightness(1.12)
      drop-shadow(0 0 9px rgba(255,193,25,.9))
      drop-shadow(0 0 22px rgba(255,223,90,.82));
  }
}
.leaf-tooltip {
  position: absolute; max-width: min(17rem, calc(100% - 16px));
  padding: 10px 12px; border-radius: 8px;
  color: var(--paper); background: var(--ink); line-height: 1.4; font-size: .875rem;
  z-index: 3; pointer-events: auto;
}
.leaf-tooltip[hidden] { display: none; }

/* Reduced-motion preferences still show the complete garden and the lit yellow leaf. */
@media (prefers-reduced-motion: reduce) {
  :is(.sway,.leaf-breeze,.leaf,.branch,.internode,.tip-lift,.node-ring) { animation: none !important; }
  .tip-lift { transform: translateY(var(--rise)); }
  .new-content-leaf { animation: none !important; }
}
@media (max-width: 540px) {
  .app-header { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 4px; }
  .brand .panda { width: 43px; height: 43px; }
  .brand { min-height: 48px; }
  .garden-head { padding-top: 6px; padding-bottom: 4px; }
  .footer-link { font-size: .8125rem; }
}
/* At very low heights, keep controls legible; allow the main region to scroll. */
@media (max-height: 440px) and (min-width: 541px) {
  .app-header { padding-top: 4px; padding-bottom: 2px; }
  .brand .panda { width: 36px; height: 36px; }
  .brand { min-height: 40px; }
  .brand-name { font-size: 1.375rem; }
  .garden-head { padding-block: 2px; }
  h1 { font-size: 1.375rem; }
  .footer-link { min-height: 44px; flex-direction: row; gap: 8px; }
  .footer-nav { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); }
  .subject { min-height: 44px; padding-block: 4px; gap: 4px; }
  .subjects { padding-block: 2px 4px; }
}
@media (forced-colors: active) {
  .footer-link[aria-current="page"] { outline: 2px solid Highlight; outline-offset: -3px; }
  .new-content-leaf { forced-color-adjust: none; fill: var(--new-yellow); stroke: none; animation: none; filter: none; }
  .leaf-focus-ring { stroke: Highlight; }
  .leaf-tooltip { color: CanvasText; background: Canvas; border: 1px solid CanvasText; }
}

/* Homes de idioma. La cabecera, el pie y los colores parten de la home v6. */
:root {
  --card: #ffffff;
  --edge: #c5d2c1;
  --new-wash: #fff5d2;
  --new-ink: #614b12;
  --hero: #eef4e8;
}
[hidden] { display: none !important; }
button, input { font: inherit; }
button { border: 0; }
:where(a, button, input, summary):focus-visible {
  outline: 3px solid var(--focus); outline-offset: 4px;
}
:where(h1, h2)[tabindex='-1']:focus { outline: none; }
.content { overscroll-behavior-y: contain; scrollbar-gutter: stable; }
.content[data-view='jardin'] { scrollbar-gutter: auto; }
.view-wrap {
  width: 100%; max-width: none; margin-inline: 0;
  padding: 0 var(--page-gutter, clamp(16px,4vw,50px)) 36px;
}
.back-row { display: flex; align-items: center; min-height: 52px; margin-bottom: 6px; }
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 4px 4px 4px 0;
  font-size: .9375rem; font-weight: 700;
}
.back-link .ui-icon { width: 22px; height: 22px; }
.back-link:hover span { text-decoration: underline; text-underline-offset: 4px; }
.lang-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 230px;
  grid-template-rows: auto auto;
  align-items: center; column-gap: 24px; row-gap: 20px;
  min-width: 0; padding: 26px 32px;
  border-radius: 20px; background: var(--hero);
}
.lang-hero[data-language='ingles'] { --hero: #fff5db; }
.lang-hero[data-language='frances'] { --hero: #eef3f3; }
.hero-copy { grid-column: 1; grid-row: 1; align-self: end; }
.hero-copy h1 { font-size: clamp(2rem, 3.8vw, 2.875rem); letter-spacing: -.045em; }
.hero-copy p { margin: 10px 0 0; font-size: 1.0625rem; line-height: 1.5; color: var(--muted); }
.hero-action { grid-column: 1; grid-row: 2; align-self: start; }
.hero-art {
  grid-column: 2; grid-row: 1 / 3; position: relative;
  display: flex; flex-direction: column; align-items: center;
  align-self: center; justify-self: center;
}
.hero-panda { width: 150px; height: 150px; display: block; }
.greeting {
  background: var(--paper); border-radius: 14px;
  padding: 7px 18px; text-align: center; line-height: 1.25;
  font-weight: 700; font-size: 1.1875rem; margin-bottom: -4px;
}
.greeting small { display: block; font-weight: 400; font-size: .8125rem; margin-top: 2px; color: var(--muted); }
.primary-button, .secondary-button {
  display: inline-flex; justify-content: center; align-items: center;
  min-height: 50px; max-width: 100%; padding: 12px 20px;
  gap: 10px; border-radius: 12px; text-align: center;
  font-size: 1rem; font-weight: 700; line-height: 1.35;
  text-decoration: none; cursor: pointer;
}
.primary-button { background: var(--ink); color: var(--paper); border: 2px solid var(--ink); }
.primary-button:hover { background: #103c2f; border-color: #103c2f; }
.primary-button .ui-icon { filter: brightness(0) invert(1); }
.secondary-button { background: var(--paper); border: 1.5px solid var(--ink); color: var(--ink); }
.secondary-button:hover { background: var(--soft); }
.home-section { margin-top: 28px; }
.section-heading { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; }
h2 { margin: 0; font-size: 1.3125rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.3; }
.section-caption { margin: -6px 0 16px; color: var(--muted); font-size: .9375rem; line-height: 1.5; }
.yellow-leaf { display: block; width: 22px; height: 26px; flex: none; overflow: visible; }
.new-topic {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 20px; align-items: center; padding: 22px 24px;
  border-radius: 16px; background: var(--new-wash); min-width: 0;
  color: var(--ink); position: relative;
}
.new-topic:hover { background: #ffefb6; }
.topic-visual { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; background: var(--paper); flex: none; }
.topic-visual .ui-icon { width: 40px; height: 40px; }
.topic-tag { margin: 0 0 5px; font-size: .8125rem; color: var(--new-ink); line-height: 1.5; }
.topic-name { display: block; font-size: 1.5rem; line-height: 1.25; letter-spacing: -.03em; font-weight: 700; }
.topic-subtitle { display: block; font-size: .9375rem; color: var(--muted); line-height: 1.5; margin-top: 5px; }
.topic-link-label { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9375rem; white-space: nowrap; }
.topic-link-label span { text-decoration: underline; text-underline-offset: 4px; }
.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.topic-card {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 20px;
  align-items: center; gap: 12px; min-width: 0;
  min-height: 106px; padding: 18px; background: var(--card);
  border: 1px solid var(--edge); border-radius: 14px;
}
.topic-card:hover { border-color: var(--ink); background: #f7faf3; }
.topic-card .card-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; }
.topic-card .card-icon .ui-icon { width: 30px; height: 30px; }
.card-copy { min-width: 0; }
.card-copy strong { display: block; font-size: 1.0625rem; line-height: 1.3; }
.card-copy small { display: block; font-size: .875rem; color: var(--muted); line-height: 1.4; margin-top: 5px; }
.card-arrow { width: 20px; height: 20px; }
.more-topics { margin-top: 16px; }
.more-topics summary { cursor: pointer; padding: 12px 0; width: fit-content; min-height: 44px; color: var(--ink); font-weight: 700; font-size: .9375rem; }
.more-topics summary::marker { color: var(--ink); }
.more-topics summary span { text-decoration: underline; text-underline-offset: 4px; }
.more-topics .topic-grid { margin-top: 10px; }
.empty-news { display: flex; gap: 14px; align-items: center; padding: 18px 20px; background: #f2f5ed; border-radius: 14px; }
.empty-news .ui-icon { width: 30px; height: 30px; }
.empty-news p { margin: 0; color: var(--muted); line-height: 1.5; font-size: .9375rem; }
.empty-news strong { display: block; color: var(--ink); margin-bottom: 3px; font-size: 1rem; }
.note { font-size: .875rem; line-height: 1.6; color: var(--muted); margin: 18px 0 0; }
.demo-label { display: inline-block; font-size: .8125rem; line-height: 1.5; font-weight: 400; color: var(--muted); padding-left: 7px; }
/* One shared destination template; the exercise engine is deliberately not migrated here. */
.page-title { margin-bottom: 24px; }
.page-title h1 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
.page-title p { color: var(--muted); margin: 10px 0 0; line-height: 1.5; }
.detail-heading { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; }
.detail-heading .topic-visual { background: var(--soft); }
.detail-heading h1 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
.detail-heading p { margin: 8px 0 0; color: var(--muted); font-size: .9375rem; }
.feature-mode { display: flex; align-items: center; gap: 18px; padding: 22px 24px; background: var(--soft); border-radius: 16px; margin-bottom: 14px; }
.feature-mode .topic-visual { background: var(--paper); }
.feature-mode .card-copy { flex: 1; }
.feature-mode .card-copy strong { font-size: 1.4rem; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.detail-wrap { max-width: 870px; }
.mode-card { width: 100%; text-align: left; }
.preview-note { display: flex; align-items: flex-start; gap: 9px; padding: 15px 18px; background: #f2f5ed; border-radius: 12px; margin-top: 24px; font-size: .875rem; color: var(--muted); line-height: 1.55; }
.preview-note .ui-icon { width: 20px; height: 20px; margin-top: 1px; }
.simple-page { max-width: 700px; }
.simple-page .page-title { margin-top: 12px; }
.language-list { display: grid; gap: 14px; }
.language-list .topic-card { min-height: 96px; }
/* Configuración por pasos, sin la lista de modos dentro de la sesión. */
.steps { display: flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--muted); margin-bottom: 26px; }
.steps .step { display: flex; align-items: center; gap: 7px; }
.step b { width: 26px; height: 26px; display: grid; place-items: center; background: var(--soft); border-radius: 50%; color: var(--ink); }
.step.current { color: var(--ink); font-weight: 700; }
.step.current b { background: var(--ink); color: var(--paper); }
.step-rule { flex: 1; height: 1px; background: var(--edge); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.3; margin-bottom: 10px; font-weight: 700; letter-spacing: -.025em; }
.form-hint { margin: 0 0 24px; color: var(--muted); line-height: 1.5; }
.choice-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-bottom: 28px; }
.radio-card { position: relative; min-width: 0; }
.radio-card input { position: absolute; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.radio-card span { display: block; text-align: center; padding: 18px 8px; border: 1.5px solid var(--ink); border-radius: 12px; font-size: 1.125rem; }
.radio-card input:checked + span { background: var(--ink); color: var(--paper); font-weight: 700; }
.radio-card input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 4px; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.config-summary { color: var(--ink); background: var(--soft); padding: 18px 20px; line-height: 1.6; border-radius: 14px; margin: 20px 0; }
/* A short real demo for the hero's play button; no network or saved progress. */
.session-wrap { max-width: 700px; }
.session-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 16px; }
.session-meta p { margin: 0; font-size: .875rem; color: var(--muted); }
.session-progress { display: flex; gap: 6px; height: 5px; margin-bottom: 26px; }
.session-progress span { flex: 1; border-radius: 3px; background: #ccd9c4; }
.session-progress .filled { background: var(--ink); }
.prompt { text-align: center; margin: 24px 0; }
.prompt h1 { font-size: 1.5rem; }
.foreign-word { display: block; font-size: clamp(2.25rem, 6vw, 3.5rem); margin: 22px 0 8px; font-weight: 700; line-height: 1.4; }
.word-reading { display: block; color: var(--muted); font-size: 1.0625rem; line-height: 1.5; }
.answer-list { display: grid; gap: 12px; }
.answer { padding: 17px 20px; background: var(--card); border: 1.5px solid var(--ink); border-radius: 12px; font-size: 1.0625rem; text-align: left; min-height: 54px; line-height: 1.4; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.answer:hover:not(:disabled) { background: var(--soft); }
.answer.correct { background: #e4efdd; color: var(--ink); }
.answer:disabled { opacity: 1; cursor: default; color: var(--muted); border-color: #adbba8; }
.answer.correct:disabled { color: var(--ink); border-color: var(--ink); }
.feedback { min-height: 28px; margin: 18px 0 12px; color: var(--ink); font-size: 1rem; line-height: 1.5; }
.feedback[data-kind='retry'] { color: #7b4117; }
.session-next { width: 100%; }
.card-study { text-align: center; background: var(--card); border: 1px solid var(--edge); border-radius: 18px; padding: 24px; margin: 22px 0; }
.card-study img.word-image { width: 112px; height: 112px; object-fit: contain; margin: 0 auto; }
.card-study .foreign-word { margin-top: 4px; }
.card-study .meaning { margin: 20px 0 8px; font-weight: 700; font-size: 1.5rem; line-height: 1.4; }
.sound-button { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: 10px 14px; min-height: 44px; margin-top: 14px; background: var(--soft); }
.completion { text-align: center; padding: 32px 0; }
.completion .hero-panda { margin: 0 auto 24px; }
.completion h1 { font-size: 2rem; }
.completion p { line-height: 1.5; color: var(--muted); margin: 16px 0 24px; }
.completion .form-actions { justify-content: center; }
.app.is-session { grid-template-rows: auto minmax(0,1fr); }
.app.is-session .app-footer { display: none; }
@media (max-width: 850px) {
  .topic-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .lang-hero { grid-template-columns: minmax(0,1fr) 190px; padding: 24px; }
  .hero-panda { width: 136px; height: 136px; }
  .new-topic { gap: 16px; }
}
@media (max-width: 540px) {
  .view-wrap { padding: 0 16px 24px; }
  .back-row { min-height: 46px; margin-bottom: 4px; }
  .back-link { font-size: .875rem; }
  .lang-hero { padding: 20px; grid-template-columns: minmax(0,1fr) 100px; column-gap: 12px; row-gap: 18px; border-radius: 16px; }
  .hero-copy { align-self: center; }
  .hero-copy h1 { font-size: 2rem; }
  .hero-copy p { font-size: .9375rem; margin-top: 8px; }
  .hero-art { grid-row: 1; }
  .hero-panda { width: 96px; height: 96px; }
  .greeting { font-size: 1rem; padding: 6px 10px; border-radius: 10px; }
  .greeting small { font-size: .8125rem; }
  .hero-action { grid-column: 1 / -1; }
  .hero-action .primary-button { width: 100%; min-height: 48px; }
  .home-section { margin-top: 24px; }
  .section-heading { margin-bottom: 12px; }
  h2 { font-size: 1.25rem; }
  .new-topic { grid-template-columns: 46px minmax(0,1fr) 20px; gap: 12px; padding: 18px 16px; border-radius: 14px; }
  .new-topic .topic-visual { width: 46px; height: 52px; border-radius: 12px; }
  .new-topic .topic-visual .ui-icon { width: 32px; height: 32px; }
  .topic-name { font-size: 1.25rem; }
  .topic-tag { font-size: .8125rem; }
  .topic-link-label span { display: none; }
  .new-topic .topic-link-label { align-self: center; }
  .new-topic .topic-link-label .ui-icon { width: 20px; height: 20px; }
  .topic-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .topic-card { min-height: 94px; padding: 16px; }
  .topic-subtitle { font-size: .875rem; }
  .section-caption { font-size: .875rem; margin-bottom: 14px; }
  .detail-heading { gap: 12px; }
  .detail-heading .topic-visual { width: 52px; height: 56px; }
  .detail-heading .topic-visual .ui-icon { width: 34px; height: 34px; }
  .mode-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .feature-mode { padding: 18px 16px; gap: 12px; }
  .feature-mode .topic-visual { width: 44px; height: 48px; }
  .feature-mode .topic-visual .ui-icon { width: 30px; height: 30px; }
  .feature-mode .card-copy strong { font-size: 1.25rem; }
  .feature-mode > .ui-icon { width: 20px; height: 20px; }
  .choice-grid { gap: 10px; }
  .form-actions .primary-button { flex-grow: 1; }
  .steps { margin-top: 10px; }
}
@media (max-width: 350px) {
  .view-wrap { padding-inline: 12px; }
  .lang-hero { grid-template-columns: minmax(0,1fr) 84px; padding: 18px 16px; gap: 12px; }
  .hero-panda { width: 80px; height: 80px; }
  .hero-copy h1 { font-size: 1.875rem; }
  .new-topic { padding: 16px 12px; gap: 9px; grid-template-columns: 38px minmax(0,1fr) 18px; }
  .new-topic .topic-visual { width: 38px; height: 46px; }
  .topic-name { font-size: 1.125rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
@media (forced-colors: active) {
  :is(.lang-hero, .new-topic, .topic-card, .feature-mode, .empty-news) { border: 1px solid CanvasText; }
  .primary-button, .secondary-button, .answer { border: 2px solid ButtonText; }
  .ui-icon { forced-color-adjust: none; }
  .radio-card input:checked + span { outline: 3px solid Highlight; }
}
.footer-link.in-section { background: var(--soft); color: var(--ink); font-weight: 700; }
.footer-link.in-section .nav-label { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }


/* Locally hosted school handwriting for first-grade learning. License: assets/fonts/playwrite-es/OFL.txt. */
@font-face{font-family:'Bambu Escolar';src:url('/assets/fonts/playwrite-es/playwrite-es.ttf') format('truetype');font-style:normal;font-weight:100 400;font-display:swap}
.app.is-first-grade .content,.unit-contest[data-grade="1"],.unit-overview[data-grade="1"]{font-family:'Bambu Escolar','Trebuchet MS',sans-serif;font-size:1.15rem;line-height:1.65;font-synthesis:none;font-variant-ligatures:common-ligatures contextual;letter-spacing:normal}
.app.is-first-grade .content .answer-choice-content,.unit-contest[data-grade="1"] .answer-choice-content{font-size:1.5rem;font-weight:400;line-height:1.65;letter-spacing:normal}
