:root {
  --toolbar-toggle-width: 2.5rem;
  --toolbar-toggle-radius: 0.65rem;
  --toolbar-toggle-offset: 0.75rem;
  --toolbar-toggle-offset-top: 0.75rem;
  --toolbar-toggle-offset-top-collapsed: 1rem;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1e1e1e;
  background-color: #f6f6f6;
}

body {
  display: flex;
  flex-direction: column;
}

header.toolbar {
  display: flex;
  align-items: center;
  padding: 0.75rem calc(1.5rem + var(--toolbar-toggle-width)) 0.75rem 1.5rem;
  background-color: #ffffff;
  border-bottom: 1px solid #d0d0d0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 1000;
  transition: transform 0.3s ease-in-out;
}

header.toolbar.toolbar--no-transition {
  transition: none !important;
}

.toolbar__content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  width: 100%;
  transition: opacity 0.2s ease;
}

.toolbar__toggle {
  position: absolute;
  top: 50%;
  right: var(--toolbar-toggle-offset);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--toolbar-toggle-width);
  height: var(--toolbar-toggle-width);
  padding: 0;
  border: 1px solid #b0b0b0;
  border-radius: var(--toolbar-toggle-radius);
  background-color: #ffffff;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e1e1e;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  line-height: 1;
  text-align: center;
  z-index: 1200;
  transform: translateY(-50%);
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.toolbar__toggle--floating {
  position: fixed;
  right: var(--toolbar-toggle-offset);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: none;
  pointer-events: auto;
}

.toolbar__toggle:hover,
.toolbar__toggle:focus-visible {
  background-color: #eef2ff;
  color: #1a3aa0;
  outline: none;
}

body.toolbar-collapsed header.toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transform: translateX(100%);
  box-shadow: none;
}

body.toolbar-collapsed .toolbar__content {
  opacity: 0;
  pointer-events: none;
}

body.toolbar-collapsed main {
  flex: 1;
}

.map-only .toolbar__toggle {
  display: none !important;
}

.toolbar__section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toolbar__section h1 {
  margin: 0;
  font-size: 1.25rem;
}

.toolbar__section label {
  font-weight: 600;
}

.toolbar__section select {
  padding: 0.18rem 0.35rem;
  border: 1px solid #b0b0b0;
  border-radius: 0.3rem;
  background-color: #ffffff;
  font-size: 1rem;
  line-height: 1.2;
}

.toolbar__section select:focus {
  outline: 2px solid #3367d6;
  outline-offset: 2px;
}

p#status {
  margin: 0;
  font-size: 0.9rem;
  color: #3c3c3c;
}

.legend {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  font-size: 0.85rem;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.legend__swatch {
  display: inline-flex;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.legend__swatch.marker-gold {
  background-color: #d4af37;
}

.legend__swatch.marker-silver {
  background-color: #b0b0b0;
}

.legend__swatch.marker-bronze {
  background-color: #b87333;
}

.legend__swatch.marker-default {
  background-color: #3367d6;
}

.marker {
  display: inline-block;
  width: 32px;
  height: 44px;
}

.marker svg {
  width: 100%;
  height: 100%;
  display: block;
}

main {
  flex: 1;
  position: relative;
}

#map {
  position: absolute;
  inset: 0;
}

.custom-marker {
  background: transparent;
  border: none;
  width: 32px;
  height: 44px;
}

.cluster-popup,
.country-popup {
  max-height: min(60vh, 420px);
  overflow-y: auto;
  padding-right: 0.35rem;
  scrollbar-gutter: stable;
}

.cluster-popup h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}


.popup__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.popup__list li + li {
  margin-top: 0.35rem;
}

.popup__company {
  color: #5a5a5a;
  font-size: 0.9em;
}

.popup__city {
  color: #5a5a5a;
  font-size: 0.9em;
}

.popup__original-name {
  margin: 0 0 0.35rem;
  color: #4c4c4c;
  font-size: 0.9rem;
}

.popup__link-icon {
  margin-left: 0.35rem;
  color: inherit;
  text-decoration: none;
}

.popup__link-icon:hover,
.popup__link-icon:focus-visible {
  text-decoration: underline;
}

.marker-popup h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.marker-popup p {
  margin: 0;
  font-size: 0.9rem;
  color: #2c2c2c;
}

.marker-popup p + p {
  margin-top: 0.35rem;
}

@media (max-width: 640px) {
  .toolbar__content {
    align-items: flex-start;
  }

  .toolbar__section {
    width: 100%;
  }

  #country-filter {
    min-width: 100%;
  }

  .legend {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
}
