:root {
  color-scheme: dark;
  --bg: #17243e;
  --panel: rgba(20, 29, 50, 0.54);
  --panel-strong: rgba(17, 25, 43, 0.72);
  --panel-soft: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.1);
  --text: #fffaf2;
  --muted: rgba(255, 250, 242, 0.72);
  --subtle: rgba(255, 250, 242, 0.54);
  --accent: #9de3ff;
  --accent-strong: #ffd166;
  --danger: #ff8066;
  --radius: 8px;
  --label-width: 144px;
  --cell-width: 76px;
  --cell-height: 48px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 224, 151, 0.2) 0%, rgba(255, 224, 151, 0) 18rem),
    linear-gradient(160deg, #6c7aa8 0%, #2f6685 28%, #213455 54%, #2c2445 76%, #32212a 100%);
  background-attachment: fixed;
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 28%, rgba(157, 227, 255, 0.08) 74%, transparent),
    linear-gradient(180deg, transparent 0%, rgba(4, 8, 16, 0.34) 62%, rgba(4, 8, 16, 0.58) 100%);
  pointer-events: none;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1460px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: none;
}

.eyebrow a {
  color: var(--text);
  text-decoration-color: rgba(255, 250, 242, 0.42);
  text-underline-offset: 3px;
}

.eyebrow a:hover {
  text-decoration-color: var(--text);
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.8rem, 3vw, 3.4rem);
  line-height: 0.98;
  letter-spacing: 0;
  text-shadow: 0 3px 24px rgba(0, 0, 0, 0.18);
}

h2 {
  margin-bottom: 0;
  font-size: 0.82rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.forecast-heading h2 {
  text-transform: none;
}

main {
  display: grid;
  gap: 14px;
}

main > * {
  min-width: 0;
}

.source-line,
.section-heading p {
  color: var(--muted);
}

.source-line {
  margin-bottom: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-button,
.source-link,
.segment {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  backdrop-filter: blur(18px);
}

.icon-button,
.source-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  text-decoration: none;
}

.icon-button {
  cursor: pointer;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button:hover,
.source-link:hover,
.segment:hover {
  background: rgba(255, 255, 255, 0.16);
}

.icon-button:focus-visible,
.source-link:focus-visible,
.segment:focus-visible,
.cell-link:focus-visible,
.hour-card:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.weather-hero {
  --clear-hero-fit: 1;
  --clear-radar-size: calc(260px * var(--clear-hero-fit));
  --clear-radar-score-size: calc(2.15rem * var(--clear-hero-fit));
  --clear-caption-size: calc(0.86rem * var(--clear-hero-fit));
  --clear-plot-width: calc(300px * var(--clear-hero-fit));
  --clear-plot-height: calc(84px * var(--clear-hero-fit));
  --clear-plot-axis-width: calc(28px * var(--clear-hero-fit));
  --clear-plot-gap: calc(6px * var(--clear-hero-fit));
  --clear-section-gap: calc(8px * var(--clear-hero-fit));
  --clear-card-gap: calc(10px * var(--clear-hero-fit));
  --clear-card-padding: calc(10px * var(--clear-hero-fit));
  --clear-score-label-size: calc(0.86rem * var(--clear-hero-fit));
  --clear-score-value-size: calc(1.35rem * var(--clear-hero-fit));
  --clear-score-time-size: calc(0.74rem * var(--clear-hero-fit));
  --clear-score-axis-size: calc(0.64rem * var(--clear-hero-fit));
  --clear-heading-size: calc(0.76rem * var(--clear-hero-fit));
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: var(--clear-section-gap);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: max(3px, calc(18px * var(--clear-hero-fit)));
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05)),
    linear-gradient(160deg, rgba(75, 151, 189, 0.52), rgba(49, 58, 112, 0.4) 48%, rgba(30, 20, 50, 0.62));
  box-shadow: 0 24px 64px rgba(4, 8, 20, 0.22);
  overflow: hidden;
  backdrop-filter: blur(24px);
}

.weather-hero[data-quality="good"] {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.06)),
    linear-gradient(160deg, rgba(52, 150, 134, 0.72), rgba(54, 91, 149, 0.48) 54%, rgba(35, 29, 70, 0.58));
}

