/* Bridgehead — Diagnostic (animated journey) */

#diagnostic {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 80px 0 120px;
  position: relative;
  overflow: hidden;
}

#diagnostic .diag-section-num {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
#diagnostic .diag-section-num .live {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: diagLivePulse 2s infinite;
}
@keyframes diagLivePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.9); }
}

/* ===== STAGE ===== */
.diag-stage {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  position: relative;
  border-top: 1px solid var(--rule-soft);
}
.diag-stage:first-of-type { border-top: 0; }

.diag-stage > .stage-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* Compressed (answered) stage */
.diag-stage.done {
  min-height: auto;
  padding: 28px 24px;
}
.diag-stage.done .stage-inner {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.diag-stage.done .done-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.diag-stage.done .done-value {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2.5vw, 32px);
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -0.01em;
  line-height: 1;
}
.diag-stage.done .done-summary {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.diag-stage.done .done-edit {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
  transition: color .15s ease;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 4px;
}
.diag-stage.done .done-edit:hover { color: var(--ink); }

/* ===== HEADLINE ===== */
.diag-headline {
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(40px, 5.6vw, 80px);
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin: 0 0 28px;
  max-width: 22ch;
  text-wrap: balance;
  margin-left: auto;
  margin-right: auto;
}
.diag-headline em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -0.015em;
}

/* ===== PROMPT ===== */
.diag-prompt {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 48px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.diag-prompt::before, .diag-prompt::after {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--rule);
}

/* ===== BUBBLES — wider/chaotic spread ===== */
.diag-bubbles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 36px 56px;
  padding: 48px 16px;
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
}
.diag-bubbles.var-area { gap: 40px 64px; }

.diag-bubble {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: block;
  position: relative;
  --float-amp-y: 14px;
  --float-amp-x: 12px;
  --float-dur: 7s;
  --float-delay: 0s;
  --y-offset: 0px;
  --rot: 0deg;
  --fade-delay: 0ms;
  transform: translateY(var(--y-offset)) rotate(var(--rot));
  transition: opacity .4s var(--fade-delay) ease, transform .4s ease;
}

.diag-bubble .orb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--bg);
  text-align: center;
  padding: 0 22px;
  position: relative;
  animation: bubbleDrift var(--float-dur) var(--float-delay) ease-in-out infinite;
  transition: border-color .3s ease, background .3s ease, box-shadow .3s ease;
  will-change: transform;
}

@keyframes bubbleDrift {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(var(--float-amp-x), calc(var(--float-amp-y) * -0.55)) scale(1.012); }
  50%  { transform: translate(calc(var(--float-amp-x) * 0.3), calc(var(--float-amp-y) * -1)) scale(1.02); }
  75%  { transform: translate(calc(var(--float-amp-x) * -1), calc(var(--float-amp-y) * -0.45)) scale(1.012); }
  100% { transform: translate(0, 0) scale(1); }
}

.diag-bubble:hover .orb {
  border-color: var(--ink);
  background: var(--bg-alt);
  box-shadow: 0 24px 56px -16px color-mix(in oklab, var(--accent) 50%, transparent),
              0 0 0 6px color-mix(in oklab, var(--accent) 8%, transparent);
  animation-play-state: paused;
}
.diag-bubble:hover { transform: translateY(calc(var(--y-offset) - 6px)) rotate(var(--rot)); }

.orb .bt {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 10px;
  transition: color .3s ease;
}
.orb .bb {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.35;
  max-width: 14ch;
}

/* Picked — pulse outward then disappear (burst overlays it) */
.diag-bubble.picked {
  z-index: 5;
  animation: bubblePickedScale 700ms cubic-bezier(.4, 1.6, .4, 1) forwards;
}
.diag-bubble.picked .orb {
  animation: bubblePickedPulse 700ms cubic-bezier(.2,.7,.2,1) forwards;
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 14%, var(--bg-alt));
  box-shadow: 0 0 0 12px color-mix(in oklab, var(--accent) 18%, transparent),
              0 0 60px 0 color-mix(in oklab, var(--accent) 50%, transparent);
}
.diag-bubble.picked .orb .bt { color: var(--accent); }

