/* ===== MAROON SERIES: UNIFIED CHAPTER STYLESHEET ===== */
/* Location-specific styling + character colors + narrative atmosphere */

:root {
  /* ===== DEFAULT COLORS ===== */
  --base-bg: #050505;
  --base-text: #d1d1d1;
  --base-accent: #ffb000;
  
  /* ===== CHARACTER COLORS (CONSISTENT) ===== */
  --color-architect: #ff00ff;
  --color-architect-alt: #8b00ff;
  --color-sarah: #ff006e;
  --color-sarah-alt: #ffff00;
  --color-marcus: #ff00ff;
  --color-marcus-gray: #808080;
  --color-ray: #d1d1d1;
  --color-ray-black: #050505;
  --color-melissa: #00ff00;
  --color-melissa-cyan: #00e6ff;
  
  /* ===== CHAPTER-SPECIFIC OVERRIDES (set per location) ===== */
  --chapter-primary: #8b00ff;
  --chapter-secondary: #00e6ff;
  --chapter-accent: #ffb000;
  --chapter-corp: #ff8c00;
}

/* ===== GLOBAL BODY STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--base-bg);
  color: var(--base-text);
  font-family: 'Courier Prime', 'Courier New', monospace;
  line-height: 1.6;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

/* ===== HEADER (UNIFIED ACROSS ALL CHAPTERS) ===== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: linear-gradient(90deg, rgba(5, 5, 5, 0.95) 0%, rgba(5, 5, 5, 0.85) 100%);
  border-bottom: 2px solid var(--chapter-primary);
  backdrop-filter: blur(4px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
}

.header-left {
  font-family: 'Courier New', monospace;
  font-size: 1.25rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  color: var(--chapter-primary);
  text-shadow: 0 0 8px var(--chapter-primary);
}

.header-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  color: var(--base-text);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  transition: all 0.3s ease;
  position: relative;
}

.nav-link::before {
  content: '';
  position: absolute;
  width: 0%;
  height: 2px;
  background: var(--chapter-primary);
  bottom: -2px;
  left: 0;
  transition: width 0.3s ease;
}

.nav-link:hover {
  color: var(--chapter-primary);
  text-shadow: 0 0 8px var(--chapter-primary);
}

.nav-link:hover::before {
  width: 100%;
}

/* ===== MAIN CONTENT AREA ===== */
main {
  padding: 3rem 2rem;
  min-height: calc(100vh - 200px);
  position: relative;
}

/* ===== CHAPTER TITLE ===== */
.chapter-title {
  font-family: 'Courier New', monospace;
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--chapter-primary);
  margin-bottom: 2rem;
  text-shadow: 0 0 16px var(--chapter-primary), 0 0 32px var(--chapter-primary);
  letter-spacing: 0.1em;
  text-align: center;
  position: relative;
  display: block;
  animation: titleGlitch 600ms infinite;
}

/* Two-layer chromatic pseudo-element glitch (original processing.html behavior) */
.chapter-title::before,
.chapter-title::after {
  content: attr(data-glitch);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.9;
}

.chapter-title::before {
  color: var(--chapter-secondary);
  mix-blend-mode: screen;
  animation: titleGlitchBefore 600ms infinite;
}

