@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  --magenta:    #ff4dff;
  --cyan:       #00f5ff;
  --teal:       #4ecdc4;
  --teal-dark:  #1a6b66;
  --purple:     #9b30ff;
  --deep-purple:#5b00b5;
  --pink:       #ff9de2;
  --pink-hot:   #f472b6;
  --bg-dark:    #0d0015;
  --bg-mid:     #150025;
  --bg-card:    #1a0030;
  --cabinet-bg: #1e4a47;
  --cabinet-top:#2d1b69;
  --gold:       #ffe600;
  --green-neon: #00ff99;
  --red-neon:   #ff3333;
  --white:      #ffffff;
  --font-pixel: 'Press Start 2P', monospace;

  --glow-magenta: 0 0 8px #ff4dff, 0 0 24px #ff4dff66, 0 0 48px #ff4dff33;
  --glow-cyan:    0 0 8px #00f5ff, 0 0 24px #00f5ff66;
  --glow-teal:    0 0 8px #4ecdc4, 0 0 24px #4ecdc466;
  --glow-purple:  0 0 8px #9b30ff, 0 0 24px #9b30ff66;
  --glow-gold:    0 0 8px #ffe600, 0 0 24px #ffe60066;
  --glow-green:   0 0 8px #00ff99, 0 0 24px #00ff9966;
  --glow-red:     0 0 8px #ff3333, 0 0 24px #ff333366;
  --glow-pink:    0 0 8px #f472b6, 0 0 24px #f472b666;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: var(--font-pixel);
  color: var(--white);
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='4' fill='%23f472b6' opacity='0.9'/%3E%3Ccircle cx='10' cy='10' r='2' fill='%23ffffff'/%3E%3C/svg%3E") 10 10, crosshair;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

canvas {
  display: block;
  position: absolute;
  top: 0; left: 0;
}

#visual-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(13,0,21,0.1) 0%, rgba(13,0,21,0.55) 100%),
    url('assets/fondo_arcade_new.png') center/cover no-repeat,
    radial-gradient(circle at center, #1a003a 0%, #0d0015 72%);
}

#visual-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(155,48,255,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,245,255,0.1) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.5;
  pointer-events: none;
}

#visual-scene::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(13,0,21,0.08) 0%, rgba(13,0,21,0.55) 100%);
  pointer-events: none;
}

#visual-scene.screen-shake {
  animation: screen-shake 0.4s ease;
}

#visual-chibi {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 120px;
  height: 150px;
  object-fit: contain;
  object-position: center bottom;
  transform: translateX(-50%);
  opacity: 0.45;
  z-index: 2;
  filter: drop-shadow(0 0 12px rgba(255,77,255,0.75));
  transition: left 0.45s ease, bottom 0.45s ease, width 0.45s ease, height 0.45s ease, opacity 0.25s ease;
  pointer-events: none;
  user-select: none;
}

#visual-chibi.game-mode {
  left: 82%;
  bottom: 10px;
  width: 170px;
  height: 210px;
  opacity: 1;
  animation: chibi-float 1.8s ease-in-out infinite;
}

#visual-chibi.slide-pulse {
  animation: chibi-slide-pulse 0.42s ease, chibi-float 1.8s ease-in-out 0.42s infinite;
}

@keyframes chibi-float {
  0%,100% { transform: translateX(-50%) translateY(0); }
  50%     { transform: translateX(-50%) translateY(-6px); }
}

@keyframes chibi-slide-pulse {
  0%   { transform: translateX(-38%) scale(0.95); opacity: 0.4; }
  70%  { transform: translateX(-52%) scale(1.04); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ============================================================
   CHECKERED PATTERN (piso del arcade)
   ============================================================ */
.checkered {
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.04) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0px;
}

/* ============================================================
   NEON STRIP (franja decorativa horizontal)
   ============================================================ */
.neon-strip {
  height: 4px;
  background: linear-gradient(90deg, var(--magenta), var(--teal), var(--magenta));
  box-shadow: 0 0 12px var(--magenta), 0 0 30px var(--teal);
  border: none;
}

/* ============================================================
   HUD
   ============================================================ */
#hud {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  z-index: 20;
  pointer-events: none;
}

