:root {
  /* palette lifted from alyxrbytes.pro */
  --v: #b44fff;
  --v2: #7b00d4;
  --v3: #e0aaff;
  --g: #00ff8c;
  --g2: #00c96d;
  --g3: #aaffd8;
  --bg: #06060a;
  --bg2: #0d0d14;
  --bg3: #12121c;
  --dim: #2a2a3a;
  --muted: #555570;
  --text: #c8c8e0;
  --danger: #ff3355;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  overflow: hidden;
  cursor: crosshair;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
}

/* ── SCANLINES ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  pointer-events: none;
  z-index: 9000;
}

/* ── VIGNETTE ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.75) 100%);
  pointer-events: none;
  z-index: 9001;
}

/* ── NOISE ── */
.noise {
  position: fixed;
  inset: 0;
  opacity: 0.035;
  pointer-events: none;
  z-index: 9002;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ── GRID BG ── */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(180, 79, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180, 79, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 1;
}

/* ── HEADER ── */
#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 1.5rem 1.75rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--dim);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 6, 10, 0.7), transparent);
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: 0.04em;
  line-height: 0.9;
  color: #fff;
  position: relative;
  display: inline-block;
}
.logo .v { color: var(--v); }

.logo-glitch { position: relative; }
.logo-glitch::before,
.logo-glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  opacity: 0;
}
.logo-glitch::before { color: var(--v); animation: glitch-1 8s infinite; }
.logo-glitch::after { color: var(--g); animation: glitch-2 8s infinite; }

@keyframes glitch-1 {
  0%, 94%, 100% { opacity: 0; transform: none; }
  95% { opacity: 0.7; transform: translate(-3px, 1px) skewX(-5deg); clip-path: polygon(0 20%, 100% 20%, 100% 45%, 0 45%); }
  97% { opacity: 0; }
}
@keyframes glitch-2 {
  0%, 94%, 100% { opacity: 0; transform: none; }
  96% { opacity: 0.5; transform: translate(3px, -1px) skewX(3deg); clip-path: polygon(0 55%, 100% 55%, 100% 80%, 0 80%); }
  98% { opacity: 0; }
}

.tagline {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.3rem;
}
.tagline .dot { color: var(--v); }

.header-right { text-align: right; padding-top: 0.3rem; }

.status-line {
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  margin-bottom: 0.25rem;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g);
  margin-right: 6px;
  vertical-align: middle;
  animation: pulse-ll 2.8s ease-in-out infinite;
  position: relative;
}
.status-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--g);
  animation: ping 2.8s ease-in-out infinite;
  opacity: 0;
}
@keyframes pulse-ll {
  0%, 8% { opacity: 1; }
  9%, 35% { opacity: 0.2; }
  36%, 62% { opacity: 1; }
  63%, 89% { opacity: 0.2; }
  90%, 100% { opacity: 1; }
}
@keyframes ping {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ── HUD ── */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: 18px;
  padding-top: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 6;
}

.panel {
  pointer-events: auto;
  background: rgba(13, 13, 20, 0.78);
  border: 1px solid var(--dim);
  border-radius: 2px;
  padding: 14px 16px;
  backdrop-filter: blur(6px);
  max-width: 360px;
  font-size: 12.5px;
}

#top-left-stack {
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  gap: 0;
}
#stats-panel { align-self: flex-start; }

.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  font-variant-numeric: tabular-nums;
}

.label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
}

.row:not(.phase) span:last-child { color: var(--g3); }

.section-label {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--dim);
}
.section-label:first-child { margin-top: 0; padding-top: 0; border-top: none; }

#dimension-panel {
  align-self: flex-start;
  margin-top: 10px;
}
#dimension-panel button {
  margin-top: 8px;
  width: 100%;
}

.phase {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--dim);
  color: var(--v3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

#controls-panel {
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

button {
  pointer-events: auto;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--dim);
  border-radius: 2px;
  padding: 9px 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: crosshair;
  transition: border-color 0.15s, color 0.15s;
}
button:hover { border-color: var(--v); color: var(--v3); }
button:active { transform: translateY(1px); }

.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.slider-row input {
  flex: 1;
  accent-color: var(--v);
}

.hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12.5px;
  line-height: 1.55;
}

#flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 9500;
}
#flash.hit {
  transition: opacity 0.08s ease-out;
  opacity: 1;
}
#flash.fade {
  transition: opacity 1.1s ease-in;
  opacity: 0;
}

#transition-text .line {
  display: block;
  opacity: 0;
  transform: translateY(6px);
  animation: line-in 0.5s ease forwards;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g3);
  margin-bottom: 10px;
}
@keyframes line-in {
  to { opacity: 1; transform: translateY(0); }
}

#transition {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.4s ease;
  z-index: 10;
}

#transition.visible {
  opacity: 1;
  pointer-events: auto;
}

#transition.hidden { display: flex; }

#transition-text {
  max-width: 640px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  line-height: 1.8;
  color: var(--v3);
  text-shadow: 0 0 24px rgba(180, 79, 255, 0.55);
}

@media (max-width: 640px) {
  #site-header { flex-direction: column; gap: 8px; }
  .header-right { text-align: left; }
  .panel { max-width: none; }
}