.weather-hero[data-quality="mixed"] {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.05)),
    linear-gradient(160deg, rgba(194, 137, 54, 0.62), rgba(67, 99, 147, 0.52) 52%, rgba(44, 32, 74, 0.6));
}

.weather-hero[data-quality="poor"] {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05)),
    linear-gradient(160deg, rgba(134, 61, 60, 0.72), rgba(72, 72, 116, 0.5) 52%, rgba(38, 29, 55, 0.68));
}

.hero-score {
  grid-column: 1 / -1;
  align-self: center;
  display: grid;
  justify-items: center;
  justify-self: center;
  min-width: 190px;
  text-align: center;
}

.score-number {
  margin-bottom: 0;
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 680;
  line-height: 0.88;
  letter-spacing: 0;
}

.score-label {
  margin-bottom: 0;
  color: rgba(255, 250, 242, 0.76);
  font-size: 0.86rem;
  font-weight: 720;
  text-transform: uppercase;
}

.hero-radar {
  display: grid;
  place-items: center;
  width: 188px;
  height: 188px;
  border-radius: 50%;
  cursor: help;
}

.hero-radar-chart {
  display: block;
  width: 188px;
  height: 188px;
  overflow: visible;
}

.hero-radar:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 4px;
}

.hero-radar.is-radar-active .hero-radar-chart {
  filter: drop-shadow(0 0 12px rgba(157, 227, 255, 0.42));
}

.hero-radar-caption {
  width: min(210px, 100%);
  margin: 6px 0 0;
  color: #ffe3a3;
  font-size: 0.78rem;
  font-weight: 780;
  line-height: 1.25;
}

.hero-radar-caption span {
  display: block;
}

.hero-night-scores {
  grid-column: 1 / -1;
  justify-self: stretch;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(12, 20, 38, 0.18);
  overflow: hidden;
}

.hero-night-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 0;
  position: relative;
}

.hero-night-heading p {
  margin-bottom: 0;
  color: rgba(255, 250, 242, 0.78);
  font-size: 0.76rem;
  font-weight: 780;
  text-transform: uppercase;
}

.hero-night-heading p:last-child {
  color: rgba(255, 250, 242, 0.56);
}

.hero-night-strip {
  display: grid;
  grid-auto-columns: minmax(210px, 1fr);
  grid-auto-flow: column;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 12px 12px;
  scrollbar-color: rgba(255, 255, 255, 0.38) rgba(255, 255, 255, 0.08);
}

.weather-hero .hero-radar {
  width: var(--clear-radar-size);
  height: var(--clear-radar-size);
}

.weather-hero .hero-radar-chart {
  width: var(--clear-radar-size);
  height: var(--clear-radar-size);
}

.weather-hero .radar-center-score {
  font-size: var(--clear-radar-score-size);
}

.weather-hero .hero-radar-caption {
  margin-top: calc(6px * var(--clear-hero-fit));
  font-size: var(--clear-caption-size);
  line-height: 1.2;
}

.weather-hero .hero-night-heading {
  padding: calc(9px * var(--clear-hero-fit)) calc(12px * var(--clear-hero-fit)) 0;
}

.weather-hero .hero-night-heading p {
  font-size: var(--clear-heading-size);
}

.weather-hero .hero-night-scores {
  width: min(100%, 820px);
  justify-self: center;
}

.weather-hero .hero-night-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-columns: auto;
  grid-auto-flow: row;
  gap: var(--clear-card-gap);
  overflow-x: visible;
  padding: var(--clear-card-padding) calc(12px * var(--clear-hero-fit)) calc(12px * var(--clear-hero-fit));
}

.weather-hero .night-score-card {
  padding: var(--clear-card-padding);
}

.weather-hero .night-score-label {
  font-size: var(--clear-score-label-size);
}

.weather-hero .night-score-peak {
  font-size: var(--clear-score-value-size);
}

.weather-hero .night-score-plot {
  grid-template-columns: var(--clear-plot-axis-width) minmax(0, var(--clear-plot-width));
  justify-content: center;
  gap: var(--clear-plot-gap);
  margin: calc(4px * var(--clear-hero-fit)) 0;
}