.hud-neon-bar {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--magenta) 0%, var(--teal) 50%, var(--magenta) 100%);
  box-shadow: 0 0 10px var(--magenta), 0 0 20px var(--teal);
}

.hud-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px 6px;
  background: linear-gradient(180deg, rgba(13,0,21,0.97) 0%, rgba(13,0,21,0.0) 100%);
}

#hud-left, #hud-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}
#hud-right { align-items: flex-end; }

.hud-label {
  font-size: 5px;
  color: var(--pink);
  letter-spacing: 3px;
  text-shadow: var(--glow-pink);
  text-transform: uppercase;
}

/* Barra de vida estilo cabinet */
.bar-container {
  position: relative;
  width: 190px;
  height: 12px;
  background: rgba(0,0,0,0.7);
  border: 1px solid;
  overflow: hidden;
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
}
.bar-container.patience-bar {
  border-color: var(--pink-hot);
  box-shadow: var(--glow-pink);
}
.bar-container.peace-bar {
  border-color: var(--teal);
  box-shadow: var(--glow-teal);
}

.bar-fill {
  height: 100%;
  transition: width 0.4s ease;
  position: relative;
}
.bar-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 3px; height: 100%;
  background: rgba(255,255,255,0.7);
  animation: bar-pulse 1s ease-in-out infinite;
}
@keyframes bar-pulse { 0%,100%{opacity:1} 50%{opacity:0.2} }

