/* =========================================================
   1) VARIABLES GLOBALES
   ========================================================= */

:root {
  --ui-font-size: 14px;
  --topbar-height: 68px;

  --search-font-size: 14px;
  --search-frame-thickness: 2px;
  --search-frame-color: #333;
  --search-size: 40px;
  --search-open-width: 220px;
  --search-open-padding: 0 10px;
  --search-open-trans-time: 0.35s;
  --search-close-trans-time: 0.25s;
  --search-handle-height: 18px;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: "Electrolize", sans-serif;
}

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

body {
  font-size: var(--ui-font-size);
}

#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}.leaflet-cluster-spider-leg {
  stroke: #dc143c !important;
  stroke-width: 2px !important;
}

/* =========================================================
   2) NORMAL MODE
   ========================================================= */

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

#loading-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #ffffff 0%, #f3f3f3 45%, #e7e7e7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  opacity: 1;
  visibility: visible;
}

#loading-overlay.is-complete {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-box {
  max-width: 620px;
  padding: 32px 28px 26px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  text-align: center;
  backdrop-filter: blur(6px);
}

.loading-title {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #111;
}

.loading-subtitle {
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 500;
  color: #444;
}

.loading-bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: #f3d4da;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.loading-bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #b20a2c, #e40046);
  border-radius: 999px;
  transition: width 0.4s ease-out;
}

.loading-subtext {
  margin: 0;
  font-size: 12px;
  color: #666;
}

/* =========================
   TUTORIAL
   ========================= */

#tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 3100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#tutorial-overlay.tutorial-visible {
  opacity: 1;
  pointer-events: auto;
}

#tutorial-overlay.tutorial-hidden {
  opacity: 0;
  pointer-events: none;
}

.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.75));
}

.tutorial-card {
  position: relative;
  max-width: 520px;
  margin: 0 18px;
  padding: 20px 22px 16px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  z-index: 1;
  text-align: left;
}

#tutorial-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #111;
}

#tutorial-body,
#tutorial-body-2 {
  margin: 0 0 16px;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

.tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tutorial-btn-main,
.tutorial-btn-ghost,
.tutorial-btn-lang {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.tutorial-btn-main {
  background: #111;
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease;
}

.tutorial-btn-main:hover {
  background: #e40046;
  transform: translateY(-1px);
}

.tutorial-btn-ghost {
  background: transparent;
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.35);
  padding-inline: 12px;
}

.tutorial-btn-ghost:hover {
  background: rgba(0, 0, 0, 0.06);
}

.tutorial-btn-lang {
  background: #e40046;
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

.tutorial-btn-lang:hover {
  background: #b20a2c;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.tutorial-highlight-left,
.tutorial-highlight-right,
.tutorial-highlight-bottom {
  box-shadow: 0 0 0 2px #e40046, 0 0 18px rgba(228, 0, 70, 0.6);
}

#tutorial-replay-btn {
  border-radius: 999px;
  border: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 12px;
  background: #111;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
}

#tutorial-replay-btn:hover {
  background: #dc143c;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
}

#tutorial-replay-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* =========================
   MAP OVERLAYS / BORDERS / CLUSTERS
   ========================= */

.ukraine-border,
.country-highlight {
  pointer-events: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.country-highlight {
  filter: drop-shadow(0 0 2px rgba(220, 20, 60, 0.7));
  animation: country-border-blink 0.8s ease-in-out 2;
}

.ukraine-border {
  filter: drop-shadow(0 0 2px rgba(1, 92, 187, 0.3));
}

@keyframes country-border-blink {
  0% {
    stroke-width: 2px;
    stroke-opacity: 1;
    fill-opacity: 0.15;
  }

  50% {
    stroke-width: 4px;
    stroke-opacity: 0.2;
    fill-opacity: 0.25;
  }

  100% {
    stroke-width: 2px;
    stroke-opacity: 1;
    fill-opacity: 0.15;
  }
}

.custom-cluster {
  background-color: rgba(0, 0, 0, 0.8);
  border: 1px solid #000;
  border-radius: 50%;
  color: #fff;
  text-align: center;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-cluster:hover {
  transform: scale(1.25);
  opacity: 0.9;
  filter: brightness(1.15);
  box-shadow: 0 0 5px rgba(220, 20, 60, 0.8);
  animation: hoverBounce 0.25s ease-out;
  z-index: 10;
}

/* =========================
   EVENT MARKERS
   ========================= */

.marker-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
  cursor: pointer;
  z-index: 1;
  position: relative;
}

.marker-violences {
  background-image: url("icons/violence.png");
}

.marker-autres {
  background-image: url("icons/agression.png");
}

.marker-tues {
  background-image: url("icons/assassinat.png");
}

.marker-disparus {
  background-image: url("icons/disparu.png");
}

.marker-arretes-detenus-otages {
  background-image: url("icons/arrestation.png");
}

.marker-icon:hover {
  transform: scale(1.4);
  filter: brightness(1.55);
  box-shadow: 0 0 5px rgba(220, 20, 60, 0.8);
  animation: hoverBounce 0.25s ease-out;
  z-index: 10;
}

.marker-tues {
  animation: pulse 2s;
}

.marker-tues:hover {
  box-shadow: 0 0 14px rgba(220, 20, 60, 0.7);
}

.marker-icon.radar-once::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  opacity: 1;
  pointer-events: none;
  animation: radar-pulse 2s ease-out 1;
}

.marker-violences.radar-once::after {
  background: rgba(255, 152, 0, 0.35);
}

.marker-autres.radar-once::after {
  background: rgba(96, 125, 139, 0.35);
}

.marker-tues.radar-once::after {
  background: rgba(220, 20, 60, 0.4);
}

.marker-disparus.radar-once::after {
  background: rgba(33, 150, 243, 0.4);
}

.marker-arretes-detenus-otages.radar-once::after {
  background: rgba(175, 28, 131, 0.35);
}

@keyframes hoverBounce {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1.25);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(220, 20, 60, 0);
  }

  50% {
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(220, 20, 60, 0.5);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(220, 20, 60, 0);
  }
}

@keyframes radar-pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0.8;
  }

  70% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0.1;
  }

  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

/* =========================
   TOPBAR STICKY
   ========================= */

.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1400;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 2px solid rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(8px);
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
}

.app-topbar-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-topbar-logo img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.app-topbar-brand {
  min-width: 0;
}

.app-topbar-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  color: #E40046;
}

.app-topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-topbar-nav::-webkit-scrollbar {
  display: none;
}

.topbar-nav-btn {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  border-radius: 999px;
  padding: 10px 14px;
  white-space: nowrap;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;

  transition: transform 0.15s ease;
}

/* ligne animée */
.topbar-nav-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(228, 0, 70, 0.8);

  /* magie ici */
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.6s ease;

  pointer-events: none;
}

.topbar-nav-btn:hover::before {
  clip-path: inset(0 0 0 0);
}

.topbar-nav-btn:hover {
  border-color: transparent;
}

.topbar-nav-btn.is-active {
  background: rgba(228, 0, 70, 0.10);
  border-color: rgba(228, 0, 70, 0.40);
  color: #111;
  box-shadow: 0 6px 18px rgba(228, 0, 70, 0.12);
}

.app-topbar-playback {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.topbar-playback-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-playback-meta #playback-speed {
  max-width: 72px;
}

.topbar-playback-meta #playback-date {
  min-width: 84px;
  text-align: right;
}

/* On n’utilise plus les boutons latéraux comme navigation principale */
#toggle-bottom-chart {
  display: none;
}

/* =========================
   FLOATING CONTROLS / PLAYBACK
   ========================= */

#floating-controls {
  display: none;
}

.playback-btn {
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 16px;
  padding: 0;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.playback-btn:hover {
  background: #f6f6f6;
  transform: translateY(-1px);
}

.playback-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  background: rgba(228, 49, 42, 0.7);
  border-color: rgba(228, 49, 42, 1);
}

.playback-btn[disabled] {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.playback-main {
  border-color: #111;
  font-weight: 700;
}

#playback-speed {
  flex: 0 0 auto;
  max-width: 72px;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #fff;
}

#playback-date {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.playback-date {
  margin-top: 6px;
  text-align: center;
  font-size: 12px;
  color: #666;
  font-variant-numeric: tabular-nums;
}

