/* =========================================================================
 * styles.css — Zonajuega (mobile-first, vertical)
 * Estética propia: oscura, limpia, con acentos ámbar/violeta.
 * ========================================================================= */

:root {
  --bg-0: #070812;
  --bg-1: #11142a;
  --panel: rgba(18, 21, 42, 0.94);
  --acento: #ffd23f;
  --acento2: #9775fa;
  --texto: #e9ebff;
  --texto-tenue: #9aa0c8;
  --peligro: #ff5d5d;
  --ok: #51cf66;
  --radio: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--texto);
  font-family: var(--fuente-ui, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#app { position: fixed; inset: 0; }

#lienzo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  z-index: 0;
}

/* ---- Capa de juego (barra + pads) ---- */
.capa { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.oculto { display: none !important; }

#barra-juego {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: calc(46px + var(--safe-t));
  padding: var(--safe-t) 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(7,8,18,0.85), rgba(7,8,18,0));
}
.logo-mini { font-weight: 800; font-size: 15px; color: var(--texto); opacity: 0.9; letter-spacing: 0.3px; }
.barra-btns { display: flex; gap: 8px; }

.btn-icono {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--texto);
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
}
.btn-icono:active { transform: scale(0.92); }

/* ---- Splash / pantalla de carga (#01) ---- */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(80% 60% at 50% 30%, #1c2150, #0a0b1a 72%);
  transition: opacity 0.5s ease;
}
.splash.fuera { opacity: 0; pointer-events: none; }
.splash-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; animation: splash-pop 0.6s cubic-bezier(.2,.9,.3,1.2) both; }
.splash-mark {
  width: 104px; height: 104px; border-radius: 28px; display: grid; place-items: center;
  background: linear-gradient(160deg, #ffe27a, #f0a91a);
  box-shadow: inset 0 2px 6px rgba(255,255,255,0.5), 0 0 50px rgba(255,200,60,0.5);
  font-family: var(--fuente-display, system-ui), sans-serif; font-weight: 700; font-size: 60px; color: #2a1d00;
  animation: splash-flota 3s ease-in-out infinite;
}
.splash h1 { font-family: var(--fuente-display, system-ui), sans-serif; font-weight: 700; font-size: 38px; margin: 0; color: #fff; letter-spacing: -0.5px; }
.splash h1 span { color: #ffd23f; }
.splash .esl { color: #aab0d6; font-size: 13px; margin: -6px 0 0; }
.splash-bar { width: 200px; height: 8px; border-radius: 99px; background: rgba(255,255,255,0.12); overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 8%; border-radius: 99px; background: linear-gradient(90deg, #ffe27a, #f0a91a); animation: splash-carga 1.8s ease-in-out infinite; }
.splash .ver { font-size: 11px; color: #7a80a8; }
@keyframes splash-carga { 0% { width: 6%; } 60% { width: 90%; } 100% { width: 100%; } }
@keyframes splash-flota { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes splash-pop { from { opacity: 0; transform: scale(0.82); } to { opacity: 1; transform: scale(1); } }

/* ---- Pads de control ---- */
.pad {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  pointer-events: none;
  justify-content: center;
}
.pad.abajo { bottom: 0; padding-bottom: calc(8px + var(--safe-b)); }
.pad.arriba { top: calc(46px + var(--safe-t)); }

.btn-ctrl {
  pointer-events: auto;
  flex: 1 1 0;
  max-width: 88px;
  height: clamp(50px, 8.5vh, 72px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.09);
  color: var(--texto);
  font-size: clamp(20px, 5vw, 28px);
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: transform 0.05s, background 0.1s;
}
.btn-ctrl.activo, .btn-ctrl:active { background: rgba(255,210,63,0.35); transform: scale(0.94); }
.btn-ctrl.soft { background: rgba(151,117,250,0.18); }
.btn-ctrl.hard { background: rgba(255,93,93,0.18); }

/* ---- Pantallas (overlays) ---- */
.pantalla {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--safe-t)) 18px calc(20px + var(--safe-b));
  /* Translúcido sobre el fondo animado (el panel central queda legible). */
  background: rgba(8, 9, 20, 0.58);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}

.panel {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radio);
  padding: 22px 20px 24px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
}

.titulo {
  font-family: var(--fuente-display); font-size: 42px; margin: 6px 0 2px; font-weight: 700; letter-spacing: -0.5px;
}
.titulo span { color: var(--acento); }
.sub { color: var(--texto-tenue); margin: 0 0 18px; font-size: 14px; }

h1, h2, h3 { font-family: var(--fuente-display); }
h2 { font-size: 26px; margin: 4px 0 12px; font-weight: 700; }
h3 { font-size: 16px; margin: 20px 0 8px; color: var(--texto-tenue); text-align: left; font-weight: 600; }

.bloque { margin: 14px 0; }
.etiqueta { color: var(--texto-tenue); font-size: 13px; margin: 0 0 8px; }

.chips { display: flex; gap: 8px; justify-content: center; }
.chip {
  flex: 1;
  padding: 11px 0;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: var(--texto);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.chip.sel {
  background: linear-gradient(135deg, var(--acento), #ffb703);
  color: #1a1400; border-color: transparent; font-weight: 800;
}

/* Botones */
.btn-primario, .btn-secundario, .btn-fantasma {
  display: block; width: 100%;
  margin: 10px 0 0;
  padding: 15px 16px;
  border-radius: 14px;
  font-size: 16px; font-weight: 700;
  cursor: pointer; border: 1px solid transparent;
}
.btn-primario {
  background: linear-gradient(135deg, var(--acento), #ffb703);
  color: #1a1400;
}
.btn-secundario {
  background: rgba(255,255,255,0.08);
  color: var(--texto);
  border-color: rgba(255,255,255,0.14);
}
.btn-fantasma {
  background: transparent;
  color: var(--texto-tenue);
  border-color: rgba(255,255,255,0.12);
  font-weight: 600; font-size: 14px;
}
.btn-primario:active, .btn-secundario:active, .btn-fantasma:active { transform: scale(0.98); filter: brightness(1.08); }

.mejor { margin-top: 18px; color: var(--texto-tenue); font-size: 14px; }
.mejor strong { color: var(--acento); }

/* Ajustes */
.fila-ajuste {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 15px;
}
.fila-ajuste input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--acento); }
.fila-ajuste input[type="range"] { width: 55%; accent-color: var(--acento); }
.campo-nombre {
  width: 46%; padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.16); background: rgba(0,0,0,0.25);
  color: var(--texto); font-weight: 700; text-align: right; text-transform: uppercase;
}
.campo-nombre:focus { outline: none; border-color: var(--acento); }
ol.records { counter-reset: pos; }

/* Récords */
.records { list-style: none; padding: 0; margin: 6px 0 12px; text-align: left; }
.records li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 10px;
  font-size: 14px;
}
.records li:nth-child(odd) { background: rgba(255,255,255,0.04); }
.records .pos { width: 22px; color: var(--texto-tenue); font-weight: 700; }
.records .pts { color: var(--acento); font-weight: 800; font-variant-numeric: tabular-nums; }
.records .meta { color: var(--texto-tenue); font-size: 12px; margin-left: auto; }
.records .vacio { color: var(--texto-tenue); justify-content: center; font-style: italic; }
.records.mini li { padding: 6px 8px; }

/* Estadísticas de fin */
.fin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 14px; }
.fin-stat { background: rgba(255,255,255,0.05); border-radius: 10px; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.fin-stat .e { font-size: 17px; }
.fin-stat .v { font-weight: 800; color: var(--acento); font-size: 16px; font-variant-numeric: tabular-nums; }
.fin-stat .l { font-size: 10px; color: var(--texto-tenue); text-align: center; line-height: 1.1; }
@media (max-width: 380px) { .fin-stats { grid-template-columns: repeat(2, 1fr); } }

/* Fin de partida */
.fin-score-label { color: var(--texto-tenue); font-size: 13px; margin: 14px 0 0; }
.fin-score { font-size: 44px; font-weight: 900; color: var(--acento); margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.record-nuevo { color: var(--ok); font-weight: 800; margin: 0 0 8px; animation: latido 0.8s ease-in-out infinite; }
@keyframes latido { 50% { transform: scale(1.08); } }

/* Online */
.separador { display: flex; align-items: center; text-align: center; color: var(--texto-tenue); margin: 14px 0; font-size: 13px; }
.separador::before, .separador::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.1); }
.separador span { padding: 0 12px; }
.campo {
  width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16); background: rgba(0,0,0,0.25);
  color: var(--texto); font-size: 20px; font-weight: 800; text-align: center;
  letter-spacing: 4px; text-transform: uppercase; margin-bottom: 10px;
}
.campo:focus { outline: none; border-color: var(--acento); }
.nota { color: var(--texto-tenue); font-size: 12px; margin-top: 14px; line-height: 1.4; }
.codigo-sala {
  display: inline-block; margin-top: 8px; font-size: 40px; font-weight: 900;
  letter-spacing: 8px; color: var(--acento); font-variant-numeric: tabular-nums;
  background: rgba(255,210,63,0.1); padding: 10px 18px; border-radius: 12px;
}
.online-msg { color: var(--texto); font-size: 15px; margin: 14px 0; }
.online-error { color: var(--peligro); font-size: 14px; font-weight: 600; margin: 10px 0; }
.spinner {
  width: 38px; height: 38px; margin: 18px auto; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.12); border-top-color: var(--acento);
  animation: girar 0.9s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* Mascota */
.mascota-menu { display: block; width: 120px; height: 120px; margin: 0 auto -6px; }
.mascota-preview {
  display: block; width: 200px; height: 200px; margin: 4px auto 12px;
  background: radial-gradient(60% 60% at 50% 40%, rgba(151,117,250,0.14), transparent 70%);
  border-radius: 18px;
}
.swatches, .accs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 6px 0 4px; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 3px solid rgba(255,255,255,0.18); box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.swatch.sel { border-color: #fff; transform: scale(1.12); }
.acc-btn {
  min-width: 50px; height: 46px; border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.06);
  color: var(--texto); font-size: 22px;
}
.acc-btn.sel { background: linear-gradient(135deg, var(--acento), #ffb703); color: #1a1400; border-color: transparent; }

/* Tutorial */
#tut-cards { min-height: 220px; display: flex; align-items: center; justify-content: center; }
.tut-card { text-align: center; animation: aparece 0.3s ease; }
.tut-emoji { font-size: 52px; margin-bottom: 8px; line-height: 1.1; }
.tut-card h3 { color: var(--acento); font-size: 22px; margin: 4px 0 10px; text-align: center; }
.tut-card p { color: var(--texto); font-size: 15px; line-height: 1.5; margin: 0; }
.tut-card b { color: #fff; }
@keyframes aparece { from { opacity: 0; transform: translateY(8px); } }
.tut-dots { display: flex; gap: 8px; justify-content: center; margin: 16px 0 4px; }
.tut-dots .dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.2); transition: background 0.2s, transform 0.2s; }
.tut-dots .dot.on { background: var(--acento); transform: scale(1.25); }

/* Pantallas grandes: panel un poco mayor */
@media (min-width: 720px) {
  .panel { max-width: 440px; }
  .titulo { font-size: 46px; }
}
