/* Diagnostics-specific extras layered on top of the .mx design system.
   Only contains things that aren't already provided by maxon-design-system.css:
   - page/hero wrappers shared by diagnostic & auth flow,
   - staggered reveal animation for hero/cards,
   - sticky status bar with progress on plan_building,
   - error-review blocks (post-diagnostic walkthrough).
   Everything is scoped under .mx so it cannot leak into legacy pages. */

/* ── Shared diagnostic / auth page layout ─────────────────────────── */
.mx .mx-diag-page {
  display: flex;
  justify-content: center;
  padding: 54px 22px 80px;
}
.mx .mx-diag-page--compact { padding: 36px 22px 80px; }
.mx .mx-diag-page__inner {
  width: 100%;
  max-width: 600px;
}
.mx .mx-diag-page__inner--auth { max-width: 460px; }

.mx .mx-diag-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.mx .mx-diag-hero__sub {
  color: var(--mx-muted);
  max-width: 440px;
  margin: 0 auto;
  font-weight: 700;
}
.mx .mx-diag-hero__hint {
  color: var(--mx-muted-2);
  max-width: 420px;
  margin: 0 auto;
  font-weight: 700;
}

/* Vertical stack helpers (used inside diagnostic cards and auth forms) */
.mx .mx-diag-stack    { display: flex; flex-direction: column; gap: 12px; }
.mx .mx-diag-stack--md { display: flex; flex-direction: column; gap: 16px; }
.mx .mx-diag-stack--lg { display: flex; flex-direction: column; gap: 22px; }

/* Progress strip above active diagnostic session */
.mx .mx-diag-progress-bar { margin-bottom: 24px; }
.mx .mx-diag-progress-bar__legend {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--mx-muted-2);
  font-weight: 800;
  margin-top: 8px;
}
.mx .mx-diag-progress-bar__legend b { color: var(--mx-primary-d); }

/* Auth pages (register/login) — secondary link below the card */
.mx .mx-diag-auth-foot {
  text-align: center;
  margin-top: 22px;
  font-weight: 700;
  color: var(--mx-muted-2);
  font-size: 14px;
}

/* Question header (numbered chip + prompt) used inside _theme/_start_subjects */
.mx .mx-diag-qhead {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 14px;
}
.mx .mx-diag-qhead__num {
  color: #fff;
  background: var(--mx-grad);
  min-width: 26px;
  height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  flex: none;
  box-shadow: 0 3px 0 var(--mx-sh-primary);
}
.mx .mx-diag-qhead__num--lg {
  min-width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 16px;
  box-shadow: 0 5px 0 var(--mx-sh-primary);
}
.mx .mx-diag-qhead__text { flex: 1; min-width: 0; }

/* Theme nav (back/next) at the bottom of the question card */
.mx .mx-diag-nav {
  display: flex;
  gap: 13px;
  margin-top: 26px;
  align-items: flex-start;
}
.mx .mx-diag-nav__primary { flex: 1; }

/* ── Staggered reveal ─────────────────────────────────────────────── */
.mx .mx-diag-reveal {
  animation: mx-diag-pop .5s var(--mx-ease-out) both;
  animation-delay: calc(var(--mx-diag-i, 0) * 70ms);
}
@keyframes mx-diag-pop {
  0%   { opacity: 0; transform: translateY(14px); }
  100% { opacity: 1; transform: none; }
}

