/* ═══════════════════════════════════════════════════════════════
   Earth Theyia — Design system inspiré Google Maps (dark mode)
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces Google Maps dark */
  --gm-bg: #202124;
  --gm-surface: #303134;
  --gm-surface-2: #3c4043;
  --gm-surface-hover: #45484b;
  --gm-border: rgba(255, 255, 255, 0.08);
  --gm-border-strong: rgba(255, 255, 255, 0.16);

  /* Texte */
  --gm-text: #e8eaed;
  --gm-text-muted: #9aa0a6;
  --gm-text-dim: #80868b;

  /* Accent Google blue */
  --gm-primary: #8ab4f8;
  --gm-primary-hover: #aecbfa;
  --gm-primary-soft: rgba(138, 180, 248, 0.12);
  --gm-danger: #f28b82;
  --gm-success: #81c995;

  /* Dimensions */
  --gm-panel-width: 280px;
  --gm-topbar-height: 56px;
  --gm-radius-sm: 8px;
  --gm-radius-md: 12px;
  --gm-radius-pill: 24px;

  /* Ombres type Google */
  --gm-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --gm-shadow-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --gm-shadow-3: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.3);

  --gm-font: "Google Sans", "Roboto", "Segoe UI", system-ui, sans-serif;
  --gm-transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --gm-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Accent Theyia (aligné Mind — indigo) */
  --theyia-accent: #6366f1;
  --theyia-accent-hover: #818cf8;
  --theyia-accent-deep: #4f46e5;
  --theyia-accent-soft: rgba(99, 102, 241, 0.14);
  --theyia-accent-border: rgba(99, 102, 241, 0.45);

  /* PWA / mobile (encoches, barre gestuelle) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --touch-min: 44px;
}

/* ── Reset & base ─────────────────────────────────────────────── */

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

html,
body {
  margin: 0;
  height: 100%;
  min-height: -webkit-fill-available;
  font-family: var(--gm-font);
  font-size: 14px;
  line-height: 1.45;
  background: var(--gm-bg);
  color: var(--gm-text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#app {
  /* svh = hauteur « petite » (barre d’adresse visible) — limite la bande noire Chrome Android */
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  width: 100vw;
  width: 100svw;
  width: 100dvw;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ── Loader ───────────────────────────────────────────────────── */

.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--gm-bg);
  color: var(--gm-text-muted);
}

.loader-logo {
  width: clamp(228px, 54vw, 336px);
  height: clamp(228px, 54vw, 336px);
  object-fit: contain;
  filter: drop-shadow(0 8px 22px rgb(36 154 192 / 28%));
  animation: loader-logo-breathe 1.8s ease-in-out infinite;
}

.loader-error {
  color: var(--gm-danger);
}

.enrichment-banner {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  opacity: 0.55;
  color: var(--gm-text-muted);
  background: rgb(8 16 28 / 45%);
  font-variant-numeric: tabular-nums;
  transition: opacity 180ms ease-out;
}

.enrichment-banner-fade-out {
  opacity: 0;
}

.loader-reload-btn {
  margin-top: 4px;
  padding: 10px 22px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 999px;
  background: rgb(36 154 192 / 22%);
  color: var(--gm-text);
  font: inherit;
  cursor: pointer;
}

.loader-reload-btn:hover {
  background: rgb(36 154 192 / 34%);
}

.update-banner {
  position: fixed;
  top: calc(var(--gm-topbar-height) + 16px + var(--safe-top));
  left: 50%;
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 560px);
  padding: 10px 14px;
  transform: translateX(-50%);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 10px;
  background: rgb(32 33 36 / 94%);
  color: var(--gm-text);
  box-shadow: 0 8px 24px rgb(0 0 0 / 35%);
}

.update-banner-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: var(--gm-accent, #249ac0);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.update-banner-dismiss {
  flex-shrink: 0;
  padding: 4px 8px;
  border: none;
  background: transparent;
  color: var(--gm-text-muted);
  font: inherit;
  cursor: pointer;
}