.chapter-title::after {
  color: var(--chapter-accent, #ffb000);
  mix-blend-mode: overlay;
  animation: titleGlitchAfter 600ms infinite;
}

@keyframes titleGlitch {
  0%   { transform: translate(0); }
  2%   { transform: translate(-2px, 1px); }
  4%   { transform: translate(0); }
  100% { transform: translate(0); }
}

@keyframes titleGlitchBefore {
  0%   { clip-path: inset(0 0 0 0); transform: translate(0); }
  20%  { clip-path: inset(10% 0 85% 0); transform: translate(-4px, 4px); }
  40%  { clip-path: inset(0 0 0 0); transform: translate(0); }
  60%  { clip-path: inset(60% 0 25% 0); transform: translate(4px, -4px); }
  80%  { clip-path: inset(0 0 0 0); transform: translate(0); }
  100% { clip-path: inset(0 0 0 0); transform: translate(0); }
}

@keyframes titleGlitchAfter {
  0%   { clip-path: inset(0 0 0 0); transform: translate(0); }
  15%  { clip-path: inset(80% 0 5% 0); transform: translate(3px, -3px); }
  35%  { clip-path: inset(0 0 0 0); transform: translate(0); }
  55%  { clip-path: inset(20% 0 70% 0); transform: translate(-3px, 2px); }
  75%  { clip-path: inset(0 0 0 0); transform: translate(0); }
  100% { clip-path: inset(0 0 0 0); transform: translate(0); }
}

/* Glitch overlay — non-destructive garbled text on top of original */
.maroon-glitch-overlay {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-block;
  white-space: nowrap;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
  font: inherit;
  line-height: inherit;
  color: inherit;
}

@keyframes glitch-flash {
  0%   { opacity: 1; transform: translate(0, 0); }
  15%  { opacity: 0.85; transform: translate(-3px, 1px); }
  30%  { opacity: 1; transform: translate(2px, -2px); }
  50%  { opacity: 0.7; transform: translate(-2px, 2px); }
  70%  { opacity: 1; transform: translate(3px, 0); }
  85%  { opacity: 0.9; transform: translate(-1px, 1px); }
  100% { opacity: 1; transform: translate(0, 0); }
}

.maroon-glitch-overlay.glitch {
  animation: glitch-flash 280ms linear;
  color: var(--chapter-primary);
  text-shadow: 2px 0 #ff0000, -2px 0 #00e6ff;
}

/* ===== SCENE CONTAINER ===== */
.scene {
  max-width: 900px;
  margin: 0 auto 4rem;
  padding: 1.5rem;
  border-left: 3px solid var(--chapter-primary);
  background: rgba(139, 0, 255, 0.02);
}

/* Scene elements eligible for glitch overlay */
[data-glitch] {
  position: relative;
}

.scene p {
  margin-bottom: 1rem;
  line-height: 1.8;
}

/* ===== SCENE BREAK — links to next page ===== */
a.scene-break {
  display: block;
  text-align: center;
  text-decoration: none;
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  color: var(--chapter-primary);
  margin: 4rem 0;
  padding: 2rem 0;
  border-top: 2px solid var(--chapter-primary);
  border-bottom: 2px solid var(--chapter-primary);
  text-shadow: 0 0 8px var(--chapter-primary);
  cursor: pointer;
  position: relative;
  letter-spacing: 0.4em;
  transition: letter-spacing 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  animation: scene-break-pulse 2.5s ease-in-out infinite;
}

a.scene-break:hover {
  letter-spacing: 0.8em;
  color: #ffffff;
  border-color: #ff00ff;
  text-shadow: 5px 0 #ff0000, -5px 0 #00ffff, 0 0 24px #ff00ff, 0 0 48px var(--chapter-primary);
}

@keyframes scene-break-pulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 8px var(--chapter-primary); }
  50% { opacity: 0.6; text-shadow: 0 0 24px var(--chapter-primary), 0 0 48px var(--chapter-secondary); }
}

/* ===== SCENE BREAK — paragraph variant (mid-chapter) ===== */
p.scene-break {
  display: block;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  color: var(--chapter-primary);
  margin: 3rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--chapter-primary);
  border-bottom: 1px solid var(--chapter-primary);
  text-shadow: 0 0 8px var(--chapter-primary);
  letter-spacing: 0.5em;
  opacity: 0.7;
  animation: scene-break-pulse 3s ease-in-out infinite;
}

/* ===== LYRICS ===== */
p.lyrics {
  font-family: 'Courier New', monospace;
  font-style: italic;
  font-size: 0.9rem;
  color: #cc7799;
  line-height: 2;
  margin: 2rem 0 2rem 3rem;
  padding: 1rem 1.2rem 1rem 1.4rem;
  border-left: 2px solid #cc7799;
  opacity: 0.9;
  white-space: pre-line;
  letter-spacing: 0.03em;
  text-shadow: 0 0 8px rgba(204, 119, 153, 0.6), 0 0 16px rgba(204, 119, 153, 0.3);
  background: rgba(204, 119, 153, 0.04);
  box-shadow: inset 3px 0 10px rgba(204, 119, 153, 0.15);
  border-radius: 0 4px 4px 0;
}

/* ===== SCANLINES EFFECT ===== */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 999;
}

/* ===== LOCATION-SPECIFIC STYLES ===== */

/* PROCESSING POD */
body[data-location="processing"] {
  --chapter-primary: #8b00ff;
  --chapter-secondary: #00e6ff;
  --chapter-accent: #ffb000;
}