.playback-toast {
  position: fixed;
  left: 50%;
  top: 10%;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 24px));
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.playback-toast.hidden {
  display: none;
}

.playback-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

.playback-toast-inner {
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.playback-toast-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.playback-toast-title {
  font-weight: 600;
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.playback-toast-date {
  color: rgba(228, 49, 42, 1);
  font-weight: 600;
  font-size: 0.9em;
  display: block;
}

.playback-toast-body {
  font-size: 13px;
  line-height: 1.35;
}

/* =========================
   GENERIC UI
   ========================= */

.collapse-btn {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.collapse-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.98);
}

.collapse-btn:active {
  transform: translateY(0);
  background: rgba(228, 49, 42, 0.14);
  border-color: rgba(228, 49, 42, 0.55);
}

.collapse-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(228, 0, 70, 0.22);
}

.collapsible-body.is-collapsed {
  display: none !important;
}

.filters-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: transparent;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.filters-dot.active {
  opacity: 1;
  background: rgba(46, 180, 90, 0.95);
  border-color: rgba(46, 180, 90, 0.95);
  transform: scale(1);
  animation: filtersDotPulse 1.6s ease-in-out infinite;
}

@keyframes filtersDotPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 180, 90, 0.35);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(46, 180, 90, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(46, 180, 90, 0);
  }
}

/* =========================
   LEFT PANEL
   ========================= */

#event-panel {
  position: absolute;
  top: var(--topbar-height);
  left: 0;
  height: calc(100dvh - var(--topbar-height));
  min-height: 0;
  width: 380px;
  display: flex;
  flex-direction: column;
  overflow: visible;
  z-index: 1100;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  border-right: 1px solid #ddd;
}

#event-panel.expanded {
  transform: translateX(0);
}

#event-header {
  background: #fff;
  border-bottom: 1px solid #ccc;
  padding: 12px 16px 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.event-section:last-child {
  border-bottom: none;
}

.event-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.event-section-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.event-section-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #111;
  text-transform: uppercase;
}

/* Active filters */
.active-filters-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.active-filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.active-filters-clear {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.active-filters-clear:hover {
  transform: translateY(-1px);
  background: rgba(0, 0, 0, 0.04);
}

.active-filters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.active-filters-empty {
  font-size: 12px;
  color: #666;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  background: rgba(0, 0, 0, 0.06);
  color: #111;
}

/* Header legend */
#header-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 8px;
  row-gap: 6px;
}

.header-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #222;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.header-legend-item:hover {
  background: #f5f5f5;
  transform: translateY(-1px);
}

.header-legend-item.is-off {
  opacity: 0.4;
}

.header-legend-count {
  min-width: 26px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  background: #f0f0f0;
  color: #333;
}

.header-legend-item.is-off .header-legend-count {
  background: #eee;
}

.header-legend-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
}

.header-legend-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-legend-violences .header-legend-count {
  background: rgba(255, 152, 0, 0.15);
  color: #EF6C00;
}

.header-legend-autres .header-legend-count {
  background: rgba(96, 125, 139, 0.15);
  color: #455A64;
}

.header-legend-tues .header-legend-count {
  background: rgba(220, 20, 60, 0.15);
  color: #C2185B;
}

.header-legend-disparus .header-legend-count {
  background: rgba(33, 150, 243, 0.15);
  color: #1976D2;
}

.header-legend-arretes-detenus-otages .header-legend-count {
  background: rgba(175, 28, 131, 0.15);
  color: #af1c83ff;
}

/* Event list */
#event-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

#event-list::-webkit-scrollbar,
#country-content::-webkit-scrollbar {
  width: 1px;
}

#event-list::-webkit-scrollbar-track,
#country-content::-webkit-scrollbar-track {
  background: rgba(211, 206, 206, 0.95);
  background-clip: padding-box;
}

#event-list::-webkit-scrollbar-thumb,
#country-content::-webkit-scrollbar-thumb {
  background: rgba(27, 26, 26, 0.95);
  height: 50px;
}

.event-day-separator {
  z-index: 5;
  padding: 6px 10px;
  margin: 8px 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #de302a;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
}

.event-item {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  margin-bottom: 10px;
  padding: 10px 12px;
  border-left: 4px solid #111;
  transition: transform 0.2s, box-shadow 0.2s;
}

.event-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.event-item h4,
.event-content h4 {
  margin: 0;
  font-size: 14px;
  color: #111;
}

.event-item p,
.event-content p {
  margin: 4px 0;
  font-size: 12px;
  color: #333;
}

.event-item .date,
.event-content .date {
  font-size: 11px;
  color: #666;
}

.event-content .date {
  font-style: italic;
}

.event-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.event-readmore-wrap {
  margin-top: 10px;
}

.event-readmore-btn {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
  color: #000;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font-family: inherit;
}

.event-readmore-btn:hover {
  color: #E4312A;
}

.event-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
}

.event-violences {
  border-left-color: #FF9800;
}

.event-autres {
  border-left-color: #607D8B;
}

.event-tues {
  border-left-color: #dc143c;
}

.event-disparus {
  border-left-color: #2196F3;
}

.event-arretes-detenus-otages {
  border-left-color: #af1c83ff;
}

.event-item.highlighted {
  animation: event-card-blink 1s ease-in-out 2;
}

@keyframes event-card-blink {
  0% {
    box-shadow: 0 0 0 rgba(220, 20, 60, 0);
    background-color: #ffffff;
  }

  25% {
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.5);
    background-color: #fff5f7;
  }

  50% {
    box-shadow: 0 0 0 rgba(220, 20, 60, 0);
    background-color: #ffffff;
  }

  75% {
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.5);
    background-color: #fff5f7;
  }

  100% {
    box-shadow: 0 0 0 rgba(220, 20, 60, 0);
    background-color: #ffffff;
  }
}

#event-footer {
  border-top: 1px solid #eee;
  padding: 12px 16px 10px;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event-footer-note-wrap {
  display: flex;
  align-items: center;
}

.event-footer-note {
  margin: 0;
  line-height: 1.4;
  flex: 1;
  font-size: 11px;
}

/* =========================
   RIGHT PANEL
   ========================= */

#country-panel {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  height: calc(100% - var(--topbar-height));
  width: 380px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: visible;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  border-left: 1px solid #ddd;
}

#country-panel.expanded {
  transform: translateX(0);
}

#country-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 10px;
  gap: 16px;
  overflow-y: auto;
}

#country-footer {
  border-top: 1px solid #eee;
  padding: 8px 12px 10px;
  font-size: 11px;
  color: #666;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 12px;
}

.footer-box {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 11px;
}

.country-footer-tuto {
  grid-column: 1;
  grid-row: 1;
}

.country-footer-lang {
  grid-column: 2;
  grid-row: 1;
}

.country-footer-credits {
  grid-column: 1 / span 2;
  grid-row: 2;
  display: flex;
  align-items: center;
}

.country-footer-note {
  margin: 0;
  line-height: 1.4;
  flex: 1;
}

/* Right sections */
#country-charts {
  padding: 0 4px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#right-view-pays {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.right-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.right-section:last-child {
  border-bottom: none;
}

.right-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.right-section-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #111;
  text-transform: uppercase;
}

#country-chart-container,
#cities-chart-container {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.regions-choropleth-layer,
.regions-choropleth-layer:focus,
.regions-choropleth-layer.leaflet-interactive:focus {
  outline: none;
}

.regions-choropleth-tooltip {
  border: 1px solid rgba(22, 32, 29, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  color: #16201d;
  font-family: "Electrolize", sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.25;
  box-shadow: 0 8px 18px rgba(14, 24, 20, 0.16);
}

body.theme-dark .regions-choropleth-tooltip {
  border-color: rgba(230, 241, 237, 0.18);
  background: rgba(18, 27, 25, 0.94);
  color: #eef5f2;
}

#right-panel-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
  z-index: 3;
  backdrop-filter: blur(4px);
  padding: 6px 0;
}

.chart-tab-btn {
  min-width: 0;
  width: 100%;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
  color: #16201d;
  cursor: pointer;
  font-family: "Electrolize", sans-serif;
  font-size: 0.74rem;
  font-weight: 900;
  overflow-wrap: anywhere;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.right-panel-legend .right-panel-legend-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  text-align: left;
  line-height: 1.25;
}

