:root {
  --orbita-companion-intensity: .55;
  --orbita-companion-color: 111, 232, 246;
  --orbita-companion-warm: 222, 255, 119;
  --orbita-voice-energy: 0;
}

body.orbita-companion-active .three-robot-status {
  isolation: isolate;
  overflow: visible;
  border: 0;
  color: rgba(239, 254, 255, .96);
  background:
    linear-gradient(112deg, rgba(8, 24, 35, .5), rgba(10, 25, 31, .2)),
    radial-gradient(circle at 18% 0%, rgba(var(--orbita-companion-color), .2), transparent 48%);
  box-shadow:
    0 18px 58px rgba(0, 4, 14, .28),
    inset 0 1px 0 rgba(255, 255, 255, .15),
    0 0 calc(22px * var(--orbita-companion-intensity)) rgba(var(--orbita-companion-color), .12);
  backdrop-filter: blur(24px) saturate(156%);
  -webkit-backdrop-filter: blur(24px) saturate(156%);
  transition: opacity .34s ease, transform .34s cubic-bezier(.2, .8, .2, 1), background .42s ease, box-shadow .42s ease;
}

body.orbita-companion-active .three-robot-status::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, transparent 0 18%, rgba(var(--orbita-companion-color), .8) 31%, transparent 43% 70%, rgba(var(--orbita-companion-warm), .56) 84%, transparent 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: calc(.24 + var(--orbita-companion-intensity) * .34);
  animation: orbita-companion-orbit 6.4s linear infinite;
  pointer-events: none;
}

body.orbita-companion-active .three-robot-status::after {
  content: "";
  position: absolute;
  z-index: -3;
  inset: -8px -12px;
  border-radius: inherit;
  background: radial-gradient(ellipse, rgba(var(--orbita-companion-color), .15), transparent 68%);
  filter: blur(11px);
  opacity: calc(.2 + var(--orbita-companion-intensity) * .35);
  pointer-events: none;
}

body.orbita-companion-active .three-robot-status > i {
  position: relative;
  border: 0;
  background: rgb(var(--orbita-companion-color));
  box-shadow: 0 0 0 4px rgba(var(--orbita-companion-color), .1), 0 0 18px rgba(var(--orbita-companion-color), .82);
}

body.orbita-companion-active .three-robot-status > i::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(var(--orbita-companion-color), .42);
  animation: orbita-companion-signal 2.2s ease-out infinite;
}

body[data-companion-action="listen"] { --orbita-companion-color: 117, 241, 224; }
body[data-companion-action="transcribe"],
body[data-companion-action="think"],
body[data-companion-action="read"] { --orbita-companion-color: 134, 202, 255; --orbita-companion-warm: 180, 164, 255; }
body[data-companion-action="compute"],
body[data-companion-action="operate"] { --orbita-companion-color: 218, 255, 111; --orbita-companion-warm: 107, 243, 223; }
body[data-companion-action="scan"],
body[data-companion-action="explore"] { --orbita-companion-color: 127, 187, 255; --orbita-companion-warm: 196, 139, 255; }
body[data-companion-action="speak"],
body[data-companion-action="present"] { --orbita-companion-color: 111, 239, 224; --orbita-companion-warm: 251, 226, 142; }
body[data-companion-action="celebrate"],
body[data-companion-action="play"] { --orbita-companion-color: 218, 255, 111; --orbita-companion-warm: 255, 194, 119; }
body[data-companion-action="recover"] { --orbita-companion-color: 255, 111, 104; --orbita-companion-warm: 255, 184, 112; }
body[data-companion-action="protect"] { --orbita-companion-color: 118, 211, 255; --orbita-companion-warm: 178, 239, 255; }
body[data-companion-action="rest"] { --orbita-companion-color: 112, 151, 190; --orbita-companion-warm: 117, 202, 217; }

body[data-companion-action="listen"] .three-robot-status > i,
body[data-companion-action="speak"] .three-robot-status > i,
body[data-companion-action="operate"] .three-robot-status > i {
  animation: orbita-companion-live calc(1.15s - var(--orbita-companion-intensity) * .34s) ease-in-out infinite;
}

