/* HOCKEY SUBACUÁTICO (hockey.html). Hoja propia: no se apoya en style.css del
   rugby, para que ninguno de los dos juegos pueda romper al otro. Pensada
   primero para un celular tumbado (844×390); el escritorio es el mismo
   diseño con más aire. */
:root {
  --tinta: #06222f;
  --espuma: #e8f7fc;
  --agua: #6fd3ef;
  --panel: rgba(6, 34, 47, .84);
  --verde: #5cf2a0;
  --rosa: #ff3d86;
  --ambar: #ffd84d;
  --rojo: #ff5a4f;
  --fuente: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --cond: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --si: env(safe-area-inset-left, 0px);
  --sd: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sa: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d5b74; color: var(--espuma); font-family: var(--fuente); }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
#juego { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ------------------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s; z-index: 2; }
body.jugando #hud { opacity: 1; }
body.jugando { touch-action: pan-x pan-y; }   /* sin zoom jugando (ver js/sinzoom.js) */
#ahogo { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 42%, rgba(120, 8, 20, .78) 100%); }
#marco { position: absolute; inset: 0; opacity: 0; transition: opacity .2s; box-shadow: inset 0 0 0 3px var(--rosa), inset 0 0 46px rgba(255, 61, 134, .4); }
body.llevo #marco { opacity: 1; }

#esquina { position: absolute; top: calc(8px + var(--sa)); left: calc(10px + var(--si)); display: flex; gap: 8px; pointer-events: auto; }
#esquina button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(160, 220, 240, .35); background: rgba(8, 40, 55, .6); font-size: 15px; font-weight: 800; }
#esquina button.off { opacity: .45; text-decoration: line-through; }