@keyframes loader-logo-breathe {
  0%,
  100% {
    opacity: 0.82;
    transform: scale(0.96);
  }

  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

/* ── Zone carte ───────────────────────────────────────────────── */

.map-area {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.cesium-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none; /* laisser Cesium gérer pinch / pan */
}

/* Labels pays HTML — Option A (texte CSS net, anti halo Brave / cadre noir GPU) */
.borders-canvas-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.border-compare-badge {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 120;
  padding: 6px 10px;
  border-radius: 6px;
  font: 600 12px/1.3 system-ui, sans-serif;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(8, 16, 28, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.country-labels-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  /* Au-dessus des capitales / États US — pays toujours premier plan. */
  z-index: 7;
}

.country-html-label {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  padding: 0;
  border: 0;
  font: 700 24px Roboto, sans-serif;
  color: #fff;
  white-space: nowrap;
  line-height: 1;
  text-align: center;
  transform-origin: center center;
  will-change: transform;
  --country-label-stroke: #000;
  text-shadow:
    -1px -1px 0 var(--country-label-stroke),
    1px -1px 0 var(--country-label-stroke),
    -1px 1px 0 var(--country-label-stroke),
    1px 1px 0 var(--country-label-stroke),
    0 -1px 0 var(--country-label-stroke),
    0 1px 0 var(--country-label-stroke),
    -1px 0 0 var(--country-label-stroke),
    1px 0 0 var(--country-label-stroke);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

@media (max-width: 768px) {
  /* 4 ombres diagonales : moitié moins de repaints pendant le pan (Chrome Android). */
  .country-html-label {
    text-shadow:
      -1px -1px 0 var(--country-label-stroke),
      1px -1px 0 var(--country-label-stroke),
      -1px 1px 0 var(--country-label-stroke),
      1px 1px 0 var(--country-label-stroke);
  }
}

.country-html-label--high-contrast {
  font-size: 22px;
  font-weight: 700;
}

/* Pays assignés à une faction : couleur sans halo noir (blanc seul garde text-shadow). */
.country-html-label--faction {
  text-shadow: none;
}

/* Faction (REX, LEX, …) centrée sous le nom du pays. */
.country-html-label__name {
  display: block;
}

.country-html-label__faction {
  display: block;
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 0.05em;
  opacity: 0.92;
  margin-top: 2px;
  text-align: center;
}

/* NEUTRONOS — mot long, taille réduite pour rester lisible sans dominer le pays. */
.country-html-label__faction--neutronos {
  font-size: 0.58em;
  letter-spacing: 0.03em;
}

/* Éditeur factions — monté uniquement sur localhost (factions-dev-panel.js). */
.factions-dev-panel {
  position: fixed;
  left: 0;
  bottom: 72px;
  z-index: 40;
  font: 13px/1.35 Roboto, sans-serif;
  pointer-events: auto;
}

.factions-dev-panel__tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: rgba(12, 18, 28, 0.92);
  color: #e8eef5;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.factions-dev-panel.is-open .factions-dev-panel__tab {
  border-radius: 0 8px 0 0;
}

.factions-dev-panel__tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7ec8ff;
}

.factions-dev-panel__body {
  width: min(340px, calc(100vw - 16px));
  max-height: min(420px, 55vh);
  overflow: auto;
  padding: 10px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-left: none;
  border-radius: 0 0 8px 0;
  background: rgba(12, 18, 28, 0.96);
  color: #e8eef5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.factions-dev-panel__head strong {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
}

.factions-dev-panel__search-wrap {
  position: relative;
  margin-bottom: 8px;
}

.factions-dev-panel__search {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: inherit;
  font-size: 13px;
}

.factions-dev-panel__suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 2;
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: rgba(8, 12, 20, 0.98);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.factions-dev-panel__suggestion {
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}

.factions-dev-panel__suggestion:hover {
  background: rgba(255, 255, 255, 0.1);
}

.factions-dev-panel__selected {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
}

.factions-dev-panel__assigned-count {
  margin: 0 0 10px;
  font-size: 11px;
  opacity: 0.7;
}

.factions-dev-panel__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.factions-dev-panel__iso-input {
  width: 72px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: inherit;
  text-transform: uppercase;
}

.factions-dev-panel__select {
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: inherit;
  min-width: 108px;
}

.factions-dev-panel__list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.factions-dev-panel__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.factions-dev-panel__country {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.factions-dev-panel__empty {
  padding: 8px 0;
  opacity: 0.7;
  font-size: 12px;
}

.factions-dev-panel__foot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.factions-dev-panel__btn {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  font-size: 12px;
}

.factions-dev-panel__btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.factions-dev-panel__btn-del {
  width: 28px;
  padding: 2px 0;
  font-size: 16px;
  line-height: 1;
}

.factions-dev-panel__autosave-hint {
  margin: 4px 0 0;
  font-size: 10px;
  opacity: 0.65;
}

.factions-dev-panel__publish-hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.35;
  opacity: 0.85;
}

.capital-labels-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.us-state-labels-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.us-state-html-label {
  font-size: 20px;
}

.capital-html-label {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  padding: 0;
  border: 0;
  font: 500 21px Roboto, sans-serif;
  font-style: italic;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  line-height: 1;
  transform-origin: 0 0;
  will-change: transform;
  --capital-label-stroke: #000;
  text-shadow:
    -1px -1px 0 var(--capital-label-stroke),
    1px -1px 0 var(--capital-label-stroke),
    -1px 1px 0 var(--capital-label-stroke),
    1px 1px 0 var(--capital-label-stroke);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

@media (max-width: 768px) {
  .capital-html-label {
    font-weight: 600;
  }
}

.map-area.add-mode .cesium-container {
  cursor: crosshair;
}

/* Masquer crédits Cesium par défaut (on les gère en UI) */
.cesium-viewer-bottom {
  display: none !important;
}

/* ── Topbar flottante ─────────────────────────────────────────── */

.gm-topbar {
  position: absolute;
  top: calc(12px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  right: calc(12px + var(--safe-right));
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  overflow: visible;
}

.gm-topbar > * {
  pointer-events: auto;
}

.gm-search {
  position: relative;
  flex: 1;
  max-width: 640px;
  margin: 0;
  display: flex;
  align-items: center;
  overflow: visible;
  background: rgba(32, 33, 36, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--gm-radius-pill);
  box-shadow:
    0 2px 12px -4px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: box-shadow var(--gm-transition), border-color var(--gm-transition);
}

.gm-search:focus-within {
  box-shadow: var(--gm-shadow-3);
  border-color: var(--gm-border-strong);
}

#search-input {
  flex: 1;
  border: none;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  color: var(--gm-text);
  font: inherit;
  font-size: 15px;
  padding: 12px 8px 12px 16px;
  outline: none;
  min-width: 0;
}

#search-input::-webkit-search-cancel-button,
#search-input::-webkit-search-decoration {
  display: none;
}

#search-input::placeholder {
  color: var(--gm-text-dim);
}

