/* ════════════════════════════════════════════════
   SparkLlama · Spanish Pathways — plantilla F1
   styles.css — Paleta visual cálida ilustrada (los temas pueden sobrescribir variables en content.json → meta.palette)
════════════════════════════════════════════════ */

/* ── Fuentes alojadas en la propia app (sin Google Fonts) ── */
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('shared/fonts/fredoka-500.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('shared/fonts/fredoka-700.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('shared/fonts/nunito-400.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('shared/fonts/nunito-500.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('shared/fonts/nunito-700.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 800; font-display: swap;
  src: url('shared/fonts/nunito-800.woff2') format('woff2'); }

/* ── Variables ── */
:root {
  --bg: #DDF0EC;
  --bg-alt: #F2ECE4;
  --paper: #FFFDF8;
  --ink: #1B2B4B;
  --ink-soft: #3A4F6A;
  --cream: #FBF5EB;
  --coral: #E8576F;
  --coral-light: #F0A892;
  --sun: #F6C945;
  --teal: #1E8C8C;
  --teal-light: #5BB8BB;
  --blue-deep: #1B2B4B;
  --manta: #A8C8D0;
  --wood: #AC6B3E;
  --sand: #E8B870;
  --white: #FFFDF8;
  --shadow: rgba(27,43,75,0.10);
  --shadow-md: rgba(27,43,75,0.18);
  --radius: 18px;
  --radius-sm: 10px;
  --font-title: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
  --transition: 0.32s cubic-bezier(0.34,1.2,0.64,1);
}

[data-theme="dark"] {
  --bg: #0F2229;
  --bg-alt: #1A3040;
  --paper: #1C3245;
  --ink: #E6F3F0;
  --ink-soft: #B8D4CC;
  --cream: #1A3040;
  --shadow: rgba(0,0,0,0.3);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-padding-top: 0; }
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── Screen system ── */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════
   PANTALLA INICIO
════════════════════════════════ */
#screen-home {
  background: linear-gradient(160deg, var(--bg) 0%, var(--cream) 100%);
  align-items: center;
  padding: 0 1rem 2rem;
  gap: 0;
}

.home-header {
  width: 100%;
  text-align: center;
  padding: 0.9rem 0 0.4rem;
}
/* Lockup: logo circular + texto de marca en línea */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  /* sombra muy suave para separarlo del fondo */
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
}
.brand-tag {
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.9;
}

.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  width: 100%;
  max-width: 560px;
  padding: 1rem 0;
}
.home-book-cover {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px var(--shadow-md);
}
.cover-svg { width: 100%; height: auto; display: block; }
.home-text { text-align: center; }
.home-title {
  font-family: var(--font-title);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--teal);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.home-subtitle {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0.3rem 0 0.2rem;
}
.home-title-en {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--ink-soft);
  opacity: 0.65;
}
.home-subtitle-en {
  font-size: 0.95rem;
  color: var(--teal);
  border-left: 3px solid var(--teal-light);
  padding-left: 0.6rem;
  margin-top: 0.15rem;
  font-weight: 500;
  line-height: 1.5;
}

.home-nav {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 0;
}
.btn-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--paper);
  border: 2.5px solid transparent;
  border-radius: var(--radius);
  padding: 1rem 1.4rem;
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 16px var(--shadow);
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}
.btn-main:hover, .btn-main:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow-md);
  outline: none;
}
.btn-story { border-color: var(--teal); }
.btn-story:hover { background: var(--teal); color: white; }
.btn-activities { border-color: var(--coral); }
.btn-activities:hover { background: var(--coral); color: white; }
.btn-guide { border-color: var(--sun); }
.btn-guide:hover { background: var(--sun); color: var(--ink); }
.btn-icon { font-size: 1.4rem; }

/* ══════════════════════════════════════════════
   SISTEMA BILINGÜE ES / EN
   Arquitectura: btn-text-wrap (flex column)
   ══════════════════════════════════════════════ */

/* 1. EN siempre oculto por defecto */
.btn-label-en { display: none !important; }

/* 2. Contenedor de texto: columna vertical para apilar ES ↕ EN */
.btn-text-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}

