/* =====================================================
   WISHPER — Premium Dark Theme with Glassmorphism
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

/* --- Variables --- */
:root {
  --bg: #080b14;
  --bg2: #0d1120;
  --surface: rgba(255, 255, 255, 0.04);
  --surface2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.13);
  --purple: #a78bfa;
  --purple-d: #7c3aed;
  --pink: #f472b6;
  --cyan: #38bdf8;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --glow: 0 0 40px rgba(167, 139, 250, 0.15);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Outfit', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- Animated Background Orbs --- */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 12s ease-in-out infinite;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.15), transparent 70%);
  top: -200px;
  left: -150px;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.1), transparent 70%);
  top: 40%;
  right: -150px;
  animation-delay: 4s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.1), transparent 70%);
  bottom: -100px;
  left: 30%;
  animation-delay: 8s;
}

@keyframes orbFloat {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -40px) scale(1.05);
  }

  66% {
    transform: translate(-20px, 20px) scale(0.97);
  }
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  backdrop-filter: blur(20px) saturate(1.5);
  background: rgba(8, 11, 20, 0.7);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon svg {
  width: 36px;
  height: 36px;
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text2);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 6px 14px;
}

.badge-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0);
  }
}

/* --- Main Layout --- */
.main {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* --- Hero --- */
.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.gradient-text {
  background: linear-gradient(135deg, #a78bfa 0%, #f472b6 50%, #38bdf8 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradShift 4s ease-in-out infinite;
}

@keyframes gradShift {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

.hero-sub {
  color: var(--text2);
  font-size: 1rem;
  font-weight: 400;
}

/* --- Card Base --- */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow), var(--glow);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0;
}

.card-title svg {
  color: var(--purple);
}

/* --- Source Tabs --- */
.source-card .card-title {
  margin-bottom: 22px;
}

.source-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px;
  border-radius: 12px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text2);
  background: transparent;
  transition: all 0.25s;
}

.tab-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface2);
}

.tab-btn.active {
  color: var(--text);
  background: var(--surface2);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* --- Tab Panels --- */
.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Drop Zone --- */
.dropzone {
  border: 2px dashed var(--border2);
  border-radius: 14px;
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: rgba(167, 139, 250, 0.02);
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--purple);
  background: rgba(167, 139, 250, 0.07);
}

.dropzone-icon svg {
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
}

.dropzone-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 0.82rem;
  color: var(--text3);
  margin-bottom: 18px;
}

.file-info {
  margin-top: 14px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
}

.file-size {
  color: var(--text3);
  font-size: 0.78rem;
}

.remove-file {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 0 0 6px;
  transition: color 0.2s;
}

.remove-file:hover {
  color: var(--red);
}

/* --- URL Input --- */
.url-input-group {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border2);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.url-input-group:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15);
}

.url-icon {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.url-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  padding: 12px 8px;
}

.url-input::placeholder {
  color: var(--text3);
}

.url-paste-btn {
  padding: 12px 14px;
  background: var(--surface2);
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
}

.url-paste-btn:hover {
  background: var(--surface);
  color: var(--purple);
}

.url-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text3);
  margin-bottom: 14px;
}

.spotify-hint {
  color: rgba(251, 191, 36, 0.7);
}

.url-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
}

.url-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.url-title {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}

.url-duration,
.url-artist {
  font-size: 0.78rem;
  color: var(--text3);
}

/* --- Options Row --- */
.options-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 22px 0;
  flex-wrap: wrap;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.option-label {
  font-size: 0.75rem;
  color: var(--text3);
  font-weight: 500;
}

.option-select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.option-select:focus {
  border-color: var(--purple);
}

.option-select option {
  background: #0d1120;
}

.option-toggle {
  margin-left: auto;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text2);
  user-select: none;
}

.toggle-label input {
  display: none;
}

.toggle-switch {
  width: 40px;
  height: 22px;
  background: var(--border2);
  border-radius: 11px;
  position: relative;
  transition: background 0.3s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-label input:checked+.toggle-switch {
  background: var(--purple);
}

.toggle-label input:checked+.toggle-switch::after {
  transform: translateX(18px);
}

/* --- Buttons --- */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 28px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.4);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: translateX(-100%);
}