.right-panel-legend-button .bottom-chart-swatch {
  flex: 0 0 10px;
}

.right-panel-legend-button[aria-pressed="false"] .bottom-chart-swatch {
  opacity: 0.35;
}

.chart-tab-btn:hover,
.chart-tab-btn:focus-visible,
.chart-tab-btn.active {
  border-color: #b60038;
  color: #8d002c;
  background: rgba(182, 0, 56, 0.1);
}

.chart-tab-btn:focus-visible {
  outline: 2px solid #b60038;
  outline-offset: 2px;
}

body.theme-dark .chart-tab-btn {
  border-color: rgba(230, 241, 237, 0.18);
  color: #eef5f2;
  background: rgba(255, 255, 255, 0.07);
}

body.theme-dark .chart-tab-btn:hover,
body.theme-dark .chart-tab-btn:focus-visible,
body.theme-dark .chart-tab-btn.active {
  border-color: #b60038;
  color: #ffd6e3;
  background: rgba(182, 0, 56, 0.22);
}

.chart-placeholder {
  font-size: 12px;
  color: #666;
  text-align: center;
  margin: 0;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.chart-bar-row {
  display: grid;
  grid-template-columns: 1fr 3fr auto;
  align-items: center;
  gap: 6px;
}

.chart-bar-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
}

.chart-bar-label:hover {
  text-decoration: underline;
}

.chart-bar-label:active {
  color: rgba(222, 48, 42, 0.95);
  font-weight: 700;
}

.chart-bar {
  position: relative;
  height: 12px;
  background: #f0f0f0;
  overflow: hidden;
  display: flex;
  border-radius: 999px;
}

.chart-bar-fill,
.chart-bar-segment {
  height: 100%;
}

.chart-bar-fill {
  transition: width 0.3s ease;
}

.chart-bar-value {
  font-weight: 600;
  font-size: 11px;
  opacity: 0.5;
}

.chart-bar-fill-violences {
  background: #FF9800;
}

.chart-bar-fill-autres {
  background: #607D8B;
}

.chart-bar-fill-tues {
  background: #dc143c;
}

.chart-bar-fill-disparus {
  background: #2196F3;
}

.chart-bar-fill-arretes-detenus-otages {
  background: #af1c83ff;
}

.chart-bar-row.is-current-country .chart-bar-label,
.chart-bar-row.is-current-country .chart-bar-value {
  color: #e40046;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  font-size: 11px;
}

.lang-sep {
  opacity: 0.6;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 2px 4px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.6;
}

.lang-btn.lang-active {
  font-weight: 700;
  opacity: 1;
  text-decoration: underline;
}

/* =========================
   BOTTOM CHART
   ========================= */

.bottom-chart {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1101;
  height: 50vh;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(6px);
}

.bottom-chart.open {
  transform: translateY(0);
}

.bottom-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
}

.bottom-chart-title {
  font-size: 18px;
  font-weight: 700;
  color: #111;
}

.bottom-chart-subtitle {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #111;
}

.bottom-chart-body {
  padding: 0 25px 12px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.bottom-chart-canvas-wrap {
  flex: 1;
  min-height: 0;
}

#bottom-chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.bottom-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 10px;
}

.bottom-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.bottom-chart-legend-item.off {
  opacity: 0.35;
}

.bottom-chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

#toggle-bottom-chart {
  position: absolute;
  top: -40px;
  left: 45%;
  right: 55%;
  width: 15%;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: #111;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  z-index: 1201;
}

#toggle-bottom-chart:hover {
  background: #000;
  color: #fff;
}

#bottom-chart-panel.open #toggle-bottom-chart {
  transform: rotate(180deg);
}

#bottom-chart-panel.open #toggle-bottom-chart:hover {
  background: rgba(0, 0, 0, 0.95);
  color: rgba(255, 255, 255, 0.95);
}

.bottom-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  max-width: 260px;
}

.bottom-tooltip.hidden {
  display: none;
}

.bottom-tooltip-date {
  font-weight: 700;
  margin-bottom: 6px;
  color: #E4312A;
}

.bottom-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bottom-tooltip-type {
  opacity: 0.95;
}

.bottom-tooltip-val {
  font-weight: 700;
}

/* =========================
   CREDITS MODAL
   ========================= */

.credits-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.credits-modal.hidden {
  display: none;
}

.credits-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.credits-card {
  position: relative;
  max-width: 720px;
  width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

.credits-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.credits-body {
  padding: 12px 14px;
  overflow: auto;
  max-height: calc(100vh - 120px);
  font-size: 13px;
  line-height: 1.45;
}

.credits-body a,
.credits-link {
  color: #e30044;
  text-decoration: underline;
}

.credits-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.7;
}

.credits-close:hover {
  opacity: 1;
}

.credits-link {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.credits-list {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.5;
}

.credits-list li {
  margin: 6px 0;
}

/* =========================================================
   3) DARK MODE
   ========================================================= */

body.theme-dark {
  --bg-0: #0b0b0f;
  --bg-1: #111117;
  --bg-2: #171723;
  --bg-3: rgba(17, 17, 23, 0.92);
  --text-0: #f2f2f6;
  --text-1: #cfcfda;
  --text-2: #a3a3b3;
  --border-0: rgba(255, 255, 255, 0.10);
  --border-1: rgba(255, 255, 255, 0.16);
  --shadow-0: 0 10px 28px rgba(0, 0, 0, 0.55);
  --shadow-1: 0 14px 40px rgba(0, 0, 0, 0.65);
  --panel-blur: blur(6px);
  --accent: #e40046;
  --accent-soft: rgba(228, 0, 70, 0.45);
  color-scheme: dark;
}

body.theme-dark,
body.theme-dark html {
  background: var(--bg-0);
  color: var(--text-0);
}

/* Base UI */
body.theme-dark .collapse-btn {
  background: rgba(17, 17, 23, 0.92);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text-0);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55);
}

body.theme-dark .collapse-btn:hover {
  background: rgba(17, 17, 23, 0.98);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.65);
}

body.theme-dark .collapse-btn:active {
  background: rgba(228, 0, 70, 0.18);
  border-color: rgba(228, 0, 70, 0.45);
  box-shadow: 0 10px 22px rgba(228, 0, 70, 0.18);
}

/* Loading */
body.theme-dark #loading-overlay {
  background: radial-gradient(circle at top, #0f0f14 0%, #0b0b0f 45%, #07070a 100%);
}

body.theme-dark .loading-box {
  background: rgba(17, 17, 23, 0.92);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border-0);
  backdrop-filter: var(--panel-blur);
}

body.theme-dark .loading-title {
  color: var(--text-0);
}

body.theme-dark .loading-subtitle {
  color: var(--text-1);
}

body.theme-dark .loading-subtext {
  color: var(--text-2);
}

body.theme-dark .loading-bar {
  background: rgba(228, 0, 70, 0.18);
}

body.theme-dark .loading-bar-fill {
  background: linear-gradient(90deg, #b20a2c, #e40046);
}

/* Tutorial */
body.theme-dark .tutorial-card {
  background: rgba(17, 17, 23, 0.96);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-1);
}

body.theme-dark #tutorial-title {
  color: var(--text-0);
}

body.theme-dark #tutorial-body,
body.theme-dark #tutorial-body-2 {
  color: var(--text-1);
}

body.theme-dark .tutorial-btn-main {
  background: #0d0d12;
  color: var(--text-0);
  border: 1px solid var(--border-0);
}

body.theme-dark .tutorial-btn-main:hover,
body.theme-dark #tutorial-replay-btn:hover {
  background: var(--accent);
}

body.theme-dark .tutorial-btn-ghost {
  color: var(--text-0);
  border: 1px solid var(--border-1);
}

body.theme-dark #tutorial-replay-btn {
  background: #0d0d12;
  color: var(--text-0);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
}

/* Map */
body.theme-dark .custom-cluster {
  background-color: #0d0d12;
  border: 1px solid var(--border-1);
  color: var(--text-0);
}

body.theme-dark .custom-cluster:hover {
  background-color: #12121a;
  box-shadow: 0 0 8px rgba(228, 0, 70, 0.55);
}

