:root {
  --hcm-night: #07100f;
  --hcm-night-blue: #09131b;
  --hcm-deep: #0d1917;
  --hcm-panel: rgba(16, 30, 28, 0.91);
  --hcm-panel-blue: rgba(16, 29, 40, 0.9);
  --hcm-panel-solid: #12211f;
  --hcm-line: rgba(171, 211, 202, 0.15);
  --hcm-line-strong: rgba(171, 211, 202, 0.29);
  --hcm-cream: #f1ead8;
  --hcm-muted: #aebcb5;
  --hcm-cyan: #69c9d4;
  --hcm-cyan-soft: #a9dce0;
  --hcm-green: #7fc49d;
  --hcm-gold: #d0ae65;
  --hcm-pink: #d27fa0;

  --bg: var(--hcm-night);
  --bg-deep: var(--hcm-night-blue);
  --bg-alt: var(--hcm-deep);
  --panel: var(--hcm-panel);
  --panel-strong: var(--hcm-panel-solid);
  --panel-soft: rgba(105, 201, 212, 0.08);
  --line: var(--hcm-line);
  --line-strong: var(--hcm-line-strong);
  --text: var(--hcm-cream);
  --muted: var(--hcm-muted);
  --muted-strong: #d4ddd7;
  --accent: var(--hcm-cyan);
  --accent-strong: var(--hcm-cyan-soft);
  --good: var(--hcm-green);
  --good-glow: rgba(127, 196, 157, 0.35);
  --fair: var(--hcm-gold);
  --fair-glow: rgba(208, 174, 101, 0.33);
  --poor: var(--hcm-pink);
  --poor-glow: rgba(210, 127, 160, 0.33);
  --shadow: 0 25px 70px rgba(0, 0, 0, 0.34);
  --radius-xl: 18px;
  --radius-lg: 15px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --font-sans: Inter, "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(58, 131, 138, 0.22), transparent 31rem),
    radial-gradient(circle at 88% 14%, rgba(50, 89, 128, 0.2), transparent 27rem),
    linear-gradient(145deg, var(--hcm-night), var(--hcm-night-blue) 52%, #08110e);
  color: var(--hcm-cream);
}

body::before {
  display: block;
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("/hcm-topo.svg");
  background-repeat: repeat;
  background-size: 1100px 700px;
  opacity: 0.16;
  mask-image: linear-gradient(to bottom, black, rgba(0, 0, 0, 0.5) 70%, transparent);
  animation: hcm-topo-drift 55s linear infinite;
}

body::after {
  display: block;
  z-index: -1;
  background:
    radial-gradient(circle at 25% 28%, rgba(105, 201, 212, 0.08), transparent 23rem),
    radial-gradient(circle at 75% 68%, rgba(127, 196, 157, 0.06), transparent 27rem);
  opacity: 1;
  filter: none;
}

.screen-glow {
  right: -8rem;
  bottom: -12rem;
  width: 38rem;
  height: 38rem;
  background:
    repeating-radial-gradient(
      circle,
      rgba(105, 201, 212, 0.11) 0 1px,
      transparent 1px 34px
    );
  opacity: 0.62;
  filter: blur(0);
  animation: hcm-radar-rotate 42s linear infinite;
}

.splash-scene {
  opacity: 0.32;
}

.splash-scene__grid,
.splash-scene__badge {
  display: none;
}

.splash-scene__ring {
  border-color: rgba(105, 201, 212, 0.16);
}

.hcm-toolbar {
  position: relative;
  z-index: 50;
  border-bottom: 1px solid var(--hcm-line);
  background: rgba(6, 14, 13, 0.84);
  backdrop-filter: blur(17px);
}

.hcm-toolbar__inner {
  display: flex;
  width: min(1380px, calc(100% - 42px));
  min-height: 72px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.hcm-toolbar__brand {
  display: flex;
  min-height: 0;
  align-items: center;
  gap: 11px;
  color: var(--hcm-cream);
  text-decoration: none;
}

.hcm-toolbar__brand img {
  width: 43px;
  height: 43px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(105, 201, 212, 0.22));
}

.hcm-toolbar__brand span {
  display: grid;
  line-height: 1.15;
}

.hcm-toolbar__brand strong {
  font-family: Rockwell, "Roboto Slab", Georgia, serif;
  font-size: 1.02rem;
}

.hcm-toolbar__brand small {
  margin-top: 4px;
  color: var(--hcm-muted);
  font-size: 0.73rem;
}

.hcm-toolbar__nav {
  display: flex;
  align-items: center;
  gap: 3px;
}

.hcm-toolbar__nav a {
  min-height: 0;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--hcm-muted);
  font-size: 0.87rem;
  text-decoration: none;
  transition:
    color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.hcm-toolbar__nav a:hover {
  background: rgba(105, 201, 212, 0.08);
  color: var(--hcm-cream);
}

.hcm-toolbar__nav a.is-active {
  background: rgba(105, 201, 212, 0.11);
  color: var(--hcm-cream);
  box-shadow:
    inset 0 -2px 0 var(--hcm-cyan),
    0 0 20px rgba(105, 201, 212, 0.08);
}

.noc-shell {
  width: min(1380px, calc(100vw - 42px));
  padding-top: 27px;
}

.command-dock,
.toolbar,
.hero-panel,
.glance-card,
.panel,
.detail-drawer {
  border-color: var(--hcm-line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 38%),
    var(--hcm-panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(15px) saturate(115%);
}

.command-dock::before,
.toolbar::before,
.hero-panel::before,
.glance-card::before,
.panel::before,
.detail-drawer::before {
  border-color: rgba(255, 255, 255, 0.035);
  background:
    linear-gradient(
      120deg,
      rgba(105, 201, 212, 0.035),
      transparent 28%,
      rgba(127, 196, 157, 0.02)
    );
}

.hero-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--hcm-line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 8% 4%, rgba(105, 201, 212, 0.11), transparent 30rem),
    radial-gradient(circle at 91% 18%, rgba(52, 94, 135, 0.14), transparent 25rem),
    rgba(10, 21, 23, 0.88);
  box-shadow: var(--shadow);
}