/* 3. Cuando EN activo: mostrar label EN debajo del ES */
.en-active .btn-label-en {
  display: block !important;
  font-size: 0.72em;
  color: var(--teal);
  font-weight: 500;
  opacity: 0.9;
  margin-top: 0.18rem;
  line-height: 1.2;
  font-style: normal;
  letter-spacing: 0.01em;
}

/* 4. ES: siempre display block dentro del wrap para que EN quede abajo */
.btn-text-wrap .btn-label-es {
  display: block;
}

/* 5. h2 bilingüe — ES normal, EN bloque debajo más pequeño */
.en-active h2 .btn-label-es { display: block; }
.en-active h2 .btn-label-en {
  display: block !important;
  font-size: 0.62em;
  color: var(--teal);
  opacity: 0.85;
  margin-top: 0.12rem;
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: normal;
}

/* 6. Tarjetas de actividad: título y descripción */
.en-active .act-title .btn-label-es,
.en-active .act-desc .btn-label-es { display: block; }
.en-active .act-title .btn-label-en,
.en-active .act-desc .btn-label-en {
  font-size: 0.82em;
  margin-top: 0.1rem;
}

/* 7. Instrucciones de actividad (act-instruction spans) */
.en-active .act-instruction .btn-label-es { display: block; }
.en-active .act-instruction .btn-label-en {
  font-size: 0.88em;
  margin-top: 0.12rem;
}

/* ── Toggle bilingüe en inicio ── */
.lang-toggle-wrap {
  width: 100%;
  max-width: 400px;
  margin-bottom: 0.5rem;
}
.lang-toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--paper);
  border: 2.5px solid var(--teal);
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
  width: 100%;
}
.lang-toggle-label:hover {
  box-shadow: 0 6px 20px var(--shadow-md);
}
.lang-toggle-flag {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.lang-toggle-text {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--teal);
  font-weight: 600;
  flex: 1;
}

/* Switch custom */
.lang-toggle-switch { position: relative; display: flex; align-items: center; }
.lang-toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.lang-switch-track {
  display: block;
  width: 48px;
  height: 26px;
  background: var(--bg);
  border-radius: 26px;
  border: 2px solid var(--teal-light);
  transition: background 0.25s, border-color 0.25s;
  position: relative;
  cursor: pointer;
}
.lang-switch-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: var(--teal-light);
  border-radius: 50%;
  transition: transform 0.25s, background 0.25s;
}
.lang-toggle-switch input:checked ~ .lang-switch-track {
  background: var(--teal);
  border-color: var(--teal);
}
.lang-toggle-switch input:checked ~ .lang-switch-track::after {
  transform: translateX(22px);
  background: white;
}

/* Badge EN en header del libro */
.book-lang-badge {
  background: var(--teal);
  color: white;
  font-family: var(--font-title);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* Texto EN en páginas del libro — estilo diferenciado */
.text-en, .text-q-en, .text-a-en, .text-intro-en {
  border-left: 3px solid var(--teal-light);
  padding-left: 0.6rem;
  margin-top: 0.15rem;
  opacity: 1 !important; /* override anterior */
}
.text-en { font-size: 0.95rem; color: var(--teal); font-style: normal; font-weight: 500; }
.text-q-en { font-size: 1rem; color: var(--teal); font-style: normal; font-weight: 600; opacity: 0.85 !important; }
.text-a-en { font-size: 0.9rem; color: var(--teal); font-style: normal; }
.text-intro-en { font-size: 0.85rem; color: var(--teal); font-style: normal; }

/* Botones del menú principal: ES en bloque normal, EN ya manejado por regla global */
.en-active .btn-main .btn-label-es { display: block; }
/* Anular el separador "/" en botones principales — EN va en bloque, no inline */
.en-active .btn-main .btn-label-es::after { content: none; }

.home-footer {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0.5rem 0.6rem;
  width: 100%;
  max-width: 400px;
}
/* Bloque de texto legal: dos líneas pequeñas, discretas */
.footer-legal {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.68rem;
  color: var(--ink-soft);
  opacity: 0.65;
  line-height: 1.4;
  text-align: left;
}
.btn-theme, .btn-motion {
  background: none;
  border: 1.5px solid var(--ink-soft);
  border-radius: 20px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-theme:hover, .btn-motion:hover { opacity: 0.85; }

/* ════════════════════════════════
   BOOK · FLIPBOOK
════════════════════════════════ */
#screen-book {
  background: var(--bg-alt);
  gap: 0;
}

.book-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--paper);
  box-shadow: 0 2px 8px var(--shadow);
  gap: 0.5rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.book-progress {
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: var(--teal);
  min-width: 60px;
  text-align: right;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.toggle-label input { accent-color: var(--teal); }

/* Book stage — centrado con ancho máximo para pantallas grandes */
.book-stage {
  flex: 1;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  position: relative;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 4px 24px var(--shadow);
}

.book-page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  overflow: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.book-page.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}
.book-page.entering {
  display: flex;
  opacity: 0;
  transform: translateX(30px);
}
.book-page.leaving {
  opacity: 0;
  transform: translateX(-30px);
}

