/* ==========================================================================
   THEATER 16:9 ENGINE & AMBIENT BACKDROP BLUR - STYLESHEET
   ========================================================================== */

:root {
  --bg-pure: #030305;
  --bg-glass: rgba(15, 17, 23, 0.72);
  --bg-glass-hover: rgba(28, 32, 45, 0.85);
  --border-glass: rgba(255, 255, 255, 0.09);
  --border-glow: rgba(255, 159, 28, 0.4);
  --accent-amber: #ff9f1c;
  --accent-gold: #ffbe0b;
  --accent-teal: #2ec4b6;
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-subtle: #64748b;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-pure);
  color: var(--text-main);
  font-family: var(--font-body);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

body.idle-hidden {
  cursor: none;
}

/* ==========================================================================
   1. THEATER VIEWPORT
   ========================================================================== */
.theater-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

/* ==========================================================================
   2. AMBIENT BACKDROP (Hiệu ứng viền mờ cho TV khác 16:9)
   ========================================================================== */
.ambient-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

body:not(.ambient-active) .ambient-backdrop {
  display: none;
}

.ambient-player {
  position: absolute;
  top: -12%;
  left: -12%;
  width: 124%;
  height: 124%;
  object-fit: cover;
  filter: blur(56px) brightness(0.4) saturate(1.5);
  transform: scale(1.15);
  opacity: 0;
  transition: opacity 0.5s var(--transition-smooth);
}

.ambient-player.active {
  opacity: 0.95;
}

.ambient-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0.15) 30%,
    rgba(3, 3, 5, 0.85) 90%
  );
}

/* ==========================================================================
   3. STAGE 16:9 KHÓA CHẶT TỈ LỆ
   ========================================================================== */
.stage-frame {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.stage-canvas {
  pointer-events: auto;
  position: relative;
  /* Công thức chuẩn: min của 100vw hoặc 100vh quy đổi theo 16:9 */
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  aspect-ratio: 16 / 9;
  background: #050505;
  overflow: hidden;
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.main-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  background: #000;
  transition: opacity 0.28s ease-out;
}

.main-player.active {
  opacity: 1;
}

.stage-click-area {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
}

/* Spinner khi tải video */
.video-spinner {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  transition: opacity 0.3s ease;
}

.video-spinner.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner-ring {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   4. CINEMATIC HUD (HEAD-UP DISPLAY)
   ========================================================================== */
.hud-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 32px;
}

/* Idle: hide controls tray, keep indicator as ghost */
body.idle-hidden .hud-controls-tray {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.45s ease, visibility 0.45s ease, transform 0.45s ease;
}

/* Bottom nav bar — ẩn hoàn toàn, điều hướng qua click màn hình + bàn phím */
.hud-footer {
  display: none !important;
}

body.idle-hidden .slide-indicator {
  opacity: 0.13;
  transition: opacity 0.6s ease;
}

/* Header */
.hud-header {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-glass);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  border-radius: var(--radius-lg);
  padding: 12px 24px;
  gap: 20px;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.geo-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-amber);
  box-shadow: 0 0 12px var(--accent-amber);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.35); opacity: 0.5; }
}

