/* ============================================================
   Daptux.ai — Sección DAPTY // SOBRECARGA + lanzamiento al juego
   La sección invita a jugar; el overlay hace la secuencia de
   lanzamiento (~5 s) y termina con un apagado CRT que transiciona
   limpio al juego (mismo fondo #070b14 que usa el arcade).
   Reusa los tokens de intro.css (--neon, --boot-bg, --font-display).
   ============================================================ */

/* ===== Sección en la landing ===== */
.play-section {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(156, 255, 0, .07), transparent 55%),
    linear-gradient(160deg, #020812 0%, #06111f 60%, #0b172a 100%);
  color: #fff;
}

.play-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  padding-top: clamp(30px, 5vw, 60px);
  padding-bottom: clamp(34px, 5vw, 64px);
}

.play-bot {
  width: clamp(76px, 9vw, 112px);
  filter: drop-shadow(0 0 18px rgba(156, 255, 0, .35));
  animation: play-bot-float 2.6s ease-in-out infinite;
}
.play-bot .pixel-bot { width: 100%; margin: 0; display: block; }

@keyframes play-bot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.play-eyebrow {
  color: var(--neon, #9cff00);
  letter-spacing: .32em;
  margin: 0;
}

.play-title {
  margin: 0;
  max-width: 20ch;
  font-family: var(--font-display, "Pixelify Sans", monospace);
  font-size: clamp(2rem, 5.4vw, 4rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: .02em;
  text-transform: uppercase;
  text-shadow: 0 0 26px rgba(156, 255, 0, .22);
}

.play-btn {
  min-width: 220px;
  font-size: 1.05rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  box-shadow: 0 0 0 rgba(156, 255, 0, .55);
  animation: play-btn-pulse 2.2s ease-in-out infinite;
}
.play-btn:hover { animation-play-state: paused; }

@keyframes play-btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(156, 255, 0, .45); }
  55% { box-shadow: 0 0 0 14px rgba(156, 255, 0, 0); }
}

/* Esquinas neón de la sección (marco arcade) */
.play-corner {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 3px solid var(--neon, #9cff00);
  opacity: .8;
}
.play-corner--tl { top: 18px; left: 18px; border-right: 0; border-bottom: 0; }
.play-corner--tr { top: 18px; right: 18px; border-left: 0; border-bottom: 0; }
.play-corner--bl { bottom: 18px; left: 18px; border-right: 0; border-top: 0; }
.play-corner--br { bottom: 18px; right: 18px; border-left: 0; border-top: 0; }

/* ===== La sección en tema claro =====
   La invitación a jugar vive en la página, así que sigue al tema; lo que se
   queda oscuro es el OVERLAY de lanzamiento y el juego, que son la pantalla del
   arcade. El marco de esquinas, el bot y el botón lima se conservan: son lo que
   dice "esto es una máquina recreativa" sin necesidad de fondo negro. */
[data-theme="light"] .play-section {
  background:
    radial-gradient(circle at 50% 20%, rgba(156, 255, 0, .16), transparent 55%),
    linear-gradient(160deg, #ffffff 0%, #f2f6fc 60%, #e9eff7 100%);
  color: var(--text);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
[data-theme="light"] .play-eyebrow { color: var(--accent); }
[data-theme="light"] .play-title {
  color: var(--text-strong);
  text-shadow: none;
}
[data-theme="light"] .play-bot { filter: none; }
[data-theme="light"] .play-corner { border-color: var(--accent-stroke); opacity: 1; }
/* El pulso del botón es un halo lima: sobre papel no ilumina, mancha */
[data-theme="light"] .play-btn { animation: none; box-shadow: var(--shadow-card); }

/* ============================================================
   Overlay de lanzamiento
   Fondo del overlay = fondo del juego (#070b14): cuando la
   "pantalla" se apaga estilo CRT, lo que queda ya es el color
   exacto del arcade y la navegación no produce ningún salto.
   ============================================================ */
.play-launch {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #070b14; /* = PALETTE.bg del juego */
  opacity: 0;
  transition: opacity .18s ease;
}
.play-launch[hidden] { display: none; }
.play-launch.is-on { opacity: 1; }

body.play-locked { overflow: hidden; }

/* La "pantalla" interior: todo lo animado vive aquí (para apagarla al final) */
.play-launch__screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(156, 255, 0, .07), transparent 55%),
    linear-gradient(160deg, #020812 0%, #06111f 60%, #0b172a 100%);
  transform-origin: 50% 50%;
}

.play-launch__warp {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Scanlines suaves (textura arcade) */
.play-launch__scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, .035) 0 1px,
    transparent 1px 4px
  );
  mix-blend-mode: overlay;
}

.play-launch__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  font-family: var(--font-pixel, monospace);
}

/* --- DAPTY: materialización glitch (distinta al vuelo de la intro) --- */
.play-launch__bot {
  position: relative;
  width: clamp(120px, 16vw, 190px);
  opacity: 0;
}
.play-launch__bot .pixel-bot { width: 100%; margin: 0; display: block; }

