/* ==========================================================================
   WHISPERS OF SILENCE — THE CIPHER MURDERS
   Design system. Mobile-first; phone frame appears from 768px up.
   ========================================================================== */

:root {
  --bg-dark: #07090e;
  --bg-deep: #04060a;
  --bg-card: rgba(18, 24, 38, 0.88);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.15);
  --accent-crimson: #ff2a55;
  --accent-cyan: #00f0ff;
  --accent-gold: #ffd700;
  --accent-green: #34c759;
  --text-main: #f0f4f8;
  --text-muted: #9aaaba;

  --font-heading: 'Cinzel', Georgia, serif;
  --font-title: 'Cinzel', Georgia, serif;   /* was referenced but never defined */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-code: 'JetBrains Mono', ui-monospace, monospace;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --shadow-glow: 0 0 25px rgba(255, 42, 85, 0.4);
  --shadow-cyan: 0 0 25px rgba(0, 240, 255, 0.4);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --nav-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Text is unselectable by default (game feel) but inputs must stay usable —
   a global user-select:none silently blocked paste into the cipher field. */
body { user-select: none; -webkit-user-select: none; }
input, textarea, .selectable, .selectable * {
  user-select: text;
  -webkit-user-select: text;
}

html { height: 100%; }

body {
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(circle at 15% 12%, rgba(255, 42, 85, 0.13) 0%, transparent 42%),
    radial-gradient(circle at 85% 88%, rgba(0, 240, 255, 0.13) 0%, transparent 42%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; }

/* ==========================================================================
   DEVICE SHELL  —  full-bleed on phones, framed from 768px
   ========================================================================== */

.device-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  background: #000;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.phone-header-bar {
  flex: 0 0 auto;
  height: 42px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(42px + env(safe-area-inset-top, 0px));
  background: rgba(7, 9, 14, 0.96);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-glass);
  z-index: 60;
}

.status-clock { font-family: var(--font-code); letter-spacing: 1px; }
.status-right { display: flex; gap: 8px; align-items: center; }

.chapter-chip {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.35);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.chapter-chip:empty { display: none; }

.icon-btn {
  font-size: 14px;
  line-height: 1;
  padding: 6px;
  border-radius: var(--radius-sm);
  min-width: 32px;
  min-height: 32px;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); }

.phone-notch { display: none; }

.phone-screen {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ==========================================================================
   VIEWS
   ========================================================================== */

.game-view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.35s ease;
  min-height: 0;
}
.game-view.active { display: flex; opacity: 1; z-index: 10; }

/* ---------- Title ---------- */
#view-title {
  background: url('../assets/fbi_headquarters_doors_1784746183710.jpg') center/cover no-repeat;
  justify-content: flex-end;
  overflow-y: auto;
}
.title-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,9,14,0.35) 0%, rgba(7,9,14,0.92) 55%, rgba(7,9,14,0.99) 100%);
}
.title-inner {
  position: relative;
  padding: 24px 20px calc(24px + var(--safe-b));
  text-align: center;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.title-badge {
  display: inline-block;
  background: rgba(255, 42, 85, 0.22);
  color: var(--accent-crimson);
  border: 1px solid var(--accent-crimson);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 12px;
}

.main-title {
  font-family: var(--font-title);
  font-size: clamp(28px, 9vw, 44px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.95);
}
.subtitle { font-size: clamp(11px, 3.2vw, 13px); color: var(--text-muted); margin-bottom: 16px; }

.endings-teaser {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent-gold);
  margin-bottom: 14px;
}
.endings-teaser:empty { display: none; }

.mode-selector { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

.mode-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  text-align: left;
  transition: var(--transition);
  position: relative;
  width: 100%;
}
.mode-card:hover, .mode-card.selected {
  border-color: var(--accent-crimson);
  background: rgba(255, 42, 85, 0.14);
}
.mode-card.selected::after {
  content: '✓';
  position: absolute; top: 12px; right: 14px;
  color: var(--accent-crimson); font-weight: 800;
}
.mode-name {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-weight: 700; font-size: 14px; color: #fff; margin-bottom: 3px;
}
.mode-tag { font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.mode-tag.cyan { color: var(--accent-cyan); }
.mode-tag.crimson { color: var(--accent-crimson); }
.mode-desc { display: block; font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.title-actions { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Buttons ---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-crimson) 0%, #d61a42 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 14px 16px;
  min-height: 48px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glow);
  transition: var(--transition);
  width: 100%;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; filter: grayscale(0.6); }
.btn-primary.cyan-btn { background: var(--accent-cyan); color: #04121a; box-shadow: var(--shadow-cyan); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-weight: 600;
  font-size: 13px;
  padding: 12px 16px;
  min-height: 44px;
  border-radius: var(--radius-md);
  width: 100%;
  transition: var(--transition);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.13); }
.btn-ghost.sm { font-size: 11px; padding: 9px 12px; min-height: 38px; }
.btn-ghost.danger { color: var(--accent-crimson); border-color: rgba(255, 42, 85, 0.5); }

.row-actions { display: flex; gap: 8px; }
.row-actions > * { flex: 1; }
.row-actions .flex2 { flex: 2; }

/* ---------- Opening / doors ---------- */
/* Do NOT set position here: .game-view is position:absolute; inset:0, and an ID
   selector re-declaring `relative` collapses the view to height 0, which drops
   the CTA underneath the status bar. */
#view-opening { background: var(--bg-deep); overflow: hidden; }

.door-container {
  position: absolute; inset: 0;
  background: url('../assets/fbi_headquarters_doors_1784746183710.jpg') center/cover no-repeat;
}
.door-panel {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background: rgba(18, 24, 38, 0.72);
  backdrop-filter: blur(12px);
  transition: transform 1s cubic-bezier(0.77, 0, 0.175, 1);
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.85);
}
.door-left { left: 0; border-right: 2px solid var(--accent-cyan); }
.door-right { right: 0; border-left: 2px solid var(--accent-cyan); }
.door-container.open .door-left { transform: translateX(-100%); }
.door-container.open .door-right { transform: translateX(100%); }

.fbi-emblem {
  width: 68px; height: 68px; border-radius: 50%;
  border: 2px solid var(--accent-gold);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; letter-spacing: 1px;
  color: var(--accent-gold); background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}
.emblem-sub { font-size: 8px; color: #fff; }

.scene-dialogue-box {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,9,14,0.35) 0%, rgba(7,9,14,0.97) 78%);
  padding: 18px 16px calc(18px + var(--safe-b));
  z-index: 20;
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: 10px;
  overflow-y: auto;
}
.speaker-header { display: flex; align-items: center; gap: 10px; }
.speaker-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--accent-crimson);
}
.speaker-title {
  color: var(--accent-crimson); font-size: 12px; font-weight: 800;
  letter-spacing: 1px; text-transform: uppercase;
}
.speaker-sub { font-size: 10px; color: var(--accent-cyan); }
.dialogue-text { font-size: 13px; line-height: 1.5; }

/* Video slots — always tap-to-play, never autoplay (iOS rejects it) */
.video-slot { position: relative; width: 100%; max-width: 300px; margin: 0 auto; }
/* All source clips are 1080x1920. Capping only max-height while width stayed
   100% made the BOX wider than 9:16, so `contain` letterboxed the sides.
   Drive the size from the height and let width follow the ratio. */