body[data-location="processing"] main {
  background: radial-gradient(ellipse at 50% 50%, rgba(139, 0, 255, 0.05) 0%, transparent 100%);
}

body[data-location="processing"]::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(255, 176, 0, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

/* SUBSTRATUM — deleted server space, lavender/dissociation */
body[data-location="substratum"] {
  --chapter-primary: #9d86c8;
  --chapter-secondary: #b09ad0;
  --chapter-accent: #d1d1d1;
  background: #06050a;
}

body[data-location="substratum"] main {
  background: radial-gradient(ellipse at 50% 50%, rgba(157,134,200,0.06) 0%, transparent 80%);
}

body[data-location="substratum"] .scene {
  background: rgba(157,134,200,0.02);
  border-left-color: #9d86c8;
  box-shadow: inset 0 0 16px rgba(157,134,200,0.06);
}

/* THE GARDEN — Architect's domain, cold green surveillance */
body[data-location="the-garden"] {
  --chapter-primary: #00ff88;
  --chapter-secondary: #00aa55;
  --chapter-accent: #00e6ff;
  background: #020a06;
}

body[data-location="the-garden"] main {
  background: radial-gradient(ellipse at 50% 0%, rgba(0,255,136,0.08) 0%, transparent 70%);
}

body[data-location="the-garden"] .scene {
  border-left-color: #00ff88;
  background: rgba(0,255,136,0.02);
}

/* MAINTENANCE SQUARE */
body[data-location="maintenance"] {
  --chapter-primary: #ffb000;
  --chapter-secondary: #00e6ff;
  --chapter-accent: #d1d1d1;
}

body[data-location="maintenance"] main {
  background: radial-gradient(ellipse at top, rgba(255, 176, 0, 0.08) 0%, transparent 70%);
}

/* MAINTENANCE — concert/performance */
body[data-location="maintenance-concert"] {
  --chapter-primary: #8b00ff;
  --chapter-secondary: #b44dff;
  --chapter-accent: #d1d1d1;
  background: #04000a;
}

body[data-location="maintenance-concert"] main {
  background: radial-gradient(ellipse at 50% 0%, rgba(139,0,255,0.08) 0%, transparent 70%);
}

body[data-location="maintenance-concert"] .scene {
  border-left-color: #8b00ff;
  background: rgba(139,0,255,0.02);
}

/* MAINTENANCE — church/ritual */
body[data-location="maintenance-church"] {
  --chapter-primary: #f0f0f0;
  --chapter-secondary: #ffffff;
  --chapter-accent: #aaaaaa;
  background: #040404;
}

body[data-location="maintenance-church"] main {
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.05) 0%, transparent 70%);
}

body[data-location="maintenance-church"] .scene {
  border-left-color: #f0f0f0;
  background: rgba(255,255,255,0.01);
}

/* POSSESSION — Architect in Sarah's pod, maroon */
body[data-location="possession"] {
  --chapter-primary: #ff4d4d;
  --chapter-secondary: #ff1a1a;
  --chapter-accent: #d1d1d1;
  background: #0a0000;
}

body[data-location="possession"] main {
  background: radial-gradient(ellipse at 50% 0%, rgba(255,77,77,0.07) 0%, transparent 70%);
}

body[data-location="possession"] .scene {
  border-left-color: #ff4d4d;
  background: rgba(255,77,77,0.02);
}

/* RESIDUE */
body[data-location="residue"] {
  --chapter-primary: #808080;
  --chapter-secondary: #ff00ff;
  --chapter-accent: #d1d1d1;
  background: #0a0a0a;
}

/* CONTACT */
body[data-location="contact"] {
  --chapter-primary: #00e6ff;
  --chapter-secondary: #d1d1d1;
  --chapter-accent: #ffb000;
}

body[data-location="contact"] main {
  background: radial-gradient(ellipse at 50% 0%, rgba(0, 230, 255, 0.08) 0%, transparent 100%);
}

/* THE POD — Sarah alone, amber/gold */
body[data-location="the-pod"] {
  --chapter-primary: #ffb000;
  --chapter-secondary: #ff6600;
  --chapter-accent: #d1d1d1;
  background: #080400;
}

body[data-location="the-pod"] main {
  background: radial-gradient(ellipse at 50% 100%, rgba(255,176,0,0.07) 0%, transparent 70%);
}

body[data-location="the-pod"] .scene {
  border-left-color: #ffb000;
  background: rgba(255,176,0,0.02);
}