/* Desktop: book-like two-column */
@media (min-width: 760px) {
  .book-stage { min-height: 420px; }
  .book-page {
    flex-direction: row;
    position: static;
    flex: 1;
  }
  .book-page.hidden { display: none; }
  .page-illustration { flex: 1.2; }
  .page-text-area { flex: 0.8; }
}

.page-illustration {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  padding: 0.5rem;
}
.scene-svg { width: 100%; height: auto; max-height: 340px; display: block; }
.scene-img {
  width: 100%;
  height: 100%;
  max-height: 480px;
  object-fit: contain;   /* imagen completa, sin recorte */
  object-position: center;
  border-radius: 8px;
  display: block;
}

.page-text-area {
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  background: var(--paper);
  border-top: 2px solid var(--bg);
}
@media (min-width: 760px) {
  .page-text-area {
    border-top: none;
    border-left: 2px solid var(--bg);
    min-width: 220px;
    max-width: 280px;
  }
}

.scene-number {
  font-family: var(--font-title);
  font-size: 0.75rem;
  color: var(--teal);
  opacity: 0.85;
  letter-spacing: 0.05em;
}

/* Texts */
.text-es {
  font-family: var(--font-title);
  font-size: 1.35rem;
  color: var(--ink);
  line-height: 1.45;
}
.text-en {
  font-size: 1rem;
  color: var(--ink-soft);
  opacity: 0.75;
  font-style: italic;
  line-height: 1.4;
}
.text-intro-es {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}
.text-intro-en {
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.65;
  font-style: italic;
}
.text-q-es {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--teal);
  line-height: 1.3;
}
.text-q-en {
  font-size: 0.9rem;
  color: var(--ink-soft);
  opacity: 0.65;
  font-style: italic;
}
.text-a-es {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: var(--coral);
}
.text-a-en {
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.65;
  font-style: italic;
}

/* Answer reveal */
.answer-reveal {
  background: linear-gradient(135deg, #FFF8E8, #FFEEDD);
  border: 2px solid var(--sun);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  animation: popIn 0.4s var(--transition) both;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* Cover text */
.cover-text-area {
  align-items: center;
  text-align: center;
  background: linear-gradient(180deg, var(--paper) 0%, var(--cream) 100%);
  padding: 1.5rem 1rem;
}
.cover-title-es {
  font-family: var(--font-title);
  font-size: 2rem;
  color: var(--teal);
  font-weight: 700;
}
.cover-subtitle {
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0.4rem 0 0.2rem;
}
.cover-title-en {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--ink-soft);
  opacity: 0.6;
}
.cover-collection {
  font-size: 0.78rem;
  color: var(--teal);
  opacity: 0.85;
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
}

/* Ending */
.ending-area { justify-content: flex-start; }
.ending-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* Book controls */
.book-controls {
  background: var(--paper);
  border-top: 2px solid var(--bg);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: sticky;
  bottom: 0;
  z-index: 10;
}
.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ctrl-audio-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Buttons ── */
.btn-ctrl {
  background: var(--paper);
  border: 2px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--teal);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn-ctrl:hover, .btn-ctrl:focus-visible {
  background: var(--teal);
  color: white;
  outline: none;
}
.btn-ctrl:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.btn-ctrl.btn-sm { font-size: 0.78rem; padding: 0.4rem 0.7rem; }
.btn-ctrl.btn-listen { border-color: var(--coral); color: var(--coral); }
.btn-ctrl.btn-listen:hover { background: var(--coral); color: white; }

.btn-ctrl.btn-en { border-color: var(--blue-deep); color: var(--blue-deep); }
.btn-ctrl.btn-en:hover { background: var(--blue-deep); color: white; }

.btn-reveal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--teal);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  font-family: var(--font-title);
  font-size: 1rem;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.3rem;
}
.btn-reveal:hover { background: #17706F; transform: scale(1.03); }

.btn-primary {
  background: var(--teal);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.2rem;
  font-family: var(--font-title);
  font-size: 1rem;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { background: #17706F; transform: translateY(-1px); }
.btn-secondary {
  background: var(--paper);
  border: 2px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--teal);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--teal); color: white; }

.btn-back {
  background: none;
  border: 2px solid var(--ink-soft);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.18s;
}
.btn-back .btn-text-wrap, .btn-back span { white-space: nowrap; }
.btn-back:hover { background: var(--ink-soft); color: white; }

.en-controls {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.audio-status {
  font-size: 0.78rem;
  color: var(--ink-soft);
  opacity: 0.7;
  text-align: center;
  min-height: 1.2em;
}

/* ════════════════════════════════
   ACTIVIDADES — Headers comunes
════════════════════════════════ */
.act-screen { background: var(--bg); }
.act-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.2rem;
  background: var(--paper);
  box-shadow: 0 2px 8px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}
.act-header h2 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: var(--teal);
}
.act-instruction {
  text-align: center;
  padding: 0.85rem 1.2rem 0.4rem;
  font-family: var(--font-title);
  font-size: 1.05rem;
  color: var(--ink-soft);
}

