html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #16202b 0%, #0a0e14 70%);
}

#page {
  display: flex;
  height: 100vh;
  width: 100vw;
}

#map-stage {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  background: radial-gradient(circle at 50% 35%, #1b2a38 0%, #0a0e14 75%);
}

#world-map {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.base-country {
  fill: #98a2ae;
  fill-rule: evenodd;
  stroke: rgba(0, 0, 0, 0.15);
  stroke-width: 0.3;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 0.15s;
}

.base-country:hover {
  fill: #aeb7c1;
}

.overlay-country {
  cursor: grab;
  touch-action: none;
}

.overlay-country:active {
  cursor: grabbing;
}

.overlay-hit-area {
  fill: transparent;
  pointer-events: all;
}

.overlay-path {
  fill-rule: evenodd;
  fill-opacity: 0.62;
  stroke: rgba(10, 14, 20, 0.55);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
  transition: fill-opacity 0.1s;
}

.overlay-country:hover .overlay-path {
  fill-opacity: 0.78;
}

/* ---- Panneau latéral ---- */

#top-panel {
  flex: 0 0 340px;
  width: 340px;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(8, 11, 16, 0.85);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

#top-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

#brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

#brand {
  font: 700 20px/1 system-ui, sans-serif;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  margin-right: 0.2em;
}

.brand-globe {
  color: #4fc3f7;
  margin-right: 0.2em;
}

.brand-trip {
  color: #ffcf3f;
}

#lang-switcher {
  position: relative;
  flex: 0 0 auto;
}

#lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 12px/1 system-ui, sans-serif;
  color: #e6ebf0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

#lang-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

#lang-toggle img {
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
  display: block;
}

#lang-toggle .bi-chevron-down {
  font-size: 9px;
  color: #98a2ae;
  margin-left: 1px;
  transition: transform 0.2s ease;
}

#lang-toggle[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}

#lang-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 112px;
  background: rgba(12, 16, 22, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  z-index: 20;
}

#lang-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 12px/1 system-ui, sans-serif;
  color: #e6ebf0;
  padding: 8px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

#lang-list li img {
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
  display: block;
}

#lang-list li:hover {
  background: rgba(255, 255, 255, 0.08);
}

#lang-list li[aria-selected="true"] {
  background: rgba(79, 195, 247, 0.15);
  color: #4fc3f7;
}

#real-size-title {
  margin: 0;
  font: 700 20px/1.3 system-ui, sans-serif;
  color: #e6ebf0;
}

#real-size-intro {
  margin: 0;
  color: #98a2ae;
  font: 13px/1.5 system-ui, sans-serif;
}

/* ---- Recherche de pays ---- */

#country-search {
  position: relative;
  width: 100%;
}

#country-search .bi-search {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #98a2ae;
  font-size: 13px;
  pointer-events: none;
}

#country-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px 10px 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #e6ebf0;
  font: 13px/1.4 system-ui, sans-serif;
}

#country-search-input::placeholder {
  color: #98a2ae;
}

#country-search-input:focus {
  outline: none;
  border-color: #4fc3f7;
  background: rgba(255, 255, 255, 0.09);
}

#country-search-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 6px;
  max-height: 240px;
  overflow-y: auto;
  background: rgba(12, 16, 22, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 15;
}

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

#country-search-results li {
  padding: 8px 10px;
  border-radius: 8px;
  font: 13px/1.3 system-ui, sans-serif;
  color: #e6ebf0;
  cursor: pointer;
}

#country-search-results li:hover,
#country-search-results li.active {
  background: rgba(79, 195, 247, 0.16);
}

#country-search-results li.no-results {
  color: #98a2ae;
  cursor: default;
}

#country-search-results li.no-results:hover {
  background: none;
}

/* ---- Pays actifs (déposés sur la carte) ---- */

#active-countries {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.active-country-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.045);
}

.active-country-swatch {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.active-country-name {
  flex: 1 1 auto;
  min-width: 0;
  color: #e6ebf0;
  font: 600 13px/1.3 system-ui, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-country-scale {
  flex: 0 0 auto;
  color: #98a2ae;
  font: 600 12px/1 system-ui, sans-serif;
  white-space: nowrap;
}

.active-country-remove {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #98a2ae;
  cursor: pointer;
  font-size: 11px;
  transition: background 0.15s, color 0.15s;
}

.active-country-remove:hover {
  background: rgba(244, 63, 94, 0.25);
  color: #f43f5e;
}

#active-countries-empty {
  margin: 4px 0 0;
  color: #98a2ae;
  font: 13px/1.5 system-ui, sans-serif;
}

#active-countries:not(:empty)+#active-countries-empty {
  display: none;
}

/* ---- CTA téléchargement (identique aux autres modules) ---- */

#download-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: auto;
  padding-top: 2em;
}

.download-text {
  margin: 0;
  text-align: center;
  color: rgba(230, 235, 240, 0.85);
  font: 13px/1.5 system-ui, sans-serif;
}

.store-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 14, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 12px;
  color: #e6ebf0;
  text-decoration: none;
  backdrop-filter: blur(6px);
  transition: background 0.2s, border-color 0.2s, transform 0.2s ease;
}

.store-btn i {
  font-size: 1.2rem;
  color: #4fc3f7;
}

.store-btn:hover {
  background: rgba(10, 14, 20, 0.75);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.store-sub {
  font-size: 0.6rem;
  color: #98a2ae;
  line-height: 1;
}

.store-name {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 1px;
}

.store-btn-disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

@media (max-width: 700px) {
  #page {
    flex-direction: column;
  }

  #map-stage {
    flex: 1 1 auto;
    order: 2;
  }

  #top-panel {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    max-height: 52vh;
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    order: 1;
  }
}
