/* =========================================
   HERO: Pantalla de título del juego
   Título glitch + TV flotante + deco dispersa
   ========================================= */

.hero {
  align-items: center;
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  margin-bottom: 30px;
  min-height: min(56vh, 620px);
  padding: 30px 0 10px;
  position: relative;
}

/* El contenedor de deco no es celda del grid;
   sus hijos se posicionan sobre el hero entero */
.hero-deco {
  display: contents;
}

@media (min-width: 1000px) {
  .hero {
    grid-template-columns: 44px 1.4fr 1fr 44px;
  }
}

.hero-vert {
  display: none;
}

@media (min-width: 1000px) {
  .hero-vert {
    display: block;
  }
  .hero-vert.right {
    justify-self: end;
    transform: rotate(180deg);
  }
}

.hero-core {
  position: relative;
  text-align: center;
  /* Parallax inverso sutil */
  transform: translate(calc(var(--mx, 0) * -12px), calc(var(--my, 0) * -8px));
  z-index: 2;
}

/* --- SECUENCIA DE ARRANQUE (js/boot.js) --- */
/* La consola de boot ocupa el lugar del título mientras carga */
.boot-screen {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  inset: 0;
  justify-content: center;
  margin: 0 auto;
  max-width: 480px;
  position: absolute;
  text-align: left;
}

.boot-screen[hidden] {
  display: none;
}

.hero-title.pre-boot {
  visibility: hidden;
}

.hero-title.boot-reveal {
  animation: boot-reveal 0.7s ease;
}

@keyframes boot-reveal {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Contacto en el hero: visible de entrada, nivel portafolio */
.hero-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

/* --- PLAYER_DATA: HUD por segmentos sobre el monitor --- */
.hero-tv { cursor: pointer; }

/* Hover = rota la foto (lo hace js/monitor.js).
   Clic = abre el HUD por segmentos (.hud-open) para interactuar. */
.tv-hud {
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 4;
}

.hero-tv.hud-open .tv-hud {
  pointer-events: auto;
}

.tv-seg {
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  background-color: rgba(9, 6, 18, 0.94);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 12px rgba(var(--rgb-cyan), 0.45);
  clip-path: var(--clip-chip);
  opacity: 0;
  position: absolute;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.hero-tv.hud-open .tv-seg {
  opacity: 1;
  transform: none;
}

.hero-tv.hud-open .tv-seg:nth-child(2) { transition-delay: 0.05s; }
.hero-tv.hud-open .tv-seg:nth-child(3) { transition-delay: 0.1s; }

/* Botón de cerrar el HUD */
.tv-hud-close {
  background-color: var(--neon-pink);
  border: none;
  clip-path: var(--clip-chip);
  color: var(--void);
  cursor: pointer;
  font-family: var(--font-hud);
  font-size: 0.5rem;
  opacity: 0;
  padding: 5px 8px;
  position: absolute;
  right: -4%;
  top: -4%;
  transition: opacity 0.22s ease;
  z-index: 5;
}

.hero-tv.hud-open .tv-hud-close {
  opacity: 1;
}

/* Segmento NOMBRE: arriba, cruzando el borde superior */
.tv-seg--name {
  align-items: baseline;
  border-color: var(--neon-pink);
  box-shadow: 0 0 12px rgba(var(--rgb-pink), 0.45);
  display: flex;
  gap: 8px;
  left: -6%;
  padding: 7px 12px;
  top: -4%;
}

.tv-seg-k {
  color: var(--pastel-pink);
  font-family: var(--font-hud);
  font-size: 0.42rem;
}

/* El nombre es un botón: cambia la foto al pulsarlo */
.tv-seg-name {
  background: none;
  border: none;
  border-bottom: 1px dashed rgba(var(--rgb-pink), 0.7);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-hud);
  font-size: 0.7rem;
  padding: 0 0 1px;
  text-shadow: 0 0 8px rgba(var(--rgb-pink), 0.6);
}

.tv-seg-name:hover {
  color: var(--pastel-pink);
}

.tv-seg-lv {
  color: var(--pastel-yellow);
  font-family: var(--font-hud);
  font-size: 0.5rem;
}

/* Segmento BARRAS: a la izquierda, cluster de recursos */
.tv-seg--bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  left: -14%;
  padding: 10px;
  top: 30%;
  width: 116px;
}

.tv-bar-row {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 26px 1fr;
}

.tv-bar-row > span:first-child {
  color: var(--text-dim);
  font-family: var(--font-hud);
  font-size: 0.42rem;
}

.tv-bar-row .stat-bar {
  height: 10px;
  margin: 0;
}

/* Barras editables: se arrastran para cambiar el valor */
.stat-bar.editable {
  cursor: ew-resize;
}

.stat-bar.editable:hover {
  box-shadow: 0 0 8px rgba(var(--bar), 0.7);
}

/* Segmento META: abajo, datos rápidos + créditos */
.tv-seg--meta {
  border-color: var(--neon-purple);
  bottom: -2%;
  box-shadow: 0 0 12px rgba(var(--rgb-purple), 0.4);
  left: 8%;
  padding: 8px 12px;
  right: 8%;
}

.tv-seg--meta p {
  color: var(--text-dim);
  font-family: var(--font-pixel);
  font-size: 0.95rem;
  margin: 0 0 2px;
}