.weather-hero .night-score-axis {
  padding: calc(8px * var(--clear-hero-fit)) 0 calc(13px * var(--clear-hero-fit));
  font-size: var(--clear-score-axis-size);
}

.weather-hero .night-score-svg {
  width: min(100%, var(--clear-plot-width));
  height: auto;
  aspect-ratio: 25 / 7;
  justify-self: center;
}

.weather-hero .night-score-times {
  font-size: var(--clear-score-time-size);
}

.model-view {
  display: grid;
  gap: 14px;
}

.model-controls,
.model-hero,
.model-night-panel,
.model-detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(2, 6, 18, 0.18);
  backdrop-filter: blur(22px);
}

.model-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.location-form {
  display: flex;
  align-items: end;
  gap: 10px;
  min-width: min(100%, 560px);
}

.location-field {
  display: grid;
  gap: 6px;
  min-width: min(68vw, 380px);
}

.location-field span,
.model-source,
.model-empty,
.model-detail-card p {
  color: var(--muted);
}

.location-field span {
  font-size: 0.74rem;
  font-weight: 780;
  text-transform: uppercase;
}

.location-field input {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.11);
  color: var(--text);
  font: inherit;
  outline: none;
}

.location-field input:focus {
  border-color: rgba(255, 209, 102, 0.72);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.18);
}

.model-source {
  margin-bottom: 0;
  text-align: right;
}

.model-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: clamp(20px, 4vw, 34px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05)),
    linear-gradient(160deg, rgba(57, 134, 160, 0.58), rgba(71, 83, 131, 0.48) 54%, rgba(41, 37, 70, 0.64));
}

.model-hero[data-quality="good"] {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06)),
    linear-gradient(160deg, rgba(48, 139, 125, 0.7), rgba(58, 101, 146, 0.5) 54%, rgba(42, 37, 78, 0.58));
}

.model-hero[data-quality="mixed"] {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05)),
    linear-gradient(160deg, rgba(182, 130, 59, 0.6), rgba(71, 99, 143, 0.5) 54%, rgba(51, 39, 75, 0.6));
}

.model-hero[data-quality="poor"] {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05)),
    linear-gradient(160deg, rgba(130, 67, 70, 0.68), rgba(77, 83, 124, 0.48) 54%, rgba(43, 35, 60, 0.66));
}

.model-hero-score {
  display: grid;
  justify-items: center;
}

.model-hero-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.model-fact {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.model-fact span,
.model-fact strong {
  display: block;
}

.model-fact span {
  margin-bottom: 5px;
  color: rgba(255, 250, 242, 0.62);
  font-size: 0.68rem;
  font-weight: 780;
  text-transform: uppercase;
}

.model-fact strong {
  color: rgba(255, 250, 242, 0.96);
  font-size: clamp(1rem, 2vw, 1.45rem);
  line-height: 1.05;
}

.model-night-panel {
  overflow: hidden;
}

.model-night-scores {
  min-width: 0;
}

.model-night-strip {
  padding: 12px 14px 14px;
}

.model-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.model-detail-card {
  min-width: 0;
  padding: 14px;
}

.model-detail-card h2 {
  margin-bottom: 12px;
}

.model-detail-card p {
  margin-bottom: 8px;
  line-height: 1.35;
}

.night-score-card {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
}

.night-score-card.is-best {
  border-color: rgba(255, 209, 102, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 209, 102, 0.2), rgba(255, 255, 255, 0.1)),
    rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 242, 0.12),
    0 12px 30px rgba(255, 209, 102, 0.12);
}

