:root {
  color-scheme: light;
  font: 16px/1.65 var(--font-family);
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* {
  box-sizing: border-box;
}
body,
h1,
p {
  margin: 0;
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
button,
select {
  font: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.map-app {
  min-width: 0;
}
.map-toolbar,
.map-detail,
.map-notes {
  padding: 16px clamp(14px, 2.4vw, 28px);
}
.map-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  background: #fff;
}
#map-status {
  color: var(--muted);
  font-size: 0.875rem;
}
.map-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 490px);
}
.map-controls label {
  display: grid;
  gap: 5px;
  font-size: 0.8125rem;
  font-weight: 600;
}
.map-controls select {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid #dce1eb;
  border-radius: 7px;
  color: var(--text);
  background: #fff;
}
.map-controls select:focus {
  border-color: var(--accent);
}

.map-viewport {
  overflow: hidden;
  border-block: 1px solid var(--line);
  background: #fafaff;
}
#trade-map {
  display: block;
  width: 100%;
  height: auto;
}
.map-gridline {
  stroke: var(--line);
  stroke-width: 0.7;
  pointer-events: none;
}
.country {
  fill: #e6e9f1;
  stroke: #fafaff;
  stroke-width: 0.65;
  cursor: pointer;
}
.country.has-agreements {
  fill: #dcdfef;
}
.country.is-related {
  fill: #c2c3f1;
}
.country.is-selected {
  fill: var(--accent);
}
.country-marker {
  fill: #686b9b;
  stroke: #fff;
  stroke-width: 0.65;
  cursor: pointer;
}
.country-marker.is-related {
  fill: var(--accent);
}
.country-marker.is-selected {
  fill: #2f2a93;
}
.route,
.route-active {
  fill: none;
  vector-effect: non-scaling-stroke;
}
.route {
  stroke: var(--accent);
  stroke-opacity: 0.21;
  stroke-width: 0.85;
  pointer-events: none;
}
.route-active {
  stroke: var(--accent);
  stroke-opacity: 0.73;
  stroke-width: 1.45;
  pointer-events: none;
}
.route-active.is-selected {
  stroke: #2f2a93;
  stroke-opacity: 1;
  stroke-width: 2.7;
}
.route-active.is-provisional,
.route.is-provisional {
  stroke-dasharray: 4 3;
}
#trade-map.has-selection .route {
  stroke-opacity: 0.055;
}

.map-detail {
  min-height: 126px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(0, 1.65fr);
  gap: 12px 22px;
  border-bottom: 1px solid var(--line);
}
.detail-heading h1 {
  font-size: clamp(1.125rem, 2.2vw, 1.375rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.028em;
}
.detail-heading p,
.map-notes {
  color: var(--muted);
  font-size: 0.8125rem;
}
.detail-heading p {
  margin-top: 5px;
}
.map-results {
  display: grid;
  align-content: start;
  gap: 5px;
  font-size: 0.875rem;
}
.map-results a {
  width: fit-content;
}
.map-results strong {
  color: var(--text);
}
.map-list {
  max-height: 260px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  overscroll-behavior: contain;
}
.map-list li {
  padding: 5px 0;
}
.map-list li + li {
  border-top: 1px solid var(--line);
}
.map-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
@media (max-width: 590px) {
  .map-detail {
    grid-template-columns: minmax(0, 1fr);
    min-height: 136px;
  }
  .map-toolbar {
    align-items: start;
  }
}

.map-content {
  border-block: 1px solid var(--line);
}
.map-content .map-viewport,
.map-content .map-detail {
  border: 0;
}
.map-content .map-detail {
  border-top: 1px solid var(--line);
}
@media (min-width: 940px) {
  .map-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(215px, 23%, 310px);
    min-height: 500px;
  }
  .map-content .map-viewport {
    display: grid;
    align-items: center;
  }
  .map-content .map-detail {
    display: flex;
    flex-direction: column;
    contain: size;
    min-width: 0;
    min-height: 0;
    border-top: 0;
    border-left: 1px solid var(--line);
    background: var(--soft);
  }
  .map-content .map-results {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  .map-content .map-list {
    flex: 1;
    min-height: 0;
    max-height: none;
  }
}