/* ── Conjunto / modo toggles ── */
.act1-set-toggle, .act2-mode-toggle, .act3-room-toggle {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.5rem 1rem;
  flex-wrap: wrap;
}
.btn-set {
  background: var(--paper);
  border: 2px solid var(--teal);
  border-radius: 20px;
  padding: 0.35rem 1rem;
  font-size: 0.9rem;
  color: var(--teal);
  cursor: pointer;
  transition: all 0.18s;
  font-family: var(--font-body);
  font-weight: 700;
}
.btn-set.active, .btn-set[aria-pressed="true"] {
  background: var(--teal);
  color: white;
}
.btn-set:hover { background: var(--teal); color: white; }

/* ════════════════════════════════
   ACTIVIDAD 1 · Flashcards
════════════════════════════════ */
.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  padding: 1rem 1.2rem;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.flashcard {
  background: var(--paper);
  border: 3px solid transparent;
  border-radius: var(--radius);
  padding: 1.2rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: 0 3px 12px var(--shadow);
  min-height: 150px;
  position: relative;
}
.flashcard:hover, .flashcard:focus-visible {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 8px 24px var(--shadow-md);
  border-color: var(--teal);
  outline: none;
}
.flashcard.active-card {
  border-color: var(--sun);
  background: #FFFBE6;
  box-shadow: 0 0 0 4px rgba(246,201,69,0.3);
}
.flashcard-svg-wrap {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flashcard-svg-wrap svg { width: 80px; height: 80px; }
.flashcard-name {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--ink);
  text-align: center;
  transition: opacity 0.2s;
}
.flashcard-name.hidden-name { opacity: 0; }

.act-adult-note {
  padding: 0.75rem 1.2rem 1.2rem;
  text-align: center;
}
.btn-adult-toggle {
  background: none;
  border: 1.5px solid var(--wood);
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
  font-size: 0.82rem;
  color: var(--wood);
  cursor: pointer;
  transition: all 0.18s;
}
.btn-adult-toggle:hover { background: var(--wood); color: white; }
.adult-reveal {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  padding: 0.5rem;
  background: #FFF8EE;
  border-radius: var(--radius-sm);
  border: 1px solid var(--sun);
}
.adult-text {
  font-size: 0.9rem;
  color: var(--ink-soft);
  padding: 0.4rem 0.8rem;
  background: #FFF8EE;
  border-radius: var(--radius-sm);
  border: 1px solid var(--sun);
  margin-top: 0.5rem;
}

/* ════════════════════════════════
   ACTIVIDAD 2 · Escucha y elige
════════════════════════════════ */
.act2-question-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1.2rem;
  gap: 0.5rem;
}
.btn-listen-q {
  font-size: 1.05rem;
  padding: 0.7rem 1.5rem;
}

