/* ─── Reset & Base ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #0a0a0f;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text: #e8e8ed;
  --text-dim: #8888a0;
  --text-muted: #555566;
  --accent-us: #4f8ff7;
  --accent-us-glow: rgba(79, 143, 247, 0.3);
  --accent-uk: #e8596f;
  --accent-uk-glow: rgba(232, 89, 111, 0.3);
  --accent-primary: #7c5cfc;
  --accent-primary-glow: rgba(124, 92, 252, 0.35);
  --success: #34d399;
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Animated Background ─── */
.bg-mesh {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(124, 92, 252, 0.08), transparent),
    radial-gradient(ellipse 60% 80% at 80% 90%, rgba(79, 143, 247, 0.06), transparent),
    radial-gradient(ellipse 70% 50% at 50% 50%, rgba(232, 89, 111, 0.04), transparent);
  z-index: 0;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  z-index: 0;
  animation: float 20s ease-in-out infinite;
}

.bg-orb--1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(124, 92, 252, 0.15), transparent 70%);
  top: -10%; left: -5%;
  animation-delay: 0s;
}

.bg-orb--2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(79, 143, 247, 0.12), transparent 70%);
  bottom: -10%; right: -5%;
  animation-delay: -7s;
}

.bg-orb--3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(232, 89, 111, 0.1), transparent 70%);
  top: 40%; left: 50%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* ─── Layout ─── */
.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ─── Header ─── */
.header {
  text-align: center;
  margin-bottom: 48px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo-icon {
  font-size: 36px;
  filter: drop-shadow(0 0 12px var(--accent-primary-glow));
}

.header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #e8e8ed 0%, #7c5cfc 50%, #4f8ff7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-dim);
  font-size: 1.05rem;
  font-weight: 400;
}

/* ─── Steps ─── */
.step {
  margin-bottom: 36px;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #4f8ff7);
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-primary-glow);
}

.result-number {
  background: linear-gradient(135deg, var(--success), #059669);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
}

.step-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ─── Accent Cards ─── */
.accent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.accent-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 20px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  font-family: inherit;
  color: var(--text);
  outline: none;
}

.accent-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.accent-card[data-accent="american"].selected {
  border-color: var(--accent-us);
  background: rgba(79, 143, 247, 0.08);
  box-shadow: 0 0 30px var(--accent-us-glow), inset 0 0 30px rgba(79, 143, 247, 0.05);
}

.accent-card[data-accent="british"].selected {
  border-color: var(--accent-uk);
  background: rgba(232, 89, 111, 0.08);
  box-shadow: 0 0 30px var(--accent-uk-glow), inset 0 0 30px rgba(232, 89, 111, 0.05);
}

.accent-flag {
  font-size: 2.4rem;
  margin-bottom: 4px;
}

.accent-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.accent-card p {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.accent-check {
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: var(--transition);
  color: white;
}

.accent-card.selected .accent-check {
  opacity: 1;
  transform: scale(1);
}

.accent-card[data-accent="american"].selected .accent-check {
  background: var(--accent-us);
}

.accent-card[data-accent="british"].selected .accent-check {
  background: var(--accent-uk);
}

/* ─── Audio Input ─── */
.audio-input-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
}

.audio-option {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
}

.audio-option h3 {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.divider-or {
  display: flex;
  align-items: center;
  justify-content: center;
}

.divider-or span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ─── Record Button ─── */
.record-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.record-btn {
  position: relative;
  width: 72px; height: 72px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-primary), #5a3ce0);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 4px 24px var(--accent-primary-glow);
}

.record-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px var(--accent-primary-glow);
}

.record-btn__ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  opacity: 0;
  transition: var(--transition);
}

.record-btn.recording {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  box-shadow: 0 4px 24px rgba(239, 68, 68, 0.35);
  animation: pulse-record 1.5s ease-in-out infinite;
}

.record-btn.recording .record-btn__ring {
  opacity: 0.4;
  animation: ring-expand 1.5s ease-out infinite;
}

@keyframes pulse-record {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes ring-expand {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(1.5); opacity: 0; }
}

.record-btn__inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-label {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ─── Waveform ─── */
.waveform {
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

/* ─── Upload Area ─── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent-primary);
  background: rgba(124, 92, 252, 0.04);
}

.upload-area svg {
  opacity: 0.5;
}

.upload-area p {
  font-size: 0.85rem;
}

.upload-link {
  color: var(--accent-primary);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.upload-hint {
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
}

.file-info {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(124, 92, 252, 0.08);
  border: 1px solid rgba(124, 92, 252, 0.2);
}

.file-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-primary);
}

.file-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition);
}

.file-remove:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ─── Audio Preview ─── */
.audio-preview {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.audio-preview h4 {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.audio-preview audio,
.result-card audio {
  width: 100%;
  height: 44px;
  border-radius: 8px;
}

/* ─── Transcript ─── */
.transcript-section {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.transcript-section h4 {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.transcript-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.transcript-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.transcript-input::placeholder {
  color: var(--text-muted);
}

.transcript-input:focus {
  border-color: var(--primary);
}

/* ─── Convert Button ─── */
#step-convert {
  text-align: center;
}

.convert-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 48px;
  border-radius: 60px;
  border: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--accent-primary) 0%, #4f8ff7 100%);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 30px var(--accent-primary-glow);
  min-width: 220px;
}

.convert-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px var(--accent-primary-glow);
}

.convert-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.convert-btn__loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ─── Spinner ─── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Result ─── */
.result-section {
  animation: slideUp 0.5s ease-out;
}

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

.result-card {
  padding: 28px 24px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1.5px solid rgba(52, 211, 153, 0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 0 40px rgba(52, 211, 153, 0.06);
}

.result-accent {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--success);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 30px;
  border: 1.5px solid rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
  color: var(--success);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  align-self: flex-start;
}

.download-btn:hover {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.5);
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 14px 28px;
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .container {
    padding: 32px 16px 60px;
  }

  .header h1 {
    font-size: 1.8rem;
  }

  .accent-grid {
    grid-template-columns: 1fr;
  }

  .audio-input-grid {
    grid-template-columns: 1fr;
  }

  .divider-or {
    padding: 4px 0;
  }

  .convert-btn {
    width: 100%;
  }
}
