/* DRIFT CITY — neon HUD + hologram modal */

:root {
  --bg: #07021a;
  --neon-pink: #ff2bd6;
  --neon-cyan: #22e4ff;
  --neon-magenta: #b657ff;
  --neon-white: #fff0ff;
  --grime: rgba(255, 43, 214, 0.12);
  --panel: rgba(8, 2, 26, 0.82);
  --panel-edge: rgba(34, 228, 255, 0.45);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--neon-cyan);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 14px;
  overflow: hidden;
  user-select: none;
}

#scene {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
}

/* --- HUD --- */

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  pointer-events: none;
  text-shadow: 0 0 6px var(--neon-cyan);
  z-index: 5;
}

/* Music toggle, top-right, subtle. */
#music-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 6;
  background: rgba(7, 2, 26, 0.45);
  border: 1px solid rgba(34, 228, 255, 0.35);
  color: var(--neon-cyan);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 6px 12px;
  cursor: pointer;
  opacity: 0.55;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
  transition: opacity 120ms, border-color 120ms;
}
#music-toggle:hover { opacity: 1; border-color: var(--neon-cyan); }
#music-toggle.muted { color: var(--neon-pink); border-color: rgba(255, 43, 214, 0.35); }
/* Hide it during a conversation so it never overlaps the speaker panel. */
body:has(#conv:not(.hidden)) #music-toggle { opacity: 0; pointer-events: none; }

#hud-title {
  font-size: 18px;
  letter-spacing: 0.2em;
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink);
}

#hud-title .muted {
  color: var(--neon-cyan);
  font-size: 12px;
  letter-spacing: 0.18em;
  opacity: 0.7;
}

#hud-counter {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 0.12em;
}

#hud-counter #hud-count {
  color: var(--neon-pink);
}

#hud-score {
  margin-top: 3px;
  font-size: 13px;
  letter-spacing: 0.12em;
}
#hud-score #hud-correct { color: var(--neon-cyan); }
#hud-score #hud-answered { color: var(--neon-white); }
#hud-score .muted { color: var(--neon-cyan); font-size: 11px; opacity: 0.6; }

#hud-controls {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

/* --- floating "press E" prompt --- */

#prompt-near {
  position: fixed;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  text-shadow: 0 0 6px var(--neon-cyan);
  letter-spacing: 0.15em;
  z-index: 5;
  pointer-events: none;
  box-shadow:
    0 0 12px rgba(34, 228, 255, 0.3),
    inset 0 0 12px rgba(34, 228, 255, 0.15);
}

#prompt-near .key {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--neon-pink);
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink);
  font-weight: bold;
}

#prompt-near .label {
  font-size: 12px;
}

/* --- toast --- */

#toast {
  position: fixed;
  top: 24%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border: 1px solid var(--neon-pink);
  background: var(--panel);
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink);
  letter-spacing: 0.2em;
  font-size: 13px;
  z-index: 6;
  pointer-events: none;
  box-shadow: 0 0 14px rgba(255, 43, 214, 0.35);
}

/* --- modal --- */

/* Mass Effect style: the dialogue panel sits at the bottom of the screen
   so the cinematic two-shot of player + ghost stays visible above it. The
   top gradient softly darkens the upper edge of the panel into the scene
   instead of a full-screen dim. */
/* Mass Effect style conversation overlay.
   - Speaker tag (week + persona) in upper-left.
   - Subtitle line at bottom-center: shows the line currently being voiced.
   - Question + choices at the very bottom; choices are compact text rows.
   - No big rectangular panel. Soft gradients fade UI into the cinematic shot.
   - No letterboxing: just opacity, blur, and gradients. */

/* #conv is a marker only — visibility gates the conv-* fixed children.
   Children are individually position:fixed so they anchor to the viewport
   regardless of parent layout. */
#conv {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10;
  pointer-events: none;
  font-family: inherit;
  color: var(--neon-white);
}
#conv.hidden > * { display: none !important; }
/* Hide the corner HUD during dialogue -- the speaker tag takes its place.
   Use visibility:hidden + opacity:0 so the layout is fully gone, not just
   faded; at 18% the HUD title still bled through the speaker tag. */