.brand-code {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.slide-badge {
  background: rgba(255, 159, 28, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(255, 159, 28, 0.35);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 20px;
}

.hud-title-box {
  text-align: center;
  flex: 1;
  overflow: hidden;
  padding: 0 12px;
}

.slide-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.slide-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-btn:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.hud-btn.active {
  background: rgba(255, 159, 28, 0.18);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.hud-btn.highlight {
  background: linear-gradient(135deg, rgba(255, 159, 28, 0.3), rgba(243, 156, 18, 0.15));
  border-color: var(--accent-amber);
  color: #fff;
}

.hud-btn.icon-only {
  padding: 8px 10px;
}

/* Footer Control Bar */
.hud-footer {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-glass);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  border-radius: var(--radius-lg);
  padding: 12px 24px;
  gap: 24px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s var(--transition-smooth);
  flex-shrink: 0;
}

.nav-btn:hover:not(:disabled) {
  background: var(--bg-glass-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.nav-btn.primary {
  background: linear-gradient(135deg, #ff9f1c 0%, #f39c12 100%);
  border-color: rgba(255, 255, 255, 0.3);
  color: #050505;
  box-shadow: 0 4px 18px rgba(255, 159, 28, 0.35);
}

.nav-btn.primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(255, 159, 28, 0.55);
}

/* Timeline Segments (10 Slides) */
.timeline-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 640px;
}

.timeline-segment {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
}

.timeline-segment:hover {
  height: 10px;
  background: rgba(255, 255, 255, 0.3);
}

.timeline-segment.active {
  background: var(--accent-amber);
  box-shadow: 0 0 10px var(--accent-amber);
}

.timeline-segment.passed {
  background: rgba(255, 159, 28, 0.5);
}

/* Tooltip on segment hover */
.timeline-segment::after {
  content: attr(data-title);
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(10, 12, 16, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s ease;
}

.timeline-segment:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   5. DRAWER MENU (MỤC LỤC SLIDE) — Geo-Intelligence Redesign
   ========================================================================== */
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 90vw);
  background: rgba(4, 6, 12, 0.97);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  border-top: 2px solid var(--slide-color, #ff9f1c);
  box-shadow: -32px 0 80px rgba(0, 0, 0, 0.9), inset -1px 0 0 rgba(255, 255, 255, 0.04);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-panel.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-title h2 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.btn-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.18s ease;
}

.btn-close:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
}

/* Custom scrollbar */
.drawer-list::-webkit-scrollbar { width: 3px; }
.drawer-list::-webkit-scrollbar-track { background: transparent; }
.drawer-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.18s ease;
  position: relative;
  overflow: hidden;
}

.drawer-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--slide-color, #ff9f1c);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.drawer-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.drawer-item:hover::before {
  opacity: 1;
}

.drawer-item.active {
  background: rgba(255, 255, 255, 0.05);
}

.drawer-item.active::before {
  opacity: 1;
}

.drawer-item.sim-drawer-item {
  border-left: none;
  background: rgba(46, 196, 182, 0.04);
  margin: 0;
}

.drawer-item.sim-drawer-item:hover {
  background: rgba(46, 196, 182, 0.1);
}

.drawer-num {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--slide-color, #ff9f1c);
  width: 52px;
  flex-shrink: 0;
  text-align: center;
  padding: 16px 0;
  opacity: 0.7;
  letter-spacing: 0.5px;
}

.drawer-item.active .drawer-num,
.drawer-item:hover .drawer-num {
  opacity: 1;
}