.gm-search-clear {
  width: 28px;
  height: 28px;
  margin-right: 8px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--gm-text-muted);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 180ms var(--gm-ease-spring),
    background 160ms ease,
    color 160ms ease;
}

.gm-search-clear:hover {
  color: var(--gm-text);
  background: rgba(255, 255, 255, 0.08);
}

/* Dropdown résultats — z-index > Cesium ; voir portal body dans search/ui.js */
.gm-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: var(--gm-surface);
  border-radius: var(--gm-radius-md);
  box-shadow: var(--gm-shadow-3);
  border: 1px solid var(--gm-border);
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
  pointer-events: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.gm-search-results li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.gm-search-result-btn {
  width: 100%;
  margin: 0;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.35;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--gm-transition);
}

.gm-search-result-btn:hover,
.gm-search-result-btn[aria-selected="true"] {
  background: var(--gm-surface-hover);
}

body.search-results-open .gm-search-results,
body.search-results-open .gm-search-results.is-fixed {
  z-index: 100003;
}

.gm-search-results .result-title {
  font-size: 14px;
  color: var(--gm-text);
}

.gm-search-results .result-sub {
  font-size: 12px;
  color: var(--gm-text-muted);
}

.gm-search-results .result-type {
  font-size: 11px;
  color: var(--gm-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gm-search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: transparent;
  /* Ne pas intercepter les taps — iOS les bloquait avant les résultats. */
  pointer-events: none;
  touch-action: none;
}

.gm-search-backdrop.hidden {
  display: none;
}

.gm-search-results.is-fixed {
  z-index: 100002;
}

/* ── Boutons (langage Theyia Mind — adapté dark / globe) ─────── */

.gm-btn,
.gm-icon-btn,
.gm-zoom-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 180ms var(--gm-ease-spring),
    background 160ms ease,
    box-shadow 200ms ease,
    border-color 160ms ease,
    color 160ms ease;
  transform: translateZ(0);
}

.gm-btn {
  padding: 0 16px;
  min-height: 34px;
  border-radius: 10px;
  font-size: 13px;
}

