/* Tipografía del juego (Bangers, licencia SIL OFL), incluida en el juego: carga al instante y funciona sin internet */
@font-face {
  font-family: 'Bangers';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url(assets/fuentes/bangers.woff2) format('woff2');
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  background: #14121f;
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 40%, #2b2545 0%, #14121f 70%);
  /* celular: sin zoom por doble toque, sin selección ni lupa al mantener apretado */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#game {
  display: block;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 0 3px #1d1d2b;
  background: #8fd3ff;
  outline: none;
  touch-action: none;
}

/* ---------------- Celular ---------------- */
body.tactil #game { border-radius: 0; box-shadow: none; }
#tactil { display: none; }
body.tactil #tactil {
  display: block;
  position: fixed; inset: 0;
  pointer-events: none;
  font-family: 'Bangers', 'Impact', 'Arial Black', sans-serif;
  --t: clamp(70px, 21vmin, 128px);            /* tamaño base de los botones (más grandes: más fáciles de tocar) */
  --borde-x: max(10px, env(safe-area-inset-left), env(safe-area-inset-right));
  --borde-y: max(10px, env(safe-area-inset-bottom));
}
#tactil .pad, #tactil .acc, #tactil button { pointer-events: auto; touch-action: none; }
/* si Pibardo, la pelota o un enemigo pasan por detrás, el botón se vuelve casi transparente (se sigue pudiendo tocar) */
#tactil .pad, #tactil .acciones { transition: opacity 0.15s; }
#tactil .pad.tapa, #tactil .acciones.tapa { opacity: 0.3; }
/* los botones de juego solo jugando */
/* (ocultos con visibility y no con display: así se pueden medir aunque no se vean) */
#tactil:not([data-estado="play"]) .pad,
#tactil:not([data-estado="play"]) .acciones,
#tactil:not([data-estado="play"]) .b-pausa { visibility: hidden; }

/* Botonera con la estética de Pibardo: botones "de figurita" con relieve (labio abajo, brillo arriba,
   borde de tinta). Solo gradientes y sombras sólidas (sin blur): baratos para el celular. */
#tactil .pad {
  position: absolute;
  left: var(--borde-x); bottom: var(--borde-y);
  width: calc(var(--t) * 2.15); height: calc(var(--t) * 1.6);
  border-radius: calc(var(--t) * 0.8);
  background:
    radial-gradient(circle at 50% 30%, rgba(90, 76, 160, 0.45), rgba(20, 16, 40, 0.5));
  border: 4px solid rgba(29, 22, 48, 0.85);
  box-shadow: 0 6px 0 rgba(10, 6, 24, 0.45), inset 0 3px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 3px rgba(255, 210, 63, 0.18);
}
#tactil .fl {
  position: absolute;
  color: #fff;
  font-size: calc(var(--t) * 0.44);
  line-height: 1;
  text-shadow: 0 3px 0 #1d1630, 2px 0 0 #1d1630, -2px 0 0 #1d1630, 0 -2px 0 #1d1630, 0 2px 0 #1d1630;
  opacity: 0.92;
  transition: transform 0.06s, color 0.06s;
}
#tactil .fl.izq { left: 12%; top: 32%; }
#tactil .fl.der { right: 12%; top: 32%; }
#tactil .fl.aba { left: 50%; bottom: 7%; transform: translateX(-50%); font-size: calc(var(--t) * 0.38); }
#tactil .pad.izq .fl.izq, #tactil .pad.der .fl.der { color: #ffd23f; transform: scale(1.28); }
#tactil .pad.aba .fl.aba { color: #ffd23f; transform: translateX(-50%) scale(1.28); }

