@property --agent-fill {
  syntax: "<color>";
  inherits: true;
  initial-value: #050b0d;
}

@property --agent-edge {
  syntax: "<color>";
  inherits: true;
  initial-value: #35e7d1;
}

@property --agent-rim {
  syntax: "<color>";
  inherits: true;
  initial-value: #a8fff4;
}

@property --agent-bubble-bg {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(5, 12, 14, 0.94);
}

@property --agent-bubble-text {
  syntax: "<color>";
  inherits: true;
  initial-value: #f4fbfc;
}

@property --agent-bubble-border {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(53, 231, 209, 0.38);
}

@property --agent-shadow {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(0, 0, 0, 0.36);
}

@property --agent-glow {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(53, 231, 209, 0.72);
}

.agent-cursor {
  --agent-fill: #02080a;
  --agent-edge: #35e7d1;
  --agent-rim: #a8fff4;
  --agent-bubble-bg: rgba(5, 12, 14, 0.94);
  --agent-bubble-text: #f4fbfc;
  --agent-bubble-border: rgba(53, 231, 209, 0.38);
  --agent-shadow: rgba(0, 0, 0, 0.36);
  --agent-glow: rgba(53, 231, 209, 0.72);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9998;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-80px, -80px, 0);
  transition:
    opacity 180ms ease,
    --agent-fill 220ms ease,
    --agent-edge 220ms ease,
    --agent-rim 220ms ease,
    --agent-bubble-bg 220ms ease,
    --agent-bubble-text 220ms ease,
    --agent-bubble-border 220ms ease,
    --agent-shadow 220ms ease,
    --agent-glow 220ms ease;
  will-change: transform;
}

.agent-cursor[data-theme="light"] {
  --agent-fill: #fffaf6;
  --agent-edge: #ff8f72;
  --agent-rim: #ffd8ca;
  --agent-bubble-bg: rgba(255, 249, 245, 0.96);
  --agent-bubble-text: #2a1711;
  --agent-bubble-border: rgba(255, 180, 155, 0.6);
  --agent-shadow: rgba(112, 66, 48, 0.18);
  --agent-glow: rgba(255, 143, 114, 0.72);
}

.agent-cursor.is-visible {
  opacity: 1;
}

.agent-cursor__pointer {
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 40px;
  transform-origin: 5px 5px;
  filter:
    drop-shadow(0 10px 20px var(--agent-shadow))
    drop-shadow(0 0 10px var(--agent-glow));
  transition: transform 180ms ease, filter 220ms ease;
}

.agent-cursor__pointer::before,
.agent-cursor__pointer::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 0 32px, 10px 24px, 16px 39px, 24px 36px, 18px 22px, 34px 22px);
  transition: background 220ms ease;
}

.agent-cursor__pointer::before {
  background: linear-gradient(135deg, var(--agent-edge) 0%, var(--agent-rim) 54%, var(--agent-edge) 100%);
}

.agent-cursor__pointer::after {
  inset: 5px 7px 7px 5px;
  background: var(--agent-fill);
}

.agent-cursor.is-idle .agent-cursor__pointer {
  transform: rotate(14deg);
}

.agent-cursor__persona {
  position: absolute;
  top: -22px;
  left: 30px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 270px;
  opacity: 0;
  transform: translate3d(-12px, 10px, 0) scale(0.88);
  transform-origin: 0 24px;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.agent-cursor.is-speaking .agent-cursor__persona,
.agent-cursor.is-away .agent-cursor__persona {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.agent-cursor__avatar {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 2px solid var(--agent-edge);
  border-radius: 50%;
  background: var(--agent-fill);
  color: var(--agent-edge);
  font-size: 1.1rem;
  font-weight: 950;
  box-shadow: 0 12px 28px var(--agent-shadow);
}

.agent-cursor[data-theme="light"] .agent-cursor__avatar {
  color: #ff8f72;
}

.agent-cursor__bubble {
  position: relative;
  max-width: 250px;
  padding: 12px 14px;
  border: 1px solid var(--agent-bubble-border);
  border-radius: 8px;
  background: var(--agent-bubble-bg);
  color: var(--agent-bubble-text);
  box-shadow: 0 16px 42px var(--agent-shadow);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.35;
}

.agent-cursor__bubble::before {
  content: "";
  position: absolute;
  top: 14px;
  left: -7px;
  width: 12px;
  height: 12px;
  border-left: 1px solid var(--agent-bubble-border);
  border-bottom: 1px solid var(--agent-bubble-border);
  background: var(--agent-bubble-bg);
  transform: rotate(45deg);
}

.agent-cursor.is-flipped .agent-cursor__persona {
  right: 12px;
  left: auto;
  flex-direction: row-reverse;
  transform-origin: 100% 24px;
}

.agent-cursor.is-flipped .agent-cursor__bubble::before {
  right: -7px;
  left: auto;
  border: 0;
  border-top: 1px solid var(--agent-bubble-border);
  border-right: 1px solid var(--agent-bubble-border);
}

.agent-cursor.is-below .agent-cursor__persona {
  top: 28px;
}

.agent-cursor.is-away .agent-cursor__avatar {
  animation: agent-avatar-pulse 1.6s ease-in-out infinite;
}

@keyframes agent-avatar-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.07);
  }
}

@media (max-width: 899px), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .agent-cursor {
    display: none;
  }
}
