/* Lenguajes 1° — estilos para iPad (11", vertical y horizontal) */

@font-face {
  font-family: 'Andika';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../vendor/fonts/andika-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Andika';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../vendor/fonts/andika-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Andika';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../vendor/fonts/andika-700-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Andika';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../vendor/fonts/andika-700-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --color: #2f7fe0;
  --fondo: #fff7e8;
  --tinta: #26283a;
  --tinta-suave: #5d6275;
  --tarjeta: #ffffff;
  --borde: #eadfc9;
  --borde-fuerte: #d6c7aa;
  --bien: #1b9450;
  --bien-fondo: #e2f6e9;
  --bien-oscuro: #10552f;
  --mal: #dc3d43;
  --mal-fondo: #fdeaea;
  --mal-oscuro: #8f1d22;
  --sel: #f7c600;
  --sel-fondo: #fff3bf;
  --radio: 22px;
  /* iPad 11": ~27px en vertical, ~24px en horizontal */
  font-size: clamp(17px, min(1.9vw + 11px, 2.2vh + 6px), 28px);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--fondo);
  background-image: radial-gradient(circle at 1px 1px, rgba(120, 90, 30, .09) 1.5px, transparent 0);
  background-size: 28px 28px;
  color: var(--tinta);
  font-family: 'Andika', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input, textarea { -webkit-user-select: text; user-select: text; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.oculto { visibility: hidden; }

/* ---------- Barra superior ---------- */
.barra {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: calc(.45rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .45rem max(1rem, env(safe-area-inset-left));
  background: var(--color-barra, var(--color));
  color: #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .12);
}
.barra-titulo {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 1.02rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-icono {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, .24);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  text-decoration: none;
}
.btn-icono:active { transform: scale(.94); }
.barra-cuenta:empty { display: none; }
.barra-cuenta {
  flex: none;
  font-weight: 700;
  font-size: .95rem;
  background: rgba(255, 255, 255, .24);
  border-radius: 999px;
  padding: .2rem .8rem;
  white-space: nowrap;
}
.progreso {
  height: 10px;
  background: color-mix(in srgb, var(--color-barra, var(--color)) 22%, white);
}
.progreso > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--sel);
  border-radius: 0 6px 6px 0;
  transition: width .4s ease;
}

/* ---------- Contenido ---------- */
.contenido {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: .9rem;
  min-height: calc(100dvh - 3.6rem - 10px);
}

.tarjeta {
  background: var(--tarjeta);
  border: 2px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: 0 8px 0 var(--borde), 0 2px 18px rgba(80, 60, 20, .06);
  padding: 1rem 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chip-tema {
  align-self: flex-start;
  background: color-mix(in srgb, var(--color) 14%, white);
  color: color-mix(in srgb, var(--color) 70%, black);
  border-radius: 999px;
  padding: .15rem .8rem;
  font-size: .85rem;
  font-weight: 700;
}

.instruccion {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
}
.instruccion h2 {
  margin: .25rem 0 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.btn-voz {
  flex: none;
  width: 2.8rem;
  height: 2.8rem;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color) 15%, white);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--color) 38%, white);
  font-size: 1.35rem;
  display: grid;
  place-items: center;
}
.btn-voz.chico { width: 2.1rem; height: 2.1rem; font-size: 1rem; box-shadow: 0 3px 0 color-mix(in srgb, var(--color) 38%, white); }
.btn-voz:active { transform: translateY(3px); box-shadow: none; }
.btn-voz.hablando { animation: latido 1s ease-in-out infinite; background: var(--sel-fondo); }

/* ---------- Enunciado ---------- */
.enunciado {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .8rem;
}
.enunciado:empty { display: none; }