.hero-panel,
.hero-stage__lead,
.hero-stage__brief,
.glance-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.hero-stage__lead {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.hero-stage__lead > :not(.hcm-signal-field) {
  position: relative;
  z-index: 2;
}

.hero-stage__brief {
  border-left: 1px solid var(--hcm-line);
}

.hcm-signal-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.56;
  mask-image: linear-gradient(90deg, transparent 2%, black 35%, black);
}

.hcm-signal-field svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.hcm-route {
  fill: none;
  stroke-linecap: round;
}

.hcm-route--base {
  stroke: rgba(169, 220, 224, 0.18);
  stroke-width: 2;
  stroke-dasharray: 6 11;
}

.hcm-route--moving {
  stroke: var(--hcm-cyan);
  stroke-width: 3;
  stroke-dasharray: 2 28;
  opacity: 0.42;
  animation: hcm-route-idle 8s linear infinite;
}

.hcm-route-node {
  fill: var(--hcm-night);
  stroke-width: 3;
}

.hcm-route-node--source {
  stroke: var(--hcm-gold);
}

.hcm-route-node--hop {
  stroke: var(--hcm-green);
}

.hcm-route-node--observer {
  stroke: var(--hcm-cyan);
}

.hcm-radio-wave {
  position: absolute;
  right: 5%;
  top: 4%;
  width: 10rem;
  height: 10rem;
  border: 1px solid rgba(105, 201, 212, 0.23);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.2);
}

.hcm-radio-wave--two {
  animation-delay: 900ms;
}

.hcm-radio-wave--three {
  animation-delay: 1800ms;
}

.hcm-mqtt-online .hcm-radio-wave {
  animation: hcm-wave-idle 5.4s ease-out infinite;
}

.brand-copy h1,
#hero-title {
  max-width: 760px;
  color: var(--hcm-cream);
  font-family: Rockwell, "Roboto Slab", Georgia, serif;
  font-size: clamp(2.8rem, 5.2vw, 4.8rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.045em;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.32),
    0 0 35px rgba(105, 201, 212, 0.08);
}

.eyebrow,
.panel-label,
.toolbar-label,
.meta-label {
  color: var(--hcm-cyan);
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.dock-lede {
  max-width: 730px;
  color: #c9d3cd;
  font-size: 1rem;
  line-height: 1.65;
}

/* APP_DESCRIPTION already contains the complete instruction. */
.dock-lede #hero-channel,
.dock-lede #hero-description-suffix {
  display: none;
}

.hero-stage__pulse {
  width: fit-content;
  max-width: 560px;
  padding: 10px 13px;
  border: 1px solid rgba(105, 201, 212, 0.14);
  border-radius: 9px;
  background: rgba(7, 17, 18, 0.56);
}

.hero-stage__pulse-dot {
  background: var(--hcm-cyan);
  box-shadow: 0 0 14px rgba(105, 201, 212, 0.7);
}

.toolbar-copy h2,
.panel-header h2,
.health-pocket h2 {
  color: var(--hcm-cream);
  font-family: Rockwell, "Roboto Slab", Georgia, serif;
  text-shadow: none;
}

.toolbar-copy p,
.small-note,
.dock-note,
.metric-label {
  color: var(--hcm-muted);
}

.control-button,
.ghost-button,
.primary-button {
  min-height: 41px;
  border: 1px solid var(--hcm-line-strong);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(17, 34, 33, 0.84);
  color: var(--hcm-cream);
  box-shadow: none;
}