.night-score-card.is-radar-active {
  border-color: rgba(157, 227, 255, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(157, 227, 255, 0.18),
    0 12px 30px rgba(4, 8, 20, 0.2);
}

.night-score-header,
.night-score-times {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.night-score-label,
.night-score-peak,
.night-score-times span {
  margin-bottom: 0;
}

.night-score-label {
  color: rgba(255, 250, 242, 0.76);
  font-size: 0.78rem;
  font-weight: 780;
}

.night-score-peak {
  color: rgba(255, 250, 242, 0.96);
  font-size: 1.25rem;
  font-weight: 760;
  line-height: 1;
}

.night-score-card.is-best .night-score-peak {
  color: #ffe3a3;
}

.night-score-plot {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
  margin: 4px 0;
}

.night-score-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding: 8px 0 13px;
  color: rgba(255, 250, 242, 0.54);
  font-size: 0.62rem;
  font-weight: 780;
  line-height: 1;
}

.night-score-svg {
  display: block;
  width: 100%;
  height: 74px;
  min-width: 0;
}

.night-score-guide {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.night-score-area {
  fill: rgba(255, 250, 242, 0.16);
}

.night-score-line {
  fill: none;
  stroke: rgba(255, 250, 242, 0.96);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.8;
  vector-effect: non-scaling-stroke;
}

.night-score-dot {
  fill: rgba(255, 250, 242, 0.98);
  stroke: rgba(26, 41, 74, 0.74);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  transition:
    filter 120ms ease,
    transform 120ms ease;
  vector-effect: non-scaling-stroke;
}

.night-score-dot.is-peak {
  fill: #ffe3a3;
  stroke: rgba(26, 41, 74, 0.9);
}

.night-score-dot.is-radar-active {
  filter: drop-shadow(0 0 6px rgba(157, 227, 255, 0.75));
  stroke: rgba(157, 227, 255, 0.98);
  stroke-width: 2.2;
  transform: scale(1.65);
}

.night-score-peak-line {
  stroke: rgba(255, 227, 163, 0.78);
  stroke-dasharray: 3 4;
  stroke-linecap: round;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.night-score-peak-time {
  fill: rgba(255, 250, 242, 0.86);
  font-size: 0.55rem;
  font-weight: 800;
  paint-order: stroke;
  pointer-events: none;
  stroke: rgba(26, 41, 74, 0.72);
  stroke-width: 2.5;
  text-anchor: middle;
}

.night-score-times {
  color: rgba(255, 250, 242, 0.58);
  font-size: 0.68rem;
  font-weight: 760;
}

.hourly-panel,
.forecast-panel,
.legend-panel,
.original-chart {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(2, 6, 18, 0.18);
  backdrop-filter: blur(22px);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.section-heading p {
  margin-bottom: 0;
  text-align: right;
}

.hourly-strip {
  display: grid;
  grid-auto-columns: 82px;
  grid-auto-flow: column;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 14px 14px;
  scrollbar-color: rgba(255, 255, 255, 0.4) rgba(255, 255, 255, 0.08);
}

.hour-card {
  position: relative;
  min-height: 128px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 10px 9px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  text-align: center;
}

.hour-time,
.hour-value,
.hour-meta {
  margin-bottom: 0;
}

.hour-time {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.hour-icon {
  display: grid;
  place-items: center;
  height: 38px;
  margin: 10px 0 4px;
}

.hour-icon .value-icon {
  width: 30px;
  height: 30px;
}

.hour-value {
  min-height: 19px;
  font-size: 0.76rem;
  font-weight: 820;
}

.hour-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.hour-score {
  display: block;
  height: 4px;
  margin-top: 9px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.92) var(--score), rgba(255, 255, 255, 0.22) var(--score));
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  min-width: 0;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 15px;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.summary-card.loading {
  position: relative;
}

.summary-card.loading::after {
  content: "";
  display: block;
  width: 70%;
  height: 18px;
  margin-top: 32px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
}

.summary-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}

.summary-icon {
  display: inline-flex;
  color: var(--muted);
}

.summary-icon .value-icon {
  width: 17px;
  height: 17px;
}

.summary-kicker {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.summary-value {
  min-width: 0;
  margin-bottom: 8px;
  font-size: clamp(1.12rem, 1.7vw, 1.55rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
  white-space: pre-line;
  word-break: break-word;
}

.summary-meta {
  min-width: 0;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.35;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.control-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px);
}

.segment {
  min-width: 76px;
  padding: 0 14px;
  cursor: pointer;
}

.segment.is-active {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.2);
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(18px);
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  display: inline-flex;
  align-items: center;
  width: 42px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.16);
  transition:
    background 140ms ease,
    border-color 140ms ease;
}

.switch-thumb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transform: translateX(0);
  transition: transform 140ms ease;
}

.switch-text {
  font-weight: 760;
}

.switch-control.is-checked .switch-track {
  border-color: rgba(157, 227, 255, 0.64);
  background: rgba(157, 227, 255, 0.34);
}

.switch-control.is-checked .switch-thumb {
  transform: translateX(18px);
}

.switch-control:focus-within {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.forecast-panel {
  overflow: hidden;
}

.forecast-scroll {
  min-width: 0;
  overflow-x: auto;
  scrollbar-color: rgba(255, 255, 255, 0.4) rgba(255, 255, 255, 0.08);
}

.forecast-grid {
  display: grid;
  grid-template-columns: var(--label-width) repeat(var(--cols), var(--cell-width));
  width: max-content;
  min-width: 100%;
}

.corner,
.time-cell,
.row-label,
.forecast-cell {
  min-height: var(--cell-height);
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.corner,
.time-cell {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(18, 27, 47, 0.88);
  backdrop-filter: blur(18px);
}

.corner,
.row-label {
  position: sticky;
  left: 0;
  z-index: 4;
}

.corner {
  z-index: 5;
}

.time-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 8px;
}

.time-main {
  font-size: 0.85rem;
  font-weight: 800;
}

.time-date {
  color: var(--accent-strong);
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 860;
  line-height: 1.1;
  white-space: nowrap;
}

.time-date.is-day-label {
  min-width: max-content;
  padding: 2px 4px;
  border-radius: 5px;
  background: rgba(18, 27, 47, 0.72);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.42);
}

.time-cell.is-day-start {
  position: sticky;
  z-index: 6;
}

.time-cell.is-day-start::before,
.forecast-cell.is-day-start::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 3;
  width: 4px;
  background: var(--accent-strong);
  pointer-events: none;
}

