:root {
  --bg: #12192a;
  --card: #1f293d;
  --stroke: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --secondary: rgba(255, 255, 255, 0.72);
  --muted: rgba(255, 255, 255, 0.5);
  --accent: #73b8ff;
  --warning: #ff9e38;
  --danger: #f55252;
  --stale: #ffc759;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.search-wrap { position: relative; flex: 1; }
input[type="search"] {
  width: 100%;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
}

.results {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  margin: 6px 0 0;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 14px;
}
.results:empty { display: none; }

.result, button.ghost {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

button.ghost {
  width: auto;
  border: 1px solid var(--stroke);
  background: var(--card);
  white-space: nowrap;
}

.result:hover, button.ghost:hover { background: rgba(255,255,255,0.06); }

.status { color: var(--secondary); min-height: 1.2em; margin: 0 0 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px;
}

.layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.place h1 { margin: 0 0 6px; font-size: 28px; }
.meta, .muted, .eyebrow, .footer { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; font-weight: 600; }
.temp { font-size: 72px; font-weight: 300; line-height: 1; margin: 0; }
.condition { font-size: 20px; color: var(--secondary); }
.hilo { color: var(--secondary); font-weight: 600; }

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 0;
}
.metrics dt { color: var(--muted); font-size: 12px; }
.metrics dd { margin: 2px 0 0; font-weight: 600; }

.hours, .hourly {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(76px, 1fr);
  overflow-x: auto;
  gap: 10px;
}
.hour {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--secondary);
}
.hour strong { color: var(--text); font-size: 18px; }

.meteogram-card { padding: 18px 14px 12px; }
.meteogram { display: flex; flex-direction: column; gap: 18px; }
.meteogram-hours {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 92px;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 6px;
}
.meteogram-hour {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  color: var(--secondary);
}
.meteogram-clock { font-size: 11px; color: var(--muted); }
.meteogram-icon { font-size: 26px; line-height: 1; }
.meteogram-condition {
  min-height: 2.4em;
  font-size: 12px;
  line-height: 1.2;
}
.meteogram-precip { font-size: 12px; }
.meteogram-dots { display: flex; gap: 5px; }
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.dot.gold { background: #ffc759; }
.dot.amber { background: #ff9e38; }
.chart-block { display: flex; flex-direction: column; gap: 8px; }
.chart {
  width: 100%;
  height: auto;
  display: block;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
}
.chart .grid { stroke: rgba(255,255,255,0.08); }
.chart .axis { fill: rgba(255,255,255,0.45); font-size: 11px; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  color: var(--muted);
  font-size: 12px;
}
.chart-legend .swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.radar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.radar-header h2 { margin: 0; }
.radar-shell {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #0b1020;
}
.radar { height: 220px; }
.radar-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(7, 11, 20, 0.82);
}
.radar-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
}
.radar-btn:hover { background: rgba(255,255,255,0.08); }
.radar-controls input[type="range"] {
  flex: 1;
  min-width: 48px;
  accent-color: var(--accent);
  height: 16px;
}
.radar-clock {
  min-width: 58px;
  font-size: 12px;
  color: var(--secondary);
  text-align: right;
}
.radar-opacity {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  width: 88px;
  flex: 0 0 auto;
}
.radar-opacity input { width: 56px; flex: none; }
body.radar-open { overflow: hidden; }
.radar-card.is-maximized {
  position: fixed;
  inset: 16px;
  z-index: 40;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
}
.radar-card.is-maximized .radar-shell {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.radar-card.is-maximized .radar {
  flex: 1 1 auto;
  height: 0;
  min-height: 280px;
}

.daily { display: flex; flex-direction: column; gap: 10px; }
.day {
  display: grid;
  grid-template-columns: 48px 28px 72px 1fr 1fr;
  gap: 8px;
  align-items: center;
}
.low { color: var(--muted); text-align: right; }
.high { font-weight: 600; text-align: right; }

.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.alert {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(245, 82, 82, 0.16);
  color: #ffd0d0;
}
.alert.moderate, .alert.minor { background: rgba(255, 158, 56, 0.16); color: #ffe0b8; }

.agreement { font-size: 22px; font-weight: 650; margin: 8px 0; }
.agreement.strong { color: var(--accent); }
.agreement.mixed { color: var(--warning); }
.agreement.weak { color: var(--danger); }

.section-title { margin: 24px 0 8px; }
.models {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}
.model header { display: flex; justify-content: space-between; align-items: center; }
.model h3 { margin: 0; }
.fresh { text-transform: capitalize; color: var(--secondary); font-size: 13px; }
.fresh.stale, .fresh.aging, .fresh.unusable { color: var(--stale); }
.values { color: var(--secondary); }

.footer { margin-top: 28px; font-size: 13px; line-height: 1.5; }

@media (max-width: 860px) {
  .layout, .models { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .temp { font-size: 56px; }
}