/* ── Plan-building sticky status bar ──────────────────────────────── */
.mx .mx-diag-statusbar {
  display: flex;
  flex-direction: column;
  gap: 15px;
  border-radius: var(--mx-radius-2xl);
  padding: 18px 20px;
  background: linear-gradient(135deg, #fff, var(--mx-primary-soft));
  border: 2px solid var(--mx-primary-100);
  box-shadow: 0 8px 0 var(--mx-primary-100);
  position: sticky;
  top: 0;
  z-index: calc(var(--mx-z-header) + 1);
}
.mx .mx-diag-statusbar.is-ready {
  border-color: #A7E8C9;
  background: linear-gradient(135deg, #fff, var(--mx-success-soft));
  box-shadow: 0 8px 0 #A7E8C9;
}
.mx .mx-diag-statusbar.is-ready .mx-progress__fill {
  background: linear-gradient(90deg, var(--mx-lime), var(--mx-success));
}
.mx .mx-diag-statusbar.is-failed .mx-progress__fill {
  background: linear-gradient(90deg, var(--mx-pink), var(--mx-danger));
}
.mx .mx-diag-statusbar.is-failed {
  border-color: #F8B6C5;
  background: linear-gradient(135deg, #fff, var(--mx-danger-soft));
  box-shadow: 0 8px 0 #F8B6C5;
}
.mx .mx-diag-statusbar__top { display: flex; align-items: center; gap: 14px; }
.mx .mx-diag-statusbar__title { min-width: 0; flex: 1; }
.mx .mx-diag-statusbar__title b { font-size: 16px; font-weight: 800; color: var(--mx-ink); display: block; line-height: 1.25; }
.mx .mx-diag-statusbar__title p { font-size: 13px; color: var(--mx-muted-2); margin-top: 3px; font-weight: 700; line-height: 1.4; }
.mx .mx-diag-statusbar__go {
  margin-left: auto; flex: none; display: none; align-items: center; gap: 7px;
}
.mx .mx-diag-statusbar.is-ready .mx-diag-statusbar__go { display: inline-flex; animation: mx-diag-pop .45s var(--mx-ease-out) both; }
.mx .mx-diag-statusbar__retry { margin-left: auto; flex: none; display: none; }
.mx .mx-diag-statusbar.is-failed .mx-diag-statusbar__retry { display: inline-flex; }

/* ── Error review (post-diagnostic walkthrough) ───────────────────── */
.mx .mx-diag-rev-h    { font-weight: 800; font-size: 22px; margin: 34px 0 6px; color: var(--mx-ink); line-height: 1.2; }
.mx .mx-diag-rev-sub  { font-size: 14.5px; color: var(--mx-muted); margin-bottom: 6px; font-weight: 700; line-height: 1.5; }
.mx .mx-diag-rev-topic {
  font-size: 13px; font-weight: 800; color: var(--mx-primary-d); text-transform: uppercase;
  letter-spacing: .06em; margin: 26px 0 12px; display: flex; align-items: center; gap: 10px;
}
.mx .mx-diag-rev-topic::after { content: ""; flex: 1; height: 2px; background: var(--mx-border); border-radius: 2px; }
.mx .mx-diag-qc {
  background: var(--mx-card);
  border: 2px solid var(--mx-border);
  border-radius: var(--mx-radius-2xl);
  padding: 20px;
  margin-top: 13px;
  box-shadow: var(--mx-shadow-lg);
}
.mx .mx-diag-qt { font-weight: 800; font-size: 16px; margin-bottom: 15px; line-height: 1.4; color: var(--mx-ink); word-wrap: break-word; }
.mx .mx-diag-ans {
  display: flex; align-items: flex-start; gap: 11px; font-size: 15px;
  padding: 12px 16px; border-radius: 13px; margin-top: 9px; font-weight: 800; line-height: 1.4;
}
.mx .mx-diag-ans--bad  { background: var(--mx-danger-soft); color: var(--mx-danger-deep); }
.mx .mx-diag-ans--good { background: var(--mx-success-soft); color: var(--mx-success-deep); }
.mx .mx-diag-ans__lab {
  font-weight: 800; min-width: 104px; font-size: 12.5px; text-transform: uppercase;
  letter-spacing: .03em; opacity: .8; flex: none; line-height: 1.6;
}
.mx .mx-diag-ans__val { flex: 1; min-width: 0; word-wrap: break-word; }
.mx .mx-diag-expl {
  font-size: 14px; color: var(--mx-muted); line-height: 1.55; margin-top: 14px;
  padding: 13px 16px; background: var(--mx-surface-alt);
  border-left: 4px solid var(--mx-primary);
  border-radius: 0 13px 13px 0; font-weight: 700;
}
.mx .mx-diag-more-note {
  text-align: center; font-size: 14.5px; color: var(--mx-muted); font-weight: 800;
  border: 2px dashed var(--mx-border); border-radius: var(--mx-radius-lg);
  padding: 18px; margin-top: 18px;
}
.mx .mx-diag-more-note b { color: var(--mx-primary-d); font-weight: 900; }

/* ── Results screen (success) ─────────────────────────────────────── */
.mx.mx-diag-results-pad,
.mx .mx-diag-results-pad { padding-bottom: 200px; }
.mx .mx-diag-confetti { position: absolute; top: 10px; left: 50%; width: 1px; height: 1px; pointer-events: none; }
.mx .mx-diag-confetti i {
  position: absolute; width: 11px; height: 11px; border-radius: 3px;
  opacity: 0;
  animation: mx-diag-confetti-fall 1.4s ease-out forwards;
  animation-delay: calc(.25s + var(--mx-diag-n) * .05s);
}
@keyframes mx-diag-confetti-fall {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--mx-diag-x), 190px) rotate(540deg); }
}
.mx .mx-diag-confetti i:nth-child(1)  { --mx-diag-x: -150px; --mx-diag-n: 1;  background: var(--mx-pink); }
.mx .mx-diag-confetti i:nth-child(2)  { --mx-diag-x:  130px; --mx-diag-n: 2;  background: var(--mx-yellow); }
.mx .mx-diag-confetti i:nth-child(3)  { --mx-diag-x:  -90px; --mx-diag-n: 3;  background: var(--mx-teal); }
.mx .mx-diag-confetti i:nth-child(4)  { --mx-diag-x:  170px; --mx-diag-n: 4;  background: var(--mx-sky); }
.mx .mx-diag-confetti i:nth-child(5)  { --mx-diag-x: -180px; --mx-diag-n: 5;  background: var(--mx-orange); }
.mx .mx-diag-confetti i:nth-child(6)  { --mx-diag-x:   60px; --mx-diag-n: 6;  background: var(--mx-lime); }
.mx .mx-diag-confetti i:nth-child(7)  { --mx-diag-x:  -40px; --mx-diag-n: 7;  background: var(--mx-primary); }
.mx .mx-diag-confetti i:nth-child(8)  { --mx-diag-x:  110px; --mx-diag-n: 8;  background: var(--mx-pink); }
.mx .mx-diag-confetti i:nth-child(9)  { --mx-diag-x: -120px; --mx-diag-n: 9;  background: var(--mx-yellow); }
.mx .mx-diag-confetti i:nth-child(10) { --mx-diag-x:  200px; --mx-diag-n: 10; background: var(--mx-teal); }
.mx .mx-diag-confetti i:nth-child(11) { --mx-diag-x: -200px; --mx-diag-n: 11; background: var(--mx-sky); }
.mx .mx-diag-confetti i:nth-child(12) { --mx-diag-x:   30px; --mx-diag-n: 12; background: var(--mx-orange); }
.mx .mx-diag-confetti i:nth-child(13) { --mx-diag-x:  -70px; --mx-diag-n: 13; background: var(--mx-lime); }
.mx .mx-diag-confetti i:nth-child(14) { --mx-diag-x:  150px; --mx-diag-n: 14; background: var(--mx-primary); }