.is-bot .play-launch__bot {
  animation: play-glitch-in .9s steps(12) forwards;
  filter: drop-shadow(0 0 22px rgba(156, 255, 0, .45));
}

@keyframes play-glitch-in {
  0%   { opacity: 0; clip-path: inset(0 0 100% 0); transform: translate(-6px, 8px); filter: hue-rotate(90deg); }
  18%  { opacity: 1; clip-path: inset(0 0 62% 0); transform: translate(5px, -3px); }
  30%  { clip-path: inset(28% 0 30% 0); transform: translate(-4px, 2px); filter: hue-rotate(-60deg); }
  46%  { clip-path: inset(0 0 34% 0); transform: translate(3px, -2px); }
  62%  { clip-path: inset(12% 0 4% 0); transform: translate(-2px, 1px); filter: none; }
  78%  { clip-path: inset(0); transform: translate(1px, 0); opacity: .65; }
  86%  { opacity: 1; }
  92%  { opacity: .8; }
  100% { opacity: 1; clip-path: inset(0); transform: translate(0, 0); }
}

/* Fase warp: DAPTY vibra con la propulsión y aparece la llama.
   OJO: esta animación reemplaza a play-glitch-in (se pierde su fill forwards),
   así que la opacidad debe fijarse aquí explícitamente. */
.is-warp .play-launch__bot {
  opacity: 1;
  animation: play-shake .16s linear infinite;
  filter: drop-shadow(0 0 26px rgba(156, 255, 0, .55));
}
@keyframes play-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(1.5px, -1px); }
  50% { transform: translate(-1px, 1.5px); }
  75% { transform: translate(1px, 1px); }
  100% { transform: translate(-1.5px, -1px); }
}

.play-launch__flame {
  position: absolute;
  left: 50%;
  top: calc(100% - 6px);
  width: 22%;
  height: 0;
  transform: translateX(-50%);
  border-radius: 0 0 40% 40%;
  background: linear-gradient(to bottom, #fff, var(--neon, #9cff00) 35%, rgba(156, 255, 0, 0));
  filter: blur(1px);
  opacity: 0;
}
.is-warp .play-launch__flame {
  opacity: 1;
  animation: play-flame .14s steps(2) infinite;
  height: clamp(46px, 7vw, 84px);
  transition: height .35s ease;
}
@keyframes play-flame {
  0% { transform: translateX(-50%) scaleY(1); }
  100% { transform: translateX(-50%) scaleY(.72); }
}

/* --- Terminal de tipeo --- */
.play-launch__type {
  margin: 0;
  min-height: 3.2em;
  font-size: clamp(.85rem, 1.6vw, 1.05rem);
  line-height: 1.6;
  color: #d9e2f0;
  text-align: center;
  white-space: pre-wrap;
}
.play-launch__type .neon { color: var(--neon, #9cff00); }
.play-launch__type::after {
  content: "█";
  color: var(--neon, #9cff00);
  animation: play-caret .5s steps(1) infinite;
}
@keyframes play-caret { 50% { opacity: 0; } }

/* --- ¿LISTO? / ¡PURGA LA RED! --- */
.play-launch__ready {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.4);
  font-family: var(--font-display, "Pixelify Sans", monospace);
  font-size: clamp(2.6rem, 9vw, 6.4rem);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--neon, #9cff00);
  text-shadow: 0 0 34px rgba(156, 255, 0, .55);
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
}
.is-ready .play-launch__ready {
  animation: play-ready-pop .42s cubic-bezier(.2, 1.6, .4, 1) forwards;
}
.play-launch__ready.go {
  animation: play-ready-pop .38s cubic-bezier(.2, 1.6, .4, 1) forwards,
             play-ready-flicker .32s steps(2) 2;
}
@keyframes play-ready-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes play-ready-flicker { 50% { opacity: .35; } }

/* En fase READY el bot y el texto se atenúan para dar protagonismo */
.is-ready .play-launch__bot { opacity: .28; }
.is-ready .play-launch__type { opacity: 0; transition: opacity .25s ease; }

/* --- Apagado CRT: la pantalla se colapsa a una línea y a un punto --- */
.is-crt .play-launch__screen {
  animation: play-crt-off .5s cubic-bezier(.7, 0, .95, .4) forwards;
  box-shadow: 0 0 60px rgba(156, 255, 0, .8), 0 0 140px rgba(156, 255, 0, .4);
}
@keyframes play-crt-off {
  0%   { transform: scaleY(1)    scaleX(1);   filter: brightness(1); }
  55%  { transform: scaleY(.006) scaleX(1);   filter: brightness(2.4); }
  78%  { transform: scaleY(.004) scaleX(.35); filter: brightness(3); }
  100% { transform: scaleY(.002) scaleX(0);   filter: brightness(4); }
}

/* Accesibilidad: sin movimiento, el overlay ni aparece (JS navega directo) */
@media (prefers-reduced-motion: reduce) {
  .play-bot, .play-btn { animation: none; }
}
