:root {
  color-scheme: dark;
  --bg: #090706;
  --panel: rgba(25, 18, 16, 0.88);
  --panel-strong: #1d1512;
  --line: rgba(255, 143, 76, 0.16);
  --text: #f8eee8;
  --muted: #aa9690;
  --ember: #ff5a2f;
  --lava: #ff8a3d;
  --green: #55d68b;
  --red: #ff625f;
  --blue: #5c9dff;
  --white: #e8e7e5;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 80% -10%, rgba(190, 52, 16, 0.24), transparent 35rem),
    linear-gradient(180deg, #0f0a08 0%, var(--bg) 55%, #070606 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.7;
  background-image:
    linear-gradient(rgba(255, 111, 45, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 111, 45, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 8% 82%, rgba(255, 69, 24, 0.22) 0 1px, transparent 2px),
    radial-gradient(circle at 24% 65%, rgba(255, 148, 76, 0.18) 0 1px, transparent 2px),
    radial-gradient(circle at 65% 78%, rgba(255, 94, 37, 0.16) 0 1px, transparent 2px);
  background-size: 54px 54px, 54px 54px, 210px 210px, 270px 270px, 330px 330px;
  mask-image: linear-gradient(to bottom, black, rgba(0, 0, 0, 0.35));
}

a {
  color: inherit;
}

main,
footer {
  width: min(1440px, 90vw);
  margin-inline: auto;
}

.hero {
  padding: 64px 0 52px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 9px;
  color: #dd7146;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

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

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.4rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  letter-spacing: -0.025em;
}

.section-heading,
.chart-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 20px;
}

.section-heading > p {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.83rem;
}

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

.team-card {
  position: relative;
  min-height: 270px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(33, 24, 21, 0.94), rgba(18, 14, 13, 0.92));
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.team-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--team-color);
  content: "";
  opacity: 0.72;
}

.team-card:hover,
.team-card:focus-visible {
  border-color: color-mix(in srgb, var(--team-color) 48%, transparent);
  outline: none;
  transform: translateY(-3px);
}

.team-card.selected {
  border-color: color-mix(in srgb, var(--team-color) 66%, transparent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--team-color) 9%, #211815), rgba(18, 14, 13, 0.95));
}

.team-card.blue { --team-color: var(--blue); }
.team-card.green { --team-color: var(--green); }
.team-card.red { --team-color: var(--red); }
.team-card.white { --team-color: var(--white); }

.card-top,
.metric-row,
.last-seen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team-name {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.status-badge {
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.status-badge.online {
  border-color: rgba(85, 214, 139, 0.2);
  background: rgba(85, 214, 139, 0.1);
  color: #72e6a4;
}

.status-badge.offline {
  border-color: rgba(255, 98, 95, 0.2);
  background: rgba(255, 98, 95, 0.09);
  color: #ff8b87;
}

.temperature {
  margin: 30px 0 5px;
  font-size: clamp(2.25rem, 4vw, 3.4rem);
  font-weight: 760;
  letter-spacing: -0.06em;
  line-height: 1;
}

.metric-row {
  justify-content: flex-start;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-row span {
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.metric-row span:last-child {
  padding-right: 0;
  border-right: 0;
}

.last-seen {
  position: absolute;
  right: 22px;
  bottom: 21px;
  left: 22px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 0.72rem;
}

.last-seen strong {
  color: #d5c6c0;
  font-weight: 600;
  text-align: right;
}

.chart-panel {
  margin: 62px 0 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(29, 20, 17, 0.93), rgba(14, 11, 10, 0.94));
  box-shadow: var(--shadow);
}

.chart-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 8px;
}

.chart-stat-row > div {
  min-width: 90px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
}

.chart-stat-row span,
.chart-stat-row strong {
  display: block;
}

.chart-stat-row span {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.64rem;
  text-transform: uppercase;
}

.chart-stat-row strong {
  font-size: 0.94rem;
}

.chart-wrap {
  position: relative;
  height: 390px;
}

#temperature-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.chart-empty[hidden] {
  display: none;
}

.chart-empty span {
  color: var(--ember);
  font-size: 2rem;
}

.chart-empty strong,
.chart-empty small {
  display: block;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 134, 72, 0.3);
  border-radius: 10px;
  background: rgba(16, 11, 9, 0.95);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.76rem;
  pointer-events: none;
}

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}

.chart-tooltip span {
  margin-top: 2px;
  color: var(--muted);
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 30px 0 40px;
  color: #776964;
  font-size: 0.76rem;
}

footer a {
  color: #bf9d8f;
  text-underline-offset: 3px;
}

.footer-note {
  color: #8d6254;
  font-style: italic;
}

@media (max-width: 1050px) {
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  main,
  footer {
    width: min(92vw, 1440px);
  }

  .hero {
    padding: 46px 0 42px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.5rem;
  }

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

  .team-card {
    min-height: 245px;
  }

  .chart-panel {
    margin-top: 45px;
    padding: 20px 14px;
  }

  .chart-stat-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-stat-row > div {
    min-width: 0;
  }

  .chart-wrap {
    height: 330px;
  }

  footer {
    align-items: start;
    flex-direction: column;
    gap: 0.45rem;
  }
}

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