.row-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(18, 27, 47, 0.9);
  backdrop-filter: blur(18px);
  font-size: 0.84rem;
  font-weight: 820;
}

.row-label-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: rgba(255, 250, 242, 0.72);
}

.row-label-icon .value-icon {
  width: 17px;
  height: 17px;
}

.row-label span:last-child {
  min-width: 0;
}

.forecast-cell {
  position: relative;
  display: flex;
  min-width: 0;
  background: rgba(255, 255, 255, 0.08);
}

.row-label.forecast-row-break-after,
.forecast-cell.forecast-row-break-after,
.forecast-graph-cell.forecast-row-break-after {
  border-bottom-color: rgba(255, 227, 163, 0.72);
  box-shadow: inset 0 -2px 0 rgba(255, 227, 163, 0.5);
}

.forecast-graph-cell {
  position: relative;
  min-height: 112px;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.045),
      rgba(255, 255, 255, 0.045) 1px,
      transparent 1px,
      transparent var(--cell-width)
    );
  overflow: hidden;
}

.forecast-graph-cell.is-empty {
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.045),
      rgba(255, 255, 255, 0.045) 6px,
      rgba(255, 255, 255, 0.018) 6px,
      rgba(255, 255, 255, 0.018) 12px
    );
}

.forecast-graph {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 96px;
}

.graph-day-separators {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell-width));
  pointer-events: none;
}

.graph-day-separator {
  align-self: stretch;
  width: 4px;
  margin-left: -2px;
  background: var(--accent-strong);
}

.graph-baseline {
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1;
}

.graph-range {
  stroke: rgba(255, 250, 242, 0.42);
  stroke-linecap: round;
  stroke-width: 7;
}

.graph-line {
  fill: none;
  stroke: rgba(255, 250, 242, 0.96);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.2;
  vector-effect: non-scaling-stroke;
}

.graph-marker {
  fill: rgba(255, 250, 242, 0.98);
  stroke: rgba(12, 18, 31, 0.78);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.graph-marker.is-range {
  fill: rgba(157, 227, 255, 0.98);
}

.graph-scale {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  color: rgba(255, 250, 242, 0.62);
  font-size: 0.66rem;
  font-weight: 780;
  pointer-events: none;
}

.forecast-cell.is-empty {
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.045),
      rgba(255, 255, 255, 0.045) 6px,
      rgba(255, 255, 255, 0.018) 6px,
      rgba(255, 255, 255, 0.018) 12px
    );
}