.scene-video, .media-video {
  height: 46vh; width: auto; max-width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain; background: #000;
  border-radius: 18px; border: 2px solid var(--accent-cyan);
  box-shadow: 0 10px 30px rgba(0, 240, 255, 0.28);
  display: block;
}
.video-play-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 62px; height: 62px; border-radius: 50%;
  background: rgba(0, 240, 255, 0.9); color: #04121a;
  font-size: 24px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
}
.video-play-btn[hidden] { display: none; }
.video-caption {
  position: absolute; bottom: 10px; left: 0; right: 0;
  text-align: center; font-size: 9px; font-weight: 700;
  letter-spacing: 1px; color: var(--accent-cyan);
  text-shadow: 0 2px 6px #000; pointer-events: none;
}

/* ==========================================================================
   BUREAU OS
   ========================================================================== */

#view-os { display: none; flex-direction: column; min-height: 0; }
#view-os.active { display: flex; }

/* Wrapper so the nav can become a left rail on wide landscape without the
   HUD ending up beside the panels. */
.os-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.hud {
  flex: 0 0 auto;
  background: rgba(18, 24, 38, 0.92);
  border-bottom: 1px solid var(--border-glass);
  padding: 8px 12px;
}
.hud-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.affinity { display: flex; gap: 12px; flex-wrap: wrap; font-size: 10px; font-weight: 700; }
.affinity-stat { display: flex; align-items: center; gap: 5px; }
.affinity-track {
  width: 46px; height: 4px; border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.14); overflow: hidden;
}
.affinity-fill { height: 100%; border-radius: var(--radius-full); transition: width 0.5s ease; }
.affinity-fill.crimson { background: var(--accent-crimson); }
.affinity-fill.cyan { background: var(--accent-cyan); }

.objectives { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.objectives:empty { display: none; }
.objective {
  font-size: 10px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.objective.done { color: var(--accent-green); text-decoration: line-through; opacity: 0.75; }

.coop-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: rgba(0, 0, 0, 0.55);
  border-bottom: 1px solid var(--border-glass);
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
}
.coop-bar[hidden] { display: none; }
.coop-dot { width: 8px; height: 8px; border-radius: 50%; }
.coop-dot.crimson { background: var(--accent-crimson); box-shadow: 0 0 8px var(--accent-crimson); }
.coop-dot.cyan { background: var(--accent-cyan); box-shadow: 0 0 8px var(--accent-cyan); }
.coop-switch { margin-left: auto; }

.os-panel {
  flex: 1 1 auto;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  min-height: 0;
}
.os-panel.active { display: flex; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px; flex-wrap: wrap;
}
.panel-title { font-size: 13px; font-weight: 800; letter-spacing: 0.5px; }
.panel-title.cyan { color: var(--accent-cyan); }
.panel-title.gold { color: var(--accent-gold); }
.panel-title.crimson { color: var(--accent-crimson); }

.seg-control {
  display: flex; gap: 2px; padding: 2px;
  background: rgba(0, 0, 0, 0.5); border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
}
.seg {
  font-size: 9px; font-weight: 800; letter-spacing: 1px;
  padding: 6px 12px; border-radius: var(--radius-full);
  color: var(--text-muted); min-height: 30px;
}
.seg.active { background: var(--accent-cyan); color: #04121a; }

/* ---------- Nav ---------- */
.os-navbar {
  flex: 0 0 auto;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(18, 24, 38, 0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-glass);
  display: flex; align-items: center; justify-content: space-around;
}
.nav-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-muted); font-size: 9px; font-weight: 600;
  padding: 6px 8px; min-width: 52px; min-height: 44px;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.nav-item.active { color: var(--accent-cyan); background: rgba(0, 240, 255, 0.12); }
.nav-icon { font-size: 17px; line-height: 1; }
.nav-label { line-height: 1; }

.unread-badge {
  position: absolute; top: 3px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-crimson);
  box-shadow: 0 0 8px var(--accent-crimson);
  animation: pulseDot 1.6s ease-in-out infinite;
}
.unread-badge[hidden] { display: none; }
@keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Chat ---------- */
.thread-list { display: flex; flex-direction: column; gap: 8px; }

.thread-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border-glass);
  padding: 12px; border-radius: var(--radius-md);
  cursor: pointer; transition: var(--transition); text-align: left; width: 100%;
}
.thread-card:hover { border-color: var(--accent-cyan); }
.thread-card.unread { border-color: rgba(255, 42, 85, 0.55); }

.avatar-img {
  width: 46px; height: 46px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--border-glass); flex: 0 0 auto;
}
.avatar-img.sm { width: 34px; height: 34px; }

.thread-info { flex: 1; min-width: 0; }
.thread-name {
  display: flex; justify-content: space-between; gap: 8px;
  font-weight: 700; font-size: 13px; color: #fff; margin-bottom: 2px;
}
.thread-time { font-size: 10px; color: var(--text-muted); font-weight: 500; flex: 0 0 auto; }
.thread-snippet {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thread-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent-crimson); box-shadow: 0 0 8px var(--accent-crimson);
}

.single-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.back-btn { color: var(--accent-cyan); font-size: 18px; padding: 6px 8px; min-height: 40px; }

.chat-messages {
  flex: 1 1 auto;
  display: flex; flex-direction: column; gap: 9px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-right: 4px; margin-bottom: 10px; min-height: 0;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  font-size: 12.5px; line-height: 1.45;
  animation: bubbleIn 0.28s ease-out;
  word-wrap: break-word;
}
.chat-bubble.incoming {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  align-self: flex-start; border-bottom-left-radius: 4px;
}
.chat-bubble.outgoing {
  background: linear-gradient(135deg, #0084ff 0%, #00b3ff 100%);
  color: #fff; align-self: flex-end; border-bottom-right-radius: 4px;
}
.chat-bubble.killer {
  background: rgba(255, 42, 85, 0.13);
  border: 1px solid rgba(255, 42, 85, 0.45);
  font-family: var(--font-code); font-size: 11.5px;
}
.bubble-time { display: block; font-size: 9px; opacity: 0.6; margin-top: 4px; }

.typing { display: flex; gap: 4px; align-self: flex-start; padding: 12px 14px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted);
  animation: typingBounce 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

.chat-options { display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; }
.chat-option-btn {
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: var(--accent-cyan);
  padding: 11px 13px; min-height: 44px;
  border-radius: var(--radius-md);
  font-size: 11.5px; font-weight: 600; text-align: left;
  transition: var(--transition); width: 100%;
}
.chat-option-btn:hover { background: var(--accent-cyan); color: #04121a; }

.audio-chip {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 8px; padding: 8px 12px; min-height: 38px;
  background: rgba(255, 42, 85, 0.2);
  border: 1px solid var(--accent-crimson);
  border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700; color: #fff;
}

/* ---------- Tactical map ---------- */
.map-tactical { display: flex; flex-direction: column; gap: 8px; }
.map-tactical[hidden], .map-grid[hidden] { display: none; }

.map-stage {
  position: relative; width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  background: #060a12;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.9);
}
.map-plate { display: block; width: 100%; height: auto; opacity: 0.95; }
.map-stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,240,255,0.035) 0 1px, transparent 1px 3px),
    radial-gradient(circle at 50% 45%, transparent 45%, rgba(0,0,0,0.72) 100%);
}
.map-trail {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 8;
}
.map-trail path {
  fill: none;
  stroke: rgba(0, 240, 255, 0.55);
  stroke-width: 0.5;
  stroke-dasharray: 2 2;
  filter: drop-shadow(0 0 3px rgba(0, 240, 255, 0.6));
}
.map-pins { position: absolute; inset: 0; z-index: 12; }

/* Hotspot pins — pattern proven in deepwater-lighthouse */
.map-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 30px; height: 30px;
  cursor: pointer; z-index: 15;
}
.hotspot-dot {
  position: absolute; top: 8px; left: 8px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent-crimson);
  border: 2px solid #fff;
  box-shadow: 0 0 10px var(--accent-crimson);
  transition: var(--transition);
}
.map-hotspot:hover .hotspot-dot,
.map-hotspot:focus-visible .hotspot-dot { transform: scale(1.35); background: var(--accent-gold); }