.gm-btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--theyia-accent-hover) 0%, var(--theyia-accent-deep) 100%);
  border-color: var(--theyia-accent-border);
  box-shadow:
    0 1px 2px rgba(79, 70, 229, 0.25),
    0 4px 12px -4px rgba(79, 70, 229, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.gm-btn-primary:hover {
  background: linear-gradient(180deg, #a5b4fc 0%, var(--theyia-accent-hover) 100%);
  box-shadow:
    0 2px 4px rgba(79, 70, 229, 0.3),
    0 8px 20px -4px rgba(79, 70, 229, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transform: translateY(-1px) translateZ(0);
}

.gm-btn-ghost {
  color: var(--gm-text-muted);
  background: linear-gradient(180deg, rgba(60, 64, 67, 0.92) 0%, rgba(48, 49, 52, 0.78) 100%);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.gm-btn-ghost:hover {
  color: var(--gm-text);
  background: linear-gradient(180deg, rgba(69, 72, 75, 0.98) 0%, rgba(60, 64, 67, 0.88) 100%);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 2px 8px -2px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-1px) translateZ(0);
}

.gm-btn-danger {
  color: var(--gm-danger);
  background: linear-gradient(180deg, rgba(242, 139, 130, 0.12) 0%, rgba(242, 139, 130, 0.06) 100%);
  border-color: rgba(242, 139, 130, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.gm-btn-danger:hover {
  background: linear-gradient(180deg, rgba(242, 139, 130, 0.2) 0%, rgba(242, 139, 130, 0.1) 100%);
  border-color: rgba(242, 139, 130, 0.42);
  transform: translateY(-1px) translateZ(0);
}

.gm-btn.active,
.gm-icon-btn.active {
  color: #fff;
  background: linear-gradient(180deg, var(--theyia-accent-hover) 0%, var(--theyia-accent-deep) 100%);
  border-color: var(--theyia-accent-border);
  box-shadow:
    0 1px 2px rgba(79, 70, 229, 0.25),
    0 4px 14px -4px rgba(79, 70, 229, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.gm-btn.active:hover,
.gm-icon-btn.active:hover {
  background: linear-gradient(180deg, #a5b4fc 0%, var(--theyia-accent-hover) 100%);
  transform: translateY(-1px) translateZ(0);
}

.gm-btn:active:not(:disabled),
.gm-icon-btn:active:not(:disabled),
.gm-zoom-btn:active:not(:disabled) {
  transform: translateY(0.5px) scale(0.97) translateZ(0) !important;
  transition-duration: 60ms !important;
}

.gm-btn:focus-visible,
.gm-icon-btn:focus-visible,
.gm-zoom-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--gm-bg), 0 0 0 4px var(--theyia-accent) !important;
}

.gm-icon-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 10px;
  font-size: 16px;
  color: var(--gm-text-muted);
  background: linear-gradient(180deg, rgba(60, 64, 67, 0.88) 0%, rgba(48, 49, 52, 0.72) 100%);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.gm-icon-btn:hover {
  color: var(--gm-text);
  background: linear-gradient(180deg, rgba(69, 72, 75, 0.95) 0%, rgba(60, 64, 67, 0.85) 100%);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 2px 8px -2px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-1px) translateZ(0);
}

.gm-link {
  background: none;
  border: none;
  color: var(--theyia-accent-hover);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  padding: 0;
  margin-left: 8px;
}

.gm-file-label {
  cursor: pointer;
}

/* ── Panneau latéral ──────────────────────────────────────────── */

.gm-panel-backdrop {
  position: absolute;
  inset: 0;
  z-index: 85;
  background: rgba(0, 0, 0, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--gm-transition);
}

.gm-panel-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.gm-panel {
  position: absolute;
  top: calc(var(--gm-topbar-height) + 8px);
  left: 8px;
  bottom: calc(16px + var(--safe-bottom));
  width: var(--gm-panel-width);
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: var(--gm-radius-md);
  box-shadow: var(--gm-shadow-3);
  transition: transform var(--gm-transition), opacity var(--gm-transition);
}

.gm-panel.collapsed {
  transform: translateX(calc(-1 * var(--gm-panel-width) - 24px));
  pointer-events: none;
  opacity: 0;
}

.gm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gm-border);
  flex-shrink: 0;
}

.gm-panel-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.gm-panel-brand__logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.gm-panel-brand__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--gm-text);
  white-space: nowrap;
}

/* Fermeture panneau : point rouge discret, zone de clic élargie */
.gm-panel-close {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: -8px -10px -8px 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 160ms ease;
}

.gm-panel-close::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.gm-panel-close:hover::before {
  background: rgba(255, 255, 255, 0.06);
}

.gm-panel-close:active::before {
  background: rgba(255, 255, 255, 0.1);
}

.gm-panel-close__dot {
  position: relative;
  z-index: 1;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef5350;
  box-shadow:
    0 0 0 1px rgba(239, 83, 80, 0.35),
    0 0 8px rgba(239, 83, 80, 0.25);
  transition: transform 160ms ease, box-shadow 160ms ease;
  pointer-events: none;
}

.gm-panel-close:hover .gm-panel-close__dot {
  transform: scale(1.2);
  box-shadow:
    0 0 0 1px rgba(239, 83, 80, 0.5),
    0 0 10px rgba(239, 83, 80, 0.45);
}

.gm-panel-close:focus-visible {
  outline: none;
}

.gm-panel-close:focus-visible::before {
  box-shadow: 0 0 0 2px var(--gm-surface), 0 0 0 4px rgba(239, 83, 80, 0.65);
}

.gm-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.gm-panel-footer {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--gm-border);
  flex-shrink: 0;
}

.gm-panel-footer .gm-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
}

.gm-account-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  border-top: 1px solid var(--gm-border);
  flex-shrink: 0;
}

.gm-account-status {
  font-size: 12px;
  color: var(--gm-text-muted, rgba(240, 244, 250, 0.72));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gm-btn-compact {
  padding: 4px 10px !important;
  font-size: 12px !important;
  flex: 0 0 auto !important;
}

.gm-account-lead {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--gm-text-muted, rgba(240, 244, 250, 0.78));
}

.gm-account-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gm-account-error {
  margin: 0;
  font-size: 12px;
  color: #f87171;
}

.gm-panel .gm-btn-primary {
  padding: 8px 12px;
  font-size: 13px;
}

.gm-panel .gm-chip {
  padding: 5px 10px;
  font-size: 12px;
}

/* Sections */
.gm-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gm-section-grow {
  flex: 1;
  min-height: 0;
}

.gm-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gm-section-title {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gm-text-muted);
}

.gm-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--gm-surface);
  color: var(--gm-text-muted);
}

/* Chips / toggles calques */
.gm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gm-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--gm-radius-pill);
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--gm-transition);
  user-select: none;
}

.gm-chip:hover {
  background: var(--gm-surface-hover);
}