.control-button:hover,
.ghost-button:hover,
.primary-button:hover {
  border-color: rgba(105, 201, 212, 0.57);
  background: rgba(28, 55, 53, 0.9);
  transform: translateY(-1px);
}

.primary-button {
  border-color: rgba(105, 201, 212, 0.7);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), transparent),
    #286b70;
}

.pill,
.status-pill {
  border-color: var(--hcm-line-strong);
  background: rgba(12, 27, 27, 0.76);
  box-shadow: none;
}

.hcm-mqtt-online #mqtt-pill::before {
  box-shadow:
    0 0 0 4px rgba(105, 201, 212, 0.08),
    0 0 17px rgba(105, 201, 212, 0.7);
}

.telemetry-strip {
  border-top: 1px solid var(--hcm-line);
  background:
    linear-gradient(90deg, rgba(105, 201, 212, 0.035), transparent 35%),
    rgba(4, 13, 15, 0.34);
}

.telemetry-strip__item + .telemetry-strip__item {
  border-left-color: var(--hcm-line);
}

.glance-card__value {
  color: var(--hcm-cream);
  font-family: Rockwell, "Roboto Slab", Georgia, serif;
  text-shadow: none;
}

.sparkline span {
  background: rgba(105, 201, 212, 0.28);
}

.panel,
.marquee-panel {
  border-radius: var(--radius-xl);
}

.marquee-panel {
  background:
    radial-gradient(circle at 0% 100%, rgba(127, 196, 157, 0.07), transparent 25rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.018), transparent),
    var(--hcm-panel);
}

.session-code {
  border-color: rgba(105, 201, 212, 0.26);
  border-radius: 11px;
  background:
    linear-gradient(135deg, rgba(105, 201, 212, 0.08), transparent),
    rgba(11, 26, 29, 0.86);
  color: var(--hcm-cream);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 28px rgba(105, 201, 212, 0.05);
}

.health-pocket {
  border-left-color: var(--hcm-line);
}

#health-label {
  color: var(--hcm-cyan);
  text-shadow: 0 0 22px rgba(105, 201, 212, 0.16);
}

.score-ring {
  position: relative;
  filter: drop-shadow(0 0 17px rgba(105, 201, 212, 0.11));
}

.score-ring::before,
.score-ring::after {
  content: "";
  position: absolute;
  inset: 7%;
  border: 1px solid rgba(105, 201, 212, 0.18);
  border-radius: 50%;
  pointer-events: none;
}

.score-ring::after {
  inset: -10%;
  border-color: rgba(105, 201, 212, 0.09);
}

.score-ring__track {
  stroke: rgba(169, 220, 224, 0.13);
}

.score-ring__fill {
  stroke: var(--hcm-cyan);
  filter: drop-shadow(0 0 5px rgba(105, 201, 212, 0.55));
}

body[data-hcm-health="good"] {
  --ring-color: var(--hcm-green);
}

body[data-hcm-health="fair"] {
  --ring-color: var(--hcm-gold);
}

body[data-hcm-health="poor"] {
  --ring-color: var(--hcm-pink);
}

body[data-hcm-health="good"] #health-label,
body[data-hcm-health="good"] .score-ring__fill {
  color: var(--hcm-green);
  stroke: var(--hcm-green);
}

body[data-hcm-health="fair"] #health-label,
body[data-hcm-health="fair"] .score-ring__fill {
  color: var(--hcm-gold);
  stroke: var(--hcm-gold);
}

body[data-hcm-health="poor"] #health-label,
body[data-hcm-health="poor"] .score-ring__fill {
  color: var(--hcm-pink);
  stroke: var(--hcm-pink);
}

.metric-card,
.metric-card.compact {
  border-color: var(--hcm-line);
  background: rgba(5, 15, 16, 0.2);
}

.observer-map {
  filter: saturate(0.82) contrast(1.02);
}

.receipt-card,
.history-item,
.observer-pill,
.observer-badge,
.empty-state {
  border-color: var(--hcm-line);
  background:
    linear-gradient(145deg, rgba(105, 201, 212, 0.025), transparent),
    rgba(13, 29, 28, 0.7);
  box-shadow: none;
}

.panel-divider,
.ledger-divider {
  border-color: var(--hcm-line);
}

.site-footer {
  color: var(--hcm-muted);
}

.site-footer a {
  color: var(--hcm-cyan-soft);
}

/* Real receipt event */
.hcm-receipt-event .hcm-route--moving {
  opacity: 1;
  stroke-width: 5;
  animation: hcm-route-receipt 1.8s cubic-bezier(.2, .75, .2, 1);
}

.hcm-receipt-event .hcm-route-node {
  animation: hcm-node-flash 1.5s ease-out;
}

.hcm-receipt-event .hcm-radio-wave {
  animation: hcm-wave-receipt 1.9s ease-out;
}