@keyframes bubblePickedScale {
  0%   { transform: translateY(var(--y-offset)) rotate(var(--rot)) scale(1); }
  35%  { transform: translateY(calc(var(--y-offset) - 8px)) rotate(var(--rot)) scale(1.18); opacity: 1; }
  100% { transform: translateY(calc(var(--y-offset) - 4px)) rotate(var(--rot)) scale(0.2); opacity: 0; }
}
@keyframes bubblePickedPulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.05); }
  100% { transform: scale(0.4); opacity: 0; }
}

/* Fading non-picked bubbles */
.diag-bubble.fading {
  animation: bubbleFade 600ms cubic-bezier(.4,0,.6,1) forwards;
  animation-delay: var(--fade-delay);
}
@keyframes bubbleFade {
  0%   { opacity: 1; }
  100% { opacity: 0; transform: translateY(calc(var(--y-offset) + 28px)) scale(0.85); filter: blur(3px); }
}

/* ============= BURST ============= */
.diag-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 10;
}
.burst-px {
  position: absolute;
  top: 0; left: 0;
  width: var(--size);
  height: var(--size);
  background: var(--accent);
  transform-origin: center;
  animation: burstFly var(--dur) var(--delay) cubic-bezier(.18,.7,.25,1) both;
  will-change: transform, opacity;
  border-radius: 1px;
}
.burst-px.ink { background: var(--ink); }
@keyframes burstFly {
  0% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2) rotate(var(--rot));
    opacity: 0;
  }
}
.burst-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(1);
  animation: burstRing 700ms cubic-bezier(.18,.7,.25,1) forwards;
  opacity: 1;
}
.burst-ring.two {
  border-color: var(--ink);
  animation-delay: 80ms;
  animation-duration: 820ms;
}
@keyframes burstRing {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 0.9; border-width: 2px; }
  100% { transform: translate(-50%, -50%) scale(28); opacity: 0; border-width: 0.5px; }
}

/* ============= SIGNAL BUBBLES ============= */
.diag-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 32px;
  justify-content: center;
  align-items: center;
  padding: 32px 16px;
  max-width: 1000px;
  margin: 0 auto;
}
.diag-sig {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  position: relative;
  --float-amp-y: 10px;
  --float-amp-x: 8px;
  --float-dur: 6s;
  --float-delay: 0s;
}
.diag-sig .sig-orb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 124px;
  height: 124px;
  width: 124px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--bg);
  padding: 0 18px;
  text-align: center;
  position: relative;
  animation: bubbleDrift var(--float-dur) var(--float-delay) ease-in-out infinite;
  transition: border-color .25s ease, background .25s ease, box-shadow .25s ease, transform .25s ease;
}
.diag-sig:hover .sig-orb {
  border-color: var(--ink);
  background: var(--bg-alt);
  animation-play-state: paused;
  transform: scale(1.04);
  box-shadow: 0 10px 24px -8px color-mix(in oklab, var(--accent) 30%, transparent);
}
.sig-label {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.005em;
  line-height: 1.2;
  color: var(--ink);
  text-wrap: balance;
}
.sig-check {
  width: 0;
  height: 0;
  opacity: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 50%;
  transition: width .25s ease, height .25s ease, opacity .15s ease;
  overflow: hidden;
  flex-shrink: 0;
}
.sig-check svg {
  width: 12px; height: 12px;
  stroke: var(--accent);
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 18;
  stroke-dashoffset: 18;
}
.diag-sig.on .sig-orb {
  border-color: var(--accent);
  border-width: 2px;
  background: var(--ink);
  box-shadow: 0 0 0 6px color-mix(in oklab, var(--accent) 14%, transparent),
              0 14px 30px -10px color-mix(in oklab, var(--accent) 60%, transparent);
}
.diag-sig.on .sig-label { color: var(--bg); }
.diag-sig.on .sig-check { width: 18px; height: 18px; opacity: 1; }
.diag-sig.on .sig-check svg path { animation: drawCheck 280ms 80ms cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes drawCheck { to { stroke-dashoffset: 0; } }

/* Ripple on click */
.sig-ripple {
  position: absolute;
  top: 50%; left: 50%;
  width: 124px; height: 124px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  transform: translate(-50%, -50%) scale(1);
  pointer-events: none;
  opacity: 0;
}
.diag-sig.on .sig-ripple {
  animation: sigRipple 700ms cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes sigRipple {
  0%   { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.6); border-width: 0.5px; }
}

/* ===== CUSTOM INPUT ORB (Something else) ===== */
.custom-orb-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 48px;
  perspective: 800px;
}