.gm-chip input {
  accent-color: var(--gm-primary);
  cursor: pointer;
}

.gm-tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gm-tool-row .gm-btn {
  flex: 1;
  min-width: 90px;
  font-size: 13px;
  padding: 8px 10px;
}

.gm-measure-readout {
  margin: 0;
  padding: 10px 12px;
  background: var(--gm-surface);
  border-radius: var(--gm-radius-sm);
  font-size: 13px;
  color: var(--gm-primary);
  border: 1px solid var(--gm-border);
}

/* Bannière mode ajout */
.gm-banner {
  padding: 10px 14px;
  background: var(--gm-primary-soft);
  border: 1px solid rgba(138, 180, 248, 0.25);
  border-radius: var(--gm-radius-sm);
  font-size: 13px;
  color: var(--gm-primary);
}

/* ── Liste des points ─────────────────────────────────────────── */

.gm-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gm-list .empty-state {
  padding: 24px 12px;
  text-align: center;
  color: var(--gm-text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.marker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--gm-radius-sm);
  cursor: pointer;
  transition: background var(--gm-transition);
  /* Skip le rendu/layout des items hors écran — gain net sur listes longues
     (197 marqueurs) en scroll, surtout sur mobile. */
  content-visibility: auto;
  contain-intrinsic-size: 56px;
}

.marker-item:hover {
  background: var(--gm-surface);
}

.marker-item.active {
  background: var(--gm-primary-soft);
}

.marker-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--gm-radius-sm);
  background: var(--gm-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 20px;
}

.marker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.marker-info h3 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.marker-info p {
  margin: 0;
  font-size: 12px;
  color: var(--gm-text-muted);
}

.marker-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--gm-transition);
}

.marker-item:hover .marker-actions {
  opacity: 1;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--gm-text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--gm-transition), color var(--gm-transition);
}

.icon-btn:hover {
  background: var(--gm-surface-hover);
  color: var(--gm-text);
}

/* ── Contrôles carte (droite) ─────────────────────────────────── */

.gm-controls-right {
  position: absolute;
  right: calc(16px + var(--safe-right));
  bottom: calc(80px + var(--safe-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  --gm-compass-size: 44px;
  --gm-controls-gap: 10px;
  --gm-zoom-btn-size: 36px;
  --gm-zoom-stack-height: calc(var(--gm-zoom-btn-size) * 2);
  /* Bas panneau = bas du stack zoom (gap + hauteur zoom sous la boussole) */
  --gm-compass-panel-bottom: calc(-1 * (var(--gm-controls-gap) + var(--gm-zoom-stack-height)));
  /* Centre panneau = centre boussole, bas fixe sur le zoom − */
  --gm-compass-panel-height: calc(
    var(--gm-compass-size) + 2 * (var(--gm-controls-gap) + var(--gm-zoom-stack-height))
  );
}

.gm-compass-anchor {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.gm-compass-presets {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 40px;
  flex: 1;
  align-self: stretch;
  min-height: 88px;
}

.gm-compass-preset-btn {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 0;
  padding: 4px;
  border-radius: var(--gm-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.35) 0%, rgba(79, 70, 229, 0.18) 100%);
  color: #fff;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 180ms var(--gm-ease-spring);
}

.gm-compass-preset-btn:hover {
  background: linear-gradient(180deg, var(--theyia-accent-hover) 0%, var(--theyia-accent-deep) 100%);
  border-color: var(--theyia-accent-border);
  transform: translateY(-1px);
}

.gm-compass-preset-btn:active {
  transform: translateY(0) scale(0.96);
}

.gm-compass-preset-icon {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.gm-compass-preset-btn--solo .gm-compass-preset-icon {
  font-size: 14px;
  letter-spacing: 0.02em;
}

.gm-compass-preset-label {
  font-size: 9px;
  font-weight: 650;
  line-height: 1.1;
  opacity: 0.92;
}

.gm-compass-panel {
  position: absolute;
  right: calc(100% + 10px);
  top: auto;
  bottom: var(--gm-compass-panel-bottom);
  height: var(--gm-compass-panel-height);
  transform: none;
  z-index: 90;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(32, 33, 36, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--gm-radius-md);
  box-shadow:
    0 2px 12px -4px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  pointer-events: auto;
  touch-action: none;
}

.gm-compass-panel.hidden {
  display: none;
}

.gm-compass-control {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 40px;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
}

.gm-compass-control-label {
  font-size: 10px;
  font-weight: 550;
  color: var(--gm-text-muted);
  text-align: center;
  line-height: 1.2;
}

.gm-compass-control-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--gm-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.gm-compass-slider-v {
  flex: 1;
  width: 32px;
  height: auto;
  min-height: 88px;
  margin: 0;
  padding: 0;
  accent-color: var(--theyia-accent);
  -webkit-appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  cursor: pointer;
}

/* Nord : 0° au centre, -180° bas, +180° haut */
.gm-compass-slider-v--heading {
  direction: ltr;
}

.gm-compass {
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  display: block;
  overflow: visible;
  background: transparent;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.34),
    0 6px 18px -6px rgba(0, 0, 0, 0.55);
  transition:
    transform 220ms var(--gm-ease-spring),
    box-shadow 220ms ease,
    filter 180ms ease;
}

.gm-compass::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.1) 0%, transparent 62%);
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.gm-compass:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.38),
    0 10px 24px -8px rgba(0, 0, 0, 0.62);
}