body.theme-dark .marker-icon {
  background-color: rgba(255, 255, 255, 0.95);
}

body.theme-dark .marker-icon:hover {
  filter: brightness(1.35);
  box-shadow: 0 0 8px rgba(228, 0, 70, 0.55);
}

body.theme-dark .country-highlight {
  filter: drop-shadow(0 0 2px rgba(228, 0, 70, 0.55));
}

/* Topbar */
body.theme-dark .app-topbar {
  background: rgba(17, 17, 23, 0.92);
  border-bottom: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
  backdrop-filter: var(--panel-blur);
}

body.theme-dark .app-topbar-title {
  color: var(--text-0);
}

body.theme-dark .topbar-nav-btn {
  background: rgba(17, 17, 23, 0.92);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text-0);
}

body.theme-dark .topbar-nav-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.theme-dark .topbar-nav-btn.is-active {
  background: rgba(228, 0, 70, 0.18);
  border-color: rgba(228, 0, 70, 0.40);
  color: var(--text-0);
}

/* Playback */
body.theme-dark .playback-btn {
  background: #0f0f14;
  border: 1px solid var(--border-1);
  color: var(--text-0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

body.theme-dark .playback-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.theme-dark .playback-main {
  border-color: rgba(242, 242, 246, 0.5);
}

body.theme-dark #playback-speed {
  background: #0f0f14;
  color: var(--text-0);
  border: 1px solid var(--border-1);
}

body.theme-dark .playback-date {
  color: var(--text-2);
}

/* Left panel */
body.theme-dark #event-panel {
  background: rgba(17, 17, 23, 0.92);
  border-right: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
  backdrop-filter: var(--panel-blur);
}

body.theme-dark #event-header {
  background: rgba(17, 17, 23, 0.96);
  border-bottom: 1px solid var(--border-0);
}

body.theme-dark .event-section {
  border-bottom: 1px solid var(--border-0);
}

body.theme-dark .event-section-title {
  color: var(--text-0);
}

body.theme-dark .header-legend-item {
  color: var(--text-1);
}

body.theme-dark .header-legend-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.theme-dark .header-legend-count {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-0);
}

body.theme-dark .header-legend-item.is-off .header-legend-count {
  background: rgba(255, 255, 255, 0.05);
}

body.theme-dark .header-legend-violences .header-legend-count {
  background: rgba(255, 152, 0, 0.15);
  color: #EF6C00;
}

body.theme-dark .header-legend-autres .header-legend-count {
  background: rgba(96, 125, 139, 0.15);
  color: #455A64;
}

body.theme-dark .header-legend-tues .header-legend-count {
  background: rgba(220, 20, 60, 0.15);
  color: #C2185B;
}

body.theme-dark .header-legend-disparus .header-legend-count {
  background: rgba(33, 150, 243, 0.15);
  color: #1976D2;
}

body.theme-dark .header-legend-arretes-detenus-otages .header-legend-count {
  background: rgba(175, 28, 131, 0.15);
  color: #af1c83ff;
}

body.theme-dark .active-filters-clear {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-1);
  color: var(--text-0);
}

body.theme-dark .active-filters-clear:hover {
  background: rgba(255, 255, 255, 0.10);
}

body.theme-dark .active-filters-empty {
  color: var(--text-2);
}

body.theme-dark .active-filter-chip {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-0);
}

body.theme-dark #event-list {
  color: var(--text-0);
}

body.theme-dark #event-list::-webkit-scrollbar-track,
body.theme-dark #country-content::-webkit-scrollbar-track {
  background: rgba(83, 81, 81, 0.95);
}

body.theme-dark #event-list::-webkit-scrollbar-thumb,
body.theme-dark #country-content::-webkit-scrollbar-thumb {
  background: rgba(222, 48, 42, 0.95);
}

body.theme-dark .event-item {
  background: rgba(15, 15, 20, 0.92);
  border: 1px solid var(--border-0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

body.theme-dark .event-item:hover {
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.55);
}

body.theme-dark .event-item h4 {
  color: var(--text-0);
}

body.theme-dark .event-item p,
body.theme-dark .event-content p {
  color: var(--text-1);
}

body.theme-dark .event-item .date,
body.theme-dark .event-content .date {
  color: var(--text-2);
}

body.theme-dark .event-card {
  background: rgba(15, 15, 20, 0.92);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border-0);
}

body.theme-dark .event-day-separator {
  color: #de302a;
  background: rgba(17, 17, 23, 0.05);
  border: 1px solid var(--border-0);
}

body.theme-dark #event-footer {
  background: rgba(17, 17, 23, 0.96);
  border-top: 1px solid var(--border-0);
}

body.theme-dark .event-footer-note-wrap {
  background: rgba(17, 17, 23, 0.92);
}

body.theme-dark .event-footer-note {
  color: var(--text-2);
}

body.theme-dark .event-violences {
  border-left-color: #FF9800;
}

body.theme-dark .event-autres {
  border-left-color: #607D8B;
}

body.theme-dark .event-tues {
  border-left-color: #dc143c;
}

body.theme-dark .event-disparus {
  border-left-color: #2196F3;
}

body.theme-dark .event-arretes-detenus-otages {
  border-left-color: #af1c83ff;
}

body.theme-dark .event-icon,
body.theme-dark .header-legend-icon {
  background-color: rgba(255, 255, 255, 0.95);
}

body.theme-dark .event-readmore-btn {
  background: rgba(20, 20, 20, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f2f2f2;
}

/* Right panel */
body.theme-dark #country-panel {
  background: rgba(17, 17, 23, 0.92);
  border-left: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
  backdrop-filter: var(--panel-blur);
}

body.theme-dark .right-section {
  border-bottom: 1px solid var(--border-0);
}

body.theme-dark .right-section-title {
  color: var(--text-0);
}

body.theme-dark #right-panel-legend {
  background: rgba(17, 17, 23, 0.92);
}

body.theme-dark #country-footer {
  border-top: 1px solid var(--border-0);
  color: var(--text-2);
}

body.theme-dark .country-footer-lang,
body.theme-dark .country-footer-credits {
  background: rgba(17, 17, 23, 0.92);
}

body.theme-dark .chart-placeholder {
  color: var(--text-2);
}

body.theme-dark .chart-bar {
  background: rgba(255, 255, 255, 0.07);
}

body.theme-dark .chart-bar-label {
  color: var(--text-1);
}

body.theme-dark .chart-bar-value {
  color: var(--text-2);
  opacity: 0.8;
}

body.theme-dark .chart-bar-label:active {
  color: rgba(222, 48, 42, 0.95);
  font-weight: 700;
}

body.theme-dark .chart-bar-row.is-current-country .chart-bar-label,
body.theme-dark .chart-bar-row.is-current-country .chart-bar-value {
  color: var(--accent);
}

/* Bottom chart */
body.theme-dark .bottom-chart {
  background: rgba(17, 17, 23, 0.1);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-1);
  backdrop-filter: var(--panel-blur);
  color: #fff;
}

body.theme-dark .bottom-chart-title {
  color: var(--text-0);
}

body.theme-dark .bottom-chart-legend-item {
  border: 1px solid var(--border-0);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-1);
}

body.theme-dark .bottom-chart-swatch {
  border: 1px solid var(--border-1);
}

body.theme-dark #toggle-bottom-chart {
  background: rgba(17, 17, 23, 0.96);
  color: var(--text-0);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
}

body.theme-dark #toggle-bottom-chart:hover,
body.theme-dark #bottom-chart-panel.open #toggle-bottom-chart:hover {
  background: #000;
  color: var(--text-0);
}

body.theme-dark #bottom-chart-panel.open #toggle-bottom-chart {
  background: rgba(17, 17, 23, 0.96);
}

/* Credits */
body.theme-dark .credits-card {
  background: rgba(17, 17, 23, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-1);
}

