/* Penales de Celutimba. MOBILE-FIRST. Misma paleta que la portada y los otros
   juegos (azul noche + naranja), con el verde del césped y el blanco del arco. */

@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url('../fonts/oswald.woff2') format('woff2');
}

:root {
  --fondo:       #081226;
  --panel:       #0d1b38;
  --borde:       #1c3564;
  --azul:        #2f9df0;
  --azul-brillo: #6cc4ff;
  --naranja:     #f7941d;
  --naranja-brillo: #ffb54d;
  --dorado:      #e6b84c;
  --verde:       #1fbf6b;
  --verde-hondo: #0c8a45;
  --cesped:      #123f2a;
  --cesped2:     #0d3120;
  --rojo:        #d4133a;
  --texto:       #eaf3ff;
  --texto-suave: #9fb4d8;
  --titulo: 'Oswald', 'Arial Narrow', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  background: var(--fondo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.mesa {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* centra el juego a lo alto: reparte el espacio libre */
  gap: 16px;
  padding: 18px 12px 24px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

/* --- Cancha y arco --------------------------------------------------------- */

.cancha { position: relative; width: 100%; }

.arco {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 3.4;
  border-radius: 14px;
  overflow: hidden;
  /* Fondo azul liso arriba; el pasto va aparte, adelante, en .arco__cesped. */
  background: linear-gradient(180deg, #0a2142 0%, #0b1a34 100%);
  box-shadow: inset 0 2px 30px rgba(0, 0, 0, .55);
}

/* Franja de pasto al frente, con rayas de cortadora. Va sobre la tribuna, ocupa
   solo la parte de abajo (donde está el punto de penal y la pelota). */
.arco__cesped {
  position: absolute;
  left: 0;
  right: 0;
  top: 60%;
  bottom: 0;
  z-index: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 6.5%, rgba(0, 0, 0, .06) 6.5% 13%),
    linear-gradient(180deg, #1e8a4e 0%, #116035 55%, #0b4227 100%);
  box-shadow: inset 0 12px 22px -10px rgba(0, 0, 0, .55);
}

/* Marco del arco (postes y travesaño). Ancho: usa casi todo el arco. */
.arco::before {
  content: '';
  position: absolute;
  left: 4%;
  right: 4%;
  top: 7%;
  bottom: 24%;
  border: 6px solid #eef4ff;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 12px rgba(255, 255, 255, .25);
  z-index: 1;
}

/* Red del arco: malla tenue dentro del marco */
.arco__red {
  position: absolute;
  left: calc(4% + 6px);
  right: calc(4% + 6px);
  top: calc(7% + 6px);
  bottom: 24%;
  z-index: 1;
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .14) 0 1px, transparent 1px 15px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .14) 0 1px, transparent 1px 15px);
}

/* Punto del penal */
.arco::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 12%;
  width: 9px;
  height: 9px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, .7);
  z-index: 1;
}

.arco__zonas { position: absolute; inset: 0; z-index: 3; }

/* Una zona/palo: círculo objetivo */
.palo {
  position: absolute;
  width: 20%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: radial-gradient(circle at 42% 35%, rgba(108, 196, 255, .35), rgba(47, 157, 240, .1) 65%, transparent 72%);
  outline: 2px dashed rgba(234, 243, 255, .45);
  outline-offset: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .1s ease, background .2s ease, outline-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.arco--activo .palo:hover { transform: translate(-50%, -50%) scale(1.08); outline-color: var(--naranja-brillo); }
.arco--activo .palo:active { transform: translate(-50%, -50%) scale(.96); }
.arco:not(.arco--activo) .palo { cursor: default; }

/* Guante del arquero sobre un palo tapado */
.palo__guante {
  width: 62%;
  height: 62%;
  display: none;
  animation: aparecer .18s ease;
}
.palo--tapado .palo__guante { display: block; }
.palo--tapado {
  background: radial-gradient(circle at 42% 35%, rgba(255, 106, 128, .5), rgba(212, 19, 58, .18) 60%, transparent 72%);
  outline-color: rgba(255, 143, 163, .8);
}
/* Gol: la zona festeja en verde */
.palo--gol {
  background: radial-gradient(circle at 42% 35%, rgba(53, 224, 138, .6), rgba(31, 191, 107, .18) 60%, transparent 72%);
  outline: 2px solid var(--verde);
  outline-offset: -6px;
}

.palo__guante svg { width: 100%; height: 100%; display: block; }

/* La pelota (una pelota de fútbol en SVG, la arma penales.js). Descansa siempre
   sobre el punto de penal; el JS controla left/top/transform para el vuelo al palo. */
.pelota {
  position: absolute;
  left: 50%;
  top: 85%;
  width: 13%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(.6);
  z-index: 4;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, .55));
}
.pelota img { width: 100%; height: 100%; display: block; }
/* La transición de vuelo la maneja el JS cambiando left/top/transform. Rápida y
   con curva de disparo (sale fuerte y frena al llegar). */
.pelota--volando { transition: left .26s cubic-bezier(.25, .85, .35, 1), top .26s cubic-bezier(.25, .85, .35, 1), transform .26s ease-out; }
/* Mientras vuela, la pelota gira. La rotación va en el <img> para no pisar el
   translate/scale que maneja el contenedor. */
@keyframes girarPelota { to { transform: rotate(360deg); } }
.pelota.girando img { animation: girarPelota .3s linear infinite; }

/* --- Resultado de la ronda ------------------------------------------------- */

