/* Estilos comunes de los juegos: lienzo, barra superior, pantallas, resultado y panel admin */
/* la página no se mueve; solo el lienzo bloquea gestos (así las pantallas de inicio/elección pueden deslizarse) */
html, body { overflow: hidden; position: fixed; inset: 0; touch-action: manipulation; user-select: none; -webkit-user-select: none; background: #0b0604; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }

.hud { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 14px; right: 14px; display: flex; gap: 10px; align-items: center; pointer-events: none; z-index: 10; }
.hud > * { pointer-events: auto; }
.hud .sp { flex: 1; }
/* sin desenfoque de fondo: sobre un canvas que cambia en cada cuadro obliga a re-desenfocar 60 veces por segundo */
.hud .icon-btn { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(10,8,16,.62); }
.back { min-height: 52px; padding: 0 20px 0 14px; font-size: 16px; background: rgba(10,8,16,.62); }
#mute.off .on-i, #mute:not(.off) .off-i { display: none; }

.hint {
  position: fixed; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 70px); transform: translateX(-50%); z-index: 4;
  padding: 12px 22px; border-radius: 999px; background: rgba(10,8,16,.55);
  border: 1px solid rgba(242,193,78,.35); color: #ffe6a6; background: rgba(10,8,16,.72); font-weight: 700; font-size: clamp(15px, 2.2vw, 20px); white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .3s; animation: pulse 1.6s ease-in-out infinite;
}
body[data-state=ready] .hint { opacity: 1; }
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.05); } }

/* Pantallas */
.screen { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; padding: max(76px, calc(env(safe-area-inset-top) + 70px)) 16px max(20px, env(safe-area-inset-bottom)); opacity: 0; pointer-events: none; transition: opacity .35s;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
/* margin:auto centra cuando sobra lugar y, si la tarjeta es más alta que la pantalla, arranca arriba (sin cortarla) */
#start > *, #pick > * { margin: auto; }
.screen.show, body[data-state=start] #start, body[data-state=pick] #pick, body[data-state=result] #result { opacity: 1; pointer-events: auto; }
.card {
  width: min(560px, 100%); text-align: center; padding: 34px 28px 30px; border-radius: 30px; display: grid; gap: 14px; justify-items: center;
  background: rgba(18, 12, 8, .92); border: 1px solid rgba(242,193,78,.3);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.08);
  transform: translateY(18px) scale(.96); transition: transform .45s cubic-bezier(.2,.9,.3,1.25);
}
body[data-state=start] #start .card, body[data-state=result] #result .card { transform: none; }
.brand { width: 150px; height: auto; margin-bottom: 4px; }
.brand-sm { width: 110px; opacity: .9; margin-bottom: 0; }
.brand-logo { width: min(280px, 62vw); height: auto; margin: 4px 0 2px; filter: drop-shadow(0 8px 24px rgba(0,0,0,.5)); }
.brand-logo.byd { width: min(220px, 50vw); margin: 10px 0 8px; }
/* pantallas bajas (tablet acostada, celulares): todo más compacto para que entre sin deslizar */
@media (max-height: 900px) {
  .card { padding: 22px 22px 22px; gap: 10px; }
  .brand { width: 120px; } .brand-sm { width: 92px; }
  .brand-logo { width: min(200px, 50vw); } .brand-logo.byd { width: min(160px, 42vw); margin: 4px 0; }
  .card h1 { font-size: clamp(26px, 4.6vh, 44px); }
  .card p { font-size: clamp(14px, 2vh, 18px); }
  .btn-lg { min-height: 60px; }
}
@media (max-height: 640px) {
  .card { padding: 16px 18px; gap: 8px; border-radius: 22px; }
  .brand-sm { display: none; }
}
.card h1 { margin: 0; font-size: clamp(30px, 5.5vw, 48px); line-height: 1.02; letter-spacing: -.01em; font-weight: 800;
  background: linear-gradient(180deg, #fff6d6, #f2c14e 60%, #c98a12); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card p { margin: 0; color: #e6dccb; font-size: clamp(16px, 2.4vw, 20px); line-height: 1.4; max-width: 30ch; }
.card .btn { margin-top: 8px; }

#result { align-items: end; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
body.land #result { align-items: center; justify-items: end; padding-right: 3vw; }
#result .card { gap: 8px; padding: 22px 24px 24px; width: min(520px, 100%); }
body.land #result .card { width: min(400px, 40vw); }
.res-row { display: flex; align-items: baseline; justify-content: center; gap: 16px; flex-wrap: wrap; }
#result .card h2 { margin: 0; font-size: clamp(36px, 6.5vw, 60px); line-height: 1; font-weight: 900; color: #fff; }
#result.win .card h2 { background: linear-gradient(180deg, #fffbe6, #ffd76a 55%, #d4920f); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 24px rgba(242,193,78,.5)); }
#result .pct { font-size: clamp(40px, 7vw, 64px); font-weight: 900; line-height: .9; color: #ff6b8a; letter-spacing: -.03em; }
#result.win .pct { color: #ffe08a; text-shadow: 0 0 40px rgba(242,193,78,.6); }
.trophy { display: none; width: 64px; height: 64px; border-radius: 28px; place-items: center; background: linear-gradient(180deg, #ffe7a0, #f2c14e 50%, #b77a0c); box-shadow: 0 16px 40px -10px rgba(242,193,78,.8); animation: bob 2s ease-in-out infinite; }
#result.win .trophy { display: grid; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }

/* Panel admin */
.admin { width: min(620px, 100%); text-align: left; gap: 22px; }
.admin h2 { text-align: center; }
.admin section { display: grid; gap: 14px; padding: 18px; border-radius: 20px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.admin h3 { margin: 0; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { flex: 1 1 auto; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0,0,0,.3); font-weight: 700; cursor: pointer; }
.seg button.on { background: linear-gradient(120deg, var(--magenta), var(--purple)); border-color: transparent; }
.range { display: grid; gap: 8px; font-weight: 700; }
.range span { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.range b { color: #ffd76a; font-weight: 700; font-size: 14px; }
.range input { width: 100%; height: 36px; accent-color: var(--magenta); }
.note { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
#stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
#stats div { padding: 12px; border-radius: 14px; background: rgba(0,0,0,.3); display: grid; gap: 4px; }
#stats b { font-size: 28px; }
#stats span { font-size: 12px; color: var(--muted); }
