@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/PressStart2P-400-latin.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-var-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #03020a; }
button { font: inherit; }

#football-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding-top: 30px;
  background:
    radial-gradient(ellipse at 50% -12%, rgb(255 47 172 / .16) 0%, transparent 52%),
    radial-gradient(ellipse at 50% 118%, rgb(34 231 255 / .13) 0%, transparent 48%),
    linear-gradient(#0a0418 0%, #060311 60%, #0d0521 100%);
}

/* ── Barra de título ── */

.football-titlebar {
  position: fixed;
  z-index: 8;
  top: 0;
  left: 0;
  display: flex;
  width: 100%;
  height: 30px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(255 47 172 / .55);
  padding-left: 12px;
  color: #ff9ad4;
  background: linear-gradient(#120826, #0b0418);
  box-shadow:
    inset 0 1px 0 rgb(255 154 212 / .18),
    0 0 14px rgb(255 47 172 / .25);
  font: 8px "Press Start 2P", monospace;
  letter-spacing: .22em;
  text-shadow: 0 0 6px rgb(255 47 172 / .7);
}

.football-titlebar button {
  align-self: stretch;
  width: 38px;
  border: 0;
  border-left: 1px solid rgb(34 231 255 / .45);
  color: #22e7ff;
  background: transparent;
  font: 18px "JetBrains Mono", monospace;
  cursor: pointer;
  text-shadow: 0 0 6px rgb(34 231 255 / .8);
  transition: background .15s;
}

.football-titlebar button:hover,
.football-titlebar button:focus-visible { background: rgb(255 47 172 / .28); color: #fff; }

/* ── Mueble de recreativa ── */

.cab {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 12px 0;
  padding: 0 24px 16px;
  border: 3px solid #14092b;
  outline: 1px solid rgb(34 231 255 / .22);
  outline-offset: -5px;
  border-radius: 16px 16px 10px 10px;
  background: linear-gradient(#170b30, #100723 55%, #0a0518);
  box-shadow:
    inset 4px 0 0 #241145,
    inset -4px 0 0 #070310,
    0 0 26px rgb(255 47 172 / .14),
    0 0 56px rgb(34 231 255 / .08),
    0 24px 48px rgb(0 0 0 / .65);
}

/* ── Marquee neón ── */

.cab-marquee {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  margin: 12px 0;
  padding: 14px 10px 17px;
  border: 3px solid #14092b;
  border-radius: 10px;
  background:
    /* rejilla synthwave en perspectiva */
    repeating-linear-gradient(to bottom,
      rgb(255 47 172 / .16) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(to right,
      rgb(34 231 255 / .13) 0 1px, transparent 1px 14px),
    radial-gradient(ellipse at 50% 118%, rgb(255 47 172 / .32), transparent 62%),
    linear-gradient(#160b2e, #0e0620);
  box-shadow:
    inset 0 0 20px rgb(255 47 172 / .16),
    inset 0 0 40px rgb(34 231 255 / .07),
    inset 0 2px 0 rgb(255 255 255 / .05);
  text-align: center;
  font-family: "Press Start 2P", monospace;
}

/* horizonte brillante bajo el texto */
.cab-marquee::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  pointer-events: none;
  background: linear-gradient(to top, rgb(34 231 255 / .22), transparent);
}

.cab-marquee > * { position: relative; z-index: 1; }

.cab-marquee span {
  color: #22e7ff;
  font-size: 8px;
  letter-spacing: .38em;
  text-shadow:
    0 0 8px rgb(34 231 255 / .85),
    0 0 18px rgb(34 231 255 / .45),
    -1px 0 0 rgb(255 47 172 / .55);
  animation: neon-cyan-flicker 4.2s infinite;
}

.cab-marquee strong {
  color: #fff;
  font-size: clamp(13px, 2.4vw, 21px);
  font-weight: 400;
  letter-spacing: .1em;
  text-shadow:
    0 0 6px #fff,
    0 0 16px rgb(255 47 172 / .9),
    0 0 32px rgb(255 47 172 / .55),
    3px 3px 0 #4b0f36;
  animation: neon-magenta-flicker 6.1s infinite;
}

@keyframes neon-cyan-flicker {
  0%, 100%, 41%, 44%, 46% { opacity: 1; }
  42%, 43%, 45.5% { opacity: .55; }
}
@keyframes neon-magenta-flicker {
  0%, 19.9%, 22%, 62%, 64%, 100% { opacity: 1; }
  20%, 21.9%, 63%, 63.9% { opacity: .4; }
}

/* ── Bisel y pantalla ── */

.cab-screen {
  position: relative;
  padding: 16px;
  border: 3px solid #14092b;
  border-radius: 12px;
  background: linear-gradient(#0c0618, #060310);
  box-shadow:
    inset 0 3px 0 rgb(255 255 255 / .05),
    inset 0 -3px 0 #000,
    0 0 18px rgb(34 231 255 / .1);
}

#football-stage {
  position: relative;
  display: flex;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  border-radius: 12px / 16px;
  background: #010201;
  box-shadow:
    0 0 0 2px #000,
    0 0 24px rgb(34 231 255 / .2),
    0 0 48px rgb(255 47 172 / .1);
}

#football-canvas {
  display: block;
  outline: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

#football-crt {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  border-radius: inherit;
  background:
    /* scanlines */
    repeating-linear-gradient(to bottom,
      rgb(255 255 255 / .03) 0 1px, rgb(0 0 0 / .13) 1px 3px),
    /* máscara RGB vertical tenue */
    repeating-linear-gradient(to right,
      rgb(255 0 128 / .02) 0 1px, rgb(0 255 200 / .02) 1px 2px, rgb(40 80 255 / .02) 2px 3px),
    /* viñeta con curvatura simulada */
    radial-gradient(ellipse at center, transparent 58%, rgb(0 0 0 / .38) 100%);
  mix-blend-mode: multiply;
}
#football-crt.active { opacity: 1; animation: crt-breathe 5s ease-in-out infinite; }
#football-crt.active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(to bottom,
      transparent 0%, rgb(255 255 255 / .035) 49%,
      rgb(255 255 255 / .01) 50%, transparent 51%) no-repeat,
    linear-gradient(to bottom, rgb(180 240 255 / .05), transparent 12%);
  background-size: 100% 90px, 100% 100%;
  animation: crt-roll 7s linear infinite;
}
@keyframes crt-roll { from { transform: translateY(-90px); } to { transform: translateY(calc(100% + 90px)); } }
@keyframes crt-breathe { 50% { filter: brightness(1.05); } }

/* cristal con brillo diagonal + viñeta exterior */
.cab-glass {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(112deg, transparent 42%, rgb(255 255 255 / .05) 46%, rgb(255 255 255 / .09) 50%, rgb(255 255 255 / .04) 54%, transparent 58%),
    radial-gradient(ellipse at 50% 50%, transparent 66%, rgb(6 2 16 / .5) 100%);
}

#football-hint {
  width: fit-content;
  max-width: 100%;
  margin: 10px auto 0;
  padding: 6px 10px;
  border: 1px solid rgb(34 231 255 / .3);
  border-radius: 6px;
  color: #bfeef7;
  background: #0a0620;
  box-shadow: inset 0 0 10px rgb(34 231 255 / .08);
  font: 7px "Press Start 2P", monospace;
  letter-spacing: .08em;
  white-space: nowrap;
  text-shadow: -1px 0 0 rgb(255 47 172 / .5), 0 0 6px rgb(34 231 255 / .5);
}