/* THE POD — Architect with Sarah, maroon */
body[data-location="the-pod-architect"] {
  --chapter-primary: #ff4d4d;
  --chapter-secondary: #ff1a1a;
  --chapter-accent: #d1d1d1;
  background: #0a0000;
}

body[data-location="the-pod-architect"] main {
  background: radial-gradient(ellipse at 50% 0%, rgba(255,77,77,0.07) 0%, transparent 70%);
}

body[data-location="the-pod-architect"] .scene {
  border-left-color: #ff4d4d;
  background: rgba(255,77,77,0.02);
  animation: pod-architect-glitch 6s steps(1, end) infinite;
}

body[data-location="the-pod-architect"] p {
  animation: pod-architect-text-bleed 8s steps(1, end) infinite;
}

@keyframes pod-architect-glitch {
  0%, 100% { transform: none; border-left-color: #ff4d4d; box-shadow: none; }
  82% { transform: translateX(-3px) skewX(-0.5deg); border-left-color: #ff0000; box-shadow: 3px 0 0 rgba(255,0,0,0.3), -1px 0 0 rgba(0,230,255,0.2); }
  83.5% { transform: translateX(2px); border-left-color: #ff4d4d; box-shadow: none; }
  84% { transform: none; }
}

@keyframes pod-architect-text-bleed {
  0%, 100% { text-shadow: none; }
  88% { text-shadow: 2px 0 0 rgba(255,0,0,0.4), -1px 0 0 rgba(0,230,255,0.25); }
  89.2% { text-shadow: none; }
}

/* CORE */
body[data-location="core"] {
  --chapter-primary: #ff006e;
  --chapter-secondary: #d1d1d1;
  --chapter-accent: #cccccc;
}

/* CLIMB */
body[data-location="climb"] {
  --chapter-primary: #ff00ff;
  --chapter-secondary: #00e6ff;
  --chapter-accent: #ffff00;
  background: linear-gradient(180deg, #050505 0%, #1a0033 50%, #050505 100%);
}

/* UPLOAD */
body[data-location="upload"] {
  --chapter-primary: #00e6ff;
  --chapter-secondary: #ffb000;
  --chapter-accent: #050505;
}

/* BREACH */
body[data-location="breach"] {
  --chapter-primary: #ff006e;
  --chapter-secondary: #d1d1d1;
  --chapter-accent: #00e6ff;
}

/* STUDIO — Sarah's creative suite, icy white/chrome */
body[data-location="studio"] {
  --chapter-primary: #c8d8e8;
  --chapter-secondary: #8fa8c0;
  --chapter-accent: #e8f4ff;
  background: #020508;
}
body[data-location="studio"] main {
  background: radial-gradient(ellipse at 50% 0%, rgba(200,216,232,0.06) 0%, transparent 70%);
}
body[data-location="studio"] .scene {
  border-left-color: #c8d8e8;
  background: rgba(200,216,232,0.015);
}

/* THE GARDEN DARK — warped inner sanctum */
body[data-location="the-garden-dark"] {
  --chapter-primary: #007744;
  --chapter-secondary: #003322;
  --chapter-accent: #ff6666;
  background: #000301;
}
body[data-location="the-garden-dark"] main {
  background: radial-gradient(ellipse at 50% 0%, rgba(0,119,68,0.08) 0%, transparent 70%);
}
body[data-location="the-garden-dark"] .scene {
  border-left-color: #007744;
  background: rgba(0,119,68,0.02);
}

/* RAY-OFFICE — clinical enforcement alcove, cold institutional white */
body[data-location="ray-office"] {
  --chapter-primary: #c4d8e8;
  --chapter-secondary: #8aabb8;
  --chapter-accent: #d8e8f0;
  background: #030507;
}
body[data-location="ray-office"] main {
  background: radial-gradient(ellipse at 50% 50%, rgba(196,216,232,0.04) 0%, transparent 75%);
}
body[data-location="ray-office"] .scene {
  border-left-color: #c4d8e8;
  background: rgba(196,216,232,0.012);
}

/* COLISEUM — Roman arena simulation, torchlight, ancient stone, sand floor */
body[data-location="coliseum"] {
  --chapter-primary: #c8922a;
  --chapter-secondary: #8b5e1a;
  --chapter-accent: #e0b050;
  background: #0d0805;
}
body[data-location="coliseum"] main {
  background: radial-gradient(ellipse at 50% 100%, rgba(200,146,42,0.07) 0%, transparent 65%);
}
body[data-location="coliseum"] .scene {
  border-left-color: #8b5e1a;
  background: rgba(200,146,42,0.02);
}

/* THRONE-ROOM — castle keep, regal stone, gold and royal purple */
body[data-location="throne-room"] {
  --chapter-primary: #ffd700;
  --chapter-secondary: #6b4226;
  --chapter-accent: #c9a959;
  background: #0d0d1a;
}
body[data-location="throne-room"] main {
  background: radial-gradient(ellipse at 50% 50%, rgba(255,215,0,0.05) 0%, transparent 70%);
}
body[data-location="throne-room"] .scene {
  border-left-color: #6b4226;
  background: rgba(255,215,0,0.01);
}

/* ===== BROKEN CORPO ADS ===== */
/* Degraded ambient advertising — broken cyan, too-bright, looping */
p.corpo-ad {
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  color: #f0f0f0;
  opacity: 0.85;
  line-height: 1.8;
  margin: 1.8rem 0 1.8rem 2rem;
  padding-left: 1rem;
  border-left: 2px dotted rgba(0, 230, 255, 0.5);
  letter-spacing: 0.05em;
  white-space: pre-line;
  position: relative;
  text-shadow: 0 0 6px #00e6ff, 0 0 16px rgba(0, 230, 255, 0.6), 0 0 32px rgba(0, 230, 255, 0.3);
}

/* ===== CORPORATE / DUMP LINKS ===== */
/* At rest: invisible in prose. Spontaneous glitch fires from JS. */
a.corp-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  position: relative;
}

a.corp-link:hover {
  color: #00e6ff;
  text-decoration: none;
  text-shadow:
    0 0 6px #00e6ff,
    0 0 14px #00e6ff,
    0 0 32px rgba(0, 230, 255, 0.6),
    2px 0 #ff0055,
    -2px 0 #00e6ff;
}

a.dump-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  position: relative;
}

a.dump-link:hover {
  color: #f0f0f0;
  font-family: 'Courier New', monospace;
  text-decoration: none;
  text-shadow:
    0 0 6px #ffffff,
    0 0 14px #ffffff,
    0 0 32px rgba(255, 255, 255, 0.5),
    2px 0 #ff0000,
    -2px 0 #00e6ff;
}

/* ===== TRANSITION STYLES ===== */
.transition-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #c0c0c0;
  border: 2px solid #000;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.3);
  max-width: 500px;
  z-index: 2000;
}

.transition-titlebar {
  background: #000080;
  color: #fff;
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: bold;
}

.transition-content {
  padding: 1rem;
  font-family: Verdana, sans-serif;
  font-size: 0.9rem;
  color: #000;
}

.transition-content p {
  margin-bottom: 0.5rem;
}

.transition-content a {
  color: #0000ee;
  text-decoration: underline;
}

.transition-content a:hover {
  text-decoration: none;
}

/* ===== CHAPTER NAV ===== */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 760px;
  margin: 1.5rem auto 3rem;
  padding: 0;
}