.mx .mx-diag-bar-row + .mx-diag-bar-row { margin-top: 20px; }
.mx .mx-diag-bar-row { margin-top: 18px; }
.mx .mx-diag-bar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; gap: 10px; flex-wrap: wrap; }
.mx .mx-diag-bar-top .mx-diag-name { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; min-width: 0; }
.mx .mx-diag-bottom-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 2px solid var(--mx-border);
  box-shadow: 0 -10px 30px rgba(110, 86, 248, .12);
  padding: 16px 22px 20px;
  animation: mx-diag-slideup .55s var(--mx-spring) both;
  animation-delay: .25s;
}
@keyframes mx-diag-slideup {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: none; }
}
.mx .mx-diag-bottom-cta__inner { width: 100%; max-width: 600px; }
.mx .mx-diag-bottom-cta__pmt { font-size: 14px; color: var(--mx-muted); text-align: center; margin-bottom: 12px; font-weight: 800; }
.mx .mx-diag-bottom-cta__pmt b { color: var(--mx-primary-d); font-weight: 900; }

/* ── Reduced motion: keep functional indicators only ──────────────── */
@media (prefers-reduced-motion: reduce) {
  .mx .mx-diag-reveal,
  .mx .mx-diag-confetti,
  .mx .mx-diag-bottom-cta { animation: none !important; }
  .mx .mx-diag-confetti { display: none; }
}

/* ── Mobile ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .mx .mx-diag-statusbar { padding: 14px 16px; gap: 12px; }
  .mx .mx-diag-statusbar__top { flex-wrap: wrap; }
  .mx .mx-diag-statusbar__go,
  .mx .mx-diag-statusbar__retry { margin-left: 0; width: 100%; }
  .mx .mx-diag-ans { flex-direction: column; gap: 4px; }
  .mx .mx-diag-ans__lab { min-width: 0; }
  .mx .mx-diag-rev-h { font-size: 20px; margin-top: 28px; }
  .mx.mx-diag-results-pad,
  .mx .mx-diag-results-pad { padding-bottom: 220px; }
}
