:root {
  --bg0: #0c1412;
  --bg1: #13201c;
  --ink: #e8f0ec;
  --muted: #8fa399;
  --line: rgba(232, 240, 236, 0.12);
  --accent: #c4f082;
  --warn: #f0a35a;
  --danger: #e85d4c;
  --chart: #7ec8a3;
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Sora", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-ui);
  background: var(--bg0);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(126, 200, 163, 0.18), transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(240, 163, 90, 0.12), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 45%, #0a1010);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem 0.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.55rem;
  background:
    linear-gradient(145deg, var(--accent), #4d8f72 60%, #1f3d34);
  box-shadow: 0 0 0 1px rgba(196, 240, 130, 0.25);
  animation: pulse-mark 2.8s ease-in-out infinite;
}

@keyframes pulse-mark {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.04);
    filter: brightness(1.12);
  }
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-sub {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.dot.on {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(196, 240, 130, 0.55);
}

.dot.off {
  background: var(--danger);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 3rem;
}

.hero-level {
  text-align: center;
  padding: 1.75rem 0 0.85rem;
  animation: rise 0.7s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-level .label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 500;
}

.hero-level .level {
  margin: 0.35rem 0 0;
  font-family: var(--font-mono);
  font-size: clamp(3.8rem, 12vw, 6.5rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  transition: color 0.35s ease;
}

.hero-level .level.hot {
  color: var(--warn);
}

.hero-level .level.over {
  color: var(--danger);
  animation: throb 1.2s ease-in-out infinite;
}

@keyframes throb {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.015);
  }
}

.hero-level .unit {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 1rem;
}

.hero-level .meta {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.derived {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem 1.25rem;
  margin: 0 0 1.25rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  animation: rise 0.75s ease 0.04s both;
}

.derived-card {
  min-width: 0;
}

.derived-label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.derived-value {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 3.5vw, 1.85rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  transition: color 0.3s ease;
}

.derived-value.hvac-low {
  color: var(--chart);
}

.derived-value.hvac-mid {
  color: var(--warn);
}

.derived-value.hvac-high {
  color: var(--danger);
}

.derived-value.over-limit {
  color: var(--danger);
}

.derived-value.under-limit {
  color: var(--ink);
}

.derived-unit {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.derived-hint {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.9;
}

.spectrogram-section,
.fft-section {
  margin: 0 0 1.75rem;
  animation: rise 0.85s ease 0.06s both;
}

.spectrogram-wrap {
  display: grid;
  grid-template-columns: 3.6rem 1fr 2.2rem;
  gap: 0.45rem;
  align-items: stretch;
}

.spectrogram-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.15rem 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  text-align: right;
  line-height: 1;
}

.spectrogram-canvas-wrap {
  position: relative;
  border-radius: 0.35rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a1010;
  min-height: 360px;
}

#spectrogram {
  display: block;
  width: 100%;
  height: 360px;
  cursor: crosshair;
}

.spectrogram-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px dashed rgba(232, 240, 236, 0.55);
  pointer-events: none;
  transform: translateX(-0.5px);
}

.spectrogram-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 0.15rem 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  background: linear-gradient(
    180deg,
    rgb(253, 231, 37),
    rgb(94, 201, 98),
    rgb(33, 145, 140),
    rgb(59, 82, 139),
    rgb(68, 1, 84)
  );
  border-radius: 0.25rem;
  text-shadow: 0 0 3px #000, 0 1px 2px #000;
}

.spectrogram-x {
  position: relative;
  height: 1.4rem;
  margin: 0.35rem 0 0 3.6rem;
  margin-right: 2.2rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.spectrogram-x span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.spectrogram-note {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  max-width: 52rem;
}

.ghost-btn {
  appearance: none;
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(196, 240, 130, 0.35);
  border-radius: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ghost-btn:hover {
  background: rgba(196, 240, 130, 0.08);
  border-color: rgba(196, 240, 130, 0.55);
}

.spectrum {
  margin: 0.25rem 0 1.5rem;
  animation: rise 0.8s ease 0.05s both;
}

.spectrum-head .chart-legend {
  margin: 0;
  align-self: center;
}

.spectrum-head h2,
.spectrogram-section h2,
.fft-section h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
}

.spectrum-hint {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.spectrum-bars {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.spectrum-bars.locked .s-fill {
  background: linear-gradient(90deg, #3d6b9a, #7eb8e8);
}

.s-band {
  display: grid;
  grid-template-columns: 4.2rem 1fr 3.2rem;
  align-items: center;
  gap: 0.65rem;
}

.s-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
}

.s-band.lf .s-label {
  color: #b8d4c4;
}

.s-track {
  height: 0.7rem;
  border-radius: 0.2rem;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.s-fill {
  height: 100%;
  width: 0;
  border-radius: 0.2rem;
  background: linear-gradient(90deg, #4d8f72, var(--accent));
  transition: width 0.45s ease;
}

.s-band.hot .s-fill {
  background: linear-gradient(90deg, #c4893a, var(--warn));
}

.s-band.empty .s-fill {
  opacity: 0.25;
}

.s-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.controls select {
  appearance: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  padding: 0.55rem 0.8rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  min-width: 10rem;
}

.chart-wrap {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1rem 0 0.25rem;
  animation: rise 0.9s ease 0.1s both;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.15rem;
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-legend .swatch {
  width: 0.85rem;
  height: 0.55rem;
  border-radius: 0.12rem;
  flex-shrink: 0;
}

.chart-legend .swatch.day {
  background: rgba(126, 200, 163, 0.28);
  box-shadow: inset 0 0 0 1px rgba(126, 200, 163, 0.45);
}

.chart-legend .swatch.night {
  background: rgba(2, 6, 14, 0.85);
  box-shadow: inset 0 0 0 1px rgba(232, 240, 236, 0.18);
}

.chart-legend .swatch.limit {
  background: transparent;
  border-top: 2.5px solid #ff2d95;
  height: 0;
  margin-top: 0.2rem;
}

.chart-legend .swatch.limit-change {
  width: 0.18rem;
  height: 0.7rem;
  border-radius: 0;
  background: #ff2d95;
  box-shadow: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin: 0.5rem 0 1.75rem;
}

.stat {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
}

.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
}

.privacy {
  max-width: 40rem;
}

.privacy-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.privacy h2 {
  margin: 0 0 1.15rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.privacy-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.privacy-points li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.75rem 1.1rem;
  align-items: baseline;
  padding-left: 0.9rem;
  border-left: 2px solid rgba(196, 240, 130, 0.35);
}

.privacy-label {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 500;
}

.privacy-text {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.api-log {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

@media (max-width: 700px) {
  .stats,
  .derived {
    grid-template-columns: repeat(2, 1fr);
  }

  .spectrogram-wrap {
    grid-template-columns: 2.8rem 1fr 1.6rem;
  }

  .spectrogram-x {
    margin-left: 2.8rem;
    margin-right: 1.6rem;
  }

  .top {
    padding-inline: 1rem;
  }

  main,
  .site-footer,
  .api-log {
    padding-inline: 1rem;
  }

  .privacy-points li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}
