* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(to bottom, #0f172a, #1e293b);
  color: #f8fafc;
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

/* Header */
header {
  padding: 16px 20px;
  width: 100%;
  z-index: 10;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status {
  font-size: 15px;
  font-weight: 500;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status.ai-ready { color: #4ade80; }
.status.connecting { color: #fbbf24; }

.timer {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  transition: color 0.3s, background-color 0.3s;
}

.timer.timer-low {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.2);
}

/* Main Content */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  padding: 0 16px;
  overflow: hidden;
}

.visualizer-container {
  display: none;
}

/* Messages area */
.messages {
  width: 100%;
  flex: 1; /* Let it grow to fill all available space */
  max-height: none; /* Remove the 75vh limit */
  overflow-y: auto;
  /* Smooth fade mask at the top - reduced size */
  mask-image: linear-gradient(to bottom, transparent, black 40px);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 40px);
  padding-top: 20px; /* Reduced padding */
  padding-bottom: 120px;
  margin-bottom: 0;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.messages::-webkit-scrollbar { display: none; }

.msg {
  font-size: 16px;
  line-height: 1.5;
  padding: 8px 12px;
  color: #cbd5e1;
  animation: fadeIn 0.3s ease-out;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.msg.info { 
  color: #94a3b8; 
  font-size: 13px; 
  text-align: center; 
  background: transparent;
  padding: 4px 0;
  margin: 8px 0;
}
.msg.error { color: #f87171; text-align: center; background: rgba(239, 68, 68, 0.1); padding: 8px; border-radius: 8px; }
.msg.success { color: #e2e8f0; }
.msg.warn { color: #fcd34d; }

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

/* Bottom Controls Bar */
.controls-bar {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 32px;
  z-index: 20;
  background: #0f172a;
  background: rgba(15, 23, 42, 0.85);
  padding: 16px 32px;
  border-radius: 32px;
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.btn {
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

.btn-start {
  height: 56px;
  padding: 0 20px;
  border-radius: 999px;
  background: #3b82f6;
  color: #f9fafb;
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
  white-space: nowrap;
}

.btn-start:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.5);
}

.btn-start:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-start-icon {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-start-text {
  letter-spacing: 0.01em;
}

.btn-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #334155;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-circle svg {
  width: 28px;
  height: 28px;
  stroke-width: 2px;
}

.btn-circle:hover {
  transform: scale(1.05);
  background: #475569;
}

.btn-circle:active {
  transform: scale(0.92);
}

/* Mute Button States */
.btn-mute {
  background: #f8fafc;
  color: #0f172a;
}
.btn-mute:hover { background: #e2e8f0; }

.btn-mute.is-muted {
  background: #ef4444;
  color: white;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}
.btn-mute.is-muted:hover { background: #dc2626; }

/* End Chat Button */
.btn-hangup {
  background: #f86969;
  color: white;
}
.btn-hangup:hover { background: #6b0202; }

/* Buy Button */
.controls-bar.buy-mode {
  width: 90%;
  max-width: 400px;
  padding: 8px;
  gap: 0;
  display: flex;
  justify-content: center;
}

.btn-buy {
  width: 100%;
  border-radius: 24px;
  height: 56px;
  font-size: 16px;
  font-weight: 600;
  background: #3b82f6;
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.btn-buy:hover { background: #2563eb; }
.btn-buy:active { transform: scale(0.98); }

/* Footer */
footer {
  position: absolute;
  bottom: 8px;
  width: 100%;
  text-align: center;
  pointer-events: none;
  opacity: 0.5;
}
footer small {
  font-size: 11px;
  color: #64748b;
}

.lucide {
  width: 24px;
  height: 24px;
  stroke-width: 2px;
}

@media (max-height: 600px) {
  .controls-bar { bottom: 16px; padding: 8px 16px; }
  .btn-circle { width: 48px; height: 48px; }
  .messages { margin-bottom: 80px; }
}
