/* ── Design System ── */

:root {
  --accent: #f07c23;
  --accent-hover: #d96a15;
  --bg: #fafaf7;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e5e0;
  --card-bg: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --max-width: 640px;
  --transition: 0.2s ease;
}

/* ── Reset & Base ── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
}

/* ── Layout ── */

.quiz-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Progress Bar ── */

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 32px;
}

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

/* ── Navigation ── */

.quiz-nav {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  min-height: 36px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 4px 0;
  transition: color var(--transition);
}

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

.btn-back svg {
  width: 16px;
  height: 16px;
}

/* ── Start Screen ── */

.screen-start {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Hero banner — bleeds past wrapper padding */
.hero-banner {
  position: relative;
  width: calc(100% + 32px);
  margin: -24px -16px 0;
  height: 380px;
  overflow: hidden;
  border-radius: 0 0 16px 16px;
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 20px 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  display: flex;
  align-items: flex-end;
}

.quiz-badge {
  display: inline-block;
  padding: 5px 14px;
  background: var(--accent);
  color: white;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.start-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 24px;
}

.presenter-line {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.btn-start {
  width: 100%;
  padding: 16px 28px;
  font-size: 1.0625rem;
  margin-top: 16px;
  box-shadow: 0 3px 0 #b55e18, 0 4px 10px rgba(0,0,0,0.14);
  position: relative;
  top: 0;
  transition: top 0.1s ease, box-shadow 0.1s ease, background var(--transition);
}

.btn-start:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 0 #b55e18, 0 3px 8px rgba(0,0,0,0.12);
}

.btn-start:active {
  top: 2px;
  box-shadow: 0 1px 0 #b55e18, 0 2px 4px rgba(0,0,0,0.1);
  transform: none;
}

.screen-start h1 {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.screen-start .subtitle {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.start-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  padding: 14px 16px;
  background: #f3f4f6;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border);
}

.start-meta {
  display: flex;
  justify-content: flex-start;
  gap: 20px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ── Question Screen ── */

.question-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 8px;
}

.question-subtext {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 24px;
}

/* ── Options ── */

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

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--text);
  transition: border-color var(--transition), background var(--transition);
}

.option-btn:hover {
  border-color: var(--accent);
}

.option-btn.selected {
  border-color: var(--accent);
  background: #fef3e8;
}

.option-indicator {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  margin-top: 2px;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

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

.option-btn.selected .option-indicator::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

/* Multi-select: square checkboxes */
.multi-select .option-indicator {
  border-radius: 4px;
}

.multi-select .option-btn.selected .option-indicator {
  border-radius: 4px;
}

.multi-select .option-btn.selected .option-indicator::after {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: white;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform 0.1s ease;
}

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

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

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

.btn-primary:disabled {
  background: #d4d4cf;
  cursor: not-allowed;
  transform: none;
}

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

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: none;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.875rem;
  padding: 8px 16px;
}

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

.quiz-footer {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-footer .btn {
  width: 100%;
}

.btn-back-footer {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
  transition: color var(--transition);
}

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

/* ── Email Opt-in ── */

.optin-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.optin-screen h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.optin-screen p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.optin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.optin-form input {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color var(--transition);
}

.optin-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.optin-form input::placeholder {
  color: #9ca3af;
}

.optin-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  cursor: pointer;
}

.optin-consent-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}

.optin-consent-label a {
  color: var(--accent);
  text-decoration: none;
}

.optin-consent-label a:hover {
  text-decoration: underline;
}

.optin-success {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 16px 20px;
}

.optin-success-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.optin-success strong {
  display: block;
  font-size: 1rem;
  color: #15803d;
  margin-bottom: 2px;
}

.optin-success p {
  font-size: 0.875rem;
  color: #166534;
  margin: 0;
}

.field-error {
  display: block;
  color: #dc2626;
  font-size: 13px;
  margin-top: -6px;
  min-height: 0;
}

.field-error:empty {
  display: none;
}

.field-error-input {
  border-color: #dc2626 !important;
}

.optin-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

/* ── Result Page ── */

.result-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.result-header {
  text-align: center;
  padding: 32px 24px;
  border-radius: var(--radius);
  border: 2px solid;
}

.score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  background: white;
}

.score-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.score-label {
  font-size: 0.75rem;
  opacity: 0.7;
}

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

.result-subtitle {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 12px;
}

