:root {
  --bg-dark: #0b0f19;
  --bg-card: #131c2e;
  --bg-card-glass: rgba(19, 28, 46, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.2);
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(99, 102, 241, 0.4);
  --accent: #06b6d4;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 100% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.app-header {
  text-align: center;
  margin-bottom: 2rem;
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 9999px;
  margin-bottom: 1rem;
}

.app-header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 520px;
  margin: 0 auto;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  flex: 1;
}

.voice-card {
  background: var(--bg-card-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.voice-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

/* Orb & Visualizer */
.orb-container {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.orb-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  filter: blur(20px);
  opacity: 0.5;
  transition: all 0.5s ease;
}

.orb {
  position: relative;
  z-index: 2;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3730a3 0%, #1e1b4b 100%);
  border: 2px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mic-icon {
  width: 38px;
  height: 38px;
  color: #c7d2fe;
  transition: all 0.3s ease;
}

.wave-rings {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
}

.ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
  opacity: 0;
  pointer-events: none;
}

/* Animated States */
.state-connecting .orb {
  background: linear-gradient(135deg, #b45309 0%, #78350f 100%);
  animation: pulse-connecting 1.5s infinite;
}
.state-connecting .orb-glow {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.6) 0%, transparent 70%);
  opacity: 0.8;
}

.state-active .orb {
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  transform: scale(1.06);
  border-color: rgba(255, 255, 255, 0.4);
}
.state-active .orb-glow {
  background: radial-gradient(circle, rgba(6, 182, 212, 0.6) 0%, rgba(79, 70, 229, 0.4) 50%, transparent 75%);
  opacity: 0.9;
  filter: blur(24px);
}
.state-active .ring-1 {
  animation: ripple 2.4s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}
.state-active .ring-2 {
  animation: ripple 2.4s cubic-bezier(0, 0.2, 0.8, 1) infinite 0.8s;
}
.state-active .ring-3 {
  animation: ripple 2.4s cubic-bezier(0, 0.2, 0.8, 1) infinite 1.6s;
}

@keyframes ripple {
  0% {
    width: 90px;
    height: 90px;
    opacity: 0.8;
  }
  100% {
    width: 200px;
    height: 200px;
    opacity: 0;
  }
}

@keyframes pulse-connecting {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.85;
  }
}

/* Status Indicator */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 2rem;
  transition: all 0.3s ease;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-idle {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.status-idle .status-dot {
  background-color: var(--text-muted);
}

.status-connecting {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-connecting .status-dot {
  background-color: #fbbf24;
  animation: blink 1s infinite alternate;
}

.status-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-active .status-dot {
  background-color: #34d399;
  box-shadow: 0 0 10px #34d399;
}

.status-muted {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.status-muted .status-dot {
  background-color: #f87171;
}

@keyframes blink {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

/* Controls */
.controls-area {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 1.75rem;
  border-radius: 0.85rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.btn-icon {
  width: 20px;
  height: 20px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
}
.btn-danger:hover {
  background: var(--danger-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-secondary.is-muted {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.error-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 0.75rem 1.25rem;
  border-radius: 0.65rem;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  max-width: 90%;
  text-align: center;
}

.micro-copy {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

/* Transcript */
.transcript-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.transcript-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.transcript-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.transcript-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
}

.transcript-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 280px;
  overflow-y: auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  text-align: center;
  gap: 0.75rem;
}

.empty-state svg {
  width: 32px;
  height: 32px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.875rem;
}

.chat-turn {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 85%;
  animation: fadeIn 0.2s ease forwards;
}

.turn-user {
  align-self: flex-end;
}
.turn-user .turn-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}
.turn-user .turn-sender {
  text-align: right;
}

.turn-assistant {
  align-self: flex-start;
}
.turn-assistant .turn-bubble {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: #f1f5f9;
  border-bottom-left-radius: 0.25rem;
}

.turn-sender {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 0.25rem;
}

.turn-bubble {
  padding: 0.65rem 0.95rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
}

.turn-time {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 0.2rem;
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-footer {
  text-align: center;
  padding-top: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