.hotspot-pulse {
  position: absolute; top: 0; left: 0;
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--accent-crimson);
  opacity: 0;
  animation: pulseRing 1.9s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
@keyframes pulseRing {
  0% { transform: scale(0.5); opacity: 1; }
  80%, 100% { transform: scale(2); opacity: 0; }
}

.hotspot-label {
  position: absolute; top: -24px; left: 50%; transform: translateX(-50%);
  background: rgba(6, 10, 18, 0.95);
  color: var(--accent-gold);
  font-size: 8.5px; font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 7px; border-radius: 4px;
  border: 1px solid rgba(255, 215, 0, 0.5);
  white-space: nowrap; pointer-events: none;
}
.hotspot-step {
  position: absolute; top: 10px; left: 10px;
  width: 10px; height: 10px;
  font-size: 7px; font-weight: 900; line-height: 10px;
  text-align: center; color: #fff; pointer-events: none;
}

/* Locked pins read as sealed, never clickable-then-alert */
.map-hotspot.locked { cursor: not-allowed; }
.map-hotspot.locked .hotspot-dot {
  background: rgba(120, 135, 150, 0.65);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: none;
}
.map-hotspot.locked .hotspot-pulse { display: none; }
.map-hotspot.locked .hotspot-label { color: var(--text-muted); border-color: var(--border-glass); }

.map-hotspot.next .hotspot-dot { background: var(--accent-cyan); box-shadow: 0 0 14px var(--accent-cyan); }
.map-hotspot.next .hotspot-pulse { border-color: var(--accent-cyan); }
.map-hotspot.searched .hotspot-dot { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.map-hotspot.searched .hotspot-pulse { display: none; }

.map-legend { font-size: 10px; color: var(--text-muted); text-align: center; line-height: 1.5; }

/* ---------- Map grid (list view) ---------- */
.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.map-card {
  position: relative;
  height: clamp(118px, 30vw, 158px);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  cursor: pointer; transition: var(--transition);
  text-align: left; padding: 0; width: 100%;
}
.map-card:hover { border-color: var(--accent-crimson); }
.map-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(7, 9, 14, 0.96) 100%);
  padding: 10px; display: flex; flex-direction: column; justify-content: flex-end;
}
.map-card-title { font-weight: 700; font-size: 12px; color: #fff; }
.map-card-tag { font-size: 8.5px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--accent-gold); }
.map-card.locked { opacity: 0.55; cursor: not-allowed; }
.map-step {
  position: absolute; top: 8px; left: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.8); border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan); font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

.seal-stamp {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 8px; font-weight: 800; letter-spacing: 0.5px;
  padding: 3px 7px; border-radius: 4px;
}

/* ---------- Cipher ---------- */
.locked-pane {
  margin: auto; text-align: center; padding: 32px 20px;
  color: var(--text-muted); font-size: 12px; line-height: 1.6;
}
.locked-pane[hidden] { display: none; }
.locked-pane .lock-icon { font-size: 40px; display: block; margin-bottom: 12px; opacity: 0.6; }

.puzzle-box {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  padding: 16px;
  border-radius: var(--radius-lg);
  text-align: center;
}
.puzzle-box[hidden] { display: none; }
.puzzle-title { font-size: 15px; font-weight: 800; color: var(--accent-gold); margin-bottom: 4px; }
.puzzle-prompt { font-size: 11px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5; }

.cipher-transmission {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px; margin-bottom: 14px;
}
.cipher-label { display: block; font-size: 9px; letter-spacing: 1px; color: var(--accent-cyan); margin-bottom: 5px; }
.cipher-text {
  font-family: var(--font-code); font-size: 14px;
  letter-spacing: 3px; color: var(--accent-gold); word-break: break-word;
}

.cipher-rings { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.ring-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.ring-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 215, 0, 0.16);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold); font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.ring-btn:hover { background: var(--accent-gold); color: #000; }
.shift-readout { font-family: var(--font-code); font-size: 12px; color: var(--text-muted); }
.shift-readout strong { color: var(--accent-gold); font-size: 15px; }

/* One definition only. The old file declared .cipher-ring twice and the dead
   circular version leaked height:120px + display:flex into these rows. */
.cipher-ring {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  text-align: center;
  overflow: hidden;
  width: 100%;
}
.cipher-ring.outer { border-color: rgba(255, 215, 0, 0.6); }
.cipher-ring.inner { border-color: rgba(0, 240, 255, 0.4); }
.ring-label {
  display: block; font-size: 8.5px; font-weight: 800;
  color: var(--text-muted); letter-spacing: 1px; margin-bottom: 4px;
}
.ring-letters {
  display: block; font-family: var(--font-code);
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  white-space: nowrap; overflow-x: auto; padding: 4px 0;
  scrollbar-width: none;
}
.ring-letters::-webkit-scrollbar { display: none; }
.cipher-ring.outer .ring-letters { color: var(--accent-gold); }
.cipher-ring.inner .ring-letters { color: var(--accent-cyan); }

.puzzle-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 13px; min-height: 48px;
  border-radius: var(--radius-md);
  font-family: var(--font-code); font-size: 13px;
  letter-spacing: 2px; text-align: center;
  margin-bottom: 10px;
}
.puzzle-input:focus { outline: none; border-color: var(--accent-cyan); }

.puzzle-feedback { margin-top: 10px; font-size: 11px; font-weight: 600; line-height: 1.5; }
.puzzle-feedback.ok { color: var(--accent-green); }
.puzzle-feedback.bad { color: var(--accent-crimson); }
.puzzle-feedback:empty { display: none; }

.hint-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.hint-item {
  font-size: 10.5px; color: var(--accent-gold);
  background: rgba(255, 215, 0, 0.09);
  border: 1px solid rgba(255, 215, 0, 0.3);
  padding: 8px 10px; border-radius: var(--radius-sm);
  text-align: left; line-height: 1.5;
}

/* ---------- Evidence ---------- */
.evidence-list { display: flex; flex-direction: column; gap: 10px; }

.evidence-card {
  display: flex; gap: 10px; padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer; text-align: left; width: 100%;
  transition: var(--transition);
}
.evidence-card:hover { border-color: var(--accent-gold); }
.evidence-card.locked { opacity: 0.5; cursor: not-allowed; }
.evidence-img {
  width: 68px; height: 68px; flex: 0 0 auto;
  border-radius: var(--radius-sm); object-fit: cover;
}
.evidence-info { flex: 1; min-width: 0; }
.evidence-title { font-size: 12.5px; font-weight: 700; color: var(--accent-gold); margin-bottom: 2px; }
.evidence-meta { font-size: 9.5px; color: var(--text-muted); margin-bottom: 4px; }
.evidence-notes { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.accusation-wrap {
  margin-top: 20px; padding-top: 18px;
  border-top: 1px dashed rgba(255, 42, 85, 0.4);
}
.accusation-wrap[hidden] { display: none; }
.accusation-prompt { font-size: 11.5px; color: var(--text-muted); margin: 6px 0 14px; line-height: 1.5; }
.accusation-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.accusation-field { display: flex; flex-direction: column; gap: 5px; }
.accusation-label { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: var(--accent-cyan); }
.accusation-select {
  width: 100%; min-height: 46px; padding: 12px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: #fff; font-family: inherit; font-size: 12.5px;
}
.accusation-select:focus { outline: none; border-color: var(--accent-cyan); }
.accusation-field.correct .accusation-select { border-color: var(--accent-green); }
.accusation-field.wrong .accusation-select { border-color: var(--accent-crimson); }

.strike-row { display: flex; gap: 6px; align-items: center; font-size: 10px; color: var(--text-muted); margin-bottom: 10px; }
.strike { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--accent-crimson); }
.strike.used { background: var(--accent-crimson); }

