/* =========================================================================
   ATLAS DES DIRIGEANTS — v2 : refonte dark modern
   Design system : dashboard éditorial, palette navy/teal/gold,
   typographie Inter uniquement, aération, micro-interactions discrètes.
   ========================================================================= */

@import url('https://rsms.me/inter/inter.css');

:root {
  /* --- Palette v2 : dark mode, tons profonds --- */
  --bg-0: #0a0f1a;         /* fond page (bleu nuit profond) */
  --bg-1: #0f1729;         /* fond conteneur (légèrement plus clair) */
  --bg-2: #1a2440;         /* cartes / panneaux */
  --bg-3: #253356;         /* éléments interactifs */
  --bg-elev: #1e2b4a;      /* survol */
  --border: #2a3a5f;
  --border-strong: #3d5285;

  /* Texte */
  --text-hi: #f0f4fa;      /* titres, très haute lisibilité */
  --text: #cbd5e1;         /* corps de texte */
  --text-mute: #94a3b8;    /* secondaire */
  --text-faint: #64748b;   /* tertiaire, labels */

  /* Accents (usage parcimonieux) */
  --accent: #60d4c8;       /* teal — actions principales */
  --accent-dim: #3ba99a;
  --accent-glow: rgba(96, 212, 200, 0.15);
  --gold: #f5c065;         /* highlights (statistiques, jaune ambre) */
  --coral: #f87171;        /* alertes, sensible */
  --lavender: #a78bfa;     /* secondaire */

  /* Couleurs de continents sur la carte */
  --c-africa:   #4a5f3e;   /* vert olive */
  --c-europe:   #3d4d7a;   /* bleu ardoise */
  --c-asia:     #6b3e5a;   /* prune */
  --c-americas: #3a5a6b;   /* bleu-vert */
  --c-oceania:  #6b5f3e;   /* ambre foncé */
  --c-nodata:   #202b45;
  --c-hover:    var(--accent);
  --c-selected: var(--gold);

  /* Typo */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  /* Métriques */
  --header-h: 64px;
  --panel-w: 400px;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  /* Timings */
  --t-fast: 0.12s;
  --t-normal: 0.2s;
  --t-slow: 0.35s;

  /* Feature settings (typo Inter) */
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}

/* ============ RESET ============ */

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

*::selection {
  background: var(--accent);
  color: var(--bg-0);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--sans);
  background: var(--bg-0);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  position: relative;
}

/* Glassmorphism commun à tous les panels overlay */
.overlay {
  position: fixed;
  z-index: 10;
  background: rgba(15, 23, 41, 0.82);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border: 1px solid rgba(61, 82, 133, 0.5);
  box-shadow: var(--shadow-md);
}

/* Grille de fond subtile */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% -10%, rgba(96, 212, 200, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 110%, rgba(245, 192, 101, 0.05), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  font-size: inherit;
}

input {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast) ease;
}

a:hover { color: var(--accent-dim); }

/* ============ HEADER ============ */

/* Barre unique fusionnée en haut — design éditorial premium */
.topbar {
  top: 14px;
  left: 14px;
  right: 14px;
  height: 62px;
  padding: 0 10px 0 14px;
  border-radius: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(180deg, rgba(20, 30, 52, 0.88), rgba(10, 15, 26, 0.88));
  border: 1px solid rgba(96, 212, 200, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* ---------- Bloc identité ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
  border-right: 1px solid rgba(61, 82, 133, 0.4);
  height: 100%;
  flex-shrink: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 30% 30%, var(--accent) 0%, transparent 60%),
    radial-gradient(circle at 70% 70%, var(--gold) 0%, transparent 60%),
    linear-gradient(135deg, #1a2440, #253356);
  box-shadow:
    inset 0 0 8px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(96, 212, 200, 0.25);
  position: relative;
  flex-shrink: 0;
}

.brand-mark::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.3) 100%);
}

.brand-text { display: flex; flex-direction: column; gap: 2px; }