.drawer-info {
  flex: 1;
  overflow: hidden;
  padding: 14px 16px 14px 0;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-name {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: rgba(248, 250, 252, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.drawer-item.active .drawer-name,
.drawer-item:hover .drawer-name {
  color: #fff;
}

.drawer-desc {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   6. SHORTCUTS MODAL — Terminal Style Redesign
   ========================================================================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.3s ease;
}

.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: rgba(4, 6, 12, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-top: 2px solid var(--slide-color, #ff9f1c);
  border-radius: 6px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.03);
  width: min(520px, 94vw);
  overflow: hidden;
  animation: modal-pop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { transform: translateY(-10px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--slide-color, #ff9f1c);
}

.modal-body {
  padding: 20px 22px 22px;
}

.shortcut-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.shortcut-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: rgba(248, 250, 252, 0.65);
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.shortcut-list li:last-child {
  border-bottom: none;
}

.key-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 11px;
  color: var(--slide-color, #ff9f1c);
  min-width: 26px;
  text-align: center;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.modal-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
  color: var(--text-subtle);
  line-height: 1.6;
}

/* ==========================================================================
   7. SLIDE 02 INTERACTIVE MAP OVERLAY & FLOATING SWITCHER
   ========================================================================== */
.slide02-overlay {
  position: absolute;
  left: 58.27%;
  top: 0.39%;
  width: 41.71%;
  height: 99.21%;
  z-index: 6;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.4s ease;
}

.slide02-map-frame {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  animation: map-subtle-drift 4s ease-in-out infinite alternate;
}

@keyframes map-subtle-drift {
  0% { transform: scale(1.002); }
  100% { transform: scale(1.014); }
}

.slide02-map-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.8));
}

.slide02-map-img.base {
  z-index: 1;
  opacity: 1;
}

.slide02-wipe-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 2;
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  will-change: clip-path;
}

.slide02-map-img.top {
  width: 100%;
  height: 100%;
}

/* Animations Quét Tia Radar Laser Down/Up */
.slide02-wipe-layer.scanning-down {
  animation: wipe-sweep-down 0.7s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes wipe-sweep-down {
  0% {
    clip-path: polygon(0 0, 100% 0, 100% 0%, 0 0%);
  }
  100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

.slide02-wipe-layer.scanning-up {
  animation: wipe-sweep-up 0.7s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes wipe-sweep-up {
  0% {
    clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0 100%);
  }
  100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

/* Laser Scanline Beam */
.slide02-laser-beam {
  position: absolute;
  left: -15%;
  width: 130%;
  height: 5px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(46, 196, 182, 0.8) 15%,
    #ffffff 50%,
    rgba(255, 159, 28, 0.9) 85%,
    transparent 100%
  );
  box-shadow: 0 0 14px #ffffff, 0 0 35px #ff9f1c, 0 0 55px #2ec4b6;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transform: rotate(-3.5deg);
  will-change: top, opacity;
}

.slide02-laser-beam.scanning-down {
  animation: laser-beam-down 0.7s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes laser-beam-down {
  0% {
    top: -4%;
    opacity: 0;
  }
  10% {
    opacity: 1;
    filter: brightness(2.2);
  }
  90% {
    opacity: 1;
    filter: brightness(2.2);
  }
  100% {
    top: 104%;
    opacity: 0;
  }
}

.slide02-laser-beam.scanning-up {
  animation: laser-beam-up 0.7s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes laser-beam-up {
  0% {
    top: 104%;
    opacity: 0;
  }
  10% {
    opacity: 1;
    filter: brightness(2.2);
  }
  90% {
    opacity: 1;
    filter: brightness(2.2);
  }
  100% {
    top: -4%;
    opacity: 0;
  }
}

.map-badge-tag {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(14, 16, 24, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 159, 28, 0.4);
  color: var(--accent-amber);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: all 0.3s ease;
}

/* Floating Switcher Pill — Redesigned */
.map-switcher-pill {
  position: absolute;
  top: 96px;
  right: 24px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(4, 6, 12, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1.5px solid var(--slide-color, #ff9f1c);
  border-radius: 6px;
  padding: 5px 8px 5px 12px;
  transition: all 0.3s ease;
  pointer-events: auto;
}

body.idle-hidden .map-switcher-pill {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
}

.switcher-label {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-subtle);
  text-transform: uppercase;
}

.switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 5px 10px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.switcher-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.switcher-btn.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.gold {
  background: #ff9f1c;
  box-shadow: 0 0 8px #ff9f1c;
}

.dot.teal {
  background: #2ec4b6;
  box-shadow: 0 0 8px #2ec4b6;
}

/* ==========================================================================
   THEMATIC MAP PILL & LIGHTBOX (Slide 08 & Slide 09)
   ========================================================================== */
.thematic-map-pill {
  position: absolute;
  top: 76px;
  right: 28px;
  z-index: 80;
  display: flex;
  align-items: center;
  pointer-events: auto;
  transition: opacity 0.3s ease, transform 0.3s ease;
  animation: pill-slide-down 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pill-slide-down {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.thematic-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(6, 182, 212, 0.2));
  border: 1.5px solid rgba(16, 185, 129, 0.5);
  color: #fff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(16, 185, 129, 0.3);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.thematic-pill-btn:hover {
  transform: translateY(-2px) scale(1.03);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.4), rgba(6, 182, 212, 0.35));
  border-color: #34d399;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 24px rgba(52, 211, 153, 0.5);
}

.thematic-pill-btn.minerals {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(245, 158, 11, 0.2));
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(239, 68, 68, 0.3);
}

.thematic-pill-btn.minerals:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.4), rgba(245, 158, 11, 0.35));
  border-color: #f87171;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 24px rgba(248, 113, 113, 0.5);
}