.chapter-nav a {
  color: var(--chapter-primary);
  text-decoration: none;
  font-size: 3rem;
  line-height: 1;
  opacity: 0.65;
  transition: opacity 0.15s, text-shadow 0.15s, filter 0.15s;
  position: relative;
  filter: drop-shadow(0 0 4px var(--chapter-primary));
}

.chapter-nav a:hover {
  opacity: 1;
  filter: drop-shadow(0 0 10px var(--chapter-primary)) drop-shadow(0 0 20px var(--chapter-secondary));
}

.chapter-nav span {
  display: block;
  width: 1px;
}

.chapter-nav-disabled {
  width: auto !important;
  color: var(--chapter-primary);
  font-size: 3rem;
  line-height: 1;
  opacity: 0.15;
  cursor: default;
  filter: none;
  user-select: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .chapter-title {
    font-size: 1.8rem;
  }
  
  header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .header-nav {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }
  
  main {
    padding: 1rem;
  }
  
  .scene {
    padding: 1rem;
    max-width: 100%;
  }
}

/* ── CHARACTER COLORS ─────────────────────────────────────── */
.char-architect {
  color: #00e6ff;
  text-shadow: 0 0 6px #00e6ff55;
}

.char-ray {
  color: #f0f4ff;
  text-shadow: 0 0 8px #ffffff99, 0 0 16px #c0d0ff66;
}