.btn-primary:hover:not(:disabled) .btn-shimmer {
  animation: shimmer 0.6s ease;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text2);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--purple);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text3);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border2);
  background: var(--surface2);
}

.btn-sm {
  padding: 7px 14px !important;
  font-size: 0.82rem !important;
}

/* --- Progress Section --- */
.progress-card {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.progress-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-weight: 500;
}

.progress-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-bar-wrap {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s ease;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.pstep {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text3);
  transition: color 0.3s;
}

.pstep.active {
  color: var(--purple);
}

.pstep.done {
  color: var(--green);
}

.pstep-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* --- Waveform Card --- */
.waveform-card {
  padding: 22px 28px;
}

.waveform-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.track-thumb {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  overflow: hidden;
}

.track-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.track-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-sub {
  font-size: 0.78rem;
  color: var(--text3);
}

.playback-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.2s;
}

.ctrl-btn:hover {
  color: var(--text);
  border-color: var(--purple);
  background: rgba(167, 139, 250, 0.1);
}

.ctrl-play {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border-color: transparent;
  color: white;
  width: 46px;
  height: 46px;
}

.ctrl-play:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
}

.time-display {
  font-size: 0.85rem;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.time-sep {
  margin: 0 4px;
  color: var(--text3);
}

.waveform-canvas {
  width: 100%;
  height: 80px;
  display: block;
  cursor: pointer;
  border-radius: 8px;
}

/* --- Analysis Grid --- */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.analysis-card {
  padding: 22px;
}

.ac-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.ac-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.voice-icon {
  background: rgba(167, 139, 250, 0.15);
}

.emotion-icon {
  background: rgba(244, 114, 182, 0.15);
}

.tone-icon {
  background: rgba(56, 189, 248, 0.15);
}

.ac-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.ac-subtitle {
  font-size: 0.75rem;
  color: var(--text3);
}

.voice-type-badge {
  display: inline-block;
  padding: 6px 16px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(56, 189, 248, 0.2));
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 20px;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--purple);
}

.voice-metrics {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vm-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vm-label {
  font-size: 0.75rem;
  color: var(--text3);
  width: 65px;
  flex-shrink: 0;
}

.vm-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  overflow: hidden;
}

.vm-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--purple-d));
  border-radius: 3px;
  transition: width 1s ease;
}

