/** @format */

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-drag: none;
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
}

html,
body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background-color: #000;
  color: #fff;
}

#pano {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* --- Floating UI Canvas --- */
#ui-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none; /* Crucial: lets the user drag the 360 tour */
}

/* --- Top Left Panel --- */
.top-left-panel {
  position: absolute;
  top: 30px;
  left: 30px;
  pointer-events: auto;
  text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
}

.project-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 4px 0;
  letter-spacing: -0.5px;
}

.scene-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- Bottom Center Status Pill --- */
.bottom-center-panel {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
}

.glass-pill {
  background: rgba(20, 20, 20, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 40px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.ai-dot {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* --- AI Sidebar Placeholder --- */
.ai-sidebar-placeholder {
  position: absolute;
  right: 30px;
  bottom: 30px;
  width: 450px;
  pointer-events: auto;
}

.glass-panel {
  background: rgba(15, 15, 15, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.ai-header {
  padding: 16px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
}

.ai-body {
  padding: 20px 16px;
  font-size: 25px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
}

.ai-input {
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.ai-input input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 12px;
  border-radius: 8px;
  color: #fff;
  outline: none;
}
.ai-input input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* --- Matterport-Style Navigation Rings (Link Hotspots) --- */
.link-hotspot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.link-hotspot::after {
  content: '';
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.link-hotspot:hover {
  transform: translate(-50%, -50%) scale(1.15);
  background: rgba(255, 255, 255, 0.3);
  border-color: #fff;
}
.link-hotspot:hover::after {
  transform: scale(0.7);
}

/* --- Sleek Info Hotspots (Pins) --- */
.info-hotspot {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.info-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  border: 2px solid #fff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}

.info-hotspot:hover .info-icon {
  background: #fff;
  color: #000;
  transform: scale(1.1);
}

.info-tooltip {
  position: absolute;
  bottom: 40px;
  white-space: nowrap;
  background: rgba(25, 25, 25, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.tooltip-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}
.tooltip-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
}

.info-hotspot:hover .info-tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* --- Minimap Styles --- */
#minimap-panel {
  position: absolute;
  bottom: 30px;
  left: 30px;
  pointer-events: auto;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
}

#minimap-panel.collapsed {
  width: 200px;
  height: 150px;
}

#minimap-panel.expanded {
  width: 60vw;
  max-width: 800px;
  height: 60vh;
  max-height: 600px;
}

.minimap-header {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.minimap-header:hover {
  background: rgba(255, 255, 255, 0.1);
}

.minimap-body {
  position: relative;
  flex-grow: 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

#minimap-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  opacity: 0.8;
}

/* Map Pins */
.map-pin {
  position: absolute;
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.4);
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.map-pin:hover {
  transform: translate(-50%, -50%) scale(1.3);
  background: #fff;
}
.map-pin.active {
  background: #22c55e;
  border-color: #fff;
  box-shadow: 0 0 10px #22c55e;
}

/* --- Rich Content Hotspots --- */
.info-tooltip {
  width: max-content;
  max-width: 280px;
}

/* Material Spec Layout */
.spec-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4px 10px;
  margin-top: 8px;
  font-size: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 8px;
}
.spec-label {
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  font-size: 10px;
}
.spec-value {
  color: #fff;
  font-weight: 500;
}
.btn-sample {
  margin-top: 12px;
  width: 100%;
  padding: 8px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 11px;
}
.btn-sample:hover {
  background: #e0e0e0;
}

/* Media Showcase Layout */
.media-container {
  margin-top: 8px;
  border-radius: 4px;
  overflow: hidden;
}
.media-container img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

/* --- Pure CSS Compass --- */
#compass-panel {
  position: absolute;
  top: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  pointer-events: auto;
}
.compass-outer {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(15, 15, 15, 0.6);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.compass-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid #ef4444;
  z-index: 2;
}
#compass-dial {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 50%;
}
.compass-n {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}

/* --- Fixed Minimap Layout --- */
.minimap-body {
  position: relative;
  flex-grow: 1;
  overflow: auto;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
#minimap-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: auto;
}
#minimap-img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.8;
}
#minimap-pins {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* --- Radar Cone on Map Pins --- */
.radar-cone {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-bottom: 50px solid rgba(255, 255, 255, 0.4);
  top: 50%;
  left: 50%;
  transform-origin: 50% 100%;
  margin-left: -20px;
  margin-top: -50px;
  pointer-events: none;
  display: none;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
  transition: transform 0.1s linear;
}
.map-pin.active .radar-cone {
  display: block;
}

/* --- AI Voice UI Styles --- */
.mode-toggle-btn {
  float: right;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  padding: 4px 8px;
  transition: background 0.2s;
}

.mode-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

#voice-mode-ui {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px;
}