.brand-text h1 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-hi);
  line-height: 1;
  white-space: nowrap;
}
.brand-text h1 span {
  font-weight: 400;
  color: var(--text-mute);
  font-size: 12px;
  margin-left: 3px;
}
.brand-text h1::before { content: none; }

.brand-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text-faint);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.pill-count {
  background: rgba(96, 212, 200, 0.15);
  color: var(--accent);
  border: 1px solid rgba(96, 212, 200, 0.3);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #4ade80; }
  50% { opacity: 0.5; box-shadow: 0 0 10px #4ade80; }
}

.live-label {
  color: var(--text-mute);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* ---------- Recherche améliorée ---------- */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 460px;
}

.topbar .search-box {
  height: 38px;
  padding: 0 10px 0 12px;
  background: rgba(10, 15, 26, 0.5);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all var(--t-fast) ease;
  display: flex;
  align-items: center;
}

.topbar .search-box:hover { border-color: var(--border-strong); }

.topbar .search-box:focus-within {
  border-color: var(--accent);
  background: rgba(37, 51, 86, 0.5);
  box-shadow: 0 0 0 3px rgba(96, 212, 200, 0.1);
}

.topbar .search-box input {
  padding: 6px 4px;
  font-size: 13px;
  color: var(--text-hi);
}

.topbar .search-box input::placeholder {
  color: var(--text-faint);
  font-weight: 400;
}

.search-kbd {
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 6px;
  background: var(--bg-2);
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-weight: 500;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.search-box:focus-within .search-kbd { display: inline-block; }
.search-box:not(:focus-within) .search-kbd { display: none; }

/* ---------- Dropdown résultats ---------- */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 380px;
  overflow-y: auto;
  background: rgba(15, 23, 41, 0.96);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  padding: 6px;
  z-index: 25;
  animation: dropdownIn 0.15s ease-out;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-results[hidden] { display: none; }

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--t-fast) ease;
  text-align: left;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
}

.search-result:hover,
.search-result.highlighted {
  background: var(--bg-3);
}

.search-result img {
  width: 22px;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.search-result-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-hi);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-hint {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.search-result mark {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.search-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  font-style: italic;
}

/* ---------- Filtres pills ---------- */
.topbar .filters {
  padding: 3px;
  border-radius: 8px;
  background: rgba(10, 15, 26, 0.5);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar .filter-btn {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 6px;
  color: var(--text-mute);
  transition: all var(--t-fast) ease;
}

.topbar .filter-btn:hover {
  color: var(--text-hi);
  background: rgba(37, 51, 86, 0.6);
}

.topbar .filter-btn.active {
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: var(--bg-0);
  box-shadow: 0 2px 6px rgba(96, 212, 200, 0.25);
}

/* ---------- Indicateur "mis à jour" ---------- */
.update-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  border-radius: 8px;
  background: rgba(10, 15, 26, 0.4);
  border: 1px solid var(--border);
  flex-shrink: 0;
  height: 38px;
}

.update-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(96, 212, 200, 0.12);
  border-radius: 6px;
  flex-shrink: 0;
}

.update-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.update-label {
  font-size: 9px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.update-value {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text);
  white-space: nowrap;
}

.mast-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
  padding-right: 12px;
  border-right: 1px solid var(--border);
  height: 100%;
}

.mast-brand h1 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

.mast-brand h1::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.tagline {
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 400;
  white-space: nowrap;
}

.mast-meta {
  display: flex;
  align-items: center;
  font-size: 10px;
  flex-shrink: 0;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  height: 100%;
}

.meta-value {
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 10px;
}

.meta-value::before {
  content: '●';
  color: var(--accent);
  margin-right: 4px;
  font-size: 7px;
  vertical-align: middle;
}


.search-box {
  position: relative;
  width: 320px;
  display: flex;
  align-items: center;
  background: rgba(37, 51, 86, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color var(--t-fast) ease, background var(--t-fast) ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  background: var(--bg-3);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box svg {
  color: var(--text-faint);
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  outline: none;
  color: var(--text-hi);
}

.search-box input::placeholder {
  color: var(--text-faint);
}

.search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--text-faint);
  background: var(--bg-3);
  flex-shrink: 0;
  transition: all var(--t-fast) ease;
}