/* ---------- Dossiers ---------- */
.dossier-list { display: flex; flex-direction: column; gap: 10px; }

.dossier-card {
  display: flex; gap: 12px; align-items: center;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-left: 3px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer; text-align: left; width: 100%;
  transition: var(--transition);
}
.dossier-card:hover { border-color: var(--accent-cyan); }
.dossier-card.suspect { border-left-color: var(--accent-crimson); }
.dossier-card.ally { border-left-color: var(--accent-cyan); }
.dossier-card.rival { border-left-color: var(--accent-gold); }
.dossier-card.victim { border-left-color: var(--text-muted); }

.dossier-thumb {
  width: 54px; height: 54px; flex: 0 0 auto;
  border-radius: var(--radius-sm); object-fit: cover;
  background: #000;
}
.dossier-name { font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 2px; }
.dossier-sub { font-size: 10px; color: var(--text-muted); }
.dossier-count { font-size: 9px; color: var(--accent-cyan); margin-top: 3px; font-weight: 700; }

.dossier-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.dossier-portrait { position: relative; width: 84px; height: 84px; flex: 0 0 auto; }
.dossier-portrait img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border-glass);
  background: #000;
}
.dossier-portrait .portrait-caption {
  display: block; font-size: 8px; color: var(--text-muted);
  margin-top: 4px; text-align: center; line-height: 1.3;
}

.dossier-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.dossier-field {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}
.field-label { font-size: 9px; font-weight: 800; letter-spacing: 1px; color: var(--accent-cyan); margin-bottom: 4px; }
.field-value { font-size: 11.5px; line-height: 1.55; color: var(--text-main); }
.field-value.redacted {
  font-family: var(--font-code);
  color: transparent;
  background: #0d1118;
  border-radius: 3px;
  letter-spacing: 1px;
  user-select: none;
  position: relative;
}
.field-value.redacted::selection { background: transparent; }

/* Progressive photo redaction. The gated source is never in the DOM at all;
   these only style a stage the player has legitimately reached. */
.redact-none { filter: none; }
.redact-silhouette { filter: brightness(0) contrast(0); }
.redact-pixelate { filter: blur(13px) contrast(1.35) saturate(0.6); }
.redact-grain { filter: grayscale(1) contrast(1.4) brightness(0.75); }

/* ---------- Modals ---------- */
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.93);
  backdrop-filter: blur(18px);
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 18px calc(24px + var(--safe-b));
  animation: fadeIn 0.3s ease;
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }

.sheet {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 18px;
  width: 100%; max-width: 380px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
  max-height: 100%;
  overflow-y: auto;
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border-glass);
  color: #fff; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}

.sheet-media { margin-bottom: 12px; }
.sheet-img {
  width: 100%; height: 168px; object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  margin-bottom: 12px; display: block;
}
.sheet-img.contain { object-fit: contain; background: #000; }
img[data-zoom] { cursor: zoom-in; }

.sheet-title { font-family: var(--font-title); font-size: 16px; color: var(--accent-cyan); margin-bottom: 4px; }
.sheet-title.gold { color: var(--accent-gold); }
.sheet-title.cyan { color: var(--accent-cyan); }
.sheet-tag { font-size: 9.5px; color: var(--accent-gold); font-weight: 700; letter-spacing: 0.5px; margin-bottom: 10px; }
.sheet-desc, .sheet-notes { font-size: 11.5px; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; }
.sheet-notes {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.45);
  padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}
.sheet-sub { font-size: 10.5px; font-weight: 700; color: #fff; margin-bottom: 7px; }

.clue-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.clue-item {
  font-size: 11px; line-height: 1.5;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}
.clue-item.p1 { border-left: 3px solid var(--accent-crimson); }
.clue-item.p2 { border-left: 3px solid var(--accent-cyan); }
.clue-item.hidden-other {
  color: var(--text-muted); font-style: italic; opacity: 0.7;
}

/* ---------- Call modal ---------- */
.call-modal { justify-content: space-between; }
.call-inner { text-align: center; width: 100%; margin-top: auto; }
.caller-media { position: relative; max-width: 260px; margin: 0 auto 14px; }
.caller-avatar {
  width: 106px; height: 106px; border-radius: 50%;
  object-fit: cover; border: 4px solid var(--accent-crimson);
  box-shadow: var(--shadow-glow);
  animation: callPulse 1.6s ease-in-out infinite;
}
@keyframes callPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 42, 85, 0.45); }
  50% { box-shadow: 0 0 0 16px rgba(255, 42, 85, 0); }
}
.caller-video {
  height: 48vh; width: auto; max-width: 100%; aspect-ratio: 9 / 16;
  object-fit: cover; border-radius: 20px;
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 10px 30px rgba(0, 240, 255, 0.35);
  margin: 0 auto; display: block;
}
.caller-video[hidden], .caller-avatar[hidden] { display: none; }
.caller-name { font-size: 19px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.caller-status { font-size: 11px; color: var(--accent-cyan); letter-spacing: 1px; text-transform: uppercase; }

.audio-wave { display: flex; gap: 5px; align-items: center; justify-content: center; height: 34px; margin: 14px 0; }
.audio-wave i {
  width: 4px; height: 8px; background: var(--accent-cyan); border-radius: 2px;
  animation: wavePulse 1s ease-in-out infinite alternate;
}
.audio-wave i:nth-child(2) { animation-delay: 0.2s; }
.audio-wave i:nth-child(3) { animation-delay: 0.4s; }
.audio-wave i:nth-child(4) { animation-delay: 0.6s; }
.audio-wave i:nth-child(5) { animation-delay: 0.8s; }
@keyframes wavePulse { 0% { height: 6px; } 100% { height: 30px; } }
.audio-wave[hidden] { display: none; }

.call-transcript {
  font-size: 11.5px; line-height: 1.55; color: #fff;
  background: rgba(0, 0, 0, 0.62);
  padding: 11px; border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  max-width: 340px; margin: 14px auto 0; text-align: left;
}
.call-transcript[hidden] { display: none; }

.call-actions { display: flex; gap: 40px; justify-content: center; margin-top: auto; padding-top: 20px; }
.call-btn {
  width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  transition: var(--transition);
}
.call-btn.decline { background: #ff3b30; }
.call-btn.accept { background: var(--accent-green); }
.call-btn:active { transform: scale(0.93); }
.call-actions[hidden] { display: none; }
.call-hangup { max-width: 200px; margin-top: 16px; }
.call-hangup[hidden] { display: none; }

/* ---------- Vote / handoff ---------- */
.vote-channel {
  display: inline-block; font-size: 9px; font-weight: 800; letter-spacing: 1px;
  padding: 4px 10px; border-radius: var(--radius-full); margin-bottom: 10px;
  background: rgba(0, 240, 255, 0.15); color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.4);
}
.vote-options { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.vote-option {
  padding: 13px; min-height: 52px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  text-align: left; width: 100%;
  font-size: 12.5px; font-weight: 600; line-height: 1.45;
  transition: var(--transition);
}
.vote-option:hover { border-color: var(--accent-cyan); background: rgba(0, 240, 255, 0.1); }
.vote-arg { display: block; font-size: 10.5px; font-weight: 400; color: var(--text-muted); margin-top: 5px; line-height: 1.5; }
.vote-note { font-size: 10.5px; color: var(--text-muted); text-align: center; line-height: 1.5; }

.handoff { background: rgba(2, 4, 8, 0.985); }
.handoff-inner { text-align: center; max-width: 320px; }
.handoff-icon { font-size: 52px; margin-bottom: 14px; }
.handoff-title { font-family: var(--font-title); font-size: 21px; color: var(--accent-cyan); margin-bottom: 8px; }
.handoff-sub { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 22px; }

/* ---------- Case log ---------- */
.case-log { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; }
.log-entry {
  font-size: 11px; line-height: 1.5;
  padding-left: 14px; position: relative;
  color: var(--text-muted);
}
.log-entry::before {
  content: ''; position: absolute; left: 0; top: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-cyan);
}
.log-entry strong { color: var(--text-main); display: block; font-size: 11.5px; }

/* ---------- Lightbox ---------- */
.lightbox { background: rgba(0, 0, 0, 0.96); padding: 20px; }
.lightbox img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 12px; border: 2px solid var(--accent-cyan); }
.lightbox-close { position: absolute; top: 16px; right: 16px; background: var(--accent-crimson); }
.lightbox-caption { font-size: 11px; color: var(--accent-gold); margin-top: 12px; text-align: center; font-weight: 700; }