.gm-compass:hover::before {
  opacity: 1;
}

.gm-compass:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 80ms;
}

.gm-compass.active {
  box-shadow:
    0 0 0 2px rgba(99, 102, 241, 0.45),
    0 2px 6px rgba(79, 70, 229, 0.35),
    0 8px 22px -6px rgba(79, 70, 229, 0.55);
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.35));
}

.gm-compass-bezel,
.gm-compass-needle {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.gm-compass-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.gm-compass-svg-n {
  fill: #f87171;
  font-size: 7.5px;
  font-weight: 800;
  font-family: var(--gm-font);
  letter-spacing: 0.04em;
  paint-order: stroke fill;
  stroke: rgba(0, 0, 0, 0.45);
  stroke-width: 0.35px;
}

.gm-compass-needle {
  transform-origin: 50% 50%;
  transition: transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.gm-compass-needle-n {
  fill: #ef4444;
}

.gm-compass-needle-s {
  fill: rgba(154, 160, 166, 0.92);
}

.gm-compass-needle-hub {
  fill: rgba(232, 234, 237, 0.95);
  stroke: rgba(0, 0, 0, 0.28);
  stroke-width: 0.5;
}

.gm-compass-needle-pin {
  fill: #3c4043;
}

.gm-compass:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--gm-bg),
    0 0 0 4px var(--theyia-accent),
    0 6px 18px -6px rgba(0, 0, 0, 0.55);
}

.gm-zoom-stack {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.gm-zoom-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(60, 64, 67, 0.88) 0%, rgba(48, 49, 52, 0.72) 100%);
  color: var(--gm-text-muted);
  font-size: 18px;
  font-weight: 500;
}

.gm-zoom-btn:hover {
  color: var(--gm-text);
  background: linear-gradient(180deg, rgba(69, 72, 75, 0.95) 0%, rgba(60, 64, 67, 0.85) 100%);
  transform: translateY(-1px) translateZ(0);
}

.gm-zoom-btn + .gm-zoom-btn {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Lien sous-app Mind (bas-droite, P4 link-only) ───────────── */

.gm-sibling-app-link {
  position: fixed;
  right: calc(16px + var(--safe-right));
  bottom: calc(16px + var(--safe-bottom));
  z-index: 1200;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(69, 72, 75, 0.95) 0%, rgba(48, 49, 52, 0.92) 100%);
  box-shadow: var(--gm-shadow-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s var(--gm-ease), box-shadow 0.2s ease, border-color 0.2s ease;
}

.gm-sibling-app-link:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: var(--gm-shadow-3);
}

.gm-sibling-app-link img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  pointer-events: none;
}

.gm-sibling-app-link.is-switching {
  transform: scale(0.94);
  opacity: 0.88;
  transition-duration: 60ms;
}

.gm-sibling-hint {
  position: fixed;
  right: calc(16px + var(--safe-right));
  bottom: calc(72px + var(--safe-bottom));
  z-index: 1201;
  max-width: min(320px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: var(--gm-radius-sm);
  background: rgba(32, 33, 36, 0.96);
  border: 1px solid var(--gm-border);
  box-shadow: var(--gm-shadow-3);
  color: var(--gm-text);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.gm-sibling-hint.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── HUD bas ──────────────────────────────────────────────────── */

.gm-hud {
  position: absolute;
  bottom: calc(12px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  background: rgba(32, 33, 36, 0.88);
  backdrop-filter: blur(8px);
  border-radius: var(--gm-radius-pill);
  border: 1px solid var(--gm-border);
  box-shadow: var(--gm-shadow-1);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: var(--gm-text-muted);
  pointer-events: none;
  white-space: nowrap;
}

/* ── Menu contextuel ──────────────────────────────────────────── */

.gm-context-menu {
  position: fixed;
  z-index: 500;
  margin: 0;
  padding: 6px 0;
  min-width: 200px;
  list-style: none;
  background: var(--gm-surface);
  border-radius: var(--gm-radius-sm);
  box-shadow: var(--gm-shadow-3);
  border: 1px solid var(--gm-border);
}

.gm-context-menu button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--gm-text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background var(--gm-transition);
}

.gm-context-menu button:hover {
  background: var(--gm-surface-hover);
}

/* ── Dialogs / Modals ─────────────────────────────────────────── */

.gm-dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 32px);
}

.gm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.gm-dialog-card {
  background: var(--gm-bg);
  border-radius: var(--gm-radius-md);
  border: 1px solid var(--gm-border);
  box-shadow: var(--gm-shadow-3);
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gm-dialog-wide .gm-dialog-card {
  width: min(560px, calc(100vw - 32px));
}

.gm-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gm-border);
}

