:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07111f;
  color: #edf4ff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --surface: #0e1b2c;
  --surface-raised: #132339;
  --border: #20344c;
  --muted: #9aacc2;
  --accent: #9bd8ff;
  --mint: #72e0c1;
  --warning: #ffd47c;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 75% -20%, rgb(35 85 121 / 22%), transparent 48rem),
    #07111f;
  color: #edf4ff;
}

button, input { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }

.dashboard { width: min(1120px, 100% - 32px); margin: 0 auto; padding: 18px 0 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-bottom: 20px; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: #edf4ff; font-weight: 700; text-decoration: none; letter-spacing: -.025em; }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; color: #081522; background: var(--mint); border-radius: 10px; }
.brand-light { color: var(--muted); font-weight: 500; }
.live-status { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: .78rem; }
.live-dot { width: 8px; height: 8px; background: var(--mint); border-radius: 50%; box-shadow: 0 0 12px rgb(114 224 193 / 65%); }

.panel { min-width: 0; padding: 22px; background: linear-gradient(145deg, rgb(18 35 55 / 96%), rgb(12 25 41 / 96%)); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 12px 35px rgb(0 0 0 / 12%); }
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(250px, .75fr); gap: 34px; padding: clamp(22px, 4vw, 38px); background: radial-gradient(ellipse at 12% 0%, rgb(60 137 167 / 20%), transparent 60%), linear-gradient(140deg, #10243a, #0d1b2c 70%); }
.eyebrow { margin: 0 0 8px; color: #8bc7e6; font-size: .68rem; font-weight: 750; letter-spacing: .13em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(1.55rem, 3vw, 2rem); letter-spacing: -.04em; }
h2 { margin: 0; font-size: 1.05rem; letter-spacing: -.02em; }
.muted, .chance-location { color: var(--muted); }
.chance-location { margin-bottom: 20px; font-size: .9rem; }
.chance-reading { display: flex; align-items: baseline; gap: 12px; margin: 2px 0 16px; }
.chance-value { color: var(--mint); font-size: clamp(4rem, 11vw, 6.5rem); font-weight: 750; line-height: .95; letter-spacing: -.08em; }
.chance-label { padding: 6px 11px; color: #c8f7e9; background: rgb(114 224 193 / 12%); border: 1px solid rgb(114 224 193 / 25%); border-radius: 999px; font-size: .82rem; font-weight: 650; text-transform: capitalize; }
.reason-list { display: grid; gap: 7px; margin: 0; padding-left: 18px; color: #c3d0df; font-size: .85rem; line-height: 1.5; }
.reason-list li::marker { color: var(--mint); }
.location-card { padding: 18px; background: rgb(5 15 27 / 42%); border: 1px solid rgb(125 160 194 / 19%); border-radius: 14px; }
.location-card h2 { margin-bottom: 9px; }
#location-display { min-height: 2.8em; margin-bottom: 13px; color: #c3d0df; font-size: .84rem; line-height: 1.5; }
.button { min-height: 42px; padding: 9px 13px; color: #eaf5ff; background: #1b3853; border: 1px solid #31516d; border-radius: 10px; cursor: pointer; font-size: .82rem; font-weight: 650; }
.button:hover { background: #244664; }
.button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.location-card > .button { width: 100%; }
details { margin-top: 13px; border-top: 1px solid rgb(125 160 194 / 16%); }
summary { padding: 13px 0 2px; color: var(--accent); cursor: pointer; font-size: .82rem; }
.location-form { display: grid; gap: 8px; padding-top: 12px; }
.location-form label { color: #c3d0df; font-size: .76rem; }
.location-form input { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; color: #edf4ff; background: #091626; border: 1px solid #2a4059; border-radius: 8px; }
.location-form input::placeholder { color: #71859c; }
.coordinate-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.coordinate-fields > div { display: grid; gap: 6px; }
.form-message { margin: 9px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.45; }

.conditions-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.metric-value { color: #f2f7ff; font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kp-gauge { height: 11px; overflow: hidden; background: linear-gradient(90deg, #3cbf99 0 22%, #a9cb62 22% 44%, #f0bf5f 44% 67%, #e78363 67% 84%, #cc668b 84%); border-radius: 999px; }
.kp-gauge span { display: block; width: 0; height: 100%; background: rgb(5 14 25 / 48%); border-right: 2px solid #fff; transition: width .4s ease; }
.gauge-labels { display: flex; justify-content: space-between; margin-top: 6px; color: #8296ad; font-size: .68rem; }
.kp-panel .muted { margin: 13px 0 0; font-size: .78rem; }
.forecast-bars { display: flex; align-items: end; gap: 12px; min-height: 94px; }
.forecast-day { display: grid; flex: 1; justify-items: center; gap: 7px; min-width: 0; }
.forecast-day strong { color: #dce8f6; font-size: .78rem; font-variant-numeric: tabular-nums; }
.forecast-column { display: flex; align-items: end; width: min(36px, 70%); height: 54px; overflow: hidden; background: #091626; border-radius: 7px 7px 3px 3px; }
.forecast-column span { display: block; width: 100%; min-height: 3px; background: linear-gradient(0deg, #54bea5, #9bd8ff); border-radius: 7px 7px 0 0; }
.forecast-day small { overflow: hidden; max-width: 100%; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.forecast-bars > .muted { align-self: center; font-size: .8rem; }
.solar-icon { color: #ffd47c; font-size: 1.5rem; }
.solar-readings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.solar-readings > div { display: grid; gap: 4px; }
.solar-readings .muted { font-size: .76rem; }
.solar-readings strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.solar-readings small { color: #8296ad; font-size: .68rem; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 14px; margin-top: 14px; }
.map-badge, .count-badge { padding: 5px 8px; color: #b7c8da; background: #1a2c41; border-radius: 999px; font-size: .68rem; white-space: nowrap; }
.aurora-map { display: block; width: 100%; min-height: 180px; max-height: 350px; object-fit: contain; background: #081321; border: 1px solid #1b2c40; border-radius: 11px; }
.map-caption { margin: 10px 0 0; color: #8195ac; font-size: .7rem; }
.alerts-panel .section-heading { margin-bottom: 10px; }
.item-list, .events-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.alert-item, .event-item { padding: 12px; background: rgb(5 15 27 / 38%); border: 1px solid rgb(125 160 194 / 14%); border-radius: 10px; }
.alert-item { border-left: 3px solid var(--warning); }
.alert-item p, .event-item p { margin: 5px 0 0; color: #c3d0df; font-size: .78rem; line-height: 1.5; overflow-wrap: anywhere; }
.alert-item time, .event-item time { color: #8296ad; font-size: .69rem; }
.item-title { color: #f0f5fc; font-size: .8rem; font-weight: 650; }
.empty-state { padding: 14px 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.events-panel { margin-top: 14px; }
.events-panel .section-heading { margin-bottom: 13px; }
.event-range { font-size: .72rem; white-space: nowrap; }
.events-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.event-type { display: inline-block; margin-right: 6px; padding: 3px 6px; color: #a9dcff; background: rgb(94 174 224 / 12%); border-radius: 5px; font-size: .63rem; font-weight: 750; letter-spacing: .04em; }
.event-item a { color: var(--accent); font-size: .72rem; text-decoration: none; }
.event-item a:hover { text-decoration: underline; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 18px 4px 0; color: #71859c; font-size: .68rem; }
.stale-banner { margin-bottom: 12px; padding: 11px 14px; color: #ffe3a3; background: rgb(140 100 30 / 19%); border: 1px solid rgb(210 158 65 / 34%); border-radius: 10px; font-size: .8rem; line-height: 1.45; }
.stale-banner[hidden] { display: none; }
.dashboard-status { min-height: 0; margin: 0; color: var(--muted); font-size: .75rem; }
.dashboard-status:not(:empty) { padding: 0 2px 10px; }

@media (max-width: 760px) {
  .dashboard { width: min(100% - 24px, 560px); padding-top: 12px; }
  .topbar { margin-bottom: 13px; }
  .hero { grid-template-columns: 1fr; gap: 22px; }
  .conditions-grid { grid-template-columns: 1fr 1fr; }
  .solar-panel { grid-column: 1 / -1; }
  .content-grid { grid-template-columns: 1fr; }
  .events-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 440px) {
  .dashboard { width: calc(100% - 20px); }
  .panel { padding: 17px; border-radius: 15px; }
  .hero { padding: 20px; }
  .conditions-grid { gap: 10px; }
  .conditions-grid > .panel { padding: 15px; }
  .forecast-bars { gap: 7px; }
  .events-list { grid-template-columns: 1fr; }
  .event-range { max-width: 112px; text-align: right; white-space: normal; }
  .footer { flex-direction: column; gap: 5px; }
  .live-status { font-size: .68rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
