/* ============================================
   CSS VARIABLES / DESIGN TOKENS
   ============================================ */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --bg-card: #101018;
  --bg-card-border: #252530;
  --text-primary: #e8e4df;
  --text-secondary: #8a8690;
  --text-tertiary: #5a5660;
  --accent-gold: #c9a84c;
  --accent-gold-dim: rgba(201, 168, 76, 0.25);
  --conflict-red: #c23b3b;
  --conflict-amber: #c4853a;
  --conflict-yellow: #c9a84c;
  --tension-muted: #8a6530;
  --nato-blue: #4a7ab5;
  --eu-blue: #2e5090;
  --brics-teal: #2d7d6e;
  --sco-purple: #6a4c93;
  --aukus-steel: #5a7a8a;
  --asean-gold: #b8963e;
  --fiveeyes-grey: #6a7080;
  --us-blue: #4a7ab5;
  --russia-green: #4a7b3f;
  --china-red: #9b2335;
  --france-purple: #6a4c93;
  --uk-teal: #2d7d6e;
  --turkey-orange: #c4853a;
  --resource-cyan: #3a8a8a;
  --pipeline-orange: #c4853a;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
}

/* ============================================
   LOADING SCREEN
   ============================================ */
#loading-screen {
  position: fixed; inset: 0;
  z-index: 10000;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#loading-screen .loading-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}
#loading-screen .loading-subtitle {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}
.loading-bar-track {
  width: 220px; height: 2px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-gold-dim));
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ============================================
   MAP
   ============================================ */
#map {
  width: 100%; height: 100%;
  background: var(--bg-primary);
}

/* Restyle Leaflet controls */
.leaflet-control-zoom {
  border: 1px solid var(--bg-card-border) !important;
  border-radius: 4px !important;
  overflow: hidden;
  margin-top: 70px !important;
}
.leaflet-control-zoom a {
  background: var(--bg-secondary) !important;
  color: var(--text-secondary) !important;
  border-bottom: 1px solid var(--bg-card-border) !important;
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  font-size: 16px !important;
  transition: color 0.2s, background 0.2s;
}
.leaflet-control-zoom a:hover {
  background: var(--bg-tertiary) !important;
  color: var(--accent-gold) !important;
}
.leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}
.leaflet-control-attribution {
  background: rgba(10,10,15,0.7) !important;
  color: var(--text-tertiary) !important;
  font-family: var(--font-mono) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

/* ============================================
   HEADER BAR
   ============================================ */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 14px 24px 18px;
  background: linear-gradient(180deg, rgba(10,10,15,0.92) 0%, rgba(10,10,15,0.7) 60%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
#header > * { pointer-events: auto; }

.header-left {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.header-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.06em;
}
.header-subtitle {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin-top: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Layer toggle pills */
.layer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--bg-card-border);
  border-radius: 20px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}
.layer-pill:hover {
  border-color: var(--text-tertiary);
  color: var(--text-primary);
}
.layer-pill.active {
  border-color: var(--accent-gold);
  color: var(--text-primary);
  background: rgba(201, 168, 76, 0.08);
}
.layer-pill .pill-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.layer-pill.active .pill-dot { opacity: 1; }
.layer-pill .pill-key {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-tertiary);
  margin-left: 2px;
}