#centro { position: absolute; top: calc(8px + var(--sa)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; }
#marcador { display: flex; align-items: center; gap: 10px; padding: 4px 12px; border-radius: 12px; background: var(--panel); border: 1px solid rgba(143, 224, 247, .25); font-family: var(--cond); }
#marcador .eq { display: flex; align-items: center; gap: 7px; }
#marcador .eq i, .f-marcador .eq i { width: 14px; height: 14px; border-radius: 50%; display: block; }
.eq.blanco i { background: #f4f7f9; box-shadow: 0 0 0 2px rgba(6, 34, 47, .7); }
.eq.negro i { background: #14181d; box-shadow: 0 0 0 2px rgba(220, 240, 250, .8); }
#marcador b { font-size: 28px; line-height: 1; min-width: 18px; text-align: center; }
#marcador b.sube { animation: sube .6s; }
@keyframes sube { 30% { transform: scale(1.7); color: var(--ambar); } }
#reloj { font-size: 20px; font-weight: 700; padding: 0 8px; min-width: 62px; text-align: center; color: #cfeefa; font-variant-numeric: tabular-nums; }
#reloj.poco { color: var(--ambar); }

#aire { display: flex; align-items: center; gap: 7px; padding: 4px 9px; border-radius: 10px; background: var(--panel); }
#aire span { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: #bfe9f6; }
.barra { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .16); overflow: hidden; }
#aire .barra { width: 190px; height: 12px; }
#aire-n { height: 100%; width: 100%; border-radius: 6px; background: linear-gradient(90deg, #4cc7ea, #b8f1ff); transform-origin: left; }
#aire.medio #aire-n { background: linear-gradient(90deg, #f2b632, var(--ambar)); }
#aire.poco #aire-n { background: linear-gradient(90deg, #d7261e, var(--rojo)); }
#aire.poco { animation: late .5s infinite alternate; }
#aire.llena #aire-n { background: linear-gradient(90deg, #45d98c, #b9ffd9); }
@keyframes late { to { box-shadow: 0 0 0 3px rgba(255, 90, 79, .75); } }

#quien { font-size: 11px; font-weight: 800; letter-spacing: .1em; padding: 3px 10px; border-radius: 20px; background: rgba(6, 34, 47, .7); color: #cfeefa; white-space: nowrap; }
#quien::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--rosa); margin-right: 6px; vertical-align: -1px; }
#quien.tu { background: var(--rosa); color: #fff; }
#quien.tu::before { background: #fff; }
#quien.mio { background: rgba(244, 247, 249, .92); color: var(--tinta); }
#quien.rival { background: rgba(20, 24, 29, .92); color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .4); }

#mapa { position: absolute; top: calc(8px + var(--sa)); right: calc(10px + var(--sd)); width: 132px; height: 88px; border-radius: 8px; border: 1px solid rgba(143, 224, 247, .3); background: rgba(6, 34, 47, .6); }

#control { position: absolute; left: 50%; top: calc(112px + var(--sa)); transform: translateX(-50%); text-align: center; opacity: 0; transition: opacity .15s; }
#control.ver { opacity: 1; }
#control span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .12em; margin-bottom: 4px; text-shadow: 0 1px 3px #000; }
#control .barra { width: 150px; margin: 0 auto; background: rgba(0, 0, 0, .45); }
#control-n { height: 100%; background: var(--rosa); transition: width .1s; }
#control.malo span { color: var(--rojo); }
#control.malo #control-n { background: var(--rojo); }

#flecha { position: absolute; left: 0; top: 0; width: 46px; height: 46px; margin: -23px 0 0 -23px; display: none; align-items: center; justify-content: center; flex-direction: column; border-radius: 50%; background: var(--rosa); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
#flecha.ver { display: flex; }
#flecha i { font-style: normal; font-size: 18px; line-height: 1; display: block; }
#flecha small { font-size: 8px; font-weight: 800; letter-spacing: .06em; line-height: 1; }

#aviso { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(.9); text-align: center; opacity: 0; transition: opacity .2s, transform .2s; width: min(92vw, 640px); }
#aviso.ver { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#aviso b { display: block; font-family: var(--cond); font-size: clamp(30px, 7vh, 58px); line-height: 1; text-transform: uppercase; letter-spacing: .02em; text-shadow: 0 3px 14px rgba(0, 0, 0, .7); }
#aviso small { display: block; margin-top: 6px; font-size: clamp(13px, 2.6vh, 18px); font-weight: 600; text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
#aviso.gol b { color: var(--verde); }
#aviso.malo b { color: var(--rojo); }
#aviso.chico b { font-size: clamp(22px, 5vh, 36px); }

#coach { position: absolute; left: 50%; bottom: calc(14px + var(--sb)); transform: translateX(-50%) translateY(6px); max-width: min(46vw, 460px); padding: 8px 14px; border-radius: 12px; background: rgba(6, 34, 47, .88); border: 1px solid rgba(143, 224, 247, .4); font-size: 14px; font-weight: 600; line-height: 1.25; text-align: center; opacity: 0; transition: opacity .25s, transform .25s; }
#coach.ver { opacity: 1; transform: translateX(-50%); }
#coach b { color: var(--ambar); font-weight: 800; }
#coach.urge { border-color: var(--rojo); background: rgba(90, 12, 16, .9); }

#teclas { position: absolute; left: 14px; bottom: 12px; font-size: 11px; color: #bfe0ea; background: rgba(6, 34, 47, .6); padding: 5px 9px; border-radius: 8px; max-width: 30vw; line-height: 1.5; }
#teclas b { color: #fff; background: rgba(255, 255, 255, .14); padding: 0 4px; border-radius: 3px; }

/* ------------------------------------------------------ controles táctiles */
/* Por DEBAJO del HUD (que no recibe toques salvo pausa y sonido): si va
   encima, se come los clics de esos dos botones. */
#tactil { position: fixed; inset: 0; z-index: 1; display: none; touch-action: none; }
body.jugando #tactil { display: block; }
#palanca { position: absolute; left: calc(84px + var(--si)); top: calc(100% - 92px - var(--sb)); width: 116px; height: 116px; margin: -58px 0 0 -58px; border-radius: 50%; border: 2px solid rgba(160, 220, 240, .3); background: rgba(8, 40, 55, .28); pointer-events: none; }
#palanca.viva { border-color: rgba(160, 220, 240, .6); background: rgba(8, 40, 55, .4); }
#perilla { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: rgba(200, 240, 252, .75); }
#botones { position: absolute; right: calc(14px + var(--sd)); bottom: calc(12px + var(--sb)); display: flex; align-items: flex-end; gap: 10px; }
.btn { touch-action: none; width: 64px; height: 64px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1; font-size: 11px; font-weight: 800; letter-spacing: .04em; background: rgba(8, 40, 55, .62); border: 2px solid rgba(160, 220, 240, .4); color: var(--espuma); cursor: pointer; }
.btn.down { transform: scale(.93); background: rgba(111, 211, 239, .55); }
#b-sprint { width: 58px; height: 58px; font-size: 10px; }
#b-nivel { width: 78px; height: 78px; border-color: #8fe0f7; background: rgba(28, 110, 160, .72); }
#b-nivel i { font-style: normal; font-size: 22px; }
#b-nivel b { font-size: 13px; margin-top: 2px; }
#b-nivel.subir { background: rgba(20, 60, 78, .7); }
#b-nivel.urge { background: rgba(215, 38, 30, .9); border-color: #fff; animation: pulso .45s infinite alternate; }
#b-nivel.listo { background: rgba(40, 170, 110, .88); border-color: #fff; animation: pulso .7s infinite alternate; }
@keyframes pulso { to { transform: scale(1.09); } }

/* El botón de acción dice lo que va a hacer y cambia de color con ello. */
#b-accion { width: 96px; height: 96px; position: relative; border-width: 3px; }
#b-accion i { font-style: normal; font-size: 20px; height: 22px; }
#b-accion b { font-size: 16px; letter-spacing: .04em; }
#b-accion small { font-size: 9px; font-weight: 700; opacity: .92; margin-top: 2px; max-width: 80px; }
#b-accion::after { content: ''; position: absolute; inset: -7px; border-radius: 50%; pointer-events: none; background: conic-gradient(var(--ambar) calc(var(--carga, 0) * 360deg), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); }
#b-accion.tiro { background: rgba(50, 200, 120, .92); border-color: #fff; color: #04261a; animation: pulso .5s infinite alternate; }
#b-accion.pase { background: rgba(47, 127, 212, .9); border-color: #cfe9ff; }
#b-accion.flick { background: rgba(47, 127, 212, .6); border-color: #8fe0f7; }
#b-accion.quitar { background: rgba(225, 50, 44, .92); border-color: #fff; animation: pulso .4s infinite alternate; }
#b-accion.tomar { background: rgba(255, 61, 134, .92); border-color: #fff; }
#b-accion.pedir { background: rgba(244, 247, 249, .92); border-color: #fff; color: var(--tinta); }
#b-accion.rival, #b-accion.puck, #b-accion.baja { background: rgba(8, 40, 55, .5); border-color: rgba(160, 220, 240, .3); color: rgba(232, 247, 252, .7); }

/* Con ratón los botones se quedan como chivato de lo que hacen las teclas. */
@media (pointer: fine) {
  #palanca { display: none; }
  #botones { transform: scale(.82); transform-origin: bottom right; }
  #b-sprint { display: none; }
}
@media (pointer: coarse) { #teclas { display: none; } .solo-raton { display: none; } }
@media (pointer: fine) { .solo-tactil { display: none; } }

/* ----------------------------------------------------------- pantallas */
.pantalla { position: fixed; inset: 0; z-index: 10; display: none; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(10px + var(--sa)) calc(12px + var(--sd)) calc(10px + var(--sb)) calc(12px + var(--si)); background: linear-gradient(180deg, rgba(4, 26, 37, .5), rgba(4, 26, 37, .72)); }
.pantalla.ver { display: flex; }
/* El centrado va con margin:auto en el hijo: con align-items:center lo que no
   cabe queda cortado por arriba y no se alcanza con el dedo. */
.tarjeta { margin: auto; width: min(960px, 100%); background: var(--panel); border: 1px solid rgba(143, 224, 247, .3); border-radius: 18px; padding: 18px 22px; box-shadow: 0 18px 60px rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tarjeta.chica { width: min(520px, 100%); text-align: center; }
.kicker { font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--agua); }
.lobby-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.idiomas { flex: none; white-space: nowrap; }
.idiomas button { min-width: 44px; height: 32px; border-radius: 8px; border: 1px solid #3f6b7a; background: transparent; font-size: 12px; font-weight: 800; margin-left: 4px; }
.idiomas button.on { background: var(--agua); color: var(--tinta); border-color: var(--agua); }
.lobby-cuerpo { display: grid; grid-template-columns: 1.25fr 1fr; gap: 22px; align-items: center; margin-top: 6px; }
h1 { font-family: var(--cond); font-size: clamp(34px, 8.5vh, 68px); line-height: .95; margin: 2px 0 8px; text-transform: uppercase; letter-spacing: .01em; }
h2 { font-family: var(--cond); font-size: clamp(30px, 8vh, 52px); line-height: 1; margin: 4px 0 8px; text-transform: uppercase; }
.gancho { font-size: clamp(13px, 2.3vh, 17px); line-height: 1.35; margin: 0 0 10px; color: #d6eef6; }
.como { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.como li { display: flex; gap: 10px; align-items: flex-start; }
.como li span { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--rosa); color: #fff; font-weight: 900; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.como p { margin: 2px 0 0; font-size: clamp(12px, 2.1vh, 15px); line-height: 1.3; color: #cfe6ee; }
.como b { color: #fff; }
.niveles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.niveles label { position: relative; cursor: pointer; }
.niveles input { position: absolute; opacity: 0; inset: 0; }
.niveles span { display: flex; flex-direction: column; gap: 2px; justify-content: center; min-height: 52px; padding: 7px 8px; border-radius: 10px; border: 1px solid #365d6b; background: #092a38; text-align: center; }
.niveles b { font-size: 14px; }
.niveles small { font-size: 10px; color: #a9c7d1; line-height: 1.15; }
.niveles input:checked + span { border-color: var(--verde); background: #123f49; box-shadow: inset 0 -3px var(--verde); }
.niveles input:focus-visible + span { outline: 2px solid #fff; }
.jugar { display: block; width: 100%; margin-top: 10px; min-height: 58px; border: 0; border-radius: 14px; background: linear-gradient(180deg, #ff5c9a, #f02a72); color: #fff; font-family: var(--cond); font-size: 28px; font-weight: 800; letter-spacing: .08em; box-shadow: 0 6px 0 #a3134a, 0 12px 26px rgba(240, 42, 114, .4); }
.jugar:active { transform: translateY(3px); box-shadow: 0 3px 0 #a3134a; }
.jugar:disabled { background: #2c5564; box-shadow: none; font-size: 17px; letter-spacing: .02em; color: #b9d6df; }
.segundo { display: block; width: 100%; margin-top: 10px; min-height: 46px; border-radius: 12px; border: 1px solid #54818d; background: transparent; font-weight: 700; font-size: 15px; }
.dura { margin: 9px 0 0; font-size: 12px; color: #b6d1da; text-align: center; }
.ayuda { margin: 6px 0 0; font-size: 11px; color: #9dbdc8; text-align: center; line-height: 1.6; }
.ayuda b { color: #fff; background: rgba(255, 255, 255, .12); padding: 0 4px; border-radius: 3px; }
.otros { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #2b4d5a; font-size: 13px; }
.otros span { font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #8fb3bf; }
.otros a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 700; text-decoration: none; border-bottom: 0; color: #d9f3fb; }
.otros a::after { content: '›'; margin-left: 5px; color: var(--agua); }
.otros a.tienda { margin-left: auto; color: var(--ambar); font-size: 12px; }
.chica .otros { justify-content: center; }
.chica .otros a.tienda { margin-left: 0; flex-basis: 100%; justify-content: center; min-height: 32px; }

.f-marcador { display: flex; align-items: center; justify-content: center; gap: 12px; font-family: var(--cond); margin: 4px 0; }
.f-marcador b { font-size: 54px; line-height: 1; }
.f-marcador u { text-decoration: none; font-size: 30px; opacity: .6; }
.f-marcador .eq { display: flex; align-items: center; gap: 6px; font-size: 13px; letter-spacing: .1em; }
.f-marcador em { font-style: normal; }
#f-sub { margin: 4px 0 10px; color: #cfe6ee; font-size: 15px; }
.f-datos { list-style: none; padding: 0; margin: 0 0 4px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.f-datos li { background: #0a2e3c; border-radius: 10px; padding: 7px 4px; font-size: 10px; color: #a9c7d1; line-height: 1.2; }
.f-datos b { display: block; font-family: var(--cond); font-size: 24px; color: #fff; line-height: 1.05; }
#final.gana h2 { color: var(--verde); }
#final.pierde h2 { color: #ffb0a8; }

/* --------------------------------------------- celular tumbado: todo cabe */
@media (max-height: 480px) {
  .tarjeta { padding: 10px 16px; border-radius: 14px; }
  .lobby-cuerpo { gap: 16px; }
  .jugar { min-height: 50px; font-size: 24px; margin-top: 8px; }
  .otros { margin-top: 8px; padding-top: 4px; }
  .otros a { min-height: 36px; }
  .dura { margin-top: 6px; }
  .ayuda { display: none; }
  #marcador b { font-size: 24px; }
  #reloj { font-size: 18px; }
  #aire .barra { width: 150px; }
  #mapa { width: 108px; height: 72px; }
  #coach { font-size: 13px; padding: 6px 12px; bottom: calc(8px + var(--sb)); max-width: 40vw; }
  #b-accion { width: 88px; height: 88px; }
  #b-nivel { width: 72px; height: 72px; }
  .tarjeta.chica { padding: 10px 18px; }
  .tarjeta.chica h2 { font-size: 32px; margin: 0 0 2px; }
  .f-marcador b { font-size: 38px; }
  #f-sub { margin: 0 0 6px; font-size: 13px; }
  .f-datos b { font-size: 19px; }
  .f-datos li { padding: 4px; }
  .segundo { min-height: 44px; margin-top: 6px; }
  .tarjeta.chica .jugar { min-height: 46px; margin-top: 6px; }
  #final .tarjeta.chica { width: min(680px, 100%); display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; align-items: center; }
  #final .kicker, #final h2, #final .f-marcador, #final #f-sub, #final .f-datos, #final .otros { grid-column: 1 / -1; }
}

/* ------------------------------------------------- vertical: sigue jugable */
@media (orientation: portrait) {
  .lobby-cuerpo { grid-template-columns: 1fr; gap: 12px; }
  h1 { font-size: clamp(34px, 11vw, 56px); }
  #mapa { display: none; }
  #centro { top: calc(60px + var(--sa)); }
  #coach { bottom: calc(190px + var(--sb)); max-width: 88vw; }
  #control { top: calc(166px + var(--sa)); }
  #botones { flex-wrap: wrap-reverse; justify-content: flex-end; max-width: 190px; bottom: calc(22px + var(--sb)); }
  .f-datos { grid-template-columns: repeat(3, 1fr); }
  .otros a.tienda { margin-left: 0; }
}
#gira { position: fixed; inset: 0; z-index: 20; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; background: rgba(4, 26, 37, .94); }
#gira b { font-family: var(--cond); font-size: 34px; text-transform: uppercase; }
#gira p { margin: 0; max-width: 300px; color: #cfe6ee; }
#gira button { margin-top: 10px; min-height: 46px; padding: 0 22px; border-radius: 12px; border: 1px solid #54818d; background: transparent; font-weight: 700; }
#gira .telefono { width: 54px; height: 92px; border: 4px solid var(--agua); border-radius: 12px; animation: gira 1.8s infinite ease-in-out; }
@keyframes gira { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(90deg); } }
@media (orientation: portrait) and (pointer: coarse) {
  body.jugando:not(.vertical-ok) #gira { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
  #b-accion, #b-nivel, #aire, #gira .telefono { animation: none !important; }
}
