:root {
  color-scheme: dark;
  --ink: #f7fbff;
  --muted: #99a9bd;
  --page: #08111f;
  --panel: #101d2e;
  --panel-2: #13233a;
  --line: rgba(255, 255, 255, 0.11);
  --cyan: #45dcff;
  --low: #63e283;
  --moderate: #ffd449;
  --high: #ff9c45;
  --very-high: #ff5364;
  --extreme: #c993ff;
  --radius: 28px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--page); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -10%, rgba(69, 220, 255, 0.16), transparent 30rem),
    radial-gradient(circle at 88% 16%, rgba(255, 212, 73, 0.12), transparent 28rem),
    var(--page);
}

button, input, select { font: inherit; }

button, select, input { outline-offset: 3px; }

a { color: inherit; }

.masthead {
  min-height: 78px;
  padding: 18px clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.brand strong { color: var(--cyan); }

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.brand-mark span {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--moderate);
  box-shadow: 0 0 24px rgba(255, 212, 73, 0.78);
}

.live-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--low);
  box-shadow: 0 0 0 5px rgba(99, 226, 131, 0.1);
}

main {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(42px, 6vw, 86px) 0 70px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 32px;
  align-items: end;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(36px, 5vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 3vw, 44px);
  letter-spacing: -0.045em;
}

.controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.controls label { display: grid; gap: 7px; }

.controls label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

select, input, .button {
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 13px;
}

select, input {
  min-width: 185px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
}

input { color-scheme: dark; }

.button {
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

.button-secondary { color: var(--ink); background: var(--panel); }
.button-primary { color: #05111e; background: var(--cyan); border-color: var(--cyan); }

.status-message { min-height: 0; margin-bottom: 0; }

.status-message.visible {
  min-height: 48px;
  margin: -12px 0 22px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 83, 100, 0.3);
  border-radius: 13px;
  color: #ffd7dc;
  background: rgba(255, 83, 100, 0.09);
}

.overview {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.current-card, .peak-card, .forecast-panel, .source-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 29, 46, 0.9);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.current-card, .peak-card { min-height: 400px; padding: clamp(26px, 4vw, 50px); }

.current-card::after {
  content: "";
  position: absolute;
  inset: auto -12% -65% 32%;
  height: 140%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 212, 73, 0.2), transparent 63%);
  pointer-events: none;
}

.current-card { --category-color: var(--moderate); }
.current-card.category-low { --category-color: var(--low); }
.current-card.category-moderate { --category-color: var(--moderate); }
.current-card.category-high { --category-color: var(--high); }
.current-card.category-very-high { --category-color: var(--very-high); }
.current-card.category-extreme { --category-color: var(--extreme); }
.current-card.category-unknown { --category-color: var(--muted); }

.card-topline {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.category-pill {
  padding: 7px 11px;
  border-radius: 999px;
  color: #171204;
  background: var(--category-color);
}

.current-reading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  gap: 24px;
  margin: 36px 0 30px;
}

.current-reading > strong {
  font-size: clamp(118px, 18vw, 232px);
  font-weight: 800;
  line-height: 0.72;
  letter-spacing: -0.09em;
}

.current-reading div { display: grid; gap: 8px; padding-bottom: 5px; }
.current-reading div > span { font-size: 12px; font-weight: 900; letter-spacing: 0.16em; }
.current-reading small { color: var(--muted); font-size: 13px; }
.current-reading small b { color: var(--ink); }

.meter {
  position: relative;
  z-index: 1;
  height: 9px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--low) 0 18%, var(--moderate) 18% 38%, var(--high) 38% 54%, var(--very-high) 54% 76%, var(--extreme) 76%);
}

.meter span {
  position: absolute;
  left: var(--meter-position, 25%);
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border: 3px solid var(--page);
  border-radius: 50%;
  background: white;
}

.protection-copy {
  position: relative;
  z-index: 1;
  margin: 20px 0 0;
  color: #d8e1ed;
  font-size: clamp(15px, 1.5vw, 18px);
}

.peak-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(145deg, rgba(25, 41, 62, 0.96), rgba(11, 22, 37, 0.96));
}

.peak-reading { display: flex; align-items: end; gap: 20px; }
.peak-reading strong { font-size: clamp(86px, 10vw, 140px); line-height: 0.75; letter-spacing: -0.08em; }
.peak-reading div { display: grid; gap: 7px; }
.peak-reading span { font-size: 13px; font-weight: 900; letter-spacing: 0.14em; }
.peak-reading small { color: var(--moderate); font-size: 16px; }