body.theme-dark .credits-header {
  background: rgba(17, 17, 23, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

body.theme-dark .credits-body {
  color: #fff;
  background: rgba(17, 17, 23, 0.96);
}

body.theme-dark .credits-close {
  color: #fff;
}

body.theme-dark .leaflet-control-layers {
  background: rgba(17, 17, 23, 0.92);
  border: 1px solid var(--border-0);
  box-shadow: var(--shadow-0);
  color: var(--text-0);
}

body.theme-dark .leaflet-control-layers label {
  color: var(--text-1);
}body.theme-dark .event-item.highlighted {
  animation: event-card-blink-dark 0.8s ease-in-out 2;
}

@keyframes event-card-blink-dark {
  0% {
    box-shadow: 0 0 0 rgba(228, 0, 70, 0);
    background-color: rgba(15, 15, 20, 0.92);
  }

  25% {
    box-shadow: 0 0 14px rgba(228, 0, 70, 0.45);
    background-color: rgba(228, 0, 70, 0.10);
  }

  50% {
    box-shadow: 0 0 0 rgba(228, 0, 70, 0);
    background-color: rgba(15, 15, 20, 0.92);
  }

  75% {
    box-shadow: 0 0 14px rgba(228, 0, 70, 0.45);
    background-color: rgba(228, 0, 70, 0.10);
  }

  100% {
    box-shadow: 0 0 0 rgba(228, 0, 70, 0);
    background-color: rgba(15, 15, 20, 0.92);
  }
}

/* =========================================================
   4) MOBILE
   ========================================================= */

@media (max-width: 600px) {
  .loading-box {
    margin: 0 16px;
    padding: 24px 18px 18px;
  }

  .loading-title {
    font-size: 22px;
  }

  .loading-subtitle {
    font-size: 13px;
  }
}

@media (max-width: 768px),
(orientation: portrait) {
  :root {
    --ui-font-size: 12px;
    --viewport-fit: cover;
    --topbar-height: 104px;
  }

  body {
    font-size: var(--ui-font-size);
    line-height: 1.15;
    -webkit-text-size-adjust: 80%;
    text-size-adjust: 80%;
  }

  .playback-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .playback-btn.playback-main {
    width: 34px;
  }

  #playback-speed {
    flex: 0 0 auto;
    max-width: 50px;
  }

  #playback-date {
    font-size: 11px;
  }

  #event-panel,
  #country-panel {
    width: min(300px, 100%);
  }

  #country-footer {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .chart-bar-row {
    grid-template-columns: 1.8fr 2.8fr auto;
    gap: 4px;
  }

  .chart-bar-label,
  .chart-tab-btn,
  .bottom-chart-legend-item,
  .event-item p,
  .event-card p,
  .event-content p,
  .event-item .date,
  .event-content .date {
    font-size: 12px;
  }

  .event-item h4,
  .event-card h4,
  .event-content h4 {
    font-size: 14px;
  }

  .header-legend-item {
    font-size: 8px;
    padding: 6px 8px;
  }

  .header-legend-count {
    font-size: 8px;
    min-width: 15px;
  }

  .tutorial-card {
    font-size: 15px;
  }

  .bottom-chart {
    height: 40vh;
    max-height: 40vh;
  }

  .bottom-chart-title {
    font-size: 16px;
  }

  #toggle-bottom-chart {
    top: -35px;
    right: 40%;
    left: 40%;
    width: 20%;
    height: 35px;
  }

  .app-topbar {
    gap: 10px;
    padding: 8px 10px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .app-topbar-left {
    flex: 1 1 100%;
  }

  .app-topbar-title {
    font-size: 14px;
  }

  .app-topbar-nav {
    order: 3;
    flex: 1 1 100%;
    padding-bottom: 2px;
  }

  .app-topbar-playback {
    display: none;
  }

  .topbar-nav-btn {
    font-size: 11px;
    padding: 8px 12px;
  }

  .topbar-playback-meta #playback-date {
    min-width: 64px;
    font-size: 11px;
  }
}

/* === UI harmonisee facon Exil === */
.app-topbar.map-title-panel {
  position: fixed;
  top: auto;
  right: auto;
  left: 0;
  bottom: 0;
  z-index: 1200;
  width: min(430px, 100%);
  min-width: 0;
  max-width: 100%;
  max-height: calc(100vh - 18px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(18, 40, 32, 0.12);
  border-bottom-left-radius: 0;
  border-radius: 8px 8px 8px 0;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 35px rgba(14, 24, 20, 0.16);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
  overflow: visible;
}

.app-topbar .map-title-heading {
  position: relative;
  min-width: 0;
  max-width: 100%;
  padding-right: 20px;
  cursor: pointer;
}

.app-topbar .map-title-heading::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #111;
  transform: translateY(-50%);
}

.app-topbar.collapsed .map-title-heading::after {
  border-top: 0;
  border-bottom: 6px solid #111;
}

.app-topbar.collapsed .app-topbar-playback,
.app-topbar.collapsed .title-filter-grid,
.app-topbar.collapsed .title-category-list {
  display: none;
}

.app-topbar-logo {
  flex: 0 0 auto;
  width: 56px;
  height: auto;
  max-height: 38px;
}

.app-topbar-brand {
  min-width: 0;
  max-width: 100%;
}

.app-topbar-title {
  min-width: 0;
  max-width: 100%;
  color: #111;
  font-size: clamp(1rem, 1.35vw, 1.38rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.app-topbar-nav {
  display: none;
}

.app-topbar-playback {
  display: flex;
  justify-content: flex-start;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
}

.app-topbar-playback .playback-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.title-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.title-filter-grid select {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  text-overflow: ellipsis;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
}

.title-filter-grid #title-author-select {
  grid-column: 1;
}

.title-filter-grid .title-date-start {
  grid-column: 1;
}

.title-filter-grid select.hidden {
  display: none;
}

.title-category-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  max-width: 100%;
  gap: 7px;
}

.title-category-list .header-legend-item {
  min-width: 0;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
}

.title-category-list .header-legend-label {
  white-space: normal;
  line-height: 1.1;
}

#event-panel,
#country-panel {
  top: 0;
  height: 100%;
}

#header-legend-unused {
  display: none;
}

.event-section:has(#header-legend-unused) {
  display: none;
}

.utility-menu {
  position: absolute;
  z-index: 1300;
  left: 10px;
  top: 88px;
}

.utility-menu-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(22, 32, 29, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  box-shadow: 0 7px 18px rgba(14, 24, 20, 0.14);
  cursor: pointer;
}

.utility-menu-toggle span {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
}

.utility-menu-toggle span::before,
.utility-menu-toggle span::after,
.utility-menu-toggle span i {
  content: "";
  display: block;
  width: 15px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.utility-menu.open .utility-menu-toggle,
.utility-menu-toggle:hover,
.utility-menu-toggle:focus-visible {
  border-color: #111;
  background: #111;
  color: #fff;
}

.utility-menu-panel {
  position: absolute;
  left: 0;
  top: 40px;
  display: grid;
  gap: 7px;
  width: 176px;
  padding: 8px;
  border: 1px solid rgba(22, 32, 29, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 38px rgba(14, 24, 20, 0.18);
  backdrop-filter: blur(10px);
}

.utility-menu-panel[hidden] {
  display: none;
}

.utility-menu-item {
  min-height: 32px;
  width: 100%;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
  color: #111;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
}

.utility-menu-field {
  display: grid;
  gap: 4px;
  color: #666;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.language-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
}

.language-toggle .lang-btn {
  min-height: 32px;
  border: 0;
  border-right: 1px solid #d7dfdc;
  background: transparent;
  color: #666;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  opacity: 1;
}

.language-toggle .lang-btn:last-child {
  border-right: 0;
}

.language-toggle .lang-btn.lang-active {
  background: rgba(228, 0, 70, 0.1);
  color: #111;
  text-decoration: none;
}

.bottom-chart {
  top: 0;
  bottom: auto;
  transform: translateY(-100%);
}

.bottom-chart.open {
  transform: translateY(0);
}

#toggle-bottom-chart {
  top: auto;
  bottom: -40px;
}

#bottom-chart-panel.open #toggle-bottom-chart {
  transform: rotate(0deg);
}

body.theme-dark .app-topbar.map-title-panel,
body.theme-dark .utility-menu-panel,
body.theme-dark .utility-menu-toggle {
  border-color: rgba(230, 241, 237, 0.14);
  background: rgba(18, 27, 25, 0.92);
  color: #eef5f2;
}

