/* WEAPON BORN — Act 1 style
   Palette tokens from design doc §7 */

:root {
  --void: #030308;
  --grid: #1E3A4A;
  --grid-bright: #7FD4E8;
  --dot: #FF2A1F;
  --burn-a: #FFB347;
  --white-place: #F7F5F0;
  --text: #C9D4D8;
  --mono: ui-monospace, "IBM Plex Mono", "Cascadia Mono", Consolas, "SF Mono", monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  font-family: var(--mono);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.dot-active { cursor: none; }

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

/* ---------- Loading screen ---------- */

#loading {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--void);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 1s ease;
}

#loading.gone { opacity: 0; pointer-events: none; }

#loading .pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 18px 4px rgba(255, 42, 31, 0.35);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ---------- Title screen ---------- */

#title-screen {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: var(--void);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.3em;
  opacity: 0;
  transition: opacity 1.4s ease;
}

#title-screen.shown { opacity: 1; }
#title-screen.fading { opacity: 0; pointer-events: none; transition: opacity 1.8s ease; }

#title-screen h1 {
  color: var(--text);
  font-size: clamp(26px, 5vmin, 46px);
  font-weight: 400;
  letter-spacing: 0.55em;
  padding-left: 0.55em;
}

#title-screen .sub {
  color: rgba(201, 212, 216, 0.5);
  font-size: 14px;
}

#title-screen #play-btn {
  margin-top: 2.4em;
  background: none;
  border: 1px solid rgba(255, 42, 31, 0.45);
  color: rgba(255, 96, 80, 0.9);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.35em;
  padding: 0.8em 2.6em 0.8em 2.95em; /* optically recenter letterspaced text */
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
}

#title-screen #play-btn:hover {
  border-color: rgba(255, 42, 31, 0.9);
  color: #FF5A46;
  box-shadow: 0 0 22px rgba(255, 42, 31, 0.18);
}

#title-screen .hint {
  margin-top: 1.6em;
  color: rgba(201, 212, 216, 0.28);
  font-size: 12px;
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  #loading .pulse-dot { animation: none; opacity: 0.8; }
}

/* ---------- Prose overlay ---------- */

#prose {
  position: fixed;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(640px, 86vw);
  text-align: center;
  pointer-events: none;
  transition: top 1.4s ease;
  z-index: 10;
}

body.text-bottom #prose {
  top: 82%;
}

#prose .line {
  color: var(--text);
  font-size: clamp(15px, 1.9vmin, 18px);
  line-height: 1.65;
  margin: 0.55em 0;
  opacity: 1;
  transition: opacity 1.1s ease;
  text-wrap: balance;
}

#prose .line.dim { opacity: 0.32; }
#prose .line.gone { opacity: 0; }

#prose .line.narration { font-style: italic; color: rgba(201, 212, 216, 0.78); }
#prose .line.her {
  font-style: italic;
  color: #A9DCFF;
  text-shadow: 0 0 7px rgba(127, 200, 255, 0.55), 0 0 20px rgba(127, 200, 255, 0.25);
}
#prose .line.jickson { color: var(--text); }
#prose .line.prompt { font-style: italic; color: rgba(201, 212, 216, 0.92); }
#prose .line.pool {
  font-size: clamp(20px, 3.2vmin, 30px);
  letter-spacing: 0.45em;
  color: rgba(201, 212, 216, 0.55);
}

/* the crisp voice — cold, clipped, no warmth */
#prose .line.crisp {
  color: #9FB4BE;
  letter-spacing: 0.08em;
}

/* the last line of the game — her voice, claiming both names */
#prose .line.final {
  font-size: clamp(18px, 2.8vmin, 27px);
  color: #A9DCFF;
  text-shadow: 0 0 7px rgba(127, 200, 255, 0.55), 0 0 22px rgba(127, 200, 255, 0.25);
  letter-spacing: 0.06em;
}

/* ---------- Name entry ---------- */

#name-entry {
  position: fixed;
  left: 50%;
  top: 56%;
  transform: translateX(-50%);
  z-index: 20;
}

#name-display {
  color: var(--text);
  font-size: clamp(18px, 2.6vmin, 24px);
  letter-spacing: 0.14em;
  min-height: 1.5em;
  text-align: center;
  white-space: pre;
}