/* ── Panel de mandos ── */

.cab-panel {
  margin-top: 12px;
  padding: 12px 16px 22px;
  border: 3px solid #14092b;
  border-radius: 10px;
  background: linear-gradient(#1c1038, #130a29 70%, #0d0620);
  box-shadow:
    inset 0 3px 0 rgb(255 255 255 / .06),
    inset 0 -4px 0 #05020e,
    inset 0 0 24px rgb(255 47 172 / .05);
}

#football-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.football-btn {
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: filter .12s, transform .06s;
}
.football-btn:hover { filter: brightness(1.15); }
.football-btn:focus-visible { outline: 2px solid #22e7ff; outline-offset: 2px; }

.cab-stick {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 42px);
  gap: 2px;
  place-items: center;
}

.cab-dir--up { grid-area: 1 / 2; }
.cab-dir--left { grid-area: 2 / 1; }
.cab-ball { grid-area: 2 / 2; }
.cab-dir--right { grid-area: 2 / 3; }
.cab-dir--down { grid-area: 3 / 2; }

.cab-ball {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffd9ec, #ff2fac 45%, #8f1060 80%, #4d0a38);
  box-shadow:
    0 0 0 4px #0a0620,
    0 0 0 6px #241145,
    0 0 14px rgb(255 47 172 / .5),
    0 3px 8px rgb(0 0 0 / .6);
}

