:root {
  --bg: #02060b;
  --bg-2: #050b12;
  --ink: #eef8fb;
  --ink-soft: #c7d9e0;
  --muted: #78909b;
  --faint: #405560;
  --panel: rgba(5, 11, 18, 0.82);
  --panel-strong: rgba(8, 15, 23, 0.94);
  --panel-soft: rgba(12, 22, 31, 0.66);
  --line: rgba(159, 213, 230, 0.18);
  --line-strong: rgba(159, 213, 230, 0.46);
  --accent: #9edff2;
  --accent-strong: #e4fbff;
  --accent-dim: rgba(158, 223, 242, 0.12);
  --ok: #9edff2;
  --warn: #d7b86b;
  --danger: #e2797f;
  --radius: 8px;
  --shadow: 0 26px 90px rgba(0, 0, 0, 0.56);
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -12%, rgba(158, 223, 242, 0.13), transparent 32vw),
    radial-gradient(circle at 9% 22%, rgba(158, 223, 242, 0.07), transparent 24vw),
    linear-gradient(135deg, #02060b 0%, #071017 46%, #02060b 100%);
  font-family: var(--sans);
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -6;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(158, 223, 242, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(158, 223, 242, 0.028) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.96), transparent 94%);
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.24;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.032) 0,
      rgba(255, 255, 255, 0.032) 1px,
      transparent 1px,
      transparent 5px
    );
  mix-blend-mode: screen;
}

button {
  font: inherit;
}

#matrixCanvas {
  position: fixed;
  inset: 0;
  z-index: -5;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.field-wash,
.scan-layer,
.radar-glow,
.motion-field,
.data-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.field-wash {
  z-index: -4;
  background:
    linear-gradient(115deg, transparent 0 18%, rgba(158, 223, 242, 0.05) 19%, transparent 27%),
    linear-gradient(245deg, transparent 0 58%, rgba(158, 223, 242, 0.04) 59%, transparent 67%);
}

.scan-layer {
  z-index: -3;
  opacity: 0.42;
  background:
    linear-gradient(transparent 0, rgba(158, 223, 242, 0.1) 50%, transparent 100%),
    linear-gradient(90deg, transparent, rgba(158, 223, 242, 0.08), transparent);
  background-size: 100% 190px, 58vw 100%;
  background-position: 0 -190px, -58vw 0;
}

.radar-glow {
  z-index: -2;
  opacity: 0.5;
  background:
    conic-gradient(from 212deg at 51% 37%, transparent 0deg, rgba(158, 223, 242, 0.11) 34deg, transparent 76deg),
    radial-gradient(circle at 51% 37%, transparent 0 13rem, rgba(158, 223, 242, 0.08) 13.1rem, transparent 13.28rem),
    radial-gradient(circle at 51% 37%, rgba(158, 223, 242, 0.08), transparent 28rem);
}

.motion-field {
  z-index: -2;
  overflow: hidden;
}

.motion-field span {
  position: absolute;
  left: -24vw;
  width: 24vw;
  height: 1px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(228, 251, 255, 0.8), transparent);
  box-shadow: 0 0 18px rgba(158, 223, 242, 0.5);
  transform: rotate(-18deg);
}

.motion-field span:nth-child(1) { top: 12%; animation-delay: 0s; }
.motion-field span:nth-child(2) { top: 27%; animation-delay: 1.2s; }
.motion-field span:nth-child(3) { top: 44%; animation-delay: 2.4s; }
.motion-field span:nth-child(4) { top: 61%; animation-delay: 3.6s; }
.motion-field span:nth-child(5) { top: 76%; animation-delay: 4.8s; }
.motion-field span:nth-child(6) { top: 88%; animation-delay: 6s; }

.data-rain {
  z-index: -1;
  overflow: hidden;
  opacity: 0.46;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(228, 251, 255, 0.32);
}

.data-rain span {
  position: absolute;
  top: -40px;
  text-shadow: 0 0 12px rgba(158, 223, 242, 0.42);
  writing-mode: vertical-rl;
}

.data-rain span:nth-child(1) { left: 8%; animation-delay: 0.2s; }
.data-rain span:nth-child(2) { left: 24%; animation-delay: 1.6s; }
.data-rain span:nth-child(3) { left: 39%; animation-delay: 3.1s; }
.data-rain span:nth-child(4) { right: 34%; animation-delay: 0.8s; }
.data-rain span:nth-child(5) { right: 18%; animation-delay: 2.3s; }
.data-rain span:nth-child(6) { right: 7%; animation-delay: 4.1s; }