body[data-companion-action="speak"] .three-robot-status {
  box-shadow:
    0 18px 58px rgba(0, 4, 14, .28),
    inset 0 1px 0 rgba(255, 255, 255, .15),
    0 0 calc(22px + 26px * var(--orbita-voice-energy)) rgba(var(--orbita-companion-color), calc(.12 + .2 * var(--orbita-voice-energy)));
}

body[data-companion-action="observe"] .three-robot-status > i,
body[data-companion-action="greet"] .three-robot-status > i,
body[data-companion-action="peek"] .three-robot-status > i {
  background: hsl(var(--orbita-personal-hue, 184) 78% 67%);
  box-shadow: 0 0 0 4px hsl(var(--orbita-personal-hue, 184) 78% 67% / .1), 0 0 18px hsl(var(--orbita-personal-hue, 184) 78% 67% / .72);
}

body[data-companion-action="think"] .three-robot-status::before,
body[data-companion-action="read"] .three-robot-status::before,
body[data-companion-action="compute"] .three-robot-status::before,
body[data-companion-action="scan"] .three-robot-status::before {
  animation-duration: 2.8s;
}

body[data-companion-action="celebrate"] .three-robot-status,
body[data-companion-action="play"] .three-robot-status {
  transform: translateY(-3px) scale(1.015);
}

body[data-companion-action="recover"] .three-robot-status {
  background: linear-gradient(112deg, rgba(43, 12, 16, .58), rgba(16, 18, 27, .24));
}

body[data-companion-action="rest"] .three-robot-status {
  opacity: .72;
  filter: saturate(.78);
}

body[data-companion-source="agent-state"] .three-robot-status span,
body[data-companion-source="agent-tool"] .three-robot-status span,
body[data-companion-source="agent"] .three-robot-status span {
  text-shadow: 0 0 18px rgba(var(--orbita-companion-color), .24);
}

body[data-companion-source="model-frame"] .three-robot-status {
  background:
    radial-gradient(circle at 12% 0%, rgba(116, 221, 255, .2), transparent 42%),
    linear-gradient(112deg, rgba(5, 25, 39, .58), rgba(11, 20, 36, .24));
}

body[data-companion-source="model-frame"] .three-robot-status span::after,
body[data-companion-source="admin-preview"] .three-robot-status span::after,
body[data-companion-source="active-narration"] .three-robot-status span::after {
  display: block;
  margin-top: 2px;
  color: rgba(var(--orbita-companion-color), .56);
  font: 700 7px/1.2 "Avenir Next", "PingFang SC", sans-serif;
  letter-spacing: .14em;
}

body[data-companion-source="model-frame"] .three-robot-status span::after { content: "MODEL DIRECTIVE / AUDITED"; }
body[data-companion-source="admin-preview"] .three-robot-status span::after { content: "ADMIN REHEARSAL / LIVE"; color: rgba(223, 255, 117, .62); }
body[data-companion-source="active-narration"] .three-robot-status span::after { content: "PROACTIVE GUIDE / INTERRUPTIBLE"; color: rgba(255, 220, 139, .62); }

body[data-companion-source="active-narration"] .three-robot-status {
  background:
    radial-gradient(circle at 84% 12%, rgba(255, 205, 119, .16), transparent 42%),
    linear-gradient(112deg, rgba(8, 27, 34, .58), rgba(12, 22, 26, .22));
  animation: orbita-narration-breathe 3.6s ease-in-out infinite;
}

body.orbita-companion-active .three-robot-status span[data-autonomy-intent]:not([data-autonomy-intent=""])::before {
  display: block;
  margin-bottom: 3px;
  color: rgba(var(--orbita-companion-warm), .72);
  content: attr(data-autonomy-intent);
  font: 700 7px/1.2 "Avenir Next", "PingFang SC", sans-serif;
  letter-spacing: .13em;
}

