* { box-sizing: border-box; }

:root {
  --bg-void: #0A0D12;
  --bg-panel: #12161D;
  --bg-raised: #171C25;
  --hairline: #232A36;
  --text-hi: #E9EDF3;
  --text-dim: #7C8798;
  --wind: #FFB454;
  --temp: #5EEAD4;
  --live: #6BE37A;
  --danger: #FF6B6B;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-void);
  color: var(--text-hi);
  font-family: var(--font-ui);
  min-height: 100vh;
}

body {
  position: relative;
  overflow-x: hidden;
}

/* faint oscilloscope graticule behind everything */
.bg-graticule {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 0%, transparent 75%);
}

/* ---------------- topbar ---------------- */

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 40px) 18px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { color: var(--wind); flex-shrink: 0; }

.brand-text h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brand-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--bg-panel);
  border: 1px solid var(--hairline);
  padding: 8px 14px;
  border-radius: 20px;
}

.status-sep { opacity: 0.4; }

#statusText { color: var(--text-hi); font-weight: 500; }
#statusText.is-down { color: var(--danger); }

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(107, 227, 122, 0.55);
  animation: pulse-live 1.8s ease-out infinite;
  flex-shrink: 0;
}
.pulse.is-down { background: var(--danger); animation: none; box-shadow: none; }

@keyframes pulse-live {
  0%   { box-shadow: 0 0 0 0 rgba(107, 227, 122, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(107, 227, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(107, 227, 122, 0); }
}

/* ---------------- layout ---------------- */

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 0 clamp(16px, 4vw, 40px) 28px;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 22px clamp(16px, 3vw, 26px) 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel[data-accent="wind"] { --accent: var(--wind); }
.panel[data-accent="temp"] { --accent: var(--temp); }

/* ---------------- metrics ---------------- */

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.metric-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.metric-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 40px;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.metric-value small {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 6px;
}

.metric-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-strip .metric {
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 9px 14px;
  min-width: 82px;
}

.metric-value--sm {
  font-size: 19px;
}

.metric--record .metric-value--sm { color: var(--accent); }

.metric-value.flash {
  animation: flash-value 1.1s ease-out;
}
@keyframes flash-value {
  0%   { text-shadow: 0 0 14px var(--accent), 0 0 2px var(--accent); }
  100% { text-shadow: none; }
}

/* ---------------- chart ---------------- */

.chart-wrap {
  position: relative;
  height: 240px;
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 14px 16px 6px;
}

@media (max-width: 560px) {
  .chart-wrap { height: 190px; padding: 10px 8px 4px; }
}

/* ---------------- range slider ---------------- */

.range-control { display: flex; flex-direction: column; gap: 8px; }

.range-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-tick {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 34px;
}
.range-tick:last-child { text-align: right; }

.range-readout {
  font-size: 11.5px;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}
.range-readout b {
  font-family: var(--font-mono);
  color: var(--text-hi);
  font-weight: 600;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--hairline);
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--hairline);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-raised);
  box-shadow: 0 0 0 1px var(--accent);
  transition: transform 0.12s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-raised);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ---------------- footer ---------------- */

.foot {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 10px 16px 28px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  opacity: 0.65;
}
.foot-sep { margin: 0 8px; opacity: 0.5; }

/* ---------------- a11y ---------------- */

input[type="range"]:focus-visible,
:focus-visible {
  outline: 2px solid var(--accent, var(--wind));
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  .metric-value.flash { animation: none; }
}
