*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4f6ef7;
  --primary-dark: #3a57d4;
  --primary-light: #eef1ff;
  --success: #22c55e;
  --error: #ef4444;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}

.page { width: 100%; max-width: 600px; display: flex; flex-direction: column; gap: 24px; }

/* Header */
.header { text-align: center; }
.logo { font-size: 2rem; font-weight: 800; color: var(--primary); letter-spacing: -1px; }
.tagline { color: var(--muted); margin-top: 4px; font-size: .95rem; }

/* Card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border-radius: 50px;
  padding: 6px;
}

.mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 50px;
  background: transparent;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
  transition: all .2s;
}

.mode-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79,110,247,.35);
}

.mode-btn:not(.active):hover { background: var(--border); color: var(--text); }
.mode-icon { font-size: 1.1rem; }
.mode-arrow { color: var(--muted); font-size: 1.2rem; flex-shrink: 0; }

.mode-hint { text-align: center; color: var(--muted); font-size: .85rem; margin-top: -8px; }

/* Drop Zone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.drop-icon { font-size: 2.5rem; }
.drop-text { margin-top: 10px; font-weight: 600; font-size: .95rem; }
.drop-sub { color: var(--muted); font-size: .82rem; margin-top: 4px; }

/* File List */
.file-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .88rem;
}

.file-item-icon { font-size: 1.2rem; flex-shrink: 0; }
.file-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-size { color: var(--muted); font-size: .8rem; flex-shrink: 0; }
.file-item-remove {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 1.1rem; line-height: 1; padding: 2px 4px; border-radius: 4px;
  transition: color .15s;
}
.file-item-remove:hover { color: var(--error); }

/* Quality Selector */
.quality-bar {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.quality-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.quality-options {
  display: flex;
  gap: 8px;
  flex: 1;
}

.quality-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  transition: all .2s;
  line-height: 1.2;
}

.quality-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.quality-btn:not(.active):hover {
  border-color: #cbd5e1;
  color: var(--text);
}

.quality-sub {
  font-size: .72rem;
  font-weight: 400;
  color: inherit;
  opacity: .75;
}

/* Convert Button */
.btn-convert {
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s, opacity .2s;
}

.btn-convert:hover:not(:disabled) { background: var(--primary-dark); }
.btn-convert:active:not(:disabled) { transform: scale(.98); }
.btn-convert:disabled { opacity: .45; cursor: not-allowed; }

/* Progress */
.progress-wrap { display: flex; flex-direction: column; gap: 8px; }
.progress-bar { background: var(--border); border-radius: 50px; height: 6px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 50px;
  transition: width .4s ease;
  animation: pulse-progress 1.5s ease-in-out infinite;
}
@keyframes pulse-progress {
  0%, 100% { opacity: 1; } 50% { opacity: .7; }
}
.progress-text { text-align: center; color: var(--muted); font-size: .88rem; }

/* Results */
.result-wrap { display: flex; flex-direction: column; gap: 12px; }
.result-header { display: flex; align-items: center; justify-content: space-between; }
.result-title { font-weight: 700; color: var(--success); }

.btn-reset {
  background: none; border: 1px solid var(--border); border-radius: 50px;
  padding: 5px 14px; font-size: .82rem; cursor: pointer; color: var(--muted);
  transition: all .2s;
}
.btn-reset:hover { border-color: var(--primary); color: var(--primary); }

.result-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.result-item {
  display: flex; align-items: center; gap: 10px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 8px; padding: 10px 14px; font-size: .88rem;
}

.result-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-dl {
  background: var(--success); color: #fff; border: none; border-radius: 50px;
  padding: 6px 14px; font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: background .2s; flex-shrink: 0;
}
.btn-dl:hover { background: #16a34a; }

.btn-download-all {
  padding: 12px; background: var(--text); color: #fff; border: none;
  border-radius: 50px; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.btn-download-all:hover { background: #334155; }

/* Error */
.error-box {
  display: flex; align-items: center; gap: 10px;
  background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 8px; padding: 12px 14px; font-size: .88rem; color: #991b1b;
}
.error-icon { flex-shrink: 0; }
.error-close {
  margin-left: auto; background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: #b91c1c; line-height: 1; padding: 0 4px;
}

/* Footer */
.footer { text-align: center; color: var(--muted); font-size: .8rem; }

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

@media (max-width: 480px) {
  .card { padding: 20px 16px; }
  .mode-label { font-size: .8rem; }
}