.voice-blob-container {
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

/* Resting State: Slow Breathing */
.voice-blob {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #a8a29e, #ffffff);
  border-radius: 50%;
  transition: all 0.3s ease;
  animation: breath 4s infinite ease-in-out;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

/* Speaking State: Active Pulsing */
.voice-blob.speaking {
  animation: pulse-speak 0.6s infinite alternate;
  background: linear-gradient(135deg, #22c55e, #3b82f6);
}

@keyframes breath {
  0%,
  100% {
    transform: scale(1);
    border-radius: 50%;
  }
  50% {
    transform: scale(1.05);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  }
}

@keyframes pulse-speak {
  0% {
    transform: scale(1);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
  }
  100% {
    transform: scale(1.2);
    border-radius: 45% 55% 40% 60%;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.7);
  }
}

.mic-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

/* Update the listening state to look more like a 'Cancel' button */
.mic-btn.listening {
  background: rgba(239, 44, 44, 0.2); /* Soft red background */
  border-color: #ef4444;
  color: #ef4444;
  font-weight: 600;
  animation: pulse-red 1.5s infinite;
}

.mic-btn.listening:hover {
  background: #ef4444;
  color: #fff;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 44, 44, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(239, 44, 44, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 44, 44, 0);
  }
}

/* --- ADVANCED AI AURA (THE BLOB) --- */
.ai-aura {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin: 0 auto 20px;
  transition: transform 0.3s ease;
}

.aura-core {
  position: absolute;
  width: 40px;
  height: 40px;
  background: #ffffff;
  border-radius: 50%;
  z-index: 10;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
}

.aura-layer {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen; /* Blends colors dynamically */
  filter: blur(15px); /* Creates the fluid edge */
  opacity: 0.6;
}

/* Three distinct colored layers */
.layer-1 {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  animation: organic-drift 6s infinite alternate ease-in-out;
  transform-origin: 45% 55%;
}

.layer-2 {
  width: 90%;
  height: 90%;
  background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
  animation: organic-drift 7s infinite alternate ease-in-out;
  transform-origin: 55% 45%;
  animation-delay: -2s;
}

.layer-3 {
  width: 110%;
  height: 110%;
  background: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
  animation: organic-drift 5s infinite alternate ease-in-out;
  transform-origin: 50% 50%;
  animation-delay: -4s;
  opacity: 0.4;
}

/* --- STATES --- */

/* 1. RESTING (Default) - Gentle breathing */
@keyframes organic-drift {
  0% {
    transform: scale(0.9) rotate(0deg);
  }
  100% {
    transform: scale(1.1) rotate(20deg);
  }
}

/* --- 3D SPHERICAL VOICE SPECTRUM --- */
.ai-spectrum-sphere {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 20px;
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: all 0.5s ease;
}

/* The Glowing Center */
.sphere-core {
  position: absolute;
  top: 25%;
  left: 25%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, #ffffff, #4facfe);
  border-radius: 50%;
  box-shadow: 0 0 20px #00f2fe;
  animation: core-breathe 4s infinite alternate ease-in-out;
  transition: all 0.3s ease;
}

/* The Spectrum Rings */
.ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid transparent;
  box-sizing: border-box;
  mix-blend-mode: screen;
  transition: all 0.3s ease;
}

/* Idle State - Dashed borders rotating in 3D look like spectrum lines */
.ring-x {
  border-top: 3px dashed #4facfe;
  border-bottom: 3px dashed #00f2fe;
  animation: rotate-x 8s linear infinite;
}
.ring-y {
  border-left: 3px dashed #a18cd1;
  border-right: 3px dashed #fbc2eb;
  animation: rotate-y 8s linear infinite;
}
.ring-z {
  border-top: 3px dashed #ff0844;
  border-bottom: 3px dashed #ffb199;
  animation: rotate-z 8s linear infinite;
}
.ring-d1 {
  border-left: 2px solid rgba(255, 255, 255, 0.6);
  border-right: 2px solid transparent;
  animation: rotate-d1 6s linear infinite;
}
.ring-d2 {
  border-top: 2px solid rgba(255, 255, 255, 0.4);
  border-bottom: 2px solid transparent;
  animation: rotate-d2 7s linear infinite;
}

