:root {
  --bg: #05060a;
  --panel: rgba(8, 12, 22, 0.78);
  --panel-strong: rgba(14, 20, 36, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f6f8ff;
  --muted: #8d9ab3;
  --cyan: #67e8f9;
  --pink: #ff7ac8;
  --violet: #a78bfa;
  --green: #34d399;
  --amber: #fbbf24;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  background: #05060a;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 44% 38%, rgba(29, 78, 216, 0.38), transparent 34%),
    radial-gradient(circle at 78% 8%, rgba(219, 39, 119, 0.22), transparent 28%),
    linear-gradient(135deg, #05060a 0%, #090d18 44%, #03040a 100%);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app {
  height: 100vh;
}

.operator-ui {
  display: none;
}

.phase-ui {
  display: none;
}

.outcome-ui {
  display: none;
}

body[data-phase-ui="1"] .phase-ui {
  display: block;
}

body[data-outcome-ui="1"] .outcome-ui {
  display: block;
}

body[data-operator-ui="1"] .app {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 520px;
}

.rail {
  align-items: center;
  background: rgba(5, 6, 10, 0.72);
  border-right: 1px solid var(--line);
  flex-direction: column;
  gap: 16px;
  padding: 18px 12px;
}

body[data-operator-ui="1"] .rail {
  display: flex;
}

.mark {
  background: linear-gradient(135deg, var(--cyan), var(--violet) 48%, var(--pink));
  border-radius: 15px;
  box-shadow: 0 0 34px rgba(103, 232, 249, 0.34);
  color: #07111c;
  display: grid;
  font-size: 14px;
  font-weight: 900;
  height: 44px;
  letter-spacing: 0;
  place-items: center;
  width: 44px;
}

.rail-button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  cursor: pointer;
  height: 44px;
  width: 44px;
}

.rail-button.active {
  background: rgba(103, 232, 249, 0.13);
  border-color: rgba(103, 232, 249, 0.35);
  color: var(--text);
}

.stage {
  height: 100vh;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.hero {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  left: 26px;
  position: absolute;
  right: 26px;
  top: 24px;
  z-index: 5;
}

.eyebrow {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(34px, 3.7vw, 54px);
  letter-spacing: 0;
  line-height: 0.92;
  margin: 0;
  max-width: 900px;
}

h2 {
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0;
}

h3 {
  font-size: 14px;
  line-height: 1.18;
  margin: 0;
}

.subtitle {
  color: #b5c1d6;
  font-size: 14px;
  line-height: 1.45;
  margin: 12px 0 0;
  max-width: 720px;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.metric {
  background: rgba(5, 6, 10, 0.62);
  border: 1px solid var(--line);
  border-radius: 17px;
  min-width: 112px;
  padding: 12px 14px;
  backdrop-filter: blur(14px);
}

.metric b {
  display: block;
  font-size: 25px;
  letter-spacing: 0;
}

.metric b.counting {
  animation: count-pop 180ms ease-out;
}

.metric span {
  color: var(--muted);
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric.pulse {
  box-shadow: 0 0 32px rgba(52, 211, 153, 0.16);
}

.graph-panel {
  inset: 154px 0 78px;
  position: absolute;
}

body[data-operator-ui="1"] .graph-panel {
  inset: 154px 0 290px;
}

.phase-card {
  background: linear-gradient(135deg, rgba(10, 16, 30, 0.86), rgba(5, 6, 10, 0.54));
  border: 1px solid rgba(103, 232, 249, 0.18);
  border-radius: 22px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  left: 26px;
  max-width: 820px;
  padding: 14px 16px;
  position: absolute;
  right: 26px;
  top: 124px;
  z-index: 9;
  backdrop-filter: blur(16px);
}

.phase-card h2 {
  font-size: 22px;
}

.phase-card p:not(.eyebrow) {
  color: #cbd8eb;
  font-size: 13px;
  line-height: 1.35;
  margin: 8px 0 12px;
}

.progress-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.progress-track i {
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  border-radius: inherit;
  box-shadow: 0 0 24px rgba(103, 232, 249, 0.34);
  display: block;
  height: 100%;
  transition: width 0.55s ease;
  width: 0;
}

.phase-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.phase-step {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
  padding: 6px 8px;
  text-transform: uppercase;
}

.phase-step.active {
  border-color: rgba(103, 232, 249, 0.36);
  color: var(--cyan);
}

svg {
  display: block;
  height: 100%;
  width: 100%;
}

.grid-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.075);
  stroke-width: 1;
}

.sector {
  stroke: rgba(103, 232, 249, 0.075);
  stroke-dasharray: 2 12;
}

.cluster-label {
  fill: rgba(190, 242, 255, 0.58);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 6px;
  text-transform: uppercase;
}

.node {
  fill: #a9b7cc;
  opacity: 0.34;
  transition: opacity 0.25s ease, r 0.25s ease, fill 0.25s ease;
}

.node.live0 { fill: var(--cyan); opacity: 1; filter: drop-shadow(0 0 20px var(--cyan)); }
.node.live1 { fill: var(--pink); opacity: 1; filter: drop-shadow(0 0 20px var(--pink)); }
.node.live2 { fill: var(--violet); opacity: 1; filter: drop-shadow(0 0 20px var(--violet)); }
.node.live3 { fill: var(--green); opacity: 1; filter: drop-shadow(0 0 20px var(--green)); }
.node.live4 { fill: var(--amber); opacity: 1; filter: drop-shadow(0 0 20px var(--amber)); }

.label {
  fill: #f8fbff;
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 4px;
  transition: opacity 0.25s ease;
}

.label.live {
  opacity: 1;
}

.beam {
  fill: none;
  stroke-linecap: round;
  stroke-width: 3.5;
  stroke-dasharray: 11 9;
  animation: beamDash 1.1s linear infinite;
  filter: drop-shadow(0 0 15px currentColor);
}

.beam-ghost {
  fill: none;
  opacity: 0.11;
  stroke-linecap: round;
  stroke-width: 13;
}

.packet-dot {
  filter: drop-shadow(0 0 16px currentColor);
}

@keyframes beamDash {
  to { stroke-dashoffset: -80; }
}

.outcome-board {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(6, 10, 18, 0.86));
  border: 1px solid rgba(251, 191, 36, 0.22);
  border-radius: 24px;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.44);
  left: 26px;
  opacity: 0;
  padding: 16px;
  pointer-events: none;
  position: absolute;
  right: 26px;
  top: 220px;
  transform: translateY(10px) scale(0.985);
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 7;
  backdrop-filter: blur(18px);
}