.patience-fill {
  background: linear-gradient(90deg, #c40000, #ff4444, #f472b6);
  box-shadow: 0 0 6px #ff3333;
}
.peace-fill {
  background: linear-gradient(90deg, var(--teal-dark), var(--teal), var(--cyan));
  box-shadow: 0 0 6px var(--teal);
}

.bar-text {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  font-size: 6px;
  color: white;
  text-shadow: 0 0 6px black;
  z-index: 1;
}

/* Centro HUD */
.hud-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.hud-wave {
  font-size: 6px;
  color: var(--gold);
  text-shadow: var(--glow-gold);
  letter-spacing: 1px;
}

.hud-combo {
  font-size: 8px;
  color: var(--green-neon);
  text-shadow: var(--glow-green);
  display: none;
}
.hud-combo.active {
  display: block;
  animation: combo-bounce 0.25s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes combo-bounce {
  0%   { transform: scale(1.8) rotate(-3deg); }
  60%  { transform: scale(0.95) rotate(1deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.hud-score {
  font-size: 9px;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: 2px;
}

/* Botón mute arcade */
#mute-btn {
  background: rgba(78,205,196,0.15);
  border: 1px solid var(--teal);
  color: var(--teal);
  font-size: 10px;
  width: 28px; height: 28px;
  cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-teal);
  transition: all 0.15s;
  pointer-events: all;
  flex-shrink: 0;
}
#mute-btn:hover {
  background: rgba(78,205,196,0.3);
  transform: scale(1.1);
}

/* ============================================================
   PANEL ENEMIGO — estilo pantalla de arcade cabinet
   ============================================================ */
#enemy-panel {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, 90vw);
  z-index: 20;
  pointer-events: none;
  display: none;
}

/* Tira superior estilo "ARCADE 1" */
.cabinet-topbar {
  background: linear-gradient(90deg, var(--cabinet-top) 0%, #4a1a9e 50%, var(--cabinet-top) 100%);
  border: 1px solid var(--magenta);
  border-bottom: none;
  padding: 5px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 0 16px var(--magenta), inset 0 0 20px rgba(255,77,255,0.1);
  position: relative;
  overflow: hidden;
}
.cabinet-topbar::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  animation: scan-line 2.5s linear infinite;
}
@keyframes scan-line { 0%{left:-100%} 100%{left:150%} }

.cabinet-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.enemy-avatar {
  font-size: 22px;
  filter: drop-shadow(0 0 6px var(--enemy-color, #ff4dff));
}

.enemy-name {
  font-size: 8px;
  color: var(--enemy-color, #ff4dff);
  text-shadow: 0 0 10px var(--enemy-color, #ff4dff);
  letter-spacing: 1px;
}
.enemy-subtype {
  font-size: 5px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px;
  margin-top: 2px;
}

.enemy-badge {
  font-size: 5px;
  padding: 3px 8px;
  background: var(--enemy-color, #ff4dff);
  color: #0d0015;
  letter-spacing: 1px;
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
  flex-shrink: 0;
}

/* Pantalla CRT del mensaje */
.cabinet-screen {
  background: linear-gradient(180deg, #071a18 0%, #0a2220 100%);
  border: 2px solid var(--teal);
  border-top: 2px solid var(--magenta);
  padding: 14px 18px 16px;
  position: relative;
  min-height: 64px;
  box-shadow:
    0 0 18px var(--teal),
    inset 0 0 40px rgba(78,205,196,0.08);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
#enemy-message-text {
  flex: 1;
  min-width: 0;
}
#enemy-portrait-wrap {
  width: 110px;
  height: 120px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--enemy-color, #ff4dff);
  box-shadow: 0 0 10px var(--enemy-color, #ff4dff);
  background: #0d0015;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}
#enemy-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}
/* Líneas de scanline en la pantalla */
.cabinet-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(78,205,196,0.03) 3px,
    rgba(78,205,196,0.03) 4px
  );
  pointer-events: none;
}

/* Label flotante */
.cabinet-screen::after {
  content: '▶ MENSAJE ENTRANTE';
  position: absolute;
  top: -8px; left: 12px;
  font-size: 5px;
  color: var(--teal);
  background: #071a18;
  padding: 0 6px;
  letter-spacing: 2px;
  text-shadow: var(--glow-teal);
}

#enemy-message-text {
  font-size: 7.5px;
  line-height: 2.1;
  color: #b8f0ec;
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px rgba(78,205,196,0.4);
  position: relative;
  z-index: 1;
}

/* ============================================================
   TIMER
   ============================================================ */
#timer-container {
  position: absolute;
  top: 16%;
  right: 4%;
  z-index: 25;
  pointer-events: none;
  display: none;
}

.timer-ring {
  position: relative;
  width: 72px;
  height: 72px;
}
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring-bg   { fill:none; stroke: #1a3330; stroke-width: 7; }
.timer-ring-fill {
  fill: none;
  stroke: var(--teal);
  stroke-width: 7;
  stroke-linecap: butt;
  stroke-dasharray: 188.5;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
  filter: drop-shadow(0 0 5px var(--teal));
}
.timer-number {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  color: var(--teal);
  text-shadow: var(--glow-teal);
  line-height: 1;
}
.timer-ring.urgent .timer-ring-fill {
  stroke: var(--red-neon);
  filter: drop-shadow(0 0 8px var(--red-neon));
}
.timer-ring.urgent .timer-number {
  color: var(--red-neon);
  animation: timer-panic 0.4s ease-in-out infinite alternate;
}
@keyframes timer-panic {
  from { transform: translate(-50%,-50%) scale(1); }
  to   { transform: translate(-50%,-50%) scale(1.18); }
}

/* ============================================================
   BOTONES DE RESPUESTA — panel de mandos estilo arcade
   ============================================================ */
#options-container {
  position: absolute;
  bottom: 7%;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, 90vw);
  z-index: 20;
  display: none;
  flex-direction: column;
  gap: 7px;
}

#options-label {
  font-size: 6px;
  color: var(--gold);
  text-shadow: var(--glow-gold);
  text-align: center;
  letter-spacing: 3px;
  margin-bottom: 2px;
  animation: blink-label 1s step-end infinite;
}
@keyframes blink-label { 0%,100%{opacity:1} 50%{opacity:0} }

.option-btn {
  background: rgba(7,26,24,0.92);
  border: 1px solid var(--teal);
  border-left: 3px solid var(--pink-hot);
  color: #b8f0ec;
  font-family: var(--font-pixel);
  font-size: 7px;
  padding: 11px 16px 11px 40px;
  text-align: left;
  cursor: pointer;
  line-height: 1.8;
  position: relative;
  overflow: hidden;
  transition: all 0.12s ease;
  pointer-events: all;
  letter-spacing: 0.5px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  box-shadow: inset 0 0 20px rgba(78,205,196,0.05), 0 0 8px rgba(78,205,196,0.15);
}

/* Letra índice [A/B/C] */
.option-btn::before {
  content: attr(data-index);
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: var(--pink-hot);
  text-shadow: var(--glow-pink);
  font-weight: bold;
}

/* Shimmer hover */
.option-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 70px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(244,114,182,0.2), transparent);
  transition: left 0.35s ease;
}

