/* ============================================================================
   COLLECTIVE MEMORY v5.0 — Stylesheet
   Cinematic immersive documentary experience
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,500;0,9..40,700;0,9..40,900;1,9..40,300&family=DM+Serif+Display&display=swap');

:root {
  --primary: #4285f4;
  --secondary: #00ffff;
  --accent: #FFD700;
  --connection: #4ECDC4;
  --dark: #000000;
  --text: #ffffff;
  --overlay: rgba(0, 0, 0, 0.78);
  --glass: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --hotspot-glow: rgba(255, 215, 0, 0.6);
  --radius: 14px;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'DM Serif Display', Georgia, serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

body {
  font-family: var(--font-body);
  background: var(--dark);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app { width: 100vw; height: 100vh; position: relative; overflow: hidden; }


/* ══════════════════════════════════════════════════════════════════════════════
   WELCOME SCREEN
   ══════════════════════════════════════════════════════════════════════════════ */

#welcome {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1040 50%, #0d0d2b 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  transition: opacity 1.4s var(--ease-out);
  overflow: hidden;
}
#welcome.hidden { opacity: 0; pointer-events: none; }

.welcome-bg-video {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.25;
  z-index: 0;
  pointer-events: none;
  filter: saturate(0.7);
}

.welcome-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    135deg,
    rgba(10, 10, 26, 0.88) 0%,
    rgba(26, 16, 64, 0.82) 50%,
    rgba(13, 13, 43, 0.88) 100%
  );
  z-index: 1;
}

.welcome-content {
  position: relative; z-index: 2;
  text-align: center;
  max-width: 720px; width: 90%;
  padding: 40px 20px;
  animation: welcomeFadeIn 1.8s var(--ease-out);
}

@keyframes welcomeFadeIn {
  from { opacity: 0; transform: translateY(40px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.title {
  font-family: var(--font-display);
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 400;
  margin-bottom: 16px;
  background: linear-gradient(160deg, #fff 30%, var(--secondary) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  line-height: 1.1;
}

.subtitle {
  font-size: clamp(14px, 2.2vw, 20px);
  opacity: 0.75;
  margin-bottom: 28px;
  letter-spacing: 8px;
  text-transform: uppercase;
  font-weight: 300;
}

.description {
  font-size: clamp(15px, 1.8vw, 18px);
  line-height: 1.85;
  opacity: 0.8;
  margin-bottom: 36px;
  font-weight: 300;
  max-width: 560px;
  margin-left: auto; margin-right: auto;
}

/* Welcome Loading Bar — thin, elegant */
.welcome-loading-container {
  width: 100%; max-width: 320px;
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 20px auto;
  border-radius: 1px;
  overflow: hidden;
}
.welcome-loading-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--connection), var(--primary), #a78bfa);
  width: 0%;
  transition: width 0.5s ease-out;
  border-radius: 1px;
}

.btn-start {
  padding: 20px 56px;
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 700;
  background: linear-gradient(135deg, rgba(66,133,244,0.5), rgba(30,64,175,0.5));
  border: 1.5px solid rgba(66,133,244,0.5);
  border-radius: 50px;
  color: white; cursor: pointer;
  transition: all 0.5s var(--ease-out);
  box-shadow: 0 8px 40px rgba(66,133,244,0.35);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-family: var(--font-body);
  touch-action: manipulation;
  animation: gentlePulse 4s ease-in-out infinite;
  backdrop-filter: blur(12px);
}
@keyframes gentlePulse {
  0%, 100% { box-shadow: 0 8px 40px rgba(66,133,244,0.35); }
  50%      { box-shadow: 0 12px 50px rgba(66,133,244,0.5); }
}
.btn-start:hover, .btn-start:active {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 50px rgba(66,133,244,0.55);
  border-color: rgba(66,133,244,0.8);
  animation: none;
}

.welcome-note {
  margin-top: 16px;
  font-size: clamp(12px, 1.4vw, 14px);
  opacity: 0.55;
}


/* ══════════════════════════════════════════════════════════════════════════════
   LOADING
   ══════════════════════════════════════════════════════════════════════════════ */

#loading {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.98);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 250;
  transition: opacity 1s var(--ease-out);
}
#loading.hidden { opacity: 0; pointer-events: none; }

.loading-bar-container {
  width: 240px; height: 1.5px;
  background: rgba(255,255,255,0.08);
  border-radius: 1px; overflow: hidden;
}
.loading-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--connection), var(--primary), #a78bfa);
  width: 0%;
  transition: width 0.3s ease-out;
}
.loading-text {
  margin-top: 20px;
  font-size: 13px; opacity: 0.5;
  letter-spacing: 3px;
  animation: breathe 2.5s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.3; } }


