/*
 * QueenMary — estilos.
 * Concepto: una máquina arcade de medianoche con aire de realeza.
 * Fondo púrpura casi negro con líneas de CRT, oro para la corona, el SCORE y
 * lo valioso; cian para lo que el jugador elige; verde y rojo solo para
 * acierto y error. Un solo aspecto oscuro, a propósito.
 */
:root {
  color-scheme: dark;
  --bg: #120a20;
  --bg-2: #1a0f2e;
  --panel: #221539;
  --panel-2: #2e1d4c;
  --line: #4a3477;
  --text: #f4eeff;
  --muted: #ab9bcd;
  --gold: #f5c451;
  --gold-2: #ffe29a;
  --gold-deep: #a8761f;
  --cyan: #66e5ff;
  --rosa: #ff8fd0;
  /* Colores de las 6 dificultades (Fácil → Muy difícil) */
  --d1: #4fe39c;
  --d2: #a6e45a;
  --d3: #f5c451;
  --d4: #ffa24f;
  --d5: #ff6f5e;
  --d6: #ff3d7f;
  --ok: #4fe39c;
  --bad: #ff5170;
  --warn: #ffb44f;
  --ink: #1a0f2e;

  --font-logo: "Bungee", "Impact", "Arial Black", sans-serif;
  --font-hud: "Press Start 2P", ui-monospace, "Courier New", monospace;
  --font-text: "Chakra Petch", "Segoe UI", system-ui, sans-serif;

  --radio: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(120, 70, 200, 0.35), transparent 60%),
    radial-gradient(80% 50% at 50% 110%, rgba(245, 196, 81, 0.08), transparent 70%),
    var(--bg);
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
/* Franja bajo la barra de estado del celular (app instalada / APK): el contenido no se ve por detrás al hacer scroll. */
html::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 0px);
  background: var(--bg);
  z-index: 40;
}
/* Líneas de pantalla CRT, muy suaves. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px);
  z-index: 50;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

#app {
  max-width: 520px;
  min-height: 100%;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Tipografía y utilidades ---------- */
.hud-font { font-family: var(--font-hud); letter-spacing: 0.04em; }
.etiqueta {
  font-family: var(--font-hud);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}
.muted { color: var(--muted); }
.centro { text-align: center; }
.fila { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.columna { display: flex; flex-direction: column; gap: 10px; }
.separador { height: 1px; background: var(--line); border: 0; margin: 4px 0; }

/* ---------- Botones ---------- */
.btn {
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 16px;
  border-radius: 6px;
  border: 2px solid var(--gold);
  background: var(--panel);
  color: var(--gold-2);
  box-shadow: 0 4px 0 var(--gold-deep);
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
  text-align: center;
  line-height: 1.4;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-deep); }
