/* Acertijos (/acertijos): lo específico de la partida. El resto —resultado,
   ranking— reutiliza las clases de la página del Reto (game.css). */

/* ── Portada (oct-2026) ──────────────────────────────────────────────────────
   El mismo lenguaje que la portada del Reto (reto.css): cristal oscuro con texto
   claro, que se lee sobre los 26 fondos de tema, y acento índigo en vez de rojo.
   reto.css no se carga aquí, así que todo va con su propio prefijo .rd-.
   Movimiento: solo transform/opacity; prefers-reduced-motion lo apaga. */
.riddle-page {
  --rd-glass: rgba(14, 10, 26, .64);
  --rd-glass-2: rgba(255, 255, 255, .06);
  --rd-line: rgba(255, 255, 255, .12);
  --rd-text: #f8fafc;
  --rd-muted: rgba(241, 245, 249, .74);
  --rd-accent: #818cf8;
  --rd-gold: #fbbf24;
}
.riddle-page .reto-wrap.rd { justify-content: flex-start; gap: 14px; padding-top: 10px; }

.riddle-page .rd-hero {
  position: relative; overflow: hidden; isolation: isolate;
  width: 100%; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 16px 18px; border-radius: 24px; color: var(--rd-text);
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(99, 102, 241, .32), transparent 60%),
    radial-gradient(90% 60% at 0% 110%, rgba(34, 197, 94, .14), transparent 65%),
    var(--rd-glass);
  border: 1px solid var(--rd-line);
  -webkit-backdrop-filter: blur(12px) saturate(1.1); backdrop-filter: blur(12px) saturate(1.1);
  box-shadow: 0 22px 44px -20px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.riddle-page .rd-hero::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 1px; z-index: -1;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
}
.riddle-page .rd-hero-top {
  width: 100%; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.riddle-page .rd-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; color: var(--rd-muted); white-space: nowrap;
  background: var(--rd-glass-2); border: 1px solid var(--rd-line);
}
.riddle-page .rd-chip[hidden] { display: none; }
.riddle-page .rd-chip .ic { width: 14px; height: 14px; flex: none; }
.riddle-page .rd-num { font-variant-numeric: tabular-nums; }

/* Emblema: la pieza en un cuadro índigo con un aro que respira. */
.riddle-page .rd-emblem {
  position: relative; width: 76px; height: 76px; margin: 2px 0 10px;
  display: grid; place-items: center; border-radius: 24px;
  background: linear-gradient(160deg, rgba(99, 102, 241, .34), rgba(99, 102, 241, .08));
  border: 1px solid rgba(129, 140, 248, .5);
  box-shadow: 0 12px 28px -10px rgba(99, 102, 241, .65), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.riddle-page .rd-emblem-glyph { position: relative; font-size: 2.4rem; line-height: 1; animation: rd-float 4s ease-in-out infinite; }
.riddle-page .rd-emblem-ring {
  position: absolute; inset: -7px; border-radius: 30px;
  border: 1.5px solid rgba(165, 180, 252, .5);
  animation: rd-breathe 3.2s ease-in-out infinite;
}
@keyframes rd-breathe { 0%, 100% { transform: scale(.94); opacity: .2; } 50% { transform: scale(1.04); opacity: .9; } }
@keyframes rd-float { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-3px) rotate(4deg); } }

.riddle-page .rd-hero .reto-title { margin: 0 0 4px; font-size: 1.75rem; letter-spacing: -.01em; color: var(--rd-text); }
.riddle-page .rd-hero .reto-sub { margin: 0 0 14px; color: var(--rd-muted); font-size: .92rem; line-height: 1.4; text-wrap: balance; }