/* Language toggle */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--bg-card-border);
  border-radius: 20px;
  overflow: hidden;
  margin-left: 6px;
}
.lang-btn {
  padding: 5px 10px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn.active {
  color: var(--accent-gold);
  background: var(--accent-gold-dim);
}
.lang-btn:hover:not(.active) {
  color: var(--text-secondary);
}

/* Mobile hamburger */
.hamburger-btn {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  border-radius: 6px;
  padding: 7px 9px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.hamburger-btn:hover { color: var(--accent-gold); }
.hamburger-btn svg { display: block; }

/* Mobile dropdown */
.mobile-layer-dropdown {
  display: none;
  position: fixed;
  top: 52px; right: 16px;
  z-index: 1001;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  border-radius: 10px;
  padding: 8px;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.mobile-layer-dropdown.open { display: flex; }
.mobile-layer-dropdown .layer-pill {
  width: 100%;
  justify-content: flex-start;
}

/* Desktop layer pills container */
.desktop-pills { display: flex; gap: 8px; align-items: center; }

/* ============================================
   INFO CARD (LEFT PANEL)
   ============================================ */
#info-card {
  position: fixed;
  top: 70px; left: 16px;
  bottom: 16px;
  width: 360px;
  max-width: calc(100vw - 32px);
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 10px;
  overflow-y: auto;
  transform: translateX(calc(-100% - 32px));
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
  pointer-events: none;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) transparent;
}
#info-card.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
#info-card::-webkit-scrollbar { width: 4px; }
#info-card::-webkit-scrollbar-track { background: transparent; }
#info-card::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 2px; }

.card-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  z-index: 2;
}
.card-close:hover {
  color: var(--text-primary);
  background: var(--bg-card-border);
}

.card-content {
  padding: 24px 22px 28px;
}
.card-type {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent-gold);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
}
.card-subtitle {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.card-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-gold-dim), transparent);
  margin-bottom: 18px;
}
.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 18px;
}
.card-stat-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.card-stat-value {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}
.card-narrative {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--text-secondary);
}
.card-updated {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-tertiary);
}

/* ============================================
   LEGEND PANEL
   ============================================ */
#legend {
  position: fixed;
  bottom: 16px; left: 16px;
  z-index: 999;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 180px;
  max-width: 240px;
  transform: translateY(calc(100% + 32px));
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
  pointer-events: none;
}
#legend.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.legend-section {
  margin-bottom: 12px;
}
.legend-section:last-child { margin-bottom: 0; }
.legend-section-title {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-secondary);
}
.legend-item.clickable {
  cursor: pointer;
  transition: color 0.2s;
}
.legend-item.clickable:hover { color: var(--text-primary); }
.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-square {
  width: 8px; height: 8px;
  flex-shrink: 0;
}
.legend-line {
  width: 16px; height: 0;
  border-top: 2px dashed;
  flex-shrink: 0;
}
.legend-hollow {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid;
  flex-shrink: 0;
}

/* ============================================
   PULSING ANIMATION (active combat)
   ============================================ */
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}
.pulse-marker {
  position: relative;
}
.pulse-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--conflict-red);
  position: relative;
  z-index: 2;
}
.pulse-ring {
  position: absolute;
  top: 0; left: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--conflict-red);
  z-index: 1;
  animation: pulse-ring 2s ease-out infinite;
}

/* Base markers */
.base-marker {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.base-marker:hover {
  transform: scale(1.5);
  box-shadow: 0 0 10px rgba(255,255,255,0.2);
}

/* Chokepoint markers */
.chokepoint-marker {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--conflict-red);
  background: rgba(194, 59, 59, 0.15);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}
.chokepoint-marker:hover {
  transform: scale(1.3);
  background: rgba(194, 59, 59, 0.3);
}

/* Resource markers */
.resource-marker {
  width: 10px; height: 10px;
  background: var(--resource-cyan);
  cursor: pointer;
  transition: transform 0.2s;
}
.resource-marker:hover { transform: scale(1.4); }

/* ============================================
   CABLES PANEL
   ============================================ */
#cables-panel {
  position: fixed;
  top: 70px; right: 0; bottom: 16px;
  width: 340px;
  z-index: 1000;
  background: var(--bg-card);
  border-left: 1px solid var(--bg-card-border);
  border-radius: 10px 0 0 10px;
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% - 36px));
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#cables-panel.expanded { transform: translateX(0); }
#cables-panel.hidden-panel { display: none; }

