:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --success: #22c55e;
  --danger: #ef4444;
  --warning-bg: #fffbeb;
  --warning-border: #fbbf24;
  --radius: 16px;
  --shadow: 0 4px 12px -2px rgb(0 0 0 / 0.08);
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

#app { max-width: 640px; margin: 0 auto; padding-bottom: 40px; }

.app-header {
  position: sticky;
  top: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  z-index: 100;
  box-shadow: var(--shadow);
}

.logo { font-weight: 800; font-size: 1.25rem; color: var(--primary); letter-spacing: -0.5px; }

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
#progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  width: 0%;
  transition: width 0.3s ease;
}

main { padding: 16px; }

.screen { display: none; animation: fadeIn 0.25s ease; }
.screen.active { display: block; }

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

.hero { text-align: center; padding: 28px 0 20px; }
.hero h1 { font-size: 1.5rem; margin-bottom: 8px; line-height: 1.3; }
.subtitle { color: var(--text-light); font-size: 1rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.card h2 { font-size: 1.2rem; margin-bottom: 16px; line-height: 1.3; }

.help { color: var(--text-light); font-size: 0.9rem; margin-bottom: 16px; line-height: 1.5; }

.form-group { margin-bottom: 24px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 10px;
  line-height: 1.3;
}

select, input[type="text"], input[type="tel"], textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select {
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%2712%27%20height%3D%2712%27%20viewBox%3D%270%200%2012%2012%27%3E%3Cpath%20fill%3D%27%2364748b%27%20d%3D%27M6%209.5l-4-4h8z%27%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

textarea { resize: vertical; min-height: 80px; font-family: inherit; }

.radio-group {
  display: grid;
  gap: 8px;
}
.radio-group.grid-2 { grid-template-columns: 1fr 1fr; }

.radio-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.95rem;
  background: var(--card);
}
.radio-card:hover { border-color: var(--primary); background: #f0f7ff; }
.radio-card:has(input:checked) {
  border-color: var(--primary);
  background: #eff6ff;
}
.radio-card input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  color: var(--text);
}
.chip:hover { border-color: var(--primary); background: #f0f7ff; }
.chip.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  -webkit-appearance: none;
}
.btn-primary:active, .btn-secondary:active { transform: scale(0.98); }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.nav-btns {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  margin-top: 24px;
}

.hidden { display: none !important; }

.npub-box {
  background: #f1f5f9;
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  word-break: break-all;
  border: 1px solid var(--border);
}
.npub-box label { font-size: 0.85rem; color: var(--text-light); display: block; margin-bottom: 4px; font-weight: 600; }
.npub-box code { font-size: 0.85rem; color: var(--text); font-family: ui-monospace, SFMono-Regular, monospace; }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.center { text-align: center; }
.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.npub-hint { margin-top: 12px; font-size: 0.85rem; color: var(--text-light); }
.npub-hint code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-family: ui-monospace, monospace; }

.conditional-input { margin-top: 8px; }

.review-block { margin-bottom: 16px; }
.review-block h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.review-block div { font-size: 0.95rem; line-height: 1.5; margin-bottom: 3px; }
.review-block strong { color: var(--text-light); font-weight: 500; font-size: 0.9rem; }

/* Accessibility: larger tap targets on small screens */
@media (max-width: 360px) {
  .radio-group.grid-2 { grid-template-columns: 1fr; }
  .chip { font-size: 0.85rem; padding: 8px 12px; }
}

@media (min-width: 480px) {
  .radio-group.grid-2 { grid-template-columns: 1fr 1fr; }
}