.cab-dir {
  display: flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 2px solid #0a0418;
  border-bottom-width: 4px;
  border-radius: 10px;
  color: #22e7ff;
  text-shadow: 0 0 6px rgb(34 231 255 / .8);
  background: radial-gradient(circle at 35% 30%, #33205c, #1b0f38 62%, #110827);
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / .12),
    inset 0 -3px 0 #060213,
    0 0 8px rgb(34 231 255 / .18),
    0 2px 0 #000;
  font-family: "JetBrains Mono", monospace;
  font-size: 15px;
}
.cab-dir:active {
  transform: translateY(3px);
  border-bottom-width: 2px;
  box-shadow: inset 0 2px 8px #000, inset 0 0 10px rgb(34 231 255 / .12);
}

.cab-coin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 2px solid #0a0418;
  border-radius: 8px;
  background: #0b0520;
  box-shadow: inset 0 2px 8px rgb(0 0 0 / .85);
}

.cab-coin__slots { display: flex; gap: 10px; }
.cab-coin__slots i {
  display: block;
  width: 6px;
  height: 18px;
  border-radius: 2px;
  background: #050210;
  box-shadow: inset 0 0 0 1px #4a2a86, 0 0 5px rgb(34 231 255 / .25);
}

.cab-coin__label {
  color: #ffd166;
  font: 6px "Press Start 2P", monospace;
  letter-spacing: .14em;
  text-shadow: 0 0 6px rgb(255 209 102 / .75), -1px 0 0 rgb(255 47 172 / .45);
  animation: coin-blink 1.4s steps(2) infinite;
}
@keyframes coin-blink { 50% { opacity: .25; } }

.cab-actions { display: flex; align-items: center; gap: 14px; }