.btn.principal { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--ink); }
.btn.secundario { border-color: var(--line); color: var(--text); box-shadow: 0 4px 0 #120a20; }
.btn.chico { font-size: 9px; padding: 10px 12px; }
.btn.peligro { border-color: var(--bad); color: var(--bad); box-shadow: 0 4px 0 #5a1426; }
.btn:disabled { opacity: 0.35; box-shadow: none; transform: none; }
.btn.bloque { width: 100%; }

.enlace {
  background: none;
  border: 0;
  color: var(--cyan);
  text-decoration: underline;
  padding: 4px 0;
  font-size: 14px;
}

/* ---------- Portada ---------- */
.portada { display: flex; flex-direction: column; gap: 18px; align-items: stretch; padding-top: 18px; }
.marquesina { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.corona { width: 64px; height: auto; overflow: visible; filter: drop-shadow(0 0 12px rgba(245, 196, 81, 0.5)); }
/* Logo: un solo SVG (QUEEN + corona-slash + MARY) que se escala al ancho disponible. */
.logo { margin: 0; width: 100%; max-width: 440px; line-height: 0; }
.logo-svg { width: 100%; height: auto; display: block; overflow: visible; filter: drop-shadow(0 3px 0 #3a2160) drop-shadow(0 0 18px rgba(245, 196, 81, 0.25)); }
.logo-texto { font-family: var(--font-logo); font-size: 100px; }
.solo-lector { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Dibujo de la portada (dos caritas en neón) */
.dibujo { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto; }
.dibujo.chico { max-width: 180px; }

/* Celebración al coronarse (los dibujos bailan al ritmo de la música: 100 BPM = 0,6 s por tiempo) */
.fiesta { position: relative; width: 100%; max-width: 440px; aspect-ratio: 820 / 640; margin: 6px auto 0; }
.fiesta .fp { position: absolute; z-index: 1; animation: fp-entra 0.75s cubic-bezier(0.2, 1.5, 0.4, 1) both; animation-delay: calc(var(--i) * 0.2s + 0.2s + var(--t)); }
.fiesta .fp img { display: block; width: 100%; height: auto; transform-origin: 50% 100%; }
.fp-oso img { animation: fp-salto 0.6s ease-in-out calc(1.4s + var(--t)) infinite alternate; }
.fp-panda img { animation: fp-vaiven 1.2s ease-in-out calc(1.4s + var(--t)) infinite alternate; transform-origin: 40% 100%; }
.fp-lentes img { animation: fp-bote 0.6s ease-in-out calc(1.4s + var(--t)) infinite alternate; }
.fp-mono img { animation: fp-bote 0.6s ease-in-out calc(1.7s + var(--t)) infinite alternate; }
.fp-corazon img { animation: fp-latido 0.6s ease-in-out calc(1.4s + var(--t)) infinite alternate; transform-origin: 50% 60%; }
.fiesta-corona { position: absolute; left: 7%; top: 63%; width: 21%; z-index: 1; animation: fp-entra 0.75s cubic-bezier(0.2, 1.5, 0.4, 1) calc(1.3s + var(--t)) both; }
.fiesta-corona svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 10px rgba(245, 196, 81, 0.75)); animation: fp-corona 1.2s ease-in-out calc(2s + var(--t)) infinite alternate; }
@keyframes fp-entra { 0% { transform: translateY(18%) scale(0.2); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes fp-salto { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-9%) rotate(6deg); } }
@keyframes fp-vaiven { from { transform: rotate(-5deg); } to { transform: rotate(4deg) translateY(-3%); } }
@keyframes fp-bote { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-7%) rotate(3deg); } }
@keyframes fp-latido { from { transform: scale(0.92) translateY(4%); } to { transform: scale(1.12) translateY(-4%); } }
@keyframes fp-corona { from { transform: rotate(-8deg) translateY(0); } to { transform: rotate(6deg) translateY(-8%); } }
.confeti { position: absolute; inset: -6% -4% 0; overflow: hidden; pointer-events: none; z-index: 0; }
.confeti i { position: absolute; top: -14%; height: 114%; width: 8px; animation: fp-caer var(--d) linear calc(var(--e) + var(--t)) 3 both; }
.confeti i::before { content: ""; position: absolute; top: 0; left: 0; width: 7px; height: 11px; border-radius: 2px; background: var(--c); box-shadow: 0 0 6px var(--c); animation: fp-girar 0.8s linear infinite; }
@keyframes fp-caer { from { transform: translate(0, 0); opacity: 1; } 85% { opacity: 1; } to { transform: translate(var(--x), 100%); opacity: 0; } }
@keyframes fp-girar { to { transform: rotate(var(--r)) scaleX(0.3); } }
.keep-going { display: block; width: 100%; max-width: 380px; height: auto; margin: 0 auto; overflow: visible; }
.avatar { width: 64px; height: 64px; display: block; margin: 0 auto; }
.avatar.grande { width: 120px; height: 120px; }
.avatar.mini { width: 28px; height: 28px; display: inline-block; vertical-align: middle; margin: -6px 4px -6px 0; }
.lema { font-family: var(--font-hud); font-size: 9px; color: var(--cyan); letter-spacing: 0.14em; }
.parpadeo { animation: parpadeo 1.1s steps(2, start) infinite; }
@keyframes parpadeo { to { visibility: hidden; } }

.hi-portada {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-family: var(--font-hud);
  font-size: 11px;
}
.hi-portada b { color: var(--gold); font-weight: 400; }

.aviso-modo {
  border: 1px dashed var(--line);
  border-radius: var(--radio);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--muted);
  background: rgba(34, 21, 57, 0.6);
}
.aviso-modo strong { color: var(--text); }

/* ---------- HUD de juego ---------- */
.hud {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: stretch;
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: linear-gradient(180deg, var(--bg) 70%, rgba(18, 10, 32, 0));
  padding-bottom: 6px;
}
.hud-caja {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.hud-valor { font-family: var(--font-hud); font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-valor.oro { color: var(--gold); }
.hud-valor.negativo { color: var(--bad); }
.hud-boton {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-family: var(--font-hud);
  font-size: 9px;
  color: var(--muted);
  min-width: 44px;
}
.hud-boton[aria-pressed="true"] { color: var(--gold); border-color: var(--gold-deep); }

.jugador-turno { font-family: var(--font-hud); font-size: 10px; color: var(--cyan); text-align: center; }

/* Escalera de 10 niveles */
.escalera { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.peldano {
  position: relative;
  height: 26px;
  border-radius: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-family: var(--font-hud);
  font-size: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.peldano.pasado { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--ink); border-color: var(--gold); }
.peldano.actual { border: 2px solid var(--cyan); color: var(--cyan); box-shadow: 0 0 10px rgba(102, 229, 255, 0.5); animation: latir 1.4s ease-in-out infinite; }
.peldano .marca {
  position: absolute;
  bottom: -14px;
  font-size: 7px;
  color: var(--gold);
  white-space: nowrap;
}
.peldano::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--dif, transparent); }
.peldano.pasado::after { opacity: 0.45; }
.escalera-pie { min-height: 14px; padding-top: 4px; text-align: right; font-family: var(--font-hud); font-size: 7px; color: var(--muted); letter-spacing: 0.06em; }

/* Selector de dificultad (portada) */
.dificultad-sel { display: flex; flex-direction: column; gap: 9px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radio); padding: 12px; }
.ds-cabeza { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-family: var(--font-hud); font-size: 8px; color: var(--muted); letter-spacing: 0.06em; }
.ds-cabeza b { color: var(--text); font-weight: 400; font-size: 10px; margin-left: 4px; }
.ds-mult { color: var(--gold); white-space: nowrap; }
.ds-opciones { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ds-opcion {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  font-family: var(--font-hud);
  font-size: 7px;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 2px;
  cursor: pointer;
}
.ds-opcion .estrellas { color: var(--gold-deep); font-family: var(--font-text); font-size: 10px; letter-spacing: -1px; line-height: 1; }
.ds-opcion[aria-checked="true"] { border-color: var(--gold); background: rgba(245, 196, 81, 0.12); color: var(--text); box-shadow: 0 0 12px rgba(245, 196, 81, 0.25); }
.ds-opcion[aria-checked="true"] .estrellas { color: var(--gold); }
.punto-dif { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dif); margin-right: 3px; vertical-align: 1px; }
.tabla-desliza { overflow-x: auto; }
.tabla-modos { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tabla-modos th { font-family: var(--font-hud); font-size: 7px; color: var(--muted); font-weight: 400; padding: 6px 3px; white-space: nowrap; }
.tabla-modos td { padding: 6px 3px; border-top: 1px solid var(--line); text-align: center; }
.tabla-modos td:first-child, .tabla-modos th:first-child { text-align: left; }
.tabla-hi td.dif { font-family: var(--font-hud); font-size: 8px; color: var(--muted); }
@keyframes latir { 50% { box-shadow: 0 0 2px rgba(102, 229, 255, 0.2); } }

/* ---------- Comodines ---------- */
.comodines { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.comodin {
  position: relative;
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--radio);
  padding: 9px 6px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 74px;
  transition: transform 0.12s, border-color 0.2s, background 0.2s;
  overflow: hidden;
}
.comodin svg { width: 24px; height: 24px; }
.comodin .nombre { font-size: 12px; font-weight: 700; line-height: 1.1; text-align: center; }
.comodin .costo { font-family: var(--font-hud); font-size: 7px; color: var(--bad); }
.comodin .cantidad {
  position: absolute;
  top: 4px;
  right: 5px;
  font-family: var(--font-hud);
  font-size: 8px;
  color: var(--ink);
  background: var(--gold);
  border-radius: 3px;
  padding: 2px 3px;
}
.comodin.disponible { border-color: var(--gold-deep); color: var(--gold-2); }
.comodin.disponible:active { transform: scale(0.96); }
.comodin.disponible:hover { border-color: var(--gold); }
.comodin.inactivo { opacity: 0.55; }
.comodin.usado { color: var(--muted); background: var(--panel); filter: grayscale(0.8); }
.comodin.usado::before, .comodin.usado::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 84%;
  height: 4px;
  background: var(--bad);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255, 81, 112, 0.6);
}
.comodin.usado::before { transform: translate(-50%, -50%) rotate(35deg); }
.comodin.usado::after { transform: translate(-50%, -50%) rotate(-35deg); }
.comodin.bloqueado { border-style: dashed; color: var(--muted); background: transparent; }
.comodin.bloqueado .costo { color: var(--muted); }
.comodin.temporal { border: 2px dashed var(--cyan); color: var(--cyan); box-shadow: 0 0 12px rgba(102, 229, 255, 0.35); }
.comodin.recarga { border-color: var(--warn); color: var(--warn); }
.comodin.anim-usado { animation: sello 0.6s ease-out; }
.comodin.anim-usado::before, .comodin.anim-usado::after { animation: tachar 0.45s ease-out; }
.comodin.anim-ganado { animation: aparecer 0.9s cubic-bezier(.2, 1.6, .4, 1); box-shadow: 0 0 22px rgba(245, 196, 81, 0.8); border-color: var(--gold); }
@keyframes sello { 0% { transform: scale(1.15); } 40% { transform: scale(0.94); } 100% { transform: scale(1); } }
@keyframes tachar { from { width: 0; } }
@keyframes aparecer { 0% { transform: scale(0.3) rotate(-8deg); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }

.acciones-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Temáticas ---------- */
.titulo-seccion { font-family: var(--font-hud); font-size: 11px; color: var(--gold); margin: 6px 0 0; line-height: 1.6; text-wrap: balance; }
.tematicas { display: flex; flex-direction: column; gap: 10px; }
.tematica {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radio);
  padding: 16px;
  text-align: left;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s, transform 0.08s;
}
.tematica:hover { border-color: var(--gold); }
.tematica:active { transform: scale(0.98); }
.tematica .flecha { color: var(--gold); font-family: var(--font-hud); font-size: 12px; }
.tematica.sorpresa { border-style: dashed; border-color: var(--cyan); }
.tematica.sorpresa small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 3px; }

