:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --track: #e2e8f0;
  --rain: #0284c7;
  --dot: #0f172a;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --line: #334155;
    --accent: #60a5fa;
    --track: rgba(255, 255, 255, .09);
    --rain: #38bdf8;
    --dot: #ffffff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 34rem;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1 { font-size: 1.1rem; margin: 0 0 .75rem; color: var(--muted); font-weight: 600; }

[hidden] { display: none !important; }

button {
  font: inherit; padding: .6rem .8rem; border-radius: .6rem;
  border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer;
}
button.primary, #search button[type="submit"] { background: var(--accent); color: #fff; border-color: var(--accent); }
button.link { border: 0; background: none; padding: .35rem 0; color: var(--accent); }

/* Landing */
#landing h2 { font-size: 1.6rem; line-height: 1.2; margin: 1.5rem 0 .75rem; }
#landing p { margin: 0 0 .75rem; }
.points { margin: 0 0 1.5rem; padding-left: 1.2rem; color: var(--muted); }
.points li { margin: .35rem 0; }
#locate { width: 100%; padding: .85rem; font-size: 1.05rem; font-weight: 600; }
.fine { font-size: .8rem; color: var(--muted); text-align: center; margin-top: .5rem !important; }
.or { color: var(--muted); text-align: center; margin: 1.5rem 0 .5rem !important; }

/* Location picker */
#search { display: flex; gap: .5rem; }
#search input {
  flex: 1; min-width: 0; padding: .6rem .75rem; font: inherit;
  border: 1px solid var(--line); border-radius: .6rem; background: var(--card); color: var(--text);
}
#results { list-style: none; margin: .5rem 0 0; padding: 0; }
#results button { width: 100%; text-align: left; margin-top: .25rem; }
#recent { margin-top: .5rem; }
#picker-actions { display: flex; justify-content: space-between; margin-top: .5rem; }

#status { color: var(--muted); margin: 1rem 0; }

.current { text-align: center; margin: 1.5rem 0 1rem; }
.place { margin: 0; font-weight: 600; }
.region { color: var(--muted); font-weight: 400; }
.change {
  margin-left: .4rem; padding: .15rem .55rem; font-size: .8rem; font-weight: 500;
  border-radius: 1rem; color: var(--accent); vertical-align: 1px;
}

.hero { margin: .25rem 0; display: flex; justify-content: center; align-items: baseline; gap: 1rem; }
.hero .c { font-size: clamp(4.5rem, 24vw, 7rem); font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.hero .unit { font-size: .4em; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.hero .f { font-size: 1.75rem; color: var(--muted); }

.cond { margin: .25rem 0; }
.feel { margin: .5rem 0 0; font-size: 1.1rem; font-weight: 600; }

.pair .c { font-weight: 600; }
.pair .f { color: var(--muted); font-size: .9em; }

/* Two-day forecast rows with Apple Weather-style range bars */
.days {
  background: var(--card); border: 1px solid var(--line); border-radius: 1rem;
  padding: .35rem 1rem;
}
.days h2 {
  font-size: .75rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); margin: 0; padding: .5rem 0; border-bottom: 1px solid var(--line);
}
.days ul { list-style: none; margin: 0; padding: 0; }
.day {
  display: grid; grid-template-columns: 5rem 2rem 2.7rem minmax(0, 1fr) 2.7rem;
  align-items: center; gap: .6rem; padding: .75rem 0; border-bottom: 1px solid var(--line);
}
.day:last-child { border-bottom: 0; }
.day-name { font-weight: 600; }
.day-icon { text-align: center; font-size: 1.2rem; line-height: 1.05; }
.rain { display: block; font-size: .65rem; font-weight: 600; color: var(--rain); }

.t { font-variant-numeric: tabular-nums; line-height: 1.1; }
.t .c { display: block; font-size: 1.1rem; font-weight: 600; }
.t .f { display: block; font-size: .72rem; color: var(--muted); }
.t.lo { text-align: right; color: var(--muted); }

.bar { position: relative; height: .3rem; border-radius: 1rem; background: var(--track); }
.bar-seg { position: absolute; top: 0; bottom: 0; border-radius: 1rem; }
.bar-now {
  position: absolute; top: 50%; width: .65rem; height: .65rem; border-radius: 50%;
  background: var(--dot); box-shadow: 0 0 0 2.5px var(--card); transform: translate(-50%, -50%);
}

@media (max-width: 23rem) {
  .day { grid-template-columns: 4.2rem 1.7rem 2.4rem minmax(0, 1fr) 2.4rem; gap: .45rem; }
}

footer { margin-top: 2rem; text-align: center; font-size: .8rem; color: var(--muted); }
footer a { color: inherit; }
footer p { margin: .35rem 0; }
.fine a { color: inherit; }

/* Privacy page */
.doc h1 a { color: inherit; text-decoration: none; }
.doc main h2 { font-size: 1.6rem; margin: 1.25rem 0 .25rem; }
.doc .updated { color: var(--muted); font-size: .85rem; margin: 0 0 1.25rem; }
.doc section { margin: 0 0 1.5rem; }
.doc h3 { font-size: 1.1rem; margin: 0 0 .5rem; }
.doc h4 { font-size: .95rem; margin: 1rem 0 .35rem; }
.doc p, .doc li { line-height: 1.55; }
.doc p { margin: 0 0 .75rem; }
.doc ul { margin: 0 0 .75rem; padding-left: 1.2rem; }
.doc li { margin: .3rem 0; }
.doc a { color: var(--accent); }
.doc .muted { color: var(--muted); font-size: .85em; }
.doc .contact { font-weight: 600; user-select: all; }
.doc table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .25rem 0 .75rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: .5rem .5rem .5rem 0; border-bottom: 1px solid var(--line); }
.doc th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.doc code { font-size: .85em; }