.result-snapshot {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Result Sections ── */

.result-section {
  padding: 0;
}

.result-section h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.result-section p {
  margin-bottom: 12px;
  line-height: 1.65;
}

.result-section p:last-child {
  margin-bottom: 0;
}

.symptom-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.symptom-tag {
  display: inline-block;
  padding: 4px 12px;
  background: #f3f4f6;
  border-radius: 20px;
  font-size: 0.8125rem;
  color: var(--text);
}

.result-tried {
  margin-top: 16px;
  padding: 16px;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

.result-tried p {
  font-size: 0.9375rem;
}

/* ── Action Steps ── */

.result-action {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.result-action h3 {
  margin-bottom: 4px;
}

.action-step {
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.action-step h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.action-step p {
  font-size: 0.9375rem;
  color: var(--text);
}

.action-step .btn {
  margin-top: 12px;
}

.action-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.action-badge.free {
  background: #ecfdf5;
  color: #059669;
}

.action-badge.paid {
  background: #fef3e8;
  color: var(--accent);
}

.action-cta {
  border-color: var(--accent);
  border-width: 2px;
}

/* ── Pricing ── */

.pricing {
  display: flex;
  gap: 12px;
  margin: 16px 0 4px;
}

.price-option {
  flex: 1;
  padding: 12px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
}

.price-option.featured {
  border-color: var(--accent);
  background: #fef3e8;
}

.price {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.price-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Disclaimer ── */

.result-disclaimer {
  padding: 16px;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  text-align: center;
}

.result-disclaimer p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Phase Labels ── */

.phase-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ── Loading Screen ── */

.loading-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.loading-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.loading-text {
  font-size: 1.125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.loading-dots {
  display: flex;
  gap: 10px;
}

.loading-dots span {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  animation: loadingDot 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDot {
  0%, 80%, 100% { transform: scale(0.55); opacity: 0.35; }
  40%            { transform: scale(1);    opacity: 1; }
}

/* ── Result Hero ── */

.result-hero {
  color: white;
  padding: 36px 24px 28px;
  text-align: center;
  border-radius: var(--radius);
  margin-bottom: 0;
}

.result-hero-label {
  font-size: 0.8125rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.88;
  margin-bottom: 12px;
}

.result-mode-big {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 16px 0 12px;
  letter-spacing: -0.01em;
}

.result-hero-subtitle {
  font-size: 1rem;
  opacity: 0.88;
  max-width: 380px;
  margin: 0 auto;
  line-height: 1.55;
}

/* ── Snapshot + Email teaser ── */

.result-snapshot-note {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 12px 16px 0;
}

.result-email-teaser {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #ecfdf5;
  border-radius: var(--radius-sm);
  border: 1px solid #a7f3d0;
  font-size: 0.9375rem;
  color: #065f46;
  font-weight: 500;
}

.email-teaser-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* ── Educational block ── */

.result-edu-block {
  padding: 20px;
  background: #f9fafb;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.result-edu-block h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.result-edu-block p {
  font-size: 0.9375rem;
  line-height: 1.65;
  margin-bottom: 12px;
  color: var(--text);
}

.result-edu-block p:last-child {
  margin-bottom: 0;
}

/* ── Dark CTA block ── */

.result-cta-dark {
  background: #1c1c1e;
  color: white;
  padding: 36px 24px;
  border-radius: var(--radius);
  text-align: center;
}

.cta-dark-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: white;
  letter-spacing: -0.02em;
}

.cta-dark-desc {
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.72);
  line-height: 1.65;
  margin-bottom: 24px;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

.btn-cta-dark {
  display: inline-block;
  padding: 16px 36px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 0 #b55e18, 0 6px 16px rgba(0,0,0,0.3);
  transition: background var(--transition), box-shadow 0.1s ease;
}

.btn-cta-dark:hover {
  background: var(--accent-hover);
}

/* ── Animations ── */

.fade-in {
  animation: fadeIn 0.3s ease;
}

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

/* ── Responsive ── */

@media (min-width: 480px) {
  .quiz-wrapper {
    padding: 32px 24px;
  }

  .screen-start h1 {
    font-size: 2rem;
  }

  .option-btn {
    padding: 16px 20px;
  }
}

@media (min-width: 768px) {
  .quiz-wrapper {
    padding: 48px 24px;
  }
}