body:has(#conv:not(.hidden)) #hud {
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms, visibility 0s linear 200ms;
}
body:has(#conv.hidden) #hud {
  opacity: 1;
  visibility: visible;
  transition: opacity 200ms, visibility 0s;
}
/* Same treatment for the proximity "press E" prompt: never visible while
   the conversation overlay is up. */
body:has(#conv:not(.hidden)) #prompt-near {
  opacity: 0;
  visibility: hidden;
}

/* --- top-left speaker tag --- */
#conv-speaker {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 11;
  max-width: 40vw;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.85);
}
#conv-eyebrow {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink), 0 0 12px rgba(0, 0, 0, 0.9);
  margin-bottom: 4px;
}
#conv-persona {
  font-size: 18px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan), 0 0 16px rgba(0, 0, 0, 0.9);
  font-style: italic;
  letter-spacing: 0.04em;
}
#conv-progress {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--neon-white);
  opacity: 0.75;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
}
#conv-progress:empty { display: none; }

/* MASS-EFFECT-SPEC: no close X during dialogue. Conversation ends when the
   question is answered or the rationale is dismissed. */
#conv-close { display: none; }

/* --- subtitle line (currently spoken text or question prompt) ---
   Outlined white text positioned above the player silhouette so the two
   never collide. ~32vh from the bottom (above the player's head region at
   the cinematic eye-line). Max 50vw to keep lines compact and away from the
   choices column on the right. Text-stroke via multi-direction shadow keeps
   it legible without a scrim plate. */
#conv-subtitle {
  position: fixed;
  z-index: 11;
  /* Anchored to the LEFT of the player silhouette. The player sits roughly
     center-screen at the cinematic FOV, so we cap the subtitle in the
     left ~45% of the viewport at all sizes. Bottom 38vh keeps the line
     above the player's head. */
  left: 3vw;
  right: auto;
  bottom: 38vh;
  width: min(45vw, 560px);
  text-align: left;
  font-size: clamp(15px, 1.6vw, 20px);
  line-height: 1.45;
  color: var(--neon-white);
  text-shadow:
    0 0 1px #000, 0 1px 1px #000, 1px 0 1px #000, -1px 0 1px #000, 0 -1px 1px #000,
    0 0 10px rgba(0, 0, 0, 0.95),
    0 0 18px rgba(0, 0, 0, 0.7),
    0 0 14px rgba(34, 228, 255, 0.32);
  pointer-events: none;
  white-space: pre-wrap;
  transition: opacity 200ms;
  opacity: 1;
}
#conv-subtitle.fade { opacity: 0; }
#conv-subtitle:empty { display: none; }

#conv-choices {
  position: fixed;
  z-index: 11;
  right: 4vw;
  bottom: 6vh;
  width: min(360px, 32vw);
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}

@media (max-width: 720px) {
  #conv-choices { right: 2vw; width: 48vw; }
  #conv-subtitle { font-size: 15px; bottom: 36vh; max-width: 88vw; }
}

.conv-choice {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(7, 2, 26, 0.45);
  border: 1px solid rgba(34, 228, 255, 0.18);
  color: var(--neon-cyan);
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  transition: background 80ms, border-color 80ms, transform 60ms;
  text-shadow: 0 0 1px #000;
}
.conv-choice:hover, .conv-choice:focus {
  background: rgba(34, 228, 255, 0.12);
  border-color: rgba(34, 228, 255, 0.7);
  transform: translateX(-2px);
  outline: none;
}
.conv-choice .letter {
  flex: 0 0 16px;
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink);
  font-weight: bold;
}
.conv-choice .text { flex: 1 1 auto; }
.conv-choice.correct { border-color: var(--neon-cyan); background: rgba(34, 228, 255, 0.20); }
.conv-choice.wrong   { border-color: #ff5050; background: rgba(255, 80, 80, 0.20); }
.conv-choice.disabled { cursor: default; transform: none; }

/* --- rationale overlay (on wrong answer) ---
   ME-style: presented as a subtitle attributed to the ghost. No panel; just
   outlined text in the subtitle slot. The dismiss button sits where the
   choices were, bottom-right. */
#conv-rationale {
  position: fixed;
  z-index: 11;
  /* Same left-half framing as the subtitle so it doesn't overlap the
     choices column / continue button on the right. */
  left: 4vw;
  right: 38vw;
  bottom: 32vh;
  text-align: left;
  pointer-events: none;
}
.conv-rationale-label {
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink), 0 0 10px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.25em;
  font-size: 10px;
  margin-bottom: 6px;
}
#conv-rationale-body {
  white-space: pre-wrap;
  font-size: clamp(14px, 1.4vw, 18px);
  line-height: 1.45;
  color: var(--neon-white);
  text-shadow:
    0 0 1px #000, 0 1px 1px #000, 1px 0 1px #000, -1px 0 1px #000, 0 -1px 1px #000,
    0 0 10px rgba(0, 0, 0, 0.9);
  margin-bottom: 12px;
}
#conv-dismiss {
  position: fixed;
  right: 4vw;
  bottom: 6vh;
  z-index: 12;
  background: rgba(7, 2, 26, 0.5);
  border: 1px solid rgba(255, 43, 214, 0.6);
  color: var(--neon-pink);
  text-shadow: 0 0 4px var(--neon-pink), 0 0 6px rgba(0, 0, 0, 0.9);
  padding: 8px 16px;
  font-family: inherit;
  letter-spacing: 0.18em;
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
}
#conv-dismiss:hover { background: rgba(255, 43, 214, 0.14); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--panel-edge);
  background: linear-gradient(90deg, rgba(255, 43, 214, 0.08), rgba(34, 228, 255, 0.06));
}

