:root {
  --bg: #010805;
  --fg: #baffc9;
  --dim: #3f8a5a;
  --accent: #39ff6a;
  --glow: 0 0 4px rgba(57, 255, 106, 0.55), 0 0 12px rgba(57, 255, 106, 0.25);
  --font-dos: 'VT323', ui-monospace, 'SF Mono', 'Courier New', monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); }
body {
  font-family: var(--font-dos);
  color: var(--fg);
  font-size: 22px;
  line-height: 1.5;
  text-shadow: var(--glow);
  letter-spacing: 0.02em;
}
a { color: var(--accent); }
a:hover { color: var(--fg); }
.hidden { display: none !important; }

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

/* CRT scanline overlay over the whole DOM layer */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 30; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 1px, rgba(0,0,0,0.18) 2px, rgba(0,0,0,0) 3px
  );
  mix-blend-mode: multiply;
}

#cookie-gate {
  position: fixed; inset: 0; z-index: 15;
  background: rgba(1, 8, 5, 0.96);
  display: flex; align-items: safe center; justify-content: safe center;
  padding: 6vh 6vw; overflow-y: auto;
}
.consent-panel {
  border: 1px solid var(--dim); padding: 1.4em 1.6em; max-width: 60ch;
}
#cookie-boot {
  font-size: 0.85em; color: var(--dim); margin-bottom: 1em;
  min-height: 5.5em; white-space: pre-wrap;
}
.consent-copy { max-width: 56ch; margin-bottom: 1.4em; }
.consent-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1em 1.6em;
}
.privacy-link { font-size: 0.95em; text-decoration: none; border-bottom: 1px solid currentColor; }

#welcome {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(1, 8, 5, 0.92);
  display: flex; flex-direction: column; justify-content: safe center;
  padding: 6vh 6vw;
  overflow-y: auto;
}
#welcome h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  letter-spacing: 0.08em;
  margin-bottom: 1em;
}
#welcome p { max-width: 60ch; margin-bottom: 1em; }
#welcome .bio { color: var(--dim); }
#welcome .credit { font-size: 0.85em; color: var(--dim); }

.links {
  display: flex; flex-wrap: wrap; gap: 0.4em 1.2em;
  margin-bottom: 1.6em;
}
.links a { text-decoration: none; border-bottom: 1px solid currentColor; }

.capability {
  color: var(--dim);
  font-size: 0.9em;
  margin-bottom: 1em;
}

#mode-select {
  display: flex; flex-direction: column; gap: 0.6em;
  margin-bottom: 1.6em;
}
#mode-select button {
  font-family: inherit; font-size: 1.05em;
  background: rgba(1,15,9,0.5); color: var(--fg);
  border: 2px solid var(--dim);
  border-radius: 3px;
  padding: 0.6em 1.1em;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.15em;
  text-align: left;
}
#mode-select button:hover { border-color: var(--accent); }
#mode-select button.selected {
  color: var(--bg); background: var(--accent); border-color: var(--accent);
}
#mode-select button.selected .mode-legend { color: rgba(1,8,5,0.75); }

.btn-enter {
  font-family: inherit; font-size: 1.3em;
  background: transparent; color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 3px;
  padding: 0.6em 1.6em;
  cursor: pointer;
}
.btn-enter:hover { background: var(--accent); color: var(--bg); }

#touch-hint {
  position: fixed; left: 50%; top: 6vh; transform: translateX(-50%) translateY(-6px);
  z-index: 8; max-width: 80vw; text-align: center;
  font-size: 1em; letter-spacing: 0.03em; color: var(--fg);
  background: rgba(1,12,7,0.85); border: 2px solid rgba(186,255,201,0.45);
  padding: 0.6em 1.2em; opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#touch-hint.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.toast {
  position: fixed; left: 50%; bottom: 6vh; transform: translateX(-50%) translateY(6px);
  z-index: 9; font-size: 1em; color: var(--fg);
  background: rgba(1,12,7,0.9); border: 2px solid var(--dim);
  padding: 0.6em 1.2em; opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.mode-legend { display: block; font-size: 0.85em; color: var(--dim); margin-top: 0.3em; letter-spacing: 0.02em; }

