:root {
  --bg-main: #0a0e17;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(24, 32, 50, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.3);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);

  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);

  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.35);

  --amber: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
  --shadow-glow: 0 0 25px var(--primary-glow);
}

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

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app-container {
  width: 100%;
  max-width: 580px;
  padding: 1.25rem 1rem 3rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.brand-text h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-text h1 span {
  background: linear-gradient(90deg, #818cf8, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Cards & Containers */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  transition: border-color 0.25s ease;
}

/* Studio Recording Card */
.recording-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.studio-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--text-muted);
  transition: background-color 0.3s ease;
}

.status-pill.recording .pulse-dot {
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: pulse-glow 1.2s infinite ease-in-out;
}

.timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Waveform Canvas */
.waveform-container {
  width: 100%;
  height: 80px;
  background: rgba(10, 14, 23, 0.6);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  margin-bottom: 1.5rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#waveformCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.waveform-placeholder {
  position: absolute;
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

/* Big Record Button */
.studio-controls {
  margin-bottom: 1rem;
}

.record-button {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.record-button-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed rgba(99, 102, 241, 0.4);
  transition: all 0.3s ease;
}

.record-button-inner {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 24px var(--primary-glow);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
}

.record-button:hover .record-button-inner {
  transform: scale(1.05);
}

.record-button:active .record-button-inner {
  transform: scale(0.95);
}

.record-button.recording .record-button-inner {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 8px 24px var(--danger-glow);
}

.record-button.recording .record-button-ring {
  border: 2px solid var(--danger);
  animation: rotate-ring 6s linear infinite;
}

.icon-stop {
  width: 22px;
  height: 22px;
  background-color: white;
  border-radius: 4px;
}

.studio-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.voice-preview-row {
  margin-top: 1.15rem;
  display: flex;
  justify-content: center;
  width: 100%;
}

.voice-preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.4));
  border: 1.5px solid rgba(165, 180, 252, 0.65);
  border-radius: var(--radius-full);
  padding: 0.55rem 1.25rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.voice-preview-pill:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(139, 92, 246, 0.65));
  border-color: #ffffff;
  box-shadow: 0 6px 25px rgba(99, 102, 241, 0.55), 0 0 15px rgba(129, 140, 248, 0.4);
  transform: translateY(-2px);
}

.voice-preview-pill .pill-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 10px #34d399;
}

.voice-preview-pill strong {
  font-weight: 700;
  color: #ffffff;
}

.voice-preview-pill.playing {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.45), rgba(5, 150, 105, 0.55));
  border-color: #6ee7b7;
  color: #ffffff;
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.5), 0 0 15px rgba(52, 211, 153, 0.4);
}

.voice-preview-pill.playing .pill-dot {
  background-color: #ffffff;
  box-shadow: 0 0 12px #ffffff;
  animation: pulse-glow 1s infinite ease-in-out;
}

/* Audio Review & Actions */
.audio-review {
  width: 100%;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

audio {
  width: 100%;
  height: 38px;
  border-radius: var(--radius-sm);
  filter: invert(0.88) hue-rotate(180deg);
}

.review-actions {
  display: flex;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  box-shadow: 0 4px 16px var(--primary-glow);
  flex: 1;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-ghost {
  background: none;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
}

.full-width {
  width: 100%;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-subtle {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-priority {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.badge-priority.high {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-priority.medium {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-priority.low {
  background: rgba(100, 116, 139, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

/* Processing State Card */
.processing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.processing-spinner {
  width: 70px;
  height: 70px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--primary);
  animation: rotate-ring 1s linear infinite;
}

.spinner-ai-icon {
  color: var(--primary);
  animation: pulse-glow 1.5s infinite ease-in-out;
}

.processing-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.processing-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.processing-progress-bar {
  width: 100%;
  max-width: 280px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.processing-progress-fill {
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #34d399);
  border-radius: var(--radius-full);
  animation: indeterminate-progress 1.5s infinite ease-in-out;
}

/* Results Card */
.results-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.results-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.results-tools {
  display: flex;
  gap: 0.4rem;
}

.demo-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.75rem;
  color: #fde68a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.demo-banner code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

/* Section Blocks */
.section-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.section-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.voice-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.voice-select {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.voice-select:hover, .voice-select:focus {
  border-color: var(--border-highlight);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.07);
}

.btn-voice {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-voice:hover {
  background: rgba(99, 102, 241, 0.25);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.btn-voice.speaking {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--emerald);
  color: #6ee7b7;
}

.btn-voice.loading {
  opacity: 0.7;
  cursor: wait;
}

.btn-xs {
  font-size: 0.68rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.readback-player-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  animation: slide-up 0.2s ease-out;
}

.readback-status {
  font-size: 0.75rem;
  color: #c7d2fe;
  flex: 1;
  font-weight: 500;
}

.sound-wave-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 14px;
}

.sound-wave-bars .bar {
  width: 2px;
  height: 100%;
  background-color: var(--primary);
  border-radius: 1px;
  animation: wave-bar 1.2s infinite ease-in-out;
}

.sound-wave-bars .bar:nth-child(1) { animation-delay: 0.0s; height: 30%; }
.sound-wave-bars .bar:nth-child(2) { animation-delay: 0.2s; height: 75%; }
.sound-wave-bars .bar:nth-child(3) { animation-delay: 0.4s; height: 100%; }
.sound-wave-bars .bar:nth-child(4) { animation-delay: 0.1s; height: 60%; }
.sound-wave-bars .bar:nth-child(5) { animation-delay: 0.3s; height: 40%; }

.summary-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #e2e8f0;
}

/* Action Items List */
.action-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.action-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.action-item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
}

.action-item-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--emerald);
  cursor: pointer;
}

.action-item-text {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.4;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.action-item.completed .action-item-text {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Key Highlights */
.key-points-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.key-point-item {
  position: relative;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.key-point-item::before {
  content: "•";
  color: var(--primary);
  font-weight: bold;
  font-size: 1.2rem;
  position: absolute;
  left: 0.2rem;
  top: -0.1rem;
}

/* Transcript Accordion */
.transcript-details {
  background: rgba(10, 14, 23, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.transcript-summary {
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.transcript-summary::-webkit-details-marker {
  display: none;
}

.chevron {
  transition: transform 0.2s ease;
}

.transcript-details[open] .chevron {
  transform: rotate(180deg);
}

.transcript-content {
  padding: 0 1rem 1rem 1rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #94a3b8;
  white-space: pre-wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid var(--border-highlight);
  color: var(--text-primary);
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  animation: pop-up 0.25s ease-out;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Keyframes */
@keyframes rotate-ring {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
}

@keyframes indeterminate-progress {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
  100% { transform: translateX(250%); }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop-up {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes wave-bar {
  0%, 100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}