.cables-tab {
  position: absolute;
  left: 0; top: 50%;
  transform: translate(-100%, -50%);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  padding: 10px 5px;
  cursor: pointer;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  writing-mode: vertical-lr;
  letter-spacing: 0.1em;
  transition: color 0.2s;
}
.cables-tab:hover { color: var(--accent-gold); }
/* Cables new indicator dot */
.cables-tab.has-new::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 6px rgba(201, 168, 76, 0.5);
}



.cables-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--bg-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cables-header-text {
  font-size: 0.78rem;
}
.cables-header-text .cables-word {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 500;
}
.cables-header-text .via-word {
  color: var(--text-tertiary);
  font-weight: 300;
}
.cables-header-text .amonhen-link {
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}
.cables-header-text .amonhen-link:hover { opacity: 0.8; }
.cables-collapse-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 2px 6px;
  transition: color 0.2s;
}
.cables-collapse-btn:hover { color: var(--text-primary); }

.cables-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) transparent;
}
.cables-list::-webkit-scrollbar { width: 4px; }
.cables-list::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 2px; }

.cable-entry {
  padding: 12px;
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}
.cable-entry:hover { border-color: var(--text-tertiary); }
.cable-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.cable-tag {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 3px;
  color: #fff;
}
.cable-date {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-tertiary);
}
.cable-title {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 4px;
}
.cable-preview {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.cable-readlink {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent-gold);
  text-decoration: none;
  display: block;
  text-align: right;
  transition: opacity 0.2s;
}
.cable-readlink:hover { opacity: 0.8; }

/* Sanctions badges */
.sanction-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(138, 48, 48, 0.2);
  color: #c26060;
  border: 1px solid rgba(138, 48, 48, 0.3);
  margin-right: 4px;
}

/* ============================================
   TIMELINE BAR
   ============================================ */
#bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: linear-gradient(0deg, rgba(10,10,15,0.92) 0%, rgba(10,10,15,0.75) 70%, transparent 100%);
  padding: 8px 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
#bottom-bar > * {
  pointer-events: auto;
}
.bottom-stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.bottom-timeline-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}
.bottom-timeline-row.visible {
  max-height: 100px;
  opacity: 1;
}
.timeline-slider-row {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 800px;
  gap: 12px;
}
.timeline-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}
.timeline-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent-gold);
  border: 2px solid var(--bg-primary);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.4);
}
.timeline-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent-gold);
  border: 2px solid var(--bg-primary);
  cursor: pointer;
}
.timeline-current {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-gold);
  text-align: center;
  margin-top: 4px;
}
.timeline-events {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 4px;
  min-height: 1.2em;
}
.timeline-now-btn {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--accent-gold);
  background: transparent;
  border: 1px solid var(--accent-gold-dim);
  border-radius: 10px;
  padding: 2px 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.timeline-now-btn:hover { background: var(--accent-gold-dim); }

/* Cable geo-linking hover */
.cable-entry[data-has-geo] { cursor: pointer; transition: border-left 0.2s, padding-left 0.2s; }
.cable-entry[data-has-geo]:hover { border-left: 2px solid var(--accent-gold); padding-left: 10px; }

/* ============================================
   TRADE COMPOSITION
   ============================================ */
.trade-composition {
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
}
.trade-direction {
  margin-bottom: 8px;
}
.trade-direction:last-child {
  margin-bottom: 0;
}
.trade-direction-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent-gold);
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.trade-direction-items {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================
   SEARCH OVERLAY
   ============================================ */
#search-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
#search-overlay.open {
  opacity: 1;
  visibility: visible;
}
.search-modal {
  width: 480px;
  max-width: calc(100vw - 32px);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}
.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg-card-border);
  gap: 10px;
}
.search-icon {
  color: var(--text-tertiary);
  font-size: 16px;
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
}
.search-input::placeholder {
  color: var(--text-tertiary);
}
.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}
.search-group-title {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  padding: 8px 10px 4px;
}
.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.search-result:hover,
.search-result.selected {
  background: var(--bg-tertiary);
}
.search-result-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.search-result-name {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-primary);
}
.search-empty {
  padding: 24px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-tertiary);
}
.search-hint {
  padding: 8px 16px;
  border-top: 1px solid var(--bg-card-border);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-tertiary);
  text-align: center;
}