body[data-outcome-ui="1"][data-phase="done"] .outcome-board {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

body[data-outcome-ui="1"][data-phase="done"] .packet-dock {
  opacity: 0.18;
}

.outcome-head {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.outcome-head span {
  color: var(--amber);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.outcome-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.outcome-item {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 17px;
  min-width: 0;
  padding: 12px;
}

.outcome-item b {
  color: #f8fbff;
  display: block;
  font-size: 14px;
  line-height: 1.15;
  margin-bottom: 6px;
}

.outcome-item span {
  color: var(--cyan);
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.25;
  text-transform: uppercase;
}

.outcome-item p {
  color: #dce8f8;
  font-size: 12px;
  line-height: 1.34;
  margin: 9px 0 7px;
}

.outcome-item em {
  color: #b5c1d6;
  display: block;
  font-size: 11px;
  font-style: normal;
  line-height: 1.3;
}

.ticker {
  align-items: center;
  background: rgba(5, 6, 10, 0.72);
  border: 1px solid var(--line);
  border-radius: 19px;
  bottom: 24px;
  display: flex;
  gap: 13px;
  left: 26px;
  padding: 13px 16px;
  position: absolute;
  right: 26px;
  z-index: 6;
  backdrop-filter: blur(14px);
}

.live-dot {
  color: #22c55e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
}

#tickerText {
  color: #dbeafe;
  font-size: 14px;
}

.packet-dock {
  background: linear-gradient(135deg, rgba(10, 16, 30, 0.88), rgba(5, 6, 10, 0.62));
  border: 1px solid var(--line);
  border-radius: 22px;
  bottom: 84px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.36);
  gap: 16px;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.4fr);
  left: 26px;
  padding: 16px;
  position: absolute;
  right: 26px;
  z-index: 6;
  backdrop-filter: blur(16px);
}

