/* ============================================
   MemoFlow Quiz — Style System
   Mobile-first, 360px+ baseline
   AAA contrast on primary text
   ============================================ */

/* --- Custom Properties --- */
:root {
  --bg-primary: #0F1318;
  --bg-secondary: #1A2028;
  --bg-card: #232D37;
  --bg-card-hover: #2B3744;
  --text-primary: #FFFFFF;
  --text-secondary: #9FABB6;
  --text-muted: #6B7B88;
  --accent: #AB3434;
  --accent-hover: #C43E3E;
  --accent-light: #E8D5C4;
  --border: #2A3540;
  --border-focus: #5BA3D9;
  --success: #3FB06F;
  --warning: #E5A84B;
  --star: #F4B942;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.3s ease;
  --max-width: 600px;
  --gutter: 16px;
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a {
  color: var(--accent-light);
  text-decoration: underline;
}

a:hover {
  color: var(--text-primary);
}

input[type="date"] {
  font-family: inherit;
  font-size: 1.125rem;
}

/* --- Focus Styles --- */
:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* --- Quiz Container --- */
#quiz-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- Header --- */
#quiz-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  padding: 12px var(--gutter);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.logo span {
  color: var(--accent);
}

/* --- Progress Bar --- */
.progress-wrap {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

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

.progress-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

/* --- Main Content --- */
#quiz-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px var(--gutter) 32px;
}

/* --- Quiz Steps --- */
.quiz-step {
  display: none;
  width: 100%;
  max-width: var(--max-width);
  animation: fadeIn 0.35s ease;
  scroll-margin-top: 80px;
}

.quiz-step.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

@media (prefers-reduced-motion: reduce) {
  .quiz-step {
    animation: none;
  }
  .progress-fill {
    transition: none;
  }
}

/* --- Step Content --- */
.step-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}

.step-title {
  font-size: 1.625rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  margin-bottom: 8px;
}

.step-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
  max-width: 480px;
}

/* --- Option Buttons --- */
.options-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 1.0625rem;
  text-align: left;
  transition: background var(--transition), border-color var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.option-btn:active,
.option-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--bg-card);
}

.option-btn .option-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.option-btn .option-text {
  flex: 1;
}

/* Multi-select checkbox indicator */
.option-btn .check-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.option-btn[aria-pressed="true"] .check-box {
  background: var(--accent);
  border-color: var(--accent);
}

.option-btn[aria-pressed="true"] .check-box::after {
  content: '';
  display: block;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

/* --- Cards Grid (for stress level, concerns) --- */
.options-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 12px;
  min-height: 100px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: background var(--transition), border-color var(--transition);
  cursor: pointer;
  gap: 8px;
}

.option-card:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

.option-card:active,
.option-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--bg-card);
}

.option-card .card-icon {
  font-size: 2rem;
}

.option-card .card-label {
  font-weight: 600;
  font-size: 0.9375rem;
}

.option-card .card-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* --- Continue / Action Buttons --- */
.btn-primary {
  width: 100%;
  padding: 16px 24px;
  background: var(--accent);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform 0.15s ease;
  min-height: 52px;
  margin-top: 20px;
}

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

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

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

.btn-secondary {
  width: 100%;
  padding: 14px 24px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 10px;
  min-height: 48px;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  cursor: pointer;
  transition: color var(--transition);
  background: none;
  border: none;
  margin-top: 16px;
  min-height: 48px;
}

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

/* --- Interstitial Screens --- */
.interstitial {
  text-align: center;
  padding: 20px 0;
}

.interstitial .step-title {
  margin-bottom: 16px;
}

.interstitial-body {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  text-align: left;
  margin-bottom: 20px;
}

.interstitial-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.interstitial-highlight {
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0;
  font-size: 1rem;
  color: var(--text-primary);
  text-align: left;
}

/* --- Loading Screens --- */
.loading-screen {
  text-align: center;
  padding: 40px 0;
}

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

.loading-subtitle {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.loading-bar-wrap {
  width: 100%;
  max-width: 320px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto 20px;
}

.loading-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  width: 0%;
}

.loading-percent {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

/* Animated Steps List (Step 16) */
.loading-steps {
  list-style: none;
  text-align: left;
  max-width: 360px;
  margin: 0 auto;
}

.loading-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  font-size: 1rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: color 0.4s ease;
}

.loading-steps li:last-child {
  border-bottom: none;
}

.loading-steps li .step-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.4s ease;
}

.loading-steps li.completed {
  color: var(--text-primary);
}

.loading-steps li.completed .step-check {
  background: var(--success);
  border-color: var(--success);
}

