:root {
  color-scheme: light;
  --ink: #182026;
  --muted: #5c6870;
  --line: #dce3e8;
  --panel: #f8faf8;
  --surface: #ffffff;
  --accent: #146c5f;
  --accent-dark: #0f5249;
  --warning: #9d5425;
  --shadow: 0 18px 55px rgba(24, 32, 38, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: #eef3f1;
}

button,
input {
  font: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(380px, 520px);
}

.map-pane {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  overflow: hidden;
  background: #d9e4df;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.map-credit {
  position: absolute;
  left: 16px;
  bottom: 88px;
  z-index: 500;
  max-width: min(520px, calc(100% - 32px));
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 12px;
  box-shadow: 0 8px 22px rgba(24, 32, 38, 0.12);
}

.weather-map-marker {
  border: 0;
  background: transparent;
}

.weather-map-marker__bubble {
  width: 66px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0 auto;
  border: 1px solid rgba(15, 82, 73, 0.22);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(24, 32, 38, 0.2);
}

.weather-map-marker--active .weather-map-marker__bubble {
  border-color: var(--accent);
  background: #f1fbf6;
  box-shadow:
    0 0 0 3px rgba(20, 108, 95, 0.18),
    0 10px 24px rgba(24, 32, 38, 0.24);
}

.weather-map-marker__symbol {
  font-size: 23px;
  line-height: 1;
}

.weather-map-marker__temp {
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.weather-map-marker__label {
  max-width: 92px;
  margin-top: 4px;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(24, 32, 38, 0.72);
  color: #fff;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.radar-panel,
.radar-legend,
.radar-history {
  position: absolute;
  z-index: 1000;
  border: 1px solid rgba(220, 227, 232, 0.92);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 30px rgba(24, 32, 38, 0.14);
}

.radar-panel {
  top: 16px;
  left: 16px;
  width: min(270px, calc(100% - 32px));
  display: grid;
  gap: 9px;
  padding: 12px;
}

.radar-panel__header,
.switch {
  display: flex;
  align-items: center;
}

.radar-panel__header {
  justify-content: space-between;
  gap: 12px;
}

.radar-panel__header span:last-child,
.radar-panel label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.switch {
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
}

.switch input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.radar-panel select,
.radar-panel input[type="range"] {
  width: 100%;
}

.radar-panel select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
  color: var(--ink);
}

.radar-panel input[type="range"] {
  accent-color: var(--accent);
}

.map-locate-button,
.map-theme-button {
  position: absolute;
  top: 16px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(220, 227, 232, 0.92);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 10px 30px rgba(24, 32, 38, 0.14);
}

.map-locate-button {
  right: calc(520px + 16px);
}

.map-theme-button {
  right: calc(520px + 68px);
}

.map-locate-button:hover,
.map-theme-button:hover {
  background: #f1fbf6;
}

.map-theme-button.active {
  background: #182026;
  color: #f8faf8;
}

.radar-legend {
  left: 16px;
  bottom: 130px;
  max-width: 126px;
  max-height: 260px;
  padding: 8px;
  overflow: hidden;
}

.radar-legend[hidden] {
  display: none;
}

.radar-legend img {
  display: block;
  max-width: 108px;
  max-height: 242px;
}

.radar-history {
  position: fixed;
  left: 16px;
  right: calc(520px + 16px);
  bottom: 16px;
  width: auto;
  min-width: 320px;
  display: grid;
  gap: 9px;
  padding: 12px 14px;
  transform: none;
}

.radar-history__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.radar-history__meta output {
  color: var(--ink);
  white-space: nowrap;
}

.radar-history__controls {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 10px;
}

.radar-history__controls button {
  width: 74px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.radar-history__controls button:hover {
  background: var(--accent-dark);
}

.radar-history input {
  width: 100%;
  accent-color: var(--accent);
}

.weather-pane {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 900;
}

.topbar,
.section-title,
.search-row,
.current,
.metrics {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.updated,
.summary,
.section-title span,
.metrics span,
.status {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 5px;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
}

.icon-button,
.search button {
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

.icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
}

.search {
  display: grid;
  gap: 8px;
}

.search label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-row {
  gap: 10px;
}

.search input {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
}

.search button {
  height: 46px;
  min-width: 76px;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 800;
}

.icon-button:hover,
.search button:hover {
  background: var(--accent-dark);
}

.status {
  min-height: 20px;
  font-size: 13px;
}

.status.error {
  color: var(--warning);
}

.current {
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 8px;
  border-top: 1px solid var(--line);
}

.place {
  font-size: 24px;
  font-weight: 850;
  line-height: 1.16;
}

.updated {
  margin-top: 6px;
  font-size: 13px;
}

.temperature {
  white-space: nowrap;
  color: var(--accent-dark);
  font-weight: 900;
  line-height: 1;
}

.temperature span:first-child {
  font-size: 70px;
}

.temperature .unit {
  font-size: 24px;
  vertical-align: top;
}

.summary {
  margin-top: -8px;
  font-size: 15px;
  line-height: 1.45;
}

.metrics {
  gap: 10px;
}

.metrics article {
  flex: 1;
  min-width: 0;
  padding: 13px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.metrics span,
.metrics strong {
  display: block;
}

.metrics span {
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 750;
}

.metrics strong {
  font-size: 18px;
}

.forecast-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.section-title {
  justify-content: space-between;
  gap: 14px;
}

.section-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.forecast-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.forecast-row {
  display: grid;
  grid-template-columns: 64px 42px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.forecast-row time {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.forecast-icon {
  font-size: 25px;
  text-align: center;
}

.forecast-row strong {
  font-size: 19px;
}

.forecast-row small {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 860px) {
  .app {
    display: block;
  }

  .map-pane {
    height: 72svh;
    min-height: 440px;
  }

  .radar-panel {
    top: 12px;
    left: auto;
    right: 12px;
    width: min(250px, calc(100% - 24px));
    gap: 7px;
    padding: 10px;
  }

  .map-locate-button,
  .map-theme-button {
    top: 12px;
    right: auto;
  }

  .map-locate-button {
    left: 12px;
  }

  .map-theme-button {
    left: 136px;
  }

  .radar-history {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    min-width: 0;
  }

  .map-credit {
    display: none;
  }

  .weather-pane {
    min-height: auto;
    padding: 22px;
    box-shadow: none;
  }
}

@media (max-width: 520px) {
  .map-pane {
    height: 74svh;
    min-height: 460px;
  }

  .radar-panel {
    width: min(230px, calc(100% - 24px));
  }

  .weather-pane {
    padding: 18px;
  }

  .current {
    display: grid;
  }

  .temperature span:first-child {
    font-size: 58px;
  }

  .metrics {
    display: grid;
    grid-template-columns: 1fr;
  }

  .forecast-row {
    grid-template-columns: 52px 34px 1fr;
  }

  .forecast-row small {
    grid-column: 3;
  }

  .radar-legend {
    display: none;
  }

  .radar-history {
    bottom: 10px;
    padding: 10px;
  }

  .radar-history__controls {
    grid-template-columns: 68px 1fr;
  }

  .radar-history__controls button {
    width: 68px;
  }
}

html.mobile-weather-view,
html.mobile-weather-view body {
  height: 100%;
  overflow: hidden;
}

html.mobile-weather-view .app {
  display: block;
  min-height: 100svh;
}

html.mobile-weather-view .map-pane {
  height: 100svh;
  min-height: 100svh;
}

html.mobile-weather-view .weather-pane,
html.mobile-weather-view .radar-legend,
html.mobile-weather-view .radar-history,
html.mobile-weather-view .map-credit,
html.mobile-weather-view .leaflet-control-zoom,
html.mobile-weather-view .radar-panel {
  display: none;
}

html.mobile-weather-view .map-locate-button,
html.mobile-weather-view .map-theme-button {
  top: 12px;
  right: auto;
}

html.mobile-weather-view .map-locate-button {
  left: 12px;
}

html.mobile-weather-view .map-theme-button {
  left: 136px;
}

html.dark-map #map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.82) contrast(1.08);
}

html.dark-map #map .leaflet-overlay-pane {
  filter: brightness(0.95) contrast(1.08);
}

html.mobile-weather-view .weather-map-marker__bubble {
  width: 56px;
  min-height: 36px;
  gap: 4px;
  border-radius: 6px;
}

html.mobile-weather-view .weather-map-marker__symbol {
  font-size: 21px;
}

html.mobile-weather-view .weather-map-marker__temp {
  font-size: 14px;
}

html.mobile-weather-view .weather-map-marker__label {
  max-width: 74px;
  font-size: 10px;
}
