:root {
  --radius: 1rem;
  --background: #f8fafc;
  --foreground: #020617;
  --title: #020617;
  --card: #ffffff;
  --card-foreground: #020617;
  --primary: #7f1395;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f9;
  --secondary-foreground: #020617;
  --muted: #e1e7ef;
  --muted-foreground: #65758b;
  --accent: #faedfd;
  --accent-foreground: #6c107e;
  --border: #e1e7ef;
  --ring: #7f1395;
  --comparison-before: #f50029;
  --comparison-before-soft: #feecef;
  --comparison-goal: #00bd4f;
  --comparison-goal-soft: #edfcf4;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border: 0 solid var(--border);
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img,
svg,
audio,
video {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
  background: transparent;
}

.quiz-main {
  min-height: 100vh;
  background-color: var(--background);
}

/* Sticky top bar */
.quiz-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--background);
}

.progress-track {
  height: 0.25rem;
  width: 100%;
  background-color: var(--muted);
}

.progress-fill {
  height: 100%;
  background-color: var(--primary);
  transition: width 0.5s cubic-bezier(0, 0, 0.2, 1);
}

.topbar-spacer {
  margin-inline: auto;
  height: 2.5rem;
  width: 100%;
  max-width: 34rem;
  padding-inline: 1rem;
  display: flex;
  align-items: center;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.back-btn:hover {
  color: var(--foreground);
  background-color: var(--secondary);
}

.back-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* Main stage */
.quiz-container {
  margin-inline: auto;
  width: 100%;
  max-width: 34rem;
  padding: 1.5rem 1rem;
}

.layers-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  animation: fade-in 0.25s ease-out;
}

.layer-slot {
  min-width: 0;
  flex-basis: 100%;
  max-width: 100%;
}

/* Prose typography */
.funnel-prose {
  color: var(--foreground);
  overflow-wrap: break-word;
  word-break: normal;
  font-size: 1rem;
  line-height: 1.5;
}

