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

:root {
  --bg: #0a0a0f;
  --surface: #111118;
  --surface2: #1a1a25;
  --border: #2a2a3a;
  --border-bright: #3a3a55;
  --accent: #5b8cff;
  --accent2: #a78bfa;
  --accent-glow: rgba(91, 140, 255, 0.15);
  --text: #e8e8f0;
  --text-muted: #6b6b8a;
  --text-dim: #3a3a55;
  --green: #22d3a0;
  --red: #ff5b5b;
  --font-display: 'Syne', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius: 12px;
  --radius-sm: 6px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background grid */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.4;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 20%, black 30%, transparent 100%);
}

.noise {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Header */
.header {
  position: relative; z-index: 10;
  padding: 48px 64px 0;
  display: flex; flex-direction: column; gap: 8px;
}

.logo {
  display: flex; align-items: center; gap: 0;
  font-size: 28px; font-weight: 800; letter-spacing: -1px;
}

.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 18px; font-weight: 800;
  margin-right: 6px;
  box-shadow: 0 0 20px var(--accent-glow);
}

.tagline {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  padding-left: 42px;
}

/* Main */
.main {
  position: relative; z-index: 10;
  max-width: 820px;
  margin: 0 auto;
  padding: 64px 32px 120px;
}

/* Form sections */
.build-form {
  display: flex; flex-direction: column; gap: 0;
}

.form-section {
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeUp 0.5s ease both;
}

.form-section:last-child { border-bottom: none; }

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

.form-section:nth-child(1) { animation-delay: 0.1s; }
.form-section:nth-child(2) { animation-delay: 0.2s; }
.form-section:nth-child(3) { animation-delay: 0.3s; }
.form-section:nth-child(4) { animation-delay: 0.4s; }
.form-section:nth-child(5) { animation-delay: 0.5s; }

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}

.section-label span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-size: 10px;
}

.section-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text);
  margin-bottom: 36px;
  line-height: 1.1;
}

/* Field groups */
.field-group {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 24px;
}

.field-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.field-input {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 14px 16px;
  transition: all 0.2s;
  outline: none;
  width: 100%;
}

.field-input:focus {
  border-color: var(--accent);
  background: var(--surface2);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-input::placeholder { color: var(--text-dim); }

.field-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.field-hint-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.field-hint-box svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; color: var(--accent); }

/* Icon grid */
.icon-grid {
  display: flex; flex-direction: column; gap: 20px;
}

.icon-card {
  display: flex; align-items: flex-start; gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.icon-card:hover { border-color: var(--border-bright); }

.icon-preview {
  width: 80px; height: 80px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.icon-placeholder svg { width: 32px; height: 32px; color: var(--text-dim); }
.icon-preview img { width: 100%; height: 100%; object-fit: contain; }

.icon-info {
  display: flex; flex-direction: column; gap: 6px; flex: 1;
}

.icon-info strong {
  font-size: 15px; font-weight: 700; color: var(--text);
}

.icon-info span {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--text-muted);
}

.badge {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent2);
  width: fit-content;
}

.upload-btn {
  display: inline-flex; align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  width: fit-content;
  margin-top: 4px;
}

.upload-btn:hover { border-color: var(--accent); color: var(--accent); }
.upload-btn input[type="file"] { display: none; }

/* Radio group */
.radio-group {
  display: flex; gap: 12px; flex-wrap: wrap;
}

.radio-option {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  transition: all 0.2s;
}

.radio-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--surface2);
  color: var(--accent);
}

.radio-option input { accent-color: var(--accent); }

/* Build summary */
.build-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 32px;
}

.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
}

.summary-row:last-child { border-bottom: none; }
.summary-row span { color: var(--text-muted); }
.summary-row strong { color: var(--text); }

/* Build button */
.build-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 20px 28px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 0 40px rgba(91, 140, 255, 0.3);
  letter-spacing: -0.3px;
}

.build-btn:hover {
  background: #7aa5ff;
  box-shadow: 0 0 60px rgba(91, 140, 255, 0.5);
  transform: translateY(-2px);
}

.build-btn:active { transform: translateY(0); }

.btn-icon svg { width: 22px; height: 22px; }

.build-note {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
}

/* Progress overlay */
.progress-overlay, .download-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  align-items: center; justify-content: center;
}

.progress-overlay.active, .download-overlay.active {
  display: flex;
}

.progress-card, .download-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}

.progress-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.progress-title {
  font-size: 22px; font-weight: 700; letter-spacing: -0.5px;
}

.progress-sub {
  font-family: var(--font-mono); font-size: 13px; color: var(--text-muted);
}

.progress-bar-wrap {
  width: 100%; height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
  box-shadow: 0 0 12px var(--accent);
}

.progress-steps {
  display: flex; flex-direction: column; gap: 6px;
  width: 100%;
  text-align: left;
}

.step-item {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.3s;
}

.step-item.active { color: var(--accent); background: var(--accent-glow); }
.step-item.done { color: var(--green); }
.step-item::before { content: '○'; font-size: 10px; }
.step-item.active::before { content: '◉'; }
.step-item.done::before { content: '✓'; }

/* Download card */
.download-icon {
  width: 64px; height: 64px;
  background: var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff;
  box-shadow: 0 0 30px rgba(34, 211, 160, 0.4);
}

.download-card h3 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.download-card p { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }

.download-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--green);
  border: none; border-radius: var(--radius);
  padding: 16px 28px;
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700;
  color: #0a0a0f;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 30px rgba(34, 211, 160, 0.3);
}

.download-btn:hover { transform: translateY(-2px); box-shadow: 0 0 50px rgba(34, 211, 160, 0.5); }
.download-btn svg { width: 20px; height: 20px; }

.reset-btn {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.reset-btn:hover { border-color: var(--border-bright); color: var(--text); }

/* Responsive */
@media (max-width: 640px) {
  .header { padding: 32px 24px 0; }
  .main { padding: 40px 16px 80px; }
  .section-title { font-size: 24px; }
  .icon-card { flex-direction: column; }
  .build-btn { font-size: 16px; }
  .progress-card, .download-card { padding: 32px 24px; margin: 16px; }
}