#name-chars .ch {
  display: inline-block;
  transition: transform 0.9s cubic-bezier(0.3, 0, 0.8, 1), opacity 0.9s ease;
}

#name-chars .ch.scatter { opacity: 0; }

#name-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  vertical-align: text-bottom;
  background: rgba(201, 212, 216, 0.85);
  animation: blink 1.05s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

#name-hidden-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  border: 0;
  left: -9999px;
}

/* ---------- The White Place ---------- */

#white-place {
  position: fixed;
  inset: 0;
  background: var(--white-place);
  opacity: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}

#white-place.flooding { pointer-events: all; }

#white-place .wp-title {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(38, 36, 42, 0.5);
  font-size: clamp(20px, 4.5vmin, 42px);
  letter-spacing: 0.5em;
  padding-left: 0.5em;
  opacity: 0;
  transition: opacity 1.3s ease;
  pointer-events: none;
}

#white-place .frag {
  position: absolute;
  color: rgba(38, 36, 42, 0.16);
  font-style: italic;
  font-size: clamp(14px, 2vmin, 20px);
  white-space: nowrap;
  will-change: transform;
}

/* ---------- Miss sting (Beat 7) ---------- */

#sting {
  position: fixed;
  inset: 0;
  background: var(--white-place);
  opacity: 0;
  z-index: 38;
  pointer-events: none;
}

/* ---------- End card (the only conventionally-styled screen) ---------- */

#end-card {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2em;
  background: var(--void);
  opacity: 0;
  transition: opacity 2.5s ease;
}

#end-card.shown { opacity: 1; }

#end-card h1 {
  color: var(--text);
  font-size: clamp(24px, 4.5vmin, 42px);
  font-weight: 400;
  letter-spacing: 0.55em;
  padding-left: 0.55em; /* optically recenter letterspaced text */
}

#end-card .sub {
  color: rgba(201, 212, 216, 0.55);
  font-size: 14px;
}

#end-card .ctas {
  display: flex;
  gap: 1.2em;
  margin-top: 2.2em;
}

#end-card .ctas a {
  display: inline-block;
  text-decoration: none;
  background: none;
  border: 1px solid rgba(127, 212, 232, 0.4);
  color: rgba(127, 212, 232, 0.85);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.15em;
  padding: 0.75em 1.8em;
  transition: border-color 0.3s, color 0.3s;
}

#end-card .ctas a:hover {
  border-color: rgba(127, 212, 232, 0.9);
  color: var(--grid-bright);
}

/* Part 2 email capture — bare text on the void, like everything else */
#part2-capture {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9em;
  max-width: min(440px, 84vw);
  text-align: center;
}

#part2-capture .capture-note {
  color: rgba(201, 212, 216, 0.6);
  font-size: 13px;
  font-style: italic;
  line-height: 1.6;
}

#part2-form {
  display: flex;
  gap: 0.8em;
  align-items: baseline;
}

#part2-email {
  background: none;
  border: none;
  border-bottom: 1px solid rgba(201, 212, 216, 0.35);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.05em;
  padding: 0.4em 0.2em;
  width: 15em;
  outline: none;
  transition: border-color 0.3s;
}

#part2-email:focus { border-bottom-color: rgba(127, 212, 232, 0.8); }
#part2-email::placeholder { color: rgba(201, 212, 216, 0.25); }

#part2-form button {
  background: none;
  border: 1px solid rgba(127, 212, 232, 0.4);
  color: rgba(127, 212, 232, 0.85);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  padding: 0.5em 1.2em;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s;
}

#part2-form button:hover {
  border-color: rgba(127, 212, 232, 0.9);
  color: var(--grid-bright);
}

#end-card > button {
  background: none;
  border: none;
  color: rgba(201, 212, 216, 0.4);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.15em;
  padding: 0.5em 1em;
  cursor: pointer;
  transition: color 0.3s;
}

#end-card > button:hover { color: rgba(201, 212, 216, 0.85); }

/* ---------- Corner controls ---------- */

#mute-toggle {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 60;
  background: none;
  border: none;
  color: rgba(201, 212, 216, 0.22);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 8px;
  transition: color 0.3s, opacity 0.3s;
}

#mute-toggle:hover { color: rgba(201, 212, 216, 0.65); }
#mute-toggle.muted { color: rgba(201, 212, 216, 0.12); text-decoration: line-through; }

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  #name-cursor { animation: none; opacity: 0.85; }
}