.vm-fill.accent-pink {
  background: linear-gradient(90deg, var(--pink), #e879a0);
}

.vm-fill.accent-cyan {
  background: linear-gradient(90deg, var(--cyan), #0ea5e9);
}

.vm-val {
  font-size: 0.75rem;
  color: var(--text2);
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}

/* Emotion Wheel */
.emotion-wheel {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 14px;
}

.ew-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: conic-gradient(var(--purple), var(--pink), var(--cyan), var(--yellow), var(--purple));
  border-radius: 50%;
  padding: 3px;
}

.ew-center::before {
  content: '';
  position: absolute;
  inset: 3px;
  background: var(--bg2);
  border-radius: 50%;
}

.ew-center {
  z-index: 0;
}

.emotion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.emotion-tag {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

.et-joy {
  background: rgba(251, 191, 36, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.et-sadness {
  background: rgba(56, 189, 248, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.et-anger {
  background: rgba(248, 113, 113, 0.12);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.et-neutral {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text2);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.et-love {
  background: rgba(244, 114, 182, 0.12);
  color: var(--pink);
  border: 1px solid rgba(244, 114, 182, 0.2);
}

.et-fear {
  background: rgba(167, 139, 250, 0.12);
  color: var(--purple);
  border: 1px solid rgba(167, 139, 250, 0.2);
}

.et-surprise {
  background: rgba(52, 211, 153, 0.12);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.pitch-chart {
  width: 100%;
  height: 70px;
  display: block;
}

.tone-levels {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

.tl-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text2);
}

.tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.tl-high .tl-dot {
  background: var(--pink);
}

.tl-mid .tl-dot {
  background: var(--purple);
}

.tl-low .tl-dot {
  background: var(--cyan);
}

/* --- Transcript Timeline --- */
.tc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.tc-actions {
  display: flex;
  gap: 8px;
}

.transcript-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 8px;
}

.transcript-timeline::-webkit-scrollbar {
  width: 4px;
}

.transcript-timeline::-webkit-scrollbar-track {
  background: transparent;
}

.transcript-timeline::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 2px;
}

.tt-segment {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.25s;
}

.tt-segment:hover {
  background: var(--surface2);
  border-color: var(--border);
}

.tt-segment.active {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.25);
}

.tt-time {
  font-size: 0.75rem;
  color: var(--purple);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 60px;
  padding-top: 2px;
}

.tt-content {
  flex: 1;
}

.tt-text {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 5px;
}

.tt-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tt-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* --- Avatar Stage --- */
.avatar-card {
  padding: 22px 28px;
}

.sync-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text3);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
}

.sync-dot.active {
  background: var(--green);
  animation: pulse 1.5s ease-in-out infinite;
}

.avatar-stage {
  display: flex;
  gap: 32px;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-container {
  position: relative;
  flex-shrink: 0;
}

.avatar-face {
  width: 140px;
  height: 160px;
  background: linear-gradient(160deg, #1e1b4b, #1e3a5f);
  border-radius: 60px 60px 50px 50px;
  border: 2px solid rgba(167, 139, 250, 0.3);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease;
}

.avatar-eyes {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  margin-top: 50px;
}

.eye {
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s;
}

.pupil {
  width: 14px;
  height: 14px;
  background: #1a0a2e;
  border-radius: 50%;
  position: absolute;
  transition: transform 0.2s;
}

.avatar-brow {
  position: absolute;
  width: 26px;
  height: 4px;
  background: #a78bfa;
  border-radius: 2px;
  top: 44px;
  transition: transform 0.4s, top 0.4s;
}

.left-brow {
  left: 26px;
}

.right-brow {
  right: 26px;
}

.avatar-mouth {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 24px;
  overflow: hidden;
  border-radius: 0 0 25px 25px;
}

.mouth-inner {
  width: 50px;
  height: 50px;
  background: #0f0a1e;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  transform: scaleY(0.3);
  transform-origin: top;
  transition: transform 0.4s, border-radius 0.4s;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.avatar-body {
  width: 100px;
  height: 70px;
  background: linear-gradient(160deg, #1e1b4b, #1e3a5f);
  border-radius: 30px 30px 10px 10px;
  margin: -10px auto 0;
  border: 2px solid rgba(167, 139, 250, 0.2);
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.avatar-arm {
  position: absolute;
  width: 20px;
  height: 50px;
  background: linear-gradient(180deg, #1e1b4b, #1e3a5f);
  border-radius: 10px;
  top: 10px;
  border: 1px solid rgba(167, 139, 250, 0.2);
  transition: transform 0.5s ease;
}

.left-arm {
  left: -16px;
  transform-origin: top center;
}

.right-arm {
  right: -16px;
  transform-origin: top center;
}

.avatar-info-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 180px;
  flex: 1;
}

.aip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.aip-label {
  font-size: 0.75rem;
  color: var(--text3);
  font-weight: 500;
}

.aip-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--purple);
}

/* --- Prompt Output --- */
.prompt-card {
  padding: 22px 28px;
}

.prompt-actions {
  display: flex;
  gap: 8px;
}

.prompt-format-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0 14px;
}

.pfmt-btn {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text3);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pfmt-btn:hover {
  color: var(--text);
  border-color: var(--border2);
}

.pfmt-btn.active {
  background: rgba(167, 139, 250, 0.1);
  border-color: var(--purple);
  color: var(--purple);
}

.prompt-output {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  overflow: auto;
  max-height: 420px;
  font-size: 0.78rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-output code {
  font-family: 'Courier New', monospace;
  color: #c4b5fd;
}

.prompt-output::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.prompt-output::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 2px;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: all 0.3s;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--green);
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--red);
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .header {
    padding: 14px 18px;
  }

  .main {
    padding: 28px 16px 60px;
  }

  .source-tabs {
    flex-direction: column;
  }

  .options-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .option-toggle {
    margin-left: 0;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .avatar-stage {
    flex-direction: column;
  }
}

/* --- Avatar Body Animation Classes --- */
.avatar-face {
  transition: box-shadow 0.5s ease, transform 0.4s ease;
}

.body-excited {
  animation: bodyBounce 0.5s ease-in-out;
}

.body-forward {
  transform: scaleX(1.04);
}

.body-slouch {
  transform: scaleY(0.96) translateY(4px);
}

@keyframes bodyBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  25% {
    transform: translateY(-6px) scale(1.02);
  }

  75% {
    transform: translateY(2px);
  }
}

/* Avatar mouth/brow/arm transitions */
.mouth-inner {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar-brow {
  transition: top 0.35s ease, transform 0.35s ease;
}

.avatar-arm {
  transition: transform 0.5s cubic-bezier(0.34, 1.20, 0.64, 1);
}

.eye {
  transition: transform 0.3s ease;
}

/* Idle breathing animation when no audio */
@keyframes breathe {

  0%,
  100% {
    transform: scaleY(1);
  }

  50% {
    transform: scaleY(1.012);
  }
}

.avatar-body {
  animation: breathe 3.5s ease-in-out infinite;
}

/* Transcript active segment */
.tt-segment.active .tt-text {
  color: var(--purple);
  transition: color 0.3s;
}

.tt-segment {
  transition: background 0.25s, border-color 0.25s;
}

/* Waveform canvas */
#waveformCanvas {
  background: rgba(0, 0, 0, 0.2);
}

/* Prompt output code color */
.prompt-output code {
  color: #c4b5fd;
}

/* ─── SuperGrok Cinema Mode ───────────────────────────────── */
.supergrok-card {
  border-color: rgba(167, 139, 250, 0.25);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.06), rgba(56, 189, 248, 0.04));
  position: relative;
  overflow: hidden;
}