.custom-orb {
  position: relative;
  width: 280px;
  height: 280px;
  animation: customOrbIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             customOrbFloat 7s ease-in-out 0.7s infinite;
  opacity: 0;
  transform: scale(0.5) rotateX(20deg);
}
@keyframes customOrbIn {
  to { opacity: 1; transform: scale(1) rotateX(0); }
}
@keyframes customOrbFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(1deg); }
  75% { transform: translateY(8px) rotate(-1deg); }
}

/* Outer glowing ring */
.custom-orb-glow {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 40%, rgba(200,120,60,0.15) 70%, transparent 100%);
  animation: glowPulse 3s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}
.custom-orb-wrap.focused .custom-orb-glow {
  background: radial-gradient(circle, transparent 40%, rgba(200,120,60,0.3) 70%, transparent 100%);
}

/* Main orb body */
.custom-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse at 30% 20%, rgba(60,58,52,1) 0%, var(--ink) 50%, rgba(20,19,17,1) 100%);
  border: 1px solid rgba(246, 244, 238, 0.08);
  box-shadow:
    inset 0 -20px 40px rgba(0,0,0,0.4),
    inset 0 20px 40px rgba(246,244,238,0.03),
    0 8px 32px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}
.custom-orb-wrap.focused .custom-orb-ring {
  border-color: rgba(200, 120, 60, 0.4);
  box-shadow:
    inset 0 -20px 40px rgba(0,0,0,0.4),
    inset 0 20px 40px rgba(246,244,238,0.03),
    0 8px 32px rgba(0,0,0,0.3),
    0 0 40px rgba(200,120,60,0.2);
}

/* Inner content */
.custom-orb-inner {
  position: absolute;
  inset: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 2;
}

.custom-orb-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
}

.custom-orb-input {
  width: 100%;
  height: 100%;
  flex: 1;
  padding: 12px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: rgba(246, 244, 238, 0.9);
  background: transparent;
  border: none;
  resize: none;
  text-align: center;
}
.custom-orb-input::placeholder {
  color: rgba(246, 244, 238, 0.35);
  text-align: center;
}
.custom-orb-input:focus {
  outline: none;
}

.custom-orb-hint {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: rgba(246, 244, 238, 0.3);
  text-align: center;
}

/* Orbiting particles */
.custom-orb-particles {
  position: absolute;
  inset: -20px;
  pointer-events: none;
}
.custom-orb-particles .particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent);
}
.custom-orb-particles .particle:nth-child(1) {
  animation: orbit1 8s linear infinite;
}
.custom-orb-particles .particle:nth-child(2) {
  animation: orbit2 10s linear infinite;
  width: 3px; height: 3px;
}
.custom-orb-particles .particle:nth-child(3) {
  animation: orbit3 12s linear infinite reverse;
  width: 2px; height: 2px;
  opacity: 0.6;
}
.custom-orb-particles .particle:nth-child(4) {
  animation: orbit4 6s linear infinite;
  width: 5px; height: 5px;
}
.custom-orb-particles .particle:nth-child(5),
.custom-orb-particles .particle:nth-child(6),
.custom-orb-particles .particle:nth-child(7),
.custom-orb-particles .particle:nth-child(8) {
  display: none;
}