.viewport-frame {
  position: fixed;
  inset: 14px;
  z-index: 40;
  pointer-events: none;
}

.viewport-frame span {
  position: absolute;
  width: 42px;
  height: 42px;
  border-color: rgba(158, 223, 242, 0.36);
  opacity: 0.7;
}

.viewport-frame::before,
.viewport-frame::after {
  position: absolute;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(228, 251, 255, 0.72), transparent);
}

.viewport-frame::before {
  top: 0;
  left: 6vw;
  width: 18vw;
  height: 1px;
}

.viewport-frame::after {
  right: 6vw;
  bottom: 0;
  width: 18vw;
  height: 1px;
}

.viewport-frame span:nth-child(1) {
  top: 0;
  left: 0;
  border-top: 1px solid;
  border-left: 1px solid;
}

.viewport-frame span:nth-child(2) {
  top: 0;
  right: 0;
  border-top: 1px solid;
  border-right: 1px solid;
}

.viewport-frame span:nth-child(3) {
  right: 0;
  bottom: 0;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.viewport-frame span:nth-child(4) {
  bottom: 0;
  left: 0;
  border-bottom: 1px solid;
  border-left: 1px solid;
}

.control-shell {
  width: min(1680px, calc(100% - 32px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 14px 0 28px;
}

.command-bar,
.telemetry-strip,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.065), transparent 34%),
    linear-gradient(180deg, rgba(12, 22, 31, 0.84), rgba(4, 10, 16, 0.84));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(22px) saturate(128%);
  -webkit-backdrop-filter: blur(22px) saturate(128%);
}

.command-bar {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 10px;
}

.brand,
.command-actions {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 13px;
}

.command-actions {
  gap: 10px;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border: 1px solid rgba(158, 223, 242, 0.5);
  border-radius: var(--radius);
  color: #061018;
  background:
    linear-gradient(135deg, var(--accent-strong), var(--accent) 58%, #6baec2),
    #9edff2;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    0 0 28px rgba(158, 223, 242, 0.18);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 900;
}

.brand-mark::before,
.brand-mark::after,
.brand-mark i {
  position: absolute;
  content: "";
  pointer-events: none;
}

.brand-mark::before {
  inset: 6px;
  border: 1px solid rgba(2, 6, 11, 0.34);
  border-radius: 6px;
}

.brand-mark::after {
  width: 120%;
  height: 1px;
  background: rgba(2, 6, 11, 0.32);
  transform: rotate(-24deg);
}

.brand-mark i {
  inset: -10px;
  border: 1px solid rgba(158, 223, 242, 0.32);
  border-radius: 10px;
}

.brand-mark span {
  position: relative;
  z-index: 1;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  overflow: hidden;
  color: var(--accent-strong);
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 850;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-grid;
  place-items: center;
  min-width: 118px;
  min-height: 40px;
  border: 1px solid rgba(158, 223, 242, 0.24);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--accent-strong);
  background: rgba(158, 223, 242, 0.07);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

.status-pill[data-tone="ok"] {
  border-color: rgba(158, 223, 242, 0.48);
  color: var(--ok);
  background: rgba(158, 223, 242, 0.1);
}

.status-pill[data-tone="busy"] {
  border-color: rgba(215, 184, 107, 0.44);
  color: var(--warn);
  background: rgba(215, 184, 107, 0.08);
}

.status-pill[data-tone="warn"] {
  border-color: rgba(226, 121, 127, 0.5);
  color: var(--danger);
  background: rgba(226, 121, 127, 0.08);
}

.primary-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 126px;
  min-height: 42px;
  overflow: hidden;
  border: 1px solid rgba(228, 251, 255, 0.5);
  border-radius: var(--radius);
  padding: 10px 18px;
  color: #051018;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), transparent 52%),
    linear-gradient(135deg, var(--accent-strong), var(--accent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 14px 44px rgba(158, 223, 242, 0.16);
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.primary-button::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.82) 48%, transparent 56%);
  transform: translateX(-140%);
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 18px 54px rgba(158, 223, 242, 0.24);
}

.primary-button:active {
  transform: translateY(0) scale(0.98);
}

.primary-button:focus-visible {
  outline: 2px solid rgba(228, 251, 255, 0.9);
  outline-offset: 3px;
}

.primary-button:hover::before,
.primary-button.is-loading::before {
  animation: sweep 1.05s ease-in-out infinite;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.78;
  transform: none;
}

.telemetry-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
  background: rgba(158, 223, 242, 0.12);
}

.telemetry-strip div {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 13px 15px;
  background:
    linear-gradient(135deg, rgba(158, 223, 242, 0.06), transparent),
    rgba(5, 11, 18, 0.84);
}

