:root {
  --ink: #f4f8ff;
  --muted: #91a6bd;
  --panel: rgba(12, 34, 57, 0.78);
  --panel-strong: rgba(15, 43, 71, 0.92);
  --line: rgba(169, 205, 238, 0.13);
  --cobb: #42d6ca;
  --bulla: #75a8ff;
  --ok: #5ce6a4;
  --warn: #ffb44a;
  --danger: #ff7083;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(22, 107, 151, 0.18), transparent 34rem),
    linear-gradient(145deg, #061321 0%, #071b2f 55%, #071424 100%);
  font-family: "DM Sans", system-ui, sans-serif;
}

.sky-glow {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(90px);
  opacity: .15;
  pointer-events: none;
}
.sky-glow-one { width: 26rem; height: 26rem; background: var(--cobb); top: -14rem; right: -6rem; }
.sky-glow-two { width: 34rem; height: 34rem; background: #244f9c; bottom: -22rem; left: -10rem; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 28px; }
.topbar, .chart-heading, .card-topline, .temperature-row, footer { display: flex; align-items: center; }
.topbar { justify-content: space-between; margin-bottom: 30px; }
.eyebrow { margin: 0 0 7px; color: #62c9ce; font-size: .69rem; font-weight: 700; letter-spacing: .19em; }
h1, h2 { font-family: Manrope, sans-serif; letter-spacing: -.04em; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1; }
.update-block { gap: 11px; color: var(--muted); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px rgba(92,230,164,.08); }
.update-label, #refreshed-at { display: block; }
.update-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
#refreshed-at { margin-top: 2px; color: #cfdded; font-size: .84rem; }
#refresh-button { width: 38px; height: 38px; margin-left: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; color: #c8d9ea; background: rgba(255,255,255,.035); cursor: pointer; }
#refresh-button:hover { background: rgba(255,255,255,.075); }
#refresh-button.loading svg { animation: spin .8s linear infinite; }
#refresh-button svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@keyframes spin { to { transform: rotate(360deg); } }

.site-banner {
  position: relative;
  height: clamp(190px, 28vw, 330px);
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #17324a;
  box-shadow: 0 30px 70px rgba(0,0,0,.19);
}
.site-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 -45px 70px rgba(4,18,31,.2), inset 0 1px rgba(255,255,255,.12);
}
.site-banner img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 44%;
}

.station-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.station-card, .station-skeleton, .chart-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(150deg, rgba(20,52,82,.9), var(--panel));
  box-shadow: 0 30px 70px rgba(0,0,0,.19), inset 0 1px rgba(255,255,255,.025);
  backdrop-filter: blur(16px);
}
.station-card { position: relative; overflow: hidden; padding: 28px; }
.station-card::before { content: ""; position: absolute; width: 220px; height: 220px; right: -100px; top: -105px; border-radius: 50%; background: radial-gradient(circle, rgba(66,214,202,.12), transparent 70%); }
.station-card.bulla::before { background: radial-gradient(circle, rgba(117,168,255,.14), transparent 70%); }
.card-topline { position: relative; justify-content: space-between; }
.status-row { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; color: var(--ok); font-size: .69rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.station-card.offline .status-row { color: var(--danger); }
.station-name { margin: 0; font-size: 1.55rem; }
.station-id { margin: 3px 0 0; color: var(--muted); font-size: .79rem; }
.wind-orbit { display: grid; place-items: center; width: 50px; height: 50px; border: 1px solid rgba(154,200,232,.18); border-radius: 50%; color: #b8d0e5; background: rgba(255,255,255,.025); }
.wind-arrow { font-size: 1.4rem; transition: transform .5s ease; }
.temperature-row { align-items: flex-start; margin: 33px 0 28px; }
.temperature { font-family: Manrope, sans-serif; font-size: clamp(4rem, 8vw, 6rem); font-weight: 700; line-height: .78; letter-spacing: -.08em; }
.degree { margin: -7px 0 0 7px; color: #90afca; font-family: Manrope, sans-serif; font-size: 1.15rem; }
.feels { align-self: flex-end; margin-left: auto; color: var(--muted); font-size: .78rem; }
.feels strong { display: block; margin-top: 3px; color: var(--ink); font-size: 1.05rem; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.metric { min-width: 0; padding: 17px 13px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric span, .metric strong { display: block; }
.metric span { margin-bottom: 5px; color: var(--muted); font-size: .69rem; }
.metric strong { white-space: nowrap; font-family: Manrope, sans-serif; font-size: .95rem; }
.observed-time { margin-top: 15px; color: #7189a2; font-size: .72rem; text-align: right; }

.station-error { grid-column: 1 / -1; padding: 22px; border: 1px solid rgba(255,112,131,.2); border-radius: 18px; color: #ffc5cd; background: rgba(255,112,131,.07); }
.station-skeleton { min-height: 410px; background: linear-gradient(105deg, rgba(16,43,70,.75) 25%, rgba(35,67,96,.75) 42%, rgba(16,43,70,.75) 60%); background-size: 250% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position-x: -250%; } }

.chart-panel { margin-top: 22px; padding: 27px 28px 21px; }
.chart-heading { justify-content: space-between; gap: 22px; }
.chart-heading h2 { margin: 0; font-size: 1.45rem; }
.chart-controls { display: flex; padding: 4px; gap: 2px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.08); }
.metric-button { padding: 8px 13px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font: 600 .76rem "DM Sans", sans-serif; cursor: pointer; }
.metric-button.active { color: #ecf7ff; background: rgba(111,172,218,.16); box-shadow: inset 0 0 0 1px rgba(151,202,237,.08); }
.chart-wrap { position: relative; height: 270px; margin-top: 20px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.legend { display: flex; justify-content: center; gap: 24px; margin-top: 5px; color: var(--muted); font-size: .76rem; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.cobb { background: var(--cobb); }
.legend-dot.bulla { background: var(--bulla); }
footer { justify-content: space-between; padding: 20px 3px 0; color: #627991; font-size: .7rem; }

@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 620px); padding-top: 25px; }
  .topbar { align-items: flex-end; }
  .update-label { display: none; }
  .station-grid { grid-template-columns: 1fr; }
  .site-banner { height: clamp(175px, 48vw, 230px); border-radius: 20px; }
  .site-banner img { object-position: center 42%; }
  .station-card { padding: 22px; border-radius: 20px; }
  .temperature-row { margin: 31px 0 24px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .chart-panel { padding: 22px 16px 17px; border-radius: 20px; }
  .chart-heading { display: block; }
  .chart-controls { margin-top: 17px; overflow-x: auto; }
  .metric-button { flex: 1; min-width: max-content; }
  .chart-wrap { height: 235px; }
  footer { display: block; text-align: center; }
  footer span { display: block; margin-top: 5px; }
}

@media (max-width: 400px) {
  #refreshed-at { max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .temperature { font-size: 4.6rem; }
}

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