:root {
  --bg: #eef3f9;
  --card: #ffffff;
  --text: #13233a;
  --muted: #5b6b80;
  --accent: #1b4f8f;
  --border: #d8e1ec;
  --yellow: #f6c700;
  --amber: #f08c00;
  --red: #d62828;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1520;
    --card: #17222f;
    --text: #e6edf5;
    --muted: #93a3b8;
    --accent: #6fa8ef;
    --border: #263546;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
main, .top { max-width: 560px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 .5rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 .6rem; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.top { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; padding-bottom: 8px; }
.top p { margin: 0; }
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  background: none; border: 0; color: var(--text); font-size: 1.4rem;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
}
.icon-btn:active { background: var(--border); }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

.hero-main { display: flex; align-items: center; gap: 16px; }
.hero-icon { font-size: 4rem; line-height: 1; }
.hero-range { font-size: 2.4rem; font-weight: 700; line-height: 1.1; }
.hero-range .muted { font-size: 1.4rem; font-weight: 500; margin-left: .5rem; }
.now { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.sun { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

.days { list-style: none; margin: 0; padding: 0; }
.days li { display: grid; grid-template-columns: 3.2rem 2rem 1fr auto; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.days li:first-child { border-top: 0; }
.days .d-icon { font-size: 1.4rem; text-align: center; }
.days .d-sum { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.days .d-temp { font-weight: 600; white-space: nowrap; }

.warning { border-left: 6px solid var(--yellow); }
.warning.amber { border-left-color: var(--amber); }
.warning.red { border-left-color: var(--red); }
.warning summary { cursor: pointer; list-style: none; }
.warning summary::-webkit-details-marker { display: none; }
.warning .w-title { font-weight: 700; }
.warning .w-badge {
  display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase;
  padding: 1px 8px; border-radius: 99px; background: var(--yellow); color: #000; margin-right: 6px;
}
.warning.amber .w-badge { background: var(--amber); }
.warning.red .w-badge { background: var(--red); color: #fff; }
.warning .w-body { margin-top: 10px; }
.warning .w-more { color: var(--accent); font-size: .9rem; }
.warning[open] .w-more { display: none; }

form label { display: block; margin: 0 0 12px; font-weight: 600; }
form input {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 0;
  background: var(--accent); color: #fff; cursor: pointer;
}
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
code { font-size: .9em; }

.meta { font-size: .85rem; text-align: center; padding: 8px 0 24px; }
.stale { color: var(--amber); font-weight: 600; }