body.theme-dark .app-topbar-title,
body.theme-dark .utility-menu-item,
body.theme-dark .title-filter-grid select,
body.theme-dark .language-toggle .lang-btn {
  color: #eef5f2;
}

body.theme-dark .title-filter-grid select,
body.theme-dark .title-category-list .header-legend-item,
body.theme-dark .utility-menu-item,
body.theme-dark .language-toggle {
  border-color: rgba(230, 241, 237, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

@media (max-width: 768px) {
  .app-topbar.map-title-panel {
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    padding: 10px;
  }

  .title-filter-grid,
  .title-category-list {
    grid-template-columns: 1fr;
  }

  .title-filter-grid #title-author-select {
    grid-column: auto;
  }

  .utility-menu {
    left: 8px;
    top: 82px;
  }
}

/* Harmonized title and panel controls */
.app-topbar.map-title-panel {
  display: flex;
  flex-direction: column;
}

.app-topbar-playback {
  order: 20;
  margin-top: 10px;
}

.app-topbar.map-title-panel .title-filter-grid {
  order: 10;
}

.app-topbar.map-title-panel .title-category-list {
  order: 15;
}

.app-topbar.map-title-panel .title-clear-filters {
  order: 18;
}

.app-topbar.map-title-panel.collapsed .app-topbar-playback,
.app-topbar.map-title-panel.collapsed .title-filter-grid,
.app-topbar.map-title-panel.collapsed .title-category-list {
  display: none !important;
}

.title-filter-grid select,
#ville-select {
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
  color: #111;
  font-family: "Electrolize", sans-serif;
  font-size: 0.76rem;
  font-weight: 850;
}

.title-filter-grid select.hidden,
#ville-select.hidden {
  display: block;
}

.title-category-list {
  gap: 6px;
  margin-top: 8px;
}

.title-category-list .header-legend-item {
  min-height: 28px;
  padding: 3px 5px;
  gap: 4px;
  font-size: 0.66rem;
}

.title-category-list .header-legend-count {
  min-width: 20px;
  padding: 1px 4px;
  font-size: 0.64rem;
}

.title-category-list .header-legend-icon {
  width: 14px;
  height: 14px;
}

.title-category-list .header-legend-label {
  font-size: 0.66rem;
}

#event-header,
.bottom-chart-header {
  position: relative;
}

#event-header > .panel-close-button {
  align-self: flex-end;
}

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

.bottom-chart-header > div {
  min-width: 0;
  flex: 1;
}

.panel-close-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
  color: #111;
  cursor: pointer;
  font-family: "Electrolize", sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
}

.panel-close-button:hover,
.panel-close-button:focus-visible {
  border-color: #111;
  background: #111;
  color: #fff;
}

#country-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid #d7dfdc;
  background: #fff;
}

#country-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: #16201d;
  font-size: 0.9rem;
  font-weight: 900;
}

#country-panel #country-content {
  padding-top: 14px;
}

body.theme-dark #country-header {
  border-color: rgba(230, 241, 237, 0.14);
  background: #121b19;
}

body.theme-dark #country-name {
  color: #eef5f2;
}

body.theme-dark .panel-close-button,
body.theme-dark .title-filter-grid select,
body.theme-dark #ville-select {
  border-color: rgba(230, 241, 237, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: #eef5f2;
}#event-panel {
  left: 0;
  right: auto;
  transform: translateX(-100%);
}

#event-panel.expanded {
  transform: translateX(0);
}

#country-panel {
  left: auto;
  right: 0;
  transform: translateX(100%);
}

#country-panel.expanded {
  transform: translateX(0);
}

.app-topbar.map-title-panel.collapsed .title-clear-filters {
  display: none !important;
}

.app-topbar-playback {
  justify-content: center;
  align-self: center;
  width: 100%;
}

.topbar-playback-meta {
  flex: 0 0 auto;
}

#ville-select:disabled,
#ville-select.is-muted {
  border-color: #d7dfdc;
  background: #f1f3f2;
  color: #7d8782;
  cursor: not-allowed;
  opacity: 0.72;
}

.clear-filters-button,
.title-clear-filters {
  width: 100%;
  min-height: 32px;
  margin-top: 8px;
  border: 1px solid rgba(204, 45, 45, 0.26);
  border-radius: 6px;
  background: rgba(204, 45, 45, 0.08);
  color: #9f2525;
  cursor: pointer;
  font-family: "Electrolize", sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
}

.clear-filters-button[hidden],
.title-clear-filters[hidden] {
  display: none !important;
}

.clear-filters-button:hover,
.clear-filters-button:focus-visible,
.title-clear-filters:hover,
.title-clear-filters:focus-visible {
  border-color: #b60038;
  background: rgba(182, 0, 56, 0.12);
  color: #8d002c;
}

#event-header .panel-list-title {
  margin: 0;
  padding-right: 92px;
  color: #16201d;
  font-family: "Electrolize", sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0;
}

#event-header > .panel-close-button {
  position: absolute;
  top: 12px;
  right: 16px;
}

body.theme-dark #ville-select:disabled,
body.theme-dark #ville-select.is-muted {
  border-color: rgba(230, 241, 237, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(238, 245, 242, 0.5);
}

body.theme-dark .clear-filters-button,
body.theme-dark .title-clear-filters {
  border-color: rgba(228, 0, 70, 0.38);
  background: rgba(228, 0, 70, 0.12);
  color: #f4b4c8;
}

body.theme-dark #event-header .panel-list-title {
  color: #eef5f2;
}

/* Compact stacked timeline */
.bottom-chart {
  top: 0;
  bottom: auto;
  /* Hauteur utile du Mexique (78px), plus 24px réservés au titre. */
  height: 102px !important;
  max-height: 102px !important;
  min-height: 0;
  overflow: visible;
  transform: translateY(-100%);
}

.bottom-chart.open {
  transform: translateY(0);
}

.bottom-chart-subtitle,
.bottom-chart-legend-header,
#bottom-chart-legend,
#toggle-bottom-chart {
  display: none !important;
}

.bottom-chart-header {
  position: absolute;
  top: 4px;
  left: 10px;
  right: 10px;
  z-index: 2;
  padding: 0;
  border: 0;
  background: transparent;
}

.bottom-chart-header .bottom-chart-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.2;
}

.bottom-chart-header .panel-close-button {
  min-height: 24px;
}

.bottom-chart-body {
  height: 100%;
  padding: 31px 8px 7px;
}

.bottom-chart-canvas-wrap {
  position: relative;
  height: 100%;
  min-height: 0;
}

#bottom-chart-canvas {
  height: 100%;
  cursor: ew-resize;
}

.timeline-zoom-button {
  position: absolute;
  z-index: 4;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  color: #111;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font-family: "Electrolize", sans-serif;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -100%) scale(0.92);
  transition: opacity 2s ease, transform 0.16s ease;
}

.timeline-zoom-button.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -100%) scale(1);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.timeline-zoom-button:hover,
.timeline-zoom-button:focus-visible {
  border-color: #111;
  background: #111;
  color: #fff;
}

body.theme-dark .timeline-zoom-button {
  border-color: rgba(230, 241, 237, 0.18);
  background: rgba(18, 24, 22, 0.95);
  color: #eef5f2;
}

body.theme-dark .timeline-zoom-button:hover,
body.theme-dark .timeline-zoom-button:focus-visible {
  border-color: rgba(230, 241, 237, 0.45);
  background: #eef5f2;
  color: #111;
}

.bottom-tooltip-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 999px;
  vertical-align: middle;
}

.bottom-tooltip-total {
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  margin-top: 4px;
  padding-top: 4px;
}

@media (max-width: 768px) {
  .bottom-chart {
    height: 94px !important;
    max-height: 94px !important;
  }

  .bottom-chart-body {
    padding: 30px 7px 6px;
  }
}

.utility-menu {
  z-index: 2600;
  left: 10px;
  top: 88px;
}

body:has(#bottom-chart-panel.open) .utility-menu {
  top: 112px !important;
}

@media (max-width: 768px) {
  body:has(#bottom-chart-panel.open) .utility-menu {
    top: 104px !important;
  }
}