.choices-grid {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.75rem 1.2rem 1rem;
}
.choice-card {
  background: var(--paper);
  border: 3px solid var(--bg);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: 0 3px 12px var(--shadow);
  min-width: 130px;
  min-height: 150px;
}
.choice-card:hover, .choice-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--teal);
  outline: none;
}
.choice-card.correct {
  border-color: var(--teal);
  background: #E8F7F7;
  box-shadow: 0 0 0 4px rgba(30,140,140,0.2);
}
.choice-card.incorrect {
  border-color: var(--coral);
  background: #FEF0F2;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ════════════════════════════════
   ACTIVIDAD 3 · Sala interactiva
════════════════════════════════ */
.act3-q-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1.2rem;
  gap: 0.6rem;
}
/* Pregunta principal Act3 — grande y clara para el niño */
.act3-question-display {
  font-family: var(--font-title);
  font-size: 1.45rem;
  color: var(--teal);
  font-weight: 700;
  text-align: center;
  background: #EEF9F7;
  border: 2px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.2rem;
  min-height: 2.4rem;
  width: 100%;
  max-width: 480px;
  letter-spacing: 0.01em;
}
.room-scene-wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem 1rem;
}
.room-scene-wrap svg { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }
.room-hotspot { cursor: pointer; transition: opacity 0.2s; }
.room-hotspot:hover { opacity: 0.85; }
.room-hotspot.correct-hs { filter: drop-shadow(0 0 8px rgba(30,140,140,0.8)); }
.room-hotspot.incorrect-hs { filter: drop-shadow(0 0 8px rgba(232,87,111,0.8)); }

/* ════════════════════════════════
   FEEDBACK AREA
════════════════════════════════ */
.feedback-area {
  min-height: 3rem;
  padding: 0.5rem 1.2rem;
  text-align: center;
  font-family: var(--font-title);
  font-size: 1.05rem;
  color: var(--teal);
}
.feedback-correct { color: var(--teal); }
.feedback-try-again { color: var(--coral); }

/* ════════════════════════════════
   ACTIVIDAD 5 · Rol
════════════════════════════════ */
.act5-cards { max-width: 680px; margin: 0 auto; }
.act5-play {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 0.5rem 1.2rem;
  box-shadow: 0 4px 16px var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.selected-card-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.act5-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 300px;
}