.modal-eyebrow {
  letter-spacing: 0.25em;
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink);
  font-size: 11px;
}

#modal-close {
  background: none;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-family: inherit;
  padding: 2px 8px;
  cursor: pointer;
  text-shadow: 0 0 4px var(--neon-cyan);
}

#modal-close:hover {
  background: rgba(34, 228, 255, 0.12);
}

.modal-body {
  padding: 18px 22px 22px;
}

.modal-persona {
  font-size: 12px;
  color: var(--neon-magenta);
  text-shadow: 0 0 6px var(--neon-magenta);
  letter-spacing: 0.15em;
  margin-bottom: 12px;
  font-style: italic;
  opacity: 0.95;
}

.modal-prompt {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--neon-white);
  text-shadow: 0 0 4px rgba(255, 240, 255, 0.55);
  white-space: pre-wrap;
  margin-bottom: 16px;
}

.modal-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opt {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(34, 228, 255, 0.35);
  background: rgba(7, 2, 26, 0.45);
  color: var(--neon-cyan);
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  transition: background 80ms, border-color 80ms, transform 60ms;
}

.opt:hover {
  background: rgba(34, 228, 255, 0.1);
  border-color: var(--neon-cyan);
  transform: translateX(2px);
}

.opt .letter {
  flex: 0 0 22px;
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink);
  font-weight: bold;
}

.modal-rationale {
  border-top: 1px solid var(--panel-edge);
  padding: 16px 22px 18px;
  background: rgba(255, 43, 214, 0.04);
}

.rationale-label {
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink);
  letter-spacing: 0.2em;
  font-size: 11px;
  margin-bottom: 8px;
}

#modal-rationale-body {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.55;
  color: var(--neon-white);
  margin-bottom: 14px;
}

#modal-dismiss {
  background: none;
  border: 1px solid var(--neon-pink);
  color: var(--neon-pink);
  text-shadow: 0 0 4px var(--neon-pink);
  padding: 6px 14px;
  font-family: inherit;
  letter-spacing: 0.15em;
  font-size: 12px;
  cursor: pointer;
}

#modal-dismiss:hover {
  background: rgba(255, 43, 214, 0.1);
}

/* --- end terminal --- */

#end-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(7, 2, 26, 0.85), rgba(7, 2, 26, 0.98));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 11;
  backdrop-filter: blur(6px);
}

.end-frame {
  width: min(720px, 94vw);
  max-height: 90vh;
  overflow: auto;
  padding: 22px 26px;
  border: 1px solid var(--neon-pink);
  background: rgba(7, 2, 26, 0.92);
  box-shadow:
    0 0 30px rgba(255, 43, 214, 0.35),
    inset 0 0 30px rgba(255, 43, 214, 0.08);
  color: var(--neon-cyan);
}

.end-title {
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink);
  letter-spacing: 0.25em;
  font-size: 14px;
  margin-bottom: 14px;
}

