:root {
  color-scheme: dark;
  --bg: #05080d;
  --panel: rgba(7, 12, 20, 0.94);
  --panel-soft: rgba(13, 22, 34, 0.88);
  --line: rgba(255, 255, 255, 0.12);
  --muted: #9aacbe;
  --text: #f4f8fc;
  --accent: #35a7ff;
  --accent-strong: #188de5;
  --danger: #ff6b6b;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

#wind-canvas {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.maplibregl-control-container {
  position: relative;
  z-index: 12;
}

.maplibregl-ctrl-top-right {
  top: 76px;
  right: 16px;
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 12, 20, 0.84);
  box-shadow: var(--shadow);
}

.maplibregl-ctrl-group button {
  background-color: transparent;
}

.maplibregl-ctrl-attrib {
  color: #dce8f2;
  background: rgba(5, 8, 13, 0.74) !important;
}

.maplibregl-ctrl-attrib a {
  color: #9fd4ff;
}

.topbar {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, rgba(2, 5, 9, 0.94), rgba(2, 5, 9, 0.3));
  pointer-events: none;
}

.brand,
.top-actions {
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.brand {
  gap: 11px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(90, 190, 255, 0.45);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6fd0ff, #167ec5 55%, #082b4a);
  box-shadow: 0 0 28px rgba(53, 167, 255, 0.28);
  font-size: 21px;
}

.brand div {
  display: flex;
  flex-direction: column;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand span:last-child {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.top-actions {
  gap: 8px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 12, 20, 0.82);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(80, 185, 255, 0.72);
  background: rgba(16, 42, 65, 0.92);
}

.layer-panel {
  position: absolute;
  z-index: 18;
  top: 82px;
  right: 18px;
  width: min(300px, calc(100vw - 36px));
  max-height: calc(100vh - 190px);
  padding: 18px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel-header,
.range-heading,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.panel-header div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.panel-header strong {
  font-size: 15px;
}

.panel-header small,
.toggle-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.layer-panel section {
  padding-top: 15px;
}

.layer-panel h2 {
  margin: 0 0 9px;
  color: #bac9d7;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
}

.base-button {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.base-button.active {
  background: rgba(53, 167, 255, 0.18);
  color: #dff2ff;
}

.layer-list {
  display: grid;
  gap: 5px;
}

.layer-button {
  display: grid;
  grid-template-columns: 31px 1fr;
  align-items: center;
  min-height: 43px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: #c5d0da;
  text-align: left;
  cursor: pointer;
}

.layer-button:hover {
  background: rgba(255, 255, 255, 0.05);
}

.layer-button.active {
  border-color: rgba(70, 180, 255, 0.42);
  background: linear-gradient(90deg, rgba(27, 137, 214, 0.72), rgba(25, 105, 167, 0.42));
  color: white;
}

.layer-icon {
  width: 25px;
  text-align: center;
  font-size: 17px;
}

.toggle-row {
  position: relative;
  cursor: pointer;
}

.toggle-row > span:first-child {
  display: flex;
  flex-direction: column;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  width: 43px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #394452;
  transition: background 160ms ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: transform 160ms ease;
}

.toggle-row input:checked + .switch {
  background: var(--accent-strong);
}

.toggle-row input:checked + .switch::after {
  transform: translateX(19px);
}

.range-heading {
  margin-bottom: 8px;
}

.range-heading h2 {
  margin: 0;
}

.range-heading output,
.range-heading span {
  color: var(--muted);
  font-size: 11px;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  accent-color: var(--accent);
  cursor: pointer;
}

.legend-gradient {
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #2276d3, #21c9b0, #ded82f, #ed762b, #d8244c, #ad18b5);
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: #aebccc;
  font-size: 9px;
}

.panel-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #778899;
  font-size: 9px;
  line-height: 1.5;
}

.status-card {
  position: absolute;
  z-index: 15;
  top: 86px;
  left: 18px;
  display: flex;
  max-width: min(420px, calc(100vw - 355px));
  flex-direction: column;
  gap: 4px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 12, 20, 0.84);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(14px);
  transition: opacity 240ms ease;
}

.status-card.hidden {
  opacity: 0;
  pointer-events: none;
}

.status-card strong {
  font-size: 12px;
}

.status-card span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.timeline-panel {
  position: absolute;
  z-index: 17;
  right: 18px;
  bottom: 20px;
  left: 18px;
  display: grid;
  grid-template-columns: 50px 1fr;
  align-items: center;
  gap: 13px;
  min-height: 91px;
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(5, 9, 15, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.play-button {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  padding-left: 4px;
  border: 1px solid rgba(65, 180, 255, 0.66);
  border-radius: 50%;
  background: rgba(32, 137, 208, 0.2);
  color: #dff3ff;
  font-size: 18px;
  cursor: pointer;
}

.play-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.timeline-content {
  min-width: 0;
}

.timeline-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 7px;
}

.timeline-heading strong {
  font-size: 12px;
}

.timeline-heading span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-ticks {
  display: flex;
  justify-content: space-between;
  min-height: 14px;
  margin-top: 3px;
  color: #8fa0b1;
  font-size: 8px;
}

.map-readout {
  position: absolute;
  z-index: 13;
  left: 18px;
  bottom: 124px;
  display: flex;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(5, 9, 15, 0.72);
  color: #b8c6d3;
  font-size: 9px;
  pointer-events: none;
}

.panel-close {
  border: 0;
  background: transparent;
  font-size: 27px;
  cursor: pointer;
}

.mobile-only {
  display: none;
}

@media (max-width: 820px) {
  .button-text {
    display: none;
  }

  .icon-button {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .mobile-only {
    display: inline-flex;
  }

  .layer-panel {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100vh - 90px);
    border-radius: 24px;
    transform: translateY(calc(100% + 16px));
    transition: transform 220ms ease;
  }

  .layer-panel.open {
    transform: translateY(0);
  }

  .status-card {
    top: 77px;
    left: 10px;
    max-width: calc(100vw - 20px);
  }

  .timeline-panel {
    right: 8px;
    bottom: 8px;
    left: 8px;
    grid-template-columns: 42px 1fr;
    min-height: 82px;
    padding: 11px 12px;
  }

  .play-button {
    width: 40px;
    height: 40px;
  }

  .timeline-heading {
    display: block;
  }

  .timeline-heading strong,
  .timeline-heading span {
    display: block;
  }

  .timeline-heading span {
    margin-top: 2px;
  }

  .timeline-ticks {
    display: none;
  }

  .map-readout {
    bottom: 101px;
    left: 8px;
  }

  .maplibregl-ctrl-top-right {
    top: 72px;
    right: 8px;
  }
}

@media (max-width: 460px) {
  .brand span:last-child {
    display: none;
  }

  .topbar {
    padding: 8px 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }
}
