:root {
  --brand: #5c75b4;
  --brand-AAA: #3c5794;
  --brand-strong: #c3cfeb;
  --brand-dark: #cacfda;
  --brand-soft: #f2f4fc;
  --bg-page: hsl(0, 0%, 100%);
  --bg-card: #fcfdfe;
  --text-primary: #181818;
  --text-secondary: #202533;
  --success-bg: #e7ebf4;
  --success-text: #3d5894;
  --warning-bg: #e7ebf4;
  --warning-text: #3d5894;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-curve: 50px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* =========================
   BASE
========================= */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  /* background: #f7f9fb; */
  overflow-x: hidden;
}

/* =========================
   SHELL
========================= */

.quiz-shell {
  padding: 24px 0;
  display: flex;
  justify-content: center;
}

.quiz-container {
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  border: 1px solid #cad2e6;
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.04);
}

/* =========================
   HEADER
========================= */

.quiz-header {
  text-align: center;
  margin-bottom: 32px;
}

.quiz-header h1 {
  font-size: 1.5rem;
  color: var(--brand-AAA);
  margin-bottom: 8px;
}

.quiz-logo {
  height: 24px;
  margin-bottom: 16px;
}

.quiz-intro {
  font-size: 0.95rem;
  color: var(--brand-AAA);
  margin-bottom: 8px;
}

.quiz-disclaimer {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 8px;
  margin-bottom: 0;
}

/* =========================
   PROGRESS
========================= */

.progress-bar {
  height: 8px;
  background: #e6eef5;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 32px;
}

.progress-bar.hidden {
  display: none;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--success-text);
  transition: width 0.3s ease;
}

#progress-bar {
  transition:
    opacity 200ms ease,
    transform 200ms ease;
}

#progress-bar.hidden {
  opacity: 0;
  transform: translateY(-8px);
}

/* =========================
   STEPS
========================= */

.quiz-step {
  display: none;
}

.quiz-step.active {
  display: block;
}

.quiz-step h2 {
  font-size: 1.25rem;
  font-weight: 500;
  font-variation-settings: "wght" 500;
  margin-bottom: 24px;
  text-align: center;
}

/* =========================
   OPTIONS
========================= */

.options {
  display: grid;
  gap: 16px;
}

.options button {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-AAA);
  background: #f7f9fb;
  cursor: pointer;
  font-size: 1rem;
  transition:
    background 0.2s ease,
    transform 0.15s ease;
}

.options button:hover {
  background: #eef4fa;
  transform: translateY(-1px);
}

/* =========================
   FOCUS STATES
========================= */

.options button:focus-visible,
#quiz-email-wrapper button:focus-visible,
.cta-primary:focus-visible {
  outline: 3px solid var(--brand-strong);
  outline-offset: 2px;
}

/* =========================
   OUTCOME CARD – MATERIAL 3 EXPRESSIVE
========================= */

#quiz-outcome-step {
  scroll-margin-top: 144px;
}

.outcome-card {
  position: relative;
  padding: 24px;
  margin-bottom: 24px;
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  animation: fadeUp 300ms ease;
  overflow: hidden;
}

/* Thin severity indicator */
.outcome-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.quiz-result-preview {
  margin-top: 12px;
}

.quiz-result-list {
  margin: 8px 0 16px;
  padding-left: 18px;
}

/* SUCCESS STATE */
.outcome-success {
  background:
    linear-gradient(0deg, hsla(222, 46%, 34%, 0.06), hsla(222, 46%, 34%, 0.06)),
    #ffffff;
}

.outcome-success::before {
  background: var(--success-text);
}

.outcome-success h3,
.outcome-success strong {
  color: var(--success-text);
}

/* URGENT STATE */
.outcome-urgent {
  background:
    linear-gradient(0deg, hsla(222, 89%, 43%, 0.06), hsla(222, 89%, 43%, 0.06)),
    #ffffff;
}

.outcome-urgent::before {
  background: var(--warning-text);
}

.outcome-urgent h3,
.outcome-urgent strong {
  color: var(--warning-text);
}

/* Force internal text colour to prevent global overrides */
.outcome-success,
.outcome-success * {
  color: var(--success-text) !important;
}

.outcome-urgent,
.outcome-urgent * {
  color: var(--warning-text) !important;
}

/* Optional status label */
.outcome-status-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 16px;
  display: block;
  opacity: 0.8;
}

