/* 3D Dynamic Dashboard — R34 JARVIS HUD · R35 neon · R38 3D wiring · R39 lights · R40 DNA/platform */
.d3-body {
  min-height: 100vh;
  overflow-x: hidden;
  background: #050508;
  color: var(--text, #f5f3fb);
  font-family: Inter, system-ui, sans-serif;
}
.d3-body .bg-hex, .d3-body .bg-circuit { z-index: 0; }

.d3-topbar {
  position: relative; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(12,10,24,.92), rgba(12,10,24,.55));
  border-bottom: 1px solid rgba(155,92,255,.25);
  backdrop-filter: blur(16px);
}
.d3-brand { display: flex; align-items: center; gap: 12px; }
.d3-brand h1 { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 1.15rem; }
.d3-brand .acc { color: #FF5FD6; }
.d3-brand p { margin: 2px 0 0; font-size: .72rem; color: #a29dc2; }
.d3-brand-mark {
  width: 56px; height: 56px; border-radius: 50%; position: relative;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #6B1FC7, #E80D9C 55%, #FF5FD6);
  box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 28px rgba(232,13,156,.45);
}
.d3-brand-mark img {
  width: 48px; height: 48px; border-radius: 50%; position: relative; z-index: 2;
  object-fit: cover;
}
.dna-helix {
  position: absolute; inset: -5px; border-radius: 50%;
  background:
    conic-gradient(from 0deg,
      transparent 0 12%, #9B5CFF 12% 22%, transparent 22% 38%,
      #E80D9C 38% 48%, transparent 48% 62%,
      #FF5FD6 62% 72%, transparent 72% 100%);
  animation: dnaSpin 4s linear infinite;
  filter: blur(.2px); opacity: .95;
  pointer-events: none;
}
@keyframes dnaSpin { to { transform: rotate(360deg); } }

.d3-top-stats { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.d3-chip {
  background: rgba(255,255,255,.04); border: 1px solid rgba(155,92,255,.22);
  border-radius: 10px; padding: 6px 10px; min-width: 72px;
}
.d3-chip span { display: block; font-size: .65rem; color: #a29dc2; text-transform: uppercase; letter-spacing: .06em; }
.d3-chip b { font-size: .95rem; color: #f5f3fb; }

.d3-view-toggle {
  display: flex; gap: 4px; background: rgba(0,0,0,.35);
  border: 1px solid rgba(155,92,255,.3); border-radius: 999px; padding: 3px;
}
.d3-view-toggle .vt {
  border: 0; background: transparent; color: #a29dc2; font-weight: 600;
  font-size: .78rem; padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.d3-view-toggle .vt.on {
  background: linear-gradient(90deg, #6B1FC7, #E80D9C); color: #fff;
}
.d3-body.view-gia #connectorOrbit,
.d3-body.view-gia #giniPanel { opacity: 0.25; pointer-events: none; filter: grayscale(.4); }
.d3-body.view-gini .d3-gia-hub .gia-label { color: #FFC838; }
.d3-body.view-gini .d3-gia-hub .gia-core {
  background: linear-gradient(145deg, #B8860B, #6B1FC7);
}
.d3-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.d3-nav a {
  text-decoration: none; color: #c4b5fd; font-size: .8rem;
  border: 1px solid rgba(155,92,255,.3); padding: 6px 10px; border-radius: 8px;
  background: rgba(155,92,255,.08);
}
.d3-nav a:hover { background: rgba(255,95,214,.15); color: #fff; }

.d3-legend {
  position: relative; z-index: 15;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin: 10px 18px 0; padding: 8px 14px !important;
  background: rgba(8,6,18,.7) !important;
}
.d3-legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: #cfc9e8; }
.d3-legend .lt {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  box-shadow: 0 0 8px currentColor;
}
.lt.green { background: #2FE08A; color: #2FE08A; }
.lt.yellow { background: #FFC838; color: #FFC838; }
.lt.red { background: #FB6363; color: #FB6363; }
.lt.black { background: #1a1a1f; color: #555; box-shadow: 0 0 0 1px #444; }
.lt.blue { background: #38BDF8; color: #38BDF8; }
.lt.purple { background: #9B5CFF; color: #9B5CFF; }
.lt.blink { animation: errBlink 0.7s ease-in-out infinite; }
@keyframes errBlink { 0%,100%{ opacity:1; } 50%{ opacity:.25; } }
.d3-note { margin-left: auto; font-size: .7rem; color: #655f80; }
.d3-auth-banner {
  position: relative; z-index: 25; margin: 10px 18px 0; padding: 14px 16px;
  background: rgba(120,20,40,.55); border: 1px solid rgba(251,99,99,.5);
  border-radius: 12px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  font-size: .9rem;
}
.d3-auth-banner[hidden] { display: none !important; }
.d3-auth-banner a { color: #FF5FD6; font-weight: 700; }
/* Sleeping agents still visible (not invisible black-on-black) */
.d3-node .face { min-opacity: 1; }
.d3-node.status-idle .face,
.d3-node .light[style*="1a1a1f"] { outline: 1px solid rgba(155,92,255,.25); }
.d3-freebar {
  position: relative; z-index: 15; margin: 8px 18px 0; padding: 8px 12px !important;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .75rem;
  background: rgba(8,20,12,.55) !important; border-color: rgba(47,224,138,.25) !important;
}
.d3-freebar .ff {
  padding: 3px 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12);
  color: #a29dc2;
}
.d3-freebar .ff.on { border-color: rgba(47,224,138,.45); color: #2FE08A; background: rgba(47,224,138,.1); }
.d3-freebar .ff.off { opacity: .55; text-decoration: line-through; }
.d3-freebar .link { color: #c4b5fd; margin-left: 4px; }

.d3-main {
  position: relative; z-index: 5;
  display: grid; grid-template-columns: 1fr 320px; gap: 14px;
  padding: 12px 18px 24px; min-height: calc(100vh - 140px);
}
@media (max-width: 1000px) {
  .d3-main { grid-template-columns: 1fr; }
  .d3-stage-wrap { min-height: 420px; }
  .d3-topbar { padding: 10px 12px; gap: 8px; }
  .d3-brand h1 { font-size: .95rem; }
  .d3-side { max-height: none; }
  .d3-nav a { font-size: .72rem; padding: 5px 8px; }
  .d3-platform { width: min(92vw, 380px); height: min(92vw, 380px); }
  .d3-floor { width: min(90vw, 360px); height: min(90vw, 360px); }
}

.d3-stage-wrap {
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(155,92,255,.28);
  background:
    radial-gradient(ellipse 70% 50% at 50% 60%, rgba(155,92,255,.12), transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 20%, rgba(255,95,214,.08), transparent 60%),
    rgba(5,5,12,.85);
  overflow: hidden;
  min-height: 560px;
  perspective: 1200px;
  box-shadow: var(--glass-shadow, 0 30px 60px -30px rgba(0,0,0,.75));
}
.d3-reticle {
  pointer-events: none; position: absolute; inset: 12px; z-index: 3;
  border: 1px solid rgba(155,92,255,.12);
  border-radius: 12px;
  background:
    linear-gradient(#9B5CFF, #9B5CFF) top left / 18px 1px no-repeat,
    linear-gradient(#9B5CFF, #9B5CFF) top left / 1px 18px no-repeat,
    linear-gradient(#FF5FD6, #FF5FD6) top right / 18px 1px no-repeat,
    linear-gradient(#FF5FD6, #FF5FD6) top right / 1px 18px no-repeat,
    linear-gradient(#38BDF8, #38BDF8) bottom left / 18px 1px no-repeat,
    linear-gradient(#38BDF8, #38BDF8) bottom left / 1px 18px no-repeat,
    linear-gradient(#2FE08A, #2FE08A) bottom right / 18px 1px no-repeat,
    linear-gradient(#2FE08A, #2FE08A) bottom right / 1px 18px no-repeat;
}
.d3-scanline {
  pointer-events: none; position: absolute; left: 0; right: 0; height: 80px; z-index: 2;
  background: linear-gradient(180deg, transparent, rgba(155,92,255,.08), transparent);
  animation: scan 5s linear infinite;
}
@keyframes scan { 0% { top: -80px; } 100% { top: 100%; } }

.d3-wire-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4;
  pointer-events: none;
}

.d3-stage {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  transform-style: preserve-3d;
  cursor: grab;
  touch-action: none;
}
.d3-stage.dragging { cursor: grabbing; }

.d3-floor {
  position: absolute; width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(155,92,255,.15) 0%, transparent 65%);
  border-radius: 50%;
  transform: rotateX(72deg) translateZ(-40px);
  border: 1px solid rgba(155,92,255,.15);
  box-shadow: 0 0 60px rgba(155,92,255,.2);
}

.d3-platform {
  position: relative; width: 480px; height: 480px;
  transform-style: preserve-3d;
  transition: transform .05s linear;
}

.d3-platform .hud-ring {
  position: absolute; left: 50%; top: 50%; border-radius: 50%;
  border: 1px solid rgba(155,92,255,.25);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.d3-platform .hud-ring.r1 { width: 140px; height: 140px; animation: ringSpin 12s linear infinite; border-color: rgba(255,95,214,.35); }
.d3-platform .hud-ring.r2 { width: 200px; height: 200px; animation: ringSpin 18s linear infinite reverse; border-style: dashed; }
.d3-platform .hud-ring.r3 { width: 280px; height: 280px; animation: ringSpin 28s linear infinite; border-color: rgba(56,189,248,.2); }
@keyframes ringSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.d3-gia-hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) translateZ(40px);
  text-align: center; z-index: 10; cursor: pointer;
}
.gia-core {
  width: 88px; height: 88px; border-radius: 50%; margin: 0 auto; position: relative;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.2), transparent 50%),
    linear-gradient(145deg, #6B1FC7, #E80D9C);
  box-shadow: 0 0 30px rgba(155,92,255,.55), 0 0 60px rgba(255,95,214,.25),
    inset 0 0 20px rgba(255,255,255,.15);
  display: grid; place-items: center;
  transform-style: preserve-3d;
  animation: giaFloat 3.5s ease-in-out infinite;
}
@keyframes giaFloat { 0%,100%{ transform: translateZ(40px) translateY(0); } 50%{ transform: translateZ(50px) translateY(-6px); } }
.gia-core img { width: 52px; height: 52px; border-radius: 50%; position: relative; z-index: 2; }
.gia-pulse {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid rgba(155,92,255,.5);
  animation: pulseRing 2s ease-out infinite;
}
.d3-gia-hub.gia-active .gia-core {
  box-shadow: 0 0 40px #9B5CFF, 0 0 80px rgba(155,92,255,.5);
}
.d3-gia-hub.gia-active .gia-pulse { border-color: #9B5CFF; }
@keyframes pulseRing {
  0% { transform: scale(.9); opacity: .9; }
  100% { transform: scale(1.35); opacity: 0; }
}
.gia-label { margin-top: 8px; font-size: .7rem; letter-spacing: .12em; color: #c4b5fd; }
.gia-sub { font-size: .72rem; color: #a29dc2; max-width: 140px; margin: 2px auto 0; }

.d3-orbit { position: absolute; inset: 0; transform-style: preserve-3d; pointer-events: none; }
.d3-orbit > * { pointer-events: auto; }

.d3-node {
  position: absolute; left: 50%; top: 50%;
  width: 54px; height: 54px; margin: -27px 0 0 -27px;
  transform-style: preserve-3d;
  cursor: pointer;
  transition: filter .2s;
}
.d3-node:hover { filter: brightness(1.25); z-index: 20; }
.d3-node .face {
  width: 100%; height: 100%; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, rgba(255,255,255,.12), rgba(20,15,40,.85));
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 8px 20px rgba(0,0,0,.45), 0 0 16px var(--node-glow, transparent);
  backdrop-filter: blur(8px);
  transform: translateZ(20px);
  font-size: 1.15rem;
}
.d3-node .name {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 4px; font-size: .58rem; white-space: nowrap; color: #cfc9e8;
  text-shadow: 0 1px 4px #000; max-width: 90px; overflow: hidden; text-overflow: ellipsis;
}
.d3-node .light {
  position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.4); z-index: 3;
  box-shadow: 0 0 10px var(--light-color);
  background: var(--light-color);
}
.d3-node.status-error .light { animation: errBlink .7s ease-in-out infinite; }
.d3-node.conn-node .face { width: 40px; height: 40px; border-radius: 50%; font-size: .75rem; }
.d3-node.conn-node { width: 40px; height: 40px; margin: -20px 0 0 -20px; }

.d3-hint {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  z-index: 6; font-size: .68rem; color: #655f80; pointer-events: none;
}

.d3-side { display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 150px); overflow: auto; }
.d3-glass {
  background: rgba(12,10,24,.72) !important;
  border: 1px solid rgba(155,92,255,.22) !important;
  backdrop-filter: blur(14px);
}
.d3-glass .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.d3-glass h2 { margin: 0; font-size: .9rem; }
.cc-badge {
  font-size: .62rem; padding: 2px 6px; border-radius: 999px;
  border: 1px solid rgba(47,224,138,.4); color: #2FE08A; background: rgba(47,224,138,.1);
}
.d3-list { display: flex; flex-direction: column; gap: 6px; font-size: .78rem; }
.d3-list.scroll { max-height: 160px; overflow: auto; }
.d3-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
}
.d3-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.d3-row .meta { flex: 1; min-width: 0; }
.d3-row .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d3-row .meta span { color: #a29dc2; font-size: .7rem; }

#missionBox {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: rgba(0,0,0,.35); border: 1px solid rgba(155,92,255,.25);
  color: #eee; border-radius: 10px; padding: 8px; font: inherit;
}
#missionBtn { margin-top: 8px; width: 100%; }
.d3-mission-out {
  margin: 8px 0 0; font-size: .68rem; max-height: 100px; overflow: auto;
  color: #a29dc2; white-space: pre-wrap;
}

.d3-popup {
  position: fixed; z-index: 50; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(380px, 92vw); padding: 18px;
  background: rgba(10,8,22,.92); border: 1px solid rgba(155,92,255,.4);
  border-radius: 16px; backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 40px rgba(155,92,255,.15);
}
.d3-popup-x {
  position: absolute; top: 10px; right: 12px; background: none; border: 0;
  color: #a29dc2; font-size: 1rem; cursor: pointer;
}
.d3-popup h3 { margin: 0 0 8px; font-family: 'Space Grotesk', sans-serif; }
.d3-popup p { margin: 4px 0; font-size: .85rem; color: #cfc9e8; }