#tactil .acciones {
  position: absolute;
  right: var(--borde-x); bottom: var(--borde-y);
  /* PATEAR arriba y SALTAR abajo, en columna contra el borde derecho */
  width: calc(var(--t) * 1.1); height: calc(var(--t) * 2.35);
}
#tactil .acc {
  --c1: #ff7b86; --c2: #e63946; --c3: #8f1c2a;
  position: absolute;
  width: var(--t); height: var(--t);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: calc(var(--t) * 0.21);
  letter-spacing: 0.5px;
  text-shadow: 0 2px 0 #1d1630, 1.5px 0 0 #1d1630, -1.5px 0 0 #1d1630, 0 -1.5px 0 #1d1630;
  border: 4px solid #1d1630;
  background:
    radial-gradient(ellipse 60% 32% at 50% 24%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 70%),
    radial-gradient(circle at 50% 35%, var(--c1), var(--c2) 62%, var(--c3));
  box-shadow: 0 7px 0 var(--c3), 0 7px 0 4px #1d1630, 0 12px 0 4px rgba(10, 6, 24, 0.3);
  opacity: 0.9;
  transition: transform 0.05s, box-shadow 0.05s;
}
#tactil .acc span { pointer-events: none; }
#tactil .b-saltar { right: calc(var(--t) * 0.05); bottom: 0; --c1: #8ff08f; --c2: #2fa84f; --c3: #17652d; }
#tactil .b-patear { right: 0; top: 0; width: calc(var(--t) * 1.08); height: calc(var(--t) * 1.08); }
#tactil .b-pase { right: calc(var(--t) * 1.22); bottom: calc(var(--t) * 0.1); --c1: #9be7ff; --c2: #1d8fd1; --c3: #0f4f7a; width: calc(var(--t) * 0.78); height: calc(var(--t) * 0.78); font-size: calc(var(--t) * 0.17); }
#tactil[data-pase="0"] .b-pase { display: none; }
#tactil .b-cambiar { right: calc(var(--t) * 1.25); top: calc(var(--t) * 0.25); --c1: #d0f5a8; --c2: #6ab04c; --c3: #2f6a20; width: calc(var(--t) * 0.56); height: calc(var(--t) * 0.56); font-size: calc(var(--t) * 0.26); }
#tactil:not([data-cambiar="1"]) .b-cambiar { display: none; }
#tactil .acc.on {
  transform: translateY(6px);
  box-shadow: 0 1px 0 var(--c3), 0 1px 0 4px #1d1630, 0 4px 0 4px rgba(10, 6, 24, 0.3);
  filter: brightness(1.15);
}

#tactil .arriba {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: var(--borde-x);
  display: flex; gap: 12px;
}
#tactil button {
  width: 48px; height: 46px;
  border-radius: 14px;
  border: 3.5px solid #1d1630;
  background: linear-gradient(#5a4fa0, #3b3270 60%, #2c2550);
  box-shadow: 0 5px 0 #1d1630, inset 0 3px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  font: 20px/1 'Bangers', sans-serif;
  text-shadow: 0 2px 0 #1d1630;
  cursor: pointer;
}
#tactil button:active { transform: translateY(4px); box-shadow: 0 1px 0 #1d1630, inset 0 3px 0 rgba(255, 255, 255, 0.25); }
:fullscreen #tactil .b-pantalla { opacity: 0.45; }

/* celu parado: cartel que bloquea hasta que se gire (el juego se pausa solo) */
#girar { display: none; }
@media (orientation: portrait) {
  body.tactil #girar {
    display: flex;
    position: fixed; inset: 0; z-index: 10;
    align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% 40%, #2b2545 0%, #14121f 75%);
    font: 28px 'Bangers', 'Impact', sans-serif;
    color: #ffd23f; text-align: center; letter-spacing: 0.5px;
    text-shadow: 0 3px 0 #1d1d2b;
    touch-action: none;
  }
  body.tactil #girar > div { max-width: 80%; }
  body.tactil #girar .cel { font-size: 72px; display: block; margin-bottom: 18px; animation: girar 2.2s ease-in-out infinite; }
  body.tactil #girar small { display: block; font-size: 17px; color: #c9c3e6; margin-top: 10px; text-shadow: none; }
  body.tactil #tactil { display: none; }
}
@keyframes girar { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