/* ---------- Pregunta ---------- */
.tarjeta {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-family: var(--font-hud);
  font-size: 7px;
  letter-spacing: 0.08em;
  padding: 5px 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-transform: uppercase;
}
.chip.tema { color: var(--gold-2); border-color: var(--gold-deep); }
.chip.fuente-ia { color: var(--cyan); border-color: rgba(102, 229, 255, 0.4); }
.pregunta-texto { font-size: 21px; font-weight: 600; line-height: 1.3; margin: 0; text-wrap: balance; }

.reloj { height: 6px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.reloj-barra { height: 100%; background: var(--cyan); width: 100%; transition: width 0.25s linear; }
.reloj.alerta .reloj-barra { background: var(--bad); }
.reloj-texto { font-family: var(--font-hud); font-size: 9px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.reloj-texto.alerta { color: var(--bad); }

.opciones { display: flex; flex-direction: column; gap: 10px; }
.opcion {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: var(--bg-2);
  border: 2px solid var(--line);
  border-radius: var(--radio);
  padding: 12px;
  font-size: 17px;
  font-weight: 500;
  min-height: 56px;
  transition: border-color 0.12s, background 0.12s, opacity 0.3s;
}
.opcion .letra {
  font-family: var(--font-hud);
  font-size: 11px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--gold);
}
.opcion:hover:not(:disabled) { border-color: var(--gold-deep); }
.opcion.marcada { border-color: var(--cyan); background: rgba(102, 229, 255, 0.1); box-shadow: 0 0 14px rgba(102, 229, 255, 0.35); }
.opcion.marcada .letra { background: var(--cyan); color: var(--ink); }
.opcion.eliminada { opacity: 0.25; text-decoration: line-through; }
.opcion.suspenso { animation: suspenso 0.5s ease-in-out infinite alternate; }
.opcion.correcta { border-color: var(--ok); background: rgba(79, 227, 156, 0.16); }
.opcion.correcta .letra { background: var(--ok); color: var(--ink); }
.opcion.incorrecta { border-color: var(--bad); background: rgba(255, 81, 112, 0.14); animation: sacudir 0.4s; }
.opcion.incorrecta .letra { background: var(--bad); color: var(--ink); }
@keyframes suspenso { from { box-shadow: 0 0 4px rgba(102, 229, 255, 0.3); } to { box-shadow: 0 0 22px rgba(102, 229, 255, 0.9); background: rgba(102, 229, 255, 0.2); } }
@keyframes sacudir { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.confirmar-ayuda { font-family: var(--font-hud); font-size: 8px; color: var(--cyan); text-align: center; line-height: 1.6; min-height: 13px; }

/* Ayudas recibidas: pistas y QueenBot */
.ayudas { display: flex; flex-direction: column; gap: 8px; }
.pista {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px 12px;
  border-radius: var(--radio);
  background: rgba(245, 196, 81, 0.08);
  border: 1px solid var(--gold-deep);
  font-size: 15px;
  color: var(--gold-2);
}
.pista svg { width: 22px; height: 22px; }
.bot {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: start;
}
.bot-avatar { width: 40px; height: 40px; }
.bot-globo {
  background: rgba(102, 229, 255, 0.08);
  border: 1px solid rgba(102, 229, 255, 0.45);
  border-radius: 4px 14px 14px 14px;
  padding: 10px 12px;
  font-size: 15px;
}
.bot-globo b { font-family: var(--font-hud); font-size: 8px; color: var(--cyan); display: block; margin-bottom: 4px; font-weight: 400; }
.esperando { font-family: var(--font-hud); font-size: 9px; color: var(--muted); text-align: center; padding: 6px; }

/* ---------- Cargando ---------- */
.cargando { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 46px 0; }
.cargando .corona { width: 60px; animation: flotar 1.2s ease-in-out infinite alternate; }
@keyframes flotar { to { transform: translateY(-10px) rotate(4deg); } }
.puntos::after { content: ""; animation: puntos 1.2s steps(4) infinite; }
@keyframes puntos { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ---------- Resultado ---------- */
.resultado-titulo { font-family: var(--font-hud); font-size: 20px; line-height: 1.4; text-align: center; margin: 4px 0 0; }
.resultado-titulo.bien { color: var(--ok); text-shadow: 0 0 14px rgba(79, 227, 156, 0.5); }
.resultado-titulo.mal { color: var(--bad); text-shadow: 0 0 14px rgba(255, 81, 112, 0.5); }
.resultado-sub { font-family: var(--font-hud); font-size: 10px; text-align: center; color: var(--gold); line-height: 1.7; }
.dato {
  border-left: 3px solid var(--cyan);
  padding: 8px 12px;
  background: var(--bg-2);
  border-radius: 0 var(--radio) var(--radio) 0;
  font-size: 15px;
}
.dato b { font-family: var(--font-hud); font-size: 8px; color: var(--cyan); display: block; margin-bottom: 4px; font-weight: 400; letter-spacing: 0.1em; }
.desbloqueo {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radio);
  border: 2px solid var(--gold);
  background: rgba(245, 196, 81, 0.1);
  color: var(--gold-2);
  font-weight: 700;
  animation: aparecer 0.9s cubic-bezier(.2, 1.6, .4, 1);
}
.desbloqueo svg { width: 28px; height: 28px; flex: none; }

/* ---------- Pase del celular ---------- */
.pase { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 40px 0; text-align: center; }
.pase .nombre-grande { font-family: var(--font-logo); font-size: 52px; color: var(--cyan); line-height: 1; }
.pase.jugador-2 .nombre-grande { color: var(--rosa); }

/* ---------- Fin de partida ---------- */
.final-titulo { font-family: var(--font-logo); font-size: clamp(34px, 11vw, 48px); text-align: center; margin: 10px 0 0; line-height: 1.05; }
.final-titulo.gameover { color: var(--bad); }
.final-titulo.campeon { color: var(--gold); text-shadow: 0 0 20px rgba(245, 196, 81, 0.55); }
.marcador-final { font-family: var(--font-hud); text-align: center; display: flex; flex-direction: column; gap: 10px; }
.marcador-final .score-grande { font-size: 30px; color: var(--gold); font-variant-numeric: tabular-nums; }
.perfect { font-family: var(--font-hud); font-size: 14px; color: var(--cyan); text-align: center; }
.desglose { width: 100%; border-collapse: collapse; font-size: 15px; }
.desglose td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.desglose td:last-child { text-align: right; font-family: var(--font-hud); font-size: 10px; font-variant-numeric: tabular-nums; }
.desglose .menos { color: var(--bad); }
.desglose .mas { color: var(--ok); }
.versus { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.versus .tarjeta { align-items: center; text-align: center; }
.versus .ganador { border-color: var(--gold); box-shadow: 0 0 16px rgba(245, 196, 81, 0.35); }

/* Iniciales estilo arcade */
.iniciales { display: flex; justify-content: center; gap: 12px; }
.inicial { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.inicial button {
  width: 48px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--gold);
  font-family: var(--font-hud);
  font-size: 10px;
}
.inicial .letra-grande {
  font-family: var(--font-hud);
  font-size: 28px;
  color: var(--gold-2);
  width: 48px;
  text-align: center;
  border-bottom: 3px solid var(--gold);
  padding-bottom: 6px;
}

/* ---------- HI-SCORES ---------- */
.tabla-hi { width: 100%; border-collapse: collapse; font-family: var(--font-hud); font-size: 11px; font-variant-numeric: tabular-nums; }
.tabla-hi th { font-size: 8px; color: var(--muted); font-weight: 400; text-align: left; padding: 8px 4px; }
.tabla-hi td { padding: 10px 4px; border-bottom: 1px dashed var(--line); }
.tabla-hi td.num { text-align: right; }
.tabla-hi tr.p1 td { color: var(--gold); }
.tabla-hi tr.p2 td { color: #d9dcef; }
.tabla-hi tr.p3 td { color: #e0a36a; }
.tabla-hi tr.nuevo td { animation: parpadeo 0.8s steps(2, start) 6; }
.vacio { text-align: center; color: var(--muted); padding: 24px 0; }

/* ---------- Ajustes y ayuda ---------- */
.formulario { display: flex; flex-direction: column; gap: 18px; }
.campo { display: flex; flex-direction: column; gap: 8px; }
.campo label, .campo .titulo-campo { font-weight: 700; font-size: 15px; }
.campo .ayuda { font-size: 13px; color: var(--muted); }
.campo input[type="password"], .campo input[type="text"], .campo select, .nueva-clave select, .nueva-clave input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
}
.campo input[type="range"] { width: 100%; accent-color: var(--gold); }
.interruptor { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.interruptor input { width: 22px; height: 22px; accent-color: var(--gold); }
.estado-conexion { font-size: 14px; min-height: 20px; }
.estado-conexion.ok { color: var(--ok); }
.estado-conexion.mal { color: var(--bad); }
.rutas-ia, .lista-claves, .resultados-ia { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rutas-ia li { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); }
.rutas-ia .bien { color: var(--ok); }
.rutas-ia .mal { color: var(--bad); text-align: right; }
.rutas-ia .aviso { color: var(--gold); }
.lista-claves li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.lista-claves .prov { font-weight: 700; }
.lista-claves .mascara { color: var(--muted); font-family: var(--font-hud); font-size: 9px; letter-spacing: 0.05em; }
.nueva-clave { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 2fr); gap: 8px; }
.resultados-ia { gap: 2px; margin-bottom: 4px; }
.avanzado summary { cursor: pointer; font-weight: 700; font-size: 15px; color: var(--muted); }
.campo input[type="url"] { width: 100%; }

.reglas { display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.reglas h3 { font-family: var(--font-hud); font-size: 10px; color: var(--gold); margin: 10px 0 0; line-height: 1.6; }
.reglas p, .reglas ul { margin: 0; }
.reglas ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.tabla-costos { width: 100%; border-collapse: collapse; }
.tabla-costos td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.tabla-costos td:last-child { text-align: right; font-family: var(--font-hud); font-size: 10px; color: var(--bad); }

.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cabecera h2 { font-family: var(--font-hud); font-size: 13px; color: var(--gold); margin: 0; line-height: 1.5; }

/* ---------- Modales ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 5, 20, 0.82);
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.modal-caja {
  width: min(420px, 100%);
  background: var(--panel);
  border: 2px solid var(--gold-deep);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.modal-caja h3 { font-family: var(--font-hud); font-size: 12px; color: var(--gold); margin: 0; line-height: 1.6; }

/* Ruleta */
.ruleta-zona { position: relative; width: 250px; height: 250px; margin: 0 auto; }
.ruleta-puntero {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 24px solid var(--gold-2);
  z-index: 2;
  filter: drop-shadow(0 2px 0 var(--gold-deep));
}
.ruleta-rueda {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 6px solid var(--gold);
  background: conic-gradient(#5b2ea6 0 90deg, #1f6f86 90deg 180deg, #8a2d63 180deg 270deg, #2e6a3d 270deg 360deg);
  position: relative;
  box-shadow: 0 0 24px rgba(245, 196, 81, 0.35), inset 0 0 20px rgba(0, 0, 0, 0.5);
  transition: transform 2.6s cubic-bezier(0.15, 0.7, 0.12, 1);
}
.ruleta-texto {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 80px;
  margin-left: -40px;
  margin-top: -14px;
  font-family: var(--font-hud);
  font-size: 7px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
.ruleta-texto b { display: block; font-size: 12px; color: #fff; font-weight: 400; }
.ruleta-eje { position: absolute; inset: 42%; border-radius: 50%; background: var(--gold); border: 3px solid var(--ink); }
.ruleta-resultado { font-family: var(--font-hud); font-size: 11px; color: var(--cyan); line-height: 1.7; min-height: 38px; }

/* Aviso flotante */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(480px, calc(100% - 32px));
  background: var(--panel-2);
  border: 1px solid var(--warn);
  color: var(--text);
  border-radius: var(--radio);
  padding: 12px 14px;
  font-size: 14px;
  z-index: 45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: subir 0.3s ease-out;
}
@keyframes subir { from { transform: translate(-50%, 20px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