.option-btn:hover {
  border-color: var(--pink-hot);
  border-left-color: var(--magenta);
  color: #fff;
  background: rgba(20,10,30,0.95);
  box-shadow:
    inset 0 0 20px rgba(244,114,182,0.12),
    0 0 14px rgba(244,114,182,0.4),
    0 0 30px rgba(244,114,182,0.15);
  transform: translateX(4px);
}
.option-btn:hover::after { left: 120%; }
.option-btn:active { transform: translateX(4px) scale(0.98); }

.option-btn.glitch { animation: btn-glitch 0.12s linear 3; }
@keyframes btn-glitch {
  0%   { transform: translateX(4px) skewX(0deg); }
  25%  { transform: translateX(-2px) skewX(-4deg); filter: hue-rotate(90deg); clip-path: inset(15% 0 55% 0); }
  50%  { transform: translateX(5px) skewX(4deg);  filter: hue-rotate(-90deg); clip-path: inset(45% 0 15% 0); }
  75%  { transform: translateX(-1px) skewX(0deg); filter: none; clip-path: none; }
  100% { transform: translateX(4px) skewX(0deg); }
}

.option-btn.correct-flash {
  border-color: var(--green-neon);
  border-left-color: var(--green-neon);
  background: rgba(0,255,153,0.12);
  box-shadow: 0 0 20px var(--green-neon), inset 0 0 20px rgba(0,255,153,0.08);
  animation: correct-pulse 0.3s ease;
  pointer-events: none;
  color: var(--green-neon);
}
.option-btn.wrong-flash {
  border-color: var(--red-neon);
  border-left-color: var(--red-neon);
  background: rgba(255,51,51,0.12);
  box-shadow: 0 0 20px var(--red-neon), inset 0 0 20px rgba(255,51,51,0.08);
  animation: wrong-shake 0.35s ease;
  pointer-events: none;
  color: var(--red-neon);
}

@keyframes correct-pulse {
  0%,100% { transform: scale(1) translateX(4px); }
  50%      { transform: scale(1.015) translateX(4px); }
}
@keyframes wrong-shake {
  0%,100% { transform: translateX(4px); }
  25%     { transform: translateX(-5px); }
  75%     { transform: translateX(7px); }
}

/* ============================================================
   REACTION POPUP
   ============================================================ */
#reaction-popup {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 40;
  text-align: center;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: rgba(7,26,24,0.85);
  border: 2px solid var(--teal);
  box-shadow: 0 0 30px var(--teal), inset 0 0 30px rgba(78,205,196,0.05);
  padding: 20px 30px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
}
#reaction-popup.show { transform: translate(-50%, -50%) scale(1); }

.reaction-title {
  font-size: 22px;
  letter-spacing: 3px;
  animation: reaction-flicker 0.1s linear 4;
}
.reaction-title.win  { color: var(--green-neon); text-shadow: var(--glow-green); }
.reaction-title.lose { color: var(--red-neon);   text-shadow: var(--glow-red); }

.reaction-sub {
  font-size: 6.5px;
  color: #b8f0ec;
  letter-spacing: 1px;
  margin-top: 10px;
  line-height: 2;
  max-width: 380px;
}
@keyframes reaction-flicker {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.5; filter: brightness(2.5); }
}

/* ============================================================
   SCREEN EFFECTS
   ============================================================ */
#vhs-overlay {
  position: absolute; inset: 0;
  z-index: 50; pointer-events: none;
  display: none;
  background: rgba(13,0,21,0.75);
}
#vhs-overlay.active { display: block; animation: vhs-glitch 0.1s linear infinite; }
@keyframes vhs-glitch {
  0%   { clip-path: inset(0 0 100% 0); opacity: 0; }
  5%   { clip-path: inset(80% 0 0 0); opacity:1; filter:hue-rotate(90deg) brightness(2); }
  10%  { clip-path: inset(0 0 80% 0); opacity:0.8; }
  15%  { clip-path: inset(40% 0 40% 0); filter:hue-rotate(-90deg); }
  20%  { clip-path: inset(0); filter:none; opacity:1; }
  100% { clip-path: inset(0); opacity:1; }
}

