:root {
  --bg: #040a12;
  --bg-soft: rgba(4, 20, 32, 0.72);
  --panel: #071c31cc;
  --panel-strong: rgba(4, 18, 30, 0.92);
  --line: #23e7ff;
  --line-soft: rgba(35, 231, 255, 0.18);
  --line-mid: rgba(35, 231, 255, 0.32);
  --text: #b9fbff;
  --text-dim: #87e9ff;
  --accent: #2ff3ff;
  --accent2: #11b6ff;
  --warn: #ffd166;
  --hot: #ff5c7a;
  --good: #68ffa2;
  --shadow: 0 0 10px rgba(47, 243, 255, 0.20), 0 0 22px rgba(17, 182, 255, 0.14);
  --radius-cut: polygon(
    0 8px,
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px)
  );
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  font-family: "Segoe UI", "Roboto Condensed", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% 55%, rgba(35, 231, 255, 0.08), transparent 26%),
    radial-gradient(circle at 10% 10%, rgba(35, 231, 255, 0.05), transparent 22%),
    linear-gradient(180deg, #02060d, #03111d 50%, #02070d 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
  mix-blend-mode: screen;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.035) 0 1px,
    transparent 1px 3px
  );
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 8999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.065) 2px,
    rgba(0, 0, 0, 0.065) 4px
  );
}

.scan-beam {
  position: fixed;
  left: 0;
  right: 0;
  top: -3px;
  height: 3px;
  z-index: 8998;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 229, 255, 0.07),
    transparent
  );
  animation: scandown 8s linear infinite;
}

@keyframes scandown {
  from { top: -3px; }
  to { top: 100vh; }
}

.hud {
  height: 100vh;
  padding: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1.1fr 2.2fr 1.1fr;
  grid-template-rows: 82px 1fr 110px;
}

.panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(4, 20, 32, 0.78), rgba(2, 12, 22, 0.68));
  border: 1px solid rgba(35, 231, 255, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), var(--shadow);
  clip-path: var(--radius-cut);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--line-soft);
  pointer-events: none;
}

.header {
  grid-column: 1 / 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: linear-gradient(
    90deg,
    rgba(35, 231, 255, 0.08),
    rgba(35, 231, 255, 0.02) 22%,
    rgba(35, 231, 255, 0.08) 50%,
    rgba(35, 231, 255, 0.02) 78%,
    rgba(35, 231, 255, 0.08)
  );
}

.title {
  font-size: 28px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 14px rgba(47, 243, 255, 0.35);
}

.sub {
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 1px;
  opacity: 0.92;
}

.smallstat {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 14px;
}

.smallstat .block {
  min-width: 92px;
  padding: 10px 12px;
  text-align: center;
  border: 1px solid rgba(35, 231, 255, 0.24);
  background: rgba(35, 231, 255, 0.05);
  box-shadow: inset 0 0 10px rgba(35, 231, 255, 0.04);
}

.left {
  display: grid;
  gap: 10px;
  min-width: 0;
  grid-template-rows: 165px 1fr;
}

.center {
  display: grid;
  gap: 10px;
  min-width: 0;
  grid-template-rows: 1fr 185px;
}

.right {
  display: grid;
  gap: 10px;
  min-width: 0;
  grid-template-rows: 160px 1fr;
}

.footer {
  grid-column: 1 / 4;
  display: grid;
  gap: 10px;
  grid-template-columns: 1.3fr 1fr 1.3fr;
}

.ringwrap {
  display: grid;
  place-items: center;
  padding: 8px 12px 6px;
}

/* THERMAL CORE */

.hero-panel {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 10px 12px 4px;
  position: relative;
}

.hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  margin-bottom: 2px;
}

.hero-title {
  color: rgba(185, 251, 255, 0.9);
  font-size: 11px;
  letter-spacing: 4px;
}

.hero-lights {
  display: flex;
  gap: 10px;
  align-items: center;
}

.status-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(120, 160, 180, 0.16);
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  opacity: 0.45;
}

.status-light.active.good,
.status-light.active.warn,
.status-light.active.hot {
  opacity: 1;
  animation: lampPulse 1.8s ease-in-out infinite;
}

.status-light.good.active {
  background: #68ffa2;
  box-shadow: 0 0 10px rgba(104, 255, 162, 0.75), 0 0 18px rgba(104, 255, 162, 0.35);
}

