:root {
  --bg: #07060d;
  --fg: #ece9ff;
  --muted: #8f8aa8;
  --cyan: #3ef2ff;
  --pink: #ff3ea5;
  --amber: #ffb547;
  --panel: rgba(14, 12, 26, 0.62);
  --border: rgba(158, 140, 255, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Space Grotesk", system-ui, sans-serif;
  overflow: hidden;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.03) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

.hud {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 24px;
  padding: clamp(16px, 4vw, 48px);
  max-width: 1100px;
  margin: 0 auto;
  pointer-events: none;
}

.hud a, .hud button { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  letter-spacing: 0.04em;
}
.brand__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  animation: pulse 1.8s ease-in-out infinite;
}
.accent { color: var(--pink); }

.hero { align-self: end; }
.eyebrow {
  margin: 0 0 8px;
  font-family: "JetBrains Mono", monospace;
  color: var(--amber);
  font-size: 13px;
}
.title {
  margin: 0;
  font-size: clamp(44px, 9vw, 112px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-shadow: 0 0 24px rgba(62, 242, 255, 0.35);
}
.subtitle {
  margin: 14px 0 0;
  max-width: 36ch;
  color: var(--muted);
  font-size: clamp(15px, 2vw, 19px);
}

.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  opacity: 0.8;
}
.glitch::before { color: var(--pink); transform: translate(2px, 0); clip-path: inset(0 0 60% 0); animation: glitch 3.2s infinite steps(1); }
.glitch::after  { color: var(--cyan); transform: translate(-2px, 0); clip-path: inset(55% 0 0 0); animation: glitch 2.7s infinite steps(1) reverse; }

.terminal {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  overflow: hidden;
}
.terminal__bar {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.terminal__bar span { width: 11px; height: 11px; border-radius: 50%; background: #3a3550; }
.terminal__bar span:nth-child(1) { background: #ff5f57; }
.terminal__bar span:nth-child(2) { background: #febc2e; }
.terminal__bar span:nth-child(3) { background: #28c840; }
.terminal__bar em {
  margin-left: auto; font-style: normal;
  font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--muted);
}
.terminal__body {
  margin: 0;
  padding: 16px 18px 20px;
  min-height: 168px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: #d9d4ff;
}
.terminal__body .p { color: var(--cyan); }
.terminal__body .ok { color: #7dffa8; }
.terminal__body .hl { color: var(--pink); }
.cursor {
  display: inline-block; width: 8px; height: 1.05em;
  background: var(--cyan); vertical-align: -2px;
  animation: blink 1s steps(1) infinite;
}

.controls { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--pink);
  background: rgba(255, 62, 165, 0.12);
  color: var(--fg);
  font: 600 14px "JetBrains Mono", monospace;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 24px rgba(255, 62, 165, 0.35); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.btn[aria-pressed="true"] { background: var(--pink); color: #12000a; }
.btn--ghost { border-color: var(--border); background: transparent; }

/* Barra de Spotify: aparece al activar el modo bachata. */
.spotify {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 32px);
  z-index: 2;
  width: min(360px, calc(100vw - 32px));
  border-radius: 14px;
  box-shadow: 0 0 32px rgba(255, 62, 165, 0.3);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
.spotify.is-on { opacity: 1; transform: none; pointer-events: auto; }
.spotify iframe { display: block; border-radius: 12px; }

@media (max-width: 640px) {
  .spotify { left: 16px; right: 16px; width: auto; top: 56px; bottom: auto; transform: translateY(-16px); }
}

.noscript { position: fixed; bottom: 16px; left: 16px; color: var(--muted); }

@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes glitch {
  0%, 92%, 100% { transform: translate(0, 0); }
  93% { transform: translate(3px, -1px); }
  95% { transform: translate(-3px, 1px); }
  97% { transform: translate(2px, 1px); }
}

@media (max-width: 640px) {
  .hud { grid-template-rows: auto 1fr auto auto; gap: 18px; }
  .terminal__body { min-height: 150px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .glitch::before, .glitch::after, .brand__dot, .cursor { animation: none; }
}