/* ════════════════════════════════
   ACTIVIDAD 6 · Buscamos en tu casa
════════════════════════════════ */
.act6-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.75rem 1.2rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.act6-section {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  box-shadow: 0 3px 12px var(--shadow);
}
.act6-section h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--teal);
  margin-bottom: 0.4rem;
}
.act6-section p {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
}
.act6-obj-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.act6-obj-btn {
  background: var(--bg);
  border: 2px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.1rem;
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  min-width: 90px;
}
.act6-obj-btn:hover { background: var(--teal); color: white; transform: translateY(-2px); }
.act6-obj-btn { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.act6-obj-img {
  display: block;
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 6px;
}
.act6-note {
  padding: 0.75rem 1.5rem 1.5rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.8;
  max-width: 640px;
  margin: 0 auto;
}

/* ════════════════════════════════
   GUÍA PARA FAMILIAS
════════════════════════════════ */
.guide-content {
  padding: 1.2rem;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.guide-intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 560px) { .guide-intro { grid-template-columns: 1fr; } }
.guide-col {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 3px 10px var(--shadow);
}
.guide-col h3 {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--teal);
  margin-bottom: 0.5rem;
}
.guide-section-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--teal);
}
.guide-tips {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.guide-tip {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  box-shadow: 0 2px 6px var(--shadow);
}
.guide-note {
  background: #FFF8EE;
  border: 1.5px solid var(--sun);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.guide-audio-status {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: 0 3px 10px var(--shadow);
}
.guide-audio-status h3 {
  font-family: var(--font-title);
  color: var(--teal);
  margin-bottom: 0.6rem;
}
.audio-pending-notice {
  background: #FFF3CD;
  border: 1.5px solid #FBBF24;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #92400E;
  margin-bottom: 0.75rem;
}
.manifest-summary {
  font-size: 0.8rem;
  color: var(--ink-soft);
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
}

/* ════════════════════════════════
   ACTIVIDADES — menú principal
════════════════════════════════ */
#screen-activities {
  background: var(--bg);
}
.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1.2rem;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.act-card {
  background: var(--paper);
  border: 3px solid var(--bg);
  border-radius: var(--radius);
  padding: 1.3rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: 0 4px 14px var(--shadow);
  text-align: center;
}
.act-card:hover, .act-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--teal);
  box-shadow: 0 8px 24px var(--shadow-md);
  outline: none;
}
.act-number {
  font-family: var(--font-title);
  font-size: 0.72rem;
  color: var(--teal);
  opacity: 0.7;
  letter-spacing: 0.05em;
}
.act-icon { font-size: 2rem; }
.act-title {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--ink);
  font-weight: 700;
}
.act-desc {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* ════════════════════════════════
   HIGHLIGHT ANIMATIONS
════════════════════════════════ */
.highlight-ring {
  transition: opacity 0.3s ease;
}
.highlight-ring.visible {
  opacity: 1;
  animation: pulseRing 1.5s ease-in-out 2;
}
@keyframes pulseRing {
  0%, 100% { opacity: 1; stroke-width: 3; }
  50%       { opacity: 0.5; stroke-width: 5; }
}

/* ── Object animations ── */
@media (prefers-reduced-motion: no-preference) {
  .anim-tilt    { transform-origin: center; }
  .anim-tilt.animate    { animation: tilt 1.2s ease-in-out; }
  @keyframes tilt {
    0%,100% { transform: rotate(0deg); }
    30%     { transform: rotate(-8deg); }
    70%     { transform: rotate(6deg); }
  }
  .anim-compress.animate { animation: compress 1s ease-in-out; }
  @keyframes compress {
    0%,100% { transform: scaleY(1); }
    40%     { transform: scaleY(0.85); }
    70%     { transform: scaleY(1.05); }
  }
  .anim-wave.animate { animation: wave 1.3s ease-in-out; }
  @keyframes wave {
    0%,100% { transform: skewX(0deg); }
    30%     { transform: skewX(-3deg); }
    70%     { transform: skewX(2deg); }
  }
  .anim-bounce.animate { animation: bounce 0.9s cubic-bezier(0.34,1.5,0.64,1); }
  @keyframes bounce {
    0%,100% { transform: translateY(0); }
    40%     { transform: translateY(-18px); }
    70%     { transform: translateY(-8px); }
  }
  .anim-roll.animate { animation: roll 1.2s ease-in-out; }
  @keyframes roll {
    from { transform: translateX(-30px) rotate(-30deg); }
    to   { transform: translateX(0) rotate(0deg); }
  }
  .anim-glow.animate { animation: glowPulse 1.2s ease-in-out; }
  @keyframes glowPulse {
    0%,100% { filter: brightness(1); }
    50%     { filter: brightness(1.25) drop-shadow(0 0 8px rgba(30,140,140,0.6)); }
  }
  .anim-ripple.animate { animation: rippleAnim 1.4s ease-in-out; }
  @keyframes rippleAnim {
    0%,100% { transform: scaleX(1); }
    30%     { transform: scaleX(1.04); }
    60%     { transform: scaleX(0.97); }
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .anim-tilt.animate,
  .anim-compress.animate,
  .anim-wave.animate,
  .anim-bounce.animate,
  .anim-roll.animate,
  .anim-glow.animate,
  .anim-ripple.animate { animation: none; }
  .book-page { transition: none; }
}

/* ── Utilities ── */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ── Focus visible ── */
*:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--teal-light); border-radius: 3px; }

/* ════════════════════════════════
   RESPONSIVE · MOBILE
════════════════════════════════ */
@media (max-width: 480px) {
  .home-title { font-size: 1.9rem; }
  .btn-main { font-size: 1rem; padding: 0.85rem 1.1rem; }
  .book-header { padding: 0.6rem 0.75rem; }
  .scene-svg { max-height: 220px; }
  .scene-img { max-height: 220px; }
  .text-q-es { font-size: 1.2rem; }
  .text-es { font-size: 1.15rem; }
  .book-controls { padding: 0.6rem 0.75rem; }
  .btn-ctrl { font-size: 0.78rem; padding: 0.42rem 0.7rem; }
  .activities-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; padding: 0.85rem; }
  .act-icon { font-size: 1.6rem; }
  .flashcard-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; padding: 0.75rem; }
  .choices-grid { gap: 0.75rem; }
  .choice-card { min-width: 110px; min-height: 130px; }
}