.visual {
  font-size: 5.2rem;
  line-height: 1.15;
  text-align: center;
}
.visual.letra {
  font-weight: 700;
  color: var(--color);
  min-width: 1.5em;
  padding: 0 .2em;
  border: 5px solid color-mix(in srgb, var(--color) 40%, white);
  border-radius: 28px;
  background: #fff;
}
.visual.chico { font-size: 3.6rem; }
.pie-visual {
  margin-top: -.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

.escena { font-size: 3.4rem; line-height: 1.1; letter-spacing: .08em; text-align: center; }
.contexto {
  margin: 0;
  font-size: 1.1rem;
  text-align: center;
  color: var(--tinta-suave);
}

.cajas {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: center;
}
.caja {
  width: 2.4em;
  height: 2.4em;
  font-size: 2rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 4px solid var(--color);
  border-radius: 18px;
  background: #fff;
}
.caja.hueco {
  display: grid;
  min-width: 0;
  margin: 0;
  line-height: 1;
  border-bottom-width: 4px;
  border-style: dashed;
  color: var(--tinta-suave);
  background: var(--sel-fondo);
}
.caja.hueco.lleno {
  border-style: solid;
  border-color: var(--bien);
  color: var(--bien);
  background: var(--bien-fondo);
}
.flecha { font-size: 1.8rem; align-self: center; color: var(--tinta-suave); }

.frase {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.75;
  text-align: center;
}
.hueco {
  display: inline-block;
  min-width: 4em;
  border-bottom: 4px solid var(--color);
  margin: 0 .15em;
  line-height: 1.2;
}
.hueco.lleno {
  min-width: 0;
  padding: 0 .2em;
  color: var(--bien);
  border-color: var(--bien);
  font-weight: 700;
}

.lectura {
  width: 100%;
  background: #fffcf2;
  border: 2px solid #f0e1bb;
  border-radius: 18px;
  padding: .8rem 1.1rem;
  font-size: 1.08rem;
  line-height: 1.7;
}
.lectura h3 {
  margin: 0 0 .25rem;
  color: var(--color);
  font-size: 1.2rem;
  text-align: center;
}
.lectura p { margin: 0; }
.lectura .moraleja { margin-top: .45rem; }

.dialogo {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.globo-fila { display: flex; align-items: center; gap: .7rem; }
.globo-fila.derecha { flex-direction: row-reverse; }
.quien { font-size: 2.8rem; line-height: 1; flex: none; }
.globo {
  flex: 1;
  background: #fff;
  border: 3px solid var(--borde-fuerte);
  border-radius: 22px;
  padding: .6rem 1rem;
  font-size: 1.15rem;
  line-height: 1.6;
}

/* ---------- Opciones ---------- */
.zona { display: flex; flex-direction: column; align-items: stretch; gap: .9rem; }

.opciones {
  display: grid;
  gap: .85rem;
  width: 100%;
}
.opciones.cortas { grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.opciones.largas { grid-template-columns: 1fr; }
.opciones.notas { grid-template-columns: 1fr 1fr; }
.opciones.personas { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.opciones.lista { grid-template-columns: 1fr; max-width: 26rem; margin: 0 auto; counter-reset: renglon; }
.opciones.letras {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.op {
  min-height: 3.1rem;
  padding: .55rem 1rem;
  border: 3px solid var(--borde-fuerte);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 5px 0 var(--borde-fuerte);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  text-align: center;
  transition: background-color .15s, border-color .15s;
}
.op:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--borde-fuerte); }
.op:disabled { cursor: default; }
.op-emoji { font-size: 1.55em; line-height: 1; }

.opciones.letras .op {
  width: 2.3em;
  height: 2.3em;
  padding: 0;
  font-size: 2.4rem;
}
.opciones.largas .op { justify-content: flex-start; text-align: left; font-weight: 400; }
.opciones.personas .op { flex-direction: column; gap: .2rem; padding: .8rem; }
.opciones.personas .op-emoji { font-size: 2.6em; }
.opciones.notas .op {
  white-space: pre-line;
  text-align: left;
  align-items: flex-start;
  justify-content: flex-start;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.55;
  background: #fffcf2;
  padding: .8rem 1rem;
}
.opciones.lista .op { justify-content: flex-start; counter-increment: renglon; }
.opciones.lista .op::before {
  content: counter(renglon) ")";
  color: var(--tinta-suave);
  font-weight: 400;
  min-width: 1.6em;
  text-align: left;
}

.op.seleccionada {
  border-color: var(--color);
  background: color-mix(in srgb, var(--color) 13%, white);
  box-shadow: 0 5px 0 var(--color);
}
.multi .op.seleccionada::after { content: '✓'; color: var(--color); font-weight: 700; }
.op.correcta {
  border-color: var(--bien);
  background: var(--bien-fondo);
  box-shadow: 0 5px 0 var(--bien);
  color: var(--bien-oscuro);
  animation: pop .35s ease;
}
.op.incorrecta {
  border-color: var(--mal);
  background: var(--mal-fondo);
  box-shadow: 0 5px 0 var(--mal);
  color: var(--mal-oscuro);
}
.op.faltante { border-style: dashed; border-color: var(--bien); }
.resuelta .op:not(.correcta):not(.incorrecta):not(.hecha) { opacity: .5; }

/* ---------- Fichas (ordenar / clasificar) ---------- */
.ordenar, .clasificar { display: flex; flex-direction: column; gap: .9rem; }

.fichas {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  justify-content: center;
  align-content: flex-start;
  width: 100%;
  min-height: 3.8rem;
  padding: .7rem;
  border-radius: 18px;
}
.fichas.banco {
  background: color-mix(in srgb, var(--color) 7%, white);
  border: 2px dashed color-mix(in srgb, var(--color) 32%, white);
}
.fichas.banco:empty::before {
  content: '¡Listo! Toca «Revisar».';
  margin: auto;
  color: var(--tinta-suave);
  font-size: .95rem;
}
.fichas.respuesta {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  counter-reset: n;
  background: #fff;
  border: 3px dashed var(--borde-fuerte);
  min-height: 5rem;
}
.fichas.respuesta.letras { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; }
.fichas.respuesta:empty::before {
  content: attr(data-vacio);
  margin: auto;
  color: var(--tinta-suave);
  font-size: .95rem;
  text-align: center;
}

.ficha {
  background: #fff;
  border: 3px solid var(--borde-fuerte);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--borde-fuerte);
  padding: .45rem 1rem;
  min-height: 2.7rem;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  touch-action: none;
}
.ficha .op-emoji { font-size: 1.35em; }
.respuesta > .ficha { counter-increment: n; }
.respuesta > .ficha::before {
  content: counter(n);
  flex: none;
  width: 1.7em;
  height: 1.7em;
  border-radius: 50%;
  background: var(--color);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .82em;
}
.respuesta.partes > .ficha { flex-direction: column; align-items: flex-start; gap: .25rem; }
.respuesta.partes > .ficha::before { width: auto; height: auto; border-radius: 999px; padding: .05em .7em; font-size: .72em; }
.respuesta.partes > .ficha:nth-child(1)::before { content: 'Inicio'; }
.respuesta.partes > .ficha:nth-child(2)::before { content: 'Desarrollo'; }
.respuesta.partes > .ficha:nth-child(3)::before { content: 'Final'; }
.letras > .ficha { font-size: 2rem; min-width: 2.2em; justify-content: center; padding: .3rem .6rem; }
.respuesta.letras > .ficha { flex-direction: column; gap: 0; }
.respuesta.letras > .ficha::before { width: 1.3em; height: 1.3em; font-size: .4em; }
.ficha u { text-decoration-thickness: .12em; text-underline-offset: .18em; text-decoration-color: var(--color); }
.ficha .estrella-nombre { font-size: .9em; }

.ficha.seleccionada {
  border-color: var(--color);
  box-shadow: 0 4px 0 var(--color);
  background: color-mix(in srgb, var(--color) 12%, white);
  transform: translateY(-3px);
}
.ficha.correcta {
  border-color: var(--bien);
  background: var(--bien-fondo);
  box-shadow: 0 4px 0 var(--bien);
  color: var(--bien-oscuro);
  animation: pop .35s ease;
}
.ficha.incorrecta {
  border-color: var(--mal);
  background: var(--mal-fondo);
  box-shadow: 0 4px 0 var(--mal);
  color: var(--mal-oscuro);
}
.sortable-ghost { opacity: .35; }
.sortable-fallback { opacity: .95 !important; box-shadow: 0 12px 24px rgba(0, 0, 0, .18) !important; }

.botes {
  display: grid;
  gap: .8rem;
  width: 100%;
  grid-template-columns: repeat(var(--n, 2), 1fr);
}
.bote {
  border: 3px solid var(--borde-fuerte);
  border-radius: 20px;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s;
}
.bote-titulo {
  background: color-mix(in srgb, var(--color) 12%, white);
  padding: .45rem .5rem;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
}
.bote-emoji { display: block; font-size: 1.9rem; line-height: 1.2; }
.bote-lista {
  flex: 1;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  border-radius: 0;
  min-height: 6.5rem;
}
.bote-lista > .ficha { font-size: 1rem; }
.esperando .bote { border-color: var(--color); border-style: dashed; animation: brillo .9s ease-in-out infinite alternate; }

/* ---------- Parejas ---------- */
.parejas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 3.5rem;
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
}
.parejas .col { display: flex; flex-direction: column; gap: .8rem; }
.parejas .op { font-size: 2.3rem; min-height: 1.9em; padding: 0; }
.op.hecha { color: #fff; border-color: transparent; box-shadow: 0 5px 0 rgba(0, 0, 0, .18); }
.op.par-0 { background: #2f7fe0; }
.op.par-1 { background: #1b9450; }
.op.par-2 { background: #d93a86; }
.op.par-3 { background: #8a4fd6; }
.op.par-4 { background: #e2730d; }
.op.par-5 { background: #0f9b9b; }

/* ---------- Armar palabra ---------- */
.armar { display: flex; flex-direction: column; align-items: center; gap: 1.3rem; }
.casillas, .teclas { display: flex; gap: .55rem; flex-wrap: wrap; justify-content: center; }
.casilla {
  width: 2.1em;
  height: 2.3em;
  font-size: 1.9rem;
  font-weight: 700;
  border: 0;
  border-bottom: 5px solid var(--color);
  border-radius: 12px 12px 4px 4px;
  background: color-mix(in srgb, var(--color) 8%, white);
}
.casilla.correcta { background: var(--bien-fondo); border-color: var(--bien); color: var(--bien-oscuro); }
.casilla.incorrecta { background: var(--mal-fondo); border-color: var(--mal); color: var(--mal-oscuro); }
.tecla {
  width: 2.1em;
  height: 2.1em;
  font-size: 1.9rem;
  font-weight: 700;
  border: 3px solid var(--borde-fuerte);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 5px 0 var(--borde-fuerte);
}
.tecla:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--borde-fuerte); }
.tecla.usada { visibility: hidden; }

/* ---------- Palabras tocables ---------- */
.lectura.tocable { font-size: 1.2rem; line-height: 2.15; }
.pal {
  padding: .12em .1em;
  margin: 0 -.1em;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color .15s;
}
.pal.sel { background: var(--sel-fondo); box-shadow: inset 0 -.22em 0 var(--sel); }
.pal.correcta { background: var(--bien-fondo); box-shadow: inset 0 -.22em 0 var(--bien); }
.pal.incorrecta { background: var(--mal-fondo); box-shadow: inset 0 -.22em 0 var(--mal); }

/* ---------- Pie: mensaje + botón ---------- */
.pie {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 0 calc(.8rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--fondo) 72%, rgba(255, 247, 232, 0));
}
.pie.vacio { display: none; }
.mensaje {
  flex: 1;
  min-height: 1.5em;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.mensaje.bien { color: var(--bien); }
.mensaje.casi { color: #b4570b; }
.mensaje.revelar { color: var(--tinta); }
.mensaje .explicacion {
  display: block;
  font-weight: 400;
  font-size: 1rem;
  color: var(--tinta-suave);
}

.btn {
  flex: none;
  border: 0;
  border-radius: 20px;
  padding: .65rem 1.6rem;
  min-height: 3rem;
  background: var(--color);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--color) 62%, black);
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--color) 62%, black); }
.btn:disabled { opacity: .45; filter: grayscale(.5); cursor: default; }
.btn.grande { font-size: 1.45rem; padding: .8rem 2.4rem; }
.btn.secundario {
  background: #fff;
  color: var(--tinta);
  border: 3px solid var(--borde-fuerte);
  box-shadow: 0 6px 0 var(--borde-fuerte);
}
.btn.peligro { background: var(--mal); box-shadow: 0 5px 0 var(--mal-oscuro); }

/* ---------- Menú ---------- */
.portada {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
  padding: calc(1rem + env(safe-area-inset-top)) 4rem .2rem;
}
.portada h1 { margin: 0; font-size: 1.8rem; line-height: 1.2; }
.portada .btn-icono.volver { right: auto; left: max(1rem, env(safe-area-inset-left)); }
.portada p { margin: .3rem 0 0; color: var(--tinta-suave); font-size: 1.05rem; }
.portada .btn-icono {
  position: absolute;
  top: calc(1.2rem + env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  background: #fff;
  color: var(--tinta);
  border: 2px solid var(--borde-fuerte);
}

.temas {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}
@media (orientation: landscape) and (min-width: 960px) {
  .temas { grid-template-columns: repeat(4, 1fr); }
}
.tema-card {
  color: var(--tinta);
  text-decoration: none;
  background: #fff;
  border: 3px solid color-mix(in srgb, var(--color) 38%, white);
  border-radius: 24px;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--color) 55%, white);
  padding: .7rem .8rem .6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: .25rem;
  min-height: 8rem;
}
.tema-card:active { transform: translateY(5px); box-shadow: 0 2px 0 color-mix(in srgb, var(--color) 55%, white); }
.tema-card .icono {
  font-size: 2.1rem;
  width: 1.65em;
  height: 1.65em;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color) 14%, white);
  display: grid;
  place-items: center;
}
.tema-card .texto { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.tema-card .nombre { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.tema-card .pag { font-size: .8rem; color: var(--tinta-suave); }
.tema-card.examen { background: color-mix(in srgb, var(--color) 16%, white); }
.estrellas { font-size: 1.05rem; letter-spacing: .08em; }
.estrellas .apagada { filter: grayscale(1); opacity: .28; }
/* En vertical el ícono va a un lado para que los 8 temas quepan sin desplazarse. */
@media (orientation: portrait) {
  .tema-card { flex-direction: row; justify-content: flex-start; text-align: left; gap: .8rem; min-height: 0; padding: .9rem 1rem; }
  .tema-card .icono { flex: none; }
  .tema-card .texto { align-items: flex-start; }
}

/* ---------- Intro y final ---------- */
.intro, .final {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  padding: 1.2rem 0 2rem;
}
.intro-icono { font-size: 4.6rem; line-height: 1.1; }
.intro h1, .final h1 { margin: 0; font-size: 1.9rem; line-height: 1.2; }
.intro .pagina { margin: -.6rem 0 0; color: var(--tinta-suave); font-size: .95rem; }
.recuerda {
  max-width: 42rem;
  text-align: left;
  background: #fff;
  border: 3px solid color-mix(in srgb, var(--color) 35%, white);
  border-radius: 22px;
  padding: 1rem 1.2rem;
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  font-size: 1.1rem;
  line-height: 1.55;
}
.recuerda p { margin: 0; }
.nota-intro { margin: 0; color: var(--tinta-suave); font-size: .95rem; }

.estrellas-final { font-size: 4.2rem; letter-spacing: .1em; line-height: 1.1; }
.estrellas-final span { display: inline-block; animation: aparecer .5s ease both; }
.estrellas-final span:nth-child(2) { animation-delay: .25s; }
.estrellas-final span:nth-child(3) { animation-delay: .5s; }
.estrellas-final .apagada { filter: grayscale(1); opacity: .25; }
.final .puntaje { margin: 0; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; gap: .6rem; }
.acciones { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin-top: .5rem; }

.resumen {
  width: 100%;
  max-width: 34rem;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  text-align: left;
}
.resumen li {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: #fff;
  border: 2px solid var(--borde);
  border-radius: 16px;
  padding: .5rem .8rem;
  font-size: 1.02rem;
}
.resumen .r-icono { font-size: 1.5rem; }
.resumen .r-nombre { flex: 1; font-weight: 700; }
.resumen .r-ok { color: var(--bien); font-weight: 700; white-space: nowrap; }
.resumen .r-mal { color: var(--mal); font-weight: 700; white-space: nowrap; }
.resumen a { color: inherit; }
.repasa { margin: 0; font-size: 1.05rem; }

/* ---------- Ajustes ---------- */
dialog.ajustes {
  border: 0;
  border-radius: 24px;
  padding: 1.4rem 1.5rem;
  width: min(92vw, 32rem);
  color: var(--tinta);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  font-size: .95rem;
}
dialog.ajustes::backdrop { background: rgba(30, 30, 50, .45); }
dialog.ajustes h2 { margin: 0 0 .2rem; font-size: 1.3rem; }
dialog.ajustes .ayuda { margin: 0 0 1rem; color: var(--tinta-suave); font-size: .85rem; }
.campo { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; font-weight: 700; }
.campo input[type="text"] {
  font: inherit;
  font-weight: 400;
  font-size: 1.1rem;
  padding: .55rem .8rem;
  border-radius: 12px;
  border: 2px solid var(--borde-fuerte);
  width: 100%;
}
.interruptor { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; font-weight: 700; }
.interruptor input { width: 1.4rem; height: 1.4rem; accent-color: var(--color); }
.fila-botones { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: .5rem; }
.fila-botones .btn { font-size: 1rem; min-height: 2.6rem; padding: .5rem 1.1rem; }
.info-voz { font-size: .85rem; color: var(--tinta-suave); margin: 0 0 1rem; }

/* ---------- Prueba ---------- */
.prueba { max-width: 1000px; margin: 0 auto; padding: 1rem; font-size: 15px; -webkit-user-select: text; user-select: text; }
.prueba table { border-collapse: collapse; width: 100%; background: #fff; }
.prueba th, .prueba td { border: 1px solid var(--borde); padding: 4px 8px; text-align: left; vertical-align: top; }
.prueba .ok { color: var(--bien); font-weight: 700; }
.prueba .falla { color: var(--mal); font-weight: 700; }
.prueba pre { white-space: pre-wrap; font-size: 12px; margin: 0; }

/* ---------- Ajustes de orientación ---------- */
@media (orientation: landscape) {
  .clasificar .ficha { font-size: 1rem; min-height: 2.3rem; padding: .35rem .8rem; }
  .clasificar .fichas { gap: .5rem; padding: .5rem; }
  .bote-titulo { padding: .3rem .5rem; }
  .bote-emoji { display: inline; font-size: 1.4rem; margin-right: .35rem; vertical-align: middle; }
  .bote-lista { min-height: 4rem; }
  .parejas { gap: .6rem 3rem; }
  .parejas .col { gap: .6rem; }
  .parejas .op { font-size: 2rem; min-height: 1.6em; }
  .ordenar.vertical { flex-direction: row; align-items: stretch; }
  .ordenar.vertical > .fichas { flex: 1; }
  .visual { font-size: 4.4rem; }
  .escena { font-size: 2.9rem; }
}
@media (max-width: 640px) {
  .opciones.notas { grid-template-columns: 1fr; }
  .botes { grid-template-columns: 1fr; }
  .portada { padding-left: 1rem; padding-right: 3.5rem; }
  .portada:has(.volver) { padding-left: 3.5rem; }
  .parejas { gap: .8rem 1.5rem; }
}

/* ---------- Animaciones ---------- */
@keyframes sacudir {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.sacudir { animation: sacudir .45s ease; }
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.07); }
  100% { transform: scale(1); }
}
@keyframes latido { 50% { transform: scale(1.12); } }
@keyframes brillo { from { background-color: #fff; } to { background-color: color-mix(in srgb, var(--color) 8%, white); } }
@keyframes aparecer {
  from { transform: scale(.2) rotate(-30deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