#screen-flash {
  position: absolute; inset: 0;
  z-index: 45; pointer-events: none;
  opacity: 0; transition: opacity 0.05s;
  background: var(--red-neon);
}
#screen-flash.red-flash   { opacity: 0.22; }
#screen-flash.white-flash { opacity: 0.38; background: white; }

/* ============================================================
   SCANLINES + CRT
   ============================================================ */
#scanlines {
  position: absolute; inset: 0;
  z-index: 5; pointer-events: none;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,0.07) 2px, rgba(0,0,0,0.07) 4px
  );
}
#crt-vignette {
  position: absolute; inset: 0;
  z-index: 6; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.75) 100%);
}

/* ============================================================
   WAVE CLEAR
   ============================================================ */
#wave-clear {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40; text-align: center;
  pointer-events: none; display: none;
}
#wave-clear.show {
  display: block;
  animation: wave-clear-in 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes wave-clear-in {
  0%   { transform: translate(-50%, -50%) scale(0) rotate(-8deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}
.wave-clear-title {
  font-size: 18px;
  color: var(--green-neon);
  text-shadow: var(--glow-green), 0 0 60px var(--green-neon);
  letter-spacing: 4px;
  background: rgba(7,26,24,0.85);
  border: 2px solid var(--green-neon);
  padding: 10px 24px 8px;
}
.wave-clear-sub {
  font-size: 7px;
  color: var(--gold);
  text-shadow: var(--glow-gold);
  margin-top: 8px;
  letter-spacing: 2px;
}

/* ============================================================
   PARTICLES
   ============================================================ */
.pixel-particle {
  position: absolute;
  width: 6px; height: 6px;
  pointer-events: none;
  z-index: 35;
  border-radius: 1px;
}

/* ============================================================
   TIMEOUT POPUP
   ============================================================ */
#timeout-popup {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 41; text-align: center;
  pointer-events: none; display: none;
  background: rgba(30,0,0,0.9);
  border: 2px solid var(--red-neon);
  padding: 14px 28px;
  box-shadow: 0 0 30px var(--red-neon);
}
#timeout-popup.show {
  display: block;
  animation: timeout-shake 0.45s ease;
}
@keyframes timeout-shake {
  0%,100% { transform: translate(-50%,-50%) rotate(0deg); }
  20%     { transform: translate(-52%,-50%) rotate(-3deg); }
  40%     { transform: translate(-48%,-50%) rotate(3deg); }
  60%     { transform: translate(-52%,-50%) rotate(-2deg); }
  80%     { transform: translate(-48%,-50%) rotate(2deg); }
}
.timeout-text {
  font-size: 14px;
  color: var(--red-neon);
  text-shadow: var(--glow-red);
}

/* ============================================================
   TITLE SCREEN
   ============================================================ */
#title-screen {
  position: absolute; inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(to bottom, rgba(13,0,21,0.82) 0%, rgba(13,0,21,0.55) 45%, rgba(13,0,21,0.82) 100%),
    url('assets/fondo_victoria.png') center/cover no-repeat;
  pointer-events: all;
}

/* Franja inferior con piso de ajedrez */
#title-screen::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 28%;
  background-image:
    linear-gradient(45deg, rgba(78,205,196,0.07) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(78,205,196,0.07) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(78,205,196,0.07) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(78,205,196,0.07) 75%);
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0px;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  pointer-events: none;
}

