:root {
  color-scheme: light;
  --bg: #eef3f8;
  --panel: rgba(9, 18, 31, 0.72);
  --panel-strong: rgba(8, 16, 28, 0.82);
  --panel-border: rgba(255, 255, 255, 0.18);
  --text: #f8fbff;
  --muted: rgba(232, 239, 247, 0.74);
  --accent: #44b0ff;
  --accent-strong: #1970ff;
  --shadow: 0 24px 64px rgba(7, 18, 34, 0.26);
  --toast-shadow: 0 18px 48px rgba(12, 26, 49, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(68, 176, 255, 0.16), transparent 32%),
    radial-gradient(circle at bottom right, rgba(25, 112, 255, 0.12), transparent 24%),
    var(--bg);
}

body {
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  filter: saturate(1.04) contrast(1.02);
}

.layer-switcher,
.toast {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.layer-switcher {
  position: fixed;
  top: 50%;
  right: 18px;
  z-index: 1000;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    var(--panel-strong);
  transform: translateY(-50%);
}

.layer-switcher-label {
  padding: 2px 6px 6px;
  color: rgba(240, 247, 255, 0.7);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.layer-btn {
  min-width: 118px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.layer-key {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(248, 251, 255, 0.9);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.layer-btn:hover,
.layer-btn:focus-visible {
  outline: none;
  transform: translateY(-1px) scale(1.01);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.layer-btn.active {
  border-color: rgba(142, 208, 255, 0.48);
  background:
    linear-gradient(135deg, rgba(84, 189, 255, 0.98), rgba(25, 112, 255, 0.96));
  color: #fbfdff;
  box-shadow:
    0 10px 24px rgba(25, 112, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.layer-btn.active .layer-key {
  background: rgba(255, 255, 255, 0.22);
}

.toast {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1001;
  padding: 11px 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04)),
    rgba(7, 18, 31, 0.9);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--toast-shadow);
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: top left;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.error {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
    rgba(90, 20, 34, 0.92);
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 8px, 0) scale(0.97);
}

@media (max-width: 760px) {
  .layer-switcher {
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-radius: 20px;
    transform: none;
  }

  .layer-switcher-label {
    grid-column: 1 / -1;
  }

  .layer-btn {
    min-width: 0;
    justify-content: center;
  }

  .toast {
    max-width: min(240px, calc(100vw - 28px));
  }

  .toast.hidden {
    transform: translate3d(0, 8px, 0) scale(0.97);
  }
}