.search-clear:hover {
  background: var(--coral);
  color: var(--bg-0);
}

.search-clear[hidden] { display: none; }

.filters {
  display: flex;
  gap: 2px;
  background: rgba(37, 51, 86, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.filter-btn {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-mute);
  border-radius: var(--radius-sm);
  transition: all var(--t-fast) ease;
  font-weight: 500;
  white-space: nowrap;
}

.filter-btn:hover {
  color: var(--text-hi);
  background: var(--bg-3);
}

.filter-btn.active {
  background: var(--accent);
  color: var(--bg-0);
  font-weight: 600;
}

/* ============ CARTE SVG ============ */

.map-container {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #0e1a2f 0%, #060a13 100%);
  overflow: hidden;
  z-index: 1;
}

.map-container svg#world-map {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  transition: none;
}

.map-container svg#world-map.grabbing { cursor: grabbing; }

/* Style de base des pays */
.map-container path {
  fill: var(--c-nodata);
  stroke: var(--bg-0);
  stroke-width: 0.4;
  stroke-linejoin: round;
  transition: fill var(--t-fast) ease, stroke-width var(--t-fast) ease;
  cursor: pointer;
  vector-effect: non-scaling-stroke;
}

/* Continents (couleurs douces sur fond dark) */
.map-container path.continent-africa    { fill: var(--c-africa); }
.map-container path.continent-europe    { fill: var(--c-europe); }
.map-container path.continent-asia      { fill: var(--c-asia); }
.map-container path.continent-americas  { fill: var(--c-americas); }
.map-container path.continent-oceania   { fill: var(--c-oceania); }

.map-container path.no-data { fill: var(--c-nodata); opacity: 0.6; }
.map-container path.disputed { stroke-dasharray: 1.5 1.5; }

.map-container path:hover {
  fill: var(--c-hover) !important;
  stroke: var(--text-hi);
  stroke-width: 0.8;
}

.map-container path.selected {
  fill: var(--c-selected) !important;
  stroke: var(--text-hi);
  stroke-width: 1.2;
}

.map-container path.search-match {
  fill: var(--coral) !important;
  animation: search-pulse 1.6s ease-in-out infinite;
}

@keyframes search-pulse {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 4px var(--coral)); }
  50% { opacity: 0.55; filter: drop-shadow(0 0 12px var(--coral)); }
}

.map-container path.dimmed { opacity: 0.15; pointer-events: none; }

/* ============ CONTRÔLES DE ZOOM (overlay) ============ */

.zoom-controls {
  bottom: 44px;
  --zoom-right: calc(var(--panel-w) + 24px);
  right: var(--zoom-right);
  display: flex !important;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  z-index: 15;
  transition: --zoom-right var(--t-slow) ease;
}

/* Quand le panel est fermé : on colle à droite */
body.panel-closed .zoom-controls {
  --zoom-right: 12px;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  border-radius: var(--radius-sm);
  transition: all var(--t-fast) ease;
  font-size: 18px;
  font-weight: 500;
}

.zoom-btn:hover {
  background: var(--bg-3);
  color: var(--text-hi);
}

.zoom-btn:active {
  background: var(--accent);
  color: var(--bg-0);
}

.zoom-btn svg {
  width: 18px;
  height: 18px;
}