.funnel-prose h1,
.funnel-prose h2,
.funnel-prose h3,
.funnel-prose h4 {
  color: var(--title);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

.funnel-prose h3 {
  font-size: 1.25rem;
}

.funnel-prose p {
  color: var(--foreground);
  font-size: 1rem;
  line-height: 1.625;
}

.funnel-prose p + p,
.funnel-prose h2 + p,
.funnel-prose p + h2,
.funnel-prose h2 + h3,
.funnel-prose h3 + p {
  margin-top: 0.5rem;
}

.funnel-prose strong,
.funnel-prose b {
  font-weight: 700;
}

.funnel-prose u {
  text-decoration: underline;
}

.ql-align-center {
  text-align: center;
}

.highlight-yellow {
  background-color: #facc15;
  padding: 0.1rem 0.25rem;
}

/* Images */
.layer-image-wrap {
  display: flex;
  width: 100%;
  justify-content: center;
}

.layer-image {
  width: 100%;
  height: auto;
  border-radius: 1.5rem;
  object-fit: contain;
}

/* Buttons / CTAs */
.funnel-cta-button,
.funnel-cta-link {
  display: flex;
  min-height: 3.5rem;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 1.5rem;
  background-color: var(--primary);
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-foreground);
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.funnel-cta-button:hover:not(:disabled),
.funnel-cta-link:hover:not([aria-disabled="true"]) {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.funnel-cta-button:disabled,
.funnel-cta-link[aria-disabled="true"] {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.5;
}

.animate-soft-pulse {
  animation: soft-pulse 1.8s ease-in-out infinite;
}

.is-hidden-delay {
  display: none !important;
}

/* Hotmart 1-click container compliance (never display:none or height:0) */
.hotmart-funnel-hidden {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
  pointer-events: none;
  width: 100%;
}

/* Options */
.options-grid {
  display: grid;
  width: 100%;
  gap: 0.75rem;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.options-grid.cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.options-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-btn {
  display: flex;
  min-height: 3.5rem;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  border-radius: 1.5rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  padding: 0.75rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.option-btn:hover {
  border-color: rgba(127, 19, 149, 0.4);
}

.option-btn.is-active {
  border-color: var(--primary);
  background-color: rgba(127, 19, 149, 0.1);
}

.option-btn.is-grid-card {
  gap: 0.5rem;
}

.option-btn.is-grid-card.has-image {
  flex-direction: column;
  align-items: stretch;
}

.option-img {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  border-radius: 1.25rem;
  object-fit: contain;
  background: transparent;
}

.option-btn.is-grid-card.has-image .option-img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.option-emoji {
  flex-shrink: 0;
  line-height: 1;
  font-size: 28px;
}

.option-btn.is-grid-card .option-emoji {
  font-size: 1.5rem;
}

.funnel-option-label {
  min-width: 0;
  flex: 1;
}

.funnel-option-label p {
  color: var(--foreground);
  font-size: 0.95rem;
  line-height: 1.4;
}

.funnel-option-label p:first-child {
  font-weight: 600;
}

.funnel-option-label p:nth-child(n + 2) {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  font-weight: 400;
  margin-top: 0.125rem;
}

.option-check {
  display: flex;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background-color: var(--background);
}

.option-btn.is-active .option-check {
  border-color: var(--primary);
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.option-check svg {
  width: 1rem;
  height: 1rem;
}

.option-chevron {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--muted-foreground);
}

/* Text input field */
.field-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

.field-input {
  height: 3.5rem;
  width: 100%;
  border-radius: 1.5rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  padding-inline: 1rem;
  font-size: 1rem;
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s ease;
}

.field-input::placeholder {
  color: var(--muted-foreground);
}

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

/* Weight / Height Slider Card */
.slider-card {
  width: 100%;
  border-radius: 1.5rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.slider-readout {
  text-align: center;
}

.slider-value {
  font-size: 3rem;
  line-height: 1;
  font-weight: 700;
  color: var(--foreground);
}

.slider-unit {
  margin-left: 0.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--muted-foreground);
}

.range-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  height: 1.25rem;
}

.range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.375rem;
  border-radius: 9999px;
  background: rgba(127, 19, 149, 0.2);
  outline: none;
  cursor: pointer;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 9999px;
  border: 2px solid var(--primary);
  background: var(--background);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.range-input::-moz-range-thumb {
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 9999px;
  border: 2px solid var(--primary);
  background: var(--background);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.slider-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Loading screen */
.loading-box {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-block: 1.5rem;
}

.loading-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
}

.loading-track {
  height: 0.5rem;
  width: 100%;
  overflow: hidden;
  border-radius: 9999px;
  background-color: var(--muted);
}

.loading-fill {
  height: 100%;
  border-radius: 9999px;
  background-color: var(--primary);
  transition: width 0.1s linear;
}

.loading-percent {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--primary);
}

/* Audio player */
.audio-card {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  border-radius: 1.5rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  padding: 0.75rem;
}

.audio-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
}

.audio-toggle {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background-color: var(--primary);
  color: var(--primary-foreground);
  cursor: pointer;
}

.audio-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.audio-meta {
  min-width: 0;
  flex: 1;
}

.audio-track {
  height: 0.375rem;
  width: 100%;
  overflow: hidden;
  border-radius: 9999px;
  background-color: var(--muted);
  cursor: pointer;
}

.audio-fill {
  height: 100%;
  border-radius: 9999px;
  background-color: var(--primary);
  transition: width 0.1s linear;
}

.audio-time {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* BMI Metric Dotted Bar */
.metric-wrap {
  width: 100%;
  padding: 0.25rem;
}

.metric-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  font-size: 0.875rem;
}

.metric-title {
  font-weight: 600;
  color: var(--title);
}

.metric-subtitle .funnel-prose {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.metric-pct {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--title);
}

.metric-bar {
  position: relative;
  display: flex;
  height: 0.5rem;
  align-items: center;
  border-radius: 0.5rem;
  background-color: var(--muted);
}

.metric-segments {
  margin-inline: -0.1rem;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.5rem;
}

.metric-seg {
  height: 0.5rem;
  width: 100%;
  border-radius: 1rem;
}

.seg-1 { background-image: linear-gradient(90deg, #14b8a6, #a5c368); }
.seg-2 { background-image: linear-gradient(90deg, #a5c368, #facc15); }
.seg-3 { background-image: linear-gradient(90deg, #facc15, #facc15); }
.seg-4 { background-image: linear-gradient(90deg, #facc15, #e96827); }
.seg-5 { background-image: linear-gradient(90deg, #e96827, #dc2626); }

.metric-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 9999px;
  border: 4px solid var(--primary);
  background-color: var(--card);
  padding: 0.4rem;
  transition: left 1s cubic-bezier(0, 0, 0.2, 1);
}

.metric-legends {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  padding-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--foreground);
}

.metric-legends span {
  flex: 1;
  text-align: center;
}

.metric-legends span:first-child {
  text-align: left;
}

.metric-legends span:last-child {
  text-align: right;
}

/* Alert diagnostic card */
.alert-card {
  border-radius: 1.5rem;
  border-left: 4px solid var(--primary);
  background-color: rgba(127, 19, 149, 0.1);
  padding: 1rem;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Comparison cards (Step 33) */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.comparison-column {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 6px 10px 10px;
}

.comparison-before {
  --comparison-color: var(--comparison-before);
  --comparison-soft: var(--comparison-before-soft);
}

.comparison-goal {
  --comparison-color: var(--comparison-goal);
  --comparison-soft: var(--comparison-goal-soft);
}

.comparison-photo {
  aspect-ratio: 2 / 3;
  object-fit: contain;
  width: 100%;
}

.comparison-label {
  background: var(--comparison-soft);
  color: var(--title);
  text-align: center;
  border-radius: 999px;
  align-self: center;
  width: 80%;
  margin: 6px 0 10px;
  padding: 6px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.comparison-description {
  text-align: center;
  flex: 1;
  margin-bottom: 14px;
}

.comparison-description .funnel-prose {
  font-size: 1rem;
  line-height: 1.35;
}

.comparison-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.comparison-track {
  background: var(--muted);
  border-radius: 999px;
  flex: 1;
  height: 8px;
  position: relative;
}

.comparison-fill {
  border-radius: inherit;
  background: var(--comparison-color);
  height: 100%;
  width: 0;
  transition: width 1s ease-out;
}

.comparison-dot {
  border: 3px solid var(--border);
  background: var(--card);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  transition: left 1s ease-out;
}

.comparison-percent {
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 700;
}

.comparison-callout {
  background: var(--comparison-soft);
  border-radius: 12px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
}

.comparison-callout svg {
  width: 24px;
  height: 32px;
  color: var(--comparison-color);
  fill: currentColor;
  flex-shrink: 0;
}

.comparison-callout .funnel-prose {
  font-size: 0.875rem;
  line-height: 1.35;
}

.comparison-callout strong {
  color: var(--comparison-color);
}

/* VTurb Video wrapper & Unmute fallback */
.video-stage {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin-inline: auto;
}

.vturb-unmute-btn {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  border-radius: 9999px;
  background: rgba(127, 19, 149, 0.94);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  animation: soft-pulse 1.8s ease-in-out infinite;
}

.vturb-unmute-btn.is-hidden {
  display: none;
}

/* Pending checkout notice */
.checkout-pending-toast {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--primary);
  background: var(--accent);
  color: var(--accent-foreground);
  font-size: 0.875rem;
  text-align: center;
}

@media (max-width: 400px) {
  .comparison-grid {
    gap: 8px;
  }
  .comparison-column {
    padding: 4px 6px 8px;
  }
  .comparison-description .funnel-prose {
    font-size: 0.875rem;
  }
  .comparison-callout {
    gap: 4px;
    padding: 8px 5px;
  }
  .comparison-callout svg {
    width: 18px;
  }
  .comparison-callout .funnel-prose {
    font-size: 0.8125rem;
  }
  .metric-legends {
    font-size: 0.68rem;
  }
}

@keyframes soft-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 45%, transparent);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 10px color-mix(in srgb, var(--primary) 0%, transparent);
    transform: scale(1.02);
  }
}

@keyframes fade-in {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}