.protection-window {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.protection-window strong { color: var(--ink); }

.forecast-panel { padding: clamp(26px, 4vw, 50px); }

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
  margin-bottom: 42px;
}

.legend { display: flex; flex-wrap: wrap; justify-content: end; gap: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.legend span::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.legend .low { color: var(--low); }
.legend .moderate { color: var(--moderate); }
.legend .high { color: var(--high); }
.legend .very-high { color: var(--very-high); }
.legend .extreme { color: var(--extreme); }

.chart-wrap {
  position: relative;
  min-height: 220px;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0 54px, rgba(255,255,255,.06) 55px);
}

.forecast-chart {
  display: block;
  width: 100%;
  height: 240px;
  overflow: visible;
}

.forecast-chart .grid-line { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.forecast-chart .grid-label { fill: var(--muted); font-size: 18px; }
.forecast-chart .area { fill: url(#uv-area); }
.forecast-chart .line { fill: none; stroke: var(--cyan); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.forecast-chart .point { fill: var(--page); stroke: var(--cyan); stroke-width: 4; }

.chart-placeholder {
  position: absolute;
  inset: 0 0 -1px;
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  align-items: end;
  gap: clamp(5px, 1vw, 14px);
}

.chart-placeholder span {
  min-height: 3px;
  border-radius: 8px 8px 1px 1px;
  background: linear-gradient(to top, rgba(69, 220, 255, 0.18), var(--cyan));
  box-shadow: 0 0 25px rgba(69, 220, 255, 0.1);
}

.hourly-grid {
  display: grid;
  grid-template-columns: repeat(14, minmax(68px, 1fr));
  overflow-x: auto;
  scrollbar-color: var(--line) transparent;
}

.hourly-grid > div {
  min-width: 72px;
  padding: 24px 10px 8px;
  display: grid;
  gap: 8px;
  text-align: center;
}

.hourly-grid time { color: var(--muted); font-size: 11px; }
.hourly-grid strong { font-size: 21px; }
.hourly-grid .active { border-radius: 0 0 12px 12px; background: rgba(69, 220, 255, 0.09); }
.hourly-grid .active strong { color: var(--cyan); }
.hourly-grid [data-category="low"] strong { color: var(--low); }
.hourly-grid [data-category="moderate"] strong { color: var(--moderate); }
.hourly-grid [data-category="high"] strong { color: var(--high); }
.hourly-grid [data-category="very-high"] strong { color: var(--very-high); }
.hourly-grid [data-category="extreme"] strong { color: var(--extreme); }

.source-panel {
  margin-top: 18px;
  padding: 32px clamp(26px, 4vw, 50px);
  display: grid;
  grid-template-columns: 0.7fr 1.3fr auto;
  gap: 34px;
  align-items: center;
}

.source-panel h2 { font-size: clamp(25px, 3vw, 36px); }
.source-panel > p { margin: 0; color: var(--muted); line-height: 1.6; }
.source-panel > a { color: var(--cyan); font-weight: 800; text-decoration: none; white-space: nowrap; }

footer {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 34px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

body.loading main { cursor: progress; }
body.loading .overview, body.loading .forecast-panel { opacity: 0.68; }

body.embed .masthead, body.embed .source-panel, body.embed footer { display: none; }
body.embed main { width: min(100% - 24px, 1440px); padding-block: 18px; }
body.embed .toolbar-heading .eyebrow { display: none; }
body.embed .toolbar { margin-bottom: 18px; }
body.embed h1 { font-size: clamp(30px, 4vw, 52px); }

@media (max-width: 980px) {
  .toolbar, .overview, .source-panel { grid-template-columns: 1fr; }
  .controls { margin-top: 4px; }
  .source-panel { gap: 20px; }
}

@media (max-width: 680px) {
  .masthead { padding-inline: 20px; }
  .live-status span:last-child { display: none; }
  main { width: min(100% - 24px, 1440px); padding-top: 40px; }
  h1 { font-size: 42px; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .controls label { grid-column: span 2; }
  .controls select, .controls input { width: 100%; }
  .current-card, .peak-card { min-height: 340px; }
  .current-reading { align-items: start; flex-direction: column; }
  .current-reading > strong { font-size: 128px; }
  .section-heading { align-items: start; flex-direction: column; }
  .legend { justify-content: start; }
  .forecast-panel { padding-inline: 20px; }
  .source-panel { padding: 28px 24px; }
  footer { width: calc(100% - 24px); flex-direction: column; gap: 10px; }
}

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