@font-face { font-family: Urbanist; font-weight: 400; src: url(lib/urbanist-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Urbanist; font-weight: 600; src: url(lib/urbanist-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Urbanist; font-weight: 800; src: url(lib/urbanist-latin-800-normal.woff2) format('woff2'); }
:root {
  --rojo: #d0181d; --vino: #8e1915; --fondo: #0f0b0c; --panel: #1a1415; --linea: #3b2f30;
  --texto: #f6f2f2; --suave: #b3a3a4;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: var(--fondo); color: var(--texto); font-family: Urbanist, system-ui, sans-serif; }
body { overflow: hidden; -webkit-user-select: none; user-select: none; }

/* ---------- Pantalla ---------- */
#app { display: grid; grid-template-columns: 1fr minmax(300px, 25vw); height: 100vh; }
#escena { position: relative; overflow: hidden; }
#escena canvas { display: block; width: 100%; height: 100%; }
#panel { background: linear-gradient(180deg, #1a1415, #140b0c); border-left: 1px solid var(--linea);
  padding: 2.2vh 1.6vw; display: flex; flex-direction: column; gap: 2vh; overflow: hidden; }
#panel .logo { width: 72%; align-self: center; }
#panel h1 { font-weight: 800; font-size: clamp(22px, 2.2vw, 44px); letter-spacing: .14em; text-align: center; }
#panel h1 span { color: var(--rojo); }
.caja { background: #241c1d; border: 1px solid var(--linea); border-radius: 18px; padding: 1.6vh 1.2vw; }
#qrCaja { text-align: center; }
#qr { background: #fff; border-radius: 14px; padding: 10px; width: min(78%, 30vh); aspect-ratio: 1; margin: 0 auto 1.2vh; display: grid; place-items: center; }
#qr img, #qr svg { width: 100%; height: 100%; image-rendering: pixelated; }
#qrCaja p { font-size: clamp(14px, 1.1vw, 22px); font-weight: 600; }
#qrCaja small { display: block; color: var(--suave); margin-top: .6vh; font-size: clamp(11px, .8vw, 15px); }
#juegoCaja { display: none; }
.jugando #qrCaja { display: none; }
.jugando #juegoCaja { display: block; }
.fila { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: clamp(14px, 1.05vw, 20px); }
.puntos { display: flex; gap: 8px; }
.puntos i { width: 16px; height: 16px; border-radius: 50%; background: var(--rojo); box-shadow: 0 0 10px var(--rojo); }
.puntos i.usado { background: #3b2f30; box-shadow: none; }
#barra { height: 8px; background: #3b2f30; border-radius: 9px; margin-top: 1.2vh; overflow: hidden; }
#barra div { height: 100%; width: 100%; background: var(--rojo); transition: width .2s linear; }
#instruccion { color: var(--suave); margin-top: 1.2vh; font-size: clamp(12px, .9vw, 17px); }
#mapa { width: 100%; aspect-ratio: 12.4 / 4.4; background: #140b0c; border-radius: 10px; display: block; }
.mapaTit { color: var(--suave); font-size: 12px; letter-spacing: .12em; margin-bottom: 6px; }
#premiosLista { display: grid; gap: 1vh; }
#premiosLista div { display: flex; gap: 10px; align-items: center; font-size: clamp(12px, .9vw, 17px); }
#premiosLista b { display: block; font-weight: 800; }
#premiosLista span { color: var(--suave); }
#premiosLista i { flex: none; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset -4px -5px 8px rgba(0,0,0,.45), inset 3px 3px 6px rgba(255,255,255,.35); }
#estadoRed { margin-top: auto; font-size: 11px; color: #6d5d5e; text-align: center; }

#aviso { position: fixed; left: 37.5%; top: 42%; transform: translate(-50%, -50%) scale(.9); opacity: 0; pointer-events: none;
  text-align: center; transition: .35s cubic-bezier(.2,.9,.3,1.3); background: rgba(15,11,12,.82); backdrop-filter: blur(8px);
  border: 1px solid var(--linea); border-radius: 26px; padding: 3vh 3vw; min-width: 30vw; }
#aviso.ver { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#aviso h2 { font-size: clamp(30px, 4vw, 84px); font-weight: 800; line-height: 1.05; }
#aviso p { font-size: clamp(16px, 1.5vw, 30px); color: var(--suave); margin-top: 1vh; }
#aviso .codigo { display: inline-block; margin-top: 1.6vh; font-size: clamp(22px, 2.4vw, 46px); font-weight: 800; letter-spacing: .18em;
  background: var(--rojo); color: #fff; border-radius: 14px; padding: .6vh 1.4vw; }

/* ---------- Control (celular) ---------- */
.control { display: flex; flex-direction: column; height: 100dvh; padding: max(18px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom));
  background: radial-gradient(120% 70% at 50% 0%, #24090b, var(--fondo)); touch-action: none; }
.control header { display: flex; justify-content: space-between; align-items: center; }
.control header img { height: 26px; }
.control header .puntos i { width: 13px; height: 13px; }
.control .titulo { font-weight: 800; letter-spacing: .14em; font-size: 22px; text-align: center; margin-top: 14px; }
.control .titulo span { color: var(--rojo); }
#estado { text-align: center; color: var(--suave); font-weight: 600; min-height: 48px; margin-top: 8px; font-size: 17px; }
#tiempo { height: 6px; background: #3b2f30; border-radius: 9px; overflow: hidden; margin-top: 6px; }
#tiempo div { height: 100%; width: 100%; background: var(--rojo); }
.mandos { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; }
#pad { width: min(68vw, 290px); aspect-ratio: 1; border-radius: 50%; position: relative;
  background: radial-gradient(circle, #241c1d 55%, #1a1415); border: 2px solid var(--linea);
  box-shadow: inset 0 0 40px rgba(0,0,0,.6); }
#pad::before, #pad::after { content: ''; position: absolute; left: 50%; top: 50%; background: #3b2f30; transform: translate(-50%, -50%); }
#pad::before { width: 70%; height: 2px; } #pad::after { width: 2px; height: 70%; }
#bola { position: absolute; width: 38%; aspect-ratio: 1; left: 31%; top: 31%; border-radius: 50%; z-index: 1;
  background: radial-gradient(circle at 35% 30%, #ff6b6f, var(--rojo) 45%, var(--vino)); box-shadow: 0 10px 25px rgba(0,0,0,.6); }
#soltar { width: min(80vw, 330px); height: 84px; border: 0; border-radius: 22px; font: 800 26px Urbanist, sans-serif; letter-spacing: .16em;
  color: #fff; background: linear-gradient(180deg, #e0262b, var(--vino)); box-shadow: 0 8px 0 #4a0d0b, 0 14px 30px rgba(208,24,29,.35); }
#soltar:active { transform: translateY(6px); box-shadow: 0 2px 0 #4a0d0b; }
#soltar:disabled { filter: grayscale(1) brightness(.5); }
.pantallaMsg { display: none; flex: 1; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.pantallaMsg h2 { font-size: 34px; font-weight: 800; }
.pantallaMsg p { color: var(--suave); font-size: 18px; }
.premioCard { border-radius: 24px; padding: 26px 22px; background: #241c1d; border: 1px solid var(--linea); width: 100%; }
.premioCard .esfera { width: 90px; height: 90px; border-radius: 50%; margin: 0 auto 14px; box-shadow: inset -12px -14px 22px rgba(0,0,0,.45), inset 8px 8px 16px rgba(255,255,255,.35), 0 0 40px rgba(208,24,29,.35); }
.premioCard .codigo { margin-top: 16px; font-size: 32px; font-weight: 800; letter-spacing: .2em; background: var(--rojo); border-radius: 14px; padding: 8px; }
.control.msg .mandos, .control.msg #tiempo { display: none; }
.control.msg .pantallaMsg { display: flex; }
.control.msg #estado { display: none; }
.ayuda { color: #6d5d5e; font-size: 13px; margin-top: -10px; }