/* ---------- Toasts (replace every alert()) ---------- */
.toast-host {
  position: absolute; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 32px); max-width: 360px;
  pointer-events: none;
}
.toast {
  background: rgba(12, 17, 26, 0.97);
  border: 1px solid var(--border-glass);
  border-left: 3px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 11.5px; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75);
  animation: toastIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.toast.locked { border-left-color: var(--text-muted); color: var(--text-muted); }
.toast.unlock { border-left-color: var(--accent-gold); }
.toast.danger { border-left-color: var(--accent-crimson); }
.toast.out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- Chapter transition card ---------- */
.chapter-card {
  position: absolute; inset: 0;
  z-index: 250;
  background: rgba(3, 5, 9, 0.97);
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px 24px;
}
.chapter-card.active { display: flex; animation: fadeIn 0.4s ease; }
.chapter-act { font-size: 10px; letter-spacing: 3px; color: var(--accent-crimson); font-weight: 800; margin-bottom: 10px; }
.chapter-title {
  font-family: var(--font-title); font-size: clamp(24px, 7vw, 34px);
  color: #fff; margin-bottom: 12px; line-height: 1.15;
}
.chapter-brief { font-size: 12.5px; color: var(--text-muted); line-height: 1.65; max-width: 340px; }

/* ---------- Ending ---------- */
#view-ending { overflow: hidden; }
.ending-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 24px 18px calc(28px + var(--safe-b));
  text-align: center;
}
.ending-image {
  width: 100%; max-width: 320px; aspect-ratio: 4 / 3;
  object-fit: cover; border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  margin: 0 auto 16px; display: block;
}
.ending-badge {
  display: inline-block; font-size: 9px; font-weight: 800; letter-spacing: 2px;
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  background: rgba(255, 215, 0, 0.12);
  padding: 4px 12px; border-radius: var(--radius-full); margin-bottom: 12px;
}
.ending-title {
  font-family: var(--font-title); font-size: clamp(24px, 7vw, 34px);
  line-height: 1.12; margin-bottom: 10px;
}
.ending-epitaph { font-size: 12px; color: var(--accent-cyan); font-style: italic; margin-bottom: 18px; }
.ending-body { text-align: left; max-width: 480px; margin: 0 auto 22px; }
.ending-body p { font-size: 13px; line-height: 1.75; color: var(--text-main); margin-bottom: 14px; }

.ending-stats {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin-bottom: 26px;
}
.stat-tile {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: var(--radius-md); padding: 10px 14px; min-width: 88px;
}
.stat-value { font-family: var(--font-code); font-size: 18px; font-weight: 700; color: var(--accent-gold); }
.stat-label { font-size: 9px; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; margin-top: 2px; }

.section-head {
  font-family: var(--font-title); font-size: 15px;
  letter-spacing: 1px; color: var(--accent-cyan);
  margin: 24px 0 12px; text-align: center;
}