.cab-faces {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.cab-start {
  width: 74px;
  height: 34px;
  border: 2px solid #0a0418;
  border-bottom-width: 5px;
  border-radius: 8px;
  color: #04202b;
  background: linear-gradient(#b8fbff, #22e7ff 55%, #0f93bd);
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / .55),
    inset 0 -3px 0 #0b6d90,
    0 0 12px rgb(34 231 255 / .4),
    0 3px 0 #000;
  font: 8px "Press Start 2P", monospace;
  letter-spacing: .08em;
}

.cab-a, .cab-b, .cab-c {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: "Press Start 2P", monospace;
  text-shadow: 0 1px 0 rgb(255 255 255 / .3);
}

.cab-b, .cab-c {
  width: 48px;
  height: 48px;
  border: 2px solid #1a1204;
  border-bottom-width: 5px;
  font-size: 13px;
}

.cab-b {
  color: #3a2a00;
  background: radial-gradient(circle at 34% 28%, #fff1a8, #ffd166 48%, #c48912 85%);
  box-shadow:
    inset 0 3px 0 rgb(255 255 255 / .5),
    inset 0 -4px 0 #8a5f08,
    0 0 14px rgb(255 209 102 / .45),
    0 3px 0 #000;
}

.cab-c {
  color: #3a1400;
  background: radial-gradient(circle at 34% 28%, #ffc9a0, #ff7a2e 48%, #c4450a 85%);
  box-shadow:
    inset 0 3px 0 rgb(255 255 255 / .45),
    inset 0 -4px 0 #8a2c06,
    0 0 14px rgb(255 122 46 / .45),
    0 3px 0 #000;
}

.cab-a {
  width: 62px;
  height: 62px;
  border: 2px solid #2b0420;
  border-bottom-width: 6px;
  color: #33001f;
  background: radial-gradient(circle at 34% 28%, #ffb8de, #ff2fac 48%, #b00a72 85%);
  box-shadow:
    inset 0 3px 0 rgb(255 255 255 / .45),
    inset 0 -5px 0 #7d0652,
    0 0 18px rgb(255 47 172 / .55),
    0 4px 0 #000;
  font-size: 17px;
}

.cab-faces button::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: -13px;
  transform: translateX(-50%);
  color: #b8a4d8;
  font: 5px "Press Start 2P", monospace;
  letter-spacing: .08em;
  text-shadow: 0 0 4px rgb(34 231 255 / .35);
  white-space: nowrap;
  pointer-events: none;
}

.cab-start:active, .cab-a:active, .cab-b:active, .cab-c:active {
  transform: translateY(3px);
  border-bottom-width: 2px;
}
.cab-start:active { box-shadow: inset 0 2px 8px #000; }
.cab-a:active { box-shadow: inset 0 3px 10px #000, inset 0 0 12px rgb(255 47 172 / .2); }
.cab-b:active { box-shadow: inset 0 3px 10px #000, inset 0 0 12px rgb(255 209 102 / .2); }
.cab-c:active { box-shadow: inset 0 3px 10px #000, inset 0 0 12px rgb(255 122 46 / .2); }

.football-exit {
  position: fixed;
  z-index: 9;
  top: 40px;
  right: 12px;
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 2px solid rgb(255 47 172 / .6);
  border-radius: 8px;
  color: #ff9ad4;
  background: rgb(18 6 20 / .85);
  box-shadow: 0 0 10px rgb(255 47 172 / .3);
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
}

@media (max-width: 768px) {
  .cab { margin: 8px 0; padding: 0 10px 10px; }
  .cab-marquee { margin: 8px 0; padding: 10px 8px 13px; gap: 5px; }
  .cab-marquee span { font-size: 6px; letter-spacing: .3em; }
  .cab-marquee strong { font-size: 12px; }
  .cab-screen { padding: 9px; }
  #football-hint { display: none; }
  .cab-panel { margin-top: 8px; padding: 10px 10px 20px; }
  #football-controls { gap: 10px; }
  .cab-stick { grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(3, 46px); }
  .cab-dir { width: 46px; height: 46px; }
  .football-titlebar { font-size: 6px; }
  .football-titlebar button { display: none; }
  .football-exit { display: flex; }
}

@media (max-width: 520px) {
  .cab-coin { display: none; }
  .cab-actions { flex-direction: column-reverse; gap: 16px; }
  .cab-start { width: 64px; height: 30px; font-size: 7px; }
  .cab-a { width: 54px; height: 54px; font-size: 14px; }
  .cab-b, .cab-c { width: 44px; height: 44px; font-size: 11px; }
}

@media (max-width: 768px) and (orientation: portrait) {
  #football-overlay { justify-content: flex-start; padding-top: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  #football-crt { display: none; }
  .cab-coin__label,
  .cab-marquee span,
  .cab-marquee strong { animation: none; }
  .football-btn { transition: none; }
}