.loading-steps li.completed .step-check::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.loading-steps li.active-step {
  color: var(--text-primary);
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation: none;
    border-top-color: var(--accent);
  }
  .loading-bar-fill {
    transition: none;
  }
}

/* --- Testimonials --- */
.testimonials-section {
  width: 100%;
  margin: 16px 0;
}

.testimonial-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}

.testimonial-stars {
  color: var(--star);
  font-size: 1rem;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.testimonial-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-style: italic;
  margin-bottom: 12px;
}

.testimonial-author {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.testimonial-verified {
  font-size: 0.8125rem;
  color: var(--success);
}

.results-vary {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
  font-style: italic;
}

/* Testimonial carousel (loading screen) */
.testimonial-carousel {
  position: relative;
  overflow: hidden;
  min-height: 140px;
  margin: 20px 0;
}

.testimonial-carousel .testimonial-card {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.testimonial-carousel .testimonial-card.visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .testimonial-carousel .testimonial-card {
    transition: none;
  }
}

/* --- Dashboard (Step 17) --- */
.dashboard {
  width: 100%;
}

.dashboard-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.dashboard-subtitle {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
}

.axis-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.axis-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.axis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.axis-name {
  font-size: 1rem;
  font-weight: 600;
}

.axis-band {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.band-low {
  background: rgba(171, 52, 52, 0.2);
  color: #E87070;
}

.band-mid {
  background: rgba(229, 168, 75, 0.2);
  color: var(--warning);
}

.band-high {
  background: rgba(63, 176, 111, 0.2);
  color: var(--success);
}

.axis-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.axis-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease;
}

.axis-bar-fill.low { background: #E87070; }
.axis-bar-fill.mid { background: var(--warning); }
.axis-bar-fill.high { background: var(--success); }

@media (prefers-reduced-motion: reduce) {
  .axis-bar-fill {
    transition: none;
  }
}

.axis-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Expectation Timeline */
.timeline-section {
  margin: 28px 0;
}

.timeline-heading {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.timeline-content {
  flex: 1;
}

.timeline-period {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Offer Section (Step 27) --- */
.offer-section {
  width: 100%;
}

.offer-product {
  text-align: center;
  margin-bottom: 24px;
}

.offer-product-img {
  width: 200px;
  height: 240px;
  margin: 0 auto 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.offer-product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.offer-product-name {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.offer-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.offer-rating .stars {
  color: var(--star);
  letter-spacing: 1px;
}

.offer-rating .rating-num {
  font-weight: 600;
}

.offer-customers {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Single pricing */
.offer-pricing-single {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
}

.offer-price-main {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.offer-price-main small {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.offer-price-detail {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.offer-price-shipping {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--success);
}

/* Bundle options */
.bundle-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.bundle-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color var(--transition);
  position: relative;
}

.bundle-card:hover {
  border-color: var(--text-muted);
}

.bundle-card.selected {
  border-color: var(--accent);
}

.bundle-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
}

.bundle-badge.popular {
  background: var(--success);
}

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

.bundle-name {
  font-size: 1rem;
  font-weight: 600;
}

.bundle-detail {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.bundle-pricing {
  text-align: right;
}

.bundle-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.bundle-price-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Trust badges */
.trust-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
}

.trust-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.trust-badge .badge-icon {
  font-size: 1rem;
}

/* --- Disclaimer Notice (Step 00) --- */
.disclaimer-notice {
  text-align: center;
  padding: 32px 0;
}

.disclaimer-notice .notice-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.disclaimer-notice .notice-text {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
  max-width: 480px;
}

/* --- Date Input --- */
.date-input-wrap {
  width: 100%;
  max-width: 300px;
  margin: 0 auto 16px;
}

.date-input-wrap input[type="date"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 1.125rem;
  min-height: 52px;
}

.date-input-wrap input[type="date"]:focus {
  border-color: var(--accent);
  outline: none;
}

/* --- Footer / Disclaimer --- */
#quiz-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 20px var(--gutter);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.fda-disclaimer {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

.legal-links a {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
}

.legal-links a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.footer-contact {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

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

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* --- Plan Section (Step 26) --- */
.plan-section {
  width: 100%;
}

.plan-profile {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.plan-profile-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8125rem;
}

.plan-profile-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9375rem;
}

.plan-profile-label {
  color: var(--text-secondary);
}

.plan-profile-value {
  font-weight: 600;
}

/* --- Responsive --- */
@media (min-width: 480px) {
  .step-title {
    font-size: 1.875rem;
  }

  .options-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (min-width: 768px) {
  #quiz-main {
    padding: 40px var(--gutter) 48px;
  }

  .step-title {
    font-size: 2rem;
  }

  .option-btn {
    font-size: 1.125rem;
  }
}