.btn-mute {
  position: fixed; right: 1.2em; bottom: 1.2em; z-index: 8;
  font-family: inherit; font-size: 1.4em;
  background: rgba(1,12,7,0.85); color: var(--fg);
  border: 2px solid var(--dim); border-radius: 50%;
  width: 2em; height: 2em; cursor: pointer;
}
.btn-mute.muted { color: var(--dim); }

#boot-sequence {
  font-size: 0.85em; color: var(--dim); margin-bottom: 1em;
  min-height: 6.5em; white-space: pre-wrap;
}
#boot-sequence .cursor {
  display: inline-block; width: 0.55em; background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.credits-panel {
  border: 1px solid var(--dim); padding: 1em 1.2em; margin-bottom: 1.6em; max-width: 60ch;
}
.credits-panel h2 {
  font-size: 0.75em; letter-spacing: 0.16em; color: var(--dim);
  margin-bottom: 0.8em; text-transform: uppercase;
}
.credits-panel .artist { margin-bottom: 1em; }
.credits-panel .artist:last-child { margin-bottom: 0; }
.credits-panel .artist .role {
  font-size: 0.75em; letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase;
}
.credits-panel .artist .name { font-size: 1.05em; margin: 0.15em 0 0.3em; }
.credits-panel .artist p { margin-bottom: 0.3em; font-size: 0.92em; }
.credits-panel .artist .links { margin-bottom: 0; gap: 0.3em 1em; }
.credits-panel .artist .links a { font-size: 1em; }

#control-hud {
  position: fixed; left: 50%; bottom: 2vh; transform: translateX(-50%) translateY(6px);
  z-index: 7; display: flex; gap: 1em; flex-wrap: wrap; justify-content: center;
  font-size: 0.95em; letter-spacing: 0.03em; color: var(--fg);
  opacity: 0; transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none; max-width: 92vw;
}
#control-hud.visible { opacity: 0.9; transform: translateX(-50%) translateY(0); }
#control-hud span { border: 1px solid var(--dim); padding: 0.2em 0.7em; background: rgba(1,12,7,0.7); }

#hand-legend {
  position: fixed; left: 50%; bottom: 2vh; transform: translateX(-50%) translateY(6px);
  z-index: 7; display: flex; gap: 1em; flex-wrap: wrap; justify-content: center;
  font-size: 0.9em; letter-spacing: 0.03em; color: var(--fg);
  opacity: 0; transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none; max-width: 92vw;
}
#hand-legend.visible { opacity: 0.9; transform: translateX(-50%) translateY(0); }
#hand-legend span { border: 1px solid var(--dim); padding: 0.2em 0.7em; background: rgba(1,12,7,0.7); }

#hud-toolbar {
  position: fixed; right: 1em; top: 1em; z-index: 8;
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5em;
  max-width: 96vw;
}
#hud-toolbar button {
  font-family: inherit; font-size: 1.15em; letter-spacing: 0.03em;
  background: rgba(1,15,9,0.88); color: var(--fg);
  border: 2px solid var(--dim); border-radius: 4px;
  padding: 0.4em 0.85em; cursor: pointer;
  display: flex; align-items: center; gap: 0.4em; white-space: nowrap;
}
#hud-toolbar button:hover, #hud-toolbar button:focus-visible {
  border-color: var(--accent); color: var(--bg); background: var(--accent);
}

#farewell {
  position: fixed; inset: 0; z-index: 25;
  background: rgba(1, 8, 5, 0.96);
  display: flex; align-items: safe center; justify-content: safe center;
  padding: 6vh 6vw; overflow-y: auto;
}
.farewell-inner { max-width: 62ch; text-align: center; }
.farewell-q {
  font-size: clamp(1.15rem, 3vw, 1.5rem);
  line-height: 1.5; letter-spacing: 0.01em;
  margin-bottom: 2em;
}
.farewell-credits { margin-bottom: 2em; }
.farewell-credits .role {
  font-size: 0.75em; letter-spacing: 0.1em; color: var(--dim);
  text-transform: uppercase; margin-bottom: 0.6em;
}
.farewell-credits .playlist-label { margin-top: 1.2em; }
.farewell-credits .links { justify-content: center; margin-bottom: 0; }

#webgl-error {
  position: fixed; inset: 0; z-index: 20;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 6vw;
  text-align: center;
}