/* ══════════════════════════════════════════════════════════════════════════════
   INTRO VIDEO
   ══════════════════════════════════════════════════════════════════════════════ */

#intro-layer {
  position: fixed; inset: 0;
  background: #000;
  display: none; align-items: center; justify-content: center;
  z-index: 200; opacity: 0;
  transition: opacity 1.2s;
}
#intro-layer.active { display: flex; }
#intro-layer.visible { opacity: 1; }
#intro-video { width: 100%; height: 100%; object-fit: cover; }

.video-controls-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: clamp(14px, 3vw, 24px);
  background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, transparent 100%);
  display: flex; align-items: center; gap: clamp(8px, 2vw, 14px);
  opacity: 0; transition: opacity 0.3s;
}
#intro-layer:hover .video-controls-overlay { opacity: 1; }

.video-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all 0.3s var(--ease-out);
  flex-shrink: 0; touch-action: manipulation;
}
.video-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.1); }
.video-btn-large { width: 48px !important; height: 48px !important; font-size: 18px !important; }

.video-timeline {
  flex: 1; height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px; cursor: pointer;
  overflow: hidden; touch-action: manipulation;
}
.video-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
  border-radius: 2px; width: 0%;
  transition: width 0.1s linear;
}
.video-time {
  font-size: 12px; color: white;
  white-space: nowrap; min-width: 80px;
  text-align: right; font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.btn-skip {
  position: absolute;
  bottom: clamp(24px, 5vw, 36px);
  right: clamp(24px, 5vw, 36px);
  padding: 14px 30px;
  background: rgba(0,0,0,0.85);
  border: 1.5px solid rgba(255,215,0,0.5);
  border-radius: 30px;
  color: white; cursor: pointer;
  font-size: clamp(13px, 2vw, 15px);
  font-weight: 600;
  backdrop-filter: blur(12px);
  transition: all 0.3s var(--ease-out);
  z-index: 10; letter-spacing: 1px;
  font-family: var(--font-body);
  touch-action: manipulation;
}
.btn-skip:hover { border-color: var(--accent); transform: translateX(-4px); }


/* ══════════════════════════════════════════════════════════════════════════════
   CANVAS
   ══════════════════════════════════════════════════════════════════════════════ */

#canvas {
  width: 100%; height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  position: absolute; top: 0; left: 0;
}
#canvas:active { cursor: grabbing; }


/* ══════════════════════════════════════════════════════════════════════════════
   LOCATION OVERLAY — ethereal text in 360 space
   ══════════════════════════════════════════════════════════════════════════════ */

.location-overlay {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none; z-index: 90;
  text-align: center;
  opacity: 0;
  transition: opacity 2s ease-in-out;
}
.location-overlay.visible { opacity: 1; }
.location-overlay.hidden { display: none; }

.location-text {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 400;
  letter-spacing: 6px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 8px;
  text-shadow: 0 0 30px rgba(0,0,0,0.8);
}
.location-date {
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 300;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.4);
  font-style: italic;
}


/* ══════════════════════════════════════════════════════════════════════════════
   UI OVERLAY
   ══════════════════════════════════════════════════════════════════════════════ */

#ui {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100;
  opacity: 0; transition: opacity 0.8s var(--ease-out);
}
#ui.visible { opacity: 1; }


