:root {
  --ink: #10231f;
  --muted: #64736f;
  --paper: #f4f1e8;
  --panel: #fffdf7;
  --line: #d9ddd5;
  --green: #0f6b55;
  --orange: #f0783c;
  --map-width: 65%;
  --resizer-width: 9px;
}

* { box-sizing: border-box; }
.leaflet-container,
.leaflet-container * { box-sizing: content-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.topbar {
  height: 84px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.topbar h1, .panel h2 { margin: 2px 0 0; font-family: Georgia, serif; }
.topbar h1 { font-size: 27px; font-weight: 500; }
.eyebrow { margin: 0; color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: #49a27e; box-shadow: 0 0 0 4px #e5f3ec; }
.status.loading span { background: #e3a02f; box-shadow: 0 0 0 4px #f9edcf; }
.status.error span { background: #d54a42; box-shadow: 0 0 0 4px #f7dfdc; }

main {
  height: calc(100vh - 120px);
  min-height: 600px;
  display: grid;
  grid-template-columns:
    minmax(360px, var(--map-width))
    var(--resizer-width)
    minmax(320px, 1fr);
}
.map-shell { position: relative; min-height: 480px; overflow: hidden; }
#map { position: absolute; inset: 0; background: #dce7e2; }
.leaflet-container { width: 100%; height: 100%; }
.leaflet-tile { width: 256px; height: 256px; }
.leaflet-control-attribution { font-size: 9px; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 4px 18px #173c2d2b !important; }
.leaflet-control-zoom a { color: var(--ink) !important; background: var(--panel) !important; border-color: var(--line) !important; }

.map-actions { position: absolute; z-index: 500; top: 84px; left: 10px; }
.map-actions button, .time-control button {
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; box-shadow: 0 4px 18px #173c2d2b;
}
.map-actions button { width: 34px; height: 34px; border-radius: 5px; font-size: 22px; }
.layer-status {
  position: absolute;
  z-index: 500;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 11px;
  border: 1px solid #ffffffaa;
  border-radius: 20px;
  color: var(--muted);
  background: #fffdf7ed;
  box-shadow: 0 4px 18px #173c2d1f;
  font-size: 11px;
  pointer-events: none;
}
.layer-status.ready { color: var(--green); }
.layer-status.error { color: #b33b35; }
.time-control {
  position: absolute; z-index: 500; left: 50%; bottom: 22px; transform: translateX(-50%);
  width: min(580px, calc(100% - 40px)); padding: 10px 14px; display: grid; grid-template-columns: 34px 1fr 130px;
  align-items: center; gap: 12px; border: 1px solid #ffffffaa; border-radius: 8px; background: #fffdf7ed;
  box-shadow: 0 8px 30px #173c2d33; backdrop-filter: blur(8px);
}
.time-control button { width: 32px; height: 32px; border-radius: 50%; box-shadow: none; font-size: 11px; }
.time-control input { accent-color: var(--orange); }
.time-control time { color: var(--muted); font-size: 12px; text-align: right; }

.pane-resizer {
  position: relative;
  z-index: 700;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--panel);
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}
.pane-resizer::before { content: ""; position: absolute; inset: 0 -4px; }
.pane-resizer span {
  width: 3px;
  height: 42px;
  border-radius: 3px;
  background: #b8c1bc;
  transition: background .15s, height .15s;
}
.pane-resizer:hover span,
.pane-resizer:focus-visible span,
body.resizing .pane-resizer span {
  height: 60px;
  background: var(--green);
}
.pane-resizer:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
body.resizing { cursor: col-resize; user-select: none; }

.panel { overflow-y: auto; padding: 28px 28px 20px; background: var(--panel); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel h2 { font-size: 26px; font-weight: 500; }
#coordinates { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.units { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 20px; }
.unit { width: 35px; height: 28px; border: 0; border-radius: 15px; background: transparent; cursor: pointer; font-size: 12px; }
.unit.active { color: white; background: var(--green); }

.empty-state { padding: 80px 36px; text-align: center; color: var(--muted); }
.empty-state h3 { margin: 15px 0 5px; color: var(--ink); font-family: Georgia, serif; font-size: 22px; font-weight: 500; }
.empty-state p { margin: 0 auto; max-width: 280px; line-height: 1.6; font-size: 13px; }
.empty-icon { width: 54px; height: 54px; margin: auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--orange); font-size: 28px; }

.current { margin-top: 28px; padding: 24px 0; display: flex; justify-content: space-between; border-top: 1px solid var(--line); }
.current p { margin: 0; color: var(--muted); font-size: 13px; }
.temperature { margin: 4px 0 2px; display: flex; align-items: flex-start; line-height: 1; }
.temperature strong { font-family: Georgia, serif; font-size: 66px; font-weight: 400; }
.temperature span { padding-top: 8px; font-size: 22px; }
.weather-symbol { align-self: center; color: var(--orange); font-size: 62px; line-height: 1; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 8px; }
.metrics div { min-width: 0; padding: 14px 12px; border-right: 1px solid var(--line); }
.metrics div:last-child { border: 0; }
.metrics span, .metrics small { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.metrics strong { display: block; margin: 5px 0 2px; font-size: 15px; }

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.details-grid div { min-width: 0; padding: 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.details-grid div:nth-child(3n) { border-right: 0; }
.details-grid div:nth-last-child(-n+3) { border-bottom: 0; }
.details-grid span { display: block; color: var(--muted); font-size: 10px; }
.details-grid strong { display: block; margin-top: 5px; font-size: 13px; font-weight: 650; }
.details-grid small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.pressure-rising { color: #18704f !important; }
.pressure-falling { color: #b44a3b !important; }
.pressure-steady { color: var(--muted) !important; }

.selected-alert-list { display: grid; gap: 8px; }
.selected-alert {
  padding: 11px 12px;
  border: 1px solid var(--alert-color, #c94038);
  border-left-width: 5px;
  border-radius: 6px;
  background: #fff9f3;
}
.selected-alert-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.selected-alert h4 { margin: 0; font-size: 12px; }
.selected-alert .severity {
  color: var(--alert-color, #c94038);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.selected-alert p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.selected-alert small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; }
.selected-alert a { color: var(--green); }
.no-alerts {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
}

.section-title { margin: 28px 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
.section-title h3, .layers h3 { margin: 0; font-family: Georgia, serif; font-size: 17px; font-weight: 500; }
.section-title span { color: var(--muted); font-size: 10px; }
.hourly { display: grid; grid-auto-flow: column; grid-auto-columns: 72px; gap: 5px; overflow-x: auto; padding-bottom: 8px; }
.hour { padding: 9px 4px; border: 1px solid var(--line); border-radius: 5px; text-align: center; }
.hour time, .hour small { display: block; color: var(--muted); font-size: 9px; }
.hour b { display: block; margin: 8px 0; color: var(--orange); font-size: 19px; font-weight: 400; }
.hour strong { font-size: 12px; }
.daily { border-top: 1px solid var(--line); }
.day { display: grid; grid-template-columns: 62px 1fr 70px 68px; align-items: center; gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.day .description { color: var(--muted); }
.day .description small { display: block; margin-top: 3px; font-size: 9px; }
.day .description .daily-summary { color: var(--ink); font-size: 10px; line-height: 1.35; }
.day .rain { color: #397a9d; font-size: 10px; text-align: right; }
.day .temps { text-align: right; }
.day .temps span { color: var(--muted); }

.layers { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.layers label { padding: 12px 0; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 12px; }
.layers label span { display: flex; align-items: center; gap: 9px; }
.swatch { width: 13px; height: 13px; display: inline-block; border-radius: 3px; }
.swatch.radar { background: linear-gradient(135deg, #57b4c2, #704ab9, #e55a44); }
.swatch.wind { background: var(--green); clip-path: polygon(0 42%, 65% 42%, 65% 10%, 100% 50%, 65% 90%, 65% 58%, 0 58%); }
.swatch.alert { border: 2px solid #d54a42; background: #f4b0a955; }
.layers small { color: var(--muted); font-size: 9px; }
.layers input { accent-color: var(--green); }

.wind-marker { background: transparent; border: 0; }
.wind-arrow { color: var(--green); font-size: 30px; font-weight: 300; text-shadow: 0 1px 3px white, 0 0 5px white; }
.wind-grid-marker { background: transparent; border: 0; }
.wind-grid {
  width: 54px;
  color: #0b5746;
  text-align: center;
  filter: drop-shadow(0 1px 2px white) drop-shadow(0 0 2px white);
}
.wind-grid .arrow { display: block; height: 24px; font-size: 27px; line-height: 24px; transform-origin: 50% 50%; }
.wind-grid .speed {
  display: inline-block;
  margin-top: 2px;
  padding: 2px 4px;
  border-radius: 3px;
  color: #083f34;
  background: #fffdf7d9;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

footer {
  height: 36px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line); color: var(--muted); background: var(--panel); font-size: 10px;
}

@media (max-width: 960px) {
  body { height: auto; }
  .topbar { height: 70px; padding: 0 18px; }
  .topbar h1 { font-size: 22px; }
  main { height: auto; min-height: 0; grid-template-columns: 1fr; }
  .map-shell { height: 56vh; min-height: 390px; }
  .pane-resizer { display: none; }
  .panel { overflow: visible; padding: 24px 18px; border-left: 0; border-top: 1px solid var(--line); }
  footer { height: auto; padding: 10px 18px; gap: 8px; flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .status { display: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div:nth-child(2) { border-right: 0; }
  .metrics div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .details-grid { grid-template-columns: repeat(2, 1fr); }
  .details-grid div:nth-child(3n) { border-right: 1px solid var(--line); }
  .details-grid div:nth-child(2n) { border-right: 0; }
  .details-grid div:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .details-grid div:nth-last-child(-n+2) { border-bottom: 0; }
  .time-control { grid-template-columns: 34px 1fr; }
  .time-control time { grid-column: 1 / -1; text-align: center; }
}