.telemetry-strip div::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0 42%, rgba(228, 251, 255, 0.12) 50%, transparent 58% 100%);
  transform: translateX(-120%);
}

.telemetry-strip span,
.panel-head span,
.panel-head em,
.confidence span,
.vote-board > span {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
}

.telemetry-strip strong {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: clamp(14px, 1.3vw, 18px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cockpit-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.86fr) minmax(520px, 1.42fr) minmax(330px, 0.9fr);
  gap: 12px;
  margin-top: 12px;
}

.left-rail,
.core-stage,
.right-rail {
  display: grid;
  align-content: start;
  gap: 12px;
}

.panel {
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.panel::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(158, 223, 242, 0.52), transparent 20%, transparent 80%, rgba(158, 223, 242, 0.34)) top / 100% 1px no-repeat,
    linear-gradient(90deg, rgba(158, 223, 242, 0.32), transparent 23%) bottom / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(158, 223, 242, 0.34), transparent 28%) left / 1px 100% no-repeat,
    linear-gradient(180deg, rgba(158, 223, 242, 0.22), transparent 32%) right / 1px 100% no-repeat;
}

.panel::after {
  position: absolute;
  inset: auto 12px 0;
  height: 1px;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(228, 251, 255, 0.82), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.panel:hover,
.panel:focus-within {
  border-color: rgba(158, 223, 242, 0.36);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.082), transparent 34%),
    linear-gradient(180deg, rgba(13, 24, 34, 0.88), rgba(4, 10, 16, 0.88));
}

.panel:hover::after,
.panel:focus-within::after {
  opacity: 1;
}

.forecast-panel,
.draw-panel,
.stats-panel,
.neural-core-panel,
.probability-panel,
.neuron-panel,
.detail-panel,
.history-panel {
  padding: 15px;
}

.forecast-panel {
  min-height: 252px;
}

.neural-core-panel {
  min-height: 646px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.panel-head.compact {
  align-items: center;
}

.panel-head strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}

#mainForecast {
  color: var(--accent-strong);
  font-size: clamp(44px, 5.2vw, 88px);
  font-weight: 950;
  line-height: 0.92;
  text-shadow:
    0 0 24px rgba(158, 223, 242, 0.26),
    0 0 1px rgba(228, 251, 255, 0.9);
}

.prediction-panel.is-predicting #mainForecast,
.forecast-panel.is-predicting #mainForecast {
  animation: textPulse 0.9s ease-in-out infinite;
}

.confidence {
  min-width: 88px;
  text-align: right;
}

.confidence strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 30px;
  line-height: 1.1;
  text-shadow: 0 0 18px rgba(158, 223, 242, 0.28);
}

#forecastReason {
  min-height: 72px;
  margin: 13px 0 15px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.72;
}

.pick-grid,
.stats-grid,
.network-metrics {
  display: grid;
  gap: 9px;
}

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

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

.network-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.pick-grid div,
.stats-grid div,
.network-metrics div {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(158, 223, 242, 0.15);
  border-radius: var(--radius);
  padding: 11px;
  background:
    linear-gradient(135deg, rgba(158, 223, 242, 0.08), transparent 48%),
    rgba(255, 255, 255, 0.035);
}

.pick-grid div::before,
.stats-grid div::before,
.network-metrics div::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 34%;
  height: 1px;
  content: "";
  background: rgba(228, 251, 255, 0.62);
}

.pick-grid span,
.stats-grid span,
.network-metrics span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.pick-grid strong,
.stats-grid strong,
.network-metrics strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 18px;
}

.draw-line {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 92px;
  overflow: hidden;
  border: 1px solid rgba(158, 223, 242, 0.17);
  border-radius: var(--radius);
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(158, 223, 242, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(158, 223, 242, 0.035) 1px, transparent 1px),
    rgba(2, 7, 12, 0.55);
  background-size: 18px 18px;
}

.draw-line::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(158, 223, 242, 0.09), transparent);
  transform: translateX(-100%);
}