/* ── Top Bar ──────────────────────────────────────────────────────────────── */

#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  padding: clamp(10px, 2vw, 18px) clamp(14px, 3vw, 28px);
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
  display: flex; justify-content: space-between; align-items: center;
  pointer-events: auto;
  backdrop-filter: blur(16px);
  flex-wrap: wrap; gap: clamp(8px, 2vw, 14px);
}

.title-area {
  display: flex; align-items: center;
  gap: clamp(10px, 2vw, 16px);
  flex: 1; min-width: 0;
}

.badge {
  padding: 5px 12px;
  background: rgba(66,133,244,0.15);
  border: 1px solid rgba(66,133,244,0.3);
  border-radius: 20px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap; flex-shrink: 0;
}

.scene-info { flex: 1; min-width: 0; overflow: hidden; }
.scene-title {
  font-family: var(--font-display);
  font-size: clamp(16px, 2.5vw, 24px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scene-subtitle {
  font-size: clamp(11px, 1.6vw, 12px);
  opacity: 0.6; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#breadcrumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; opacity: 0.5; margin-top: 6px;
  flex-wrap: wrap;
}
.breadcrumb {
  cursor: pointer; transition: all 0.3s;
  padding: 2px 6px; border-radius: 4px;
  touch-action: manipulation;
}
.breadcrumb:hover { opacity: 1; background: rgba(255,255,255,0.1); }
.breadcrumb-separator { opacity: 0.3; }

.controls {
  display: flex; gap: clamp(5px, 1.2vw, 8px);
  flex-wrap: wrap; justify-content: flex-end;
}

.btn {
  padding: clamp(7px, 1.5vw, 9px) clamp(14px, 3vw, 18px);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  color: white; cursor: pointer;
  font-size: clamp(11px, 1.8vw, 12px);
  font-weight: 600;
  backdrop-filter: blur(16px);
  transition: all 0.3s var(--ease-out);
  font-family: var(--font-body);
  white-space: nowrap; touch-action: manipulation;
}
.btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.25); transform: translateY(-1px); }
.btn-exit { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); }
.btn-exit:hover { background: rgba(239,68,68,0.25); }
.btn-mobile-icon { min-width: 38px; text-align: center; }


/* ══════════════════════════════════════════════════════════════════════════════
   PANELS (Audio, Video, Connections, Tracker)
   ══════════════════════════════════════════════════════════════════════════════ */

.panel {
  position: absolute;
  background: var(--overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  backdrop-filter: blur(24px);
  pointer-events: auto;
  transition: all 0.4s var(--ease-out);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  max-width: 90vw;
}
.panel.minimized { max-height: 46px !important; overflow: hidden; }
.panel.hidden { opacity: 0; transform: translateY(16px); pointer-events: none; }

.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; touch-action: manipulation;
}
.panel-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px; opacity: 0.8;
}
.panel-controls { display: flex; gap: 6px; }
.panel-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.08);
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s; font-size: 18px;
  touch-action: manipulation;
}
.panel-btn:hover { background: rgba(255,255,255,0.16); }
.panel-body { padding: 14px 18px; }
.panel-scroll-body {
  padding: 14px; max-height: clamp(280px, 45vh, 380px);
  overflow-y: auto; font-size: 13px; line-height: 1.6;
}
.panel-scroll-body::-webkit-scrollbar { width: 4px; }
.panel-scroll-body::-webkit-scrollbar-thumb { background: rgba(78,205,196,0.4); border-radius: 2px; }

/* Audio Controls */
#audio-controls { top: clamp(85px, 16vh, 105px); right: clamp(16px, 3vw, 30px); min-width: 200px; }
.audio-controls-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; justify-content: center; }
.audio-slider {
  width: 100%; -webkit-appearance: none;
  height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.15); outline: none; cursor: pointer;
}
.audio-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--secondary); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,255,255,0.3);
}
.volume-label { text-align: center; font-size: 11px; margin-top: 6px; opacity: 0.5; }

