* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
:root { --bg: #f2f6fa; --card: #fff; --text: #1b2a3a; --link: #12558f; }
@media (prefers-color-scheme: dark) { :root { --bg: #0d1623; --card: #172437; --text: #e4edf6; --link: #7cc4f0; } }
body { margin: 0; font-family: system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.55; }
a { color: var(--link); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: .5rem; z-index: 10; }
.site-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .75rem 1.25rem; background: #12355b; }
.logo { color: #fff; text-decoration: none; display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0 .45rem; line-height: 1.2; }
.logo-name { font-weight: 800; font-size: 1.35rem; letter-spacing: .01em; }
.logo-tag { color: #6ec1e4; font-size: .95rem; font-weight: 600; }
nav { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; }
nav a { color: #dbe9f6; text-decoration: none; padding: .3rem 0; }
main { max-width: 880px; margin: 0 auto; padding: 0 1rem 2rem; }
section { margin-top: 1.75rem; scroll-margin-top: 1rem; }
h1 { margin: 0 0 .6rem; font-size: clamp(1.6rem, 6vw, 2.3rem); line-height: 1.2; font-weight: 800; }
h2 { margin: 0 0 .75rem; font-size: 1.35rem; }
.card { background: var(--card); border-radius: 14px; padding: 1.1rem 1.25rem; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.card h2 + p { margin-top: 0; }
.calm { --tone: #2e9e5b; } .active { --tone: #d9a400; } .storm { --tone: #e8710a; } .severe { --tone: #d93025; }
.now { text-align: center; border-top: 8px solid var(--tone, #8796a8); }
.now p { margin: .25rem 0; }
.answer { font-size: 1.25rem; font-weight: 700; }
.today { font-size: .95rem; opacity: .8; margin-bottom: .1rem; text-transform: none; }
.day-name { margin: 0; font-size: .85rem; opacity: .75; }
.kp { font-size: clamp(3rem, 16vw, 5rem); font-weight: 800; color: var(--tone, inherit); }
.label { font-size: 1.1rem; }
.time, .checked { font-size: .9rem; opacity: .8; }
button { font: inherit; padding: .35rem .9rem; border-radius: 8px; border: 1px solid var(--link); background: transparent; color: var(--link); cursor: pointer; }
.bars { display: flex; align-items: flex-end; justify-content: space-between; gap: .35rem; min-height: 210px; }
.bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: .3rem; font-size: .8rem; }
.bar { width: 70%; max-width: 44px; background: var(--tone); border-radius: 5px 5px 0 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; }
.day { border-left: 6px solid var(--tone); } .day h3 { margin: 0; font-size: 1rem; } .day p { margin: .25rem 0; }
.kp-small { font-size: 2rem; font-weight: 800; color: var(--tone); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: .5rem; border-bottom: 1px solid rgba(128,128,128,.3); }
details { background: var(--card); border-radius: 10px; padding: .75rem 1rem; margin-bottom: .5rem; }
summary { cursor: pointer; font-weight: 600; }
.error { color: #d93025; }
nav a[aria-current] { color: #fff; font-weight: 700; }
.crumbs { margin: 0 0 .25rem; font-size: .9rem; opacity: .8; }
.kp-mid { font-size: clamp(1.4rem, 6vw, 2rem); font-weight: 800; color: var(--tone, inherit); }
.hour-day + .hour-day { margin-top: 1rem; }
.hour-day h3 { margin: 0 0 .5rem; font-size: 1rem; }
.hour-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .4rem; }
.hour { border-radius: 8px; padding: .4rem .3rem; text-align: center; border-bottom: 5px solid var(--tone); background: rgba(128,128,128,.08); }
.hour.current { outline: 2px solid var(--link); }
.hour-time, .hour-type { display: block; font-size: .78rem; opacity: .85; }
.hour-kp { display: block; font-size: 1.25rem; color: var(--tone); }
.legend { font-size: .85rem; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; background: var(--tone); }
.active-list { margin: 0; padding-left: 1.1rem; }
.active-list li { margin: .25rem 0; } .active-list li::marker { color: var(--tone); }
.calendar { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .4rem; }
.cal { background: var(--card); border-radius: 8px; padding: .45rem .3rem; text-align: center; border-top: 5px solid var(--tone); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.cal small, .cal .cal-date { display: block; font-size: .78rem; }
.cal strong { color: var(--tone); }
.lead { font-size: 1.1rem; }
.subline { margin: .3rem 0 .8rem; font-size: .92rem; opacity: .75; }
.intro { margin-top: 1.5rem; }
.now-box { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem 1rem; text-decoration: none; color: inherit; border-left: 8px solid var(--tone, #8796a8); margin: 1rem 0; }
.now-box-kp { font-size: 1.6rem; font-weight: 800; color: var(--tone, inherit); }
.now-box-text { flex: 1; min-width: 12rem; }
.now-box-link { color: var(--link); font-weight: 600; }
.toc { margin: 1rem 0; } .toc ol { margin: .5rem 0 0; padding-left: 1.3rem; columns: 2 14rem; } .toc li { margin: .2rem 0; }
article section { margin-top: 2rem; }
.chain { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; counter-reset: step; }
.chain li { position: relative; background: var(--card); border-radius: 10px; padding: .7rem .8rem .7rem 2.4rem; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.chain li::before { counter-increment: step; content: counter(step); position: absolute; left: .7rem; top: .7rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: #e8710a; color: #fff; font-size: .8rem; display: grid; place-items: center; }
.chain strong, .chain span { display: block; } .chain span { font-size: .85rem; opacity: .85; }
footer { background: #12355b; color: #dbe9f6; text-align: center; padding: 1.2rem; }

/* ---------- Forecast dashboard ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dash-heading { font-weight: 700; font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chip { border-radius: 999px; padding: .35rem .9rem; }
.chip[aria-pressed="true"] { background: var(--link); color: var(--card); }
#dash-range { width: 100%; accent-color: var(--link); height: 2rem; }
.dash-selected { font-weight: 600; margin: .2rem 0 .6rem; min-height: 1.5em; }
.dash-meaning { border-left: 8px solid var(--tone, #8796a8); }
.dash-meaning p { margin: .3rem 0; }
.dash-status { font-weight: 700; font-size: 1.15rem; color: var(--tone, inherit); }
.dash-prob-line { font-size: .92rem; opacity: .85; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; margin-top: .75rem; }
.dash-fig #dash-map .dash-svg { max-width: 640px; margin: 0 auto; }
.dash-fig { margin: 0; }
.dash-fig figcaption { font-weight: 600; margin-bottom: .4rem; }
.dash-svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
#dash-chart { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dash-svg.chart { min-width: 620px; }
.dash-svg .grid { stroke: rgba(128,128,128,.25); stroke-width: 1; }
.dash-svg .storm-line { stroke: #e8710a; stroke-dasharray: 5 4; stroke-width: 1.5; }
.dash-svg .axis { font-size: 12px; fill: currentColor; opacity: .75; }
.dash-svg .storm-label { fill: #e8710a; opacity: 1; }
.dash-svg .day-sep { stroke: rgba(128,128,128,.35); stroke-width: 1; }
.dash-svg .kbar { fill: var(--tone); cursor: pointer; }
.dash-svg .kbar.pred { opacity: .5; }
.dash-svg .now-line { stroke: var(--text); stroke-width: 1.5; }
.dash-svg .now-label { opacity: 1; font-weight: 700; }
.dash-svg .sel-band { fill: var(--link); opacity: .18; pointer-events: none; }
.map-sea { fill: #dbe9f6; }
.map-land { fill: #f4f1ea; stroke: #9aa8b6; stroke-width: .6; }
.map-bg { fill: #ffd27a; stroke: #b07a00; stroke-width: 1.2; }
.map-aurora { fill: rgba(46, 158, 91, .22); }
.map-viewline { fill: none; stroke: #2e9e5b; stroke-width: 2.5; stroke-dasharray: 8 4; }
.map-city { fill: #d93025; }
.map-label { font-size: 15px; font-weight: 700; fill: #1b2a3a; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
@media (prefers-color-scheme: dark) {
  .map-sea { fill: #10263d; } .map-land { fill: #2a3a4f; stroke: #5d7088; } .map-bg { fill: #8a6a1f; stroke: #ffd27a; }
  .map-label { fill: #fff; stroke: #10263d; }
}
.line-key { display: inline-block; width: 1.6rem; height: 0; border-top: 3px dashed #2e9e5b; vertical-align: middle; margin: 0 .2rem 0 0; }
.note { font-size: .82rem; opacity: .75; margin: .4rem 0 0; }
.bas-ref { border-left: 4px solid var(--link); padding: .2rem 0 .2rem .9rem; margin-top: .8rem; }
.bas-ref p { margin: .3rem 0; }
.city-summary { border-left: 8px solid #8796a8; margin-bottom: .6rem; }
.city-summary.lvl-1 { border-left-color: #d9a400; } .city-summary.lvl-2 { border-left-color: #e8710a; } .city-summary.lvl-3 { border-left-color: #2e9e5b; }
.city-verdict { font-weight: 700; font-size: 1.1rem; margin: 0 0 .25rem; }
.city-reason { margin: 0; }
.city-table td, .city-table th { white-space: nowrap; }
.city-table .city-name { font-weight: 600; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .82rem; font-weight: 600; background: rgba(135,150,168,.2); }
.badge.lvl-1 { background: rgba(217,164,0,.22); } .badge.lvl-2 { background: rgba(232,113,10,.22); } .badge.lvl-3 { background: rgba(46,158,91,.22); }

/* ---------- Phones: compact header and answer card ---------- */
.nav-toggle { display: none; }
@media (max-width: 640px) {
  .site-header { padding: .6rem 1rem; }
  .nav-toggle { display: inline-block; color: #fff; border-color: rgba(255,255,255,.55); padding: .35rem .9rem; }
  #site-nav { display: none; width: 100%; flex-direction: column; gap: 0; }
  #site-nav.open { display: flex; }
  #site-nav a { padding: .65rem 0; border-top: 1px solid rgba(255,255,255,.12); }
  h1 { font-size: 1.45rem; }
  .now { padding: .8rem 1rem; }
  .now .kp { font-size: 3rem; }
  .answer { font-size: 1.1rem; }
  section { margin-top: 1.25rem; }
}
@media (max-width: 400px) {
  .site-header { flex-wrap: nowrap; }
  .site-header.menu-open { flex-wrap: wrap; }
  .logo-name { font-size: 1.15rem; }
  .logo-tag { font-size: .8rem; }
  .nav-toggle { padding: .3rem .7rem; font-size: .95rem; flex-shrink: 0; }
}

/* ---------- Homepage: past + next 24 h bars, 7-day cards ---------- */
@media (max-width: 640px) {
}

/* ---------- Homepage: compact week strip ---------- */
.kp-week { padding: .9rem 0 .5rem; }
.week-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem 1rem; padding: 0 1.1rem .4rem; }
.week-title { font-weight: 700; }
.week-now { margin-left: auto; font-size: 1.6rem; font-weight: 800; color: var(--tone); }
.week-range { font-size: .85rem; opacity: .8; }
.week-strip { display: flex; gap: .25rem; overflow-x: auto; scroll-snap-type: x proximity; padding: .2rem 1.1rem .6rem; -webkit-overflow-scrolling: touch; }
.wday { flex: 1 0 76px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .55rem .3rem .6rem; border-radius: 12px; text-align: center; }
.wday.today { background: rgba(18, 85, 143, .1); box-shadow: inset 0 0 0 2px var(--link); }
.wd-date { font-size: .78rem; opacity: .7; }
.wd-name { font-size: .86rem; font-weight: 700; text-transform: capitalize; }
.wd-kp { font-size: 1.45rem; font-weight: 800; color: var(--tone, inherit); }
.wday.none .wd-kp { opacity: .35; }
.wday.rough .wd-kp { opacity: .85; }
.wd-ticks { display: flex; align-items: flex-end; gap: 2px; height: 22px; }
.wd-ticks i { width: 5px; background: var(--tone); border-radius: 1px; }
.wd-ticks i.pred { opacity: .5; }
.wd-rough { font-size: .7rem; opacity: .65; align-self: center; }

/* ---------- Solar flares page ---------- */
#xray-chart, #cycle-chart { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dash-svg .xband { fill: var(--tone); opacity: .1; }
.dash-svg .xline { fill: none; stroke: #e8710a; stroke-width: 1.6; }
.dash-svg .ssn-bar { fill: #d9a400; opacity: .75; }
.dash-svg .f107-line { fill: none; stroke: var(--link); stroke-width: 2; }
.dash-svg .f107-label { fill: var(--link); opacity: 1; }
.badge-cls { display: inline-block; min-width: 3rem; text-align: center; padding: .1rem .5rem; border-radius: 999px; font-weight: 700; background: color-mix(in srgb, var(--tone) 22%, transparent); }
.wind { border-left: 8px solid #2e9e5b; }
.wind.lvl-1 { border-left-color: #d9a400; } .wind.lvl-2 { border-left-color: #e8710a; }
.wind-status { font-weight: 700; margin: 0 0 .6rem; }
.wind-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: .5rem; text-align: center; }
.wind-cell { display: flex; flex-direction: column; }
.wind-label { font-size: .85rem; opacity: .75; }
.wind-value { font-size: 1.6rem; font-weight: 800; }
.wind-unit { font-size: .75rem; opacity: .7; }
.sun-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.sun-img { margin: 0; padding: .5rem; text-align: center; }
.sun-img img { width: 100%; height: auto; border-radius: 8px; display: block; background: #000; }
.sun-img figcaption { font-size: .82rem; margin-top: .35rem; }
@media (max-width: 400px) { .sun-pair { grid-template-columns: 1fr; } }

/* ---------- Homepage: last 24 h and next 24 h as two charts ---------- */
.hours-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: .75rem; }
.hours-pair h3 { margin: 0 0 .5rem; font-size: 1rem; }
.hours-pair .bars { min-height: 190px; gap: .2rem; overflow-x: auto; }
.hours-pair .bar-col { min-width: 30px; }
.forecast-bars .bar { opacity: .55; }

/* ---------- Alert bar (homepage, forecast) and warnings page ---------- */
.alert-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .8rem; margin: 0 0 1rem; padding: .75rem 1rem; border-radius: 12px;
  background: var(--tone); color: #fff; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.alert-bar.active { color: #1d1d1d; }
.alert-bar[hidden] { display: none; }
.alert-kind { text-transform: uppercase; font-size: .85rem; letter-spacing: .03em; }
.alert-title { font-weight: 700; flex: 1 1 14rem; }
.alert-meta { font-size: .85rem; opacity: .9; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .75rem; }
.chip { border: 1px solid var(--link); background: transparent; color: var(--link); border-radius: 999px; padding: .35rem .85rem; font: inherit; cursor: pointer; }
.chip.on { background: var(--link); color: #fff; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-item { border-left: 5px solid var(--tone); padding: .2rem 0 .2rem .8rem; margin: 0 0 .9rem; }
.alert-item p { margin: .2rem 0; }
.alert-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.alert-badge { font-size: .75rem; font-weight: 700; text-transform: uppercase; padding: .1rem .5rem; border-radius: 6px; background: rgba(128,128,128,.15); }
.alert-badge.alert { background: var(--tone); color: #fff; }

/* ---------- Aurora page ---------- */
.oval { max-width: 600px; margin: 0 auto; }
.oval img { width: 100%; height: auto; border-radius: 10px; background: #0b1020; }

/* ---------- Footer links ---------- */
footer a { color: inherit; }
footer p + p { margin-top: .3rem; }

/* ---------- Short answers (answer-first for readers and AI search) ---------- */
.short-answer { border-left: 4px solid var(--link); background: rgba(18, 85, 143, .06); padding: .55rem .8rem; border-radius: 0 8px 8px 0; }

/* ---------- Aurora: "your town" picker ---------- */
.place-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin: .6rem 0; }
.place-pick label { font-weight: 700; }
.place-pick select { font: inherit; padding: .35rem .5rem; border-radius: 8px; max-width: 100%; }
.place-pick #place-result, .place-pick .note { flex-basis: 100%; }
.place-result { border-left: 6px solid #8796a8; padding-left: .7rem; }
.place-result.lvl-1 { border-left-color: #d9a400; } .place-result.lvl-2 { border-left-color: #e8710a; } .place-result.lvl-3 { border-left-color: #2e9e5b; }
.place-result p { margin: .2rem 0; }