.draw-line b,
.draw-line em {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(228, 251, 255, 0.36);
  border-radius: 50%;
  color: #061018;
  background:
    linear-gradient(145deg, var(--accent-strong), var(--accent) 58%, #72afc1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 0 22px rgba(158, 223, 242, 0.22);
  font-family: var(--mono);
  font-size: 22px;
  font-style: normal;
  font-weight: 950;
}

.draw-line b::after,
.draw-line em::after {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(6, 16, 24, 0.2);
  border-radius: inherit;
  content: "";
}

.draw-line em {
  color: var(--accent-strong);
  background:
    linear-gradient(145deg, rgba(158, 223, 242, 0.18), rgba(158, 223, 242, 0.36)),
    #07141d;
}

.draw-line i {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 19px;
  font-style: normal;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

.tag-row span,
.sum-pill {
  border: 1px solid rgba(158, 223, 242, 0.18);
  border-radius: var(--radius);
  padding: 7px 10px;
  color: var(--ink-soft);
  background: rgba(158, 223, 242, 0.06);
  font-family: var(--mono);
  font-size: 11px;
}

.sparkline {
  display: grid;
  grid-template-columns: repeat(30, minmax(5px, 1fr));
  align-items: end;
  gap: 4px;
  height: 96px;
  margin-top: 12px;
  border: 1px solid rgba(158, 223, 242, 0.16);
  border-radius: var(--radius);
  padding: 11px;
  background:
    linear-gradient(90deg, rgba(158, 223, 242, 0.04) 1px, transparent 1px),
    rgba(2, 7, 12, 0.52);
  background-size: 20px 100%;
}

.sparkline span {
  min-height: 8px;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  box-shadow: 0 0 12px rgba(158, 223, 242, 0.2);
  transform-origin: bottom;
  animation: growBar 0.65s ease both;
}

.sparkline span[data-tone="low"] {
  background: linear-gradient(180deg, #b6d9e5, #6d9fb1);
}

.core-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 430px;
  margin-bottom: 13px;
  overflow: hidden;
  border: 1px solid rgba(158, 223, 242, 0.18);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 49%, rgba(228, 251, 255, 0.13), transparent 20%),
    radial-gradient(circle at 50% 50%, rgba(158, 223, 242, 0.11), transparent 38%),
    linear-gradient(90deg, rgba(158, 223, 242, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(158, 223, 242, 0.04) 1px, transparent 1px),
    rgba(2, 7, 12, 0.62);
  background-size: auto, auto, 28px 28px, 28px 28px, auto;
  isolation: isolate;
}

.synapse-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0.78;
}

.synapse-web {
  position: absolute;
  inset: 12%;
  z-index: 1;
  border-radius: 50%;
  pointer-events: none;
}

.synapse-web span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(228, 251, 255, 0.32), transparent);
  box-shadow: 0 0 16px rgba(158, 223, 242, 0.22);
  transform-origin: left center;
}

.synapse-web span:nth-child(1) { transform: rotate(14deg); }
.synapse-web span:nth-child(2) { transform: rotate(68deg); }
.synapse-web span:nth-child(3) { transform: rotate(126deg); }
.synapse-web span:nth-child(4) { transform: rotate(188deg); }
.synapse-web span:nth-child(5) { transform: rotate(244deg); }
.synapse-web span:nth-child(6) { transform: rotate(306deg); }

.energy-beam {
  position: absolute;
  z-index: 2;
  width: 78%;
  height: 1px;
  opacity: 0.6;
  background: linear-gradient(90deg, transparent, rgba(228, 251, 255, 0.82), transparent);
  box-shadow: 0 0 22px rgba(158, 223, 242, 0.34);
  transform-origin: center;
}

.beam-a {
  transform: rotate(28deg);
}

.beam-b {
  transform: rotate(-32deg);
}

.beam-c {
  width: 64%;
  transform: rotate(90deg);
}

.core-visual::before,
.core-visual::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.core-visual::before {
  inset: 24px;
  border: 1px solid rgba(158, 223, 242, 0.14);
  border-radius: 50%;
}

.core-visual::after {
  width: 70%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(228, 251, 255, 0.72), transparent);
  animation: coreScan 4.1s ease-in-out infinite;
}

.core-grid {
  position: absolute;
  inset: -30%;
  opacity: 0.34;
  background:
    linear-gradient(90deg, rgba(158, 223, 242, 0.09) 1px, transparent 1px),
    linear-gradient(180deg, rgba(158, 223, 242, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(700px) rotateX(62deg) translateY(9%);
  transform-origin: center;
}

.core-ring {
  position: absolute;
  inset: 28px;
  z-index: 2;
  border-radius: 50%;
  animation: slowSpin 18s linear infinite;
}

.core-ring span {
  position: absolute;
  inset: calc(var(--i, 0) * 28px);
  border: 1px solid rgba(158, 223, 242, 0.19);
  border-top-color: rgba(228, 251, 255, 0.86);
  border-right-color: rgba(228, 251, 255, 0.38);
  border-radius: 50%;
  box-shadow: inset 0 0 30px rgba(158, 223, 242, 0.05);
}

.core-ring span:nth-child(1) { --i: 0; }
.core-ring span:nth-child(2) { --i: 1; animation: reverseSpin 12s linear infinite; }
.core-ring span:nth-child(3) { --i: 2; }
.core-ring span:nth-child(4) { --i: 3; animation: slowSpin 9s linear infinite; }
.core-ring span:nth-child(5) { --i: 4; border-style: dashed; opacity: 0.72; animation: reverseSpin 18s linear infinite; }

.core-lens {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: min(214px, 46%);
  aspect-ratio: 1;
  border: 1px solid rgba(228, 251, 255, 0.36);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(228, 251, 255, 0.18), rgba(158, 223, 242, 0.07) 38%, transparent 63%);
  box-shadow:
    inset 0 0 34px rgba(158, 223, 242, 0.14),
    0 0 54px rgba(158, 223, 242, 0.13);
}

.core-lens::before,
.core-lens::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  pointer-events: none;
}