.hcm-receipt-event .score-ring {
  animation: hcm-score-arrival 1.3s ease-out;
}

.hcm-receipt-event .marquee-panel {
  animation: hcm-panel-arrival 1.7s ease-out;
}

/* Light mode keeps the same field-instrument character. */
body[data-ui-theme="light"] {
  --hcm-night: #e5e3d7;
  --hcm-night-blue: #d6dedb;
  --hcm-deep: #d8ded5;
  --hcm-panel: rgba(244, 241, 228, 0.93);
  --hcm-panel-blue: rgba(232, 238, 235, 0.94);
  --hcm-panel-solid: #edeadd;
  --hcm-line: rgba(51, 83, 76, 0.16);
  --hcm-line-strong: rgba(51, 83, 76, 0.31);
  --hcm-cream: #1d2925;
  --hcm-muted: #5f6d67;
  --hcm-cyan: #397d84;
  --hcm-cyan-soft: #315f65;
  --hcm-green: #4e7f60;
  --hcm-gold: #8c6b2e;
  --hcm-pink: #9b526c;

  --text: var(--hcm-cream);
  --muted: var(--hcm-muted);
  --muted-strong: #394942;
  --shadow: 0 16px 40px rgba(45, 57, 50, 0.12);
}

body[data-ui-theme="light"] {
  background:
    radial-gradient(circle at 18% 0%, rgba(57, 125, 132, 0.11), transparent 31rem),
    linear-gradient(145deg, #e9e6d8, #dce3df);
}

body[data-ui-theme="light"] .hcm-toolbar {
  background: rgba(235, 233, 220, 0.88);
}

body[data-ui-theme="light"] .dock-lede {
  color: #43514b;
}

@keyframes hcm-topo-drift {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 1100px 0;
  }
}

@keyframes hcm-radar-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes hcm-route-idle {
  to {
    stroke-dashoffset: -120;
  }
}

@keyframes hcm-wave-idle {
  0% {
    opacity: 0;
    transform: scale(0.25);
  }
  18% {
    opacity: 0.3;
  }
  100% {
    opacity: 0;
    transform: scale(1.65);
  }
}

@keyframes hcm-route-receipt {
  0% {
    stroke-dasharray: 1 1000;
    stroke-dashoffset: 0;
  }
  70% {
    stroke-dasharray: 850 1000;
  }
  100% {
    stroke-dasharray: 1000 1000;
    stroke-dashoffset: -80;
  }
}

@keyframes hcm-node-flash {
  0% {
    filter: drop-shadow(0 0 0 transparent);
  }
  35% {
    filter: drop-shadow(0 0 12px var(--hcm-cyan));
  }
  100% {
    filter: drop-shadow(0 0 0 transparent);
  }
}

@keyframes hcm-wave-receipt {
  0% {
    opacity: 0.7;
    transform: scale(0.2);
  }
  100% {
    opacity: 0;
    transform: scale(2.15);
  }
}

@keyframes hcm-score-arrival {
  0% {
    transform: scale(0.94);
    filter: drop-shadow(0 0 0 transparent);
  }
  45% {
    transform: scale(1.055);
    filter: drop-shadow(0 0 23px rgba(105, 201, 212, 0.45));
  }
  100% {
    transform: scale(1);
  }
}

@keyframes hcm-panel-arrival {
  0% {
    box-shadow: var(--shadow);
  }
  40% {
    box-shadow:
      var(--shadow),
      0 0 0 1px rgba(105, 201, 212, 0.35),
      0 0 38px rgba(105, 201, 212, 0.15);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  .screen-glow,
  .hcm-route--moving,
  .hcm-radio-wave,
  .hcm-receipt-event .score-ring,
  .hcm-receipt-event .marquee-panel {
    animation: none !important;
  }
}

@media (max-width: 850px) {
  .hcm-toolbar__inner {
    width: min(100% - 24px, 1380px);
    min-height: auto;
    padding: 13px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .hcm-toolbar__nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .hcm-toolbar__nav a {
    flex: 0 0 auto;
  }

  .noc-shell {
    width: min(100% - 24px, 1380px);
    padding-top: 17px;
  }

  .hero-stage__brief {
    border-top: 1px solid var(--hcm-line);
    border-left: 0;
  }

  .hcm-signal-field {
    opacity: 0.34;
  }

  .brand-copy h1,
  #hero-title {
    font-size: clamp(2.55rem, 12vw, 4rem);
  }
}

@media (max-width: 560px) {
  .hcm-toolbar__brand small {
    display: none;
  }

  .hcm-toolbar__nav a {
    padding-inline: 10px;
  }

  .hero-stage__lead,
  .hero-stage__brief {
    padding: 22px 18px;
  }

  .hcm-signal-field {
    opacity: 0.25;
  }
}