.status-light.warn.active {
  background: #ffd166;
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.75), 0 0 18px rgba(255, 209, 102, 0.35);
}

.status-light.hot.active {
  background: #ff5c7a;
  box-shadow: 0 0 10px rgba(255, 92, 122, 0.8), 0 0 18px rgba(255, 92, 122, 0.4);
  animation: lampPulse 0.9s ease-in-out infinite;
}

@keyframes lampPulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.08);
    filter: brightness(1.28);
  }
}

.hero-gauge {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.hero-arc-bg {
  fill: none;
  stroke-linecap: round;
}

.hero-arc-outer {
  stroke: rgba(135, 249, 255, 0.26);
  stroke-width: 4;
}

.hero-arc-mid {
  stroke: rgba(135, 249, 255, 0.42);
  stroke-width: 4;
}

.hero-arc-inner {
  stroke: rgba(135, 249, 255, 0.16);
  stroke-width: 3;
}

.hero-arc-value {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.hero-sweep {
  stroke: rgba(160, 250, 255, 0.75);
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.82;
}

.hero-hub {
  fill: rgba(220, 245, 255, 0.92);
  stroke: rgba(35, 231, 255, 0.28);
  stroke-width: 2;
}

.hero-temp {
  font-size: 40px;
  font-weight: 700;
  fill: #8eefff;
}

.hero-label {
  font-size: 10px;
  letter-spacing: 2px;
  fill: rgba(185, 251, 255, 0.72);
}

.hero-tick {
  stroke: rgba(185, 251, 255, 0.5);
  stroke-width: 2;
  stroke-linecap: round;
}

.thermo,
.rightpanel,
.statlist {
  padding: 14px 16px;
}

.thermo {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thermo .row,
.rightpanel .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.panel-head {
  margin-bottom: 4px;
}

.bar {
  height: 14px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(35, 231, 255, 0.24);
  background: rgba(35, 231, 255, 0.08);
}

.bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, #1eb3ff, #44fff6);
  box-shadow: 0 0 14px rgba(47, 243, 255, 0.32);
}

.drives {
  padding: 10px;
  display: grid;
  gap: 10px;
  align-content: start;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.drive {
  min-height: 112px;
  position: relative;
  overflow: hidden;
  padding: 10px;
  background: linear-gradient(180deg, rgba(5, 22, 35, 0.92), rgba(4, 15, 27, 0.82));
  border: 1px solid rgba(35, 231, 255, 0.32);
  box-shadow: inset 0 0 20px rgba(35, 231, 255, 0.02);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.drive::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, rgba(47, 243, 255, 0.15), rgba(47, 243, 255, 0.85), rgba(47, 243, 255, 0.15));
}

.drive.elevated .slot-edge,
.drive.warm .slot-edge,
.drive.hot .slot-edge {
  opacity: 1;
}

.drive.elevated .slot-edge {
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.15), rgba(255, 209, 102, 0.8), rgba(255, 209, 102, 0.15));
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.28);
}

.drive.warm .slot-edge {
  background: linear-gradient(180deg, rgba(255, 179, 71, 0.15), rgba(255, 179, 71, 0.9), rgba(255, 179, 71, 0.15));
  box-shadow: 0 0 10px rgba(255, 179, 71, 0.35);
}

.drive.hot .slot-edge {
  background: linear-gradient(180deg, rgba(255, 92, 122, 0.16), rgba(255, 92, 122, 0.95), rgba(255, 92, 122, 0.16));
  box-shadow: 0 0 12px rgba(255, 92, 122, 0.45);
}

.drive.warm {
  animation: driveWarmPulse 3.2s ease-in-out infinite;
}

.drive.hot {
  animation: driveHotPulse 1.4s ease-in-out infinite;
}

@keyframes driveWarmPulse {
  0%, 100% {
    box-shadow: inset 0 0 20px rgba(35, 231, 255, 0.02), 0 0 0 rgba(255, 179, 71, 0);
    border-color: rgba(35, 231, 255, 0.32);
  }
  50% {
    box-shadow: inset 0 0 20px rgba(35, 231, 255, 0.02), 0 0 12px rgba(255, 179, 71, 0.22);
    border-color: rgba(255, 179, 71, 0.5);
  }
}

