:root {
  --bg: #130f16;
  --bg-soft: rgba(20, 16, 27, 0.77);
  --panel: rgba(18, 13, 23, 0.87);
  --panel-strong: rgba(11, 8, 15, 0.91);
  --border: rgba(255, 183, 102, 0.22);
  --text: #f8f1e6;
  --muted: #ddc5a3;
  --accent: #f16d2a;
  --accent-soft: #ffb667;
  --accent-deep: #8e3110;
  --ok: #84d59b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --topbar-offset: 92px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Outfit", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(241, 109, 42, 0.22), transparent 24%),
    radial-gradient(circle at top right, rgba(255, 201, 120, 0.14), transparent 18%),
    radial-gradient(circle at bottom center, rgba(228, 122, 53, 0.18), transparent 20%),
    linear-gradient(180deg, #1e1624 0%, #110d17 48%, #09070c 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.05));
}

body.view-parcours-active::after,
body.view-final-active::after {
  content: "";
  position: fixed;
  top: var(--topbar-offset);
  left: 0;
  width: 100vw;
  height: calc(100svh - var(--topbar-offset));
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10, 8, 12, 0.21) 0%, rgba(10, 8, 12, 0.45) 100%),
    radial-gradient(circle at 50% 14%, rgba(255, 188, 110, 0.15), transparent 20%),
    url("./assets/chapelier-fou-seul.jpeg?v=37") center top / cover no-repeat;
  background-color: #110d17;
}

.page-shell {
  position: relative;
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: calc(var(--topbar-offset) + 10px) 0 15px;
  overflow-x: clip;
}

.page-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 999px;
  filter: blur(36px);
  opacity: 0.25;
  z-index: 0;
}

.page-glow-left {
  left: -80px;
  top: 120px;
  background: rgba(241, 109, 42, 0.55);
}

