:root {
  --ink: #33ff66;
  --ink-dim: #1c8a3a;
  --cyan: #46f0ff;
  --amber: #ffb000;
  --bg: #04060a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Courier New", "Lucida Console", monospace;
  letter-spacing: 0.08em;
  overflow-x: hidden;
}

body {
  animation: screenFlicker 4s infinite;
}
@keyframes screenFlicker {
  0%,
  19%,
  21%,
  55%,
  57%,
  100% {
    filter: brightness(1);
  }
  20% {
    filter: brightness(0.85) contrast(1.1);
  }
  56% {
    filter: brightness(0.92);
  }
}

/* Brillo ambiental tipo tubo CRT, pulsando sobre toda la pantalla */
.crt-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 52;
  background: radial-gradient(ellipse at center, rgba(51, 255, 102, 0) 45%, rgba(51, 255, 102, 0.1) 100%);
  mix-blend-mode: screen;
  animation: glowPulse 4s ease-in-out infinite;
}
@keyframes glowPulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Curvatura + scanlines de tubo CRT */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.35) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  mix-blend-mode: multiply;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 51;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.55) 100%);
}

main {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6vh 4vw 8vh;
}

/* ---- Título ---- */
.title {
  text-align: center;
  margin: 0 0 1.2rem;
  font-size: clamp(2.2rem, 8vw, 5rem);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  text-shadow:
    0 0 6px var(--ink),
    0 0 18px rgba(51, 255, 102, 0.6),
    0 0 40px rgba(51, 255, 102, 0.3);
  animation: flicker 4s infinite;
}

.subtitle {
  margin: 0 0 3.5rem;
  font-size: clamp(0.7rem, 2.4vw, 1rem);
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.35em;
}
.subtitle .blink {
  animation: blink 1.1s steps(1) infinite;
  color: var(--amber);
}

@keyframes flicker {
  0%,
  19%,
  21%,
  55%,
  57%,
  100% {
    opacity: 1;
  }
  20%,
  56% {
    opacity: 0.82;
  }
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---- Rejilla de juegos ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 260px));
  gap: 2rem;
  justify-content: center;
  width: 100%;
  max-width: 1000px;
}

.cab {
  appearance: none;
  cursor: pointer;
  background: rgba(51, 255, 102, 0.03);
  border: 2px solid var(--ink-dim);
  color: var(--ink);
  padding: 1.6rem 1.4rem 1.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  font-family: inherit;
  letter-spacing: inherit;
  transition:
    transform 0.12s,
    border-color 0.12s,
    box-shadow 0.12s,
    background 0.12s;
}
.cab:hover,
.cab:focus-visible {
  outline: none;
  transform: translateY(-4px);
  border-color: var(--ink);
  background: rgba(51, 255, 102, 0.07);
  box-shadow:
    0 0 12px rgba(51, 255, 102, 0.4),
    inset 0 0 18px rgba(51, 255, 102, 0.08);
}

.cab svg {
  width: 100%;
  height: auto;
  display: block;
}
.cab .name {
  font-size: 1.5rem;
  font-weight: 700;
  text-shadow: 0 0 8px currentColor;
}
.cab .meta {
  font-size: 0.7rem;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.25em;
}
.cab .play-row {
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.cab .play {
  font-size: 0.75rem;
  color: var(--amber);
  border: 1px solid var(--amber);
  padding: 0.35rem 1rem;
}
.cab:hover .play,
.cab:focus-visible .play {
  background: var(--amber);
  color: var(--bg);
}

/* ---- Ranura + moneda, horizontal junto al botón ----
   La ranura es solo una línea (.slot-line). La moneda vive dentro de una capa
   (.slot-track) recortada justo en esa línea (overflow hidden). Aparece con
   fade-in por la derecha y se desliza en un único movimiento continuo hacia la
   izquierda; al cruzar la línea, la propia capa la recorta y desaparece "dentro"
   de la ranura. Sin escalados ni saltos: solo un translate suave. */
.slot {
  position: relative;
  width: 22px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  overflow: visible;
}
.slot-track {
  position: absolute;
  left: 9px; /* empieza en la línea: todo lo que la cruza queda recortado */
  top: 0;
  right: -46px; /* se extiende a la derecha, por donde llega la moneda */
  bottom: 0;
  overflow: hidden;
  z-index: 1;
}
.slot-track svg.coin {
  position: absolute;
  left: 0;
  top: 50%;
  width: 18px;
  height: 18px;
  opacity: 0;
  transform: translate(30px, -50%);
}
.slot-line {
  position: absolute;
  left: 9px;
  top: 3px;
  bottom: 3px;
  width: 2px;
  border-radius: 1px;
  background: var(--ink-dim);
  z-index: 2;
}
.slot .coin.fly {
  animation:
    coinMove 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards,
    coinFade 0.24s ease-out forwards;
}
@keyframes coinMove {
  from {
    transform: translate(30px, -50%);
  }
  to {
    transform: translate(-18px, -50%);
  }
}
@keyframes coinFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---- Ventana del juego (modal) ---- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 3vh 3vw;
  background: rgba(2, 4, 8, 0.82);
  backdrop-filter: blur(2px);
}
.overlay.open {
  display: flex;
}

.window {
  width: min(1000px, 100%);
  height: min(720px, 100%);
  display: flex;
  flex-direction: column;
  border: 2px solid var(--ink);
  box-shadow:
    0 0 24px rgba(51, 255, 102, 0.5),
    inset 0 0 40px rgba(51, 255, 102, 0.05);
  background: var(--bg);
}
.window .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.9rem;
  border-bottom: 2px solid var(--ink-dim);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}
.window .bar .close {
  appearance: none;
  cursor: pointer;
  background: none;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.15rem 0.7rem;
}
.window .bar .close:hover {
  background: var(--ink);
  color: var(--bg);
}

.screen {
  position: relative;
  flex: 1;
  background: #000;
  overflow: hidden;
}
.screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.crt-boot {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #fff;
  transform: scaleY(0.001);
  opacity: 0;
  pointer-events: none;
}
.crt-boot.play {
  animation: crtBoot 0.55s ease-out forwards;
}
@keyframes crtBoot {
  0% {
    transform: scaleY(0.001);
    filter: brightness(4);
    opacity: 1;
  }
  35% {
    transform: scaleY(0.02);
    filter: brightness(6);
    opacity: 1;
  }
  65% {
    transform: scaleY(1);
    filter: brightness(2.4);
    opacity: 1;
  }
  100% {
    transform: scaleY(1);
    filter: brightness(1);
    opacity: 0;
  }
}

/* ---- Sobre Anversa ---- */
.about {
  margin: 5rem auto 0;
  max-width: 640px;
  text-align: center;
  border-top: 1px solid var(--ink-dim);
  padding-top: 2.5rem;
}
.about h2 {
  font-size: 1rem;
  letter-spacing: 0.3em;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(70, 240, 255, 0.5);
  margin: 0 0 1.4rem;
}
.about p {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 1rem;
}
.about .hl {
  color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 176, 0, 0.5);
}

footer {
  margin-top: auto;
  padding-top: 4rem;
  text-align: center;
  letter-spacing: 0.25em;
}
.contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1.4rem;
}
.contact a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    color 0.12s,
    border-color 0.12s,
    text-shadow 0.12s;
}
.contact a:hover {
  color: var(--amber);
  border-color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 176, 0, 0.5);
}
.contact .sep {
  color: var(--ink-dim);
}
.copy {
  font-size: 0.65rem;
  color: var(--ink-dim);
  letter-spacing: 0.3em;
}