.char-sarah {
  color: #ff006e;
  text-shadow: 0 0 6px #ff006e55;
}

.char-maya {
  color: #ffff00;
  text-shadow: 0 0 6px #ffff0044;
}

.char-marcus {
  color: #7aaa7a;
  font-style: normal;
}

.char-caleb {
  color: #7a9ab8;
  text-shadow: 0 0 6px #7a9ab855;
}

.char-melissa {
  color: #2dba4e;
  text-shadow: 0 0 6px #2dba4e55;
}

.char-slug {
  color: #c87941;
  text-shadow: 0 0 6px #c8794155;
}

.char-nlt {
  color: var(--chapter-corp, #ff8c00);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(255, 140, 0, 0.25);
}

.char-earpiece {
  color: #7a8fa8;
  font-style: italic;
  font-size: 0.9em;
  opacity: 0.75;
}

.char-press {
  color: #c8d8e8;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.char-ray-block {
  display: block;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: #d0e8ff;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4em 0;
  text-shadow: 0 0 8px rgba(200, 230, 255, 0.5);
}

.char-creator {
  color: #b0b0b0;
  font-style: italic;
  opacity: 0.8;
  text-shadow: 0 0 10px rgba(200, 200, 200, 0.5), 0 0 24px rgba(160, 160, 160, 0.25);
}

.char-system {
  display: block;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: #b00000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4em 0;
  text-shadow: 0 0 8px #b0000066;
}

.char-ghost {
  color: #2dba4e;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-shadow: 0 0 8px #2dba4e66;
}

.char-mesh {
  display: block;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: #2dba4e;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4em 0;
  text-shadow: 0 0 8px #2dba4e66;
}

.char-feed {
  display: block;
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 0.88rem;
  font-style: italic;
  color: #8888aa;
  opacity: 0.8;
  padding: 0.15em 0 0.15em 1.2em;
  border-left: 1px solid #8888aa33;
  text-shadow: 0 0 6px #8888aa33;
  transition: opacity 0.4s ease;
}

.system-alert {
  text-align: center;
  margin: 2.5rem 0;
  line-height: 2;
}

/* ===== TRANSITION PAGES ===== */
.transition-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 2rem;
  gap: 3rem;
}

.transition-signal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  text-align: center;
}

.transition-sep {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  color: var(--chapter-primary);
  opacity: 0.6;
  letter-spacing: 0.2em;
}

.transition-cta {
  display: block;
  font-size: 8rem;
  line-height: 1;
  color: var(--chapter-primary);
  text-decoration: none;
  filter: drop-shadow(0 0 20px var(--chapter-primary)) drop-shadow(0 0 40px var(--chapter-secondary));
  animation: transitionPulse 2s ease-in-out infinite;
  transition: filter 0.2s, transform 0.2s;
}

.transition-cta:hover {
  filter: drop-shadow(0 0 40px var(--chapter-primary)) drop-shadow(0 0 80px var(--chapter-secondary)) drop-shadow(0 0 120px var(--chapter-primary));
  transform: scale(1.1);
}

.transition-label {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  color: var(--chapter-secondary);
  opacity: 0.8;
  text-transform: uppercase;
}

@keyframes transitionPulse {
  0%, 100% {
    opacity: 0.7;
    filter: drop-shadow(0 0 20px var(--chapter-primary)) drop-shadow(0 0 40px var(--chapter-secondary));
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 30px var(--chapter-primary)) drop-shadow(0 0 60px var(--chapter-secondary)) drop-shadow(0 0 100px var(--chapter-primary));
  }
}

/* ===== COLISEUM — corrupted antiquity, barely holding together ===== */
body[data-location="coliseum"] {
  --chapter-primary: #c4b99a;
  --chapter-secondary: #8a7a5a;
  --chapter-accent: #e8d4a0;
  background: #060503;
}

body[data-location="coliseum"] main {
  background: radial-gradient(ellipse at 50% 0%, rgba(196,185,154,0.06) 0%, transparent 70%);
}

body[data-location="coliseum"] .scene {
  border-left-color: #c4b99a;
  background: rgba(196,185,154,0.015);
  animation: coliseum-scene-glitch 9s steps(1, end) infinite;
}

