:root {
  --fondo: #13101f;
  --fondo-2: #1c1830;
  --tarjeta: #262040;
  --borde: #3a3260;
  --texto: #f5f2ff;
  --suave: #a69fc7;
  --rojo: #ff4d5e;
  --rojo-osc: #c7243a;
  --amarillo: #ffd23f;
  --verde: #3ddc84;
  --azul: #5aa9ff;
  --radio: 16px;
  --pixel: 'Press Start 2P', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #2b2150 0%, var(--fondo) 60%) fixed, var(--fondo);
  color: var(--texto);
  font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.15; }
.pixel { font-family: var(--pixel); letter-spacing: .02em; }
.suave { color: var(--suave); }
.oculto { display: none !important; }
.centro { text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 0; border-radius: 14px; padding: .85em 1.3em; cursor: pointer;
  background: var(--tarjeta); color: var(--texto); font-weight: 700;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.35); transition: transform .08s;
  touch-action: manipulation; text-decoration: none;
}
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.35); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-rojo { background: var(--rojo); }
.btn-amarillo { background: var(--amarillo); color: #241b00; }
.btn-verde { background: var(--verde); color: #04210f; }
.btn-fantasma { background: transparent; border: 2px solid var(--borde); box-shadow: none; }
.btn-grande { font-size: 1.2rem; padding: 1em 1.4em; width: 100%; }
.btn-peq { padding: .45em .8em; font-size: .85rem; border-radius: 10px; }

.campo { display: flex; flex-direction: column; gap: .35em; margin-bottom: 1em; }
.campo label { font-size: .85rem; color: var(--suave); font-weight: 600; }
.campo input {
  background: var(--fondo-2); border: 2px solid var(--borde); border-radius: 12px;
  padding: .8em 1em; font-size: 1.15rem; outline: none;
}
.campo input:focus { border-color: var(--amarillo); }
.input-codigo { text-transform: uppercase; letter-spacing: .4em; font-family: var(--pixel); font-size: 1.3rem !important; text-align: center; }

.error { background: rgba(255,77,94,.15); border: 1px solid var(--rojo); color: #ffc2c8; padding: .7em 1em; border-radius: 12px; margin: .5em 0 1em; }
.aviso { background: rgba(255,210,63,.12); border: 1px solid var(--amarillo); color: #ffe9a6; padding: .7em 1em; border-radius: 12px; }

/* ---------- Avatares ---------- */
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--tarjeta); display: block; }
.avatar-inicial { display: grid; place-items: center; background: var(--c); color: #160f2a; font-weight: 900; font-size: 1.5rem; }
.avatar-inicial span { line-height: 1; }

/* ---------- Gafas ---------- */
.gafas-escena { position: relative; width: min(60vmin, 420px); aspect-ratio: 1; margin: 0 auto; }
.gafas-escena .avatar-gafas { width: 100%; height: 100%; border-radius: 24px; font-size: 10rem; }
.gafas-caen { position: absolute; left: 21%; width: 58%; top: 42%; transform: translateY(-50%); }
.gafas-caen .gafas { width: 100%; display: block; filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); }
.gafas-escena.animar .gafas-caen { animation: caer 2.4s steps(14, end) .4s both; }
@keyframes caer {
  from { transform: translateY(-50%) translateY(-120vh); }
  to { transform: translateY(-50%); }
}
.gana-titulo { animation: aparecer .4s steps(4) 2.9s both; }
@keyframes aparecer { from { opacity: 0; transform: scale(1.4); } to { opacity: 1; transform: none; } }

.pillado { position: relative; width: min(50vmin, 360px); aspect-ratio: 1; margin: 0 auto; }
.pillado .avatar { width: 100%; height: 100%; border-radius: 24px; font-size: 9rem; filter: grayscale(.6); }
.sello {
  position: absolute; inset: auto 0 12% 0; margin: auto; width: max-content; transform: rotate(-12deg);
  border: 6px solid var(--rojo); color: var(--rojo); background: rgba(19,16,31,.75);
  font-family: var(--pixel); font-size: clamp(1rem, 4vmin, 2.2rem); padding: .4em .6em; border-radius: 10px;
  animation: sellar .35s cubic-bezier(.2,1.6,.4,1) .3s both;
}
@keyframes sellar { from { opacity: 0; transform: rotate(-12deg) scale(2.2); } to { opacity: 1; transform: rotate(-12deg) scale(1); } }

/* ---------- Cuenta atrás ---------- */
.cuenta {
  --progreso: 1;
  width: 92px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--amarillo) calc(var(--progreso) * 360deg), rgba(255,255,255,.08) 0);
  font-family: var(--pixel); font-size: 1.4rem; position: relative; margin: 0 auto;
}
.cuenta::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: var(--fondo-2); }
.cuenta-num { position: relative; }
.cuenta.urgente { background: conic-gradient(var(--rojo) calc(var(--progreso) * 360deg), rgba(255,255,255,.08) 0); }
.cuenta.urgente .cuenta-num { color: var(--rojo); }
.cuenta-mini { width: auto; aspect-ratio: auto; background: none; font-size: 1rem; display: inline-block; margin: 0; }
.cuenta-mini::before { display: none; }

.conexion {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; text-align: center; padding: .4em;
  background: var(--rojo-osc); font-weight: 700; font-size: .9rem;
}