/* 360 Video Controls */
#video360-controls { top: clamp(190px, 32vh, 240px); right: clamp(16px, 3vw, 30px); min-width: 200px; }
.video-controls-row { display: flex; gap: 6px; margin-bottom: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.video-time-display { font-size: 11px; margin-top: 6px; text-align: center; opacity: 0.6; font-variant-numeric: tabular-nums; }

/* Connections Panel */
#connections-panel { top: clamp(85px, 16vh, 105px); right: clamp(240px, 42vw, 270px); min-width: 280px; max-width: 380px; }
.empty-state { opacity: 0.5; font-size: 13px; }

/* Journey Tracker */
#tracker { bottom: clamp(16px, 3vw, 28px); left: clamp(14px, 3vw, 24px); min-width: 200px; max-width: 260px; }
.stat { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; }
.stat:last-child { margin-bottom: 0; }
.stat-label { opacity: 0.7; font-weight: 500; font-size: 11px; }
.stat-value { font-weight: 800; color: var(--secondary); font-size: 17px; }


/* ══════════════════════════════════════════════════════════════════════════════
   TOOLTIP
   ══════════════════════════════════════════════════════════════════════════════ */

#tooltip {
  position: fixed;
  background: rgba(6, 6, 20, 0.96);
  padding: 18px 24px;
  border-radius: var(--radius);
  font-size: 13px;
  pointer-events: none; opacity: 0;
  transition: opacity 0.25s;
  border: 1.5px solid var(--hotspot-glow);
  backdrop-filter: blur(24px);
  z-index: 150;
  max-width: clamp(280px, 75vw, 400px);
  box-shadow: 0 12px 48px rgba(255,215,0,0.25);
}
#tooltip.visible { opacity: 1; }

.tooltip-icon { font-size: 28px; margin-bottom: 8px; text-align: center; }
.tooltip-title { font-family: var(--font-display); font-weight: 400; margin-bottom: 6px; font-size: 18px; text-align: center; }
.tooltip-subtitle { font-size: 12px; opacity: 0.7; margin-bottom: 10px; font-weight: 500; color: var(--secondary); text-align: center; }
.tooltip-preview { font-size: 13px; opacity: 0.85; margin-bottom: 10px; padding: 10px; background: rgba(255,255,255,0.04); border-radius: 8px; line-height: 1.5; }
.tooltip-hover-text { font-size: 12px; opacity: 0.7; font-style: italic; margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 10px; text-align: center; }


/* ══════════════════════════════════════════════════════════════════════════════
   AI CHAT
   ══════════════════════════════════════════════════════════════════════════════ */

#ai-panel {
  position: fixed;
  right: clamp(14px, 3vw, 24px);
  top: clamp(65px, 14vh, 85px);
  width: clamp(280px, 80vw, 360px);
  max-height: clamp(380px, 60vh, 520px);
  background: rgba(8, 12, 30, 0.96);
  border-radius: 18px;
  border: 1.5px solid rgba(58,155,220,0.25);
  display: flex; flex-direction: column;
  z-index: 180;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  transition: all 0.4s var(--ease-out);
  pointer-events: auto;
}
#ai-panel.hidden { opacity: 0; transform: translateX(110%); pointer-events: none; }
#ai-panel.minimized { max-height: 52px; overflow: hidden; }

.ai-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, #2a6a9a, #1c5278);
  border-radius: 16px 16px 0 0;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; flex-shrink: 0;
  touch-action: manipulation;
}
.ai-title { font-weight: 700; display: flex; align-items: center; gap: 8px; font-size: 13px; }

.ai-content {
  flex: 1; padding: 14px;
  overflow-y: auto; overflow-x: hidden;
  min-height: 160px; max-height: clamp(250px, 40vh, 360px);
  display: flex; flex-direction: column;
}
.ai-content::-webkit-scrollbar { width: 4px; }
.ai-content::-webkit-scrollbar-thumb { background: rgba(58,155,220,0.4); border-radius: 2px; }

