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

:root {
  --bg: #0b0b12;
  --surface: #13131e;
  --surface-hover: #1c1c2e;
  --border: #22223a;
  --border-focus: #c9a86c;
  --text: #e6e1da;
  --text-muted: #6b6880;
  --accent: #c9a86c;
  --accent-glow: rgba(201, 168, 108, 0.15);
  --error: #d55a5a;
  --error-bg: rgba(213, 90, 90, 0.08);
  --success: #78b86a;
  --radius: 10px;
  --radius-sm: 6px;
}

html {
  height: 100%;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100%;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(201, 168, 108, 0.04) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(120, 184, 106, 0.03) 0%, transparent 60%);
  color: var(--text);
  font-family: 'DM Mono', 'SF Mono', 'Cascadia Code', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  line-height: 1.5;
}

main {
  width: 100%;
  max-width: 540px;
}

.frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px 32px;
  position: relative;
}

.frame::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius) + 1px);
  background: linear-gradient(135deg, rgba(201, 168, 108, 0.08), transparent 40%, transparent 60%, rgba(120, 184, 106, 0.06));
  pointer-events: none;
  z-index: -1;
}

header {
  margin-bottom: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin-bottom: 6px;
}

.logo svg {
  opacity: 0.85;
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 42px;
}

/* Form */
.input-group label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-row {
  display: flex;
  gap: 8px;
}

#urlInput {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#urlInput::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

#urlInput:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:active {
  transform: scale(0.97);
}

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

.btn-spinner svg {
  animation: spin 0.8s linear infinite;
}

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

/* Progress */
.progress-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.steps {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid transparent;
  transition: all 0.35s;
}

.step.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.step.done {
  color: var(--success);
  border-color: transparent;
  background: rgba(120, 184, 106, 0.08);
}

.step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}

.step-check,
.step-spin {
  display: none;
}

.step.active .step-dot { display: none; }
.step.active .step-spin { display: block; animation: spin 0.8s linear infinite; }
.step.done .step-dot { display: none; }
.step.done .step-check { display: block; }

.step-count {
  opacity: 0.6;
}

.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

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

.progress-status {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Result */
.result-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.result-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(120, 184, 106, 0.06);
  border: 1px solid rgba(120, 184, 106, 0.15);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.result-card svg {
  color: var(--success);
  flex-shrink: 0;
}

.result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-title {
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.btn-download {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.btn-download:hover {
  opacity: 0.9;
}

/* Error */
.error-section {
  margin-top: 20px;
}

.error-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--error-bg);
  border: 1px solid rgba(213, 90, 90, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.78rem;
  color: var(--error);
}

.error-card svg {
  flex-shrink: 0;
}

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

/* Responsive */
@media (max-width: 480px) {
  body { padding: 12px; }
  .frame { padding: 24px 18px; }
  .input-row { flex-direction: column; }
  .steps { flex-wrap: wrap; }
  .result-card { flex-wrap: wrap; }
  .btn-download { width: 100%; justify-content: center; }
}
