/* ==========================================================================
   GPS Cinematic Full-Screen Experience – Clean Technical Aesthetics
   ========================================================================== */

:root {
  --bg-primary: #050811;
  --bg-panel: rgba(8, 14, 26, 0.82);
  --border-subtle: rgba(56, 189, 248, 0.18);
  --border-glow: rgba(0, 240, 255, 0.45);

  --color-cyan: #00f0ff;
  --color-magenta: #e879f9;
  --color-gold: #fbbf24;
  --color-emerald: #10b981;
  --color-rose: #f43f5e;
  --color-blue: #38bdf8;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', ui-monospace, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-pill: 32px;
}

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

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-primary);
  font-family: var(--font-sans);
  color: var(--text-primary);
  user-select: none;
}

/* ==========================================================================
   Full-Screen Canvas Viewport
   ========================================================================== */
.canvas-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   Top Header Overlay
   ========================================================================== */
.top-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  background: linear-gradient(180deg, rgba(5, 8, 17, 0.9) 0%, rgba(5, 8, 17, 0) 100%);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  pointer-events: auto;
}

.brand-icon {
  width: 36px;
  height: 36px;
  color: var(--color-cyan);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid var(--color-cyan);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
  animation: pulseSpin 18s linear infinite;
}

@keyframes pulseSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.brand-main {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #94a3b8, #00f0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.scenario-tracker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(8, 14, 26, 0.88);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.tracker-theme {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-gold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tracker-divider {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.tracker-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-cyan);
}

.tracker-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}

/* ==========================================================================
   Right-Side Calm Story Panel (Fades in smoothly)
   ========================================================================== */
.story-panel-right {
  position: absolute;
  right: 28px;
  top: 86px;
  width: 400px;
  max-height: calc(100vh - 190px);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.story-panel-right.fade-out {
  opacity: 0;
  transform: translateX(12px);
}

.story-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-cyan);
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.story-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.015em;
  margin-bottom: 0.85rem;
  line-height: 1.3;
}

.story-text {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.story-math-box {
  background: rgba(5, 10, 20, 0.88);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: inset 0 0 14px rgba(0, 240, 255, 0.05);
}

.math-formula {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-cyan);
}

.math-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.story-subtext {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Text Highlights */
.hl-cyan { color: var(--color-cyan); font-weight: 600; }
.hl-magenta { color: var(--color-magenta); font-weight: 600; }
.hl-gold { color: var(--color-gold); font-weight: 600; }
.hl-emerald { color: var(--color-emerald); font-weight: 600; }
.hl-rose { color: var(--color-rose); font-weight: 600; }

/* ==========================================================================
   Bottom-Center Floating Player Capsule
   ========================================================================== */
.player-capsule {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 14, 26, 0.92);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 0.55rem 1.1rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 240, 255, 0.1);
  z-index: 20;
}

.player-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.player-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.player-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: scale(1.05);
}

.player-btn.btn-play-main {
  width: 38px;
  height: 38px;
  background: rgba(0, 240, 255, 0.2);
  border-color: rgba(0, 240, 255, 0.5);
  color: var(--color-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

.player-btn.btn-play-main:hover {
  background: rgba(0, 240, 255, 0.35);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.5);
}

/* Scrubber */
.capsule-scrubber {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 300px;
}

.scrubber-track {
  position: relative;
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  cursor: pointer;
}

.scrubber-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00f0ff, #10b981);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

.scrubber-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid var(--color-cyan);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px var(--color-cyan);
  pointer-events: none;
}

.scenario-dots {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.scenario-dot {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 10px;
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(-50%);
  transition: width 0.2s ease, background 0.2s ease;
}

.scenario-dot.theme-2d {
  background: rgba(0, 240, 255, 0.5);
}

.scenario-dot.theme-3d {
  background: rgba(232, 121, 249, 0.5);
}

.scenario-dot.theme-velocity {
  background: rgba(251, 191, 36, 0.5);
}

.scenario-dot.theme-security {
  background: rgba(244, 63, 94, 0.5);
}

.scenario-dot.active {
  background: #ffffff !important;
  width: 4px;
  height: 12px;
  top: -3px;
  box-shadow: 0 0 10px var(--color-cyan);
}

.time-readout {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Scenario Dropdown */
.scenario-selector-wrap {
  position: relative;
}

.scenario-select {
  background: rgba(6, 12, 22, 0.9);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.76rem;
  font-family: var(--font-sans);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  max-width: 160px;
}

.scenario-select option {
  background: #080e1a;
  color: #fff;
}

.player-speed {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s;
}

.player-speed:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* ==========================================================================
   Bottom-Right Reference Footer
   ========================================================================== */
.bottom-ref-footer {
  position: absolute;
  bottom: 24px;
  right: 28px;
  z-index: 15;
}

.ref-pill {
  background: rgba(8, 14, 26, 0.85);
  border: 1px solid rgba(251, 191, 36, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  color: var(--color-gold);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.ref-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-gold);
  box-shadow: 0 0 6px var(--color-gold);
}

.ref-pill:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: var(--color-gold);
  transform: translateY(-1px);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .story-panel-right {
    width: 320px;
    right: 16px;
  }
  .capsule-scrubber {
    width: 180px;
  }
}

@media (max-width: 800px) {
  .story-panel-right {
    display: none;
  }
  .top-overlay {
    padding: 0 1rem;
  }
  .brand-sub {
    display: none;
  }
}
