:root {
  --bg: #0e1318;
  --panel: #171e27;
  --panel-2: #10161d;
  --line: #2c3846;
  --text: #f3efe6;
  --muted: #a3adb8;
  --amber: #ffc53d;
  --ice: #8be7ff;
  --snow: #e7f2ff;
  --rain: #7eb6ff;
  --ok: #9ddeaf;
  --danger: #ff8b70;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

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

button {
  touch-action: manipulation;
}

.app {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: 0 16px calc(28px + env(safe-area-inset-bottom));
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-bottom: 10px;
  background: linear-gradient(var(--bg) 78%, rgba(14, 19, 24, 0.92) 100%);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stripes {
  width: 16px;
  height: 26px;
  border-radius: 2px;
  background: repeating-linear-gradient(
    to bottom,
    var(--amber) 0 3px,
    transparent 3px 7px
  );
}

.eyebrow {
  margin: 0;
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 1.55rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

h2 {
  margin: 22px 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.actions { display: flex; gap: 8px; }

.actions button,
.primary,
.results button,
.chip {
  border: 1px solid var(--line);
  background: var(--panel);
}

.actions button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  padding: 0;
}

.actions svg { width: 22px; height: 22px; }

.actions button:active,
.primary:active,
.chip:active,
.results button:active { transform: scale(0.98); }

.search { display: block; }

.search input {
  width: 100%;
  height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 0 16px;
  font-size: 16px;
  outline: none;
}

.search input:focus {
  border-color: var(--amber);
}

.search-wrap, .top { position: sticky; }

.top { position: sticky; }

.results {
  list-style: none;
  margin: 8px 0 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #1c2530;
  box-shadow: var(--shadow);
}

.results button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.results button strong { font-size: 1rem; }

.results button span,
.chip span,
.updated,
.sky,
.metric em,
.day-sub,
footer,
.empty p,
.insight {
  color: var(--muted);
}

.results button:focus-visible,
.actions button:focus-visible,
.chip:focus-visible,
.primary:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 2px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  min-height: 40px;
  border-radius: 999px;
  padding: 8px 12px;
}

.banner {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #3a221c;
  color: #ffd2c6;
}

.status {
  margin-top: 8px;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 20px;
  background: var(--panel);
}

.status.danger { border-left-color: var(--danger); background: #2a1816; }
.status.ice { border-left-color: var(--ice); background: #12242b; }
.status.snow { border-left-color: var(--snow); background: #1a242e; }
.status.rain { border-left-color: var(--rain); background: #14202c; }
.status.wind,
.status.watch,
.status.cold { border-left-color: var(--amber); background: #262014; }
.status.ok { border-left-color: var(--ok); background: #142218; }

.kicker {
  color: var(--muted);
  font-size: 0.95rem;
}

.status h2 {
  margin: 4px 0 8px;
  color: var(--text);
  font-size: 1.85rem;
  letter-spacing: -0.04em;
  text-transform: none;
  line-height: 1.05;
}

.status p { font-size: 1.05rem; line-height: 1.35; }

.temp-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.temp {
  font-size: clamp(4.2rem, 20vw, 5.4rem);
  font-weight: 720;
  letter-spacing: -0.06em;
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
}

.temp.cold { color: var(--ice); }

.side {
  text-align: right;
  padding-bottom: 4px;
}

.side .sky {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: var(--text);
  font-size: 1rem;
}

.feels, .light {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.ico { width: 22px; height: 22px; display: block; }

.hazards { display: grid; gap: 8px; margin-top: 12px; }

.hazard {
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 5px;
}

.hazard h2 { margin: 0 0 4px; }
.hazard h3 { margin: 0 0 6px; font-size: 1.25rem; letter-spacing: -0.03em; line-height: 1.2; }
.hazard p { line-height: 1.4; }
.hazard.ice { border-left-color: var(--ice); }
.hazard.watch { border-left-color: var(--amber); }
.hazard.ok { border-left-color: var(--ok); }
.hazard.rain { border-left-color: var(--rain); }
.hazard.cloud { border-left-color: #c5d0dc; }

.cloud-strip {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 84px;
  margin-top: 12px;
}

.cloud-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.cloud-bar {
  width: 100%;
  min-height: 4px;
  background: #8ea0b3;
  border-radius: 3px 3px 0 0;
}

.cloud-col[data-frost="likely"] .cloud-bar { background: var(--ice); }
.cloud-col[data-frost="possible"] .cloud-bar { box-shadow: inset 0 -4px 0 var(--ice); }
.cloud-col[data-wet="1"] .cloud-bar { box-shadow: inset 0 -4px 0 var(--amber); }
.cloud-col small { height: 14px; color: var(--muted); font-size: 0.62rem; }
.cloud-key { margin-top: 6px; color: var(--muted); font-size: 0.82rem; }

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.metric {
  min-height: 84px;
  padding: 12px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.metric.warn { border-color: var(--ice); }

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  font-weight: 680;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.metric em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 0.92rem;
}

.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.insight {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  line-height: 1.35;
}

.hours {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.hours::-webkit-scrollbar { display: none; }

.hour {
  flex: 0 0 92px;
  scroll-snap-align: start;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar { display: block; height: 5px; background: var(--ok); }
.hour[data-tone="danger"] .bar { background: var(--danger); }
.hour[data-tone="ice"] .bar { background: var(--ice); }
.hour[data-tone="snow"] .bar { background: var(--snow); }
.hour[data-tone="rain"] .bar { background: var(--rain); }
.hour[data-tone="wind"] .bar,
.hour[data-tone="watch"] .bar,
.hour[data-tone="cold"] .bar { background: var(--amber); }

.hour-body {
  padding: 10px 10px 12px;
  display: grid;
  gap: 3px;
}

.hour time,
.hour .hour-temp {
  font-variant-numeric: tabular-nums;
}

.hour time { color: var(--muted); font-size: 0.85rem; }

.hour-temp { font-size: 1.25rem; font-weight: 700; }

.hour small { color: var(--muted); font-size: 0.78rem; }

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

.day {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.day-top, .day-sub {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.day-name { font-weight: 700; }

.day-temps {
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
}

.day-temps b { font-weight: 750; }

.day-temps span { color: var(--muted); font-weight: 600; margin-left: 8px; }

.day-sub { margin-top: 4px; font-size: 0.92rem; }

.summary {
  font-size: 1.05rem;
  line-height: 1.35;
}

.district h2:first-of-type { margin-top: 12px; }

.spots {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.spots::-webkit-scrollbar { display: none; }

.spot {
  flex: 0 0 auto;
  min-width: 112px;
  scroll-snap-align: start;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 10px 12px 12px;
}

.spot.on { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }

.spot span,
.spot small { color: var(--muted); font-size: 0.82rem; }

.spot strong {
  display: block;
  margin: 3px 0 2px;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.spot[data-tone="danger"] strong { color: var(--danger); }
.spot[data-tone="ice"] strong,
.spot[data-tone="cold"] strong { color: var(--ice); }
.spot[data-tone="snow"] strong { color: var(--snow); }
.spot[data-tone="rain"] strong { color: var(--rain); }
.spot[data-tone="watch"] strong,
.spot[data-tone="wind"] strong { color: var(--amber); }

.empty {
  margin-top: 18px;
  padding: 22px 18px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px dashed var(--line);
}

.empty h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  text-transform: none;
}

.empty p { font-size: 1.05rem; line-height: 1.4; }

.primary {
  margin-top: 16px;
  min-height: 52px;
  width: 100%;
  border-radius: 16px;
  background: var(--amber);
  color: #1a1406;
  font-weight: 750;
  border-color: transparent;
}

footer {
  margin-top: 28px;
  display: grid;
  gap: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (min-width: 720px) {
  .app { padding-left: 20px; padding-right: 20px; }
}