.page-glow-right {
  right: -60px;
  top: 320px;
  background: rgba(255, 187, 97, 0.32);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  margin-left: 0;
  padding: 0;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: rgba(10, 8, 12, 0.69);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.topbar-inner {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 20px 0 18px;
}

.brand-button,
.nav-link,
.primary-button,
.ghost-button,
.step-jump,
.step-card-button,
.answer-field button {
  font: inherit;
}

.brand-button,
.nav-link,
.step-jump {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.brand-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-weight: 700;
  text-transform: none;
}

.brand-kicker {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.brand-title {
  font-size: 1.08rem;
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.02em;
  color: var(--text);
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.nav-link {
  padding: 4px 5px;
  border-radius: 999px;
  font-size: 0.8rem;
  white-space: nowrap;
  color: var(--accent-soft);
  transition: 180ms ease;
}

.nav-link.is-active,
.nav-link:hover,
.nav-link:focus-visible {
  color: #1f130d;
  background: linear-gradient(135deg, var(--accent-soft) 0%, #ffd79b 100%);
  outline: none;
}

.app {
  position: relative;
  z-index: 1;
}

.view {
  display: none;
  position: relative;
}

.view.is-visible {
  display: block;
}

.view-intro {
  padding-top: 0;
}

.view-parcours,
.view-final {
  padding-top: 14px;
}

.hero-card,
.final-card,
.quick-info,
.info-card,
.step-card,
.step-sidebar {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  padding: 28px;
  border-radius: 34px;
  overflow: hidden;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.eyebrow {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  line-height: 0.98;
}

h1 {
  font-size: clamp(3.2rem, 7vw, 6.8rem);
  max-width: 10ch;
}

h2 {
  font-size: clamp(2.4rem, 4vw, 4rem);
}

h3 {
  font-size: 1.8rem;
}

.hero-lead,
.final-lead {
  font-size: 1.16rem;
  line-height: 1.65;
  color: var(--text);
  max-width: 48ch;
}

.intro-text {
  display: grid;
  gap: 10px;
  color: var(--text);
  line-height: 1.7;
}

.intro-text p,
.info-card p,
.step-question,
.step-hint,
.step-note,
.final-summary p,
.empty-state,
.answer-help,
.definition-text,
.definition-title {
  margin: 0;
}

.definition-card {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 192, 125, 0.18);
  background: rgba(255, 255, 255, 0.04);
  max-width: 42ch;
}

.definition-title {
  font-weight: 700;
  color: var(--accent-soft);
  margin-bottom: 6px;
}

.definition-text {
  color: var(--text);
  line-height: 1.65;
  font-style: italic;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.primary-button,
.ghost-button,
.step-card-button,
.answer-field button {
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button,
.answer-field button {
  background: linear-gradient(135deg, var(--accent-soft) 0%, #ffd79b 100%);
  color: #1f130d;
  font-weight: 700;
}

.step-next-button {
  background: linear-gradient(135deg, var(--accent-soft) 0%, #ffd79b 100%);
  color: #1f130d;
}

.primary-button:hover,
.ghost-button:hover,
.step-card-button:hover,
.answer-field button:hover {
  transform: translateY(-1px);
}

.ghost-button,
.step-card-button {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border);
  color: var(--text);
}

.hero-visual {
  min-height: 520px;
}

.hero-poster {
  position: relative;
  height: 100%;
  min-height: 520px;
  border-radius: 28px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(7, 8, 16, 0.08), rgba(14, 8, 18, 0.38)),
    radial-gradient(circle at 22% 18%, rgba(255, 214, 143, 0.6), transparent 18%),
    radial-gradient(circle at 76% 22%, rgba(255, 151, 73, 0.48), transparent 16%),
    radial-gradient(circle at 78% 60%, rgba(73, 140, 255, 0.35), transparent 10%),
    linear-gradient(160deg, rgba(241, 109, 42, 0.08), rgba(0, 0, 0, 0.1)),
    url("./assets/chapelier-fou-seul.jpeg") center 18% / cover no-repeat,
    linear-gradient(180deg, #3b2330 0%, #1b1a34 44%, #09070b 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 194, 121, 0.15);
}

.hero-poster::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 205, 146, 0.18);
  pointer-events: none;
}

.hero-poster-overlay {
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, rgba(8, 7, 11, 0.76));
}

.hero-poster-badge,
.hero-poster-caption {
  position: absolute;
  left: 22px;
  right: 22px;
  z-index: 1;
}

.hero-poster-badge {
  top: 22px;
  width: fit-content;
  max-width: calc(100% - 44px);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(10, 8, 11, 0.62);
  border: 1px solid rgba(255, 191, 128, 0.3);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-poster-caption {
  bottom: 24px;
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
}

.quick-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.info-card {
  padding: 20px;
  border-radius: 22px;
}

.info-card h2 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.info-card p {
  color: var(--muted);
  line-height: 1.7;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 28px;
}

.progress-pill {
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(10, 8, 12, 0.61);
  color: var(--muted);
}

.step-card,
.final-card {
  border-radius: 24px;
}

.step-card {
  padding: 28px;
}

.step-card-inner {
  display: grid;
  gap: 18px;
}

.step-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.step-counter {
  color: var(--accent-soft);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.step-theme {
  display: inline-flex;
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--accent-soft);
  background: rgba(10, 8, 12, 0.45);
  font-size: 0.82rem;
  line-height: 1.2;
}

.step-question-list,
.answer-list,
.summary-list {
  display: grid;
  gap: 14px;
}

.question-card,
.answer-field,
.summary-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 192, 125, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.step-card.is-transitioning .question-card,
.step-card.is-transitioning .answer-field {
  opacity: 0;
  transform: translateY(10px);
  animation: step-stagger 440ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.step-card.is-transitioning .step-question-list {
  position: relative;
}

.step-card.is-transitioning .step-question-list::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 72%, rgba(255, 206, 138, 0.14) 0 1px, transparent 2px),
    radial-gradient(circle at 76% 18%, rgba(255, 188, 110, 0.18) 0 1.5px, transparent 3px),
    radial-gradient(circle at 52% 46%, rgba(255, 220, 170, 0.12) 0 1px, transparent 2px),
    radial-gradient(circle at 84% 62%, rgba(255, 188, 110, 0.16) 0 1.5px, transparent 3px);
  opacity: 0;
  animation: fairy-sparkles 720ms cubic-bezier(0.22, 1, 0.36, 1);
}

.step-card.is-transitioning .question-card:nth-of-type(1),
.step-card.is-transitioning .answer-field:nth-of-type(1) {
  animation-delay: 40ms;
}

.step-card.is-transitioning .question-card:nth-of-type(2),
.step-card.is-transitioning .answer-field:nth-of-type(2) {
  animation-delay: 90ms;
}

.step-card.is-transitioning .question-card:nth-of-type(3),
.step-card.is-transitioning .answer-field:nth-of-type(3) {
  animation-delay: 140ms;
}

.step-card.is-transitioning .question-card:nth-of-type(4),
.step-card.is-transitioning .answer-field:nth-of-type(4) {
  animation-delay: 190ms;
}

.summary-card {
  width: 100%;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: 160ms ease;
}

.summary-card:hover,
.summary-card:focus-visible {
  border-color: rgba(255, 186, 126, 0.32);
  background: rgba(241, 109, 42, 0.1);
  outline: none;
}

.step-question {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 12px;
}

.step-hint,
.step-note,
.answer-help,
.summary-meta {
  color: var(--muted);
  line-height: 1.6;
}

.step-hint {
  color: var(--text);
}

.answer-warning {
  margin: 0;
  color: #ffcf9c;
  line-height: 1.6;
}

.answer-field {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 18px;
}

fieldset.answer-field {
  min-inline-size: 0;
  border: 0;
}

.answer-label {
  display: block;
  font-weight: 600;
  padding: 0;
  margin: 0 0 10px;
}

.answer-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 210, 163, 0.14);
  background: rgba(10, 8, 14, 0.65);
  cursor: pointer;
  transition: 160ms ease;
}

.answer-option:hover,
.answer-option:has(.answer-radio:checked) {
  border-color: rgba(255, 186, 126, 0.32);
  background: rgba(241, 109, 42, 0.12);
}

.answer-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.answer-option span {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.answer-option span::before {
  content: "";
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 999px;
  border: 2px solid rgba(255, 205, 146, 0.42);
  background:
    radial-gradient(circle at center, transparent 0 45%, rgba(255, 255, 255, 0.04) 46% 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: 160ms ease;
}

.answer-option:has(.answer-radio:checked) span::before {
  border-color: rgba(255, 194, 121, 0.95);
  background:
    radial-gradient(circle at center, rgba(255, 194, 121, 0.95) 0 34%, transparent 35% 100%),
    linear-gradient(135deg, rgba(241, 109, 42, 0.28), rgba(255, 194, 121, 0.12));
  box-shadow:
    0 0 0 4px rgba(241, 109, 42, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.answer-option:has(.answer-radio:focus-visible) {
  outline: 2px solid rgba(255, 180, 109, 0.44);
  outline-offset: 2px;
}

.step-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.step-actions > * {
  flex: 1 1 0;
}

.step-action-spacer {
  visibility: hidden;
}

.step-action-spacer.is-hidden {
  display: none;
}

.step-actions:has(.step-action-spacer.is-hidden) {
  justify-content: center;
}

.step-actions:has(.step-action-spacer.is-hidden) .step-next-button {
  flex: 0 1 240px;
}

.step-card-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.step-next-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.empty-state {
  padding: 26px;
  border-radius: 22px;
  border: 1px dashed rgba(255, 194, 121, 0.22);
  color: var(--muted);
}

.final-card {
  padding: 30px;
}

.final-summary {
  margin: 24px 0;
}

.final-code-card {
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(255, 192, 125, 0.18);
  background: linear-gradient(135deg, rgba(241, 109, 42, 0.19), rgba(255, 255, 255, 0.09));
}

.final-code-label,
.final-code-value {
  margin: 0;
}

.final-code-label {
  color: var(--muted);
  line-height: 1.5;
}

.final-code-value {
  margin-top: 6px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0.18em;
  color: var(--accent-soft);
}

.final-answers-title {
  margin: 0 0 12px;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.8rem;
  color: var(--text);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 7, 11, 0.7);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(100%, 420px);
  max-width: calc(100vw - 24px);
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 192, 125, 0.2);
  background: rgba(20, 15, 24, 0.98);
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-text {
  margin: 10px 0 18px;
  color: var(--text);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.summary-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.summary-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.summary-answer-row + .summary-answer-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.summary-question-text,
.summary-good,
.summary-explanation {
  margin: 6px 0 0;
  line-height: 1.6;
}

.summary-question-text {
  color: var(--text);
}

.summary-good {
  color: var(--ok);
  font-weight: 600;
}

.summary-explanation {
  color: var(--muted);
}

.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;
}

@media (max-width: 980px) {
  .hero-card {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    order: -1;
  }

  .hero-visual {
    min-height: 420px;
  }

  .summary-list,
  .quick-info {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 720px) {
  :root {
    --topbar-offset: 102px;
  }

  body.view-parcours-active::after,
  body.view-final-active::after {
    top: var(--topbar-offset);
    height: calc(100svh - var(--topbar-offset));
  }

  .page-shell {
    width: min(100% - 16px, 1180px);
    padding: calc(var(--topbar-offset) + 4px) 0 15px;
  }

  .page-glow {
    display: none;
  }

  .topbar-inner {
    width: min(100% - 16px, 1180px);
    flex-direction: column;
    align-items: stretch;
    padding: 14px 0 12px;
  }

  .modal-card {
    width: 100%;
    padding: 20px;
    border-radius: 20px;
  }

  .modal-actions {
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .modal-actions .primary-button,
  .modal-actions .ghost-button {
    flex: 1 1 0;
    width: auto;
  }

  .topnav {
    justify-content: space-between;
  }

  .nav-link {
    flex: 1 1 0;
    text-align: center;
    font-size: 0.76rem;
    padding: 4px 4px;
  }

  .hero-card,
  .step-card,
  .final-card {
    padding: 18px;
    border-radius: 24px;
  }

  h1 {
    font-size: clamp(2.5rem, 14vw, 4.2rem);
  }

  h2 {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  .section-heading,
  .step-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .step-action-spacer {
    display: none;
  }

  .step-actions {
    flex-wrap: nowrap;
    flex-direction: row;
    align-items: stretch;
  }

  .hero-poster {
    min-height: 380px;
  }
}