.message {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 92%;
  animation: msgIn 0.35s var(--ease-out);
  line-height: 1.55; font-size: 13px;
  word-wrap: break-word; flex-shrink: 0;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.message.user { background: rgba(58,155,220,0.2); margin-left: auto; text-align: right; border: 1px solid rgba(58,155,220,0.2); }
.message.assistant { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); }
.message.thinking { background: rgba(255,193,7,0.12); color: #ffc107; border: 1px solid rgba(255,193,7,0.2); font-style: italic; }

.ai-input-row {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0; background: rgba(0,0,0,0.2);
}
.ai-input {
  flex: 1; padding: 10px 14px;
  border-radius: 22px;
  border: 1.5px solid rgba(58,155,220,0.2);
  background: rgba(0,0,0,0.3);
  color: white; outline: none;
  font-size: 13px; font-family: var(--font-body);
  transition: border-color 0.3s;
}
.ai-input:focus { border-color: rgba(58,155,220,0.5); }
.ai-input::placeholder { color: rgba(255,255,255,0.3); }

.ai-send {
  width: 40px; height: 40px; border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #3a9bdc, #1f6fa1);
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s; font-size: 16px;
  flex-shrink: 0; touch-action: manipulation;
}
.ai-send:hover { transform: scale(1.08); }
.ai-send:disabled { opacity: 0.4; cursor: not-allowed; }

#ai-toggle {
  position: fixed;
  right: clamp(16px, 3vw, 24px);
  bottom: clamp(160px, 28vh, 200px);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3a9bdc, #1f6fa1);
  border: none; color: white; cursor: pointer;
  z-index: 170; font-size: 24px;
  box-shadow: 0 6px 24px rgba(58,155,220,0.4);
  transition: all 0.3s;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto; touch-action: manipulation;
}
#ai-toggle:hover { transform: scale(1.1); }
#ai-toggle.hidden { opacity: 0; pointer-events: none; }


/* ══════════════════════════════════════════════════════════════════════════════
   MODALS — Full-screen cinematic
   ══════════════════════════════════════════════════════════════════════════════ */

#modal, #journey-modal, #about-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.97);
  display: none; align-items: center; justify-content: center;
  z-index: 190; pointer-events: auto;
  opacity: 0; transition: opacity 0.4s;
  overflow-y: auto; padding: 0;
}
#modal.active, #journey-modal.active, #about-modal.active { display: flex; opacity: 1; }

/* Video Modal */
.modal-content-fullscreen { position: fixed; inset: 0; background: #000; display: flex; align-items: center; justify-content: center; }
.modal-video-fullscreen { width: 100%; height: 100%; object-fit: contain; }

.close-btn-cinematic {
  position: fixed; top: clamp(16px, 3vw, 28px); right: clamp(16px, 3vw, 28px);
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(0,0,0,0.8);
  border: 2px solid rgba(255,255,255,0.4);
  color: white; cursor: pointer; font-size: 32px; font-weight: 200;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s; z-index: 200;
  backdrop-filter: blur(12px); touch-action: manipulation;
}
.close-btn-cinematic:hover { background: rgba(255,255,255,0.2); transform: rotate(90deg) scale(1.1); }

.back-to-lobby-btn {
  position: fixed; top: clamp(14px, 3vw, 24px); left: clamp(14px, 3vw, 24px);
  padding: 10px 20px;
  background: rgba(0,0,0,0.75); border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 28px; color: white; cursor: pointer;
  font-size: 13px; font-weight: 600;
  transition: all 0.3s; z-index: 200;
  backdrop-filter: blur(8px); font-family: var(--font-body);
  touch-action: manipulation;
}
.back-to-lobby-btn:hover { background: rgba(255,255,255,0.15); }

.minimize-metadata-btn {
  position: fixed; bottom: clamp(16px, 3vw, 28px); left: clamp(16px, 3vw, 28px);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,0.75);
  border: 1.5px solid rgba(78,205,196,0.4);
  color: white; cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s; z-index: 200;
  touch-action: manipulation;
}
.minimize-metadata-btn:hover { background: rgba(78,205,196,0.25); }