.thematic-pill-icon {
  font-size: 16px;
  line-height: 1;
}

.pill-key-tag {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  color: #94a3b8;
  font-family: monospace;
  font-weight: 700;
}

/* MODAL OVERLAY */
.thematic-modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.thematic-modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.thematic-modal-container {
  width: min(96vw, 1100px);
  height: min(94vh, 1000px);
  background: rgba(4, 6, 12, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 2px solid var(--slide-color, #ff9f1c);
  border-radius: 6px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-zoom-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-zoom-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.thematic-modal-header {
  height: 60px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.thematic-modal-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.thematic-modal-tag {
  background: rgba(14, 165, 233, 0.2);
  border: 1px solid rgba(14, 165, 233, 0.4);
  color: #38bdf8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
}

.thematic-modal-header h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.thematic-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-thematic-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.18s;
}

.btn-thematic-action:hover {
  background: rgba(14, 165, 233, 0.25);
  border-color: #38bdf8;
  color: #fff;
}

.btn-close-thematic {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
}

.btn-close-thematic:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
  transform: scale(1.05);
}

.thematic-modal-body {
  flex: 1;
  min-height: 0;          /* CRITICAL: cho phép flex child co lại trong flex container */
  background: #020409;
  overflow: hidden;        /* Không scroll — ảnh tự fit vừa ô */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
}

.thematic-map-frame {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thematic-map-frame img {
  display: block;
  max-width: 100%;
  max-height: 100%;        /* Không bao giờ vượt quá chiều cao ô body */
  width: auto;
  height: auto;
  object-fit: contain;     /* Giữ tỉ lệ, fit vừa khung — không cắt, không méo */
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   MINIMAL HUD — Geo-Intelligence Terminal Redesign
   ========================================================================== */

.hud-top {
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* ---- Slide Indicator Badge: 2-line terminal readout ---- */
.slide-indicator {
  pointer-events: auto;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(4, 6, 12, 0.88);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 2px solid var(--slide-color, #ff9f1c);
  border-radius: 5px;
  padding: 9px 14px 9px 12px;
  max-width: 480px;
  transition: opacity 0.5s ease, border-color 0.5s ease;
}

/* Top row: dot + number + brand */
.si-meta {
  display: flex;
  align-items: center;
  gap: 7px;
}

.si-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--slide-color, #ff9f1c);
  box-shadow: 0 0 8px var(--slide-color, #ff9f1c);
  flex-shrink: 0;
  animation: si-pulse 2.5s ease-in-out infinite;
  transition: background 0.5s ease, box-shadow 0.5s ease;
}

@keyframes si-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

.si-num {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--slide-color, #ff9f1c);
  flex-shrink: 0;
  transition: color 0.5s ease;
}

.si-num.sim {
  color: #2ec4b6;
}

.si-brand {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
}

.si-sep { display: none; } /* unused in new layout */

/* Bottom row: slide title */
.si-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: rgba(248, 250, 252, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  margin: 0;
  line-height: 1.2;
}

/* ---- Controls Tray: sharp dark panel ---- */
.hud-controls-tray {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background: rgba(4, 6, 12, 0.88);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  padding: 3px;
  transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
}

.tray-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.32);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tray-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.85);
}

.tray-btn.active {
  color: var(--slide-color, #ff9f1c);
}

.tray-btn.active:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--slide-color, #ff9f1c);
  filter: brightness(1.3);
}

.tray-btn-accent {
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--accent-amber) !important;
  border: 1px solid rgba(255, 159, 28, 0.2) !important;
}

.tray-btn-accent:hover {
  background: rgba(255, 159, 28, 0.15) !important;
  color: #fff !important;
  border-color: rgba(255, 159, 28, 0.45) !important;
}

.tray-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 2px;
  flex-shrink: 0;
}

/* Helpers */
.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hud-overlay {
    padding: 12px 16px;
  }
  .hud-header {
    padding: 8px 14px;
  }
  .slide-subtitle, .brand-code {
    display: none;
  }
  .hud-btn span {
    display: none;
  }
  .hud-footer {
    padding: 8px 14px;
    gap: 12px;
  }
  .timeline-bar {
    max-width: 100%;
  }
}
