/* SINGULARITY — neon magenta & cyan on true black, futuristic wide sans */

@font-face {
  font-family: 'Orbitron';
  src: url('../assets/fonts/orbitron.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --magenta: #ff19c8;
  --cyan: #19f0ff;
  --ink: #000;
  --glass: rgba(8, 10, 18, 0.55);
  --edge: rgba(25, 240, 255, 0.22);
  --text: #e8f6ff;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: 'Orbitron', 'Eurostile', 'Bank Gothic', 'Arial Black', sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

/* ---------- chrome (dissolves during playback) ---------- */
.chrome {
  position: fixed;
  z-index: 10;
  transition: opacity 0.9s ease, transform 0.9s ease;
}
body.idle .chrome {
  opacity: 0;
  pointer-events: none;
}
body.idle #masthead { transform: translateY(-8px); }
body.idle #chrome { transform: translateY(10px); }

#masthead {
  top: max(18px, env(safe-area-inset-top));
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  pointer-events: none;
}
.wordmark {
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.55em;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(25, 240, 255, 0.55);
}
#section-name {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--magenta);
  text-shadow: 0 0 12px rgba(255, 25, 200, 0.6);
}
#section-name.flash { animation: secflash 1.6s ease; }
@keyframes secflash {
  0% { opacity: 0; transform: translateX(12px); }
  18% { opacity: 1; text-shadow: 0 0 22px rgba(255, 25, 200, 1); }
  100% { opacity: 0.85; transform: none; }
}

/* ---------- entry overlay ---------- */
#entry {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.78) 100%);
  backdrop-filter: blur(2px);
}
#entry[hidden] { display: none; }
.entry-inner { text-align: center; padding: 24px; }
#entry h1 {
  font-weight: 900;
  font-size: clamp(34px, 7vw, 84px);
  letter-spacing: 0.34em;
  margin-left: 0.34em; /* optical centering against tracking */
  background: linear-gradient(100deg, var(--cyan) 15%, #fff 48%, var(--magenta) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(255, 25, 200, 0.35));
  animation: titlepulse 3.2s ease-in-out infinite;
}
@keyframes titlepulse {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(25, 240, 255, 0.30)); }
  50% { filter: drop-shadow(0 0 34px rgba(255, 25, 200, 0.55)); }
}
.tag {
  margin-top: 18px;
  font-size: 11px;
  letter-spacing: 0.32em;
  color: rgba(232, 246, 255, 0.72);
  text-transform: uppercase;
}
#begin {
  margin-top: 40px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4em;
  padding: 16px 42px 16px 48px;
  color: var(--cyan);
  background: rgba(25, 240, 255, 0.06);
  border: 1px solid rgba(25, 240, 255, 0.55);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-shadow: 0 0 10px rgba(25, 240, 255, 0.8);
  box-shadow: 0 0 24px rgba(25, 240, 255, 0.15), inset 0 0 18px rgba(25, 240, 255, 0.06);
}
#begin:hover, #begin:focus-visible {
  color: #000;
  background: var(--cyan);
  box-shadow: 0 0 44px rgba(25, 240, 255, 0.65);
  text-shadow: none;
  outline: none;
}
#entry.replay #begin { color: var(--magenta); border-color: rgba(255, 25, 200, 0.55); }
.hint {
  margin-top: 26px;
  font-size: 9px;
  letter-spacing: 0.28em;
  color: rgba(232, 246, 255, 0.38);
  text-transform: uppercase;
}

/* ---------- transport bar ---------- */
#chrome {
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(860px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 25, 200, 0.06);
}
body.idle #chrome { transform: translateX(-50%) translateY(10px); }

.transport { display: flex; align-items: center; gap: 12px; }
.transport button, .controls button {
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid rgba(232, 246, 255, 0.18);
  border-radius: 10px;
  min-width: 42px;
  min-height: 42px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.transport button:hover, .controls button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 16px rgba(25, 240, 255, 0.25);
}

#seek {
  position: relative;
  flex: 1;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
}
#seek::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  background: rgba(232, 246, 255, 0.14);
  border-radius: 2px;
}
#seek i {
  position: absolute;
  top: 50%;
  width: 1px;
  height: 9px;
  transform: translateY(-50%);
  background: rgba(232, 246, 255, 0.30);
  pointer-events: none;
}
#seek-fill {
  position: absolute;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(255, 25, 200, 0.55);
  pointer-events: none;
}
#seek-head {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 12px var(--magenta), 0 0 4px var(--cyan);
  pointer-events: none;
}
#time {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(232, 246, 255, 0.66);
  white-space: nowrap;
  min-width: 86px;
  text-align: right;
}

.controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#presets { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 9px !important;
  letter-spacing: 0.22em;
  min-height: 34px !important;
  padding: 6px 14px !important;
  border-radius: 999px !important;
}
.chip.on {
  border-color: var(--magenta) !important;
  color: var(--magenta) !important;
  box-shadow: 0 0 16px rgba(255, 25, 200, 0.35) !important;
  text-shadow: 0 0 8px rgba(255, 25, 200, 0.8);
}
#quality {
  font-size: 9px;
  letter-spacing: 0.22em;
  border-radius: 999px;
}
#quality.on {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(25, 240, 255, 0.25);
}

/* ---------- error ---------- */
#webgl-error {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
  background: #000;
}
#webgl-error[hidden] { display: none; }
#webgl-error h1 { letter-spacing: 0.34em; color: var(--magenta); }
#webgl-error p { font-size: 12px; letter-spacing: 0.12em; color: rgba(232,246,255,0.7); max-width: 46ch; line-height: 1.8; }

/* ---------- small viewports ---------- */
@media (max-width: 640px) {
  #masthead { left: 16px; right: 16px; }
  .wordmark { font-size: 11px; letter-spacing: 0.4em; }
  #chrome { padding: 12px; gap: 10px; border-radius: 14px; }
  .transport { gap: 8px; }
  .transport button { min-width: 44px; min-height: 44px; }
  #time { display: none; }
  .controls { flex-direction: column; align-items: stretch; }
  #presets { justify-content: center; }
  #quality { align-self: center; }
  #seek { height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  #entry h1 { animation: none; }
  #section-name.flash { animation: none; }
}
