:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --feels: #f59e0b;
  --range: #93c5fd;
  --cold: #60a5fa;
  --mild: #34d399;
  --hot: #f87171;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --line: #334155;
    --accent: #60a5fa;
    --range: #1d4ed8;
  }
}

* { 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; }

/* Celsius scale with landmarks */
.scale { margin: 1.5rem 0 .5rem; }
.track {
  position: relative; height: .75rem; border-radius: 1rem;
  background: linear-gradient(90deg, var(--cold) 0%, var(--cold) 30%, var(--mild) 55%, var(--hot) 85%);
  opacity: .9;
}
.today-range {
  position: absolute; top: -.2rem; bottom: -.2rem; border-radius: 1rem;
  background: var(--range); opacity: .85; border: 2px solid var(--card);
}
.pin {
  position: absolute; top: 50%; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  transform: translate(-50%, -50%); border: 3px solid var(--card);
}
.pin-now { background: var(--text); z-index: 1; }
.pin-feels { background: transparent; border-color: var(--feels); width: 1.4rem; height: 1.4rem; }

.ticks { position: relative; list-style: none; margin: .4rem 0 0; padding: 0; height: 3.4rem; }
.tick {
  position: absolute; transform: translateX(-50%); text-align: center;
  font-size: .75rem; line-height: 1.15; white-space: nowrap;
}
.tick::before { content: ""; display: block; width: 1px; height: .35rem; margin: 0 auto .1rem; background: var(--muted); }
.tick-c { display: block; font-weight: 700; }
.tick-word { display: block; color: var(--muted); }
.tick-f { display: block; color: var(--muted); }

.legend { font-size: .75rem; color: var(--muted); text-align: center; margin: .25rem 0 0; }
.key { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin: 0 .25rem 0 .6rem; vertical-align: -1px; }
.key-now { background: var(--text); }
.key-feels { border: 2px solid var(--feels); }
.key-range { background: var(--range); border-radius: .2rem; }

.days { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: .9rem; padding: .9rem; }
.day h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .4rem; }
.day p { margin: .25rem 0; }
.day-cond { font-size: .9rem; }
.hilo .lbl { display: inline-block; width: 2.6rem; color: var(--muted); font-size: .85rem; }
.delta { font-size: .85rem; color: var(--muted); margin-top: .5rem !important; }

@media (max-width: 22rem) {
  .days { grid-template-columns: 1fr; }
}

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

@media (max-width: 23rem) {
  .tick { font-size: .65rem; }
}