.title-logo-img {
  max-width: min(360px, 80vw);
  filter: drop-shadow(0 0 18px #ff4dff) drop-shadow(0 0 36px #9b30ff);
  animation: title-pulse 2.5s ease-in-out infinite;
}
@keyframes title-pulse {
  0%,100% { filter: drop-shadow(0 0 18px #ff4dff) drop-shadow(0 0 36px #9b30ff); }
  50%     { filter: drop-shadow(0 0 30px #ff4dff) drop-shadow(0 0 60px #9b30ff) drop-shadow(0 0 80px #ff4dff); }
}

.title-logo-text {
  font-size: 22px;
  color: var(--magenta);
  text-shadow: 0 0 20px #ff4dff, 0 0 40px #9b30ff, 0 0 80px #ff4dff;
  text-align: center;
  letter-spacing: 4px;
  line-height: 1.8;
  margin-bottom: 4px;
  animation: title-pulse-txt 2.5s ease-in-out infinite;
  -webkit-text-stroke: 1px #ff9de2;
}
@keyframes title-pulse-txt {
  0%,100% { text-shadow: var(--glow-magenta); }
  50%     { text-shadow: 0 0 20px #ff4dff, 0 0 60px #ff4dff, 0 0 100px #9b30ff; }
}

.title-sub {
  font-size: 6px;
  color: var(--teal);
  text-shadow: var(--glow-teal);
  letter-spacing: 3px;
  margin-bottom: 24px;
  text-align: center;
}

/* Botón INSERT COIN estilo botón arcade real */
#start-btn {
  background: radial-gradient(ellipse at 40% 30%, #ff80c8, #c4006a);
  border: 3px solid #ff9de2;
  border-bottom: 5px solid #7a003a;
  border-right: 4px solid #a0004f;
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 8px;
  padding: 14px 32px;
  cursor: pointer;
  letter-spacing: 2px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  box-shadow:
    0 0 20px rgba(255,77,200,0.5),
    0 0 50px rgba(255,77,200,0.25),
    inset 0 2px 6px rgba(255,255,255,0.3);
  border-radius: 50px;
  transition: all 0.1s;
  pointer-events: all;
  margin-top: 4px;
}
#start-btn:hover {
  background: radial-gradient(ellipse at 40% 30%, #ff99d8, #d4007a);
  box-shadow:
    0 0 30px rgba(255,77,200,0.7),
    0 0 70px rgba(255,77,200,0.35),
    inset 0 2px 8px rgba(255,255,255,0.4);
  transform: translateY(-2px);
}
#start-btn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
  border-bottom-color: #5a0028;
}

.insert-coin {
  font-size: 9px;
  color: var(--gold);
  text-shadow: var(--glow-gold);
  letter-spacing: 4px;
  animation: insert-blink 0.75s step-end infinite;
  margin-top: 16px;
}
@keyframes insert-blink { 0%,100%{opacity:1} 50%{opacity:0} }

.title-desc {
  font-size: 5.5px;
  color: rgba(184,240,236,0.75);
  text-align: center;
  line-height: 2.8;
  max-width: 480px;
  margin: 14px 20px 0;
  letter-spacing: 1px;
}

.title-stats {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.title-stat-chip {
  font-size: 5px;
  color: var(--teal);
  font-family: var(--font-pixel);
  letter-spacing: 1px;
  border: 1px solid rgba(78,205,196,0.4);
  padding: 3px 10px;
  background: rgba(78,205,196,0.08);
  box-shadow: 0 0 6px rgba(78,205,196,0.2);
}

/* ============================================================
   ARCADE BUTTON (genérico)
   ============================================================ */
.arcade-btn {
  background: rgba(7,26,24,0.9);
  border: 1px solid var(--teal);
  border-bottom: 3px solid var(--teal-dark);
  color: var(--teal);
  font-family: var(--font-pixel);
  font-size: 7px;
  padding: 10px 22px;
  cursor: pointer;
  letter-spacing: 2px;
  text-shadow: var(--glow-teal);
  box-shadow: 0 0 12px rgba(78,205,196,0.3), inset 0 0 12px rgba(78,205,196,0.05);
  transition: all 0.12s;
  margin: 4px;
  pointer-events: all;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
}
.arcade-btn:hover {
  background: rgba(78,205,196,0.15);
  box-shadow: 0 0 22px rgba(78,205,196,0.5), inset 0 0 20px rgba(78,205,196,0.1);
  color: white;
  transform: scale(1.04);
}
.arcade-btn:active { transform: scale(0.97); }

.arcade-btn.magenta-btn {
  border-color: var(--magenta);
  border-bottom-color: var(--deep-purple);
  color: var(--magenta);
  text-shadow: var(--glow-magenta);
  box-shadow: 0 0 12px rgba(255,77,255,0.3), inset 0 0 12px rgba(255,77,255,0.05);
}
.arcade-btn.magenta-btn:hover {
  background: rgba(255,77,255,0.12);
  box-shadow: 0 0 22px rgba(255,77,255,0.5), inset 0 0 20px rgba(255,77,255,0.08);
  color: white;
}

/* ============================================================
   SCORE CARD
   ============================================================ */
.score-card {
  background: rgba(7,26,24,0.96);
  border: 1px solid var(--teal);
  border-top: 3px solid var(--magenta);
  box-shadow: 0 0 24px rgba(78,205,196,0.3), 0 0 50px rgba(78,205,196,0.1);
  padding: 14px 22px;
  margin: 10px 0;
  width: min(360px, 82vw);
  text-align: center;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
}
.score-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(78,205,196,0.15);
  font-size: 6.5px;
}
.score-card-row:last-child { border-bottom: none; }
.score-label { color: var(--pink); }
.score-value { color: var(--teal); text-shadow: var(--glow-teal); }

/* ============================================================
   GAME OVER SCREEN
   ============================================================ */
#gameover-screen {
  position: absolute; inset: 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10,0,0,0.96);
  pointer-events: all;
}
#gameover-screen.active {
  display: flex;
  animation: gameover-in 0.5s ease;
}
@keyframes gameover-in {
  0%   { filter: brightness(4) hue-rotate(180deg); }
  30%  { filter: brightness(0.4) hue-rotate(-90deg); }
  60%  { filter: brightness(3) hue-rotate(45deg); }
  100% { filter: none; }
}

.gameover-title {
  font-size: 20px;
  color: var(--red-neon);
  text-shadow: var(--glow-red);
  letter-spacing: 6px;
  margin-bottom: 8px;
  animation: glitch-text 3s linear infinite;
}
@keyframes glitch-text {
  0%,88%,100% { text-shadow: var(--glow-red); transform: none; }
  89% { text-shadow: 3px 0 var(--cyan), -3px 0 var(--magenta); transform: skewX(-6deg); }
  90% { text-shadow: -3px 0 var(--cyan), 3px 0 var(--magenta); transform: skewX(6deg); }
  91% { text-shadow: var(--glow-red); transform: none; }
  94% { text-shadow: 2px 0 var(--magenta), -2px 0 var(--cyan); transform: skewX(-2deg); }
  96% { text-shadow: var(--glow-red); transform: none; }
}
.gameover-sub {
  font-size: 7px;
  color: var(--pink);
  margin: 6px 0 20px;
  letter-spacing: 2px;
  text-align: center;
  line-height: 2.8;
}

/* ============================================================
   VICTORY SCREEN
   ============================================================ */
#victory-screen {
  position: absolute; inset: 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5,15,13,0.95);
  pointer-events: all;
}
#victory-screen.active {
  display: flex;
  animation: victory-in 0.6s ease;
}
@keyframes victory-in {
  0%   { filter: brightness(5) saturate(3); transform: scale(0.94); }
  50%  { filter: brightness(1.5) saturate(1.5); transform: scale(1.02); }
  100% { filter: none; transform: scale(1); }
}
.victory-title {
  font-size: 14px;
  color: var(--gold);
  text-shadow: var(--glow-gold);
  letter-spacing: 3px;
  text-align: center;
  line-height: 2.2;
  animation: victory-rainbow 3s linear infinite;
}
@keyframes victory-rainbow {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}
.victory-sub {
  font-size: 6.5px;
  color: var(--teal);
  text-shadow: var(--glow-teal);
  text-align: center;
  margin: 10px 0 18px;
  line-height: 2.8;
  letter-spacing: 1px;
  max-width: 480px;
  padding: 0 20px;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 600px) {
  .title-logo-text { font-size: 9px; }
  .insert-coin { font-size: 7px; }
  .bar-container { width: 130px; }
  #enemy-panel { top: 10%; }
  .enemy-name { font-size: 7px; }
  #enemy-message-text { font-size: 6.5px; }
  .option-btn { font-size: 6px; padding: 9px 10px 9px 34px; }
  .hud-score { font-size: 8px; }
  .reaction-title { font-size: 15px; }
  #start-btn { font-size: 7px; padding: 12px 24px; }
}
@media (max-width: 400px) {
  .hud-inner { padding: 6px 8px 4px; }
  .bar-container { width: 100px; }
  .hud-label { font-size: 4px; }
}