body[data-operator-ui="1"] .packet-dock {
  display: grid;
}

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

.dock-item {
  border-left: 2px solid rgba(103, 232, 249, 0.46);
  min-width: 0;
  padding-left: 10px;
}

.dock-item b {
  color: var(--cyan);
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.dock-item span {
  color: #dce8f8;
  display: block;
  font-size: 12px;
  line-height: 1.32;
}

.side {
  background: linear-gradient(180deg, rgba(8, 12, 22, 0.96), rgba(3, 4, 10, 0.98));
  border-left: 1px solid var(--line);
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 20px 18px;
}

body[data-operator-ui="1"] .side {
  display: flex;
}

.side-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.side-head h2 {
  font-size: 28px;
  line-height: 1;
}

.pill {
  background: rgba(103, 232, 249, 0.1);
  border: 1px solid rgba(103, 232, 249, 0.24);
  border-radius: 999px;
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
  padding: 7px 9px;
}

.lane-bars {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 10px;
}

.lane {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}

.lane i {
  animation: laneRun 1.45s ease-in-out infinite alternate;
  background: var(--lane);
  border-radius: inherit;
  display: block;
  height: 100%;
  width: 42%;
}

@keyframes laneRun {
  from { transform: translateX(-40%); }
  to { transform: translateX(170%); }
}

.feed-shell {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 22px;
  flex: 1;
  min-height: 300px;
  overflow: hidden;
  padding: 12px;
  position: relative;
}

.feed-shell::before {
  background: linear-gradient(rgba(8, 12, 22, 0.96), transparent);
  content: "";
  height: 42px;
  inset: 0 0 auto;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.message {
  animation: messageIn 0.26s ease both;
  background: rgba(5, 6, 10, 0.76);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
  padding: 10px;
}

.message.opening {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(14, 165, 233, 0.15));
  border-color: rgba(167, 139, 250, 0.28);
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.message-meta {
  align-items: center;
  color: var(--cyan);
  display: flex;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.message-pair {
  color: #f8fbff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 5px;
}

.message p {
  color: #cbd8eb;
  font-size: 13px;
  line-height: 1.38;
  margin: 0;
}

.cursor::after {
  animation: blink 0.8s steps(2, start) infinite;
  content: "▌";
  margin-left: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}

.operator-card {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.demand-card {
  background: linear-gradient(135deg, rgba(103, 232, 249, 0.09), rgba(251, 191, 36, 0.055));
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 18px;
  margin: 0 0 12px;
  padding: 13px;
}

.show-start {
  background: linear-gradient(135deg, rgba(10, 16, 30, 0.96), rgba(5, 6, 10, 0.88));
  border: 1px solid rgba(103, 232, 249, 0.3);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
  left: 50%;
  max-width: 420px;
  padding: 20px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100vw - 40px);
  z-index: 20;
  backdrop-filter: blur(18px);
}

.show-start p:not(.eyebrow) {
  color: #b5c1d6;
  font-size: 13px;
  line-height: 1.45;
}

.show-start button {
  background: var(--cyan);
  border: 0;
  border-radius: 12px;
  color: #061018;
  cursor: pointer;
  font-weight: 900;
  margin-top: 8px;
  padding: 12px 14px;
  white-space: nowrap;
  width: 100%;
}

.show-start.booting {
  max-width: 620px;
}

.show-boot-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.show-boot-step {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
}

.show-boot-step b {
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0;
}

.show-boot-step span {
  font-size: 13px;
  line-height: 1.35;
}

.show-boot-step.active {
  border-color: rgba(103, 232, 249, 0.62);
  background: rgba(103, 232, 249, 0.11);
  color: var(--text);
}

.show-boot-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.show-boot-stat {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  display: grid;
  gap: 5px;
  min-height: 104px;
  padding: 13px;
  transform: translateY(4px);
  transition: background 220ms ease, border-color 220ms ease, opacity 220ms ease, transform 220ms ease;
  opacity: 0.58;
}

.show-boot-stat span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.show-boot-stat b {
  align-items: center;
  color: var(--text);
  display: flex;
  font-size: clamp(24px, 5vw, 38px);
  letter-spacing: 0;
  line-height: 1;
  min-height: 38px;
  white-space: nowrap;
}

.show-boot-stat em {
  color: #b5c1d6;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.show-boot-stat.active {
  background: rgba(103, 232, 249, 0.11);
  border-color: rgba(103, 232, 249, 0.62);
  opacity: 1;
  transform: translateY(0);
}

.show-boot-stat.loading b::before {
  animation: spin 820ms linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--cyan);
  border-radius: 999px;
  content: "";
  display: block;
  height: 22px;
  width: 22px;
}

@keyframes count-pop {
  0% { transform: translateY(2px) scale(0.96); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.demand-list,
.takeaway-list {
  display: grid;
  gap: 8px;
}

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

.demand-item,
.insight-item,
.takeaway-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 9px 10px;
}

.demand-item {
  background: rgba(5, 6, 10, 0.42);
  min-width: 0;
}

.demand-item.lead-demand {
  align-items: end;
  background: linear-gradient(135deg, rgba(103, 232, 249, 0.16), rgba(5, 6, 10, 0.58));
  border-color: rgba(103, 232, 249, 0.35);
  grid-column: 1 / -1;
  padding: 12px;
}

.demand-item b,
.insight-item b,
.takeaway-item b {
  font-size: 12px;
  line-height: 1.15;
}

.demand-item.lead-demand b {
  font-size: 22px;
  line-height: 1.08;
}

.demand-item span,
.insight-item span,
.takeaway-item span {
  color: var(--amber);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
  text-align: right;
}

.demand-item.lead-demand span {
  color: var(--cyan);
  font-size: 15px;
}

.insight-card {
  max-height: 190px;
}

.insight-list {
  display: grid;
  gap: 8px;
}

.insight-item {
  align-items: flex-start;
}

.insight-item span {
  color: #b5c1d6;
  max-width: 220px;
}

.takeaway-card {
  background: rgba(251, 191, 36, 0.035);
  border-top-color: rgba(251, 191, 36, 0.22);
}

.takeaway-item {
  background: rgba(251, 191, 36, 0.045);
}

.takeaway-item span {
  color: var(--cyan);
  max-width: 190px;
}

@media (max-width: 1120px) {
  body[data-operator-ui="1"] .app {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  body[data-operator-ui="1"] .side {
    display: none;
  }

  .packet-dock {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .stage {
    min-height: 100vh;
  }

  .hero {
    display: block;
    left: 16px;
    right: 16px;
  }

  .metrics {
    justify-content: flex-start;
    margin-top: 14px;
  }

  .graph-panel {
    inset: 260px 0 86px;
  }

  body[data-operator-ui="1"] .graph-panel {
    inset: 260px 0 260px;
  }

  .phase-card {
    left: 16px;
    max-width: none;
    right: 16px;
    top: 214px;
  }

  .phase-steps {
    display: none;
  }

  .show-boot-stats {
    grid-template-columns: 1fr;
  }

  .show-boot-stat {
    min-height: 86px;
  }

  .packet-dock {
    bottom: 84px;
    left: 16px;
    right: 16px;
  }

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

  .ticker {
    left: 16px;
    right: 16px;
  }
}
