/* ==========================================================================
   MatterID Onboarding — warm dark theme, consistent with himatter.xyz
   bg #111110 / accent #e8825a / Geist + Geist Mono
   ========================================================================== */

:root {
  --bg: #111110;
  --surface: #1a1917;
  --surface-raised: #201f1c;
  --border: #2c2a26;
  --text-primary: #f5f1ea;
  --text-secondary: #9a958c;
  --text-tertiary: #6e6a62;
  --accent: #e8825a;
  --accent-dim: #5c3324;
  --accent-text: #1a1110;
  --danger: #d9695a;
  --success: #7fb38c;
  --radius: 10px;
  --radius-lg: 16px;
  --font-sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'SFMono-Regular', Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

/* ---------- Shell / layout ---------- */

.onboarding-shell {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.onboarding-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.brand-accent {
  color: var(--accent);
}

/* ---------- Step track ---------- */

.step-track {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin: 0;
  padding: 0;
}

.step-track li {
  position: relative;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  font-size: 0;
  transition: background 0.25s ease;
}

.step-track li.is-complete,
.step-track li.is-current {
  background: var(--accent);
}

/* ---------- Card ---------- */

.onboarding-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  position: relative;
  min-height: 320px;
}

.step {
  display: none;
  flex-direction: column;
  animation: step-in 0.2s ease;
}

.step.is-active {
  display: flex;
}

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

.loading-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.step-sub {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 24px;
}

/* ---------- Fields ---------- */

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.field-input {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

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

.field-input:focus {
  border-color: var(--accent);
}

.field-input-mono {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

.field-hint {
  color: var(--text-tertiary);
  font-size: 12.5px;
  margin: 8px 0 0;
}

.field-error {
  color: var(--danger);
  font-size: 13px;
  margin: 8px 0 0;
}

.success-banner {
  color: var(--success);
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 4px;
}

/* ---------- Buttons ---------- */

.step-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 11px 20px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

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

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

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}

/* ---------- Age range choice cards ---------- */

.choice-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.choice-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  padding: 16px 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.choice-card:hover {
  border-color: var(--text-tertiary);
}

.choice-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ---------- Roblox lookup result ---------- */

.roblox-result {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 16px;
}

.roblox-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

.roblox-result-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.roblox-display-name {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.roblox-username {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0;
}

/* ---------- Toggle rows ---------- */

.toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-of-type {
  border-bottom: none;
}

.toggle-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
}

.toggle-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  max-width: 280px;
  line-height: 1.45;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(18px);
  background: var(--accent-text);
}

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

/* ---------- Review list ---------- */

.review-list {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.review-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.review-row:last-child {
  border-bottom: none;
}

.review-row dt {
  font-size: 13px;
  color: var(--text-secondary);
}

.review-row dd {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}

/* ---------- Footnote ---------- */

.onboarding-footnote {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin: 0;
}

#sessionEmail {
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ---------- Accessibility ---------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .step {
    animation: none;
  }
  .btn, .choice-card, .switch-thumb, .switch-track, .step-track li {
    transition: none;
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 420px) {
  .onboarding-card {
    padding: 28px 20px;
  }
  .step-track {
    grid-template-columns: repeat(6, 1fr);
  }
  .choice-group {
    grid-template-columns: 1fr;
  }
}
