:root {
  --bg: #04060c;
  --card: rgba(22, 26, 38, 0.62);
  --card-hi: rgba(40, 46, 64, 0.55);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-hi: rgba(255, 255, 255, 0.16);
  --label: #ffffff;
  --secondary: rgba(235, 235, 245, 0.62);
  --tertiary: rgba(235, 235, 245, 0.45);
  --propagation: #409cff;
  --geomagnetic: #c77dff;
  --solar: #ffb340;
  --space: #70d7ff;
  --good: #66bb6a;
  --fair: #ffb74d;
  --poor: #ef5350;
  --gold: #d4a843;
  --radius: 22px;
  --gap: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Living sky background ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(120% 80% at 50% -10%, #0d1a3a 0%, #070b18 45%, #04060c 75%); }
.aurora { position: absolute; width: 90vmax; height: 90vmax; border-radius: 50%; filter: blur(90px); opacity: .42; mix-blend-mode: screen; }
.a1 { background: radial-gradient(circle, #1d6bff 0%, transparent 62%); top: -45vmax; left: -20vmax; animation: drift1 38s ease-in-out infinite alternate; }
.a2 { background: radial-gradient(circle, #15c39a 0%, transparent 60%); top: -40vmax; right: -30vmax; opacity: .26; animation: drift2 46s ease-in-out infinite alternate; }
.stars { position: absolute; inset: -50%; background-image:
  radial-gradient(1px 1px at 20px 30px, rgba(255,255,255,.55), transparent 60%),
  radial-gradient(1px 1px at 140px 80px, rgba(255,255,255,.35), transparent 60%),
  radial-gradient(1.4px 1.4px at 260px 160px, rgba(190,220,255,.6), transparent 60%),
  radial-gradient(1px 1px at 330px 40px, rgba(255,255,255,.3), transparent 60%),
  radial-gradient(1px 1px at 90px 230px, rgba(255,255,255,.4), transparent 60%);
  background-size: 380px 280px; opacity: .55; animation: twinkle 120s linear infinite; }
@keyframes drift1 { to { transform: translate(18vmax, 10vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-16vmax, 14vmax) scale(.9); } }
@keyframes twinkle { to { transform: translate(-380px, -280px); } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(to bottom, rgba(4,6,12,.86), rgba(4,6,12,.55));
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid var(--stroke);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand img { border-radius: 9px; box-shadow: 0 0 0 1px var(--stroke-hi), 0 6px 24px rgba(64,156,255,.35); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -.02em;
  background: linear-gradient(90deg, #fff, #9fd2ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--tertiary); font-weight: 600; }
.loc-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: var(--card-hi); border: 1px solid var(--stroke-hi); font-weight: 600; font-size: 14px; transition: transform .2s, background .2s; }
.loc-chip:hover { background: rgba(64,156,255,.22); }
.loc-chip:active { transform: scale(.97); }
.loc-chip svg { color: var(--propagation); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--secondary); font-variant-numeric: tabular-nums; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tertiary); }
.status.live .dot { background: var(--good); box-shadow: 0 0 10px var(--good); animation: pulse 2.4s ease-in-out infinite; }
.status.stale .dot { background: var(--fair); }
.status.err .dot { background: var(--poor); }
@keyframes pulse { 50% { opacity: .45; } }

.banner[hidden], .chart-tip[hidden] { display: none !important; }
.banner { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 12px auto 0; width: fit-content; max-width: calc(100% - 32px);
  padding: 8px 14px; border-radius: 12px; background: rgba(255,179,64,.14); border: 1px solid rgba(255,179,64,.35); color: #ffd59a; font-size: 13px; }

/* ---------- Layout ---------- */
.grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap);
  width: 100%; max-width: 1360px; margin: 0 auto; padding: 22px clamp(16px, 4vw, 40px) 8px;
}
.hero { grid-column: span 5; }
.bands { grid-column: span 7; }
.metrics { grid-column: span 12; }
.forecast { grid-column: span 7; }
.outlook { grid-column: span 5; }
.map { grid-column: span 12; }

@media (max-width: 1080px) {
  .hero, .bands { grid-column: span 6; }
  .forecast, .outlook { grid-column: span 12; }
}
@media (max-width: 760px) {
  :root { --gap: 14px; --radius: 20px; }
  .grid > * { grid-column: span 12 !important; }
  .brand-sub, .status #statusText { display: none; }
  .topbar { gap: 10px; }
}

/* ---------- Cards ---------- */
.card {
  position: relative; min-width: 0;
  background: linear-gradient(160deg, rgba(255,255,255,.055), rgba(255,255,255,.012) 40%), var(--card);
  border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: clamp(16px, 2.2vw, 24px);
  backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 20px 60px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(14px);
  animation: rise .7s cubic-bezier(.2,.8,.2,1) forwards;
}
.card:nth-child(2) { animation-delay: .06s; } .card:nth-child(3) { animation-delay: .12s; }
.card:nth-child(4) { animation-delay: .18s; } .card:nth-child(5) { animation-delay: .24s; } .card:nth-child(6) { animation-delay: .3s; }
@keyframes rise { to { opacity: 1; transform: none; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--secondary); }
.tag { font-size: 12px; font-weight: 650; padding: 4px 10px; border-radius: 999px; background: var(--card-hi); border: 1px solid var(--stroke-hi); color: var(--label); font-variant-numeric: tabular-nums; }
.tag.subtle { background: transparent; color: var(--tertiary); border-color: var(--stroke); }
.fine { margin: 12px 0 0; font-size: 12px; color: var(--tertiary); }

/* ---------- Hero dial ---------- */
.hero { display: flex; flex-direction: column;
  background: radial-gradient(90% 70% at 50% 40%, rgba(64,156,255,.16), transparent 70%), linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.01) 40%), var(--card); }
.dial-wrap { position: relative; width: min(100%, 320px); aspect-ratio: 1; margin: auto auto 0; }
.hero .subline { margin-bottom: auto; }
.dial { width: 100%; height: 100%; overflow: visible; }
.dial-track { fill: none; stroke: rgba(255,255,255,.07); stroke-width: 16; stroke-linecap: round; }
.dial-arc { fill: none; stroke-width: 16; stroke-linecap: round; transition: stroke-dashoffset 1.4s cubic-bezier(.2,.8,.2,1); }
.dial-needle { fill: #fff; filter: drop-shadow(0 0 8px rgba(255,255,255,.9)); transition: cx 1.4s cubic-bezier(.2,.8,.2,1), cy 1.4s cubic-bezier(.2,.8,.2,1); }
.dial-tick { stroke: rgba(255,255,255,.22); stroke-width: 2; }
.dial-tick-label { fill: var(--tertiary); font-size: 11px; font-weight: 600; text-anchor: middle; dominant-baseline: middle; font-family: var(--font); }
.dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.muf { display: flex; align-items: baseline; gap: 6px; }
#mufValue { font-size: clamp(56px, 9vw, 78px); font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff 30%, #a9d4ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.unit { font-size: 18px; font-weight: 700; color: var(--secondary); }
.muf-sub { margin-top: 4px; font-size: 13px; color: var(--tertiary); font-weight: 600; }
.headline { margin: 8px 0 4px; font-size: clamp(20px, 2.2vw, 24px); font-weight: 750; letter-spacing: -.02em; text-align: center; }
.subline { margin: 0; text-align: center; color: var(--secondary); font-size: 14px; }

/* ---------- Bands ---------- */
.legend-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tertiary); }
.lg { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; }
.lg.open { background: var(--good); } .lg.marginal { background: var(--fair); } .lg.closed { background: rgba(255,255,255,.18); }
.band-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.band { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; padding: 7px 10px 7px 12px; border-radius: 14px;
  background: rgba(255,255,255,.03); border: 1px solid transparent; transition: background .25s, border-color .25s; }
.band:hover { background: rgba(255,255,255,.06); border-color: var(--stroke); }
.band-name { font-weight: 750; font-size: 16px; font-variant-numeric: tabular-nums; }
.band-freq { display: block; font-size: 11px; color: var(--tertiary); font-weight: 600; }
.band-bar { position: relative; height: 10px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.band-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.band.open .band-fill { background: linear-gradient(90deg, #2e9d5a, #7dffb2); box-shadow: 0 0 16px rgba(125,255,178,.45); }
.band.marginal .band-fill { background: linear-gradient(90deg, #b9742a, #ffd27a); box-shadow: 0 0 14px rgba(255,210,122,.35); }
.band.closed .band-fill { background: rgba(255,255,255,.14); }
.band-state { justify-self: end; white-space: nowrap; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.band.open .band-state { color: #9dffc4; background: rgba(102,187,106,.16); }
.band.marginal .band-state { color: #ffd59a; background: rgba(255,183,77,.15); }
.band.closed .band-state { color: var(--tertiary); background: rgba(255,255,255,.05); }
.band.best { border-color: rgba(125,255,178,.35); background: rgba(102,187,106,.08); }

/* ---------- Metrics ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1080px) { .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 520px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.metric { position: relative; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.035); border: 1px solid var(--stroke); overflow: hidden; }
.metric::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--accent, var(--propagation)); opacity: .9; }
.metric-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tertiary); }
.metric-value { margin-top: 6px; font-size: 28px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.metric-value small { font-size: 13px; font-weight: 650; color: var(--secondary); margin-left: 3px; letter-spacing: 0; }
.metric-note { margin-top: 4px; font-size: 12.5px; font-weight: 650; color: var(--note, var(--secondary)); }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; width: 100%; height: clamp(220px, 28vw, 300px); }
.chart-wrap canvas, .map-wrap canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; }
.chart-tip { position: absolute; pointer-events: none; padding: 7px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 650;
  background: rgba(12,16,26,.92); border: 1px solid var(--stroke-hi); white-space: nowrap; transform: translate(-50%, -115%); font-variant-numeric: tabular-nums; }
.map-wrap { position: relative; width: 100%; aspect-ratio: 2 / 1; border-radius: 14px; overflow: hidden; background: #050913; }
.scale { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--tertiary); font-weight: 600; }
.scale-bar { flex: 1; max-width: 360px; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, #1b2a8c, #1e6bff, #22c3ff, #39e58c, #f2e44a, #ff9a2f, #ff4040); }

/* ---------- Outlook ---------- */
.outlook-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.outlook-table th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--tertiary); font-weight: 700; padding: 0 12px; }
.outlook-table td { padding: 12px; background: rgba(255,255,255,.035); font-weight: 650; font-variant-numeric: tabular-nums; }
.outlook-table td:first-child { border-radius: 12px 0 0 12px; font-weight: 750; }
.outlook-table td:last-child { border-radius: 0 12px 12px 0; }
.rating { display: inline-flex; align-items: center; gap: 7px; }
.rating::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.rating.Good { color: var(--good); } .rating.Fair { color: var(--fair); } .rating.Poor { color: var(--poor); }

/* ---------- Footer ---------- */
.foot { max-width: 1360px; margin: 0 auto; padding: 18px clamp(16px, 4vw, 40px) 40px; color: var(--tertiary); font-size: 12.5px; }
.foot p { margin: 4px 0; }
.foot a { color: var(--space); text-decoration: none; font-weight: 650; }
.foot a:hover { text-decoration: underline; }

/* ---------- Location sheet ---------- */
.sheet { border: 1px solid var(--stroke-hi); border-radius: 24px; padding: 0; width: min(440px, calc(100% - 28px)); color: var(--label);
  background: rgba(18,22,34,.96); box-shadow: 0 30px 90px rgba(0,0,0,.7); }
.sheet::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet[open] { animation: sheetIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.sheet-body { padding: 24px; display: grid; gap: 12px; }
.sheet h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.sheet .fine { margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 14px; border: 1px solid var(--stroke-hi);
  background: var(--card-hi); font-weight: 700; cursor: pointer; transition: transform .15s, filter .2s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, #2f7dff, #1fb6ff); border-color: transparent; color: #fff; box-shadow: 0 8px 28px rgba(47,125,255,.4); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.or { display: flex; align-items: center; gap: 10px; color: var(--tertiary); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--stroke-hi); }
.field input { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--stroke-hi); background: rgba(118,118,128,.18);
  font-size: 18px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-family: var(--mono); outline: none; }
.field input:focus { border-color: var(--propagation); box-shadow: 0 0 0 3px rgba(64,156,255,.25); }
.err { margin: 0; min-height: 1em; color: #ff8a80; font-size: 13px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; }

:focus-visible { outline: 2px solid var(--propagation); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card { opacity: 1; transform: none; }
}