/* 3D Rotations */
@keyframes rotate-x {
  0% {
    transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(360deg) rotateY(180deg) rotateZ(90deg);
  }
}
@keyframes rotate-y {
  0% {
    transform: rotateX(90deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(90deg) rotateY(360deg) rotateZ(180deg);
  }
}
@keyframes rotate-z {
  0% {
    transform: rotateX(45deg) rotateY(45deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(225deg) rotateY(45deg) rotateZ(360deg);
  }
}
@keyframes rotate-d1 {
  0% {
    transform: rotateX(135deg) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(135deg) rotateY(360deg) rotateZ(180deg);
  }
}
@keyframes rotate-d2 {
  0% {
    transform: rotateX(0deg) rotateY(135deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(180deg) rotateY(135deg) rotateZ(360deg);
  }
}

@keyframes core-breathe {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* --- STATE: THINKING (Request Sent, waiting for AWS) --- */
.ai-spectrum-sphere.thinking .sphere-core {
  background: radial-gradient(circle, #ffffff, #a18cd1);
  box-shadow:
    0 0 30px #a18cd1,
    inset 0 0 10px #fbc2eb;
  animation: core-pulse-fast 0.6s infinite alternate ease-in-out;
}
.ai-spectrum-sphere.thinking .ring {
  animation-duration: 2s; /* Rings spin much faster */
  border-width: 4px;
}
@keyframes core-pulse-fast {
  0% {
    transform: scale(0.8);
  }
  100% {
    transform: scale(1.2);
  }
}

/* --- STATE: ANSWERING (Chunks streaming in) & SPEAKING --- */
.ai-spectrum-sphere.answering .sphere-core,
.ai-spectrum-sphere.speaking .sphere-core {
  background: radial-gradient(circle, #ffffff, #ff0844);
  box-shadow: 0 0 40px #ff0844;
  animation: core-beat 0.2s infinite alternate cubic-bezier(0.1, 0.7, 1, 0.1);
}
.ai-spectrum-sphere.answering .ring,
.ai-spectrum-sphere.speaking .ring {
  animation-duration: 0.8s; /* Extremely fast */
  border-style: dotted; /* Changes from dashed to dotted to simulate audio waves */
  border-width: 5px;
  filter: drop-shadow(0 0 5px #ffffff);
}
@keyframes core-beat {
  0% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1.3);
  }
}

/* --- PERPLEXITY PARTICLE SPHERE --- */
.pplx-particle-sphere {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 30px;
  perspective: 800px;
  transform-style: preserve-3d;
  transition: all 0.5s ease;
}

/* Central soft glow */
.sphere-glow {
  position: absolute;
  top: 20%;
  left: 20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.4), transparent 70%);
  filter: blur(15px);
  z-index: 1;
}

/* Individual Dot Layers */
.dot-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  /* This creates the "many small dots" effect */
  background-image: radial-gradient(circle, #ffffff 1px, transparent 1px);
  background-size: 10px 10px; /* Controls the density of dots */
  background-position: center;
  mask-image: radial-gradient(circle, black 40%, transparent 70%); /* Fades dots at edges */
  -webkit-mask-image: radial-gradient(circle, black 40%, transparent 70%);
  opacity: 0.5;
  transition: all 0.4s ease;
}

/* Different Rotation Speeds and Axes to create the Sphere */
.layer-1 {
  transform: rotateX(0deg);
  animation: sphere-spin 10s linear infinite;
}
.layer-2 {
  transform: rotateX(45deg);
  animation: sphere-spin 12s linear infinite reverse;
}
.layer-3 {
  transform: rotateY(90deg);
  animation: sphere-spin 15s linear infinite;
}
.layer-4 {
  transform: rotateX(-45deg);
  animation: sphere-spin 8s linear infinite;
}
.layer-5 {
  transform: rotateY(45deg);
  animation: sphere-spin 11s linear infinite reverse;
}

@keyframes sphere-spin {
  0% {
    transform: rotateX(inherit) rotateY(0deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(inherit) rotateY(360deg) rotateZ(360deg);
  }
}

/* --- STATES --- */

/* STATE: THINKING (Deep Purple/Blue Pulse) */
.pplx-particle-sphere.thinking {
  transform: scale(1.1);
}
.pplx-particle-sphere.thinking .dot-layer {
  background-image: radial-gradient(circle, #8b5cf6 1.5px, transparent 1.5px);
  animation-duration: 3s; /* Speed up dots */
  opacity: 0.8;
}
.pplx-particle-sphere.thinking .sphere-glow {
  background: radial-gradient(circle, rgba(139, 92, 246, 0.6), transparent 70%);
}

/* STATE: ANSWERING / SPEAKING (Bright Teal / High Frequency) */
.pplx-particle-sphere.answering,
.pplx-particle-sphere.speaking {
  transform: scale(1.2);
  animation: sphere-vibrate 0.1s infinite;
}

.pplx-particle-sphere.answering .dot-layer,
.pplx-particle-sphere.speaking .dot-layer {
  background-image: radial-gradient(circle, #14b8a6 2px, transparent 2px);
  background-size: 8px 8px; /* Denser dots */
  animation-duration: 1s; /* Chaotic speed */
  opacity: 1;
  filter: drop-shadow(0 0 3px #14b8a6);
}

.pplx-particle-sphere.answering .sphere-glow,
.pplx-particle-sphere.speaking .sphere-glow {
  background: radial-gradient(circle, rgba(20, 184, 166, 0.8), transparent 70%);
  filter: blur(20px);
}

@keyframes sphere-vibrate {
  0% {
    transform: scale(1.2) translate(0, 0);
  }
  50% {
    transform: scale(1.22) translate(1px, -1px);
  }
  100% {
    transform: scale(1.2) translate(-1px, 1px);
  }
}

/* --- PLASMA VISUALIZER --- */
.ai-plasma {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 30px;
  filter: blur(10px) contrast(1.2); /* Blends the layers into liquid */
  display: flex;
  align-items: center;
  justify-content: center;
}

.plasma-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen; /* Dynamic color blending */
  opacity: 0.7;
  animation: morph-plasma 8s infinite alternate ease-in-out;
}

/* Color Palette: Teal, Indigo, Pink, Orange */
.p-1 {
  background: #14b8a6;
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 40%;
  animation-delay: 0s;
}
.p-2 {
  background: #6366f1;
  border-radius: 50% 50% 30% 70% / 50% 30% 70% 50%;
  animation-delay: -2s;
  width: 90%;
  height: 90%;
}
.p-3 {
  background: #ec4899;
  border-radius: 60% 40% 50% 50% / 30% 60% 40% 70%;
  animation-delay: -4s;
  width: 110%;
  height: 110%;
}
.p-4 {
  background: #f59e0b;
  border-radius: 30% 70% 70% 30% / 50% 40% 30% 60%;
  animation-delay: -6s;
}

/* The "Gooey" Morph Animation */
@keyframes morph-plasma {
  0% {
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 40%;
    transform: rotate(0deg) scale(1);
  }
  33% {
    border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%;
    transform: rotate(120deg) scale(1.1);
  }
  66% {
    border-radius: 30% 70% 70% 30% / 50% 40% 30% 60%;
    transform: rotate(240deg) scale(0.9);
  }
  100% {
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 40%;
    transform: rotate(360deg) scale(1);
  }
}

/* --- STATES --- */

/* STATE: THINKING (Calm, Deep Blue/Purple) */
.ai-plasma.thinking .plasma-layer {
  filter: saturate(0.5) brightness(0.8);
  animation-duration: 12s; /* Slower, meditative movement */
}

/* STATE: ANSWERING (Rapid, High Intensity) */
.ai-plasma.answering .plasma-layer {
  animation-duration: 3s; /* Speeds up as data arrives */
  filter: saturate(1.5) brightness(1.2);
  opacity: 0.9;
}

/* STATE: SPEAKING (Audio-Reactive Pulse) */
.ai-plasma.speaking {
  animation: plasma-vibrate 0.2s infinite;
}

.ai-plasma.speaking .plasma-layer {
  animation-duration: 1.5s; /* Very fast movement */
  filter: contrast(1.5) brightness(1.3);
  opacity: 1;
}

@keyframes plasma-vibrate {
  0% {
    transform: scale(1.1) rotate(1deg);
  }
  50% {
    transform: scale(1.15) rotate(-1deg);
  }
  100% {
    transform: scale(1.1) rotate(1deg);
  }
}