.gm-dialog-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.gm-dialog-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gm-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--gm-border);
}

.gm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gm-field span {
  font-size: 12px;
  font-weight: 500;
  color: var(--gm-text-muted);
}

.gm-field input,
.gm-field textarea {
  padding: 10px 12px;
  border-radius: var(--gm-radius-sm);
  border: 1px solid var(--gm-border-strong);
  background: var(--gm-surface);
  color: var(--gm-text);
  font: inherit;
  outline: none;
  transition: border-color var(--gm-transition);
}

.gm-field input:focus,
.gm-field textarea:focus {
  border-color: var(--gm-primary);
}

.gm-coords {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Drop zone images */
.gm-media-sources {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gm-dropzone {
  padding: 16px;
  border: 2px dashed var(--gm-border-strong);
  border-radius: var(--gm-radius-sm);
  text-align: center;
  transition: border-color var(--gm-transition), background var(--gm-transition);
}

.gm-dropzone p {
  margin: 0 0 8px;
  color: var(--gm-text-muted);
  font-size: 13px;
}

.gm-dropzone.drag-over {
  border-color: var(--gm-primary);
  background: var(--gm-primary-soft);
}

.gm-dropzone input[type="file"] {
  font-size: 13px;
  color: var(--gm-text-muted);
}

.gm-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
}

.gm-branding-picker {
  padding: 12px;
  border: 1px solid var(--gm-border);
  border-radius: var(--gm-radius-sm);
  background: var(--gm-surface-2);
}

.gm-branding-picker > p {
  margin: 0 0 10px;
  color: var(--gm-text-muted);
  font-size: 13px;
  text-align: center;
}

.gm-branding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.gm-branding-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 2px solid transparent;
  border-radius: var(--gm-radius-sm);
  background: var(--gm-surface);
  cursor: pointer;
  transition: border-color var(--gm-transition), background var(--gm-transition);
}

.gm-branding-item img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.gm-branding-item span {
  font-size: 11px;
  color: var(--gm-text-muted);
}

.gm-branding-item:hover {
  border-color: var(--gm-border-strong);
}

.gm-branding-item.is-selected {
  border-color: var(--gm-primary);
  background: var(--gm-primary-soft);
}

.gm-branding-item.is-selected span {
  color: var(--gm-text);
}

.preview-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--gm-radius-sm);
  overflow: hidden;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Détail point */
.gm-detail-coords {
  margin: 0;
  font-size: 13px;
  color: var(--gm-text-muted);
}

.gm-detail-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.no-images {
  color: var(--gm-text-muted);
  font-size: 13px;
  margin: 0;
}

#detail-gallery img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--gm-radius-sm);
  cursor: pointer;
  transition: opacity var(--gm-transition);
}

#detail-gallery img:hover {
  opacity: 0.85;
}

/* Carousel */
.gm-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--gm-surface);
  border-radius: var(--gm-radius-sm);
  overflow: hidden;
}

.gm-carousel img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gm-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(48, 49, 52, 0.92) 0%, rgba(32, 33, 36, 0.88) 100%);
  backdrop-filter: blur(8px);
  color: var(--gm-text);
  font-size: 20px;
  font-weight: 550;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 180ms var(--gm-ease-spring),
    background 160ms ease,
    box-shadow 200ms ease;
}

.gm-carousel-btn:hover {
  background: linear-gradient(180deg, rgba(69, 72, 75, 0.95) 0%, rgba(48, 49, 52, 0.9) 100%);
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.4);
}

#carousel-prev { left: 8px; }
#carousel-next { right: 8px; }

.gm-carousel-counter {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 12px;
  color: var(--gm-text-muted);
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 8px;
  border-radius: 12px;
}

/* ── Responsive ───────────────────────────────────────────────── */

.gm-topbar .gm-icon-btn.active {
  background: var(--theyia-accent-soft);
  border-color: var(--theyia-accent-border);
  color: var(--theyia-accent-hover);
}

