:root {
  --bg-main: #f5f2e9;
  --bg-secondary: #dff2eb;
  --ink: #0c3045;
  --ink-muted: #36586d;
  --card-bg: rgba(255, 255, 255, 0.78);
  --card-border: rgba(12, 48, 69, 0.14);
  --accent-temp: #ff6b35;
  --accent-humidity: #00a896;
  --accent-pressure: #1d4ed8;
  --accent-current-avg: #d97706;
  --accent-co: #9a3412;
  --accent-rms: #0e7490;
  --accent-highlight: #f4a261;
  --ok: #16a34a;
  --bad: #dc2626;
  --telemetry-card-bg: rgba(8, 28, 42, 0.92);
  --telemetry-text: #dff5ff;
  --telemetry-muted: #9ec4d8;
  --shadow-soft: 0 16px 40px rgba(12, 48, 69, 0.16);
  --radius: 22px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% -10%, #fff9eb 0%, transparent 45%),
    radial-gradient(circle at 85% 0%, #cdece2 0%, transparent 42%),
    linear-gradient(160deg, var(--bg-main) 0%, #eef6f0 100%);
  overflow-x: hidden;
}

.container {
  width: min(1160px, 92vw);
  margin: 0 auto;
}

.bg-shape,
.bg-grid {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
}

.bg-shape--one,
.bg-shape--two {
  position: fixed;
  border-radius: 50%;
  filter: blur(8px);
}

.bg-shape--one {
  width: 340px;
  height: 340px;
  top: 64px;
  left: -70px;
  background: radial-gradient(circle, rgba(244, 162, 97, 0.36) 0%, rgba(244, 162, 97, 0) 70%);
  animation: floatOne 11s ease-in-out infinite;
}

.bg-shape--two {
  width: 440px;
  height: 440px;
  right: -140px;
  bottom: -90px;
  background: radial-gradient(circle, rgba(0, 168, 150, 0.28) 0%, rgba(0, 168, 150, 0) 70%);
  animation: floatTwo 14s ease-in-out infinite;
}

.bg-grid {
  background-image:
    linear-gradient(rgba(12, 48, 69, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(12, 48, 69, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.24;
  mask-image: radial-gradient(circle at 55% 30%, black 20%, transparent 85%);
}

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1rem;
  align-items: start;
  padding: 3.4rem 0 1.8rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #134462;
  font-weight: 700;
}

h1 {
  margin: 0.55rem 0 0;
  font-size: clamp(1.9rem, 3.6vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.subtitle {
  max-width: 65ch;
  margin: 1rem 0 0;
  color: var(--ink-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.hero-badges {
  margin-top: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.badge {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: #144560;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(12, 48, 69, 0.14);
  border-radius: 999px;
  padding: 0.32rem 0.62rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(4px);
  padding: 1.05rem;
}

.connection-card {
  display: grid;
  gap: 0.74rem;
  align-content: start;
}

.telemetry-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 14%, rgba(93, 181, 225, 0.2) 0%, transparent 34%),
    radial-gradient(circle at 91% 82%, rgba(80, 240, 203, 0.14) 0%, transparent 38%),
    linear-gradient(140deg, rgba(4, 18, 31, 0.96) 0%, var(--telemetry-card-bg) 60%, rgba(5, 34, 47, 0.92) 100%);
  border-color: rgba(146, 211, 239, 0.28);
}

.telemetry-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0) 52%),
    repeating-linear-gradient(
      90deg,
      rgba(166, 223, 255, 0.07) 0,
      rgba(166, 223, 255, 0.07) 1px,
      transparent 1px,
      transparent 28px
    );
  opacity: 0.5;
}

.telemetry-card h2,
.telemetry-card .small,
.telemetry-card .label {
  color: var(--telemetry-text);
}

.telemetry-card .small {
  color: var(--telemetry-muted);
}

.telemetry-card .card-title-row,
.telemetry-card .metric-grid {
  position: relative;
  z-index: 1;
}

.telemetry-card .metric-card {
  background: rgba(255, 255, 255, 0.86);
}

.telemetry-card .metric-card .label {
  color: #21506a;
}

.telemetry-card .metric-card .metric-value {
  color: #0c3045;
}

.metric-subtitle {
  margin-top: 1.05rem;
}

.telemetry-stage {
  position: relative;
  z-index: 1;
  margin-top: 0.9rem;
  min-height: 380px;
  border-radius: 18px;
  border: 1px solid rgba(146, 211, 239, 0.24);
  background:
    radial-gradient(circle at 20% 26%, rgba(121, 188, 255, 0.2) 0%, transparent 42%),
    radial-gradient(circle at 86% 72%, rgba(93, 255, 194, 0.14) 0%, transparent 38%),
    linear-gradient(160deg, rgba(5, 28, 43, 0.94) 0%, rgba(3, 21, 34, 0.92) 100%);
  overflow: hidden;
}

#telemetryScene {
  display: block;
  width: 100%;
  height: 380px;
}

.telemetry-focus {
  position: absolute;
  left: 1rem;
  top: 1rem;
  max-width: 260px;
  background: rgba(4, 22, 33, 0.62);
  border: 1px solid rgba(146, 211, 239, 0.26);
  border-radius: 14px;
  padding: 0.7rem 0.78rem;
  backdrop-filter: blur(7px);
}

.telemetry-focus-name,
.telemetry-focus-value {
  margin: 0.22rem 0 0;
  color: #f2fbff;
}

.telemetry-focus-name {
  font-size: 1.08rem;
  font-weight: 700;
}

.telemetry-focus-value {
  font-family: "Syne", "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
  font-size: 1.44rem;
}

.telemetry-hint {
  margin-top: 0.42rem;
  color: #95c2db;
}

.telemetry-focus-detail {
  margin-top: 0.35rem;
  color: #b6d8ea;
}

.telemetry-focus-detail.is-rising {
  color: #8ff0c8;
}

.telemetry-focus-detail.is-falling {
  color: #ffb8b8;
}

.telemetry-fallback {
  margin-top: 0.42rem;
  color: #fecaca;
}

.telemetry-chip-row {
  position: relative;
  z-index: 1;
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.telemetry-chip {
  position: relative;
  border: 1px solid rgba(151, 216, 244, 0.3);
  border-radius: 12px;
  background: rgba(8, 40, 58, 0.62);
  color: #e0f5ff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.58rem 0.62rem 0.58rem 1.04rem;
  text-align: left;
  box-shadow: none;
  transform: none;
}

.telemetry-chip::before {
  content: "";
  position: absolute;
  left: 0.53rem;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.3);
}

.telemetry-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(5, 22, 35, 0.36);
}

.telemetry-chip:active {
  transform: translateY(0);
}

.telemetry-chip.is-active {
  border-color: rgba(180, 233, 255, 0.88);
  background: rgba(12, 58, 82, 0.84);
  box-shadow: inset 0 0 0 1px rgba(180, 233, 255, 0.5);
}

.telemetry-chip.is-active::before {
  box-shadow: 0 0 0 6px rgba(180, 233, 255, 0.16);
}

.telemetry-chip[data-metric-key="temp"]::before {
  background: var(--accent-temp);
}

.telemetry-chip[data-metric-key="humid"]::before {
  background: var(--accent-humidity);
}

.telemetry-chip[data-metric-key="press"]::before {
  background: var(--accent-pressure);
}

.telemetry-chip[data-metric-key="curr_avg"]::before {
  background: var(--accent-current-avg);
}

.telemetry-chip[data-metric-key="co"]::before {
  background: var(--accent-co);
}

.telemetry-chip[data-metric-key="rms_sound"]::before {
  background: var(--accent-rms);
}

button {
  border: none;
  border-radius: 12px;
  background: linear-gradient(120deg, #0d7d7b 0%, #0a4f69 100%);
  color: #f9fffd;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.72rem 0.85rem;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(10, 79, 105, 0.26);
}

button:active {
  transform: translateY(0);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot--online {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45);
  animation: pulse 1.8s infinite;
}

.status-dot--offline {
  background: var(--bad);
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: 2rem;
}

.layout > .card {
  grid-column: span 4;
}

.layout > .card--wide {
  grid-column: span 8;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.9rem;
}

h2 {
  margin: 0;
  font-size: 1.16rem;
  letter-spacing: -0.01em;
}

.label {
  margin: 0;
  color: #21506a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.small {
  margin: 0;
  font-size: 0.8rem;
  color: #2f5368;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

.metric-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.metric-card {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(12, 48, 69, 0.1);
  border-radius: 16px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  min-height: 174px;
  border-top-width: 5px;
}

.metric-card--temp {
  border-top-color: var(--accent-temp);
}

.metric-card--humid {
  border-top-color: var(--accent-humidity);
}

.metric-card--press {
  border-top-color: var(--accent-pressure);
}

.metric-card--curr-avg {
  border-top-color: var(--accent-current-avg);
}

.metric-card--co {
  border-top-color: var(--accent-co);
}

.metric-card--rms {
  border-top-color: var(--accent-rms);
}

.metric-value {
  margin: 0;
  font-family: "Syne", "Space Grotesk", sans-serif;
  font-size: 1.38rem;
  letter-spacing: -0.02em;
}

.meter {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(12, 48, 69, 0.12);
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 180ms ease;
}

.metric-card--temp .meter span {
  background: var(--accent-temp);
}

.metric-card--humid .meter span {
  background: var(--accent-humidity);
}

.metric-card--press .meter span {
  background: var(--accent-pressure);
}

.metric-card--curr-avg .meter span {
  background: var(--accent-current-avg);
}

.metric-card--co .meter span {
  background: var(--accent-co);
}

.metric-card--rms .meter span {
  background: var(--accent-rms);
}

.sparkline {
  margin-top: auto;
  width: 100% !important;
  height: 64px !important;
}

.meta-grid {
  margin: 0.9rem 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.meta-grid div {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(12, 48, 69, 0.09);
  border-radius: 12px;
  padding: 0.72rem;
}

dt {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3a6277;
}

dd {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.sampling-list {
  margin: 0.8rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.5rem;
  color: #173f56;
  line-height: 1.36;
  font-size: 0.9rem;
}

.sampling-list li {
  padding-left: 0.1rem;
}

.message-feed {
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.52rem;
  max-height: 346px;
  overflow: auto;
}

.message-feed li {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.79rem;
  line-height: 1.45;
  color: #14384d;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(12, 48, 69, 0.14);
  border-radius: 10px;
  padding: 0.5rem 0.55rem;
}

.message-feed li.error {
  color: #7f1d1d;
  border-color: rgba(220, 38, 38, 0.38);
  background: rgba(220, 38, 38, 0.08);
}

.footer {
  position: relative;
  z-index: 1;
  padding: 0.2rem 0 1.8rem;
  color: #35566b;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: reveal 720ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 {
  animation-delay: 70ms;
}

.delay-2 {
  animation-delay: 170ms;
}

.delay-3 {
  animation-delay: 260ms;
}

.delay-4 {
  animation-delay: 340ms;
}

@keyframes floatOne {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(22px, -16px, 0);
  }
}

@keyframes floatTwo {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-24px, 14px, 0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.44);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(22, 163, 74, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
  }
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .layout > .card,
  .layout > .card--wide {
    grid-column: span 12;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .telemetry-chip-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .telemetry-stage,
  #telemetryScene {
    min-height: 330px;
    height: 330px;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(1160px, 94vw);
  }

  h1 {
    line-height: 1.12;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .telemetry-focus {
    left: 0.72rem;
    top: 0.72rem;
    max-width: calc(100% - 1.44rem);
  }

  .telemetry-chip-row {
    grid-template-columns: 1fr;
  }

  .telemetry-stage,
  #telemetryScene {
    min-height: 294px;
    height: 294px;
  }
}