/* ============================================
   SHARE BUTTON & TOAST
   ============================================ */
.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--bg-card-border);
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-left: 4px;
}
.share-btn:hover {
  color: var(--accent-gold);
  border-color: var(--accent-gold-dim);
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--accent-gold-dim);
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 6px 16px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 3000;
  pointer-events: none;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Stats pill styles (inside bottom-bar) */
.stat-pill {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.stat-pill .stat-number {
  color: var(--text-secondary);
  font-weight: 500;
}
.stat-separator {
  color: var(--bg-card-border);
}


/* ============================================
   ONBOARDING HINT
   ============================================ */
.onboarding-overlay {
  position: fixed; inset: 0;
  z-index: 9500;
  background: rgba(0,0,0,0.3);
  display: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}
.onboarding-overlay.visible { display: block; }

.coach-mark {
  position: fixed;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-gold-dim);
  border-radius: 8px;
  padding: 16px 20px;
  max-width: 340px;
  z-index: 9501;
  pointer-events: all;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.coach-mark.coach-top-right {
  top: 70px;
  right: 20px;
}
.coach-mark.coach-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.coach-text {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 14px;
}
.coach-buttons {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.coach-skip {
  font-family: var(--font-body);
  font-size: 0.72rem;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 0;
}
.coach-skip:hover { color: var(--text-secondary); }
.coach-next {
  font-family: var(--font-body);
  font-size: 0.72rem;
  background: var(--accent-gold);
  color: var(--bg-primary);
  border: none;
  border-radius: 4px;
  padding: 5px 14px;
  cursor: pointer;
  font-weight: 500;
}
.coach-next:hover { background: #b8963e; }
.coach-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.coach-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background 0.2s;
}
.coach-dot.active { background: var(--accent-gold); }

/* ============================================
   ALLIANCE OVERLAP BADGES
   ============================================ */
.card-overlap-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--bg-card-border);
}
.alliance-overlap-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: 3px;
  margin: 2px 4px 2px 0;
  cursor: pointer;
  transition: all 0.2s ease;
}
.alliance-overlap-badge:hover {
  background: rgba(255,255,255,0.05);
}

/* ============================================
   SCENARIO SEARCH
   ============================================ */
.scenario-desc {
  color: var(--text-tertiary);
  font-size: 0.7rem;
  margin-left: 4px;
}
.scenario-result .search-result-dot {
  width: auto;
  height: auto;
  border-radius: 0;
}

/* ============================================
   COMPARE OVERLAY
   ============================================ */
#compare-overlay {
  position: fixed; inset: 0;
  z-index: 8000;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
}
#compare-overlay.open { display: flex; }

.compare-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
}
.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.compare-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
}
.compare-close {
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
}
.compare-selectors {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.compare-select {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--bg-card-border);
  border-radius: 4px;
  cursor: pointer;
}
.compare-vs {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-tertiary);
}
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.compare-column {
  padding: 12px;
  background: var(--bg-primary);
  border-radius: 6px;
  border: 1px solid var(--bg-card-border);
}
.compare-country-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--accent-gold);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bg-card-border);
}
.compare-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-size: 0.72rem;
}
.compare-label {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.compare-value {
  color: var(--text-primary);
  text-align: right;
}
.compare-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  padding: 1px 5px;
  border: 1px solid;
  border-radius: 3px;
  margin: 1px 2px;
}
.compare-none {
  color: var(--text-tertiary);
  font-style: italic;
}
@media (max-width: 500px) {
  .compare-grid { grid-template-columns: 1fr; }
  .compare-selectors { flex-direction: column; }
  .compare-vs { display: none; }
}

/* ============================================
   MARKER VISIBILITY BOOST
   ============================================ */