@keyframes coliseum-scene-glitch {
  0%, 89.9% {
    transform: none;
    border-left-color: #c4b99a;
    box-shadow: none;
  }
  90% {
    transform: skewX(0.4deg) translateX(2px);
    border-left-color: #ff6030;
    box-shadow: -3px 0 10px rgba(255,96,48,0.4);
  }
  90.5% {
    transform: skewX(-0.2deg) translateX(-1px);
    border-left-color: #c4b99a;
    box-shadow: none;
  }
  91% {
    transform: skewX(0.3deg) translateX(1px);
    border-left-color: #ff6030;
    box-shadow: 2px 0 6px rgba(255,96,48,0.25);
  }
  91.5%, 100% {
    transform: none;
    border-left-color: #c4b99a;
    box-shadow: none;
  }
}

/* ===== PALACE — frozen aristocracy, luxury software crashing ===== */
body[data-location="palace"] {
  --chapter-primary: #8ab8d8;
  --chapter-secondary: #5a88a8;
  --chapter-accent: #d8f0ff;
  background: #020408;
}

body[data-location="palace"] main {
  background: radial-gradient(ellipse at 50% 50%, rgba(138,184,216,0.05) 0%, transparent 70%);
}

body[data-location="palace"] .scene {
  border-left-color: #8ab8d8;
  background: rgba(138,184,216,0.012);
  animation: palace-scene-glitch 7s steps(1, end) infinite;
}

@keyframes palace-scene-glitch {
  0%, 85.9% {
    filter: none;
    border-left-color: #8ab8d8;
  }
  86% {
    filter: hue-rotate(120deg) brightness(1.6) saturate(2);
    border-left-color: #d0a0ff;
  }
  86.4% {
    filter: hue-rotate(-50deg) brightness(0.7);
    border-left-color: #60ffcc;
  }
  86.8%, 100% {
    filter: none;
    border-left-color: #8ab8d8;
  }
}

/* ===== DUNGEON — iron control, the Architect fracturing ===== */
body[data-location="dungeon"] {
  --chapter-primary: #8a8a9a;
  --chapter-secondary: #606070;
  --chapter-accent: #c06060;
  background: #030304;
}

body[data-location="dungeon"] main {
  background: radial-gradient(ellipse at 50% 100%, rgba(192,96,96,0.04) 0%, transparent 60%);
}

body[data-location="dungeon"] .scene {
  border-left-color: #8a8a9a;
  background: rgba(138,138,154,0.01);
  animation: dungeon-scene-glitch 5s steps(1, end) infinite;
}

body[data-location="dungeon"] .char-architect {
  animation: dungeon-architect-bleed 7s steps(1, end) infinite;
}

@keyframes dungeon-scene-glitch {
  0%, 79.9% {
    transform: none;
    border-left-color: #8a8a9a;
    box-shadow: none;
  }
  80% {
    transform: translateX(4px);
    border-left-color: #c06060;
    box-shadow: -4px 0 12px rgba(192,96,96,0.5), 4px 0 4px rgba(0,180,255,0.2);
  }
  80.4% {
    transform: translateX(-3px);
    border-left-color: #8a8a9a;
    box-shadow: none;
  }
  80.8% {
    transform: translateX(2px);
    border-left-color: #c06060;
    box-shadow: -2px 0 8px rgba(192,96,96,0.3);
  }
  81.2%, 100% {
    transform: none;
    border-left-color: #8a8a9a;
    box-shadow: none;
  }
}

@keyframes dungeon-architect-bleed {
  0%, 75.9% {
    text-shadow: none;
  }
  76% {
    text-shadow: 2px 0 0 rgba(192,0,0,0.7), -1px 0 0 rgba(0,160,255,0.35);
  }
  76.5%, 100% {
    text-shadow: none;
  }
}

/* ===== AUSTIN — East Sixth Collective, worn leather western ===== */
body[data-location="austin"] {
  --chapter-primary: #b06030;
  --chapter-secondary: #7a3d18;
  --chapter-accent: #d4956a;
  background: #1c0d05;
}

body[data-location="austin"] main {
  background: radial-gradient(ellipse at 50% 30%, rgba(200,135,74,0.12) 0%, transparent 65%);
}

body[data-location="austin"] .scene {
  border-left-color: #a0622a;
  background: rgba(160,98,42,0.06);
}

body[data-location="austin"] .scene p:not([class]) {
  color: #b06030;
}

/* ===== EXTERNAL — Melissa's off-grid Portland lab, phosphor terminal ===== */
body[data-location="external"] {
  --chapter-primary: #2dba4e;
  --chapter-secondary: #1a7a32;
  --chapter-accent: #5ade7a;
  background: #010301;
}