body[data-companion-intent="orient"] { --orbita-companion-color: 111, 235, 224; --orbita-companion-warm: 208, 255, 112; }
body[data-companion-intent="research"] { --orbita-companion-color: 124, 199, 255; --orbita-companion-warm: 186, 164, 255; }
body[data-companion-intent="explore"] { --orbita-companion-color: 116, 176, 255; --orbita-companion-warm: 201, 137, 255; }
body[data-companion-intent="support"] { --orbita-companion-color: 255, 205, 119; --orbita-companion-warm: 125, 237, 217; }
body[data-companion-intent="recharge"] { --orbita-companion-color: 104, 148, 188; --orbita-companion-warm: 118, 190, 207; }

body[data-companion-source="autonomy-plan"] .three-robot-status {
  background:
    radial-gradient(circle at 82% 8%, rgba(var(--orbita-companion-warm), .12), transparent 40%),
    linear-gradient(112deg, rgba(7, 24, 34, .56), rgba(9, 22, 30, .22));
}

body[data-companion-source="autonomy-plan"] .three-robot-status span::after {
  content: "AUTONOMOUS PLAN / USER INTERRUPTIBLE";
  color: rgba(var(--orbita-companion-color), .52);
}

body[data-companion-intent="explore"].has-three-robot .robot-three-canvas {
  filter: drop-shadow(0 24px 48px rgba(92, 151, 255, .18)) saturate(1.08);
}

body[data-companion-intent="research"].has-three-robot .robot-three-canvas {
  filter: drop-shadow(0 22px 46px rgba(118, 203, 255, .16)) saturate(1.04);
}

body.orbita-autonomy-yielding .three-robot-status {
  opacity: .66;
  transform: translateY(2px) scale(.985);
  transition-duration: .12s;
}

body[data-companion-source="admin-preview"] .three-robot-status {
  outline: 1px solid rgba(223, 255, 117, .22);
  outline-offset: 3px;
}

body.orbita-companion-preempting .three-robot-status {
  opacity: .64;
  transform: translateY(2px) scale(.985);
  transition-duration: .12s;
}

@keyframes orbita-narration-breathe {
  0%, 100% { filter: saturate(1); }
  50% { filter: saturate(1.18) brightness(1.04); }
}

body.agent-open.has-three-robot .robot-three-canvas {
  z-index: 2201;
  opacity: 1;
}

body.agent-open.has-three-robot #agentPanel .orbita-conversation-eyes,
body.agent-open.has-three-robot #agentPanel .orbita-face-wave,
body.agent-open.has-three-robot #agentPanel .orbita-voice-presence {
  opacity: 0;
  visibility: hidden;
}

body.agent-open.has-three-robot #agentPanel .orbita-conversation-face {
  background:
    radial-gradient(circle at 50% 52%, rgba(var(--orbita-companion-color), .055), transparent 27%),
    linear-gradient(145deg, rgba(8, 22, 38, .04), rgba(3, 12, 25, .2));
}

@media (min-width: 721px) {
  body.agent-open.has-three-robot .robot-three-canvas {
    filter: drop-shadow(0 20px 42px rgba(0, 8, 18, .24));
  }
}

@keyframes orbita-companion-orbit {
  to { transform: rotate(1turn); }
}

@keyframes orbita-companion-signal {
  0% { opacity: .66; transform: scale(.7); }
  70%, 100% { opacity: 0; transform: scale(1.65); }
}

@keyframes orbita-companion-live {
  0%, 100% { transform: scale(.82); opacity: .74; }
  50% { transform: scale(1.22); opacity: 1; }
}

@media (max-width: 720px) {
  body.orbita-companion-active .three-robot-status {
    max-width: min(72vw, 300px);
    padding: 9px 12px;
    font-size: 11px;
    line-height: 1.35;
    background: linear-gradient(112deg, rgba(7, 20, 29, .68), rgba(8, 21, 27, .36));
    backdrop-filter: blur(18px) saturate(142%);
    -webkit-backdrop-filter: blur(18px) saturate(142%);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.orbita-companion-active .three-robot-status,
  body.orbita-companion-active .three-robot-status::before,
  body.orbita-companion-active .three-robot-status > i,
  body.orbita-companion-active .three-robot-status > i::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }
  body[data-companion-source="active-narration"] .three-robot-status { animation: none !important; }
  body.orbita-companion-active .three-robot-status::before { opacity: .26; }
}