@media (max-width: 768px) {
  :root {
    --gm-panel-width: min(300px, 84vw);
  }

  .gm-topbar {
    left: 8px;
    right: 8px;
    top: 8px;
    z-index: 500;
    isolation: isolate;
  }

  .gm-search {
    max-width: none;
    z-index: 2;
  }

  .gm-search-results,
  .gm-search-results.is-fixed {
    z-index: 100002;
    max-height: min(280px, 38dvh);
    -webkit-overflow-scrolling: touch;
  }

  .gm-search-result-btn {
    min-height: var(--touch-min, 44px);
    justify-content: center;
  }

  .gm-panel:not(.collapsed) {
    top: calc(var(--gm-topbar-height) + 4px);
    left: 4px;
    bottom: calc(12px + var(--safe-bottom));
  }

  .gm-hud {
    flex-direction: column;
    gap: 4px;
    align-items: center;
    font-size: 11px;
    bottom: 8px;
    padding: 6px 12px;
  }

  .gm-controls-right {
    right: 8px;
    bottom: 72px;
    --gm-compass-size: var(--touch-min);
    --gm-zoom-btn-size: var(--touch-min);
  }

  .gm-compass-anchor {
    width: var(--gm-compass-size);
    height: var(--gm-compass-size);
  }

  .gm-compass-panel {
    right: 0;
    top: auto;
    bottom: var(--gm-compass-panel-bottom);
    height: var(--gm-compass-panel-height);
    transform: none;
    flex-direction: row;
    align-items: stretch;
  }

  .gm-topbar .gm-icon-btn,
  .gm-controls-right .gm-icon-btn,
  .gm-controls-right .gm-zoom-btn,
  .gm-controls-right .gm-compass {
    width: var(--touch-min);
    height: var(--touch-min);
    min-width: var(--touch-min);
    min-height: var(--touch-min);
  }

  .marker-actions {
    opacity: 1;
  }

  /* backdrop-filter (blur) est recomposé à chaque frame de pan/zoom du globe
     → coût GPU/compositor majeur sur mobile. Remplacé par un fond opaque. */
  .gm-search,
  .gm-compass-panel,
  .gm-context-menu,
  .gm-modal {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

@media (max-width: 480px) {
  .gm-coords {
    grid-template-columns: 1fr;
  }

  .gm-dialog-footer {
    flex-wrap: wrap;
  }
}

/* ── Médias & vidéos ─────────────────────────────────────────── */

.gm-url-row {
  display: flex;
  gap: 8px;
}

.gm-url-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--gm-radius-sm);
  border: 1px solid var(--gm-border-strong);
  background: var(--gm-surface);
  color: var(--gm-text);
  font: inherit;
}

.gm-pending-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.gm-pending-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--gm-text-muted);
  background: var(--gm-surface);
  border-radius: var(--gm-radius-sm);
  margin-top: 4px;
  word-break: break-all;
}

.gm-pending-list button {
  border: none;
  background: transparent;
  color: var(--gm-text-muted);
  cursor: pointer;
}

.gm-media-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.gm-tab {
  flex: 1;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(60, 64, 67, 0.92) 0%, rgba(48, 49, 52, 0.78) 100%);
  color: var(--gm-text-muted);
  font: inherit;
  font-weight: 550;
  font-size: 13px;
  cursor: pointer;
  transition:
    transform 180ms var(--gm-ease-spring),
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.gm-tab.active {
  color: #fff;
  background: linear-gradient(180deg, var(--theyia-accent-hover) 0%, var(--theyia-accent-deep) 100%);
  border-color: var(--theyia-accent-border);
  box-shadow:
    0 1px 2px rgba(79, 70, 229, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.gm-tab-panel.hidden {
  display: none;
}

.gm-video-panel {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--gm-radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
}

.gm-video-embed,
.gm-video-player {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #000;
}

.gm-video-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gm-video-list li {
  padding: 8px 12px;
  border-radius: var(--gm-radius-sm);
  background: var(--gm-surface);
  cursor: pointer;
  font-size: 13px;
}

.gm-video-list li:hover {
  background: var(--gm-surface-hover);
}

.gm-badge-video {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--gm-primary-soft);
  color: var(--gm-primary);
  vertical-align: middle;
}

.preview-video {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 11px;
  padding: 4px;
  text-align: center;
  color: var(--gm-primary);
  background: var(--gm-surface-2);
}

.gm-map-video-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 120;
}

.gm-map-video-overlay.hidden {
  display: none;
}

.gm-map-video-card {
  position: absolute;
  width: min(320px, calc(100vw - 24px));
  pointer-events: auto;
  background: var(--gm-bg);
  border: 1px solid var(--gm-border);
  border-radius: var(--gm-radius-md);
  box-shadow: var(--gm-shadow-3);
  overflow: hidden;
}

.gm-map-video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--gm-border);
  font-size: 13px;
}

.gm-map-video-header button {
  border: none;
  background: transparent;
  color: var(--gm-text-muted);
  cursor: pointer;
  font-size: 16px;
}

.gm-map-video-body {
  aspect-ratio: 16 / 9;
  background: #000;
}

.gm-map-video-body iframe,
.gm-map-video-body video {
  width: 100%;
  height: 100%;
  border: none;
}

.gm-external-link {
  color: var(--gm-primary);
  word-break: break-all;
}

/* ── Accessibilité ────────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--gm-primary);
  outline-offset: 2px;
}

/* ── Légal TiaCosmos ─────────────────────────────────────────── */

.gm-legal-body {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--gm-text);
}

.gm-legal-lead {
  margin: 0 0 0.5rem;
}

.gm-legal-meta,
.gm-legal-foot {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--gm-text-muted);
}

.gm-legal-h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gm-text-muted);
}

.gm-legal-list {
  margin: 0;
  padding-left: 1.1rem;
}

.gm-legal-list li + li {
  margin-top: 0.5rem;
}

.gm-legal-note {
  margin: 0;
  color: var(--gm-text-muted);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
