/* ===== Minijuegos: tema noche + efectos (se activa con body.night) ===== */

/* Marcadores y botones de respuesta */
.night .game-head h2 { -webkit-text-stroke: 6px #000; text-shadow: 0 3px 0 #000; }
.night .stats-bar span {
  background: var(--n-panel-2); color: #7dffa0; border-color: var(--n-black);
  box-shadow: inset 0 0 0 2px var(--n-edge), inset 0 3px 0 rgba(0, 0, 0, 0.35);
}
.night .stats-bar b { text-shadow: 0 0 8px rgba(125, 255, 160, 0.55); }
.night .opt {
  background: var(--n-panel); color: var(--n-text); border-color: var(--n-black);
  box-shadow: inset 0 0 0 3px var(--n-edge), 0 4px 0 rgba(0, 0, 0, 0.55);
  transition: transform 0.12s, background 0.15s;
}
.night .opt:hover:not(:disabled) { background: #1d2060; transform: translateY(-2px); }
.night .opt:active:not(:disabled) { transform: translateY(2px); }
.night .opt:focus-visible, .night .btn:focus-visible { outline-color: #ffd23f; }
.night .opt.ok { background: #14532d; color: #d9ffe5; box-shadow: inset 0 0 0 3px #2fbf63, 0 0 16px rgba(47, 191, 99, 0.45), 0 4px 0 rgba(0, 0, 0, 0.55); }
.night .opt.ok::before { color: #7dffa0; }
.night .opt.bad { background: #5b1420; color: #ffd9de; box-shadow: inset 0 0 0 3px #e4485a, 0 4px 0 rgba(0, 0, 0, 0.55); }
.night .opt.bad::before { color: #ff7a85; }
.night .opt:disabled:not(.ok):not(.bad) { opacity: 0.55; }
.opt-key { position: absolute; right: 10px; top: 8px; font-size: 8px; opacity: 0.45; }
@media (hover: none) { .opt-key { display: none; } }

/* ---------- 1 · ¿Quién es ese Pokémon? ---------- */
.night .whos-stage {
  isolation: isolate; background: #0b0c2b; border-color: var(--n-black);
  box-shadow: inset 0 0 0 3px var(--n-edge), 0 6px 0 rgba(0, 0, 0, 0.55);
}
.night .rays { z-index: -2; background: repeating-conic-gradient(from 0deg, #121447 0 10deg, #1c1f6b 10deg 20deg); opacity: 0.95; }
.night .whos-stage::before { /* foco de luz tras el Pokémon */
  content: ''; position: absolute; left: 50%; top: 52%; width: 70%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 210, 63, 0.28), transparent 62%); pointer-events: none; z-index: -1;
}
.night .whos-banner { -webkit-text-stroke: 6px #0b0c2b; text-shadow: 0 3px 0 #000; }
.night .timer { background: #0b0c2b; border-color: var(--n-black); box-shadow: inset 0 0 0 2px var(--n-edge); }
.night .timer > div { background: repeating-linear-gradient(45deg, #4cd964 0 8px, #3ab954 8px 16px); }
.night .timer > div.warn { background: repeating-linear-gradient(45deg, #ff5a5f 0 8px, #d63a40 8px 16px); animation: timer-warn 0.5s steps(2) infinite; }
@keyframes timer-warn { 50% { opacity: 0.55; } }

.whos-stage img.hidden { filter: brightness(0) drop-shadow(0 0 3px #fff2a8) drop-shadow(0 0 16px rgba(255, 210, 63, 0.55)); }
.whos-stage img:not(.hidden) { animation: whos-reveal 0.5s cubic-bezier(.2, 1.6, .4, 1); }
.whos-stage img.whos-in.hidden { animation: whos-enter 0.45s ease-out; }
@keyframes whos-enter { from { transform: translateX(40px) scale(0.9); opacity: 0; } }
@keyframes whos-reveal { 0% { transform: scale(0.88); } 100% { transform: scale(1); } }

/* Resultado: brillo, chispas, sacudida */
.whos-stage.win { animation: stage-win 0.6s ease-out; }
.whos-stage.lose, .whos-stage.late { animation: stage-shake 0.4s steps(6); }
@keyframes stage-win { 0% { box-shadow: inset 0 0 0 3px var(--n-edge), 0 0 0 rgba(255, 210, 63, 0); } 40% { box-shadow: inset 0 0 0 3px #ffd23f, 0 0 26px rgba(255, 210, 63, 0.75); } 100% { box-shadow: inset 0 0 0 3px var(--n-edge), 0 6px 0 rgba(0, 0, 0, 0.55); } }
@keyframes stage-shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.whos-spark { position: absolute; left: 50%; top: 55%; width: 10px; height: 10px; opacity: 0; pointer-events: none; background: #fff2a8; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.whos-stage.win .whos-spark { animation: spark-out 0.9s ease-out forwards; animation-delay: calc(var(--i) * 40ms); }
.whos-spark:nth-of-type(1) { --dx: -120px; --dy: -70px; } .whos-spark:nth-of-type(2) { --dx: 120px; --dy: -80px; }
.whos-spark:nth-of-type(3) { --dx: -150px; --dy: 10px; } .whos-spark:nth-of-type(4) { --dx: 150px; --dy: 0px; }
.whos-spark:nth-of-type(5) { --dx: -70px; --dy: -110px; } .whos-spark:nth-of-type(6) { --dx: 80px; --dy: -115px; }
@keyframes spark-out { 0% { transform: translate(0, 0) scale(0.4); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1.8) rotate(90deg); opacity: 0; } }
.whos-streak { position: absolute; right: 12px; top: 10px; font-family: var(--px); font-size: 11px; color: #ffb347; text-shadow: 0 2px 0 #000; animation: streak-pop 0.4s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes streak-pop { from { transform: scale(0.4); opacity: 0; } }

/* Las opciones entran escalonadas */
.night .opts .opt { animation: opt-in 0.3s ease-out backwards; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes opt-in { from { transform: translateY(8px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .whos-stage.win, .whos-stage.lose, .whos-stage.late, .night .opts .opt, .whos-stage img { animation: none; }
}

/* ---------- 2 · Combate ---------- */
/* Arena nocturna: cielo morado con estrellas y suelo oscuro con baldosas */
.night .battlefield {
  border-color: var(--n-black); box-shadow: inset 0 0 0 3px var(--n-edge), 0 6px 0 rgba(0, 0, 0, 0.55);
  background:
    radial-gradient(circle at 12% 18%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 28% 9%, #fff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 46% 22%, #cfd4ff 0 1px, transparent 2px),
    radial-gradient(circle at 63% 8%, #fff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 81% 16%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 92% 30%, #cfd4ff 0 1.5px, transparent 2.5px),
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(255, 96, 40, 0.28), transparent 70%),
    linear-gradient(#0a0820, #2a1160 62%, #4a1f78);
}
.night .battlefield::before {
  border-top-color: #070618;
  background: conic-gradient(#1c2b4a 25%, #17233f 0 50%, #1c2b4a 0 75%, #17233f 0) 0 0 / 44px 44px;
}
.night .pad { border-color: #070618; background: radial-gradient(ellipse at 50% 38%, #3b4f86, #1b2850 72%); box-shadow: 0 0 14px rgba(120, 140, 255, 0.35), 0 4px 0 rgba(0, 0, 0, 0.4); }
.night .hud {
  background: #0d0f33; color: var(--n-text); border-color: var(--n-black);
  box-shadow: inset 0 0 0 2px var(--n-edge), 0 3px 0 rgba(0, 0, 0, 0.45);
}
.night .hp-tag { background: #000; color: #ffb347; }
.night .hpbar { background: #05061c; border-color: var(--n-black); }
.hud.low { animation: hud-low 0.8s steps(2) infinite; }
@keyframes hud-low { 50% { border-color: #e4202a; box-shadow: inset 0 0 0 2px #e4202a, 0 0 12px rgba(228, 32, 42, 0.6); } }
.hpbar > div { transition: width 0.7s steps(14), background-color 0.2s; }

.night .menu-box { background: var(--n-panel); border-color: var(--n-black); box-shadow: inset 0 0 0 3px var(--n-edge), 0 6px 0 rgba(0, 0, 0, 0.5); }
.night .mv { background: var(--n-panel-2); color: var(--n-text); border-color: var(--n-black); border-left-color: var(--tc, #5b6bd8); transition: transform 0.1s, background 0.15s; }
.night .mv:hover:not(:disabled) { background: #1d2060; transform: translateY(-2px); }
.night .mv:active:not(:disabled) { transform: translateY(2px); }
.night .mv small { color: var(--n-soft); }
.night .mv:focus-visible { outline: 3px solid #ffd23f; outline-offset: 2px; }
.mv::after { content: attr(data-key); position: absolute; right: 6px; top: 5px; font-size: 7px; opacity: 0.45; }
@media (hover: none) { .mv::after { display: none; } }
.night .battle-dialog { color: var(--n-text); }

/* Números de daño según eficacia */
.dmg.crit { color: #ffd23f; font-size: clamp(14px, 4.6cqw, 26px); animation-duration: 1.1s; }
.dmg.weak { color: #aab2d8; }
/* Impacto, esfera de ataque, curación y destello */
.fx-burst, .fx-orb, .fx-plus { position: absolute; z-index: 4; pointer-events: none; transform: translate(-50%, -50%); }
.fx-burst { width: 22cqw; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #fff 0 12%, var(--tc, #fff) 30%, transparent 68%); animation: burst 0.5s ease-out forwards; }
.fx-burst.big { width: 34cqw; }
@keyframes burst { from { transform: translate(-50%, -50%) scale(0.2); opacity: 1; } to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
.fx-orb { width: 7cqw; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #fff 0 25%, var(--tc, #fff) 60%, transparent 72%); box-shadow: 0 0 18px var(--tc, #fff); }
.fx-plus { color: #5be37d; font-family: var(--px); font-size: clamp(12px, 3.5cqw, 20px); text-shadow: 0 2px 0 #000; animation: plus-up 0.9s ease-out backwards forwards; }
.fx-plus::before { content: '+'; }
@keyframes plus-up { from { transform: translate(calc(-50% + var(--dx, 0px)), 10px); opacity: 0; } 30% { opacity: 1; } to { transform: translate(calc(-50% + var(--dx, 0px)), -50px); opacity: 0; } }
.fx-flash { position: absolute; inset: 0; z-index: 5; pointer-events: none; background: #fff; animation: flash 0.3s ease-out forwards; }
@keyframes flash { from { opacity: 0.7; } to { opacity: 0; } }
/* Pokémon ganador en la ventana final */
.modal img.win-bounce { animation: win-bounce 0.9s ease-in-out infinite alternate; }
@keyframes win-bounce { to { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .hud.low, .modal img.win-bounce { animation: none; } }

/* ---------- 3 · Captura ---------- */
.night .catch-bar {
  background: #05061c; border-color: var(--n-black); box-shadow: inset 0 0 0 2px var(--n-edge);
  transition: box-shadow 0.12s;
}
.night .catch-bar.in { box-shadow: inset 0 0 0 2px #7dffa0, 0 0 14px rgba(125, 255, 160, 0.55); }
.night .catch-zone { border-color: #07220f; box-shadow: 0 0 12px rgba(76, 217, 100, 0.55); }
.night .catch-marker { border-color: #000; box-shadow: 0 0 10px #ffd23f; }
.catch-bar.in .catch-marker { background: #fff; box-shadow: 0 0 14px #fff2a8; }
/* El Pokémon salvaje respira con suavidad (propiedad `translate`, no choca con las animaciones del lanzamiento) */
.catch-scene .fsprite.opp { animation: wild-idle 1.5s ease-in-out infinite alternate; }
@keyframes wild-idle { from { translate: 0 0; } to { translate: 0 -1.6cqw; } }
.night .pball { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12), 0 0 14px rgba(255, 255, 255, 0.35); }
.catch-ring { position: absolute; z-index: 4; width: 40px; aspect-ratio: 1; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%); border: 4px solid #ff7a85; animation: catch-ring 0.7s ease-out forwards; }
.catch-ring.good { border-color: #ffd23f; box-shadow: 0 0 14px #ffd23f; }
@keyframes catch-ring { from { transform: translate(-50%, -50%) scale(0.3); opacity: 1; } to { transform: translate(-50%, -50%) scale(3.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .catch-scene .fsprite.opp, .catch-ring { animation: none; } }

/* ---------- 4 · Memory ---------- */
.memory-grid { position: relative; }
.tile { animation: deal 0.35s ease-out backwards; animation-delay: calc(var(--i, 0) * 30ms); transition: translate 0.12s; }
@keyframes deal { from { transform: translateY(-14px) scale(0.8); opacity: 0; } }
.night .tile:hover:not(.matched):not(.flipped) { translate: 0 -3px; }
.night .tile:focus-visible { outline-color: #ffd23f; }
.night .tile-face { border-color: var(--n-black); }
.night .tile-front { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.28), 0 4px 0 rgba(0, 0, 0, 0.55); }
.night .tile-back { background: #12154a; box-shadow: inset 0 0 0 3px var(--n-edge); }
.night .tile.matched .tile-back { background: #14532d; box-shadow: inset 0 0 0 3px #2fbf63, 0 0 16px rgba(47, 191, 99, 0.5); }
.night .tile.matched .tile-back img { filter: drop-shadow(0 0 6px rgba(125, 255, 160, 0.6)); }
.confetti { position: absolute; top: -6px; width: 8px; height: 12px; pointer-events: none; z-index: 3; animation: confetti-fall 1.5s ease-in forwards; }
@keyframes confetti-fall { from { transform: translateY(0) rotate(0); opacity: 1; } to { transform: translate(var(--dx, 0), 420px) rotate(var(--r, 360deg)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tile { animation: none; } }

/* ---------- 5 · Más o menos ---------- */
.vs-bar { height: 8px; margin: 6px auto 0; max-width: 170px; border-radius: 4px; background: rgba(0, 0, 0, 0.18); overflow: hidden; }
.vs-bar > i { display: block; height: 100%; background: #5b8dff; }
.night .vs-bar { background: #05061c; box-shadow: inset 0 0 0 1px var(--n-edge); }
.night .vs-card img { background: radial-gradient(circle, #2a2d6e 0 62%, transparent 64%); }
.night .vs-value { color: #9db4ff; text-shadow: 0 0 8px rgba(157, 180, 255, 0.4); }
.night .vs-value.good { color: #7dffa0; text-shadow: 0 0 10px rgba(125, 255, 160, 0.6); }
.night .vs-value.bad { color: #ff7a85; text-shadow: 0 0 10px rgba(255, 122, 133, 0.6); }
.night .vs-card.win { box-shadow: inset 0 0 0 3px #2fbf63, 0 0 20px rgba(47, 191, 99, 0.5), 0 6px 0 rgba(0, 0, 0, 0.5); }
.night .vs-card.lose { box-shadow: inset 0 0 0 3px #e4485a, 0 0 20px rgba(228, 72, 90, 0.45), 0 6px 0 rgba(0, 0, 0, 0.5); animation: stage-shake 0.4s steps(6); }
.night .vs-card.win .vs-bar > i { background: #2fbf63; }
.night .vs-card.lose .vs-bar > i { background: #e4485a; }
.night .vs-badge { background: linear-gradient(135deg, #e4202a, #ff9d1c); border-color: var(--n-black); animation: vs-pulse 1.4s ease-in-out infinite alternate; }
@keyframes vs-pulse { to { transform: scale(1.1); } }
.vs-in { animation: vs-enter 0.4s ease-out; }
@keyframes vs-enter { from { transform: translateX(40px); opacity: 0; } }
.streak-hot { color: #ffb347 !important; }
.night .btn.ghost:disabled, .night .btn:disabled { opacity: 0.5; }
@media (prefers-reduced-motion: reduce) { .night .vs-badge, .vs-in, .night .vs-card.lose { animation: none; } }

/* ---------- 6 · Quiz de tipos ---------- */
.qz-dots { display: flex; gap: 6px; justify-content: center; margin: -4px 0 12px; }
.qz-dots i { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--ink); background: #44445c; }
.night .qz-dots i { border-color: var(--n-black); background: #0b0c2b; box-shadow: inset 0 0 0 1px var(--n-edge); }
.qz-dots i.now { background: #ffd23f; animation: blink 0.9s steps(2) infinite; }
.qz-dots i.ok { background: #2fbf63; box-shadow: 0 0 8px rgba(47, 191, 99, 0.7); }
.qz-dots i.bad { background: #e4485a; box-shadow: 0 0 8px rgba(228, 72, 90, 0.7); }
.qz-versus { display: flex; align-items: flex-end; justify-content: center; gap: 14px; }
.qz-versus small { display: block; margin-bottom: 4px; font-size: 7px; color: var(--muted); }
.night .qz-versus small { color: var(--n-soft); }
.qz-versus .chip { font-size: 10px; padding: 7px 12px; }
.qz-arrow { font-size: 18px; padding-bottom: 6px; color: #ffd23f; text-shadow: 0 2px 0 #000; }
.night .panel.right { box-shadow: inset 0 0 0 3px #2fbf63, 0 0 18px rgba(47, 191, 99, 0.45), 0 6px 0 rgba(0, 0, 0, 0.5); }
.night .panel.wrong { box-shadow: inset 0 0 0 3px #e4485a, 0 0 18px rgba(228, 72, 90, 0.4), 0 6px 0 rgba(0, 0, 0, 0.5); animation: stage-shake 0.4s steps(6); }
.qz-feedback { min-height: 3.2em; margin-top: 14px; }
.qz-feedback.good, .qz-feedback.bad { animation: streak-pop 0.35s cubic-bezier(.2, 1.6, .4, 1); }
.night .qz-feedback.good { color: #7dffa0; }
.night .qz-feedback.bad { color: #ff9aa4; }
@media (prefers-reduced-motion: reduce) { .qz-dots i.now, .night .panel.wrong, .qz-feedback { animation: none; } }

/* ---------- 7 · Caza rápida ---------- */
.night .field {
  border-color: var(--n-black); box-shadow: inset 0 0 0 3px var(--n-edge), 0 6px 0 rgba(0, 0, 0, 0.55);
  background: conic-gradient(#1c2b4a 25%, #17233f 0 50%, #1c2b4a 0 75%, #17233f 0) 0 0 / 40px 40px;
}
.night .hole { border-color: #070618; background: radial-gradient(ellipse at 50% 60%, #02020c 0 48%, #2a2f66 50% 100%); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5); }
.night .hole:focus-visible { outline: 4px solid #ffd23f; outline-offset: 3px; }
.hole::after { content: attr(data-key); position: absolute; right: 8px; bottom: 6px; font-family: var(--px); font-size: 8px; color: #fff; opacity: 0.25; pointer-events: none; }
@media (hover: none) { .hole::after { display: none; } }
.night .hole.up { box-shadow: 0 0 16px rgba(255, 210, 63, 0.35), 0 4px 0 rgba(0, 0, 0, 0.5); }
.night .hole img { filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.25)); }
.whack-pop { position: absolute; left: 50%; top: 30%; z-index: 3; font-family: var(--px); font-size: 14px; white-space: nowrap; pointer-events: none; -webkit-text-stroke: 4px #000; paint-order: stroke fill; animation: whack-pop-up 0.7s ease-out forwards; }
.whack-pop.good { color: #7dffa0; }
.whack-pop.bad { color: #ff7a85; font-size: 18px; }
@keyframes whack-pop-up { from { transform: translate(-50%, 0); opacity: 1; } to { transform: translate(-50%, -46px); opacity: 0; } }
.field.hurt { animation: stage-shake 0.4s steps(6), hurt-flash 0.45s ease-out; }
@keyframes hurt-flash { from { box-shadow: inset 0 0 0 4px #e4202a, 0 0 28px rgba(228, 32, 42, 0.8); } }
.stats-bar b.bump { display: inline-block; animation: streak-pop 0.25s cubic-bezier(.2, 1.6, .4, 1); }
.stats-bar span.low { animation: timer-warn 0.5s steps(2) infinite; }
.night .stats-bar span.low b { color: #ff7a85; text-shadow: 0 0 8px rgba(255, 122, 133, 0.7); }
.whack-timer { max-width: 540px; margin: 14px auto 0; }
.night .whack-timer { background: #0b0c2b; border-color: var(--n-black); box-shadow: inset 0 0 0 2px var(--n-edge); }
.night .whack-timer > div.warn { background: repeating-linear-gradient(45deg, #ff5a5f 0 8px, #d63a40 8px 16px); }
@media (prefers-reduced-motion: reduce) { .field.hurt, .stats-bar span.low, .stats-bar b.bump, .whack-pop { animation: none; } }