.zoom-level {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  text-align: center;
  padding: 2px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ============ TOOLTIP ============ */

.tooltip {
  position: fixed;
  background: var(--bg-2);
  color: var(--text-hi);
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
  z-index: 100;
  max-width: 260px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

.tooltip.visible { opacity: 1; }

.tooltip-country {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}


.tooltip-leader {
  font-size: 11px;
  color: var(--text-mute);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.tooltip-leader-role {
  color: var(--text-faint);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============ LÉGENDE ============ */

.legend {
  bottom: 12px;
  left: 60px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  color: var(--text-mute);
  display: flex;
  gap: 12px;
  z-index: 12;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 12px;
  height: 12px;
  border: 1px solid var(--bg-0);
  border-radius: 2px;
}

.swatch-standard { background: var(--c-europe); }
.swatch-disputed { background: var(--c-europe); border-style: dashed; border-color: var(--text-mute); }
.swatch-nodata { background: var(--c-nodata); opacity: 0.6; }

/* ============ PANNEAU DÉTAIL ============ */

.detail-panel {
  top: 88px;
  right: 12px;
  bottom: 12px;
  width: var(--panel-w);
  max-width: calc(100vw - 24px);
  overflow-y: auto;
  padding: 20px;
  border-radius: var(--radius);
  z-index: 15;
  transition: transform var(--t-slow) ease, opacity var(--t-slow) ease;
}

.detail-panel[hidden] {
  display: block !important;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}

.detail-reopen {
  top: 88px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  transition: all var(--t-fast) ease;
  z-index: 15;
  padding: 0;
}

.detail-reopen:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.detail-reopen[hidden] { display: none; }

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--t-fast) ease;
  z-index: 2;
}

.detail-close:hover {
  background: var(--coral);
  color: var(--bg-0);
  border-color: var(--coral);
}

.detail-close[hidden] { display: none; }

.detail-empty {
  text-align: center;
  padding: 20px 8px;
  color: var(--text-mute);
}

.detail-empty svg {
  margin-bottom: 16px;
  color: var(--text-faint);
}

.detail-empty h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-hi);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.detail-empty > p {
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 20px;
}

.empty-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.empty-stat {
  text-align: center;
  padding: 4px;
}

.stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.stat-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 500;
}

.recent-changes {
  text-align: left;
  margin-top: 20px;
}

.recent-changes h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recent-changes h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-item {
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--t-fast) ease;
  display: flex;
  gap: 10px;
  align-items: center;
}

.recent-item:hover {
  background: var(--bg-elev);
  border-color: var(--accent);
  transform: translateX(2px);
}

