/* Malilu World — the learning-plan quiz.
   Same steps, same order and the same copy as the app's onboarding
   (Malilu/Onboarding/OnboardingSteps.swift), on the violet ground. */

.quiz-body { background: var(--ground); }

.quiz {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: #fff;
}

.quiz__head {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  padding: 12px var(--gutter) 0;
}
.quiz__back {
  width: 46px; height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}
.quiz__back:hover { background: rgba(255, 255, 255, 0.14); }
.quiz__back[hidden] { visibility: hidden; display: inline-flex; }
.quiz__back svg { width: 22px; height: 22px; }
.quiz__logo { justify-self: center; }
.quiz__logo img { width: 104px; }

.quiz__progress {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 620px;
  margin: 18px auto 0;
  padding: 0 var(--gutter);
  width: 100%;
}
.quiz__track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  overflow: hidden;
}
.quiz__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--cta);
  transition: width 0.32s cubic-bezier(0.3, 0.8, 0.4, 1);
}
.quiz__count { font-size: 15px; font-weight: 800; color: rgba(255, 255, 255, 0.78); font-variant-numeric: tabular-nums; }

.quiz__stage {
  flex: 1;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 22px var(--gutter) 24px;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------- guide + bubble */

.guide {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 22px;
}
.guide__img { width: 108px; flex: 0 0 auto; margin-top: 6px; }
.guide__img img { width: 100%; }

.bubble {
  position: relative;
  background: #fff;
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 16px 20px;
  font-weight: 900;
  font-size: 19px;
  line-height: 1.34;
  flex: 1 1 auto;
  margin-top: 14px;
  min-height: 56px;
}
.bubble::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 26px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 4px;
  transform: rotate(45deg);
}
.bubble__sub {
  display: block;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-soft);
  margin-top: 8px;
}
.bubble--reaction { background: var(--sunshine); }
.bubble--reaction::before { background: var(--sunshine); }

@media (max-width: 520px) {
  .guide__img { width: 84px; }
  .bubble { font-size: 17.5px; padding: 14px 16px; }
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  vertical-align: -0.14em;
  background: currentColor;
  margin-left: 2px;
  animation: caret 1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* ------------------------------------------------------------- options */

.opts { display: grid; gap: 10px; margin: 0 0 20px; }
.opts--grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.opts--ages { grid-template-columns: repeat(3, 1fr); gap: 12px; }
.opts--binary { grid-template-columns: 1fr 1fr; gap: 12px; }

.opt {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--card);
  color: #fff;
  border: 2.5px solid transparent;
  border-radius: var(--r-md);
  padding: 16px 18px;
  font: inherit;
  font-weight: 800;
  font-size: 17px;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}
.opt:hover { background: var(--card-selected); }
.opt:active { transform: scale(0.985); }
.opt[aria-pressed="true"], .opt[aria-checked="true"] {
  background: var(--card-selected);
  border-color: var(--mist);
}

.opt__icon {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  color: var(--sunshine);
}
.opt__icon svg { width: 100%; height: 100%; }

.opt__text { flex: 1 1 auto; min-width: 0; }
.opt__sub { display: block; font-weight: 700; font-size: 14.5px; color: rgba(255, 255, 255, 0.72); }

.opt__check {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.opt[aria-pressed="true"] .opt__check,
.opt[aria-checked="true"] .opt__check {
  background: var(--cta);
  border-color: var(--cta);
  color: var(--ink);
}
.opt__check svg { width: 15px; height: 15px; opacity: 0; }
.opt[aria-pressed="true"] .opt__check svg,
.opt[aria-checked="true"] .opt__check svg { opacity: 1; }

/* icon grid */
.opt--grid {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 20px 14px;
  min-height: 132px;
  justify-content: center;
}
.opt--grid .opt__icon { width: 34px; height: 34px; }
.opt--grid .opt__check { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; }
.opt--grid { position: relative; }

/* tall illustrated rows */
.opt--tall {
  flex-direction: row;
  gap: 18px;
  padding: 24px 20px;
  min-height: 104px;
  font-size: 19px;
}
.opt--tall .opt__icon { width: 46px; height: 46px; }

/* age tiles */
.opt--age {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  padding: 22px 8px;
  font-size: 15px;
  font-weight: 800;
}
.opt--age b { font-size: 34px; font-weight: 900; line-height: 1.05; color: var(--sunshine); }

/* binary tiles */
.opt--binary {
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 26px 16px;
  font-size: 19px;
}
.opt--binary .opt__icon { width: 34px; height: 34px; }

/* ---------------------------------------------------------- name field */

.namefield { margin-bottom: 18px; }
.namefield input {
  width: 100%;
  background: rgba(255, 255, 255, 0.14);
  border: 2.5px solid rgba(255, 255, 255, 0.34);
  border-radius: var(--r-md);
  padding: 18px 20px;
  font: inherit;
  font-size: 21px;
  font-weight: 800;
  color: #fff;
}
.namefield input::placeholder { color: rgba(255, 255, 255, 0.5); font-weight: 700; }
.namefield input:focus { border-color: var(--cta); outline: none; background: rgba(255, 255, 255, 0.2); }
.hint { font-size: 14.5px; color: rgba(255, 255, 255, 0.72); font-weight: 700; margin: 10px 2px 0; }

/* ------------------------------------------------------------- carousel */

.carousel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.bcard {
  background: var(--card);
  border: 3px solid transparent;
  border-radius: var(--r-md);
  padding: 14px 10px 16px;
  text-align: center;
  color: #fff;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}
.bcard:hover { transform: translateY(-2px); }
.bcard[aria-checked="true"] {
  background: var(--card-selected);
  border-color: var(--cta);
  box-shadow: 0 0 0 4px rgba(60, 219, 188, 0.28);
}
/* The masters differ in height; a fixed box keeps every name on the same line. */
.bcard picture {
  height: 104px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 8px;
}
.bcard img { max-height: 104px; width: auto; margin: 0 auto; }
.bcard b { display: block; font-size: 18px; font-weight: 900; }
/* Two lines of room, so a one-line role and a two-line role leave the names
   on the same baseline across the grid. */
.bcard span {
  display: block;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.76);
  font-weight: 700;
  min-height: 2.6em;
}

/* ------------------------------------------------- proof, cards, sources */

.proof {
  background: var(--band-on-night);
  border-radius: var(--r-lg);
  padding: 30px 26px;
  text-align: center;
  margin-bottom: 20px;
}
.proof__stat { font-size: 54px; font-weight: 900; color: var(--sunshine); line-height: 1.05; }
.proof__title { font-size: 21px; font-weight: 900; margin-top: 6px; }
.proof__body { color: rgba(255, 255, 255, 0.82); font-size: 16px; margin: 10px auto 0; max-width: 40ch; font-weight: 700; }

.factcard {
  background: var(--band-on-night);
  border-radius: var(--r-md);
  padding: 16px 20px;
  font-size: 15.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.86);
  margin-bottom: 18px;
}