@keyframes driveHotPulse {
  0%, 100% {
    box-shadow: inset 0 0 20px rgba(35, 231, 255, 0.02), 0 0 0 rgba(255, 92, 122, 0);
    border-color: rgba(255, 92, 122, 0.45);
  }
  50% {
    box-shadow: inset 0 0 20px rgba(35, 231, 255, 0.02), 0 0 18px rgba(255, 92, 122, 0.35);
    border-color: rgba(255, 92, 122, 0.82);
  }
}

.slot-edge {
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 2px;
  opacity: 0.45;
  background: linear-gradient(180deg, rgba(47, 243, 255, 0.12), rgba(47, 243, 255, 0.65), rgba(47, 243, 255, 0.12));
  box-shadow: 0 0 6px rgba(47, 243, 255, 0.22);
  animation: slotEdgeFlow 3s ease-in-out infinite;
}

@keyframes slotEdgeFlow {
  0%, 100% {
    transform: scaleY(0.92);
    filter: brightness(1);
  }
  50% {
    transform: scaleY(1);
    filter: brightness(1.25);
  }
}

/* blinking corner alert markers */

.corner-marker {
  position: absolute;
  width: 12px;
  height: 12px;
  opacity: 0;
  pointer-events: none;
}

.corner-marker::before,
.corner-marker::after {
  content: "";
  position: absolute;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.corner-marker.tl { top: 6px; left: 6px; }
.corner-marker.tr { top: 6px; right: 6px; }
.corner-marker.bl { bottom: 6px; left: 6px; }
.corner-marker.br { bottom: 6px; right: 6px; }

.corner-marker.tl::before,
.corner-marker.tr::before,
.corner-marker.bl::before,
.corner-marker.br::before {
  width: 10px;
  height: 2px;
}

.corner-marker.tl::after,
.corner-marker.tr::after,
.corner-marker.bl::after,
.corner-marker.br::after {
  width: 2px;
  height: 10px;
}

.corner-marker.tl::before,
.corner-marker.bl::before { left: 0; top: 0; }

.corner-marker.tr::before,
.corner-marker.br::before { right: 0; top: 0; }

.corner-marker.tl::after,
.corner-marker.tr::after { top: 0; left: 0; }

.corner-marker.bl::after,
.corner-marker.br::after { bottom: 0; left: 0; }

.drive.warm .corner-marker,
.drive.hot .corner-marker {
  opacity: 1;
}

.drive.warm .corner-marker {
  color: #ffb347;
  animation: markerBlinkWarm 1.8s ease-in-out infinite;
}

.drive.hot .corner-marker {
  color: #ff5c7a;
  animation: markerBlinkHot 0.8s ease-in-out infinite;
}

@keyframes markerBlinkWarm {
  0%, 100% {
    opacity: 0.35;
    filter: brightness(1);
  }
  50% {
    opacity: 1;
    filter: brightness(1.25);
  }
}

@keyframes markerBlinkHot {
  0%, 100% {
    opacity: 0.45;
    filter: brightness(1);
  }
  50% {
    opacity: 1;
    filter: brightness(1.5);
  }
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 2px;
  color: #9befff;
  opacity: 0.92;
}

.label {
  margin-top: 10px;
  min-height: 40px;
  font-size: 15px;
  line-height: 1.25;
  color: #d7fdff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tempwrap {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  align-items: end;
  grid-template-columns: 82px 1fr;
}

.temp {
  font-size: 38px;
  line-height: 1;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 16px rgba(47, 243, 255, 0.25);
}

.drive.hot .temp {
  color: var(--hot);
  text-shadow: 0 0 16px rgba(255, 92, 122, 0.22);
}

.drive.warm .temp,
.drive.elevated .temp {
  color: var(--warn);
  text-shadow: 0 0 16px rgba(255, 209, 102, 0.18);
}

.thermobar {
  height: 22px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(35, 231, 255, 0.26);
  background: rgba(35, 231, 255, 0.08);
}

.thermobar span {
  display: block;
  height: 100%;
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.gridbars {
  height: 120px;
  margin-top: 4px;
  display: grid;
  gap: 6px;
  align-items: end;
  grid-template-columns: repeat(12, 1fr);
}

.gridbars .col {
  min-height: 10px;
  border: 1px solid rgba(35, 231, 255, 0.18);
  background: linear-gradient(180deg, rgba(47, 243, 255, 0.82), rgba(47, 243, 255, 0.12));
  box-shadow: 0 0 10px rgba(47, 243, 255, 0.15);
  animation: barPulse 2.8s ease-in-out infinite;
  transform-origin: bottom center;
}

.gridbars .col:nth-child(odd) {
  animation-duration: 3.4s;
}

.gridbars .col:nth-child(3n) {
  animation-duration: 2.2s;
}

@keyframes barPulse {
  0%, 100% {
    filter: brightness(0.95);
    box-shadow: 0 0 8px rgba(47, 243, 255, 0.12);
  }
  50% {
    filter: brightness(1.18);
    box-shadow: 0 0 14px rgba(47, 243, 255, 0.24);
  }
}

.fan-dials {
  display: grid;
  gap: 10px;
  align-items: stretch;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fan-dial {
  min-height: 150px;
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 10px;
  background: linear-gradient(180deg, rgba(5, 22, 35, 0.92), rgba(4, 15, 27, 0.82));
  border: 1px solid rgba(35, 231, 255, 0.28);
  position: relative;
  overflow: hidden;
}

.fan-dial::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(47, 243, 255, 0.7), transparent);
  animation: dialSweep 2.6s linear infinite;
  opacity: 0.55;
}

@keyframes dialSweep {
  0% {
    transform: translateX(-60%);
    opacity: 0.2;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    transform: translateX(60%);
    opacity: 0.2;
  }
}

.fan-dial svg {
  width: 100%;
  max-width: 110px;
  height: auto;
  display: block;
}

.fan-name {
  font-size: 12px;
  letter-spacing: 1px;
  color: #7cefff;
}

.fan-rpm {
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(47, 243, 255, 0.20);
}

.fan-mode-tag {
  font-size: 11px;
  letter-spacing: 1px;
}

.statlist {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  font-size: 14px;
}

.statlist .item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(35, 231, 255, 0.12);
}