.supergrok-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #7c3aed, #a78bfa, #38bdf8);
}

.badge-supergrok {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #7c3aed, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 20px;
  padding: 3px 10px;
  background-clip: text;
}

.sg-description {
  color: var(--text2);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 14px 0 20px;
}

.sg-description strong {
  color: var(--purple);
}

.sg-controls {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.sg-slider-group {
  flex: 1;
  min-width: 200px;
}

.sg-label {
  font-size: 0.75rem;
  color: var(--text3);
  font-weight: 500;
  display: block;
  margin-bottom: 8px;
}

.sg-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sg-slider-min,
.sg-slider-max {
  font-size: 0.78rem;
  color: var(--text3);
  min-width: 22px;
}

.sg-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.sg-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--purple);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.sg-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 5px rgba(167, 139, 250, 0.3);
}

.sg-slider-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--purple);
  min-width: 28px;
}

.btn-generate-scenes {
  width: auto !important;
  white-space: nowrap;
  background: linear-gradient(135deg, #7c3aed, #38bdf8) !important;
  padding: 10px 22px !important;
}

/* Scene summary info bar */
.sg-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text2);
  flex-wrap: wrap;
}

.sg-summary strong {
  color: var(--purple);
}

/* Scene list */
.sg-scenes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sg-scene-item {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.sg-scene-item:hover {
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.1);
}

.sg-scene-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}

.sg-scene-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.sg-scene-meta {
  flex: 1;
}

.sg-scene-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}

.sg-scene-time {
  font-size: 0.78rem;
  color: var(--text3);
  font-family: 'Inter', monospace;
}

.sg-bridge-tag {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--cyan);
  font-weight: 600;
  white-space: nowrap;
}

.sg-bridge-tag.first {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.25);
  color: var(--green);
}

.sg-scene-actions {
  display: flex;
  gap: 8px;
  padding: 0 18px 14px;
}

.sg-scene-prompt {
  display: none;
  padding: 0 18px 16px;
}

.sg-scene-prompt.open {
  display: block;
}

.sg-scene-prompt pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 0.75rem;
  color: #c4b5fd;
  overflow-x: auto;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

/* --- Tutorial Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(167, 139, 250, 0.2);
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.modal-title svg {
  color: var(--purple);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text3);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  color: var(--text2);
  font-size: 0.95rem;
  line-height: 1.6;
}

.step-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.step-card h4 {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 1rem;
}

.step-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text2);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}