.core-lens::before {
  inset: -18px;
  border: 1px solid rgba(228, 251, 255, 0.18);
}

.core-lens::after {
  inset: -38px;
  border: 1px dashed rgba(228, 251, 255, 0.16);
}

.core-lens span {
  position: absolute;
  border-radius: 50%;
}

.core-lens span:first-child {
  inset: 24%;
  border: 1px solid rgba(228, 251, 255, 0.34);
}

.core-lens span:last-child {
  width: 16px;
  height: 16px;
  background: var(--accent-strong);
  box-shadow: 0 0 26px rgba(158, 223, 242, 0.62);
}

.neural-orbit {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(228, 251, 255, 0.18);
  border-radius: 50%;
  pointer-events: none;
}

.neural-orbit::before,
.neural-orbit::after {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  content: "";
  background: var(--accent-strong);
  box-shadow: 0 0 18px rgba(158, 223, 242, 0.75);
}

.orbit-one {
  width: min(470px, 82%);
  aspect-ratio: 1 / 0.46;
  transform: rotate(18deg);
}

.orbit-one::before {
  top: 48%;
  left: -4px;
}

.orbit-one::after {
  right: -4px;
  bottom: 48%;
}

.orbit-two {
  width: min(420px, 74%);
  aspect-ratio: 1 / 0.38;
  transform: rotate(-34deg);
}

.orbit-two::before {
  top: 45%;
  left: -4px;
}

.orbit-two::after {
  right: -4px;
  bottom: 45%;
}

.orbit-node {
  position: absolute;
  z-index: 4;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(228, 251, 255, 0.9);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(158, 223, 242, 0.52);
}

.node-a {
  top: 21%;
  left: 62%;
}

.node-b {
  top: 62%;
  left: 23%;
}

.node-c {
  right: 21%;
  bottom: 20%;
}

.core-quadrants {
  position: absolute;
  inset: 22px;
  z-index: 4;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(228, 251, 255, 0.55);
}

