/* ==========================================================================
   CAZA ACENTOS · PlayLab Games
   style.css
   --------------------------------------------------------------------------
   Dirección visual: "laboratorio de palabras".
   · Fondo azul noche con papel cuadriculado de laboratorio muy suave
   · Las palabras son FICHAS de letras (el elemento protagonista)
   · Amarillo tilde como acento, coral para la tilde de Tildín
   · Aguda = rojo · Llana = verde · Esdrújula = morado (siempre con texto)
   · Botones grandes con relieve, como el resto de juegos PlayLab
   Índice: 1 Base · 2 Botones · 3 Inicio · 4 Paneles · 5 Niveles/Misión
           6 Partida · 7 Feedback · 8 Ayuda · 9 Ranking/Opciones
           10 Modales · 11 Tildín · 12 Efectos · 13 Animaciones · 14 Responsive
   ========================================================================== */

/* ---------- 1. BASE ---------- */
:root {
  --noche-1: #2b45b3;
  --noche-2: #1f2f7a;
  --noche-3: #152258;
  --papel: #fff8e6;
  --papel-2: #fdecc0;
  --tinta: #231f4f;
  --tinta-suave: #5d5889;
  --tilde: #ffcc2e;
  --tilde-osc: #e0a800;
  --coral: #ff5470;
  --menta: #2fc98e;
  --cielo: #3aa6ff;
  --naranja: #ff8a3d;
  --morado: #8b5cf6;
  --aguda: #ef4058;
  --llana: #22ad6a;
  --esdrujula: #8b5cf6;

  --radio: 20px;
  --marca-w: 66px;
  --marca-h: calc(var(--marca-w) * .74);
  --fuente: "Fredoka", "Nunito", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", sans-serif;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 700px) { :root { --marca-w: 96px; } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  min-height: 100vh; min-height: 100dvh;
  font-family: var(--fuente);
  font-size: 16px;
  line-height: 1.35;
  color: var(--tinta);
  background-color: var(--noche-2);
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px),
    radial-gradient(1100px 520px at 50% -8%, #4f6cf0 0%, transparent 62%),
    linear-gradient(var(--noche-1), var(--noche-2) 55%, var(--noche-3));
  background-size: 28px 28px, 28px 28px, 100% 100%, 100% 100%;
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 4px solid var(--tilde); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sin-js { color: #fff; text-align: center; padding: 2rem; }

/* Marca PlayLab (pequeña, arriba a la izquierda) */
.marca {
  position: fixed; z-index: 20;
  top: max(8px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left));
  width: var(--marca-w);
  pointer-events: none;
}
.marca img { display: block; width: 100%; height: auto; filter: drop-shadow(0 3px 0 rgba(21, 34, 88, .45)); }
body[data-pantalla="inicio"] .marca { display: none; }
body[data-pantalla="juego"] { --marca-w: 58px; }

/* Pantallas */
.pantalla { display: none; }
.pantalla.activa {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(var(--marca-h) + 22px) 16px 28px;
}
#pantalla-inicio.activa { padding-top: 16px; justify-content: center; }
.pantalla.activa > .panel { animation: aparecer .35s ease-out both; }

/* ---------- 2. BOTONES ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 54px; padding: 10px 24px;
  border: 0; border-radius: var(--radio);
  font-weight: 700; font-size: 1.1rem; letter-spacing: .02em; text-align: center;
  color: #fff; background: var(--cielo);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .28);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
  touch-action: manipulation; user-select: none;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .28); }
.btn:disabled { filter: grayscale(.7) brightness(.9); opacity: .6; cursor: not-allowed; transform: none; }
.btn-jugar { background: var(--menta); }
.btn-naranja { background: var(--naranja); }
.btn-azul { background: var(--noche-2); }
.btn-morado { background: var(--morado); }
.btn-coral { background: var(--coral); }
.btn-pista { background: var(--tilde); color: var(--tinta); }
.btn-grande { min-height: 64px; font-size: 1.3rem; padding-inline: 32px; }
.btn-icono {
  display: inline-grid; place-items: center;
  width: 54px; height: 54px; flex: none;
  border: 0; border-radius: var(--radio);
  background: #fff; font-size: 1.45rem; line-height: 1;
  box-shadow: 0 5px 0 rgba(21, 34, 88, .45);
  touch-action: manipulation;
}
.btn-icono:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(21, 34, 88, .45); }
.btn-icono[aria-pressed="false"] { background: #d9dcf0; filter: grayscale(1); opacity: .8; }
.enlace { background: none; border: 0; padding: 2px 4px; font-weight: 600; color: var(--noche-1); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 3. INICIO ---------- */
.inicio { width: 100%; max-width: 620px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.logo-grande {
  width: min(62vw, 270px); height: auto;
  filter: drop-shadow(0 7px 0 rgba(21, 34, 88, .4));
  animation: flotar 4.5s ease-in-out infinite;
}
/* Título hecho con fichas de letras: el elemento protagonista del juego */
.titulo-fichas { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }
.fila-fichas { display: flex; gap: 5px; }
.fila-fichas i, .ficha {
  position: relative;
  display: inline-grid; place-items: center;
  font-style: normal; font-weight: 700; color: var(--tinta);
  background: var(--papel); border-radius: 12px;
  box-shadow: inset 0 -5px 0 var(--papel-2), 0 5px 0 rgba(21, 34, 88, .55);
}
.fila-fichas i { width: clamp(34px, 9.4vw, 52px); height: clamp(42px, 11.4vw, 62px); font-size: clamp(1.5rem, 6.4vw, 2.3rem); padding-bottom: 4px; }
.fila-fichas i:nth-child(odd) { transform: rotate(-3deg); }
.fila-fichas i:nth-child(even) { transform: rotate(2deg); }
/* La tilde de Tildín se posa sobre la E del título */
.fila-fichas .con-tilde::before {
  content: ""; position: absolute; left: 50%; top: -22px; width: 10px; height: 26px; margin-left: -2px;
  background: var(--coral); border-radius: 6px; transform: rotate(35deg);
  box-shadow: 0 3px 0 rgba(21, 34, 88, .5);
  animation: tildeCae 3.6s cubic-bezier(.3, 1.4, .5, 1) infinite;
}
.lema { margin: 4px 0 0; color: #fff; font-size: 1.12rem; font-weight: 500; text-shadow: 0 2px 0 rgba(21, 34, 88, .6); }
.inicio-cuerpo { display: flex; align-items: flex-end; justify-content: center; gap: 12px; width: 100%; margin-top: 6px; }
.tildin-hueco { flex: none; width: 118px; display: none; }
@media (min-width: 560px) { .tildin-hueco { display: block; } }
.menu { display: flex; flex-direction: column; gap: 12px; width: min(100%, 380px); }
.menu .btn { width: 100%; }
.menu-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-fila .btn { padding-inline: 8px; font-size: 1rem; }

/* Letras y tildes flotando de fondo (solo en el inicio) */
.flotantes { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; display: none; }
body[data-pantalla="inicio"] .flotantes { display: block; }
.flotantes span {
  position: absolute; bottom: -60px;
  font-weight: 700; color: rgba(255, 255, 255, .13);
  animation: subir linear infinite;
}
.flotantes span.t { width: 9px; height: 26px; border-radius: 6px; background: rgba(255, 204, 46, .38); transform: rotate(35deg); }

/* ---------- 4. PANELES ---------- */
.panel {
  width: 100%; max-width: 640px;
  background: var(--papel);
  border-radius: 26px;
  padding: 22px 20px 20px;
  box-shadow: 0 8px 0 rgba(21, 34, 88, .5);
  border: 3px solid #fff;
}
.panel-ancho { max-width: 1040px; }
.panel-centro { max-width: 520px; }
.panel-mision { max-width: 700px; }
.titulo-pantalla { margin: 0 0 8px; font-size: clamp(1.4rem, 4.5vw, 2rem); font-weight: 700; line-height: 1.15; text-align: center; }
.subtitulo-seccion { margin: 22px 0 10px; font-size: 1.25rem; text-align: center; }
.ayuda-texto { margin: 0 0 14px; text-align: center; color: var(--tinta-suave); font-size: 1.02rem; }
.nota { margin: 12px 0 0; text-align: center; font-size: .9rem; color: var(--tinta-suave); }
.acciones { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 20px; }

/* Nickname */
.campo-nick { display: flex; gap: 10px; align-items: center; justify-content: center; }
.input-nick {
  flex: 1; min-width: 0; max-width: 340px;
  height: 60px; padding: 0 16px;
  border: 4px solid var(--noche-1); border-radius: var(--radio);
  background: #fff; font: 700 1.5rem var(--fuente); text-align: center; letter-spacing: .06em; text-transform: uppercase;
  color: var(--tinta);
}
.input-nick::placeholder { color: #b6b3d4; }
.input-nick:focus { outline: none; border-color: var(--naranja); box-shadow: 0 0 0 4px rgba(255, 138, 61, .3); }
.error { min-height: 1.4em; margin: 10px 0 0; text-align: center; color: #c21f42; font-weight: 600; }

/* ---------- 5. NIVELES Y MISIÓN ---------- */
.jugador-actual { margin: 0 0 16px; text-align: center; color: var(--tinta-suave); }
.niveles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); padding-top: 8px; }
.nivel {
  --c: var(--cielo);
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 16px 16px 14px; text-align: left;
  background: #fff; border: 3px solid #e8e3f8; border-top: 10px solid var(--c);
  border-radius: 22px; box-shadow: 0 5px 0 rgba(21, 34, 88, .25);
  transition: transform .12s ease, box-shadow .12s ease;
  touch-action: manipulation;
}
.nivel:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 8px 0 rgba(21, 34, 88, .25); }
.nivel:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(21, 34, 88, .25); }
.nivel:disabled { opacity: .55; cursor: not-allowed; }
.nivel-cab { display: flex; align-items: center; gap: 12px; }
.nivel-icono {
  display: grid; place-items: center; flex: none;
  width: 54px; height: 54px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 18%, #fff); border: 3px solid var(--c);
  font-size: 1.7rem; line-height: 1;
}
.nivel-nombre { margin: 0; font-size: 1.18rem; font-weight: 700; line-height: 1.1; }
.nivel-edad { margin: 2px 0 0; font-size: .9rem; color: var(--tinta-suave); }
.nivel-mult {
  position: absolute; top: -4px; right: 12px; transform: translateY(-50%);
  background: var(--c); color: #fff; font-weight: 700; font-size: .85rem; padding: 2px 10px; border-radius: 999px;
  border: 2px solid #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
.nivel-aprende { margin: 0; font-size: .95rem; }
.nivel-datos { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.nivel-datos li { font-size: .82rem; font-weight: 600; background: var(--papel); border-radius: 999px; padding: 3px 10px; }
.nivel-mejor { margin: 2px 0 0; font-size: .9rem; color: var(--tinta-suave); min-height: 1.3em; }
.estrellas-fila { letter-spacing: 2px; color: var(--tilde); text-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.estrellas-fila .apagada { color: #d9d6ea; text-shadow: none; }

.mision-etiqueta { margin: 0 0 4px; text-align: center; }
.mision-etiqueta span { display: inline-block; background: var(--coral); color: #fff; font-weight: 700; letter-spacing: .08em; font-size: .85rem; padding: 3px 14px; border-radius: 999px; transform: rotate(-2deg); }
.mision-cuerpo { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; margin: 12px 0; }
.bocadillo {
  position: relative; padding: 12px 16px; background: #fff; border-radius: 18px; border: 3px solid #e4defa;
  font-size: 1.1rem; font-weight: 500;
}
.bocadillo::before {
  content: ""; position: absolute; left: -12px; top: 50%; margin-top: -10px;
  border: 10px solid transparent; border-right: 12px solid #e4defa; border-left: 0;
}
.mision-ejemplo { display: flex; justify-content: center; margin: 6px 0 12px; }
.mision-datos { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mision-datos li { font-weight: 600; background: #fff; border-radius: 999px; padding: 6px 14px; box-shadow: 0 2px 0 rgba(21, 34, 88, .15); }

/* ---------- 6. PARTIDA ---------- */
#pantalla-juego.activa {
  height: 100vh; height: 100dvh; min-height: 0;
  align-items: stretch; overflow: hidden;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.hud { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.hud-acciones { grid-column: 2; grid-row: 1; display: flex; gap: 6px; align-items: center; }
.hud-chips { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: .85fr 1fr .8fr 1.15fr; gap: 6px; }
@media (min-width: 900px) {
  .hud { grid-template-columns: calc(var(--marca-w) + 8px) 1fr auto; }
  .hud-chips { grid-column: 2; grid-row: 1; max-width: 620px; }
  .hud-acciones { grid-column: 3; }
}
.hud .btn, .hud .btn-icono { min-height: 46px; height: 46px; }
.hud .btn-icono { width: 46px; font-size: 1.25rem; }
.hud .btn-pista { padding: 0 14px; font-size: 1rem; }
.cuenta { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--tinta); color: #fff; font-size: .9rem; }
@media (max-width: 480px) {
  .hud .btn-pista .txt { display: none; }
  .hud-acciones { gap: 5px; }
  .hud .btn-icono { width: 42px; height: 42px; min-height: 42px; }
  .hud .btn-pista { height: 42px; min-height: 42px; padding: 0 10px; }
}
.chip {
  display: flex; flex-direction: column; justify-content: center;
  background: rgba(255, 255, 255, .96); border-radius: 14px; padding: 4px 10px;
  box-shadow: 0 3px 0 rgba(21, 34, 88, .4); min-width: 0;
}
.chip .et { font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--tinta-suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip b { font-size: 1.15rem; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip.sube b { animation: pop .35s ease-out; }
.chip.caliente { background: #ffe6c4; }
.chip.caliente b { color: #c2410c; }
.chip-vidas b { letter-spacing: 1px; font-size: 1rem; }
.chip-vidas .perdida { filter: grayscale(1); opacity: .35; }

/* Temporizador */
.reloj { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; }
.reloj-barra { flex: 1; height: 16px; background: rgba(255, 255, 255, .22); border-radius: 999px; overflow: hidden; border: 2px solid rgba(255, 255, 255, .5); }
.reloj-relleno { height: 100%; width: 100%; background: var(--menta); border-radius: 999px; transform-origin: left center; }
.reloj.aviso .reloj-relleno { background: var(--naranja); }
.reloj.urgente .reloj-relleno { background: var(--coral); }
.reloj-seg { min-width: 2.4em; text-align: center; font-weight: 700; font-size: 1.1rem; color: #fff; font-variant-numeric: tabular-nums; }
.reloj.urgente .reloj-seg { animation: latido .6s ease-in-out infinite; }

.escena { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px 0 4px; }
.mesa {
  position: relative; width: 100%; max-width: 760px; max-height: 100%; overflow: auto;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 18px 16px 20px;
  background: var(--papel); border: 3px solid #fff; border-radius: 28px;
  box-shadow: 0 8px 0 rgba(21, 34, 88, .5);
  text-align: center;
}
.mesa.entra { animation: aparecer .3s ease-out both; }
.reto-insignia {
  margin: 0; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 14px; border-radius: 999px; background: var(--noche-2); color: #fff; font-weight: 700; font-size: .95rem;
}
.mesa[data-reto="reloj"] .reto-insignia { background: var(--coral); }
.mesa[data-reto="hiato"] .reto-insignia { background: var(--naranja); }
.reto-pregunta { margin: 0; font-size: clamp(1.1rem, 3.6vw, 1.45rem); font-weight: 600; line-height: 1.2; max-width: 30ch; }
.reto-emoji { font-size: 2.6rem; line-height: 1; min-height: 1em; }
.reto-emoji:empty { display: none; }

/* Palabra en fichas */
.palabra { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 6px; padding-top: 18px; }
.ficha {
  --tam: clamp(40px, 11vw, 64px);
  width: var(--tam); height: calc(var(--tam) * 1.16); font-size: calc(var(--tam) * .62); padding-bottom: 4px;
  border: 0; transition: transform .12s ease, background .2s ease, box-shadow .12s ease;
}
.palabra.larga .ficha { --tam: clamp(30px, 8.4vw, 54px); }
@media (min-width: 900px) and (min-height: 700px) {
  .mesa { padding: 26px 28px 30px; gap: 16px; }
  .reto-pregunta { font-size: 1.7rem; }
  .reto-emoji { font-size: 3.4rem; }
  .ficha { --tam: 80px; }
  .palabra.larga .ficha { --tam: 62px; }
  .opcion { min-height: 72px; font-size: 1.45rem; }
}
.ficha.vocal { cursor: pointer; background: #fff; box-shadow: inset 0 -5px 0 #d8e6ff, 0 5px 0 var(--noche-1); touch-action: manipulation; }
.ficha.vocal:hover:not(:disabled) { transform: translateY(-3px); }
.ficha.vocal:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 -5px 0 #d8e6ff, 0 2px 0 var(--noche-1); }
.ficha.tonica { background: #fff1bd; box-shadow: inset 0 -5px 0 #ffd666, 0 5px 0 var(--tilde-osc); }
.ficha.par { background: #ffe0cc; box-shadow: inset 0 -5px 0 #ffb98a, 0 5px 0 var(--naranja); }
.ficha.ok { background: #cdf5e2; box-shadow: inset 0 -5px 0 #8fe3bd, 0 5px 0 var(--llana); }
.ficha.mal { background: #ffd6de; box-shadow: inset 0 -5px 0 #ffaab9, 0 5px 0 var(--coral); }
.ficha:disabled { cursor: default; }
.ficha .num { position: absolute; top: 3px; left: 5px; font-size: .7rem; font-weight: 600; color: var(--tinta-suave); line-height: 1; }
.hueco-silaba { width: 12px; }
.separador { align-self: center; font-size: 1.8rem; font-weight: 700; color: var(--tinta-suave); padding: 0 2px; }
.separador.corte { color: var(--naranja); font-size: 2.2rem; }

/* Texto de la pista (dentro de la mesa, visible también en el móvil) */
.pista-texto { margin: 0; padding: 8px 14px; max-width: 520px; background: #fff1bd; border: 3px dashed var(--tilde-osc); border-radius: 16px; font-weight: 600; font-size: 1rem; }
@media (min-width: 900px) { .pista-texto { display: none; } }

/* Sílabas como botones (reto de la sílaba tónica) */
.ficha.silaba-btn {
  width: auto; min-width: clamp(70px, 19vw, 130px); height: clamp(70px, 17vw, 104px); padding: 0 16px 4px;
  font-size: clamp(1.7rem, 7vw, 3rem); font-weight: 700; letter-spacing: .04em;
  background: #fff; box-shadow: inset 0 -6px 0 #d8e6ff, 0 6px 0 var(--noche-1);
  cursor: pointer; touch-action: manipulation;
}
.ficha.silaba-btn:hover:not(:disabled) { transform: translateY(-3px); }
.ficha.silaba-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 -6px 0 #d8e6ff, 0 2px 0 var(--noche-1); }
.ficha.silaba-btn.ok { background: #cdf5e2; box-shadow: inset 0 -6px 0 #8fe3bd, 0 6px 0 var(--llana); }
.ficha.silaba-btn.mal { background: #ffd6de; box-shadow: inset 0 -6px 0 #ffaab9, 0 6px 0 var(--coral); }
.ficha.silaba-btn.descartada { opacity: .35; }

/* Opciones */
.opciones { display: grid; gap: 10px; width: 100%; max-width: 620px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.opciones:empty { display: none; }
.opcion {
  position: relative; min-height: 62px; padding: 8px 14px;
  border: 3px solid transparent; border-radius: 18px;
  background: #fff; color: var(--tinta); font-weight: 700; font-size: 1.25rem; letter-spacing: .03em;
  box-shadow: 0 5px 0 rgba(21, 34, 88, .35);
  transition: transform .08s ease, box-shadow .08s ease, background .2s;
  touch-action: manipulation;
}
.opcion small { display: block; font-size: .78rem; font-weight: 500; letter-spacing: 0; color: var(--tinta-suave); }
.opcion:hover:not(:disabled) { transform: translateY(-2px); }
.opcion:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 rgba(21, 34, 88, .35); }
.opcion .num { position: absolute; top: 4px; left: 8px; font-size: .72rem; font-weight: 600; color: var(--tinta-suave); }
.opcion.t-aguda { border-color: var(--aguda); }
.opcion.t-llana { border-color: var(--llana); }
.opcion.t-esdrujula { border-color: var(--esdrujula); }
.opcion.sin-tilde { background: var(--noche-2); color: #fff; }
.opcion.sin-tilde .num { color: #c9d1ff; }
.opcion.ok { background: #cdf5e2; border-color: var(--llana); color: #0f5132; }
.opcion.mal { background: #ffd6de; border-color: var(--coral); color: #8a1230; }
.opcion.ok::after, .ficha.ok::after { content: "✓"; }
.opcion.mal::after, .ficha.mal::after { content: "✗"; }
.opcion.ok::after, .opcion.mal::after, .ficha.ok::after, .ficha.mal::after {
  position: absolute; top: -10px; right: -8px; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; color: #fff; font-size: 15px; font-weight: 700;
}
.opcion.ok::after, .ficha.ok::after { background: var(--llana); }
.opcion.mal::after, .ficha.mal::after { background: var(--coral); }
.opcion.descartada, .ficha.descartada { opacity: .35; text-decoration: line-through; text-decoration-thickness: 3px; }
.opcion:disabled, .silaba-btn:disabled { cursor: default; }
.mesa.sacudir .palabra { animation: sacudir .4s ease-in-out; }
@media (hover: none) { .opcion .num, .ficha .num { display: none; } }

/* Tildín ayudante (esquina inferior) */
.ayudante { position: absolute; left: 0; bottom: 0; display: flex; align-items: flex-end; gap: 8px; pointer-events: none; z-index: 3; max-width: min(100%, 460px); }
.ayudante-texto {
  margin: 0 0 30px; padding: 8px 12px; background: #fff; border-radius: 16px 16px 16px 4px;
  font-weight: 600; font-size: .95rem; box-shadow: 0 4px 0 rgba(21, 34, 88, .35); animation: aparecer .25s ease-out both;
}
/* Tildín se ve en pantallas anchas o altas; el bocadillo solo en las anchas
   (en las demás, la pista sale dentro de la mesa) */
@media (max-width: 899px) and (max-height: 999px) { .ayudante { display: none; } }
@media (max-width: 899px) { .ayudante-texto { display: none; } }
.escena.con-feedback .ayudante { visibility: hidden; }
/* Con el feedback abierto, la mesa sube y el panel va debajo: nunca tapa la solución */
.escena.con-feedback { flex-direction: column; justify-content: center; gap: 12px; }
.escena.con-feedback .mesa { flex: 0 1 auto; min-height: 0; }
.escena.con-feedback .feedback { position: relative; flex: none; width: 100%; padding: 0; }
@media (max-width: 700px), (max-height: 760px) {
  .escena.con-feedback .reto-pregunta,
  .escena.con-feedback .reto-emoji,
  .escena.con-feedback .pista-texto { display: none; }
  .escena.con-feedback .mesa { gap: 8px; padding-block: 12px 14px; }
}
@media (max-height: 560px) {
  .escena.con-feedback .opciones { display: none; }
}

.capa-pausa { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(31, 47, 122, .97); border-radius: 22px; }
.pausa-caja { text-align: center; color: #fff; padding: 20px; }
.pausa-caja h2 { margin: 6px 0; font-size: 1.8rem; }
.pausa-caja p { margin: 0 0 16px; }
.pausa-emoji { font-size: 3.4rem !important; margin: 0 !important; }

/* ---------- 7. FEEDBACK ---------- */
.feedback { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; padding: 0 0 4px; }
.feedback-caja {
  width: 100%; max-width: 760px;
  display: grid; grid-template-columns: 76px 1fr; gap: 6px 12px; align-items: center;
  padding: 12px 14px 14px; border-radius: 24px; border: 4px solid #fff;
  background: #e5fbef; box-shadow: 0 8px 0 rgba(21, 34, 88, .5), 0 -6px 30px rgba(21, 34, 88, .35);
  animation: subirPanel .3s cubic-bezier(.2, 1.2, .4, 1) both;
}
.feedback.mal .feedback-caja { background: #fff0f3; }
.feedback-texto { min-width: 0; }
.fb-titulo { margin: 0; font-size: 1.35rem; font-weight: 700; line-height: 1.15; color: #0f6b43; }
.feedback.mal .fb-titulo { color: #b3173d; }
.fb-puntos { margin: 2px 0 0; font-weight: 700; color: #b45309; }
.fb-puntos:empty { display: none; }
.fb-explica { margin: 4px 0 0; font-size: 1.02rem; line-height: 1.3; }
.fb-explica b { color: var(--noche-1); }
.btn-continuar { grid-column: 1 / -1; width: 100%; }
.tecla { font-size: .7rem; font-weight: 600; opacity: .85; border: 2px solid rgba(255, 255, 255, .7); border-radius: 6px; padding: 0 5px; }
@media (hover: none) { .tecla { display: none; } }
@media (min-width: 700px) {
  .feedback-caja { grid-template-columns: 90px 1fr auto; }
  .btn-continuar { grid-column: auto; width: auto; }
}

/* ---------- 8. AYUDA ---------- */
.pestanas, .filtro-nivel { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.pestana, .filtro {
  min-height: 44px; padding: 6px 16px; border: 3px solid var(--noche-1); border-radius: 999px;
  background: #fff; color: var(--noche-1); font-weight: 700; touch-action: manipulation;
}
.filtro { min-height: 38px; padding: 4px 12px; font-size: .9rem; border-color: #d5cdf0; color: var(--tinta-suave); }
.pestana.activa { background: var(--noche-1); color: #fff; }
.filtro.activo { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.ayuda-contenido { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 8px; }
.tarjeta-ayuda { padding: 14px 16px; background: #fff; border-radius: 18px; border: 3px solid #ebe6fb; }
.tarjeta-ayuda h3 { margin: 0 0 6px; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.tarjeta-ayuda p { margin: 0 0 6px; }
.tarjeta-ayuda .ej { font-weight: 700; letter-spacing: .03em; }
.tarjeta-ayuda .ej b { color: var(--coral); }
.tarjeta-ayuda.aguda { border-color: var(--aguda); }
.tarjeta-ayuda.llana { border-color: var(--llana); }
.tarjeta-ayuda.esdrujula { border-color: var(--esdrujula); }
.tarjeta-ayuda.hiato { border-color: var(--naranja); }
.tabla-puntos { width: 100%; border-collapse: collapse; background: #fff; border-radius: 16px; overflow: hidden; }
.tabla-puntos td { padding: 10px 14px; border-bottom: 2px solid var(--papel); }
.tabla-puntos td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.teclas-ayuda { grid-column: 1 / -1; }

/* ---------- 9. RANKING Y OPCIONES ---------- */
.ranking { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.ranking li {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 12px; background: #fff; border-radius: 16px; border: 3px solid transparent;
  box-shadow: 0 3px 0 rgba(21, 34, 88, .18);
}
.ranking li.tu { border-color: var(--naranja); background: #fff3e6; }
.ranking .pos { font-size: 1.35rem; font-weight: 700; text-align: center; color: var(--tinta-suave); }
.ranking .nombre { font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }
.ranking .nombre small { display: block; font-weight: 500; font-size: .78rem; color: var(--tinta-suave); }
.ranking .puntos { font-weight: 700; font-size: 1.2rem; text-align: right; font-variant-numeric: tabular-nums; }
.ranking .puntos small { display: block; font-size: .72rem; font-weight: 500; color: var(--tinta-suave); }
.ranking-vacio { text-align: center; padding: 22px 10px; color: var(--tinta-suave); font-weight: 500; list-style: none; }

.ajustes { display: grid; gap: 12px; margin-top: 14px; }
.interruptor {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  min-height: 60px; padding: 8px 16px; text-align: left;
  background: #fff; border: 3px solid #e4defa; border-radius: 18px; font-weight: 600; font-size: 1.05rem;
  touch-action: manipulation;
}
.interruptor .ico { font-size: 1.6rem; }
.interruptor .estado { padding: 4px 14px; border-radius: 999px; background: var(--noche-2); color: #fff; font-weight: 700; font-size: .9rem; }
.interruptor[aria-pressed="true"] .estado { background: var(--llana); }
.interruptor[aria-pressed="false"] .estado { background: #8f8bb0; }

.medallas { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.medalla { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 10px; text-align: center; background: #fff; border-radius: 18px; border: 3px solid var(--tilde); }
.medalla .ico { font-size: 2.2rem; line-height: 1; }
.medalla b { font-size: .98rem; line-height: 1.15; }
.medalla small { font-size: .8rem; color: var(--tinta-suave); }
.medalla.bloqueada { border-color: #e4defa; }
.medalla.bloqueada .ico { filter: grayscale(1); opacity: .4; }
.progreso-medalla { width: 100%; height: 8px; background: #ece8fa; border-radius: 999px; overflow: hidden; }
.progreso-medalla i { display: block; height: 100%; background: var(--tilde); border-radius: 999px; }

/* ---------- 10. MODALES ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: 14px; overflow: auto; background: rgba(12, 20, 60, .74);
  animation: fundido .25s ease-out both;
}
.modal-caja {
  position: relative; width: 100%; max-width: 500px; max-height: calc(100dvh - 28px); overflow: auto;
  padding: 22px 18px 18px; text-align: center;
  background: var(--papel); border: 4px solid #fff; border-radius: 28px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, .3);
  animation: aparecer .4s cubic-bezier(.2, 1.3, .4, 1) both;
}
.m-emoji { margin: 0; font-size: 3rem; line-height: 1; }
.modal-caja h2 { margin: 6px 0 4px; font-size: clamp(1.5rem, 6vw, 2rem); line-height: 1.1; }
.m-texto { margin: 0 0 8px; color: var(--tinta-suave); font-size: 1.05rem; }
.m-estrellas { margin: 2px 0 8px; font-size: 2.6rem; line-height: 1; letter-spacing: 4px; }
.m-estrellas span { display: inline-block; color: #dcd8ee; }
.m-estrellas span.on { color: var(--tilde); text-shadow: 0 3px 0 rgba(0, 0, 0, .22); animation: estrella .6s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: var(--d, 0s); }
.m-lista { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; padding: 0; list-style: none; text-align: left; }
.m-lista li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: #fff; border-radius: 12px; font-weight: 600; font-size: .95rem; }
.m-lista li b { font-size: 1.12rem; font-variant-numeric: tabular-nums; }
.m-lista li.ancha { grid-column: 1 / -1; background: #e8f0ff; }
.m-ranking {
  margin: 10px 0; padding: 12px 10px; border-radius: 18px;
  background: linear-gradient(135deg, #ffe08a, #ffb84d); border: 3px solid #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .18);
  font-weight: 700;
}
.m-ranking .num { display: block; font-size: 2.3rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.m-ranking small { display: block; font-size: .95rem; }
.m-destacado { display: inline-block; margin: 4px 0 6px; padding: 4px 14px; border-radius: 999px; background: var(--naranja); color: #fff; font-weight: 700; animation: latido 1.6s ease-in-out infinite; }
.m-medallas { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.m-medallas span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 3px solid var(--tilde); font-weight: 700; animation: aparecer .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.m-guardado { margin: 8px 0 4px; min-height: 1.4em; font-weight: 600; font-size: .95rem; color: var(--tinta-suave); }
.m-guardado.mal { color: #c21f42; }
.m-botones { display: grid; gap: 10px; margin-top: 12px; }
.m-botones .btn { width: 100%; }
.m-botones .fila { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-botones .fila .btn { padding-inline: 8px; font-size: 1rem; }
.confeti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confeti i { position: absolute; top: -24px; width: 10px; height: 15px; border-radius: 3px; opacity: .95; animation: caer linear forwards; }

/* ---------- 11. TILDÍN ---------- */
.tildin { width: 100%; aspect-ratio: 1 / 1.08; }
.tildin svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tildin-inicio { animation: flotar 3.8s ease-in-out infinite; }
.tildin-mini { width: 86px; flex: none; }
.tildin-feedback { width: 76px; }
@media (min-width: 700px) { .tildin-feedback { width: 90px; } }
.tildin .boca { display: none; }
.tildin[data-cara="normal"] .boca-normal,
.tildin[data-cara="feliz"] .boca-feliz,
.tildin[data-cara="triste"] .boca-triste,
.tildin[data-cara="wow"] .boca-wow { display: inline; }
.tildin[data-cara="feliz"] svg, .tildin[data-cara="wow"] svg { animation: saltito .6s cubic-bezier(.3, 1.6, .5, 1); }
.tildin[data-cara="triste"] svg { animation: ladeo .7s ease-in-out; }
.tildin[data-cara="triste"] .antena { transform: rotate(-18deg); }
.tildin .antena { transform-origin: 60px 40px; transition: transform .3s ease; }
.tildin.baila svg { animation: baile .9s ease-in-out 2; }

/* ---------- 12. EFECTOS ---------- */
.efectos { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.tilde-voladora {
  position: fixed; width: 12px; height: 30px; margin: -15px 0 0 -6px;
  background: var(--coral); border-radius: 7px; transform: rotate(35deg);
  box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(0, 0, 0, .3);
}
.puntos-flotantes { position: fixed; font-weight: 700; font-size: 1.6rem; color: var(--tilde); text-shadow: 0 3px 0 var(--tinta), 0 0 10px rgba(0, 0, 0, .3); animation: flotaPuntos 1.1s ease-out forwards; white-space: nowrap; }
.chispa { position: fixed; font-size: 1.3rem; line-height: 1; animation: chispa .8s ease-out forwards; }
.cartel-racha {
  position: fixed; left: 50%; top: 32%; transform: translate(-50%, -50%);
  padding: 10px 26px; border-radius: 999px; background: var(--naranja); color: #fff; border: 4px solid #fff;
  font-size: clamp(1.4rem, 6vw, 2.2rem); font-weight: 700; white-space: nowrap;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .25); animation: cartel 1.4s ease-out forwards;
}
.cartel-racha.nivel3 { background: var(--coral); }
.ficha.recibe { animation: recibe .45s cubic-bezier(.3, 1.6, .5, 1); }

/* ---------- 13. ANIMACIONES (suaves; nada de parpadeos rápidos) ---------- */
@keyframes aparecer { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fundido { from { opacity: 0; } to { opacity: 1; } }
@keyframes subirPanel { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes flotar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes tildeCae { 0% { transform: translate(40px, -70px) rotate(35deg); opacity: 0; } 18%, 88% { transform: rotate(35deg); opacity: 1; } 100% { transform: rotate(35deg); opacity: 1; } }
@keyframes subir { from { transform: translateY(0) rotate(0); } to { transform: translateY(-115vh) rotate(25deg); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes latido { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes sacudir { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes estrella { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
@keyframes caer { to { transform: translateY(110vh) rotate(540deg); } }
@keyframes saltito { 0% { transform: translateY(0); } 40% { transform: translateY(-14px) scale(1.04); } 100% { transform: translateY(0); } }
@keyframes ladeo { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-8deg); } }
@keyframes baile { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg) translateY(-6px); } 75% { transform: rotate(10deg) translateY(-6px); } }
@keyframes flotaPuntos { from { opacity: 0; transform: translate(-50%, 0) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -10px) scale(1.1); } to { opacity: 0; transform: translate(-50%, -70px) scale(1); } }
@keyframes chispa { from { opacity: 1; transform: translate(0, 0) scale(.6); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(90deg); } }
@keyframes cartel { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -80%) scale(1); } }
@keyframes recibe { 0% { transform: scale(1); } 40% { transform: scale(1.18) translateY(-4px); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .confeti, .flotantes, .chispa { display: none !important; }
}

/* ---------- 14. RESPONSIVE (pantallas bajas / apaisado) ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .hud { grid-template-columns: calc(var(--marca-w) + 8px) 1fr auto; }
  .hud-chips { grid-column: 2; grid-row: 1; }
  .hud-acciones { grid-column: 3; }
  .chip .et { font-size: .56rem; }
  .chip b { font-size: 1rem; }
  .mesa { gap: 8px; padding: 10px 14px 12px; }
  .reto-emoji { font-size: 1.8rem; }
  .ficha { --tam: 42px; }
  .palabra { padding-top: 10px; }
  .opcion { min-height: 50px; }
}
@media (max-width: 380px) {
  .chip { padding: 4px 7px; }
  .chip .et { font-size: .56rem; }
  .chip b { font-size: 1rem; }
  .m-lista { grid-template-columns: 1fr; }
}