@keyframes orbit1 {
  from { transform: rotate(0deg) translateX(155px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(155px) rotate(-360deg); }
}
@keyframes orbit2 {
  from { transform: rotate(90deg) translateX(148px) rotate(-90deg); }
  to { transform: rotate(450deg) translateX(148px) rotate(-450deg); }
}
@keyframes orbit3 {
  from { transform: rotate(180deg) translateX(162px) rotate(-180deg); }
  to { transform: rotate(540deg) translateX(162px) rotate(-540deg); }
}
@keyframes orbit4 {
  from { transform: rotate(270deg) translateX(145px) rotate(-270deg); }
  to { transform: rotate(630deg) translateX(145px) rotate(-630deg); }
}

/* Shine effect */
.custom-orb::before {
  content: "";
  position: absolute;
  top: 15%;
  left: 20%;
  width: 30%;
  height: 20%;
  background: radial-gradient(ellipse, rgba(246,244,238,0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
}

@media (max-width: 600px) {
  .custom-orb { width: 220px; height: 220px; }
  .custom-orb-inner { inset: 24px; gap: 8px; }
  .custom-orb-input { font-size: 12px; padding: 8px; }
  .custom-orb-label { font-size: 8px; }
  @keyframes orbit1 { from { transform: rotate(0deg) translateX(120px) rotate(0deg); } to { transform: rotate(360deg) translateX(120px) rotate(-360deg); } }
  @keyframes orbit2 { from { transform: rotate(90deg) translateX(115px) rotate(-90deg); } to { transform: rotate(450deg) translateX(115px) rotate(-450deg); } }
  @keyframes orbit3 { from { transform: rotate(180deg) translateX(125px) rotate(-180deg); } to { transform: rotate(540deg) translateX(125px) rotate(-540deg); } }
  @keyframes orbit4 { from { transform: rotate(270deg) translateX(112px) rotate(-270deg); } to { transform: rotate(630deg) translateX(112px) rotate(-630deg); } }
}

/* ===== CONTINUE button ===== */
.diag-continue {
  margin-top: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.diag-continue .arrow-stalk {
  width: 1px;
  height: 56px;
  background: linear-gradient(to bottom, var(--rule), var(--ink));
  position: relative;
  animation: stalkPulse 2s ease-in-out infinite;
}
.diag-continue .arrow-stalk::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -4px;
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  transform: rotate(45deg);
}
@keyframes stalkPulse {
  0%, 100% { opacity: 1; height: 56px; }
  50% { opacity: 0.4; height: 64px; }
}

.diag-continue .compile-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 18px 32px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
  border-radius: 999px;
}
.diag-continue .compile-btn:hover {
  background: transparent;
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -12px color-mix(in oklab, var(--accent) 40%, transparent);
}
.diag-continue .compile-btn .arr { transition: transform .15s ease; }
.diag-continue .compile-btn:hover .arr { transform: translateX(4px); }
.diag-continue .compile-btn .count {
  font-size: 11px;
  opacity: 0.75;
  letter-spacing: 0;
}
.diag-continue .compile-hint {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============= RESULT STAGE ============= */
.diag-result-stage { padding: 64px 24px 24px; }
.diag-result-stage > .stage-inner {
  text-align: center;
}

.diag-result-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 32px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.diag-result-meta::before, .diag-result-meta::after {
  content: "";
  width: 36px; height: 1px;
  background: var(--accent);
}

/* ============= BUILD CONSTELLATION ============= */
.diag-cnstl {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 56px;
}
.cnstl-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 620;
}
.cnstl-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.cnstl-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* outer ring + faint scaffolding */
.cnstl-ring {
  fill: none;
  stroke: var(--rule);
  stroke-dasharray: 2 6;
  opacity: 0.4;
  animation: ringRotate 80s linear infinite;
  transform-origin: 500px 310px;
}
@keyframes ringRotate {
  to { transform: rotate(360deg); }
}

/* connection lines */
.cnstl-line .link {
  stroke: var(--rule);
  stroke-width: 1;
  fill: none;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 700ms cubic-bezier(.2,.7,.2,1), stroke .25s ease;
}
.cnstl-line.on .link {
  stroke-dashoffset: 0;
  stroke: var(--ink);
  opacity: 0.4;
}
.cnstl-line.hot .link {
  stroke: var(--accent);
  opacity: 1;
  stroke-width: 1.6;
}

/* flowing pulse along line */
.cnstl-line .link-flow {
  stroke: var(--accent);
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 0.08 0.92;
  stroke-dashoffset: 0;
  opacity: 0;
  transition: opacity .4s ease;
}
.cnstl-line.on .link-flow {
  opacity: 0.7;
  animation: lineFlow 3s linear infinite;
}
@keyframes lineFlow {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

/* core */
.core-fill { fill: var(--ink); }
.core-stroke { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.4; }
.core-glow {
  fill: var(--accent);
  opacity: 0.08;
  filter: blur(20px);
  animation: coreGlowPulse 4s ease-in-out infinite;
  transform-origin: 500px 310px;
}
@keyframes coreGlowPulse {
  0%, 100% { opacity: 0.06; transform: scale(1); }
  50% { opacity: 0.16; transform: scale(1.08); }
}
.core-orbit {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.5;
  stroke-dasharray: 2 4;
  opacity: 0.5;
  transform-origin: 500px 310px;
  animation: coreOrbit 24s linear infinite;
}
@keyframes coreOrbit {
  to { transform: rotate(360deg); }
}

/* nodes */
.cnstl-node .node-dot {
  fill: var(--accent);
  transition: r .25s ease, fill .25s ease;
}
.cnstl-node .node-halo {
  fill: var(--accent);
  opacity: 0.16;
  transition: r .25s ease, opacity .25s ease;
}
.cnstl-node.hot .node-dot { r: 8; }
.cnstl-node.hot .node-halo { r: 22; opacity: 0.32; }

/* HTML core label */
.core-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  color: var(--bg);
  padding: 0 20px;
  max-width: 210px;
}
.core-tag {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(246, 244, 238, 0.5);
  margin-bottom: 8px;
}
.core-name {
  display: block;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(18px, 1.9vw, 24px);
  letter-spacing: -0.015em;
  line-height: 1.08;
  color: var(--bg);
  margin-bottom: 10px;
  text-wrap: balance;
}
.core-name em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: oklch(0.78 0.13 250);
}
.core-meta {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: rgba(246, 244, 238, 0.45);
  text-transform: uppercase;
}

/* HTML node labels */
.cnstl-lbl {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: auto;
  cursor: default;
  padding: 8px 12px;
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--rule);
  max-width: 180px;
  transition: border-color .25s ease, background .25s ease, transform .25s ease, box-shadow .25s ease, opacity .35s ease;
}
.cnstl-lbl.right { transform: translate(20px, -50%); text-align: left; align-items: flex-start; }
.cnstl-lbl.left  { transform: translate(calc(-100% - 20px), -50%); text-align: right; align-items: flex-end; }
.cnstl-lbl.top    { /* nothing extra */ }
.cnstl-lbl.bottom { /* nothing extra */ }
.cnstl-lbl:hover {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 6%, var(--bg));
  z-index: 3;
}
.cnstl-lbl.right:hover { transform: translate(20px, -50%) translateY(-2px); }
.cnstl-lbl.left:hover  { transform: translate(calc(-100% - 20px), -50%) translateY(-2px); }