.core-quadrants span {
  position: absolute;
  padding: 5px 7px;
  border: 1px solid rgba(158, 223, 242, 0.14);
  border-radius: var(--radius);
  background: rgba(2, 7, 12, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.core-quadrants span:nth-child(1) {
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.core-quadrants span:nth-child(2) {
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
}

.core-quadrants span:nth-child(3) {
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.core-quadrants span:nth-child(4) {
  top: 50%;
  left: 4px;
  transform: translateY(-50%);
}

.neuron-map {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(18, minmax(5px, 1fr));
  gap: 6px;
  width: min(500px, 78%);
  align-content: center;
  padding: 18px;
  border: 1px solid rgba(158, 223, 242, 0.12);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(2, 7, 12, 0.16), rgba(2, 7, 12, 0.34), transparent 68%);
  filter: drop-shadow(0 0 18px rgba(158, 223, 242, 0.2));
}

.neuron-dot {
  aspect-ratio: 1;
  border: 1px solid rgba(158, 223, 242, 0.08);
  border-radius: 50%;
  background: rgba(118, 144, 155, 0.2);
  transform: scale(var(--s, 1));
}

.neuron-dot.is-active {
  border-color: rgba(228, 251, 255, 0.6);
  background: var(--accent);
  box-shadow: 0 0 14px rgba(158, 223, 242, 0.86);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.neuron-dot.is-hot {
  background: var(--accent-strong);
  box-shadow:
    0 0 18px rgba(228, 251, 255, 0.94),
    0 0 34px rgba(158, 223, 242, 0.34);
}

.neuron-dot.is-core {
  border-color: rgba(228, 251, 255, 0.88);
  background: radial-gradient(circle, var(--accent-strong), var(--accent));
}

.neural-stage {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 13px 0;
}

.neural-stage span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.neural-stage i {
  display: block;
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.neural-stage i::before {
  display: block;
  width: 44%;
  height: 100%;
  border-radius: inherit;
  content: "";
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: stageFlow 1.35s linear infinite;
}

body.is-running .panel {
  border-color: rgba(228, 251, 255, 0.38);
}

body.is-running .neural-core-panel {
  box-shadow:
    var(--shadow),
    0 0 70px rgba(158, 223, 242, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body.is-running .core-visual {
  border-color: rgba(228, 251, 255, 0.42);
}

body.is-running .synapse-canvas {
  opacity: 1;
}

body.is-running .neuron-map {
  border-color: rgba(228, 251, 255, 0.26);
  filter: drop-shadow(0 0 28px rgba(158, 223, 242, 0.38));
}

body.is-running .status-pill {
  animation: statusPulse 0.9s ease-in-out infinite;
}

.vote-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 10px;
}

.vote-board {
  min-width: 0;
  border: 1px solid rgba(158, 223, 242, 0.15);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(2, 7, 12, 0.5);
}

.vote-board > span {
  margin-bottom: 8px;
}

.mini-bars {
  display: grid;
  gap: 8px;
}

.mini-bar {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.mini-bar i {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.mini-bar i::before {
  display: block;
  width: var(--w, 1%);
  height: 100%;
  border-radius: inherit;
  content: "";
  background: linear-gradient(90deg, rgba(158, 223, 242, 0.5), var(--accent-strong));
  animation: fillBar 0.8s ease both;
}

.sum-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.probability-stack {
  display: grid;
  gap: 10px;
}

.prob-row {
  display: grid;
  gap: 7px;
}

.prob-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.prob-head strong {
  color: var(--accent-strong);
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  box-shadow: 0 0 16px rgba(158, 223, 242, 0.36);
  animation: fillBar 0.8s ease both;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.agent-card {
  min-height: 138px;
  padding: 14px;
}

.agent-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.agent-title h3,
.detail-panel h2,
.history-panel h2 {
  color: var(--accent-strong);
  font-size: 17px;
  font-weight: 800;
}

.agent-title strong {
  font-family: var(--mono);
  font-size: 20px;
}

.agent-card p,
.detail-panel li {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.neuron-list {
  display: grid;
  gap: 9px;
}

.neuron-item {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(158, 223, 242, 0.15);
  border-radius: var(--radius);
  padding: 11px;
  background:
    linear-gradient(135deg, rgba(158, 223, 242, 0.07), transparent 52%),
    rgba(2, 7, 12, 0.5);
}

.neuron-item span,
.neuron-item code,
.neuron-item small {
  display: block;
}

.neuron-item span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.neuron-item strong {
  display: block;
  margin: 6px 0;
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 17px;
}

.neuron-item code {
  overflow: hidden;
  color: #9db5bf;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.neuron-item small {
  margin-top: 6px;
  color: rgba(199, 217, 224, 0.62);
  font-family: var(--mono);
  font-size: 11px;
}

ul {
  margin: 0;
  padding-left: 18px;
}

.detail-panel h2,
.history-panel h2 {
  margin-bottom: 10px;
}

.history-list {
  display: grid;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-color: rgba(158, 223, 242, 0.42) rgba(255, 255, 255, 0.05);
}

.history-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(158, 223, 242, 0.12);
  font-family: var(--mono);
  font-size: 12px;
}

.history-row:hover {
  background: rgba(158, 223, 242, 0.055);
}

.history-row:last-child {
  border-bottom: 0;
}

.history-row span {
  color: var(--muted);
}

.history-row strong {
  color: var(--accent-strong);
}

.history-row em {
  color: var(--accent);
  font-style: normal;
  font-weight: 800;
}

.risk-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.62s ease, transform 0.62s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes scan {
  from { background-position: 0 -190px, -58vw 0; }
  to { background-position: 0 calc(100vh + 190px), 100vw 0; }
}

@keyframes radarSweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes sweep {
  from { transform: translateX(-140%); }
  to { transform: translateX(140%); }
}

@keyframes textPulse {
  0%, 100% { opacity: 1; filter: blur(0); }
  50% { opacity: 0.58; filter: blur(0.6px); }
}

@keyframes growBar {
  from { opacity: 0.4; transform: scaleY(0.2); }
  to { opacity: 1; transform: scaleY(1); }
}

@keyframes fillBar {
  from { transform: scaleX(0); transform-origin: left; }
  to { transform: scaleX(1); transform-origin: left; }
}

@keyframes stageFlow {
  from { transform: translateX(-100%); }
  to { transform: translateX(240%); }
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.62; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1.04); }
}

@keyframes slowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes reverseSpin {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@keyframes coreScan {
  0%, 100% { transform: translateY(-156px); opacity: 0; }
  20%, 82% { opacity: 1; }
  50% { transform: translateY(156px); }
}

@media (prefers-reduced-motion: no-preference) {
  body::before {
    animation: gridMove 22s linear infinite;
  }

  .scan-layer {
    animation: scan 7s linear infinite;
  }

  .radar-glow {
    animation: radarSweep 12s linear infinite;
  }

  .field-wash {
    animation: driftWash 12s ease-in-out infinite alternate;
  }

  .draw-line::before {
    animation: sweep 3.8s ease-in-out infinite;
  }

  .draw-line b,
  .draw-line em {
    animation: ballFloat 3.4s ease-in-out infinite;
  }

  .draw-line b:nth-child(3) {
    animation-delay: 0.18s;
  }

  .draw-line b:nth-child(5) {
    animation-delay: 0.36s;
  }

  .orbit-node {
    animation: nodeBlink 2s ease-in-out infinite;
  }

  .motion-field span {
    animation: energyLine 7.2s linear infinite;
  }

  .data-rain span {
    animation: dataFall 9s linear infinite;
  }

  .viewport-frame::before {
    animation: frameFlowTop 4.4s ease-in-out infinite;
  }

  .viewport-frame::after {
    animation: frameFlowBottom 4.8s ease-in-out infinite;
  }

  .brand-mark i {
    animation: markOrbit 5s linear infinite;
  }

  .brand-mark::after {
    animation: markSlice 2.8s ease-in-out infinite;
  }

  .telemetry-strip div::after {
    animation: panelGlint 4.6s ease-in-out infinite;
  }

  .telemetry-strip div:nth-child(2)::after { animation-delay: 0.35s; }
  .telemetry-strip div:nth-child(3)::after { animation-delay: 0.7s; }
  .telemetry-strip div:nth-child(4)::after { animation-delay: 1.05s; }

  .panel::before {
    animation: borderCurrent 4.8s ease-in-out infinite;
  }

  .core-grid {
    animation: coreGridDrift 8s linear infinite;
  }

  .core-lens {
    animation: coreBreath 2.4s ease-in-out infinite;
  }

  .core-lens::before {
    animation: lensPulse 2.4s ease-in-out infinite;
  }

  .core-lens::after {
    animation: reverseSpin 14s linear infinite;
  }

  .synapse-web {
    animation: synapseRotate 16s linear infinite;
  }

  .synapse-web span {
    animation: synapseFlash 2.8s ease-in-out infinite;
  }

  .synapse-web span:nth-child(2) { animation-delay: 0.22s; }
  .synapse-web span:nth-child(3) { animation-delay: 0.44s; }
  .synapse-web span:nth-child(4) { animation-delay: 0.66s; }
  .synapse-web span:nth-child(5) { animation-delay: 0.88s; }
  .synapse-web span:nth-child(6) { animation-delay: 1.1s; }

  .energy-beam {
    animation: beamPulse 2.1s ease-in-out infinite;
  }

  .beam-b {
    animation-delay: 0.72s;
  }

  body.is-running .motion-field span {
    animation-duration: 3.2s;
  }

  body.is-running .data-rain span {
    animation-duration: 4.2s;
  }

  body.is-running .core-ring {
    animation-duration: 7s;
  }

  body.is-running .synapse-web {
    animation-duration: 5s;
  }

  body.is-running .synapse-web span {
    animation-duration: 0.9s;
  }

  body.is-running .core-lens {
    animation-duration: 1.05s;
  }

  body.is-running .energy-beam {
    animation-duration: 0.78s;
  }

  .node-b {
    animation-delay: 0.32s;
  }

  .node-c {
    animation-delay: 0.68s;
  }
}

@keyframes gridMove {
  from { background-position: 0 0; }
  to { background-position: 42px 42px; }
}

@keyframes driftWash {
  from { transform: translate3d(-1%, -1%, 0); }
  to { transform: translate3d(1%, 1%, 0); }
}

@keyframes ballFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes nodeBlink {
  0%, 100% { opacity: 0.45; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.16); }
}

@keyframes energyLine {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(-18deg) scaleX(0.5); }
  8% { opacity: 1; }
  58% { opacity: 0.82; }
  100% { opacity: 0; transform: translate3d(148vw, -28vh, 0) rotate(-18deg) scaleX(1.45); }
}

@keyframes dataFall {
  0% { opacity: 0; transform: translateY(-10vh); }
  12% { opacity: 0.86; }
  82% { opacity: 0.42; }
  100% { opacity: 0; transform: translateY(118vh); }
}

@keyframes frameFlowTop {
  0%, 100% { left: 6vw; opacity: 0.15; }
  45% { left: 76vw; opacity: 0.86; }
}

@keyframes frameFlowBottom {
  0%, 100% { right: 6vw; opacity: 0.15; }
  50% { right: 76vw; opacity: 0.86; }
}

@keyframes markOrbit {
  from { transform: rotate(0deg) scale(1); }
  to { transform: rotate(360deg) scale(1); }
}

@keyframes markSlice {
  0%, 100% { transform: translateX(-18px) rotate(-24deg); opacity: 0.25; }
  50% { transform: translateX(18px) rotate(-24deg); opacity: 0.7; }
}

@keyframes panelGlint {
  0%, 44% { transform: translateX(-120%); opacity: 0; }
  52% { opacity: 1; }
  70%, 100% { transform: translateX(120%); opacity: 0; }
}

@keyframes borderCurrent {
  0%, 100% { filter: brightness(0.85); opacity: 0.76; }
  50% { filter: brightness(1.35); opacity: 1; }
}

@keyframes coreGridDrift {
  from { background-position: 0 0; }
  to { background-position: 48px 48px; }
}

@keyframes coreBreath {
  0%, 100% { transform: scale(0.965); filter: brightness(0.92); }
  50% { transform: scale(1.035); filter: brightness(1.25); }
}

@keyframes lensPulse {
  0%, 100% { opacity: 0.18; transform: scale(0.92); }
  50% { opacity: 0.72; transform: scale(1.12); }
}

@keyframes synapseRotate {
  from { transform: rotate(0deg) scale(1); }
  to { transform: rotate(360deg) scale(1); }
}

@keyframes synapseFlash {
  0%, 100% { opacity: 0.12; filter: blur(0); }
  45% { opacity: 0.9; filter: blur(0.35px); }
}

@keyframes beamPulse {
  0%, 100% { opacity: 0.24; filter: blur(0); transform: rotate(28deg) scaleX(0.58); }
  50% { opacity: 0.92; filter: blur(0.4px); transform: rotate(28deg) scaleX(1.08); }
}

.beam-b {
  animation-name: beamPulseB;
}

@keyframes beamPulseB {
  0%, 100% { opacity: 0.18; filter: blur(0); transform: rotate(-32deg) scaleX(0.58); }
  50% { opacity: 0.86; filter: blur(0.4px); transform: rotate(-32deg) scaleX(1.08); }
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(158, 223, 242, 0); }
  50% { box-shadow: 0 0 22px rgba(158, 223, 242, 0.26); }
}

@media (max-width: 1320px) {
  .cockpit-grid {
    grid-template-columns: minmax(300px, 0.92fr) minmax(460px, 1.22fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .cockpit-grid,
  .right-rail,
  .vote-grid,
  .agent-grid {
    grid-template-columns: 1fr;
  }

  .core-visual {
    min-height: 330px;
  }

  .neural-core-panel {
    min-height: auto;
  }
}

@media (max-width: 740px) {
  .viewport-frame {
    inset: 8px;
  }

  .control-shell {
    width: min(100% - 18px, 1680px);
    padding-top: 9px;
  }

  .command-bar {
    position: relative;
    top: auto;
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  h1 {
    white-space: normal;
  }

  .command-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .status-pill,
  .primary-button {
    width: 100%;
    min-width: 0;
  }

  .telemetry-strip,
  .pick-grid,
  .stats-grid,
  .network-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .forecast-panel,
  .draw-panel,
  .stats-panel,
  .neural-core-panel,
  .probability-panel,
  .neuron-panel,
  .detail-panel,
  .history-panel {
    padding: 13px;
  }

  .draw-line {
    flex-wrap: wrap;
  }

  .draw-line b,
  .draw-line em {
    width: 43px;
    height: 43px;
    font-size: 18px;
  }

  .core-visual {
    min-height: 300px;
  }

  .neuron-map {
    grid-template-columns: repeat(14, minmax(5px, 1fr));
  }

  .history-row {
    grid-template-columns: 1fr auto;
  }

  .history-row em {
    display: none;
  }
}

@media (max-width: 420px) {
  .command-actions,
  .telemetry-strip,
  .pick-grid,
  .stats-grid,
  .network-metrics {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .confidence {
    text-align: left;
  }

  .mini-bar {
    grid-template-columns: 38px 1fr 36px;
  }
}

@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;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .command-bar,
  .telemetry-strip,
  .panel {
    background: #071017;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