#end-summary {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 14px;
  color: var(--neon-white);
  text-shadow: 0 0 4px rgba(255, 240, 255, 0.5);
}

#end-yaml {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(34, 228, 255, 0.4);
  padding: 12px;
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--neon-cyan);
  text-shadow: 0 0 3px rgba(34, 228, 255, 0.5);
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
}

.end-actions {
  display: flex;
  gap: 10px;
}

.end-actions button {
  background: none;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-family: inherit;
  letter-spacing: 0.15em;
  font-size: 12px;
  padding: 8px 14px;
  cursor: pointer;
  text-shadow: 0 0 4px var(--neon-cyan);
}

.end-actions button:hover {
  background: rgba(34, 228, 255, 0.12);
}

#end-download {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  text-shadow: 0 0 4px var(--neon-pink);
}

#end-download:hover {
  background: rgba(255, 43, 214, 0.12);
}

/* Primary action: submit the result to the LiveRamp recorder. Filled cyan so
   it reads as the main thing to do, with the download as a secondary option. */
.end-actions button.end-primary {
  background: var(--neon-cyan);
  color: #07021a;
  border-color: var(--neon-cyan);
  font-weight: 700;
  text-shadow: none;
  box-shadow: 0 0 14px rgba(34, 228, 255, 0.5);
}
.end-actions button.end-primary:hover {
  background: #6af0ff;
}

/* --- loader --- */

#loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 800ms;
}

.loader-frame {
  text-align: center;
}

.loader-title {
  font-size: 42px;
  letter-spacing: 0.4em;
  color: var(--neon-pink);
  text-shadow:
    0 0 12px var(--neon-pink),
    0 0 28px var(--neon-pink),
    0 0 60px rgba(255, 43, 214, 0.5);
  animation: flicker 1.6s infinite;
}

.loader-sub {
  margin-top: 10px;
  letter-spacing: 0.3em;
  color: var(--neon-cyan);
  text-shadow: 0 0 6px var(--neon-cyan);
  font-size: 12px;
  opacity: 0.85;
}

.loader-premise {
  /* Narrow, LEFT-aligned reading column (the parent .loader-frame centers
     everything, which makes a multi-line paragraph ragged + hard to read).
     ~24em keeps the line length to a comfortable ~48 characters. */
  max-width: 24em;
  margin: 24px auto 0;
  font-size: 15px;
  line-height: 1.72;
  text-align: left;
  color: var(--neon-white);
  opacity: 0.88;
  letter-spacing: 0.01em;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.85);
}
.loader-premise-controls {
  margin-top: 16px;
  max-width: 24em;
  font-size: 12px;
  text-align: center;
  color: var(--neon-cyan);
  opacity: 0.7;
  letter-spacing: 0.08em;
}

/* Asset-load progress bar. Shown while models + audio preload; the CTA below
   it stays in a non-clickable "loading" state until everything is ready. */
#loader-progress {
  width: 18em;
  max-width: 70vw;
  height: 3px;
  margin: 28px auto 0;
  background: rgba(120, 80, 200, 0.18);
  border-radius: 3px;
  overflow: hidden;
}
#loader-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  box-shadow: 0 0 10px rgba(34, 228, 255, 0.6);
  transition: width 260ms ease;
}

.loader-cta {
  margin-top: 18px;
  letter-spacing: 0.4em;
  color: var(--neon-white);
  text-shadow: 0 0 8px var(--neon-cyan), 0 0 20px rgba(34, 228, 255, 0.5);
  font-size: 14px;
  /* While loading: a calm dim state (no pulse, not clickable). The .ready
     class swaps in the inviting pulse + pointer cursor. */
  opacity: 0.55;
  cursor: default;
}
.loader-cta.ready {
  animation: cta-pulse 1.4s ease-in-out infinite;
  cursor: pointer;
}
/* Once everything is loaded, the bar has done its job -- fade it out so the
   "click to enter" call sits on its own. */
#loader.assets-ready #loader-progress {
  opacity: 0;
  transition: opacity 400ms ease;
}

@keyframes cta-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

#loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  47% { opacity: 1; }
  48% { opacity: 0.55; }
  49% { opacity: 1; }
  78% { opacity: 1; }
  79% { opacity: 0.7; }
  80% { opacity: 1; }
}

.hidden {
  display: none !important;
}