.endings-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px; margin-bottom: 8px;
}
.ending-slot {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: var(--radius-md); padding: 11px 10px; text-align: left;
}
.ending-slot.found { border-color: rgba(255, 215, 0, 0.55); }
.ending-slot.current { border-color: var(--accent-cyan); box-shadow: var(--shadow-cyan); }
.ending-slot.locked { opacity: 0.55; }
.slot-name { font-size: 11px; font-weight: 700; color: #fff; line-height: 1.3; margin-bottom: 3px; }
.slot-meta { font-size: 9px; color: var(--text-muted); }
.slot-hint { font-size: 9.5px; color: var(--accent-gold); margin-top: 5px; line-height: 1.4; font-style: italic; }

/* ---------- Shop cross-sell ---------- */
.shop-block {
  margin-top: 30px; padding-top: 22px;
  border-top: 1px solid var(--border-glass);
}
.shop-blurb { font-size: 11.5px; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.shop-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.shop-item {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: var(--radius-md); overflow: hidden;
  display: flex; flex-direction: column; text-align: left;
  transition: var(--transition);
}
.shop-item:hover { border-color: var(--accent-gold); }
.shop-item img { width: 100%; height: 96px; object-fit: cover; display: block; }
.shop-item-body { padding: 10px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.shop-tag {
  align-self: flex-start; font-size: 8px; font-weight: 800; letter-spacing: 1px;
  color: var(--accent-cyan); background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 2px 7px; border-radius: var(--radius-full);
}
.shop-name { font-size: 12px; font-weight: 700; color: #fff; line-height: 1.3; }
.shop-desc { font-size: 10px; color: var(--text-muted); line-height: 1.45; flex: 1; }
.shop-link {
  display: block; text-align: center; text-decoration: none;
  font-size: 10.5px; font-weight: 700;
  background: rgba(255, 215, 0, 0.15); color: var(--accent-gold);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-sm); padding: 9px; min-height: 38px;
  line-height: 20px; margin-top: 4px;
}
.shop-link:hover { background: var(--accent-gold); color: #000; }

.review-cta {
  background: rgba(255, 215, 0, 0.07);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 14px; font-size: 11px; line-height: 1.6;
  color: var(--text-muted); margin-bottom: 20px;
}
.review-stars { font-size: 16px; letter-spacing: 3px; color: var(--accent-gold); display: block; margin-bottom: 8px; }
.review-cta a { color: var(--accent-gold); font-weight: 700; }

.ending-actions { display: flex; flex-direction: column; gap: 8px; max-width: 380px; margin: 0 auto; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* --- TABLET PORTRAIT & LARGE PHONE LANDSCAPE: bring back the phone frame --- */
@media (min-width: 768px) {
  body { padding: 24px; }

  .device-wrapper {
    max-width: 480px;
    height: min(940px, calc(100dvh - 48px));
    border-radius: 44px;
    border: 4px solid #2a3245;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(255, 42, 85, 0.18);
  }

  .phone-notch {
    display: block;
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 116px; height: 17px; background: #000;
    border-bottom-left-radius: 11px; border-bottom-right-radius: 11px;
    z-index: 70;
  }

  .phone-header-bar { padding-top: 0; height: 42px; }
  .toast-host { bottom: calc(var(--nav-h) + 18px); }
}

/* --- TABLET LANDSCAPE / DESKTOP: two panes --- */
@media (min-width: 1024px) and (orientation: landscape) {
  .device-wrapper.tablet-mode {
    max-width: 1040px;
    height: min(770px, calc(100dvh - 56px));
    border-radius: 28px;
  }
  .device-wrapper.tablet-mode .phone-notch { display: none; }

  /* Nav becomes a left rail; .os-main keeps HUD-above-panels intact. */
  .device-wrapper.tablet-mode #view-os { flex-direction: row; }
  .device-wrapper.tablet-mode .os-navbar {
    order: -1;
    flex-direction: column; justify-content: flex-start;
    width: 84px; height: 100%;
    padding: 14px 0 var(--safe-b);
    gap: 4px;
    border-top: 0; border-right: 1px solid var(--border-glass);
  }
  .device-wrapper.tablet-mode .nav-item { width: 100%; padding: 11px 4px; }

  .device-wrapper.tablet-mode .map-grid { grid-template-columns: repeat(3, 1fr); }
  .device-wrapper.tablet-mode .map-stage { max-width: 400px; margin: 0 auto; }
  .device-wrapper.tablet-mode .toast-host { bottom: 18px; }
  .device-wrapper.tablet-mode .ending-scroll { padding-left: 40px; padding-right: 40px; }

  /* Chat gets a comfortable measure instead of stretching the full width. */
  .device-wrapper.tablet-mode .thread-list,
  .device-wrapper.tablet-mode .single-chat,
  .device-wrapper.tablet-mode .puzzle-box,
  .device-wrapper.tablet-mode .evidence-list,
  .device-wrapper.tablet-mode .dossier-list { max-width: 620px; width: 100%; margin: 0 auto; }
}

@media (min-width: 1180px) {
  .device-wrapper.full-mode {
    max-width: 1180px;
    height: min(830px, 90dvh);
    border-radius: 18px;
  }
}

/* Wide screens: the ending page gets room to breathe */
@media (min-width: 640px) {
  .endings-gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

/* --- Short viewports (landscape phones) --- */
@media (max-height: 520px) and (orientation: landscape) {
  .main-title { font-size: 22px; }
  .mode-desc { display: none; }
  .caller-avatar { width: 68px; height: 68px; }
  .caller-video { max-height: 40vh; }
  .scene-video { max-height: 38vh; }
}

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* ==========================================================================
   ENGINE-RENDERED COMPONENTS
   js/app.js builds most of the DOM at runtime. Everything below styles the
   class vocabulary it emits. Accent is threaded through a --accent custom
   property so components stay generic.
   ========================================================================== */

.device-wrapper { --accent: var(--accent-cyan); }
.accent-crimson { --accent: var(--accent-crimson); }
.accent-cyan    { --accent: var(--accent-cyan); }
.accent-gold    { --accent: var(--accent-gold); }
.accent-muted   { --accent: var(--text-muted); }

.empty-state {
  padding: 28px 16px; text-align: center;
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
}
.boot-error {
  margin: 20px; padding: 16px; border-radius: var(--radius-md);
  background: rgba(255, 42, 85, 0.14); border: 1px solid var(--accent-crimson);
  font-size: 12px; line-height: 1.6;
}

.btn-secondary, .btn-resume, .btn-advance, .btn-vote,
.btn-accuse, .btn-decrypt, .btn-hint {
  font-family: inherit; font-weight: 700; font-size: 13px;
  padding: 12px 16px; min-height: 46px; width: 100%;
  border-radius: var(--radius-md); transition: var(--transition);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-glass); color: var(--text-main);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.13); }
.btn-primary.is-secondary {
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border-glass);
  color: var(--text-main); box-shadow: none;
}
.btn-resume { background: linear-gradient(135deg, var(--accent-gold) 0%, #d4a300 100%); color: #17130a; }
.btn-advance { background: var(--accent-green); color: #04140a; margin-top: 12px; }
.btn-accuse { background: linear-gradient(135deg, var(--accent-crimson) 0%, #d61a42 100%); color: #fff; }
.btn-decrypt { background: var(--accent-cyan); color: #04121a; }
.btn-hint {
  background: rgba(255, 215, 0, 0.14); border: 1px solid rgba(255, 215, 0, 0.45);
  color: var(--accent-gold); margin-top: 8px;
}
.btn-vote {
  background: rgba(255, 42, 85, 0.18); border: 1px solid var(--accent-crimson);
  color: #fff; font-size: 11px; letter-spacing: 1px;
  min-height: 38px; padding: 8px 14px; width: auto;
}
.icon-btn.is-muted { opacity: 0.5; }

/* ---------- HUD ---------- */
.affinity-row { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; }
.affinity-name { color: var(--text-muted); }
.affinity-val { color: var(--accent); font-family: var(--font-code); min-width: 26px; text-align: right; }
.affinity-track { width: 46px; height: 4px; border-radius: var(--radius-full); background: rgba(255,255,255,0.14); overflow: hidden; }
.affinity-fill { height: 100%; border-radius: var(--radius-full); background: var(--accent); transition: width 0.5s ease; }

.objective-row { display: flex; align-items: flex-start; gap: 6px; font-size: 10px; color: var(--text-muted); line-height: 1.45; }
.objective-mark { flex: 0 0 auto; color: var(--accent-cyan); }
.objective-row.is-done { color: var(--accent-green); opacity: 0.75; }
.objective-row.is-done .objective-label { text-decoration: line-through; }
.objective-brief { font-size: 10px; color: var(--text-muted); font-style: italic; margin-bottom: 4px; line-height: 1.5; }

.chapter-chip { display: inline-flex; align-items: baseline; gap: 6px; max-width: 62vw; overflow: hidden; }
.chip-act { color: var(--accent-crimson); font-weight: 800; flex: 0 0 auto; }
.chip-title { color: var(--accent-cyan); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-count { color: var(--text-muted); flex: 0 0 auto; }

/* ---------- Chat threads ---------- */
.chat-thread-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-left: 3px solid var(--accent);
  padding: 12px; border-radius: var(--radius-md);
  text-align: left; width: 100%; transition: var(--transition); margin-bottom: 8px;
}
.chat-thread-card:hover { border-color: var(--accent); }
.chat-thread-card.is-unread { background: rgba(255, 42, 85, 0.09); }
.chat-thread-card.is-done { opacity: 0.72; }
.chat-thread-info { flex: 1; min-width: 0; }
.chat-thread-name {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  font-weight: 700; font-size: 13px; color: #fff; margin-bottom: 2px;
}
.thread-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread-time { font-size: 10px; color: var(--text-muted); font-weight: 500; flex: 0 0 auto; }
.chat-thread-snippet { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent-crimson); box-shadow: 0 0 8px var(--accent-crimson);
  animation: pulseDot 1.6s ease-in-out infinite;
}

/* ---------- Open conversation ---------- */
.single-chat { display: none; flex-direction: column; flex: 1; min-height: 0; }
body.chat-open .single-chat { display: flex; }

.chat-open-header {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border-glass); flex: 0 0 auto;
}
.chat-open-header:empty { display: none; }
.chat-open-meta { min-width: 0; }
.chat-open-name { font-weight: 700; font-size: 13px; color: #fff; }
.chat-open-sub { font-size: 9px; color: var(--accent-cyan); letter-spacing: 1px; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-glass); flex: 0 0 auto; }
.avatar-redacted { background: #0d1118; }

.bubble-who { display: block; font-size: 9px; opacity: 0.65; margin-bottom: 3px; font-weight: 700; letter-spacing: 0.5px; }
.bubble-text { display: block; }

/* ---------- Map ---------- */
.map-base { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* The plate is 1100x1970. Locking the stage to that ratio makes the pin
   percentages line up with the drawn landmarks instead of a cropped view. */
.map-stage { position: relative; aspect-ratio: 1100 / 1970; min-height: 0; }
.map-hotspot .hotspot-dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.map-hotspot .hotspot-pulse { border-color: var(--accent); }
.map-hotspot.is-locked { cursor: not-allowed; }
.map-hotspot.is-locked .hotspot-dot { background: rgba(120,135,150,0.65); border-color: rgba(255,255,255,0.35); box-shadow: none; }
.map-hotspot.is-locked .hotspot-pulse { display: none; }
.map-hotspot.is-searched .hotspot-dot { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.map-hotspot.is-searched .hotspot-pulse { display: none; }

.map-card { display: block; }
.map-card-thumb { position: absolute; inset: 0; }
.map-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-card-flag {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(0,0,0,0.82); border: 1px solid var(--border-glass);
  color: var(--text-muted); font-size: 8px; font-weight: 800;
  padding: 3px 7px; border-radius: 4px;
}
.map-card.is-locked { opacity: 0.55; cursor: not-allowed; }
.map-card.is-searched .map-card-flag { color: var(--accent-green); border-color: rgba(52,199,89,0.5); }

/* ---------- Cipher bench ---------- */
.cipher-ciphertext {
  background: rgba(0,0,0,0.5); border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 14px; text-align: center;
}
.cipher-string {
  font-family: var(--font-code); font-size: 15px; font-weight: 700;
  letter-spacing: 4px; color: var(--accent-gold); word-break: break-word; line-height: 1.7;
}
.cipher-wheels-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cipher-controls { display: flex; align-items: center; justify-content: center; gap: 12px; }
.cipher-rotate-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,215,0,0.16); border: 1px solid var(--accent-gold);
  color: var(--accent-gold); font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.cipher-rotate-btn:hover { background: var(--accent-gold); color: #000; }
.cipher-shift-readout {
  font-family: var(--font-code); font-size: 14px; color: var(--accent-gold);
  font-weight: 700; min-width: 66px; text-align: center;
}

.outer-ring, .inner-ring {
  background: rgba(0,0,0,0.7); border: 1px solid var(--border-glass);
  border-radius: var(--radius-md); padding: 8px 10px;
  text-align: center; overflow: hidden; width: 100%;
}
.outer-ring { border-color: rgba(255,215,0,0.6); }
.inner-ring { border-color: rgba(0,240,255,0.4); }
.ring-letters-horizontal {
  display: block; font-family: var(--font-code);
  font-size: 11px; font-weight: 700; letter-spacing: 2.5px;
  white-space: nowrap; overflow-x: auto; padding: 4px 0; scrollbar-width: none;
}
.ring-letters-horizontal::-webkit-scrollbar { display: none; }
.outer-ring .ring-letters-horizontal { color: var(--accent-gold); }
.inner-ring .ring-letters-horizontal { color: var(--accent-cyan); }

.cipher-align-note { font-size: 10px; color: var(--text-muted); margin: 8px 0; line-height: 1.5; }
.cipher-align-note.is-aligned { color: var(--accent-green); font-weight: 700; }
.puzzle-box.is-locked { opacity: 0.75; text-align: center; }
.puzzle-gate { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; margin-top: 8px; }
.puzzle-duo-note {
  font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--accent-cyan);
  background: rgba(0,240,255,0.1); border: 1px solid rgba(0,240,255,0.3);
  padding: 7px 10px; border-radius: var(--radius-sm); margin-bottom: 12px;
}
.puzzle-solved { color: var(--accent-green); font-weight: 700; font-size: 12px; margin-top: 10px; }
.hint-block { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.hint-row {
  font-size: 10.5px; color: var(--accent-gold); text-align: left; line-height: 1.5;
  background: rgba(255,215,0,0.09); border: 1px solid rgba(255,215,0,0.3);
  padding: 8px 10px; border-radius: var(--radius-sm);
}
.is-bad { color: var(--accent-crimson) !important; }

/* ---------- Evidence / dossiers ---------- */
.evidence-thumb { width: 68px; height: 68px; flex: 0 0 auto; border-radius: var(--radius-sm); object-fit: cover; background: #000; }
.evidence-card.is-locked { opacity: 0.5; cursor: not-allowed; }

.dossier-card { border-left: 3px solid var(--accent); }
.dossier-card.kind-ally    { --accent: var(--accent-cyan); }
.dossier-card.kind-suspect { --accent: var(--accent-crimson); }
.dossier-card.kind-rival   { --accent: var(--accent-gold); }
.dossier-card.kind-victim  { --accent: var(--text-muted); }
.dossier-card.is-locked { opacity: 0.55; cursor: not-allowed; }
.dossier-img { width: 54px; height: 54px; flex: 0 0 auto; border-radius: var(--radius-sm); object-fit: cover; background: #000; }
.dossier-info { flex: 1; min-width: 0; }

.field-blackbar {
  font-family: var(--font-code); color: transparent; background: #0d1118;
  border-radius: 3px; letter-spacing: 1px; user-select: none;
  display: inline-block; padding: 1px 4px; line-height: 1.6;
}
.field-gate { font-size: 9px; color: var(--text-muted); letter-spacing: 1px; margin-top: 4px; }

/* ---------- Modal cards ---------- */
.modal-card {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg); padding: 18px;
  width: 100%; max-width: 380px; position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.85);
  max-height: 100%; overflow-y: auto; margin: auto;
}
.modal-card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.modal-card-title { font-family: var(--font-title); font-size: 16px; color: var(--accent-cyan); flex: 1; line-height: 1.25; }
.modal-card-tag { font-size: 9.5px; color: var(--accent-gold); font-weight: 700; letter-spacing: 0.5px; margin-bottom: 10px; }
.modal-card-body { display: flex; flex-direction: column; gap: 10px; }
.modal-close-btn {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: 1px solid var(--border-glass);
  color: #fff; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.modal-hero {
  width: 100%; max-height: 180px; object-fit: cover;
  border-radius: var(--radius-md); border: 1px solid var(--border-glass);
  margin-bottom: 12px; display: block; background: #000;
}
.modal-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.6; }
.section-label { font-size: 10.5px; font-weight: 800; color: #fff; letter-spacing: 0.5px; margin-top: 6px; }

.clue-row {
  font-size: 11px; line-height: 1.5;
  background: rgba(0,0,0,0.5); padding: 8px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-glass);
  border-left: 3px solid var(--accent);
}
.clue-owner { display: block; font-size: 8.5px; font-weight: 800; letter-spacing: 1px; color: var(--accent-cyan); margin-bottom: 3px; }

/* ---------- Call ---------- */
.call-card { text-align: center; width: 100%; max-width: 340px; margin: auto; }
.caller-avatar-large {
  width: 106px; height: 106px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--accent-crimson); box-shadow: var(--shadow-glow);
  margin: 0 auto 14px; display: block;
}
.call-ringing .caller-avatar-large { animation: callPulse 1.6s ease-in-out infinite; }
.audio-wave-container { display: flex; gap: 5px; align-items: center; justify-content: center; height: 34px; margin: 14px 0; }
.wave-bar { width: 4px; height: 8px; background: var(--accent-cyan); border-radius: 2px; animation: wavePulse 1s ease-in-out infinite alternate; }
.wave-bar:nth-child(2) { animation-delay: 0.2s; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; }
.wave-bar:nth-child(4) { animation-delay: 0.6s; }
.wave-bar:nth-child(5) { animation-delay: 0.8s; }
.transcript-tag { display: block; font-size: 9px; font-weight: 800; letter-spacing: 1px; color: var(--accent-cyan); margin-bottom: 5px; }
.call-missed-note { font-size: 11.5px; color: var(--text-muted); font-style: italic; margin-top: 12px; }
.call-card .live { color: var(--accent-green); }
.call-video { width: 100%; max-width: 230px; margin: 0 auto; }

/* ---------- Media: tap to play, never autoplay ---------- */
.media-tap-wrap { position: relative; width: 100%; max-width: 260px; margin: 0 auto 10px; }
.media-tap-btn {
  width: 100%; padding: 12px; min-height: 46px;
  background: rgba(0,240,255,0.14); border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan); border-radius: var(--radius-md);
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
}
.media-tap-btn:hover { background: var(--accent-cyan); color: #04121a; }
.media-audio-btn {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 8px; padding: 9px 13px; min-height: 40px;
  background: rgba(255,42,85,0.2); border: 1px solid var(--accent-crimson);
  border-radius: var(--radius-full); font-size: 10px; font-weight: 700; color: #fff;
}

/* ---------- Lightbox ---------- */
.lightbox-wrap { position: relative; max-width: 100%; text-align: center; margin: auto; }
.lightbox-img { max-width: 100%; max-height: 76vh; object-fit: contain; border-radius: 12px; border: 2px solid var(--accent-cyan); }

/* ---------- Toasts ---------- */
.toast-info { border-left-color: var(--accent-cyan); }
.toast-good { border-left-color: var(--accent-green); }
.toast-warn { border-left-color: var(--accent-gold); }
.toast-bad  { border-left-color: var(--accent-crimson); }
.toast-out { animation: toastOut 0.25s ease forwards; }

/* ---------- Accusation ---------- */
.accusation-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.accusation-strikes { display: flex; gap: 6px; align-items: center; font-size: 10px; color: var(--text-muted); margin-bottom: 10px; }
.accusation-result { font-size: 11.5px; font-weight: 600; line-height: 1.6; margin-top: 10px; }
.accusation-locked { font-size: 11px; color: var(--text-muted); text-align: center; padding: 16px; line-height: 1.6; }
.accusation-form:empty { display: none; }

/* ---------- Co-op ---------- */
.coop-bar:empty { display: none; }
.coop-channel {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; min-height: 34px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06); border: 1px solid var(--border-glass);
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px; color: var(--text-muted);
}
.coop-channel.is-route, .coop-channel.active {
  border-color: var(--accent); color: var(--accent); background: rgba(255,255,255,0.1);
}
.coop-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.coop-label { white-space: nowrap; }

.vote-prompt { font-family: var(--font-title); font-size: 16px; color: #fff; line-height: 1.3; margin-bottom: 12px; }
.vote-option-text { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.45; }
.vote-option-arg { display: block; font-size: 10.5px; font-weight: 400; color: var(--text-muted); margin-top: 5px; line-height: 1.5; }
.handoff-text { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; }

/* ---------- Case log ---------- */
.log-row { display: flex; gap: 8px; font-size: 11px; line-height: 1.5; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.log-label { flex: 0 0 auto; color: var(--accent-cyan); font-weight: 700; font-family: var(--font-code); font-size: 10px; }
.log-value { color: var(--text-muted); }

/* ---------- Ending ---------- */
.ending-hero {
  width: 100%; max-width: 320px; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius-lg); border: 1px solid var(--border-glass);
  margin: 0 auto 16px; display: block;
}
.ending-prose { text-align: left; max-width: 480px; margin: 0 auto 22px; }
.ending-prose p { font-size: 13px; line-height: 1.75; margin-bottom: 14px; }
.ending-badge.tier-good { color: var(--accent-green); border-color: var(--accent-green); background: rgba(52,199,89,0.12); }
.ending-badge.tier-bittersweet { color: var(--accent-gold); border-color: var(--accent-gold); background: rgba(255,215,0,0.12); }
.ending-badge.tier-tragic { color: var(--accent-crimson); border-color: var(--accent-crimson); background: rgba(255,42,85,0.12); }
.ending-badge.tier-secret { color: var(--accent-cyan); border-color: var(--accent-cyan); background: rgba(0,240,255,0.12); }

.ending-stat {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: var(--radius-md); padding: 10px 14px; min-width: 92px;
  display: flex; flex-direction: column-reverse; gap: 2px;
}
.stat-v { font-family: var(--font-code); font-size: 17px; font-weight: 700; color: var(--accent-gold); }
.stat-k { font-size: 8.5px; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; }

.gallery-head {
  font-family: var(--font-title); font-size: 13px; letter-spacing: 1px;
  color: var(--accent-cyan); text-align: center; margin: 22px 0 12px; grid-column: 1 / -1;
}
.ending-card {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: var(--radius-md); overflow: hidden; text-align: left;
  display: flex; flex-direction: column;
}
.ending-card.is-found { border-color: rgba(255,215,0,0.55); }
.ending-card.is-locked { opacity: 0.6; }
.ending-card-thumb { height: 74px; background: #0a0e15; position: relative; overflow: hidden; }
.ending-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ending-card-info { padding: 9px 10px; display: flex; flex-direction: column; gap: 3px; }
.ending-card-title { font-size: 11px; font-weight: 700; color: #fff; line-height: 1.3; }
.ending-card-sub { font-size: 9px; color: var(--text-muted); line-height: 1.45; }
.redact-block {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, #10151f 0 22px, #0a0e15 22px 30px), #0d1118;
}
.redact-block::after {
  content: '\1F512'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; opacity: 0.5;
}

/* ---------- Shop cross-sell ---------- */
.shop-heading {
  font-family: var(--font-title); font-size: 15px; letter-spacing: 1px;
  color: var(--accent-gold); text-align: center; margin-bottom: 8px;
}
.shop-products {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.shop-card {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: var(--radius-md); overflow: hidden;
  display: flex; flex-direction: column; text-decoration: none;
  color: inherit; transition: var(--transition);
}
.shop-card:hover { border-color: var(--accent-gold); }
.shop-img { width: 100%; height: 94px; object-fit: cover; display: block; }
.shop-info { padding: 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.shop-all-link {
  display: block; text-align: center; text-decoration: none;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  background: rgba(255,215,0,0.15); color: var(--accent-gold);
  border: 1px solid rgba(255,215,0,0.4);
  border-radius: var(--radius-md); padding: 13px; min-height: 46px; margin-bottom: 14px;
}
.shop-all-link:hover { background: var(--accent-gold); color: #000; }
.shop-review-cta {
  background: rgba(255,215,0,0.07); border: 1px solid rgba(255,215,0,0.3);
  border-radius: var(--radius-md); padding: 14px;
  font-size: 11px; line-height: 1.6; color: var(--text-muted); text-align: center;
}

.coop-bar.is-solo:empty { display: none; }

/* ==========================================================================
   VIEW-SCOPED CORRECTIONS
   The engine stamps body[data-view]; use it so chrome that only makes sense
   inside the Bureau OS doesn't bleed onto the title or ending screens.
   ========================================================================== */

/* Only the OS has a bottom nav — elsewhere the toast stack must sit lower,
   otherwise it floats into the middle of the ending prose. */
body[data-view="view-title"] .toast-host,
body[data-view="view-opening"] .toast-host,
body[data-view="view-ending"] .toast-host { bottom: calc(var(--safe-b) + 16px); }

/* A chapter counter on the title/ending screens is meaningless. */
body[data-view="view-title"] .chapter-chip,
body[data-view="view-ending"] .chapter-chip { display: none; }

/* Keep the toast stack short and out of the way on small screens. */
.toast-host { max-height: 40vh; overflow: hidden; }

/* Voice-only calls expose a real audio control alongside the portrait. */
.call-audio {
  width: 100%;
  max-width: 280px;
  margin: 12px auto 0;
  display: block;
  filter: invert(0.92) hue-rotate(180deg);
}

/* ---------- Opening briefing (auto-plays on BEGIN) ---------- */
.media-tap-wrap.intro-video { max-width: 300px; margin-bottom: 6px; text-align: center; }
.intro-video .media-video { height: 42vh; width: auto; margin: 0 auto; }
.video-caption-static {
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  color: var(--accent-cyan); text-align: center; margin-bottom: 10px;
}
.speaker-meta { min-width: 0; }
#openingSpeaker:empty { display: none; }