.modal-metadata-overlay {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.8) 70%, transparent 100%);
  padding: clamp(18px, 4vw, 28px);
  backdrop-filter: blur(16px);
  transition: transform 0.4s var(--ease-out);
  z-index: 195; max-height: 35vh; overflow: hidden;
}
.modal-metadata-overlay.minimized { transform: translateY(calc(100% - 36px)); pointer-events: none; }
.modal-metadata-overlay.minimized .metadata-content-cinematic { pointer-events: auto; }

.metadata-content-cinematic { max-width: 1100px; margin: 0 auto; max-height: 30vh; overflow-y: auto; }
.metadata-content-cinematic::-webkit-scrollbar { width: 0; }

.modal-title-cinematic { font-family: var(--font-display); font-size: clamp(20px, 4vw, 28px); margin-bottom: 10px; }
.modal-desc-cinematic { font-size: clamp(13px, 2vw, 15px); opacity: 0.8; margin-bottom: 16px; }
.modal-metadata-cinematic { font-size: 13px; line-height: 1.7; }

.btn-explore-connections-cinematic {
  margin-top: 16px; padding: 10px 24px;
  background: linear-gradient(135deg, var(--connection), #2a9d8f);
  border: none; border-radius: 24px;
  color: white; font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all 0.3s;
  font-family: var(--font-body); touch-action: manipulation;
}
.btn-explore-connections-cinematic:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(78,205,196,0.35); }

/* Close button shared */
.close-btn, .close-btn-visible {
  position: absolute; top: clamp(14px, 3vw, 20px); right: clamp(14px, 3vw, 20px);
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.25);
  color: white; cursor: pointer; font-size: 30px; font-weight: 200;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s; z-index: 10; touch-action: manipulation;
}
.close-btn:hover, .close-btn-visible:hover { background: rgba(255,255,255,0.2); transform: rotate(90deg); }


/* ── Journey Modal ────────────────────────────────────────────────────────── */

.journey-content {
  background: rgba(10, 18, 40, 0.98);
  border: 1.5px solid rgba(58,155,220,0.3);
  border-radius: 20px;
  padding: clamp(28px, 5vw, 44px);
  max-width: clamp(320px, 90vw, 800px); width: 92%;
  max-height: 86vh; overflow-y: auto;
  backdrop-filter: blur(20px);
}
.journey-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 4.5vw, 34px);
  margin-bottom: clamp(18px, 3.5vw, 26px);
  text-align: center;
  background: linear-gradient(160deg, #fff 30%, var(--secondary) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.journey-summary { font-size: clamp(14px, 2.2vw, 17px); line-height: 1.9; opacity: 0.9; margin-bottom: 24px; }
.journey-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(130px, 30vw, 170px), 1fr));
  gap: clamp(14px, 3vw, 20px);
  margin-top: 24px;
}
.stat-card {
  background: rgba(255,255,255,0.04); padding: 16px;
  border-radius: 12px; border: 1px solid var(--border-subtle);
  transition: all 0.3s;
}
.stat-card:hover { background: rgba(255,255,255,0.06); transform: translateY(-2px); }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; opacity: 0.5; margin-bottom: 8px; font-weight: 700; }
.stat-detail { font-size: 18px; font-weight: 700; color: var(--secondary); }

.btn-primary {
  padding: 13px 32px; font-size: 14px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #1e40af);
  border: none; border-radius: 28px; color: white; cursor: pointer;
  transition: all 0.3s; font-family: var(--font-body);
  box-shadow: 0 4px 16px rgba(66,133,244,0.3);
  touch-action: manipulation;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(66,133,244,0.5); }

.btn-secondary-large {
  padding: 13px 32px; font-size: 14px; font-weight: 600;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.25);
  border-radius: 28px; color: white; cursor: pointer;
  transition: all 0.3s; font-family: var(--font-body);
  touch-action: manipulation;
}
.btn-secondary-large:hover { background: rgba(255,255,255,0.15); }


/* ── About Modal ──────────────────────────────────────────────────────────── */

