:root {
  --bg: #f4f1ea;
  --surface: #ebe7dd;
  --ink: #14232f;
  --muted: #4d5d69;
  --line: #cfc9bb;
  --lake: #0b5a85;
  --amber: #a85a00;
  --rain: #2d7fae;
  --on-accent: #ffffff;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1821;
    --surface: #132430;
    --ink: #eef2f4;
    --muted: #a3b4c0;
    --line: #27404f;
    --lake: #6cc0ee;
    --amber: #f2b45a;
    --rain: #5aaee0;
    --on-accent: #0c1821;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  font: 16px/1.5 var(--sans);
  max-width: 1080px; margin-inline: auto; padding: 0 20px 40px;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 5; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; padding: 28px 0 18px; border-bottom: 2px solid var(--ink); }
.top h1 { font: 700 clamp(2rem, 6vw, 3.2rem)/1 var(--serif); margin: 0; letter-spacing: -.01em; }
.clock { margin: 6px 0 0; color: var(--muted); font-size: .95rem; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 8px; overflow: hidden; }
.seg button, .refresh, .error button {
  font: 600 .9rem var(--sans); min-height: 44px; padding: 0 14px; cursor: pointer;
  background: transparent; color: var(--ink); border: 0;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.refresh, .error button { border: 1.5px solid var(--ink); border-radius: 8px; }
.refresh:hover, .error button:hover { background: var(--surface); }
.refresh[disabled] { opacity: .6; cursor: progress; }

.status { color: var(--muted); padding: 40px 0; }
.error { margin: 32px 0; padding: 20px; border-left: 5px solid var(--amber); background: var(--surface); }
.error p { margin: 0 0 12px; font-weight: 600; }

.now { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 32px; padding: 32px 0; border-bottom: 1px solid var(--line); }
.now-main { display: flex; gap: 20px; align-items: center; }
.icon svg { width: clamp(84px, 16vw, 130px); height: auto; display: block; }
.temp { margin: 0; font: 700 clamp(4.5rem, 14vw, 8rem)/.9 var(--serif); letter-spacing: -.03em; }
.deg { font-size: .5em; vertical-align: top; color: var(--amber); margin-left: 2px; }
.cond { margin: 8px 0 0; font: 600 1.4rem var(--serif); }
.feels { margin: 2px 0 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; align-content: center; }
.stats div { padding: 14px 12px; border-top: 1px solid var(--line); }
.stats div:nth-child(-n+3) { border-top: 0; }
.stats dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stats dd { margin: 2px 0 0; font: 700 1.35rem var(--serif); }
.stats small { display: block; font: 400 .8rem var(--sans); color: var(--muted); }

.sec-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; padding-top: 28px; }
h2 { font: 700 1.3rem var(--serif); margin: 0 0 10px; }
.legend { margin: 0; color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 6px; }
.k-line { width: 18px; height: 3px; background: var(--amber); display: inline-block; }
.k-bar { width: 10px; height: 12px; background: var(--rain); opacity: .55; display: inline-block; margin-left: 10px; }
.chart-wrap { overflow-x: auto; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.chart-wrap svg { display: block; min-width: 720px; width: 100%; height: auto; }
.chart-wrap text { fill: var(--muted); font: 12px var(--sans); }
.chart-wrap .tv { fill: var(--ink); font-weight: 700; }

.week { list-style: none; margin: 0; padding: 0; }
.day { display: grid; grid-template-columns: 90px 44px 1fr 52px minmax(120px, 2fr) 52px; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.day:first-child { border-top: 0; }
.day .dn { font-weight: 700; }
.day .dn small { display: block; font-weight: 400; color: var(--muted); }
.day svg { width: 40px; height: 40px; }
.day .dc { color: var(--muted); font-size: .92rem; }
.day .pop { color: var(--rain); font-size: .85rem; font-weight: 600; }
.day .lo, .day .hi { font: 700 1.1rem var(--serif); }
.day .lo { color: var(--muted); text-align: right; }
.range { position: relative; height: 8px; border-radius: 4px; background: var(--surface); }
.range i { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: linear-gradient(90deg, var(--lake), var(--amber)); }

.foot { border-top: 2px solid var(--ink); margin-top: 36px; padding-top: 14px; color: var(--muted); font-size: .85rem; }
.foot a { color: var(--lake); }

@media (max-width: 760px) {
  .now { grid-template-columns: 1fr; gap: 20px; }
  .day { grid-template-columns: 70px 40px 1fr 44px 44px; }
  .day .range, .day .pop { display: none; }
  .day { grid-template-areas: none; }
}
@media (max-width: 420px) { .stats { grid-template-columns: repeat(2, 1fr); } .stats div:nth-child(3) { border-top: 1px solid var(--line); } }
@media (prefers-reduced-motion: no-preference) {
  #dash:not([hidden]) { animation: rise .5s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
}
