:root {
  color-scheme: light;
  --bg: #eef4f6;
  --ink: #142935;
  --muted: #687c86;
  --line: #c8d6dc;
  --panel: rgba(255, 255, 255, 0.84);
  --blue: #1d6f9f;
  --deep: #0e3c55;
  --accent: #d58f36;
  --fog: #9aaab2;
  --heat: #de8053;
  --snow: #78a9ca;
  --thunder: #8162b5;
  --blizzard: #4d84b7;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 10%, rgba(213, 143, 54, 0.18), transparent 28%),
    radial-gradient(circle at 85% 5%, rgba(29, 111, 159, 0.20), transparent 30%),
    linear-gradient(145deg, #edf6f8, #e2edf1 45%, #f7f2e8);
}

.app {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.toolbar,
.status-grid,
.layout {
  display: grid;
  gap: 12px;
}

.toolbar {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 14px 2px 10px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  font-size: 18px;
}

.clock {
  min-width: 180px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  text-align: right;
  box-shadow: 0 10px 30px rgba(20, 41, 53, 0.08);
}

.clock span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.clock strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
}

.status-grid {
  grid-template-columns: 360px 1fr;
  margin-bottom: 12px;
}

.layout {
  grid-template-columns: minmax(340px, .85fr) minmax(560px, 1.15fr);
  margin-bottom: 12px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 14px 38px rgba(20, 41, 53, 0.09);
  backdrop-filter: blur(16px);
}

.current-panel,
.filters,
.forecast-panel,
.map-panel,
.nm-panel {
  padding: 14px;
}

.panel-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.weather-now {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 12px;
}

.weather-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: white;
  background: var(--deep);
  font-size: 23px;
  font-weight: 900;
}

#weatherNow {
  font-size: 28px;
}

#weatherEnds {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.control-row {
  display: grid;
  grid-template-columns: 210px 170px 190px 1fr;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255,255,255,.78);
  font: inherit;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title p {
  color: var(--muted);
  font-size: 13px;
}

.overview-panel {
  margin-bottom: 12px;
  padding: 14px;
}

.zone-overview {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.zone-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 7px;
  padding: 10px;
  background: rgba(255,255,255,.72);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.zone-card strong,
.zone-card span {
  display: block;
}

.zone-card strong {
  font-size: 13px;
}

.zone-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.zone-card[aria-pressed="true"] {
  outline: 2px solid rgba(29,111,159,.32);
  background: rgba(255,255,255,.94);
}

.forecast-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 540px;
  overflow: auto;
  padding-right: 4px;
}

.forecast-item {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 7px;
  padding: 10px;
  background: rgba(255,255,255,.72);
}

.forecast-item strong {
  display: block;
  font-size: 14px;
}

.forecast-item span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.forecast-item mark {
  display: inline-block;
  margin-top: 7px;
  border-radius: 4px;
  padding: 3px 6px;
  color: #fff;
  background: var(--deep);
  font-size: 11px;
  font-weight: 800;
}

.map {
  position: relative;
  isolation: isolate;
  aspect-ratio: var(--map-ratio, 1 / 1);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255,255,255,.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.16) 1px, transparent 1px),
    radial-gradient(circle at 72% 45%, rgba(112, 163, 198, .68), transparent 22%),
    radial-gradient(circle at 28% 70%, rgba(213, 143, 54, .24), transparent 26%),
    linear-gradient(140deg, #55778b, #d8e6ea 42%, #9db5c2);
  background-size: 12.5% 12.5%, 12.5% 12.5%, auto, auto, auto;
}

.map.has-image {
  background: #e7f0f3;
}

.map.has-image::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--map-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  filter: saturate(.92) contrast(1.02);
  pointer-events: none;
}

.map.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 46%, rgba(255,255,255,0), rgba(255,255,255,.20) 72%, rgba(14,60,85,.13)),
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(13,52,72,.10));
  pointer-events: none;
}

.map-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.coord-line {
  position: absolute;
  background: rgba(14, 60, 85, .17);
  box-shadow: 0 0 0 1px rgba(255,255,255,.28);
}

.coord-line-x {
  top: 0;
  bottom: 0;
  width: 1px;
}

.coord-line-y {
  left: 0;
  right: 0;
  height: 1px;
}

.coord-label {
  position: absolute;
  min-width: 21px;
  border: 1px solid rgba(255,255,255,.66);
  border-radius: 999px;
  padding: 1px 5px;
  color: #123140;
  background: rgba(246,250,251,.78);
  box-shadow: 0 5px 14px rgba(20, 41, 53, .10);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.coord-label-x {
  bottom: 6px;
  translate: -50% 0;
}

.coord-label-y {
  left: 6px;
  translate: 0 -50%;
}

.pin {
  position: absolute;
  z-index: 4;
  translate: -16px -50%;
  display: flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: 150px;
  border: 0;
  padding: 0;
  color: #b3192a;
  background: transparent;
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: help;
  transition: opacity .15s ease, scale .15s ease, filter .15s ease;
}

.pin.edge-right {
  translate: calc(-100% + 16px) -50%;
  flex-direction: row-reverse;
}

.pin-number {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 3px solid currentColor;
  border-radius: 50%;
  color: currentColor;
  background: rgba(255,255,255,.96);
  box-shadow:
    0 0 0 2px rgba(255,255,255,.76),
    0 8px 18px rgba(0,0,0,.22);
  font-size: 16px;
  line-height: 1;
}

.pin-name {
  display: block;
  max-width: 176px;
  border-radius: 7px;
  padding: 3px 6px 4px;
  color: currentColor;
  background: rgba(255,255,255,.78);
  box-shadow: 0 6px 14px rgba(20,41,53,.13);
  font-size: 14px;
  line-height: 1.05;
  text-shadow:
    1px 0 0 white,
    -1px 0 0 white,
    0 1px 0 white,
    0 -1px 0 white,
    0 2px 5px rgba(255,255,255,.86);
  overflow-wrap: anywhere;
  white-space: normal;
}

.pin.conditional {
  color: #bb6819;
}

.pin.map-extra {
  color: #1d6f9f;
}

.pin.dim {
  opacity: .18;
  filter: grayscale(.3);
}

.pin:hover,
.pin:focus-visible {
  z-index: 6;
  scale: 1.08;
  opacity: 1;
  outline: none;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.22));
}

.pin:hover::after,
.pin:focus-visible::after {
  content: attr(data-title);
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: calc(100% + 8px);
  translate: -50% 0;
  width: max-content;
  max-width: 220px;
  border-radius: 6px;
  padding: 7px 9px;
  background: rgba(10, 24, 32, .94);
  color: white;
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 9px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: rgba(244, 249, 250, .96);
  font-size: 12px;
}

td strong {
  display: block;
  font-size: 14px;
}

.tag {
  display: inline-block;
  border-radius: 4px;
  padding: 3px 6px;
  color: white;
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.empty {
  padding: 20px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .toolbar,
  .status-grid,
  .layout,
  .control-row,
  .zone-overview {
    grid-template-columns: 1fr;
  }

  .clock {
    text-align: left;
  }

  .forecast-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }
}

@media (max-width: 540px) {
  .app {
    width: min(100% - 18px, 1480px);
    padding-top: 8px;
  }

  h1 {
    font-size: 27px;
  }

  .forecast-list {
    grid-template-columns: 1fr;
  }
}