.about-content {
  background: rgba(10, 18, 40, 0.98);
  border: 1.5px solid rgba(58,155,220,0.3);
  border-radius: 20px;
  padding: clamp(28px, 5vw, 48px);
  max-width: clamp(320px, 90vw, 760px); width: 92%;
  max-height: 84vh; overflow-y: auto;
  backdrop-filter: blur(20px);
}
.about-content::-webkit-scrollbar { width: 6px; }
.about-content::-webkit-scrollbar-thumb { background: rgba(58,155,220,0.4); border-radius: 3px; }

.about-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 5vw, 34px);
  margin-bottom: 28px; text-align: center;
  background: linear-gradient(160deg, #fff 30%, var(--secondary) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.about-section { margin-bottom: 26px; line-height: 1.8; }
.about-section h3 {
  font-family: var(--font-display);
  font-size: clamp(17px, 3vw, 21px);
  margin-bottom: 12px; color: var(--secondary);
}
.about-section p { font-size: clamp(13px, 2vw, 15px); opacity: 0.85; margin-bottom: 12px; }
.about-footer {
  margin-top: 32px; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center; font-size: 13px; opacity: 0.6;
}

.download-about-btn-bottom {
  width: 100%; max-width: 320px;
  margin: 22px auto 0;
  height: 44px; padding: 0 20px;
  border-radius: 22px;
  background: rgba(78,205,196,0.12);
  border: 1.5px solid rgba(78,205,196,0.3);
  color: var(--connection); cursor: pointer;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.3s; touch-action: manipulation;
}
.download-about-btn-bottom:hover { background: rgba(78,205,196,0.2); transform: translateY(-1px); }
.download-about-btn-bottom svg { width: 16px; height: 16px; }


/* ══════════════════════════════════════════════════════════════════════════════
   CONTENT SIDEBAR
   ══════════════════════════════════════════════════════════════════════════════ */

.content-sidebar {
  position: fixed; right: -300px; top: 76px;
  width: 300px; max-height: calc(100vh - 96px);
  background: rgba(6, 6, 20, 0.96);
  backdrop-filter: blur(20px);
  border-left: 1.5px solid rgba(102,126,234,0.25);
  z-index: 300;
  transition: right 0.4s var(--ease-out);
  display: flex; flex-direction: column;
  pointer-events: auto !important;
}
.content-sidebar.open { right: 0; }

.sidebar-toggle {
  position: fixed !important; right: 10px !important; top: 130px !important;
  z-index: 99999 !important;
  width: 56px !important; height: 56px !important;
  background: rgba(102,126,234,0.85) !important;
  border: 2px solid rgba(255,255,255,0.3) !important;
  border-radius: 12px !important;
  color: white !important; cursor: pointer !important;
  display: flex !important; flex-direction: column !important;
  align-items: center !important; justify-content: center !important;
  font-size: 22px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important;
  pointer-events: auto !important;
  transition: all 0.3s !important;
  touch-action: manipulation;
}
.sidebar-toggle:hover { background: rgba(102,126,234,1) !important; }
.sidebar-toggle.sidebar-open { right: 310px !important; }

.sidebar-content { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.sidebar-header {
  padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-header h3 { font-size: 14px; font-weight: 700; color: rgba(102,126,234,1); margin: 0; }
.sidebar-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: none;
  color: white; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.sidebar-close:hover { background: rgba(255,0,0,0.25); }

.sidebar-list { flex: 1; overflow-y: auto; padding: 12px; }
.sidebar-list::-webkit-scrollbar { width: 4px; }
.sidebar-list::-webkit-scrollbar-thumb { background: rgba(102,126,234,0.4); border-radius: 2px; }

.sidebar-story-item {
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(102,126,234,0.25);
  border-radius: 10px; padding: 14px;
  margin-bottom: 8px; cursor: pointer !important;
  transition: all 0.3s var(--ease-out);
}
.sidebar-story-item:hover {
  background: rgba(102,126,234,0.25);
  border-color: rgba(102,126,234,0.6);
  transform: translateX(-6px);
}
.sidebar-story-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.sidebar-story-meta { font-size: 11px; color: rgba(255,255,255,0.5); display: flex; gap: 6px; flex-wrap: wrap; }
.sidebar-empty { text-align: center; padding: 28px; color: rgba(255,255,255,0.4); font-size: 13px; }


/* ══════════════════════════════════════════════════════════════════════════════
   NOTIFICATIONS
   ══════════════════════════════════════════════════════════════════════════════ */

.notification {
  position: fixed;
  top: clamp(75px, 14vh, 95px); right: clamp(16px, 3vw, 24px);
  padding: 13px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  z-index: 195; backdrop-filter: blur(16px);
  max-width: clamp(260px, 75vw, 340px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: notifIn 0.4s var(--ease-out);
  pointer-events: auto;
}
@keyframes notifIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.notification.success { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.notification.error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.notification.info { background: rgba(58,155,220,0.15); border: 1px solid rgba(58,155,220,0.3); color: #60a5fa; }


/* ══════════════════════════════════════════════════════════════════════════════
   INSTRUCTIONS
   ══════════════════════════════════════════════════════════════════════════════ */

#instructions, #mobile-instructions {
  position: absolute;
  bottom: clamp(20px, 4vw, 32px); right: clamp(16px, 3vw, 30px);
  background: rgba(0,0,0,0.55);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px 20px; font-size: 12px;
  max-width: 280px; pointer-events: auto;
  backdrop-filter: blur(20px);
  animation: fadeUp 0.8s var(--ease-out) 0.5s both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.instruction-line { display: flex; align-items: center; margin-bottom: 8px; opacity: 0.7; line-height: 1.4; }
.instruction-line:last-child { margin-bottom: 0; }


/* ══════════════════════════════════════════════════════════════════════════════
   EXPERIMENTAL — Mood Board only (kept useful, removed noise)
   ══════════════════════════════════════════════════════════════════════════════ */

#mood-board {
  position: fixed; bottom: 100px; right: 14px;
  width: 150px; background: rgba(0,0,0,0.75);
  border-radius: 12px; padding: 10px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  display: none; z-index: 300;
}
#mood-board.active { display: block; animation: fadeUp 0.3s var(--ease-out); }
.mood-board-title { font-size: 10px; text-align: center; margin-bottom: 8px; opacity: 0.5; text-transform: uppercase; letter-spacing: 1px; }
.mood-cloud { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; }
.mood-tag {
  background: rgba(102,126,234,0.15);
  color: rgba(168,178,255,0.85);
  padding: 3px 8px; border-radius: 10px;
  font-size: 10px;
  border: 1px solid rgba(102,126,234,0.2);
}


/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════════ */

.desktop-only { display: block; }
.mobile-only { display: none; }

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only  { display: block !important; }

  #topbar { padding: 8px 12px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .title-area { width: 100%; }
  .controls { width: 100%; justify-content: flex-start; gap: 6px; }
  .btn { padding: 7px 12px; font-size: 11px; }

  #ai-panel, #connections-panel { right: 8px; left: 8px; width: auto; top: 8px; max-height: 68vh; }
  #audio-controls, #video360-controls { right: 8px; left: 8px; width: auto; }
  #tracker { bottom: 12px; left: 12px; max-width: calc(100vw - 24px); }

  .content-sidebar { width: 260px; right: -260px; top: 65px; }
  .sidebar-toggle.sidebar-open { right: 268px !important; }

  #mobile-instructions { bottom: 12px; right: 12px; max-width: calc(100vw - 24px); }
  .journey-content, .about-content { padding: 22px 18px; }
  #tooltip { max-width: 260px; padding: 14px 16px; }
}

@media (max-width: 926px) and (orientation: landscape) {
  #topbar { padding: 6px 10px; }
  .btn { padding: 5px 10px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media (hover: none) and (pointer: coarse) {
  .btn, .panel-btn, .video-btn, .ai-send { min-height: 44px; }
}
