:root {
  --bg: #ffffff;
  --bg-2: #fafaf9;
  --bg-elev: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --fg: #18181b;
  --fg-dim: #3f3f46;
  --fg-mute: #71717a;
  --accent: #6d28d9;
  --accent-soft: #ede9fe;
  --accent-2: #1d4ed8;
  --green: #15803d;
  --green-soft: #dcfce7;
  --red: #b91c1c;
  --font-sans: 'Inter', system-ui, -apple-system, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg-2);
  line-height: 1.5;
}
a { color: var(--accent-2); }

.page {
  max-width: 780px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(0,0,0,0.04);
}

/* topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { font-size: 28px; }
.brand-name { font-weight: 700; font-size: 18px; color: var(--fg); }
.brand-sub { font-size: 12px; color: var(--fg-mute); letter-spacing: 0.02em; }
.save-state {
  font-size: 12px;
  color: var(--fg-mute);
  font-family: ui-monospace, monospace;
}
.save-state.saved { color: var(--green); }
.save-state.saving { color: var(--accent); }
.save-state.error { color: var(--red); }

/* progress */
.progress {
  height: 4px;
  background: var(--border);
  margin: 0;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.4s ease;
}
.progress-label {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-mute);
  font-weight: 600;
  padding: 10px 28px 0;
}

/* main view */
.view {
  padding: 24px 28px 32px;
  flex: 1;
}
.view h1 {
  font-size: 28px;
  margin: 0 0 8px;
  color: var(--fg);
  letter-spacing: -0.02em;
  font-weight: 700;
}
.view h2 {
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--fg);
  letter-spacing: -0.01em;
  font-weight: 700;
}
.view .intro {
  color: var(--fg-dim);
  font-size: 16px;
  margin: 0 0 24px;
  line-height: 1.55;
}

/* form fields */
.field { margin: 0 0 22px; }
.field label.q {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--fg);
  margin-bottom: 8px;
}
.field .hint {
  font-size: 13px;
  color: var(--fg-mute);
  margin-top: 4px;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--fg);
  transition: border-color 0.15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea {
  resize: vertical;
  min-height: 88px;
}

/* radio / checkbox groups */
.options {
  display: grid;
  gap: 8px;
}
.options.cols-2 { grid-template-columns: 1fr 1fr; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.option input[type="radio"],
.option input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.option.checked {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.option .opt-label { color: var(--fg); flex: 1; }

/* scale / slider */
.scale {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.scale .scale-opt {
  text-align: center;
  padding: 12px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-2);
  cursor: pointer;
  font-size: 13px;
  color: var(--fg-dim);
  transition: all 0.15s;
}
.scale .scale-opt:hover { border-color: var(--accent); }
.scale .scale-opt.checked {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  font-weight: 600;
}

/* welcome screen */
.welcome {
  padding: 24px 0 12px;
}
.welcome .hero {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.25;
  margin: 0 0 14px;
}
.welcome .hero .accent { color: var(--accent); }
.welcome .lead {
  font-size: 17px;
  color: var(--fg-dim);
  margin: 0 0 28px;
  line-height: 1.55;
}
.welcome .grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin: 0 0 28px;
}
.welcome .grid .info {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 14px;
  font-size: 13px;
  color: var(--fg-dim);
}
.welcome .grid .info strong { color: var(--fg); display: block; margin-bottom: 4px; font-size: 14px; }

/* sections nav-info */
.section-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 18px;
}
.section-meta .sec-num {
  font-size: 12px;
  color: var(--fg-mute);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 600;
}
.section-meta .sec-count {
  font-size: 12px;
  color: var(--fg-mute);
  font-family: ui-monospace, monospace;
}

/* result */
.result {
  text-align: center;
  padding: 40px 24px;
}
.result-icon {
  font-size: 64px;
  margin-bottom: 16px;
}
.result h1 {
  margin: 0 0 12px;
  color: var(--fg);
}
.result p {
  color: var(--fg-dim);
  font-size: 16px;
  max-width: 520px;
  margin: 0 auto 20px;
}
.result .download-btn {
  margin-top: 16px;
}

/* bottom bar with nav */
.bottom {
  display: flex;
  justify-content: space-between;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}
.btn {
  border: none;
  border-radius: 6px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn.primary {
  background: var(--accent);
  color: white;
}
.btn.primary:hover { background: #5b1fb7; }
.btn.primary:disabled { background: var(--border-strong); cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--fg-dim);
}
.btn.ghost:hover { background: var(--bg-elev); color: var(--fg); }
.btn.outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn.outline:hover { background: var(--accent-soft); }

@media (max-width: 600px) {
  .welcome .grid { grid-template-columns: 1fr; }
  .options.cols-2 { grid-template-columns: 1fr; }
  .scale { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 14px 18px; }
  .view { padding: 20px 18px 28px; }
  .bottom { padding: 12px 18px; }
}

.field-error { color: var(--red); font-size: 13px; margin-top: 6px; }
.callout {
  padding: 14px 16px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 14px;
  color: var(--fg);
  margin: 16px 0;
}