.recent-item .flag-emoji {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.recent-item-content { min-width: 0; flex: 1; }

.recent-item strong {
  color: var(--text-hi);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item span {
  color: var(--text-faint);
  font-size: 11px;
}

.muted {
  color: var(--text-faint);
  font-style: italic;
  font-size: 12px;
  text-align: center;
  padding: 12px;
}

/* ============ FICHE PAYS ============ */

.detail-country {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.detail-country-flag {
  width: 44px;
  height: auto;
  display: block;
  margin-bottom: 12px;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
}

/* Drapeau petit (dans les listes) — taille équivalente à un emoji inline */
.flag-small, .flag-img {
  width: 18px;
  height: auto;
  display: inline-block;
  vertical-align: middle;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.tooltip-flag {
  width: 18px;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.detail-country-name {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-hi);
  letter-spacing: -0.02em;
}

.detail-country-official {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 4px;
  font-style: italic;
}

.detail-gov-form {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.detail-badges {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.badge {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid;
}

.badge-disputed {
  background: rgba(248, 113, 113, 0.1);
  color: var(--coral);
  border-color: var(--coral);
}

.badge-monarchy {
  background: rgba(245, 192, 101, 0.1);
  color: var(--gold);
  border-color: var(--gold);
}

.badge-republic {
  background: rgba(96, 212, 200, 0.1);
  color: var(--accent);
  border-color: var(--accent-dim);
}

/* Fiche dirigeant */
.leader-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  transition: border-color var(--t-fast) ease;
}

.leader-card:hover { border-color: var(--border-strong); }

.leader-card.primary {
  background: linear-gradient(135deg, var(--bg-2), var(--bg-elev));
  border: 1px solid var(--gold);
  padding: 16px;
  box-shadow: 0 0 24px rgba(245, 192, 101, 0.08);
}

.leader-card.primary::before {
  content: 'DIRIGE LE PAYS';
  position: absolute;
  top: -9px;
  left: 12px;
  background: var(--gold);
  color: var(--bg-0);
  font-size: 9px;
  padding: 2px 8px;
  letter-spacing: 0.1em;
  font-weight: 700;
  border-radius: 2px;
}

.leader-photo-wrap {
  width: 84px;
  height: 100px;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  background: var(--bg-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M12 12a5 5 0 100-10 5 5 0 000 10zm0 2c-3.3 0-10 1.7-10 5v3h20v-3c0-3.3-6.7-5-10-5z'/%3E%3C/svg%3E") center/50% no-repeat;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.leader-photo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--t-slow) ease-out;
}

.leader-photo-img.loaded { opacity: 1; }


.leader-info { flex: 1; min-width: 0; }

.leader-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}

.leader-card:not(.primary) .leader-role { color: var(--text-mute); }

.leader-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-hi);
  line-height: 1.2;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.leader-card.primary .leader-name { font-size: 20px; }
.leader-card.primary .leader-photo-wrap { width: 96px; height: 116px; }

.leader-position {
  font-size: 11px;
  color: var(--text-mute);
  margin-bottom: 10px;
  font-style: italic;
}

.leader-since {
  font-size: 11px;
  color: var(--text-faint);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.leader-since-value {
  font-family: var(--mono);
  color: var(--text);
  font-size: 11px;
  text-align: right;
}

.leader-since-value strong { color: var(--gold); font-weight: 600; }

.detail-note {
  font-size: 12px;
  color: var(--text-mute);
  padding: 12px;
  background: rgba(248, 113, 113, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.detail-note strong { color: var(--coral); }

/* Note informative (à savoir) — teal au lieu de coral */
.detail-note-info {
  background: rgba(96, 212, 200, 0.06);
  border-color: rgba(96, 212, 200, 0.25);
}

.detail-note-info strong { color: var(--accent); }

.wiki-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--t-fast) ease;
  align-self: flex-start;
}

.wiki-link:hover {
  background: var(--bg-elev);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============ LOADING ============ */

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  gap: 16px;
  background: var(--bg-1);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============ SCROLLBARS ============ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
* { scrollbar-color: var(--border) var(--bg-1); }

/* ============ FOOTER ============ */

.site-footer {
  bottom: 12px;
  right: 12px;
  padding: 5px 12px;
  font-size: 10px;
  color: var(--text-faint);
  border-radius: var(--radius-sm);
  z-index: 12;
}

.credit-brand strong {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.credit-sep { color: var(--border); margin: 0 4px; }

.site-footer p { margin: 0; }
.site-footer a { color: var(--text-mute); }
.site-footer a:hover { color: var(--accent); }

/* ============ REFRESH BADGE ============ */

#refresh-badge {
  position: fixed;
  bottom: 60px;
  right: 20px;
  background: var(--accent);
  color: var(--bg-0);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  cursor: pointer;
  animation: fadeIn var(--t-slow) ease-out;
}

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

@media (max-width: 900px) {
  .topbar {
    height: auto; padding: 8px; left: 8px; right: 8px;
    flex-wrap: wrap; gap: 8px; border-radius: 12px;
  }
  .brand { padding-right: 0; border-right: none; }
  .brand-text h1 span { display: none; }
  .update-indicator .update-text { display: none; }
  .update-indicator { padding: 6px; }
  .topbar .search-box { min-width: 100%; order: 3; }
  .topbar .filters { order: 4; }
  .update-indicator { order: 2; margin-left: auto; }
  .detail-panel {
    top: auto; bottom: 12px; right: 8px; left: 8px;
    width: auto; max-height: 55vh; height: auto;
  }
  .detail-reopen { top: auto; bottom: 12px; right: 12px; }
  .site-footer { display: none; }
  .zoom-controls { bottom: 60vh; }
  .legend { display: none; }
}

/* ============ ANIMATIONS ============ */

.fade-in {
  animation: fadeIn var(--t-slow) ease-out;
}

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