/* === base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #050810;
  color: #c8d4e8;
  font-family: 'Sora', system-ui, sans-serif;
  overflow: hidden;
  cursor: default;
}

/* === graph fills viewport === */
#graph {
  position: absolute;
  inset: 0;
}

/* === tooltip === */
#tip {
  position: fixed;
  z-index: 40;
  max-width: 280px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(10, 16, 30, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(120, 160, 255, 0.12);
  color: #c8d4e8;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0.01em;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0.5px 0 rgba(255,255,255,0.04);
}

/* === avatar pencil edit overlay === */
#avatar-edit {
  position: fixed;
  z-index: 30;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(10, 16, 30, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(120, 160, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(160, 190, 255, 0.8);
  cursor: pointer;
  transition: all 0.25s ease;
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.85);
}

#avatar-edit:not([hidden]) {
  opacity: 1;
  transform: scale(1);
}

#avatar-edit:hover {
  background: rgba(80, 120, 255, 0.25);
  border-color: rgba(120, 160, 255, 0.45);
  color: #fff;
  transform: scale(1.1);
}

/* === bottom controls === */
#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 36px;
  pointer-events: none;
}

/* === status pill === */
#status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  margin-bottom: 16px;
  border-radius: 20px;
  background: rgba(10, 16, 30, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(120, 160, 255, 0.08);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(160, 180, 220, 0.7);
  transition: all 0.4s ease;
  pointer-events: auto;
}

#status-pill[data-live="true"] {
  border-color: rgba(80, 200, 160, 0.2);
  color: rgba(140, 220, 190, 0.85);
}

#status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(120, 140, 180, 0.4);
  transition: all 0.4s ease;
  flex-shrink: 0;
}

#status-pill[data-live="true"] #status-dot {
  background: #50e8a0;
  box-shadow: 0 0 8px rgba(80, 232, 160, 0.5);
  animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === mic button === */
#mic-btn {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid rgba(120, 160, 255, 0.15);
  background: rgba(12, 18, 35, 0.65);
  backdrop-filter: blur(16px);
  color: rgba(160, 190, 255, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#mic-btn::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(80, 140, 255, 0.15) 25%,
    transparent 50%,
    rgba(80, 200, 160, 0.1) 75%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

#mic-btn:hover {
  border-color: rgba(120, 160, 255, 0.35);
  color: #fff;
  background: rgba(20, 30, 60, 0.7);
  transform: scale(1.05);
}

#mic-btn:hover::before {
  opacity: 1;
}

#mic-btn:active {
  transform: scale(0.96);
}

#mic-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* live / recording state */
#mic-btn[data-live="true"] {
  border-color: rgba(255, 80, 100, 0.3);
  background: rgba(255, 40, 70, 0.1);
  color: #ff6b7a;
  box-shadow: 0 0 30px rgba(255, 60, 80, 0.12);
}

#mic-btn[data-live="true"]:hover {
  background: rgba(255, 40, 70, 0.18);
  border-color: rgba(255, 80, 100, 0.5);
}

#mic-btn[data-live="true"] .mic-icon { display: none; }
#mic-btn[data-live="true"] .stop-icon { display: block !important; }

/* === pulsing rings (visible only when live) === */
.mic-rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(80, 200, 160, 0.3);
  opacity: 0;
  transform: scale(1);
}

#mic-btn[data-live="true"] .ring {
  animation: ring-expand 2.4s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

#mic-btn[data-live="true"] .ring-1 { animation-delay: 0s; }
#mic-btn[data-live="true"] .ring-2 { animation-delay: 0.8s; }
#mic-btn[data-live="true"] .ring-3 { animation-delay: 1.6s; }

@keyframes ring-expand {
  0% {
    opacity: 0.5;
    transform: scale(1);
    border-color: rgba(80, 200, 160, 0.35);
  }
  100% {
    opacity: 0;
    transform: scale(1.8);
    border-color: rgba(80, 200, 160, 0);
  }
}

/* === connecting state: subtle breathing on mic === */
#mic-btn[data-state="connecting"] {
  animation: breathe 1.5s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { border-color: rgba(120, 160, 255, 0.15); }
  50% { border-color: rgba(120, 160, 255, 0.4); }
}

/* === info button === */
#info-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 25;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(120, 160, 255, 0.1);
  background: rgba(10, 16, 30, 0.5);
  backdrop-filter: blur(10px);
  color: rgba(140, 170, 220, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#info-btn:hover,
#info-btn[aria-expanded="true"] {
  color: rgba(160, 200, 255, 0.9);
  border-color: rgba(120, 160, 255, 0.3);
  background: rgba(20, 30, 55, 0.7);
}

/* === info panel === */
#info-panel {
  position: fixed;
  bottom: 62px;
  right: 20px;
  z-index: 25;
  width: 280px;
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(8, 14, 28, 0.88);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(100, 150, 255, 0.1);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), inset 0 0.5px 0 rgba(255,255,255,0.03);
  font-size: 11.5px;
  font-weight: 300;
  line-height: 1.55;
  color: rgba(180, 200, 230, 0.75);
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

#info-panel:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#info-panel strong {
  color: rgba(200, 220, 255, 0.9);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#info-panel p {
  margin: 0 0 10px;
}

#info-panel p:first-child {
  margin-bottom: 6px;
}

#info-panel ul {
  margin: 0 0 12px;
  padding-left: 14px;
}

#info-panel ul:last-child {
  margin-bottom: 0;
}

#info-panel li {
  margin-bottom: 3px;
}

#info-panel em {
  color: rgba(120, 180, 255, 0.8);
  font-style: normal;
  font-family: 'Sora', monospace;
}
