:root {
  --bg-gradient: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
  --card-bg: rgba(30, 41, 59, 0.75);
  --card-border: rgba(255, 255, 255, 0.12);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);
  
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--text-main);
}

.mobile-app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 600px;
  margin: 0 auto;
  padding: env(safe-area-inset-top, 12px) 12px env(safe-area-inset-bottom, 12px) 12px;
  gap: 10px;
}

/* Header & Compact Controls */
.app-header {
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-icon-sm {
  width: 18px;
  height: 18px;
  color: var(--accent-cyan);
}

.app-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-listening {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.status-listening .status-dot {
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-dot 1.2s infinite;
}

.status-processing {
  border-color: rgba(6, 182, 212, 0.5);
  background: rgba(6, 182, 212, 0.15);
  color: #7dd3fc;
}

.status-processing .status-dot {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: pulse-dot 0.8s infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
}

/* Main Controls Row */
.controls-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.mic-main-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--primary), #4338ca);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--primary-glow);
  transition: transform 0.1s ease, background 0.2s ease;
}

.mic-main-btn:active {
  transform: scale(0.98);
}

.mic-main-btn.recording {
  background: linear-gradient(135deg, var(--accent-rose), #e11d48);
  box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4);
}

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

.compact-actions {
  display: flex;
  gap: 6px;
}

.action-btn {
  width: 44px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.action-btn:active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.action-btn svg {
  width: 18px;
  height: 18px;
}

/* Audio Status Bar (Mic select & Meter) */
.audio-status-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mic-select-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}

.mic-icon-tiny {
  width: 12px;
  height: 12px;
  color: var(--text-dim);
}

.mic-select {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.mic-select option {
  background: #1e293b;
  color: var(--text-main);
}

.volume-bar-box {
  width: 70px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.volume-level-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
  transition: width 0.05s ease;
}

/* Main Dynamic AI Output Area (Takes 80%+ height) */
.main-output-container {
  flex: 1;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.output-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.ai-header-icon {
  width: 18px;
  height: 18px;
  color: #a855f7;
}

.count-badge {
  margin-left: auto;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--text-dim);
}

/* AI Output List */
.ai-stream-list {
  flex: 1;
  padding: 14px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.ai-stream-list::-webkit-scrollbar {
  width: 4px;
}

.ai-stream-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.empty-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  gap: 10px;
  text-align: center;
  padding: 0 20px;
}

.empty-placeholder svg {
  width: 40px;
  height: 40px;
  opacity: 0.35;
}

.empty-placeholder p {
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 260px;
}

/* AI Output Bubble Card (Large typography for mobile readability) */
.result-bubble {
  background: rgba(30, 27, 75, 0.45);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  animation: fadeIn 0.25s ease-out;
}

.result-bubble.streaming {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.25);
}

.bubble-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #a5b4fc;
  margin-bottom: 6px;
  font-weight: 500;
}

.bubble-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #f8fafc;
  word-break: break-word;
  font-weight: 400;
}

.cursor-blink {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent-cyan);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

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