.psu-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.psu-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  min-width: 98px;
  justify-content: center;
  border: 1px solid rgba(35, 231, 255, 0.16);
  background: rgba(35, 231, 255, 0.04);
}

.psu-node.ok {
  color: var(--good);
}

.psu-node.fail {
  color: var(--hot);
}

.psu-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.08);
}

.psu-dot.ok {
  background: #68ffa2;
  box-shadow: 0 0 10px rgba(104, 255, 162, 0.75), 0 0 18px rgba(104, 255, 162, 0.35);
  animation: lampPulse 2.4s ease-in-out infinite;
}

.psu-dot.fail {
  background: #ff5c7a;
  box-shadow: 0 0 10px rgba(255, 92, 122, 0.9), 0 0 20px rgba(255, 92, 122, 0.45);
  animation: beaconFault 0.8s ease-in-out infinite;
}

@keyframes beaconFault {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.18);
    filter: brightness(1.4);
  }
}

.footerpanel {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
}

.mono {
  font-family: Consolas, "SFMono-Regular", monospace;
}

.muted {
  opacity: 0.78;
}

.accent {
  color: var(--accent);
}

.good {
  color: var(--good);
}

.warn {
  color: var(--warn);
}

.hotc {
  color: var(--hot);
}

.loading,
.empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: #87e9ff;
  letter-spacing: 1px;
  font-size: 18px;
  opacity: 0.9;
}

.clockwrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* status dot */

#clockDot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(104,255,162,0.25);
  box-shadow: 0 0 0 rgba(104,255,162,0);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

/* glow pulse on clock */

#updated.clock-pulse {
  text-shadow:
    0 0 6px rgba(47,243,255,.7),
    0 0 16px rgba(47,243,255,.4);
  transform: scale(1.05);
}

/* dot flash */

#clockDot.flash {
  background: #68ffa2;
  box-shadow:
    0 0 8px rgba(104,255,162,.9),
    0 0 16px rgba(104,255,162,.45);
  transform: scale(1.6);
}

@media (max-width: 1024px) {
  .hud {
    grid-template-columns: 0.95fr 2.4fr 0.95fr;
  }

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

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

  .left {
    grid-template-rows: 155px 1fr;
  }

  .center {
    grid-template-rows: 1fr 260px;
  }
}

@media (max-width: 800px) {
  .hud {
    grid-template-columns: 1fr;
    grid-template-rows: 76px auto auto auto 96px;
    overflow: auto;
    height: auto;
    min-height: 100vh;
  }

  .header,
  .footer {
    grid-column: auto;
  }

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

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

  .center {
    grid-template-rows: auto auto;
  }

  html,
  body {
    overflow: auto;
  }
}