/* =========================
   EMAIL
========================= */

#quiz-email-wrapper {
  margin-top: 24px;
  padding: 16px;
  background: rgba(202, 210, 230, 0.1);
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-dark);
}

#quiz-email-wrapper.hidden {
  display: none;
}

#quiz-email-wrapper form {
  display: grid;
  gap: 16px;
}

#quiz-email-wrapper input[type="email"] {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-dark);
}

#quiz-email-wrapper button {
  padding: 16px;
  border-radius: var(--radius-curve);
  background: var(--brand-AAA);
  border: none;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
}

/* =========================
   STICKY CTA - M3 EXPRESSIVE
========================= */
#sticky-cta {
  position: fixed;
  bottom: 0; /* pin to bottom */
  left: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center; /* keeps main CTA centered */
  align-items: center;
  padding: 16px 16px 16px 16px;
  box-sizing: border-box;
  border-radius: var(--radius-md) var(--radius-md) 0 0; /* tab look */
  background:
    linear-gradient(0deg, rgba(60, 87, 148, 0.06), rgba(60, 87, 148, 0.06)),
    #ffffff;
  border: 1px solid var(--brand-strong);
  box-shadow:
    0 -4px 12px rgba(0, 0, 0, 0.08),
    0 -2px 4px rgba(0, 0, 0, 0.04);
  opacity: 0;
  pointer-events: none;
  transform: translateY(100%); /* start hidden offscreen */
  transition:
    opacity 240ms ease-out,
    transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 200ms ease-out;
  z-index: 100;
}

#sticky-cta.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0); /* slide in from bottom */
}

/* CTA button itself */
#sticky-cta .btn-primary-brand {
  flex: 1; /* expand to take available space */
  max-width: 600px;
  text-align: center;
}

/* Dismiss button */
#sticky-cta button#sticky-cta-dismiss {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  margin-left: 16px;
  padding: 0 8px;
  border-radius: var(--radius-md);
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

#sticky-cta button#sticky-cta-dismiss:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
}

/* CTA link */
#sticky-cta a.btn-primary-brand {
  z-index: 1;
  display: inline-block;
  padding: 12px 24px;
  border-radius: var(--radius-curve);
  background: var(--brand-strong);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition:
    background 200ms ease,
    transform 200ms ease;
}

#sticky-cta a.btn-primary-brand:hover {
  background: var(--brand-AAA);
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Mobile-safe: full width if needed */
@media (max-width: 640px) {
  #sticky-cta {
    padding: 12px 48px 12px 16px;
  }
}

.cta-primary {
  text-decoration: none;
  text-align: center;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

/* Subtle elevation increase on hover (desktop only) */
@media (hover: hover) {
  #sticky-cta:hover {
    box-shadow:
      0 8px 24px rgba(0, 0, 0, 0.1),
      0 4px 8px rgba(0, 0, 0, 0.05);
  }
}

/* =========================
   BUTTON (GLOBAL CLASS USED)
========================= */

#sticky-cta .btn-primary-brand {
  width: 100%;
  border-radius: var(--radius-curve);

  transition:
    transform 140ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

/* Refined press interaction */
#sticky-cta .btn-primary-brand:active {
  transform: translateY(1px);
}

/* =========================
   OUTCOME SPACING SAFETY
========================= */

.main-quiz.has-outcome {
  padding-bottom: 128px;
}

/* =========================
   REDUCED MOTION SUPPORT
========================= */

@media (prefers-reduced-motion: reduce) {
  #sticky-cta {
    transition: none;
    transform: translateX(-50%) translateY(100%);
  }

  #sticky-cta.visible {
    /* transform: translateX(-50%) translateY(0%); */
  }

  #sticky-cta .btn-primary-brand,
  #sticky-cta button#sticky-cta-dismiss {
    transition: none;
  }
}

/*
/* =========================
   OUTCOME EXPANSION
========================= */

.main-quiz.has-outcome .quiz-container {
  max-width: 960px;
}

.main-quiz.has-outcome #quiz-steps-wrapper {
  margin-bottom: 0;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 640px) {
  .quiz-shell {
    padding: 16px 0px;
  }

  .quiz-container {
    padding: 8px;
  }
}

/* =========================
   ANIMATION
========================= */

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

.outcome-card {
  animation: fadeUp 280ms ease-out;
}