.cnstl-lbl .lk {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.cnstl-lbl .lv {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink);
  word-break: break-word;
  line-height: 1.3;
}

/* Constellation footer progress */
.cnstl-progress {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px;
}
.cnstl-progress .bars { display: flex; gap: 4px; }
.cnstl-progress .b {
  width: 28px; height: 2px;
  background: var(--rule);
  transition: background .3s ease;
}
.cnstl-progress .b.on { background: var(--accent); }

/* ============= RESULT HEADER ============= */
.diag-result-header {
  margin-bottom: 32px;
}
.result-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.result-title {
  font-family: var(--sans);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
  margin: 0;
}

/* ============= SELECTED SIGNALS ============= */
.diag-result-signals {
  margin-bottom: 32px;
  padding: 24px;
  background: var(--bg-alt);
  border-radius: 12px;
  max-width: 600px;
}
.signals-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.signals-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.signal-chip {
  display: inline-block;
  font-family: var(--sans);
  font-size: 14px;
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink);
}

/* ============= SUMMARY ============= */
.diag-result-summary {
  font-family: var(--sans);
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0 auto 32px;
  max-width: 56ch;
  text-align: center;
}

/* ============= APPROACH ============= */
.diag-approach {
  margin: 0 auto 48px;
  max-width: 600px;
  text-align: center;
}
.approach-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
  text-align: center;
}
.approach-list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  display: inline-block;
}
.approach-list li {
  position: relative;
  padding: 14px 0 14px 28px;
  border-top: 1px solid var(--rule-soft);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}
.approach-list li:last-child {
  border-bottom: 1px solid var(--rule-soft);
}
.approach-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--mono);
}