.base-marker-naval,
.base-marker-air,
.base-marker-ground,
.base-marker-multi {
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}
.chokepoint-marker {
  box-shadow: 0 0 6px rgba(194, 59, 59, 0.3);
}
.resource-marker {
  box-shadow: 0 0 4px rgba(58, 138, 138, 0.3);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1400px) {
  .layer-pill .pill-key { display: none; }
}
@media (max-width: 1200px) {
  .layer-pill {
    padding: 4px 8px;
    font-size: 0.65rem;
    gap: 4px;
  }
}
@media (max-width: 1024px) {
  .desktop-pills { display: none; }
  .hamburger-btn { display: block; }
}
@media (max-width: 768px) {
  .header-subtitle { display: none; }
  .desktop-pills { display: none; }
  .hamburger-btn { display: block; }

  #info-card {
    top: auto;
    left: 0; right: 0;
    bottom: 0;
    width: 100%;
    max-height: 55vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  #info-card.open {
    transform: translateY(0);
  }

  #legend {
    max-width: 180px;
    font-size: 0.65rem;
    bottom: 10px;
    right: 10px;
  }
  #cables-panel {
    top: auto; right: 0; left: 0; bottom: 0;
    width: 100%;
    max-height: 50vh;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-top: 1px solid var(--bg-card-border);
    transform: translateY(100%);
  }
  #cables-panel.expanded { transform: translateY(0); }
  .cables-tab { display: none; }
  .mobile-cables-btn { display: block !important; }
  #bottom-bar { padding: 6px 12px 10px; gap: 4px; }
  .timeline-events { display: none; }
  #search-overlay { padding-top: 10vh; }
  .bottom-stats-row { gap: 10px; }
  .stat-pill { font-size: 0.56rem; }
  .stat-pill:nth-child(n+7) { display: none; }
}

/* ============================================
   SITE FOOTER (AMON HEN)
   ============================================ */
#site-footer {
  position: fixed;
  bottom: 4px;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  color: var(--text-tertiary);
  opacity: 0.4;
  pointer-events: auto;
  transition: opacity 0.3s;
}
#site-footer:hover {
  opacity: 0.8;
}
#site-footer a {
  color: var(--accent-gold);
  text-decoration: none;
  opacity: 0.7;
}
#site-footer a:hover {
  opacity: 1;
  text-decoration: underline;
}
.footer-sep {
  opacity: 0.3;
}

/* ============================================
   LOADING CREDIT
   ============================================ */
.loading-credit {
  margin-top: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
}
.loading-credit a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s;
}
.loading-credit a:hover {
  color: var(--accent-gold);
}

/* ============================================
   INCIDENTS TIMESPAN BUTTONS
   ============================================ */
.legend-timespan-btns {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.timespan-btn {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 2px 8px;
  border: 1px solid var(--bg-card-border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.timespan-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}
.timespan-btn.active {
  border-color: #e85d45;
  color: #e85d45;
  background: rgba(232, 93, 69, 0.1);
}

/* ============================================
   FORZA INTEGRATION
   ============================================ */
.forza-header-btn {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent-gold);
  text-decoration: none;
  padding: 3px 10px;
  border: 1px solid var(--accent-gold-dim);
  border-radius: 4px;
  margin-right: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.forza-header-btn:hover {
  background: rgba(201,168,76,0.1);
  border-color: var(--accent-gold);
}
.forza-arrow { font-size: 0.6rem; }

.forza-link {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent-gold);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-gold-dim);
  transition: border-color 0.2s;
}
.forza-link:hover { border-color: var(--accent-gold); }

/* ============================================
   REGION QUICK-NAV
   ============================================ */
.region-nav {
  display: flex;
  gap: 4px;
  padding: 2px 12px 4px;
  flex-wrap: wrap;
}
.region-btn {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--bg-card-border);
  border-radius: 3px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s;
}
.region-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* ============================================
   MOBILE FORZA HIDE
   ============================================ */
@media (max-width: 600px) {
  .forza-header-btn { display: none; }
}
