:root {
  --bg-primary: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.7);
  --border-card: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --color-accent: #6366f1;
  --color-accent-hover: #4f46e5;
  --color-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --color-success: #10b981;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  overflow-x: hidden;
  position: relative;
}

/* Aurora Background Effects */
.aurora-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
}
.aurora-1 {
  background: radial-gradient(circle, #6366f1, #a855f7);
  top: -200px;
  right: -200px;
  animation: float-aurora-1 20s infinite alternate ease-in-out;
}
.aurora-2 {
  background: radial-gradient(circle, #ec4899, #3b82f6);
  bottom: -200px;
  left: -200px;
  animation: float-aurora-2 25s infinite alternate ease-in-out;
}
@keyframes float-aurora-1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-80px, 80px) scale(1.2); }
}
@keyframes float-aurora-2 {
  0% { transform: translate(0, 0) scale(1.2); }
  100% { transform: translate(80px, -80px) scale(0.9); }
}

.shell {
  width: min(800px, calc(100% - 32px));
  padding: 60px 0;
}

.hero {
  text-align: center;
  margin-bottom: 40px;
}

.eyebrow {
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  margin-bottom: 12px;
}

h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  margin: 8px 0;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

h1 span {
  background: linear-gradient(135deg, #a5b4fc 0%, #e879f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 600px;
  margin: 16px auto 0 auto;
}

/* Hardware Accel Badge */
.hw-badge-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.hw-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}
.hw-badge.webgpu-fp16 {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: #34d399;
}
.hw-badge.webgpu-fp16 .pulse-dot {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}
.hw-badge.webgpu-fp32 {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
}
.hw-badge.webgpu-fp32 .pulse-dot {
  background-color: #3b82f6;
  box-shadow: 0 0 8px #3b82f6;
}
.hw-badge.wasm {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}
.hw-badge.wasm .pulse-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}
.hw-badge.detecting {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
}
.hw-badge.detecting .pulse-dot {
  background-color: #94a3b8;
  animation: pulse 1.5s infinite;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}
.hw-badge:not(.detecting) .pulse-dot::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  animation: pulse-ring 1.8s cubic-bezier(0.215, 0.610, 0.355, 1) infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(2.8); opacity: 0; }
}
@keyframes pulse {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 28px;
  padding: 36px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: all 0.3s ease;
}

.drop-zone {
  min-height: 180px;
  border: 2px dashed rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.02);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 24px;
  text-align: center;
}

.drop-zone.dragging, .drop-zone:hover {
  border-color: var(--color-accent);
  background: rgba(99, 102, 241, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.1);
}

.drop-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--color-accent);
  display: grid;
  place-items: center;
  transition: all 0.3s ease;
}

.drop-zone:hover .drop-icon {
  background: var(--color-accent);
  color: white;
  transform: scale(1.05);
}

.drop-icon svg {
  width: 24px;
  height: 24px;
}

.drop-zone strong {
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 600;
}

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

/* File selected state */
.file-info-container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease-out;
}

.file-icon {
  font-size: 1.8rem;
}

.file-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  text-align: left;
}

.change-file-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.change-file-btn:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* Controls */
.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 28px 0;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.select-wrapper::after {
  content: '▼';
  font-size: 0.65rem;
  color: var(--text-secondary);
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  transition: all 0.2s ease;
}

select {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 36px 12px 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.3s ease;
}

select:focus {
  outline: none;
  border-color: var(--color-accent);
  background: rgba(99, 102, 241, 0.05);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

select option {
  background-color: #111827;
  color: var(--text-primary);
}

.control-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
  line-height: 1.3;
}

/* Checkboxes */
.options-row {
  display: flex;
  gap: 24px;
  margin: 20px 0 28px 0;
  flex-wrap: wrap;
}

.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 28px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
  transition: color 0.2s ease;
}

.checkbox-container:hover {
  color: var(--text-primary);
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0;
  height: 18px;
  width: 18px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.checkbox-container input:checked ~ .checkmark {
  background: var(--color-gradient);
  border-color: transparent;
}

.checkmark::after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark::after {
  display: block;
}

.checkbox-container .checkmark::after {
  left: 6px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Transcribe button */
button#transcribe {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 16px 20px;
  background: var(--color-gradient);
  color: white;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button#transcribe:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

button#transcribe:active:not(:disabled) {
  transform: translateY(0);
}

button#transcribe:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: none;
  cursor: not-allowed;
}

/* Progress */
.progress-area {
  margin-top: 32px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 20px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

#status {
  color: var(--text-primary);
}

#progress-percent {
  color: var(--color-accent);
}

.progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--color-gradient);
  border-radius: 99px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Detailed download states */
.download-details {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
  padding-right: 8px;
}

.download-details::-webkit-scrollbar {
  width: 4px;
}
.download-details::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

.download-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.download-item-file {
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.download-item-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 35%;
}

.download-item-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 99px;
  overflow: hidden;
}

.download-item-bar {
  height: 100%;
  width: 0;
  background: var(--color-accent);
  border-radius: 99px;
}

/* Live Preview */
.live-preview-container {
  margin-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 24px;
}

.live-preview-container h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.live-transcript {
  max-height: 200px;
  overflow-y: auto;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.live-transcript::-webkit-scrollbar {
  width: 6px;
}
.live-transcript::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 99px;
}

.live-chunk {
  margin-bottom: 8px;
  animation: fadeIn 0.3s ease-out forwards;
}

.live-timestamp {
  color: var(--color-accent);
  font-weight: 700;
  margin-right: 6px;
  font-family: monospace;
}

.live-text {
  color: var(--text-primary);
}

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

/* Results */
.result {
  margin-top: 32px;
  padding: 24px;
  border-radius: 16px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.15);
  color: #a7f3d0;
  text-align: center;
  animation: fadeIn 0.4s ease-out;
}

.result strong {
  font-size: 1.1rem;
  color: #34d399;
}

.download-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 24px;
  background: #10b981;
  color: white;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.download-link-btn:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer {
  margin-top: 24px;
}

@media (max-width: 600px) {
  .control-grid {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 24px;
  }
  .options-row {
    flex-direction: column;
    gap: 14px;
    margin: 10px 0 20px 0;
  }
}
