:root {
  --bg: #0b0d12;
  --card: #14171f;
  --card-border: #232733;
  --text: #f2f3f6;
  --text-dim: #9aa1b2;
  --accent: #ff3b47;
  --accent-dim: #ff3b4733;
  --pill: #1c202b;
  --pill-border: #2a2f3d;
  --success: #2fd47a;
  --danger: #ff5d5d;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-block: 48px;
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(600px circle at 20% 15%, #ff3b4722, transparent 60%),
    radial-gradient(500px circle at 85% 85%, #3b82ff1c, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 32px 28px 28px;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 12px;
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text-dim);
}

.steps {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}

.step {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--pill-border);
  transition: background 0.25s ease;
}

.step.active,
.step.done {
  background: var(--accent);
}

.panel {
  display: none;
  animation: fade-in 0.25s ease;
}

.panel.active {
  display: block;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 {
  font-size: 21px;
  margin: 0 0 6px;
  font-weight: 700;
}

.sub {
  color: var(--text-dim);
  font-size: 13.5px;
  margin: 0 0 22px;
  line-height: 1.5;
}

.field {
  margin-bottom: 6px;
}

#url-input {
  width: 100%;
  background: var(--pill);
  border: 1px solid var(--pill-border);
  color: var(--text);
  font-size: 15px;
  padding: 14px 16px;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#url-input::placeholder {
  color: #5c6273;
}

#url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: 6px 0 14px;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 20px;
  border-radius: 12px;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:active { transform: scale(0.98); }

.btn.primary {
  background: var(--accent);
  color: white;
  width: 100%;
}

.btn.primary:hover { opacity: 0.92; }

.btn.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--pill-border);
  flex: 0 0 auto;
}

.btn.ghost:hover {
  color: var(--text);
  border-color: #3a4053;
}

.row-buttons {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.row-buttons .btn.primary { flex: 1; }

.quality-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.pill {
  position: relative;
}

.pill input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.pill span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  border-radius: 10px;
  background: var(--pill);
  border: 1px solid var(--pill-border);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.pill input:checked + span {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text);
}

.pill input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.format-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.format-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 24px 12px;
  border-radius: 14px;
  background: var(--pill);
  border: 1px solid var(--pill-border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.format-card input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.format-card:has(input:checked) {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.fc-icon { font-size: 26px; }

.fc-title {
  font-weight: 700;
  font-size: 15px;
  margin-top: 2px;
}

.fc-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.loader-gif {
  display: block;
  width: 120px;
  height: 120px;
  margin: 4px auto 20px;
  border-radius: 50%;
  object-fit: cover;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--pill-border);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #ff7a52);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-pct {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

#panel-progress .error {
  text-align: center;
}

#panel-progress .row-buttons {
  margin-top: 18px;
}

.footnote {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  color: #4a5064;
  font-size: 12px;
  text-align: center;
  width: 100%;
}

@media (max-width: 420px) {
  .card { padding: 26px 20px 22px; }
  .quality-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