.utility-menu-toggle {
  color: #16201d;
  transition: opacity 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.utility-menu-toggle span {
  position: relative;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 15px;
}

.utility-menu:hover .utility-menu-toggle,
.utility-menu.open .utility-menu-toggle,
.utility-menu-toggle:focus-visible {
  border-color: #b60038;
  background: #b60038;
  color: #fff;
  box-shadow: 0 9px 22px rgba(182, 0, 56, 0.2);
  transform: scale(1.04);
}

.utility-menu-panel {
  width: 156px;
  opacity: 1;
  transform: translateY(0) scale(1);
  transform-origin: top left;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.2, 0.9, 0.2, 1), visibility 180ms ease;
}

.utility-menu-panel[hidden] {
  display: grid;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.94);
  visibility: hidden;
}

.utility-menu-item.active,
.utility-menu-item.is-active,
.language-toggle .lang-btn.active,
.language-toggle .lang-btn.lang-active {
  border-color: rgba(182, 0, 56, 0.28);
  background: rgba(182, 0, 56, 0.1);
  color: #8d002c;
}body.theme-dark .utility-menu-item.active,
body.theme-dark .utility-menu-item.is-active,
body.theme-dark .language-toggle .lang-btn.active,
body.theme-dark .language-toggle .lang-btn.lang-active {
  border-color: #b60038;
  background: #b60038;
  color: #fff;
}

@media (max-width: 768px) {.utility-menu {
    left: 8px;
    top: 82px;
  }

  .utility-menu-toggle {
    width: 30px;
    height: 30px;
  }
}

.event-section,
.right-section,
#event-footer.event-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(22, 32, 29, 0.1);
}

.event-section-header,
.right-section-header,
.legend-row,
.bottom-chart-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
}

.event-section-title,
.right-section-title,
.legend-row-title {
  color: #16201d;
  font-family: "Electrolize", sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.collapse-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
  color: #16201d;
  box-shadow: none;
  font-size: 0.86rem;
}

.collapse-btn:hover,
.collapse-btn:focus-visible {
  border-color: #b60038;
  background: rgba(182, 0, 56, 0.1);
  color: #8d002c;
  transform: none;
}

.event-footer-note-wrap,
.country-footer-credits {
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
}

.event-footer-note {
  margin: 0;
  color: #5f6b66;
  font-size: 0.72rem;
  line-height: 1.35;
}body.theme-dark .event-section,
body.theme-dark .right-section,
body.theme-dark #event-footer.event-section {
  border-color: rgba(230, 241, 237, 0.14);
}

body.theme-dark .event-section-title,
body.theme-dark .right-section-title,
body.theme-dark .legend-row-title {
  color: #eef5f2;
}

/* Transparent idle chrome */
.app-topbar.map-title-panel.collapsed:not(:hover):not(:focus-within) {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(22, 32, 29, 0.08);
  box-shadow: none;
  opacity: 0.42;
}

.app-topbar.map-title-panel.collapsed:hover,
.app-topbar.map-title-panel.collapsed:focus-within {
  opacity: 1;
}

.utility-menu:not(.open):not(:hover) .utility-menu-toggle:not(:focus-visible) {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(22, 32, 29, 0.08);
  box-shadow: none;
  opacity: 0.38;
}

.utility-menu:hover .utility-menu-toggle,
.utility-menu.open .utility-menu-toggle,
.utility-menu-toggle:focus-visible {
  opacity: 1;
}

body.theme-dark .app-topbar.map-title-panel.collapsed:not(:hover):not(:focus-within) {
  background: rgba(18, 27, 25, 0.16);
  border-color: rgba(230, 241, 237, 0.08);
}

body.theme-dark .utility-menu:not(.open):not(:hover) .utility-menu-toggle:not(:focus-visible) {
  background: rgba(18, 27, 25, 0.16);
  border-color: rgba(230, 241, 237, 0.08);
}.utility-menu {
  left: 10px !important;
  top: 88px !important;
}

.utility-menu-panel {
  top: 40px;
  display: grid;
  gap: 7px;
  width: 156px;
  padding: 9px;
}

.utility-menu-field {
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.language-toggle .lang-btn {
  min-height: 32px;
  font-size: 0.78rem;
  font-weight: 900;
}@media (max-width: 768px) {.utility-menu {
    left: 8px !important;
    top: 82px !important;
  }

  .utility-menu-panel {
    top: 36px;
    width: 146px;
  }
}

/* Right-side panels only */
#event-panel {
  left: auto !important;
  right: 0 !important;
  transform: translateX(100%) !important;
}

#event-panel.expanded {
  transform: translateX(0) !important;
}#tutorial-replay-btn.utility-menu-item {
  min-height: 32px;
  width: 100%;
  padding: 2px 6px;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
  color: #16201d;
  box-shadow: none;
  cursor: pointer;
  font-family: "Electrolize", sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
  transform: none;
  transition: none;
}

#tutorial-replay-btn.utility-menu-item:hover,
#tutorial-replay-btn.utility-menu-item:focus-visible,
#tutorial-replay-btn.utility-menu-item:active {
  border-color: #d7dfdc;
  background: #fff;
  color: #16201d;
  box-shadow: none;
  transform: none;
}

body.theme-dark #tutorial-replay-btn.utility-menu-item {
  border-color: rgba(230, 241, 237, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: #eef5f2;
}

body.theme-dark #tutorial-replay-btn.utility-menu-item:hover,
body.theme-dark #tutorial-replay-btn.utility-menu-item:focus-visible {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(182, 0, 56, 0.16);
}

/* Event panel header alignment */
#event-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title close"
    "search search";
  align-items: center;
  gap: 8px 10px;
}

#event-header .panel-list-title {
  grid-area: title;
  display: flex;
  align-items: center;
  min-height: 32px;
  margin: 0 !important;
  padding: 0 !important;
}

#event-header > .panel-close-button {
  grid-area: close;
  position: static !important;
  justify-self: end;
  align-self: center;
}

#event-header .event-header-search {
  grid-area: search;
  width: 100%;
}

#event-header > .event-section {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

/* Harmonized tutorial overlay, aligned with Exil */
#tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: block;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

#tutorial-overlay.tutorial-visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

#tutorial-overlay.tutorial-hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

#tutorial-overlay .tutorial-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(8, 18, 15, 0.42);
}

.tutorial-focus {
  position: fixed;
  z-index: 1;
  border: 3px solid #ffffff;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(8, 18, 15, 0.28), 0 0 0 5px rgba(182, 0, 56, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: left 180ms ease, top 180ms ease, width 180ms ease, height 180ms ease, opacity 140ms ease;
}

#tutorial-overlay .tutorial-card {
  position: fixed;
  right: 24px;
  bottom: 24px;
  left: auto;
  top: auto;
  z-index: 2;
  width: min(360px, calc(100vw - 32px));
  max-width: none;
  margin: 0;
  padding: 18px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  color: #16201d;
  box-shadow: 0 20px 55px rgba(5, 13, 10, 0.35);
  font-family: "Electrolize", sans-serif;
  text-align: left;
}

#tutorial-overlay.card-top .tutorial-card {
  top: 12px;
  bottom: auto;
}

#tutorial-overlay.card-bottom .tutorial-card {
  top: auto;
  bottom: 12px;
}

#tutorial-overlay.card-left .tutorial-card {
  right: auto;
  left: 24px;
}

#tutorial-title,
#tutorial-body,
#tutorial-subtitle,
#tutorial-body-2,
.tutorial-step {
  margin: 0;
}

#tutorial-title {
  margin-top: 5px;
  color: #16201d;
  font-size: 1.12rem;
  line-height: 1.16;
}

#tutorial-body,
#tutorial-body-2 {
  margin-top: 8px;
  color: #5f6b66;
  font-size: 0.9rem;
  line-height: 1.45;
}

#tutorial-subtitle {
  margin-top: 12px;
  color: #16201d;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.2;
}

.tutorial-step {
  color: #b60038;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

#tutorial-overlay .tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

#tutorial-overlay .tutorial-btn-main,
#tutorial-overlay .tutorial-btn-ghost,
#tutorial-overlay .tutorial-btn-lang {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

#tutorial-overlay .tutorial-btn-main {
  border: 1px solid #b60038;
  background: #b60038;
  color: #ffffff;
}

#tutorial-overlay .tutorial-btn-ghost,
#tutorial-overlay .tutorial-btn-lang {
  border: 1px solid #d7dfdc;
  background: #ffffff;
  color: #5f6b66;
}