.cell-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  padding: 5px;
  border: 0;
  background: var(--cell-bg);
  color: var(--cell-color);
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  overflow: visible;
  overflow-wrap: anywhere;
}

.cell-link:hover {
  filter: brightness(1.08) saturate(1.05);
}

.value-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
}

.value-icon {
  display: inline-flex;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.value-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.15;
}

.value-badge {
  min-width: 0;
  max-width: 48px;
  font-size: 0.66rem;
  font-weight: 840;
  line-height: 1;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.has-tooltip {
  position: relative;
}

.has-radar {
  cursor: help;
}

.floating-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10000;
  max-width: min(340px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(12, 18, 31, 0.96);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateY(4px);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
  white-space: normal;
}

.floating-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.radar-popover {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10001;
  width: min(380px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(12, 18, 31, 0.97);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.radar-popover.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.radar-popover-content {
  display: grid;
  gap: 10px;
}

.radar-popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.radar-popover-title p,
.radar-popover-score,
.radar-popover-meta {
  margin-bottom: 0;
}

.radar-popover-title p:first-child {
  color: rgba(255, 250, 242, 0.94);
  font-size: 0.8rem;
  font-weight: 800;
}

.radar-popover-title p:last-child,
.radar-popover-meta {
  color: rgba(255, 250, 242, 0.58);
  font-size: 0.68rem;
  font-weight: 720;
}

.radar-popover-score {
  min-width: 42px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 250, 242, 0.96);
  font-size: 1.1rem;
  font-weight: 820;
  line-height: 1;
  text-align: center;
}

.radar-popover-body {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.radar-popover-body.is-compact {
  grid-template-columns: minmax(0, 1fr);
}

.night-radar-chart {
  display: block;
  width: 156px;
  height: 156px;
}

.radar-grid-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.radar-axis {
  opacity: 0.48;
  stroke-linecap: round;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.radar-slice {
  fill-opacity: 0.34;
}

.radar-outline {
  fill: none;
  stroke: rgba(255, 250, 242, 0.92);
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.radar-point {
  stroke: rgba(12, 18, 31, 0.84);
  stroke-width: 1.3;
  vector-effect: non-scaling-stroke;
}

.radar-center-backdrop {
  fill: rgba(12, 18, 31, 0.76);
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
}

.radar-center-score {
  fill: #ffe3a3;
  font-size: 1.85rem;
  font-weight: 820;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: rgba(12, 18, 31, 0.48);
  stroke-width: 2;
  text-anchor: middle;
}

.radar-legend {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.radar-legend-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.radar-legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--component-color);
}

.radar-legend-text,
.radar-legend-numbers {
  display: grid;
  min-width: 0;
}

.radar-legend-label {
  color: rgba(255, 250, 242, 0.88);
  font-size: 0.68rem;
  font-weight: 780;
  line-height: 1.05;
}

.radar-legend-detail {
  color: rgba(255, 250, 242, 0.52);
  font-size: 0.6rem;
  font-weight: 660;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radar-legend-numbers {
  justify-items: end;
}

.radar-legend-value {
  color: rgba(255, 250, 242, 0.94);
  font-size: 0.74rem;
  font-weight: 820;
  line-height: 1.05;
}

.radar-legend-weight {
  color: rgba(255, 250, 242, 0.48);
  font-size: 0.58rem;
  font-weight: 760;
  line-height: 1.05;
}

.legend-panel {
  padding-bottom: 16px;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 16px;
}

.legend-group {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.legend-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.legend-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 34px;
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--cell-bg);
  color: var(--cell-color);
  font-size: 0.72rem;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.original-chart {
  padding: 0;
  overflow: hidden;
}

.original-chart summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
}

.original-chart a {
  display: block;
  padding: 0 16px 16px;
}

.original-chart img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: #fff;
}

.error-panel {
  border-color: rgba(255, 128, 102, 0.65);
  background: rgba(255, 128, 102, 0.12);
}

@media (max-width: 980px) {
  :root {
    --label-width: 126px;
    --cell-width: 68px;
  }

  .weather-hero {
    grid-template-columns: 1fr;
  }

  .weather-hero .hero-night-scores {
    width: min(100%, 760px);
  }

  .model-controls,
  .model-hero {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .model-controls,
  .location-form {
    flex-direction: column;
  }

  .location-form,
  .location-field {
    width: 100%;
    min-width: 0;
  }

  .model-source {
    text-align: left;
  }

  .model-hero-facts,
  .summary-grid,
  .legend-grid,
  .model-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-header,
  .toolbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading p {
    text-align: left;
  }
}

@media (max-width: 620px) {
  :root {
    --label-width: 116px;
    --cell-width: 62px;
    --cell-height: 46px;
  }

  .app-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 16px;
  }

  .app-header {
    flex-direction: column;
  }

  .weather-hero {
    min-height: 0;
    padding: max(3px, calc(22px * var(--clear-hero-fit)));
  }

  .weather-hero .hero-night-scores {
    width: min(100%, 420px);
  }

  .score-number {
    font-size: 4.4rem;
  }

  .summary-grid,
  .legend-grid,
  .model-hero-facts,
  .model-detail-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .hourly-strip {
    grid-auto-columns: 76px;
  }

  .row-label {
    font-size: 0.78rem;
  }

  .cell-link {
    font-size: 0.66rem;
  }

  .value-icon {
    width: 15px;
    height: 15px;
  }

  .value-badge {
    max-width: 40px;
    font-size: 0.58rem;
  }
}

@media (max-width: 760px), (max-aspect-ratio: 4 / 5) {
  .weather-hero .hero-night-scores {
    width: min(100%, 430px);
  }

  .weather-hero .hero-night-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) and (max-aspect-ratio: 9 / 16) {
  .weather-hero .hero-radar {
    --clear-radar-size: calc(220px * var(--clear-hero-fit));
  }

  .weather-hero .hero-radar-chart {
    width: var(--clear-radar-size);
    height: var(--clear-radar-size);
  }

  .weather-hero .night-score-svg {
    --clear-plot-width: calc(260px * var(--clear-hero-fit));
    aspect-ratio: 260 / 73;
  }

  .weather-hero .hero-night-strip {
    gap: calc(8px * var(--clear-hero-fit));
    padding:
      calc(8px * var(--clear-hero-fit))
      calc(10px * var(--clear-hero-fit))
      calc(10px * var(--clear-hero-fit));
  }
}

@media (max-height: 760px), (max-width: 420px) {
  .app-shell {
    padding-top: 8px;
  }

  .app-header {
    gap: 10px;
    padding: 4px 0 10px;
  }

  h1 {
    margin-bottom: 5px;
    font-size: clamp(1.45rem, 3vw, 2.2rem);
  }

  .eyebrow {
    margin-bottom: 3px;
    font-size: 0.68rem;
  }

  .source-line {
    font-size: 0.74rem;
  }

  main {
    gap: 10px;
  }

  .header-actions {
    gap: 6px;
  }

  .icon-button,
  .source-link,
  .switch-control,
  .segment {
    min-height: 34px;
  }

  .icon-button,
  .source-link {
    gap: 7px;
    padding: 0 10px;
  }

  .switch-control {
    gap: 7px;
    padding: 0 10px 0 8px;
  }

  .switch-track {
    width: 36px;
    height: 20px;
  }

  .switch-thumb {
    width: 14px;
    height: 14px;
  }

  .switch-control.is-checked .switch-thumb {
    transform: translateX(16px);
  }
}

@media (max-width: 420px) {
  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .header-actions .icon-button {
    flex: 0 0 34px;
    justify-content: center;
    padding: 0;
  }

  .header-actions .icon-button span {
    display: none;
  }

  .header-actions .switch-control,
  .header-actions .source-link {
    min-width: 0;
  }

  .header-actions .switch-control {
    flex: 1 1 128px;
  }

  .header-actions .source-link {
    justify-content: center;
    flex: 1 1 72px;
  }

  .switch-text {
    font-size: 0.76rem;
  }
}