.sources {
  background: #fff;
  color: var(--ink);
  border-radius: var(--r-lg);
  padding: 26px 24px;
  margin-bottom: 20px;
}
.sources h2 { font-size: 24px; }
.sources p { color: var(--ink-soft); font-size: 16px; }
.sources ul { padding-left: 1.1em; }
.sources li { color: var(--ink-soft); font-size: 15.5px; }

/* ------------------------------------------------------------ plan build */

.build { text-align: center; padding: 20px 0 0; }
.build h2 { font-size: 24px; margin-bottom: 26px; }
.buildrow { text-align: left; margin-bottom: 18px; }
.buildrow__label {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 7px;
  color: rgba(255, 255, 255, 0.9);
}
.buildrow__track { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.22); overflow: hidden; }
.buildrow__fill { display: block; height: 100%; background: var(--cta); width: 0; transition: width 0.4s linear; }

/* ---------------------------------------------------------------- result */

.result { background: #fff; color: var(--ink); border-radius: var(--r-lg); padding: 28px 24px; margin-bottom: 18px; }
.result__kicker {
  display: inline-block;
  background: var(--cta);
  color: var(--ink);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 13px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.result h2 { font-size: clamp(25px, 4vw, 33px); }
.result > p { color: var(--ink-soft); font-size: 16.5px; }

.result__facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 24px; }
.fact {
  background: var(--mist);
  border-radius: var(--r-sm);
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 800;
}
.fact b { display: block; font-size: 13px; color: var(--ink-soft); font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }

.result h3 { font-size: 19px; margin: 22px 0 10px; }

.week { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); list-style: none; padding: 0; margin: 0; }
.week li { background: var(--mist); border-radius: var(--r-sm); padding: 12px 14px; margin: 0; }
.week b { display: block; font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.week span { font-weight: 800; font-size: 15.5px; }

.result__games { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.result__games li {
  background: var(--mist);
  border-radius: var(--r-sm);
  padding: 11px 15px;
  margin: 0;
  font-size: 15.5px;
}
.result__games b { font-weight: 900; }
.result__games span { color: var(--ink-soft); }

.result__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.result__saved { font-size: 14.5px; color: var(--ink-soft); margin: 14px 0 0; font-weight: 700; }

/* ---------------------------------------------------------------- footer */

.quiz__foot {
  position: sticky;
  bottom: 0;
  padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--ground) 68%, rgba(91, 63, 208, 0));
}
.quiz__foot-inner { max-width: 620px; margin: 0 auto; }
.quiz__privacy {
  text-align: center;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.66);
  font-weight: 700;
  margin: 10px 0 0;
}

/* ---------------------------------------------------------------- welcome */

.welcome { text-align: center; padding-top: 10px; }
.welcome img.wordmark { width: min(300px, 74%); margin: 0 auto 22px; }
.welcome h1 { font-size: clamp(28px, 6vw, 42px); color: #fff; }
.welcome p { color: rgba(255, 255, 255, 0.84); font-size: 18px; max-width: 34ch; margin: 0 auto 20px; }
.welcome__hero { width: min(260px, 62%); margin: 8px auto 0; }

.intro { text-align: center; padding-top: 16px; }
.intro__img { width: min(240px, 58%); margin: 0 auto 8px; }
.intro .bubble { margin: 0 auto; max-width: 30ch; text-align: center; }
.intro .bubble::before { display: none; }

.noscript {
  background: #fff;
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 20px 22px;
  margin: 20px auto;
  max-width: 560px;
}