#tutorial-overlay .tutorial-btn-main:hover {
  background: #e40046;
  border-color: #e40046;
  transform: none;
}

#tutorial-overlay .tutorial-btn-ghost:hover,
#tutorial-overlay .tutorial-btn-lang:hover {
  background: rgba(182, 0, 56, 0.06);
  color: #16201d;
  transform: none;
  box-shadow: none;
}

body.theme-dark #tutorial-overlay .tutorial-card {
  border: 0;
  background: #ffffff;
  color: #16201d;
  box-shadow: 0 20px 55px rgba(5, 13, 10, 0.35);
}

body.theme-dark #tutorial-title,
body.theme-dark #tutorial-subtitle {
  color: #16201d;
}

body.theme-dark #tutorial-body,
body.theme-dark #tutorial-body-2 {
  color: #5f6b66;
}

body.theme-dark #tutorial-overlay .tutorial-btn-main {
  border-color: #b60038;
  background: #b60038;
  color: #ffffff;
}

body.theme-dark #tutorial-overlay .tutorial-btn-ghost,
body.theme-dark #tutorial-overlay .tutorial-btn-lang {
  border-color: #d7dfdc;
  background: #ffffff;
  color: #5f6b66;
}

@media (max-width: 520px) {
  #tutorial-overlay .tutorial-card,
  #tutorial-overlay.card-left .tutorial-card {
    right: 12px;
    left: 12px;
    width: auto;
    max-height: min(46vh, 260px);
    overflow-y: auto;
    padding: 15px;
  }

  #tutorial-title {
    font-size: 1rem;
  }

  #tutorial-body,
  #tutorial-body-2 {
    font-size: 0.82rem;
    line-height: 1.35;
  }
}

/* RSF cartography modal */
.rsf-cartography-modal[hidden],
.rsf-cartography-modal.hidden {
  display: none !important;
}

.rsf-cartography-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 24px;
  font-family: "Electrolize", sans-serif;
}

.rsf-cartography-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 15, 0.48);
  backdrop-filter: blur(5px);
}

.rsf-cartography-card {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid rgba(22, 32, 29, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  color: #16201d;
  box-shadow: 0 24px 70px rgba(5, 13, 10, 0.34);
}

.rsf-cartography-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.rsf-cartography-header h2 {
  margin: 0;
  color: #16201d;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0;
}

.rsf-cartography-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
  color: #16201d;
  cursor: pointer;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.rsf-cartography-close:hover,
.rsf-cartography-close:focus-visible {
  border-color: #b60038;
  background: rgba(182, 0, 56, 0.1);
  color: #8d002c;
}

.rsf-cartography-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.rsf-cartography-link {
  display: grid;
  grid-template-rows: minmax(128px, 1fr) auto;
  min-height: 218px;
  overflow: hidden;
  border: 1px solid #d7dfdc;
  border-radius: 8px;
  background: #fff;
  color: #16201d;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.rsf-cartography-link:hover,
.rsf-cartography-link:focus-visible {
  border-color: #b60038;
  box-shadow: 0 12px 28px rgba(5, 13, 10, 0.16);
  transform: translateY(-1px);
}

.rsf-cartography-link img {
  width: 100%;
  height: 150px;
  display: block;
  object-fit: cover;
  background: #eef2f0;
}

.rsf-cartography-link span {
  display: flex;
  align-items: flex-end;
  min-height: 64px;
  padding: 10px 12px;
  color: #16201d;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.18;
}

body.theme-dark .rsf-cartography-card,
body.dark-map-theme .rsf-cartography-card,
body.theme-dark .rsf-cartography-link,
body.dark-map-theme .rsf-cartography-link,
body.theme-dark .rsf-cartography-link span,
body.dark-map-theme .rsf-cartography-link span,
body.theme-dark .rsf-cartography-close,
body.dark-map-theme .rsf-cartography-close {
  border-color: rgba(230, 241, 237, 0.18);
  background: rgba(18, 27, 25, 0.98);
  color: #eef5f2;
}

body.theme-dark .rsf-cartography-header h2,
body.dark-map-theme .rsf-cartography-header h2,
body.theme-dark .rsf-cartography-link span,
body.dark-map-theme .rsf-cartography-link span {
  color: #eef5f2;
}

#rsf-cartography-toggle.utility-menu-item {
  margin-top: 8px;
  border: 1px solid #e40046;
  color: #e40046;
  font-weight: 700;
}

#rsf-cartography-toggle.utility-menu-item:hover,
#rsf-cartography-toggle.utility-menu-item:focus-visible {
  background: rgba(228, 0, 70, 0.1);
  border-color: #e40046;
}

body.theme-dark #rsf-cartography-toggle.utility-menu-item,
body.dark-map-theme #rsf-cartography-toggle.utility-menu-item {
  border-color: #ff4f7f;
  color: #ff4f7f;
}

@media (max-width: 680px) {
  .rsf-cartography-modal {
    padding: 12px;
  }

  .rsf-cartography-card {
    width: min(100%, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 12px;
  }

  .rsf-cartography-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .rsf-cartography-link {
    min-height: 184px;
  }

  .rsf-cartography-link img {
    height: 126px;
  }
}

/* Responsive viewport lock: panels must never create page scroll. */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow: hidden !important;
  overscroll-behavior: none;
}

#map {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  overflow: hidden;
}

#event-panel,
#country-panel {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  right: 0 !important;
  width: min(380px, 100vw) !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden !important;
  transform: translate3d(100%, 0, 0) !important;
  visibility: hidden;
  pointer-events: none;
  z-index: 1600;
}

#event-panel.expanded,
#country-panel.expanded {
  transform: translate3d(0, 0, 0) !important;
  visibility: visible;
  pointer-events: auto;
}

#event-panel.collapsed:not(.expanded),
#country-panel.collapsed:not(.expanded) {
  transform: translate3d(100%, 0, 0) !important;
}

#event-header,
#country-header,
.bottom-chart-header {
  flex: 0 0 auto;
  box-sizing: border-box;
}

#event-list,
#country-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 768px), (orientation: portrait) {
  #event-panel,
  #country-panel {
    width: 90vw !important;
    max-width: 90vw !important;
  }
}

@media (max-width: 768px), (max-height: 520px), (hover: none) and (pointer: coarse) {
  #event-panel,
  #country-panel {
    width: 90vw !important;
    max-width: 90vw !important;
  }
}

.title-filter-grid .title-date-control {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  min-height: 34px;
  max-width: none;
  justify-self: stretch;
  padding: 0 9px;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #fff;
  color: #111;
  font-family: "Electrolize", sans-serif;
  font-size: 0.76rem;
  font-weight: 850;
}

.title-date-control {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  cursor: pointer;
  line-height: 1;
  text-align: left;
}

.title-date-control.active,
.title-date-control:hover,
.title-date-control:focus,
.title-date-control:focus-visible {
  border-color: rgba(204, 45, 45, 0.42);
  background: rgba(204, 45, 45, 0.1);
  color: #9f2525;
}

.title-date-control::after {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1.8px solid currentColor;
  border-radius: 3px;
  background:
    linear-gradient(currentColor, currentColor) 0 4px / 100% 1.6px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 0 / 1.6px 3px no-repeat,
    linear-gradient(currentColor, currentColor) calc(100% - 4px) 0 / 1.6px 3px no-repeat;
  opacity: 0.78;
}

.title-date-control span {
  min-width: 0;
  margin: 0;
  color: #5f6b66;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.title-date-control.active span {
  color: #9f2525;
}

.title-date-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  font: inherit;
  opacity: 0;
  pointer-events: auto;
  color-scheme: light;
}

body.theme-dark .title-date-control {
  border-color: rgba(230, 241, 237, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: #eef5f2;
}

body.theme-dark .title-date-input {
  color: transparent;
  color-scheme: dark;
}

body.theme-dark .title-date-control.active {
  border-color: rgba(228, 0, 70, 0.38);
  background: rgba(228, 0, 70, 0.12);
  color: #f4b4c8;
}

body.theme-dark .title-date-control span,
body.theme-dark .title-date-control.active span {
  color: rgba(238, 245, 242, 0.78);
}