/* Fila de acciones del HUD: monedas + ampliar */
.tv-seg-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 4px;
}

.tv-seg--meta .hud-credits {
  cursor: pointer;
  font-size: 0.6rem;
}

.tv-seg--meta .hud-credits:hover {
  color: var(--pastel-yellow);
}

.tv-enlarge {
  background: none;
  border: 1px solid rgba(var(--rgb-cyan), 0.6);
  color: var(--pastel-cyan);
  cursor: pointer;
  font-family: var(--font-hud);
  font-size: 0.45rem;
  padding: 4px 7px;
}

.tv-enlarge:hover {
  background-color: var(--neon-cyan);
  color: var(--void);
}

/* Pista de interacción */
.tv-hint {
  animation: blink 1.6s step-end infinite;
  bottom: -8%;
  color: var(--pastel-cyan);
  font-family: var(--font-hud);
  font-size: 0.42rem;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 3;
}

.hero-tv.hud-open .tv-hint {
  opacity: 0;
}

/* En pantallas chicas los segmentos no se salen tanto */
@media (max-width: 999px) {
  .tv-seg--name { left: 0; }
  .tv-seg--bars { left: 0; }
  .tv-seg--bars { top: 24%; }
}

.hero-pre {
  color: var(--text-dim);
  font-family: var(--font-hud);
  font-size: 0.6rem;
  letter-spacing: 3px;
  margin: 0 0 18px;
  text-transform: uppercase;
}

/* Título con glitch de señal corrupta */
.glitch {
  color: var(--text);
  font-family: var(--font-hud);
  font-size: clamp(1.8rem, 6vw, 4rem);
  letter-spacing: 4px;
  line-height: 1.1;
  margin: 0;
  position: relative;
  text-shadow:
    3px 3px 0 rgba(var(--rgb-pink), 0.65),
    -3px -3px 0 rgba(var(--rgb-cyan), 0.55);
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  inset: 0;
  position: absolute;
}

.glitch::before {
  animation: glitch-slice-a 3.1s infinite steps(1, end);
  color: var(--neon-cyan);
  opacity: 0.8;
}

.glitch::after {
  animation: glitch-slice-b 2.3s infinite steps(1, end);
  color: var(--neon-pink);
  opacity: 0.8;
}

@keyframes glitch-slice-a {
  0%, 88%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
  90% { clip-path: inset(8% 0 64% 0); transform: translateX(-5px); }
  94% { clip-path: inset(48% 0 30% 0); transform: translateX(4px); }
}

@keyframes glitch-slice-b {
  0%, 78%, 100% { clip-path: inset(100% 0 0 0); transform: none; }
  80% { clip-path: inset(64% 0 12% 0); transform: translateX(5px); }
  85% { clip-path: inset(22% 0 58% 0); transform: translateX(-4px); }
}

.hero-sub {
  color: var(--pastel-purple);
  font-family: var(--font-pixel);
  font-size: 1.4rem;
  letter-spacing: 3px;
  margin: 16px 0 26px;
}

.hero-sub b {
  color: var(--pastel-pink);
  font-weight: normal;
}

/* La TV flota inclinada, saliéndose del hero */
.hero-tv {
  justify-self: center;
  margin: 0;
  max-width: 340px;
  position: relative;
  transform: rotate(2.5deg) translate(calc(var(--mx, 0) * 14px), calc(var(--my, 0) * 10px));
  width: 100%;
  z-index: 2;
}

@media (min-width: 1000px) {
  .hero-tv {
    margin-bottom: -70px;
  }
}

/* Botón invisible sobre el sticker del sol de la TV 🌇 */
.sun-secret {
  background: transparent;
  border: none;
  cursor: pointer;
  height: 14%;
  position: absolute;
  right: 2%;
  top: 0;
  width: 14%;
  z-index: 4;
}

.sun-secret:focus-visible {
  outline: 2px dashed var(--neon-yellow);
}

/* Decoración dispersa flotando por el hero */
.hero-deco i {
  animation: deco-float 5s ease-in-out infinite;
  font-style: normal;
  pointer-events: none;
  position: absolute;
  z-index: 1;
}

.hero-deco i:nth-child(1) { color: var(--neon-pink);   font-size: 1.3rem; left: 6%;  top: 12%; }
.hero-deco i:nth-child(2) { color: var(--pastel-cyan); font-size: 0.9rem; left: 17%; top: 72%; animation-delay: -1.2s; }
.hero-deco i:nth-child(3) { color: var(--neon-purple); font-size: 1.1rem; right: 8%; top: 18%; animation-delay: -2.4s; }
.hero-deco i:nth-child(4) { color: var(--pastel-yellow); font-size: 0.8rem; right: 20%; top: 64%; animation-delay: -3.1s; }
.hero-deco i:nth-child(5) { color: var(--pastel-pink); font-size: 1rem;  left: 38%; top: 6%;  animation-delay: -1.8s; }

@keyframes deco-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.hero-version {
  bottom: 4px;
  color: var(--text-dim);
  font-family: var(--font-hud);
  font-size: 0.5rem;
  letter-spacing: 2px;
  position: absolute;
  right: 0;
}