body[data-location="external"] main {
  background: radial-gradient(ellipse at 50% 50%, rgba(45,186,78,0.04) 0%, transparent 70%);
}

body[data-location="external"] .scene {
  border-left-color: #2dba4e;
  background: rgba(45,186,78,0.01);
}

/* ===== NLT-HQ — corporate press stage / Reiss's private office ===== */
body[data-location="nlt-hq"] {
  --chapter-primary: #1a3d6e;
  --chapter-secondary: #5070a0;
  --chapter-accent: #0a1528;
  background: #e8dcc8;
  color: #1a1e2e;
}

body[data-location="nlt-hq"] main {
  background: linear-gradient(180deg, #e0d4b8 0%, #e8dcc8 60%);
}

body[data-location="nlt-hq"] .scene {
  border-left-color: #a0b0cc;
  background: rgba(26,61,110,0.025);
}

body[data-location="nlt-hq"] .scene p:not([class]) {
  color: #2a2e3e;
}

/* char overrides for light background */
body[data-location="nlt-hq"] .char-architect {
  color: #1a3d6e;
  text-shadow: none;
}

body[data-location="nlt-hq"] .char-sarah {
  color: #b8004c;
  text-shadow: none;
}

body[data-location="nlt-hq"] .char-ray {
  color: #2a5090;
  text-shadow: none;
}

body[data-location="nlt-hq"] .char-ray-block {
  color: #2a5090;
  text-shadow: none;
  background: rgba(26,61,110,0.05);
  border-left: 2px solid #4a70b0;
  padding-left: 0.8em;
}

body[data-location="nlt-hq"] .char-press {
  color: #3a4e72;
}

body[data-location="nlt-hq"] .char-earpiece {
  color: #6878a0;
}

body[data-location="nlt-hq"] .char-system {
  color: #8b0000;
  text-shadow: none;
  background: rgba(139,0,0,0.04);
}

/* ===== CONTAINMENT — washed orange, Marcus's punishment cell ===== */
body[data-location="containment"] {
  --chapter-primary: #e8904a;
  --chapter-secondary: #b06020;
  --chapter-accent: #f0c080;
  background: #080401;
}

body[data-location="containment"] main {
  background: radial-gradient(ellipse at 50% 50%, rgba(232,144,74,0.04) 0%, transparent 70%);
}

body[data-location="containment"] .scene {
  border-left-color: #e8904a;
  background: rgba(232,144,74,0.01);
}

/* ===== GAOL — white noise, isolation tank ===== */
body[data-location="gaol"] {
  --chapter-primary: #909090;
  --chapter-secondary: #606060;
  --chapter-accent: #d0d0d0;
  background: #f0f0f0;
  color: #181818;
}

body[data-location="gaol"] main {
  background: none;
}

body[data-location="gaol"] .scene {
  border-left-color: #b0b0b0;
  background: rgba(200,200,200,0.08);
}

body[data-location="gaol"] .chapter-title {
  color: #404040;
}

body[data-location="gaol"] .chapter-nav a,
body[data-location="gaol"] .chapter-nav-disabled {
  color: #606060;
}

/* ===== SERAPH — deep charcoal, surgical cyan ===== */
body[data-location="seraph"] {
  --chapter-primary: #40c8d0;
  --chapter-secondary: #208898;
  --chapter-accent: #80e8f0;
  background: #050709;
}

body[data-location="seraph"] main {
  background: radial-gradient(ellipse at 50% 50%, rgba(64,200,208,0.04) 0%, transparent 70%);
}

body[data-location="seraph"] .scene {
  border-left-color: #40c8d0;
  background: rgba(64,200,208,0.02);
}

/* ===== STUDIO NINE ===== */
/* Cold corporate white. Antiseptic. Sterile. Soulless functionality. */
body[data-location="studionine"] {
  --chapter-primary: #e8ecf0;
  --chapter-secondary: #7a8a9a;
  --chapter-accent: #bcc8d4;
  background: #030406;
}

body[data-location="studionine"] main {
  background: radial-gradient(ellipse at 50% 0%, rgba(232,236,240,0.05) 0%, transparent 60%);
}

body[data-location="studionine"] .scene {
  border-left-color: #bcc8d4;
  background: rgba(232,236,240,0.02);
}