/* ════════════════════════════════════════════════
   PLANTILLA v2 — añadidos para temas dirigidos por datos
════════════════════════════════════════════════ */
[hidden] { display: none !important; }

.app-error {
  margin: 2rem auto; max-width: 560px; padding: 1rem 1.25rem; border-radius: var(--radius-sm);
  background: #fde8e8; color: #7a1f1f; border: 2px solid var(--coral); font-weight: 700;
}

/* Marcador cuando falta una imagen del tema (se ve el nombre del archivo esperado) */
.img-missing {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  background: repeating-linear-gradient(45deg, var(--cream), var(--cream) 10px, var(--bg-alt) 10px, var(--bg-alt) 20px);
  border: 2px dashed var(--teal-light); border-radius: 8px; color: var(--ink-soft);
  text-align: center; min-height: 64px; min-width: 64px;
}
.img-missing .im-emoji { font-size: 2rem; line-height: 1; }
.img-missing small { font-size: 0.7rem; word-break: break-all; padding: 0 0.3rem; }
.page-illustration .img-missing { width: 100%; height: 100%; min-height: 200px; }
.card-img { width: 80px; height: 80px; object-fit: contain; display: block; }
.card-img.img-missing small, .act6-obj-img.img-missing small, .hs .img-missing small { display: none; }
.card-img-sm { width: 40px; height: 40px; }
.hint-card { display: inline-block; vertical-align: middle; width: 40px; height: 40px; }

/* Actividad 3: escenario con zonas interactivas en HTML (coordenadas en % de la imagen) */
.scene-stage { position: relative; width: 100%; line-height: 0; border-radius: var(--radius-sm); overflow: hidden; }
.room-bg { width: 100%; height: auto; display: block; }
.scene-stage .img-missing { width: 100%; aspect-ratio: 3 / 2; border-radius: 0; border-style: solid; }
.hs {
  position: absolute; transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.10); border: 2.5px dashed rgba(255,255,255,0.6); border-radius: 8px;
  padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s, box-shadow 0.2s;
}
.hs-ellipse { border-radius: 50%; }
.hs:hover { opacity: 0.85; }
.hs:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.hs .hs-card { width: 36px; max-width: 70%; height: auto; opacity: 0.88; pointer-events: none; }
.hs .img-missing { width: 36px; height: 36px; min-width: 0; min-height: 0; border: none; background: none; }
.hs.correct-hs { box-shadow: 0 0 14px 4px rgba(30,140,140,0.8); }
.hs.incorrect-hs { box-shadow: 0 0 14px 4px rgba(232,87,111,0.8); }
.scene-stage.edit { cursor: crosshair; }
.scene-stage.edit .hs { border-color: var(--sun); background: rgba(246,201,69,0.18); }
.hs-tag { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-style: normal;
  font: 700 0.7rem/1.2 var(--font-body); background: var(--ink); color: #fff; padding: 1px 5px; border-radius: 4px; }

/* Anillo de resalte opcional al revelar la respuesta (scene.focus) */
.page-illustration { position: relative; }
.focus-ring {
  position: absolute; border: 4px solid var(--sun); border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.7), 0 0 18px 6px rgba(246,201,69,0.7);
}
.focus-ring.pulse { animation: ringPulse 1.2s ease-in-out 3; }
@keyframes ringPulse { 50% { transform: scale(1.12); } }

/* Botón 🔊 junto a la instrucción de cada actividad */
.btn-instr {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 2.4rem; height: 2.4rem; margin-left: 0.5rem; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--teal); background: var(--paper); font-size: 1.1rem; line-height: 1;
  transition: transform 0.15s;
}
.btn-instr:hover { transform: scale(1.08); }
.btn-instr:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

.guide-about { margin-top: 1.5rem; padding: 1rem 1.2rem; background: var(--paper); border-radius: var(--radius-sm);
  font-size: 0.9rem; color: var(--ink-soft); }
.guide-about p { margin: 0.35rem 0; }
.guide-about .guide-section-title { margin-top: 0; }