/* Cifras de quien ya ha jugado. */
.riddle-page .rd-stats { width: 100%; display: flex; justify-content: center; gap: 8px; margin: 0 0 14px; }
.riddle-page .rd-stats[hidden] { display: none; }
.riddle-page .rd-stat {
  flex: 0 1 180px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
  padding: 10px 4px 9px; border-radius: 16px;
  background: var(--rd-glass-2); border: 1px solid var(--rd-line);
}
.riddle-page .rd-stat b { font-size: 1.5rem; font-weight: 900; line-height: 1.1; color: #fff; }
.riddle-page .rd-stat b small { font-size: .78rem; font-weight: 800; color: var(--rd-muted); }
.riddle-page .rd-stat > span { font-size: .68rem; font-weight: 700; color: var(--rd-muted); line-height: 1.2; }
.riddle-page .rd-stat-best { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .32); }
.riddle-page .rd-stat-best b {
  background: linear-gradient(135deg, #fde68a, var(--rd-gold) 45%, #fb923c);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* Cómo se juega, para quien no tiene marca. */
.riddle-page .rd-steps { width: 100%; list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.riddle-page .rd-steps[hidden] { display: none; }
.riddle-page .rd-steps li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px;
  font-size: .88rem; font-weight: 600; color: var(--rd-muted);
  background: var(--rd-glass-2); border: 1px solid rgba(255, 255, 255, .07);
}
.riddle-page .rd-steps b { color: #fff; }
.riddle-page .rd-step-n {
  width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-size: .78rem; font-weight: 900; color: #fff;
  background: linear-gradient(150deg, #818cf8, #4f46e5); box-shadow: 0 4px 10px -4px rgba(79, 70, 229, .9);
}

/* CTA: verde, grande, con un brillo que cruza de vez en cuando (como el del Reto). */
.riddle-page .rd-hero .reto-play-btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  max-width: none; width: 100%; margin: 0; padding: 17px 18px; border: 0; border-radius: 18px; cursor: pointer;
  font-size: 1.15rem; font-weight: 900; letter-spacing: .01em; color: #fff;
  background: linear-gradient(150deg, #34d399, #16a34a 55%, #15803d);
  box-shadow: 0 14px 28px -12px rgba(22, 163, 74, .85), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .12s ease;
}
.riddle-page .rd-hero .reto-play-btn .ic { width: 22px; height: 22px; }
.riddle-page .rd-hero .reto-play-btn::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: translateX(-100%) skewX(-18deg);
  animation: rd-shine 4.2s ease-in-out 1.2s infinite;
}
@keyframes rd-shine { 0%, 60% { transform: translateX(0) skewX(-18deg); } 100% { transform: translateX(560%) skewX(-18deg); } }
.riddle-page .rd-hero .reto-play-btn:active { transform: scale(.98); }

/* Tarjetas bajo la portada. */
.riddle-page .rd-card {
  width: 100%; box-sizing: border-box; padding: 14px; border-radius: 20px; text-align: left; color: var(--rd-text);
  background: var(--rd-glass); border: 1px solid var(--rd-line);
  -webkit-backdrop-filter: blur(12px) saturate(1.1); backdrop-filter: blur(12px) saturate(1.1);
  box-shadow: 0 16px 34px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.riddle-page .rd-card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .95rem; font-weight: 800; color: var(--rd-text); }
.riddle-page .rd-card-title .ic { width: 18px; height: 18px; color: var(--rd-gold); }
.riddle-page .rd-hints-card .rd-card-title .ic { color: var(--rd-accent); }

.riddle-page .rd-top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.riddle-page .rd-top-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 14px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .07);
}
.riddle-page .rd-top-row.is-me { background: rgba(129, 140, 248, .14); border-color: rgba(129, 140, 248, .4); }
.riddle-page .rd-top-pos {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: .8rem; font-weight: 900; color: #0b1020; background: rgba(255, 255, 255, .7);
}
.riddle-page .rd-top-row[data-pos="1"] .rd-top-pos { background: linear-gradient(145deg, #fde68a, #f59e0b); box-shadow: 0 0 12px rgba(251, 191, 36, .5); }
.riddle-page .rd-top-row[data-pos="2"] .rd-top-pos { background: linear-gradient(145deg, #f1f5f9, #94a3b8); }
.riddle-page .rd-top-row[data-pos="3"] .rd-top-pos { background: linear-gradient(145deg, #fdba74, #c2410c); color: #fff; }
.riddle-page .rd-top-name { min-width: 0; font-weight: 800; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.riddle-page .rd-top-name .av-svg { vertical-align: -3px; margin-right: 4px; }
.riddle-page .rd-top-score { text-align: right; line-height: 1; }
.riddle-page .rd-top-score b { display: block; font-size: 1.15rem; font-weight: 900; color: #fff; }
.riddle-page .rd-top-score small { font-size: .62rem; font-weight: 800; letter-spacing: .04em; color: var(--rd-muted); }
.riddle-page .rd-top-empty { padding: 10px; border-radius: 14px; font-size: .86rem; font-weight: 700; text-align: center; color: var(--rd-muted); background: rgba(255, 255, 255, .05); }
.riddle-page .rd-link-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 10px;
  padding: 10px; border-radius: 12px; cursor: pointer;
  font-size: .88rem; font-weight: 800; color: var(--rd-text);
  background: transparent; border: 1px dashed rgba(255, 255, 255, .22);
}

.riddle-page .rd-hint-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.riddle-page .rd-hint {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px; border-radius: 14px;
  background: rgba(99, 102, 241, .12); border: 1px solid rgba(129, 140, 248, .3);
}
.riddle-page .rd-hint b { font-size: .88rem; font-weight: 800; color: #fff; }
.riddle-page .rd-hint small { font-size: .74rem; font-weight: 800; color: #fca5a5; }

.riddle-page .rd-rise { animation: rd-rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.riddle-page .reto-wrap.rd > :nth-child(2) { animation-delay: 70ms; }
.riddle-page .reto-wrap.rd > :nth-child(3) { animation-delay: 140ms; }
@keyframes rd-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .riddle-page .rd-rise, .riddle-page .rd-emblem-ring, .riddle-page .rd-emblem-glyph,
  .riddle-page .rd-hero .reto-play-btn::after { animation: none !important; }
  .riddle-page .rd-hero .reto-play-btn::after { display: none; }
}


.riddle-play {
  width: 100%; max-width: 560px; margin: 0 auto; box-sizing: border-box;
  padding: 4px 14px calc(88px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.riddle-topbar { width: 100%; display: flex; align-items: center; gap: 10px; }
.riddle-streak { flex: 1 1 auto; font-weight: 800; font-size: 1.05rem; color: var(--heading, #f1f5f9); }
.riddle-close {
  flex: 0 0 auto; min-width: 38px; height: 38px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  font-size: 1rem; font-weight: 800; line-height: 1; color: var(--text-muted, #94a3b8);
  background: transparent; border: 1px solid var(--border-color, rgba(148, 163, 184, .3));
}
.riddle-close.is-armed { border-color: #ef4444; color: #f87171; font-size: .85rem; }
.riddle-streak strong { color: #f59e0b; font-size: 1.35rem; margin-left: 4px; }
.riddle-timer {
  min-width: 2.4ch; text-align: right; font-weight: 900; font-size: 1.7rem; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--heading, #f1f5f9);
}
.riddle-timer.is-warning { color: #f59e0b; }
.riddle-timer.is-urgent { color: #ef4444; animation: riddle-pulse .7s ease-in-out infinite; }

.riddle-timebar { width: 100%; height: 6px; border-radius: 999px; overflow: hidden; background: rgba(148, 163, 184, .22); }
.riddle-timebar-fill {
  height: 100%; width: 100%; border-radius: 999px; background: #22c55e;
  transform-origin: left center; transition: transform .25s linear, background-color .4s;
}
.riddle-timebar-fill.is-warning { background: #f59e0b; }
.riddle-timebar-fill.is-urgent { background: #ef4444; }

.riddle-clue-card {
  width: 100%; box-sizing: border-box; padding: 14px 16px; border-radius: 16px; text-align: center;
  background: var(--surface, #1e293b); border: 1px solid var(--border-color, rgba(148, 163, 184, .22));
}
.riddle-clue { margin: 0; font-size: 1.08rem; font-weight: 600; line-height: 1.38; color: var(--text-color, #e5e7eb); }
/* Acertijo nuevo: la tarjeta salta, se llena de color con la letra en blanco y se serena; el tablero espera un
   instante y aparece de golpe (sin cascada) para que la vista caiga antes en la definición. */
.riddle-clue-card.is-new { animation: riddle-clue-nudge 1.7s ease-out backwards; }
.riddle-clue-card.is-new .riddle-clue { animation: riddle-clue-ink 1.7s ease-out backwards; }
body.riddle-page #grid .letter.grid-enter { animation: grid-enter .28s ease-out .45s both !important; animation-delay: .45s !important; }

/* Se acabó el tiempo: la palabra que quedó se enciende letra a letra y el resto del tablero se apaga. */
#grid.is-revealing .letter { transition: opacity .35s; }
#grid.is-revealing .letter:not(.reveal-path) { opacity: .25; }
#grid .letter.reveal-path {
  background: linear-gradient(145deg, #fbbf24, #d97706); color: #fff; opacity: 1;
  animation: riddle-reveal .4s cubic-bezier(.34, 1.56, .64, 1) var(--reveal-delay, 0ms) both;
}

.riddle-attribution { margin: 8px 0 0; font-size: .72rem; color: var(--text-muted, #94a3b8); }
.riddle-attribution a { color: inherit; text-decoration: underline; }

/* Tres pistas selladas: candado y coste, con borde discontinuo y un latido suave que invita a abrirlas.
   Al tocar una se da la vuelta y enseña su valor en el mismo sitio (borde continuo, sin candado ni coste). */
.riddle-hints { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.riddle-hint {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 68px; padding: 6px 4px; border-radius: 14px; cursor: pointer; color: var(--text-color, #e5e7eb);
  background: linear-gradient(160deg, rgba(99, 102, 241, .20), rgba(79, 70, 229, .08));
  border: 2px dashed rgba(129, 140, 248, .6);
  animation: riddle-seal 2.6s ease-in-out infinite;
}
.riddle-hint:nth-child(2) { animation-delay: .25s; }
.riddle-hint:nth-child(3) { animation-delay: .5s; }
.riddle-hint-value { font-size: 1.35rem; line-height: 1.1; }
.riddle-hint-name { font-size: .78rem; font-weight: 800; }
.riddle-hint-cost { font-size: .68rem; font-weight: 700; color: var(--text-muted, #94a3b8); }
.riddle-hint:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.riddle-hint:disabled:not(.is-open) { opacity: .42; cursor: default; animation: none; }
.riddle-hint.is-open {
  cursor: default; animation: none; opacity: 1;
  background: rgba(99, 102, 241, .28); border: 2px solid rgba(129, 140, 248, .95);
}
.riddle-hint.is-open .riddle-hint-value { font-size: clamp(1.6rem, 3.4dvh, 2.2rem); font-weight: 900; }
.riddle-hint.is-open .riddle-hint-cost { visibility: hidden; }
.riddle-hint.just-opened .riddle-hint-value { animation: riddle-flip .45s cubic-bezier(.34, 1.56, .64, 1) both; }

/* Modo inmersivo: mientras se juega no hay cabecera ni barra inferior y la partida ocupa toda la
   pantalla. El panel se lleva el hueco que sobra y es lo más grande que quepa (cqmin = el lado menor del
   contenedor), así que no hay que adivinar alturas para cada móvil. */
body.riddle-playing .page-topbar,
body.riddle-playing .home-nav--fixed { display: none; }
body.riddle-playing.has-bottom-nav { padding-bottom: 0; }
/* La página ya trae su margen lateral en el body: no se suma otro (antes el panel perdía 56 px de ancho). */
body.riddle-playing { padding: 0 8px; }
body.riddle-playing .riddle-play {
  /* Altura DEFINIDA: solo así los hijos flex se reparten el sobrante o se encogen; con un min-height la
     caja crece con su contenido y desborda. Si aun encogido todo no cabe, esta caja se desplaza. */
  height: 100dvh; overflow-y: auto; box-sizing: border-box;
  /* El sobrante (móviles altos) se reparte a partes iguales entre los elementos: ni una tarjeta enorme
     con una línea perdida ni aire muerto pegado al panel. */
  justify-content: space-evenly; gap: clamp(6px, 1.1dvh, 14px);
  padding: max(10px, env(safe-area-inset-top)) 0 max(12px, env(safe-area-inset-bottom));
}
/* Lo que rodea al panel crece con la altura que sobra (móviles altos) y se compacta en los bajos. */
body.riddle-playing .riddle-clue { font-size: clamp(1rem, 2.3dvh, 1.4rem); }
body.riddle-playing .riddle-clue-card { padding: clamp(10px, 1.6dvh, 20px) 16px; }
body.riddle-playing .riddle-timer { font-size: clamp(1.6rem, 3.3dvh, 2.2rem); }
body.riddle-playing .riddle-hint { min-height: clamp(62px, 8dvh, 92px); }
@media (max-height: 700px) {
  body.riddle-playing .riddle-hints { gap: 6px; }
  body.riddle-playing .riddle-hint { min-height: 56px; padding-block: 4px; }
  body.riddle-playing .riddle-hint-value { font-size: 1.15rem; }
  body.riddle-playing .riddle-hint-name { font-size: .72rem; }
}
.riddle-board-area {
  /* Cuadrado y del ancho de la pantalla; si falta altura se encoge (flex-shrink) hasta 220 px y el
     panel se ajusta al lado menor. Si sobra, no crece: el sobrante se reparte entre todos (space-evenly). */
  flex: 0 1 auto; aspect-ratio: 1 / 1; min-height: 220px; width: 100%; padding: 0;
  container-type: size; display: grid; place-items: center;
}

.riddle-page .grid-container { padding: 6px; box-sizing: border-box; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); }
.riddle-page .grid { width: 100%; height: 100%; }
/* Sin container queries (WebView muy antiguo): el cálculo por altura de antes. */
@supports not (width: 1cqw) {
  .riddle-page .grid-container { width: min(96vw, calc(100dvh - 330px)); height: min(96vw, calc(100dvh - 330px)); }
}
.riddle-page .current-word { width: 100%; max-width: 100%; margin: 0; padding: 8px 12px; min-height: 40px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
.riddle-status { position: relative; width: 100%; }

#riddle-end-icon { font-size: 3rem; line-height: 1; }

.riddle-feedback {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; border-radius: 12px;
  font-weight: 800; font-size: 1.1rem; text-align: center; color: var(--heading, #f1f5f9);
  background: var(--surface, #1e293b); pointer-events: none;
}
.riddle-feedback:empty { display: none; }
.riddle-feedback.is-ok { color: #22c55e; animation: riddle-pop .35s cubic-bezier(.34, 1.56, .64, 1) both; }
.riddle-feedback.is-bad { color: #f87171; }
.riddle-feedback.is-reveal { color: #fbbf24; animation: riddle-pop .35s cubic-bezier(.34, 1.56, .64, 1) both; }

.riddle-reveal {
  margin: 14px 0; padding: 12px 14px; border-radius: 14px; text-align: center;
  background: var(--surface, #1e293b); color: var(--text-color, #e5e7eb);
  border: 1px solid var(--border-color, rgba(148, 163, 184, .25));
}
.riddle-reveal[hidden] { display: none; }
.riddle-reveal-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted, #94a3b8); }
.riddle-reveal-word { margin-top: 2px; font-size: 1.6rem; font-weight: 900; letter-spacing: .08em; color: var(--heading, var(--text-color, #f1f5f9)); }
/* Etiquetas de la pantalla de fin: sobre el degradado el gris tenue y el 55 % de opacidad no se leen. */
.riddle-page #riddle-end-streak-label { opacity: .9; font-weight: 700; }
.riddle-reveal-clue { margin: 6px 0 0; font-size: .92rem; font-weight: 600; color: var(--text-color, #e5e7eb); }

/* Modo claro: lo que va directamente sobre el degradado, en claro. */
body.theme-light.riddle-page .riddle-streak,
body.theme-light.riddle-page .riddle-timer { color: #f8fafc; }
/* El mensaje va sobre la barra de la palabra, que en claro es una tarjeta blanca. */
body.theme-light.riddle-page .riddle-feedback { color: #1f2937; background: rgba(255, 255, 255, .95); }
body.theme-light.riddle-page #riddle-end-record { color: #fff; background: #b45309; border-color: #92400e; }
body.theme-light.riddle-page .riddle-feedback.is-reveal { color: #b45309; }
body.theme-light.riddle-page .riddle-hint { color: #1f2937; background: rgba(255, 255, 255, .88); border-color: rgba(79, 70, 229, .65); }
body.theme-light.riddle-page .riddle-hint-cost { color: #6b7280; }
body.theme-light.riddle-page .riddle-close { color: #f8fafc; border-color: rgba(248, 250, 252, .55); }
body.theme-light.riddle-page .riddle-hint.is-open { background: #e0e7ff; border-color: #4f46e5; }

@keyframes riddle-pulse { 50% { transform: scale(1.12); } }
@keyframes riddle-seal { 50% { border-color: rgba(165, 180, 252, 1); box-shadow: 0 0 0 3px rgba(129, 140, 248, .18); } }
@keyframes riddle-flip { from { transform: rotateY(90deg) scale(.6); opacity: 0; } to { transform: rotateY(0) scale(1); opacity: 1; } }
@keyframes riddle-clue-nudge {
  0% { transform: scale(.97); background: #6366f1; border-color: #c7d2fe; box-shadow: 0 0 0 0 rgba(129, 140, 248, .75); }
  16% { transform: scale(1.03); background: #6366f1; border-color: #c7d2fe; box-shadow: 0 0 0 12px rgba(129, 140, 248, .3), 0 10px 26px rgba(79, 70, 229, .55); }
  32% { transform: scale(1); background: #6366f1; border-color: #c7d2fe; box-shadow: 0 0 0 4px rgba(129, 140, 248, .25); }
  70% { background: #6366f1; border-color: #c7d2fe; box-shadow: 0 0 0 0 rgba(129, 140, 248, 0); }
}
@keyframes riddle-clue-ink { 0%, 70% { color: #fff; } }
@keyframes riddle-reveal { from { transform: scale(.7); } 60% { transform: scale(1.14); } to { transform: scale(1.05); } }
@keyframes riddle-pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .riddle-clue-card.is-new, .riddle-clue-card.is-new .riddle-clue, #grid .letter.reveal-path, .riddle-feedback.is-reveal { animation: none; }
  body.riddle-page #grid .letter.grid-enter { animation: none !important; }
  .riddle-timer.is-urgent, .riddle-hint, .riddle-hint.just-opened .riddle-hint-value, .riddle-feedback.is-ok { animation: none; }
  .riddle-timebar-fill { transition: none; }
}

/* Nombre para el ranking, en el fin de tanda */
.riddle-name-offer { margin: 14px 0 4px; text-align: center; }
.riddle-name-lead { font-weight: 700; margin: 0 0 8px; }
.riddle-name-row { display: flex; gap: 8px; justify-content: center; }
.riddle-name-row input { flex: 1; min-width: 0; max-width: 220px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-color, rgba(255,255,255,.2)); background: transparent; color: inherit; font: inherit; }
.riddle-name-row .btn { margin: 0; white-space: nowrap; }
.riddle-name-msg { margin: 8px 0 0; font-size: .85rem; opacity: .85; }
.riddle-name-done { margin: 0; font-weight: 700; color: var(--success, #22c55e); }

/* ── Acabado y sensación de juego (oct-2026) ────────────────────────────────────────────────────────
   Solo adorno: ni reglas ni tiempos. Todo anima transform/opacity (o un SVG pequeño) para ir fino en
   Android modestos, nada mueve el layout (los tests de 360×640 miden que todo quepa) y los colores salen de
   los tokens del tema o son neutros (blanco/negro con alfa), así que vale para claro, oscuro y de temporada. */

/* Tarjeta de la definición: lámina con brillo arriba, sombra suave y una comilla de adorno. */
.riddle-clue-card {
  position: relative; overflow: hidden;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 55%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 8px 22px -10px rgba(0, 0, 0, .45);
}
.riddle-clue-card::before {
  content: '\201C'; position: absolute; left: 8px; top: -14px; pointer-events: none;
  font: 900 4.2rem/1 Georgia, 'Times New Roman', serif; color: currentColor; opacity: .09;
}
.riddle-clue { position: relative; font-weight: 700; letter-spacing: -.005em; text-wrap: balance; }

/* Pistas: relieve suave, coste como píldora y un pulso al abrirse. */
.riddle-hint {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 3px 8px -4px rgba(0, 0, 0, .45);
  transition: transform .12s ease-out;
}
.riddle-hint-cost {
  margin-top: 2px; padding: 1px 7px; border-radius: 999px; line-height: 1.35;
  font-variant-numeric: tabular-nums; background: rgba(0, 0, 0, .22);
}
body.theme-light.riddle-page .riddle-hint-cost { background: rgba(79, 70, 229, .1); }
.riddle-hint:active:not(:disabled) { transform: translateY(1px) scale(.96); }
.riddle-hint.is-open.just-opened { animation: riddle-hint-open .6s ease-out both; }

/* Reloj: el coste de una pista sale flotando bajo el número; en los últimos segundos brilla y el borde de
   la pantalla late en rojo (capa fija con sombra interior: solo cambia su opacidad). */
.riddle-timer { position: relative; }
.riddle-timer::after {
  content: attr(data-delta); position: absolute; right: 0; top: 100%; z-index: 3; pointer-events: none;
  padding: 1px 7px; border-radius: 999px; white-space: nowrap; opacity: 0;
  font-size: .78rem; font-weight: 800; color: #fff; background: rgba(220, 38, 38, .92);
}
.riddle-timer.is-charged::after { animation: riddle-delta 1s ease-out both; }
.riddle-timer.is-charged { animation: riddle-charge .45s ease-out; }
.riddle-timer.is-urgent { text-shadow: 0 0 14px rgba(239, 68, 68, .55); }
.riddle-timebar { position: relative; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3); }
.riddle-timebar::after {
  content: ''; position: absolute; inset: 0 0 50% 0; pointer-events: none; border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0));
}
.riddle-play::before {
  content: ''; position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: 0;
  box-shadow: inset 0 0 70px rgba(239, 68, 68, .45);
  transition: opacity .4s;
}
.riddle-play.is-urgent::before { animation: riddle-vignette 1s ease-in-out infinite; }

/* Tanda: el número salta y un «+1» sube al acertar. */
.riddle-streak strong { position: relative; display: inline-block; }
.riddle-streak.is-up strong { animation: riddle-streak-pop .5s cubic-bezier(.34, 1.56, .64, 1); }
.riddle-streak.is-up strong::after {
  content: '+1'; position: absolute; left: 100%; top: -4px; margin-left: 4px; pointer-events: none;
  font-size: .8rem; font-weight: 900; color: #4ade80; text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  animation: riddle-plus .9s ease-out both;
}

/* Fichas, selección, rastro y fallo: los mismos que en el resto de tableros (game.css, «Tablero»). El #grid
   hace de referencia para la onda de la celebración. */
body.riddle-page #grid { position: relative; }

/* Acierto: las letras se levantan en cascada, onda desde el centro del trazo, el resto se apaga. */
#grid.is-solved .letter { transition: opacity .3s .12s; }
#grid.is-solved .letter:not(.riddle-solved) { opacity: .35; }
#grid .letter.riddle-solved {
  color: #fff; background: linear-gradient(145deg, #4ade80, #16a34a); z-index: 3;
  animation: riddle-solved-lift .55s cubic-bezier(.34, 1.56, .64, 1) var(--solve-delay, 0ms) both;
}
#grid.is-solved::before, #grid.is-solved::after {
  content: ''; position: absolute; left: var(--burst-x, 50%); top: var(--burst-y, 50%); z-index: 4;
  width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; pointer-events: none;
  border: 3px solid rgba(134, 239, 172, .9); opacity: 0;
  animation: riddle-burst .7s ease-out .12s both;
}
#grid.is-solved::after { border-width: 2px; border-color: rgba(253, 224, 71, .85); animation-delay: .26s; }

/* Casillas de la palabra (solo con la pista de letras abierta y mientras se traza). */
.riddle-slots {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 0; pointer-events: none;
  display: flex; gap: 3px; align-items: center;
}
.riddle-slots[hidden] { display: none; }
.riddle-slot {
  width: 6px; height: 6px; border-radius: 50%; box-sizing: border-box;
  border: 1.5px solid currentColor; opacity: .5; transition: transform .15s, opacity .15s, background-color .15s;
}
.riddle-slot.is-filled { background: currentColor; opacity: .95; transform: scale(1.15); }
.riddle-slots { color: var(--text-color, #e5e7eb); }
body.theme-light.riddle-page .riddle-slots { color: #fff; }
.riddle-slots.is-full { color: #4ade80; }
.riddle-slots.is-over { color: #f87171; }

/* Fin de tanda: el total sube desde 0 y aterriza; el sello de tanda máxima entra después. */
.riddle-page #riddle-end-streak { font-variant-numeric: tabular-nums; }
.riddle-page #riddle-end-streak.is-landed { animation: riddle-land .45s cubic-bezier(.34, 1.56, .64, 1); }
.riddle-page #riddle-end-record { animation: riddle-badge-in .5s cubic-bezier(.34, 1.56, .64, 1) .55s both; }
.riddle-page #riddle-end-reveal { animation: riddle-rise .45s ease-out .2s both; }

@keyframes riddle-hint-open {
  0% { transform: scale(.94); box-shadow: 0 0 0 0 rgba(129, 140, 248, .7); }
  45% { transform: scale(1.04); }
  100% { transform: scale(1); box-shadow: 0 0 0 12px rgba(129, 140, 248, 0); }
}
@keyframes riddle-delta {
  0% { opacity: 0; transform: translateY(-4px) scale(.8); }
  18% { opacity: 1; transform: translateY(2px) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}
@keyframes riddle-charge { 30% { transform: scale(.86); color: #f87171; } }
@keyframes riddle-vignette { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }
@keyframes riddle-streak-pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes riddle-plus { 0% { opacity: 0; transform: translateY(4px) scale(.7); } 25% { opacity: 1; transform: translateY(-2px) scale(1.05); } 100% { opacity: 0; transform: translateY(-16px); } }
@keyframes riddle-solved-lift {
  0% { transform: scale(1); }
  45% { transform: translateY(-7px) scale(1.12); box-shadow: 0 10px 18px -6px rgba(22, 163, 74, .7), 0 0 0 2px rgba(255, 255, 255, .5); }
  100% { transform: translateY(-3px) scale(1.06); box-shadow: 0 6px 14px -6px rgba(22, 163, 74, .6), 0 0 16px rgba(74, 222, 128, .55); }
}
@keyframes riddle-burst { 0% { opacity: .95; transform: scale(.3); } 100% { opacity: 0; transform: scale(3.2); } }
@keyframes riddle-land { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes riddle-badge-in { from { opacity: 0; transform: translateY(6px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes riddle-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .riddle-hint.is-open.just-opened, .riddle-timer.is-charged, .riddle-play.is-urgent::before,
  .riddle-streak.is-up strong,
  #grid .letter.riddle-solved, #grid.is-solved::before, #grid.is-solved::after,
  .riddle-page #riddle-end-streak.is-landed, .riddle-page #riddle-end-record, .riddle-page #riddle-end-reveal { animation: none; }
  .riddle-streak.is-up strong::after, #grid.is-solved::before, #grid.is-solved::after { display: none; }
  .riddle-timer.is-charged::after { animation: none; opacity: 1; }
  #grid .letter.riddle-solved { transform: translateY(-3px) scale(1.06); }
}