.resultado {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  background: rgba(8, 18, 38, .55);
  backdrop-filter: blur(1px);
  z-index: 6;
  animation: aparecer .16s ease;
}
.resultado__tarjeta {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 26px;
  border-radius: 16px;
  background: rgba(8, 18, 38, .94);
  border: 2px solid var(--verde);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .55), 0 0 26px rgba(31, 191, 107, .5);
  transition: transform .1s ease;
}
.resultado:active .resultado__tarjeta { transform: scale(.96); }
.resultado--perdio .resultado__tarjeta {
  border-color: var(--rojo);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .55), 0 0 26px rgba(212, 19, 58, .45);
}
.resultado__mult {
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 2.5rem;
  line-height: 1;
  color: #4ce09a;
}
.resultado--perdio .resultado__mult { color: #ff8fa3; font-size: 2rem; }
.resultado__detalle {
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--naranja-brillo);
}
.resultado--perdio .resultado__detalle { color: var(--texto-suave); }
.resultado__hint {
  margin-top: 8px;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--texto-suave);
}

@keyframes aparecer {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* --- Marcador -------------------------------------------------------------- */

.marcador { width: 100%; display: flex; gap: 8px; }
.marcador__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 8px 4px;
}
.marcador__item--fuerte {
  background: linear-gradient(180deg, rgba(247, 148, 29, .16), rgba(247, 148, 29, .04));
  border-color: rgba(247, 148, 29, .45);
}
.marcador__etiqueta { color: var(--texto-suave); font-size: .68rem; text-align: center; }
.marcador__valor { font-family: var(--titulo); font-weight: 600; font-size: 1.15rem; color: var(--texto); }
.marcador__item--fuerte .marcador__valor { color: var(--naranja-brillo); font-size: 1.35rem; }

/* --- Ajustes --------------------------------------------------------------- */

.ajustes { width: 100%; display: flex; flex-wrap: wrap; gap: 10px; }
.ajuste { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 6px; }
.ajuste__etiqueta {
  color: var(--texto-suave);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding-left: 2px;
}
.ajuste__control {
  display: flex;
  align-items: stretch;
  gap: 6px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 5px;
}
.ajuste__control--dif { justify-content: space-between; }
.ajuste__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--texto);
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 1.15rem;
  text-align: center;
}
.ajuste__input::-webkit-outer-spin-button,
.ajuste__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ajuste__input { -moz-appearance: textfield; }
.ajuste__dif {
  flex: 1;
  text-align: center;
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--dorado);
  align-self: center;
}
.ajustes__ayuda {
  flex-basis: 100%;
  color: var(--texto-suave);
  font-size: .78rem;
  padding-left: 2px;
}

.mini {
  font-family: var(--titulo);
  font-weight: 600;
  font-size: .9rem;
  color: var(--texto-suave);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--borde);
  border-radius: 9px;
  padding: 6px 10px;
  cursor: pointer;
  transition: color .1s, border-color .1s;
}
.mini:hover:not(:disabled) { color: #fff; border-color: var(--azul); }
.mini:disabled { opacity: .4; cursor: default; }
.mini--redondo { padding: 6px 14px; font-size: 1.2rem; line-height: 1; }

/* --- Botón principal ------------------------------------------------------- */

.control { width: 100%; }
.girar {
  width: 100%;
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 1.5px;
  color: #331a00;
  background: linear-gradient(180deg, var(--naranja-brillo), var(--naranja) 55%, #d97407);
  border: 1px solid #ffd08a;
  border-radius: 14px;
  padding: 14px 20px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(247, 148, 29, .5);
  transition: transform .12s ease, box-shadow .12s ease;
}
.girar:hover:not(:disabled) { box-shadow: 0 6px 30px rgba(247, 148, 29, .75); }
.girar:active:not(:disabled) { transform: scale(.98); }
.girar:disabled { opacity: .55; cursor: default; }
.girar--cobrar {
  color: #03231a;
  background: linear-gradient(180deg, #48e59a, var(--verde) 55%, var(--verde-hondo));
  border-color: #a9ffd4;
  box-shadow: 0 4px 20px rgba(31, 191, 107, .5);
}
.girar--cobrar:hover:not(:disabled) { box-shadow: 0 6px 30px rgba(31, 191, 107, .8); }

.indicacion {
  margin-top: 10px;
  text-align: center;
  color: var(--azul-brillo);
  font-family: var(--titulo);
  font-weight: 500;
  letter-spacing: .5px;
}
.aviso {
  margin-top: 8px;
  text-align: center;
  color: #ff8fa3;
  font-weight: 600;
  min-height: 1.2em;
}

/* --- Últimos resultados ---------------------------------------------------- */

.historial {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--borde);
  border-radius: 12px;
}
.historial__titulo {
  color: var(--texto-suave);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  flex-shrink: 0;
}
.historial__tira {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.historial__vacio { color: var(--texto-suave); font-size: .82rem; }
.chip {
  flex-shrink: 0;
  min-width: 42px;
  height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--titulo);
  font-weight: 600;
  font-size: .82rem;
  color: #06231a;
}
.chip--gano { background: linear-gradient(180deg, #48e59a, var(--verde)); }
.chip--perdio { background: linear-gradient(180deg, #ff6a80, var(--rojo)); color: #fff; }

/* --- Velo de acceso -------------------------------------------------------- */

.velo {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 9, 20, .8);
  backdrop-filter: blur(4px);
}
.velo__caja {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: 16px;
  padding: 26px 24px;
  max-width: 340px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.velo__caja h2 { font-family: var(--titulo); font-weight: 600; }
.velo__caja p { color: var(--texto-suave); }
.velo__boton { text-decoration: none; display: inline-block; }