/* ============= ACTIONS ============= */
.diag-result-actions {
  display: inline-flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
.diag-result-actions .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 18px 32px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.diag-result-actions .btn-primary:hover {
  background: transparent;
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -12px color-mix(in oklab, var(--accent) 50%, transparent);
}
.diag-result-actions .btn-primary .arr { transition: transform .15s ease; }
.diag-result-actions .btn-primary:hover .arr { transform: translateX(4px); }
.diag-result-actions .btn-ghost {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 6px;
  transition: color .15s ease;
}
.diag-result-actions .btn-ghost:hover { color: var(--ink); }

/* ============= RESPONSIVE ============= */
@media (max-width: 900px) {
  #diagnostic { padding: 56px 0 80px; }
  .diag-stage { min-height: 70vh; padding: 40px 16px; }
  .diag-bubbles { gap: 22px 24px; }
  .diag-bubble .orb { width: 132px; height: 132px; padding: 0 14px; }
  .orb .bt { font-size: 14px; }
  .orb .bb { font-size: 9px; }
  .diag-signals { gap: 18px 18px; }
  .diag-sig .sig-orb { width: 104px; height: 104px; min-width: 104px; padding: 0 12px; }
  .sig-label { font-size: 12px; }
  .sig-ripple { width: 104px; height: 104px; }
  .cnstl-stage { aspect-ratio: 1000 / 900; }
  .cnstl-lbl { font-size: 10px; padding: 6px 10px; }
  .cnstl-lbl .lv { font-size: 11px; }
  .diag-resolves .row { grid-template-columns: 1fr; gap: 4px; text-align: left; }
  .diag-resolves .row .from { text-align: left; }
  .diag-resolves .row .arrow { display: none; }
  .diag-result-actions { flex-direction: column; gap: 16px; }
  .diag-result-actions .btn-primary { width: 100%; justify-content: center; }
}
@media (max-width: 600px) {
  .diag-headline { font-size: clamp(28px, 7vw, 40px); }
  .diag-prompt { font-size: 12px; margin-bottom: 32px; }
  .diag-bubbles { gap: 16px 16px; padding: 0 8px; }
  .diag-bubble .orb { width: 110px; height: 110px; padding: 0 12px; }
  .orb .bt { font-size: 12px; }
  .orb .bb { font-size: 8px; letter-spacing: 0.06em; }
  .diag-signals { gap: 14px 14px; padding: 0 8px; }
  .diag-sig .sig-orb { width: 96px; height: 96px; min-width: 96px; padding: 0 10px; }
  .sig-label { font-size: 11px; }
  .sig-ripple { width: 96px; height: 96px; }
  .cnstl-stage { aspect-ratio: 1000 / 1100; }
  .cnstl-lbl { white-space: normal; max-width: 130px; font-size: 9px; padding: 5px 8px; }
  .cnstl-lbl .lv { font-size: 10px; }
  .core-label { padding: 20px 16px; }
  .core-name { font-size: clamp(20px, 5vw, 28px); }
  .core-meta { font-size: 10px; }
  .diag-result-meta { font-size: 10px; }
  .diag-result-summary { font-size: 14px; padding: 0 16px; }
  .diag-resolves { padding: 24px 16px; }
  .diag-resolves .rh { font-size: 10px; }
  .diag-resolves .row { font-size: 12px; }
  .diag-continue { margin-top: 40px; }
  .compile-btn { padding: 16px 24px; font-size: 11px; }
  .done-value { font-size: 14px; }
  .done-summary { font-size: 11px; }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
  /* Ensure minimum touch targets (44x44px) */
  .diag-bubble .orb { min-width: 96px; min-height: 96px; }
  .diag-sig .sig-orb { min-width: 88px; min-height: 88px; }

  /* Remove hover-dependent animations on touch */
  .diag-bubble:hover .orb { box-shadow: none; transform: none; }
  .diag-sig:hover .sig-orb { box-shadow: none; }

  /* Add active states for touch feedback */
  .diag-bubble:active .orb {
    transform: scale(0.96);
    transition: transform 0.1s ease;
  }
  .diag-sig:active .sig-orb {
    transform: scale(0.96);
    transition: transform 0.1s ease;
  }
  .compile-btn:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  .diag-result-actions .btn-primary:active {
    transform: scale(0.98);
  }
  .diag-result-actions .btn-ghost:active {
    opacity: 0.7;
  }

  /* Better scroll behavior */
  .diag-bubbles, .diag-signals {
    -webkit-overflow-scrolling: touch;
  }
}
