/* ============================================
   quitter.app — Design System & Styles
   ============================================ */

/* --- Design Tokens --- */
:root {
  --bg: #0B0B0F;
  --bg-elevated: #141419;
  --bg-card: #1A1A22;
  --bg-option: #1E1E28;
  --bg-option-hover: #26263A;

  --accent: #C8FF00;
  --accent-dim: #9ECC00;
  --accent-glow: rgba(200, 255, 0, 0.15);

  --text: #F5F5F7;
  --text-secondary: #A1A1AA;
  --text-tertiary: #636366;

  --danger: #FF453A;
  --success: #30D158;
  --warning: #FFD60A;
  --blue: #5E9CFF;

  --border: #2A2A35;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-sm: 8px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Sections --- */
.section {
  display: none;
  min-height: 100vh;
  padding: 80px 0;
  animation: fadeIn 0.5s var(--ease);
}

.section.active {
  display: block;
}

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0B0B0F;
}

.btn-primary:hover {
  background: #D4FF33;
  transform: translateY(-1px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

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

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

.btn-secondary:hover {
  background: var(--bg-option-hover);
  border-color: var(--text-tertiary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 16px;
}

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

.btn-lg {
  padding: 18px 40px;
  font-size: 1.125rem;
  border-radius: var(--radius);
}

.btn-arrow {
  transition: transform 0.2s var(--ease);
}

.btn:hover .btn-arrow {
  transform: translateX(3px);
}

/* ===== HERO ===== */
#hero {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 120px;
  padding-bottom: 80px;
}

#hero .container {
  max-width: 800px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--accent-glow);
  border: 1px solid rgba(200, 255, 0, 0.2);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 32px;
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.accent {
  color: var(--accent);
  position: relative;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 40px;
  line-height: 1.5;
}

#start-btn {
  margin-bottom: 80px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-top: 48px;
  border-top: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-number {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ===== QUIZ ===== */
#quiz .container {
  max-width: 640px;
}

.quiz-header {
  margin-bottom: 48px;
}

.quiz-progress {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.4s var(--ease);
  width: 0%;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}

.quiz-category {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-icon {
  font-size: 1.25rem;
}

.category-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quiz-body {
  animation: questionIn 0.35s var(--ease);
}

@keyframes questionIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.question-text {
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.question-subtext {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  margin-bottom: 32px;
}

.question-subtext:empty {
  display: none;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: var(--bg-option);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  font-size: 1rem;
  color: var(--text);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.option:hover {
  background: var(--bg-option-hover);
  border-color: var(--text-tertiary);
  transform: translateX(4px);
}

.option:active {
  transform: translateX(2px);
}

.option.selected {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.option-key {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: all 0.15s var(--ease);
}

.option:hover .option-key {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.option.selected .option-key {
  background: var(--accent);
  color: #0B0B0F;
}

/* ===== CALCULATING ===== */
.calculating-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
}

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

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

.calc-text {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 32px;
}

.calc-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-step {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s var(--ease);
}

.calc-step.visible {
  opacity: 1;
  transform: translateY(0);
  color: var(--text-secondary);
}

.calc-step.done {
  color: var(--accent);
}

.calc-step.done::after {
  content: ' ✓';
}

/* ===== RESULTS ===== */
#results {
  padding-top: 60px;
}

.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  margin-bottom: 32px;
}

.results-header {
  text-align: center;
  margin-bottom: 48px;
}

.results-badge {
  display: inline-block;
  padding: 4px 14px;
  background: var(--accent-glow);
  border: 1px solid rgba(200, 255, 0, 0.2);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 24px;
}

.score-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.score-number {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.score-max {
  font-size: 1.5rem;
  color: var(--text-tertiary);
  font-weight: 600;
}

.score-tier {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.score-summary {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Tier colors */
.tier-minimal { color: var(--success); }
.tier-controlled { color: var(--blue); }
.tier-accumulator { color: var(--warning); }
.tier-oversubscribed { color: #FF9F0A; }
.tier-drowning { color: var(--danger); }

.breakdown-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}

.breakdown-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.breakdown-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.breakdown-name {
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breakdown-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.breakdown-track {
  height: 8px;
  background: var(--bg);
  border-radius: 100px;
  overflow: hidden;
}

.breakdown-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
  transition: width 1s var(--ease);
  width: 0%;
}

/* Color-code the bars by severity */
.breakdown-fill.low { background: var(--success); }
.breakdown-fill.medium { background: var(--warning); }
.breakdown-fill.high { background: #FF9F0A; }
.breakdown-fill.critical { background: var(--danger); }

.results-savings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.savings-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.savings-icon {
  font-size: 1.5rem;
}

.savings-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.savings-text strong {
  color: var(--accent);
  font-weight: 700;
}

.results-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
}

/* ===== EMAIL CAPTURE ===== */
.email-capture {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  margin-bottom: 24px;
}

.email-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.email-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.email-form {
  display: flex;
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
}

.email-input {
  flex: 1;
  padding: 14px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s var(--ease);
}

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

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

.email-privacy {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 12px;
}

.email-success {
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
}

/* ===== RETAKE ===== */
.retake {
  text-align: center;
  margin-bottom: 48px;
}

/* ===== TEASER ===== */
.teaser {
  text-align: center;
  padding: 48px 40px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 48px;
}

.teaser-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(94, 156, 255, 0.1);
  border: 1px solid rgba(94, 156, 255, 0.2);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--blue);
  margin-bottom: 16px;
}

.teaser-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.teaser-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.footer-brand {
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .section {
    padding: 60px 0;
  }

  #hero {
    padding-top: 80px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .stat {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .results-card {
    padding: 32px 20px;
  }

  .results-savings {
    grid-template-columns: 1fr;
  }

  .results-cta {
    flex-direction: column;
  }

  .email-form {
    flex-direction: column;
  }

  .email-capture {
    padding: 32px 20px;
  }
}

/* ===== UTILITY ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0;
  transition: all 0.3s var(--ease);
  z-index: 1000;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
