/* ════════════════════════════════════════════════════════════
 * PK-O1 — Onboarding V5 (assets/js/pk-onboarding.js), chargé par quiz.html
 * Maquettes Onb1..Onb4 : illustrations SVG et @keyframes (bob, swing, shake, twinkle, pulse, glow).
 * Tokens de style.css uniquement ; animations coupées en reduced-motion.
 * ════════════════════════════════════════════════════════════ */
.train-onboarding.onb {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  gap: 14px;
  min-height: calc(100dvh - 14px - 24px - env(safe-area-inset-bottom));
}
@media (min-width: 769px) {
  .train-onboarding.onb { min-height: calc(100dvh - 80px); padding-top: 12px; }
}
.onb:focus-within h1:focus { outline: none; }

/* En-tête : barre de progression + Passer / fermer */
.onb-head { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.onb-bar { flex: 1; height: 12px; border-radius: 6px; background: var(--border1); position: relative; overflow: hidden; }
.onb-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: var(--v); transition: width var(--t-mid) var(--ease-out); }
.onb-skip { margin: 0; flex: none; }
.onb-icon-btn {
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; background: none; color: var(--text2); cursor: pointer;
}
.onb-icon-btn:hover, .onb-icon-btn:focus-visible { color: var(--text1); background: var(--bg3); }
.onb-count { font-family: var(--font-mono); font-size: 12px; color: var(--text2); }

/* Textes */
.onb-kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; color: var(--v2); }
.onb-kicker-gold { color: var(--gold-ink); }
.onb-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text1);
}
.onb-title-xl { font-size: 32px; }
.onb-sub { margin: 0; color: var(--text2); font-size: 15px; line-height: 1.45; }
.onb-center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-top: auto; }
.onb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; }
.onb-cta { min-height: 56px !important; font-size: 16px; }
.onb-ghost { margin-top: 0; min-height: 44px; text-decoration: none; font-weight: 600; }

/* Choix (objectifs, niveau) */
.onb-options { display: flex; flex-direction: column; gap: 10px; }
.onb-opt { min-height: 60px; box-shadow: 0 4px 0 var(--nav-bg); }
.onb-opt > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.onb-opt-hint { font-family: var(--font-text); font-size: 13px; font-weight: 500; color: var(--text2); }
.onb-check {
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  border: 2px solid var(--v-border); color: transparent;
  display: flex; align-items: center; justify-content: center;
}
.onb-opt.is-on { border: 2px solid var(--v); background: var(--v-surface); }
.onb-opt.is-on .onb-check { background: var(--v); border-color: var(--v); color: var(--on-v); }

/* Mini-test */
.onb-stage {
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px 14px; border-radius: 22px;
  background: var(--bg2); border: 1px solid var(--border1);
}
.onb-chords { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.onb-chord {
  border-radius: 14px; padding: 12px 0; text-align: center;
  background: var(--v-surface); border: 1px solid var(--v-border);
  display: flex; flex-direction: column; gap: 2px;
}
.onb-chord.is-missing { border: 2px dashed var(--v); background: var(--bg1); }
.onb-chord.is-revealed { border-style: solid; border-color: var(--green); background: var(--ok-bg); }
.onb-chord-name { font-family: var(--font-display); font-weight: 800; font-size: 26px; color: var(--text1); }
.onb-chord.is-missing:not(.is-revealed) .onb-chord-name, .onb-chord.is-missing:not(.is-revealed) .onb-chord-deg { color: var(--v); }
.onb-chord-deg { font-family: var(--font-mono); font-size: 12px; color: var(--v2); }
.onb-kb { display: block; width: 100%; height: auto; max-height: 76px; }
.onb-kb-white { fill: var(--key-white); stroke: var(--pk-border2); stroke-width: 1; } /* revue C11 : visibles sur fond clair */
.onb-kb-black { fill: var(--key-black); }
.onb-kb .is-lit { fill: var(--v2); }
.onb-listen-row { display: flex; align-items: center; gap: 12px; }
.onb-play {
  width: 48px; height: 48px; flex: none; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--v); color: var(--on-v); box-shadow: 0 4px 0 var(--v-shadow);
  display: flex; align-items: center; justify-content: center;
}
.onb-play:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--v-shadow); }
.onb-listen { flex: 1; height: 6px; border-radius: 3px; background: var(--border1); position: relative; overflow: hidden; }
.onb-listen i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 3px; background: var(--v2); transform-origin: left center; transform: scaleX(0); }
.onb-listen.is-playing i { animation: onb-listen 3s linear forwards; }
.onb-listen-label { font-family: var(--font-mono); font-size: 12px; color: var(--text2); }
.onb-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.onb-answers.is-3 { grid-template-columns: repeat(3, 1fr); }
.onb-answer {
  min-height: 62px; padding: 8px; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--border1); background: var(--bg2); color: var(--text1);
  font: inherit; font-weight: 800; font-size: 17px;
  box-shadow: 0 4px 0 var(--nav-bg);
}
.onb-answer:hover:not(:disabled), .onb-answer:focus-visible { border-color: var(--v); }
.onb-answer:disabled { cursor: default; color: var(--text2); }
.onb-answer.is-good { border: 3px solid var(--green); background: var(--ok-bg); color: var(--ok-text); box-shadow: 0 4px 0 var(--ok-edge); }
.onb-answer.is-bad { border: 3px solid var(--red); background: var(--err-bg); color: var(--text1); box-shadow: 0 4px 0 var(--err-edge); }
.onb-feedback { margin: 0; min-height: 22px; font-weight: 700; font-size: 15px; text-align: center; }
.onb-feedback.is-good { color: var(--ok-text); }
.onb-feedback.is-bad { color: var(--red); }

/* Résultat */
.onb-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.onb-stat {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 18px;
  background: var(--bg2); border: 1px solid var(--border1); color: var(--v2);
}
.onb-stat-gold { background: var(--gold-bg); border-color: var(--gold); color: var(--gold-ink); }
.onb-stat-num { font-family: var(--font-display); font-weight: 800; font-size: 24px; color: var(--text1); }
.onb-stat-gold .onb-stat-num { color: var(--gold-light); }
.onb-stat-label { font-size: 12px; color: var(--text2); }
.onb-stat-gold .onb-stat-label { color: var(--gold-soft); }
.onb-start {
  display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 18px;
  background: var(--v-surface); border: 1px solid var(--v-border);
}
.onb-start-name { font-weight: 700; font-size: 16px; color: var(--text1); }
.onb-start-hint { font-size: 14px; color: var(--v-text-soft); }

/* Objectif quotidien */
.onb-minutes-top { display: flex; align-items: center; gap: 14px; }
.onb-minutes-top > div { display: flex; flex-direction: column; gap: 6px; }
.onb-radio {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 16px; text-align: left; cursor: pointer;
  border-radius: 16px; border: 1px solid var(--border1); background: var(--bg2); color: var(--text1);
  font: inherit; box-shadow: 0 4px 0 var(--nav-bg);
}
.onb-radio.is-on { border: 2px solid var(--v); background: var(--v-surface); }
.onb-radio-dot { width: 22px; height: 22px; flex: none; border-radius: 11px; border: 2px solid var(--v-border); display: flex; align-items: center; justify-content: center; }
.onb-radio.is-on .onb-radio-dot { border-color: var(--v); }
.onb-radio.is-on .onb-radio-dot::after { content: ''; width: 10px; height: 10px; border-radius: 5px; background: var(--v); }
.onb-radio-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.onb-radio-label { font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.onb-radio-hint { font-size: 13px; color: var(--text2); }
.onb-tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; padding: 4px 8px; border-radius: 999px; background: var(--v); color: var(--on-v); }
.onb-week { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 18px; background: var(--bg2); border: 1px solid var(--border1); }
.onb-week-title { font-weight: 700; font-size: 15px; }
.onb-week-keys { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.onb-week-key {
  height: 58px; border-radius: 0 0 6px 6px; background: var(--key-dim); color: var(--key-black);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 5px;
  font-family: var(--font-mono); font-size: 11px;
}
.onb-week-key.is-today { background: var(--key-white); color: var(--key-black); box-shadow: inset 0 0 0 3px var(--v); }
.onb-week-hint { font-size: 13px; color: var(--text2); }

/* Cadeau */
.onb-gift-list { padding: 4px 16px; border-radius: 18px; background: var(--gold-bg); border: 1px solid var(--gold-deep); }
.onb-gift-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.onb-gift-row + .onb-gift-row { border-top: 1px solid var(--pk-border2); }
.onb-gift-icon { width: 42px; height: 42px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.onb-gift-icon.is-frost { background: var(--frost); color: var(--frost-ink); }
.onb-gift-icon.is-gold { background: var(--gold-bg); border: 1px solid var(--gold); color: var(--gold-ink); }
.onb-gift-title { font-weight: 700; color: var(--text1); }
.onb-gift-text { font-size: 13px; color: var(--gold-soft); }
.onb-chest-body { fill: var(--gold-deep); }
.onb-chest-lid { fill: var(--gold); }
.onb-chest-lock { fill: var(--gold-light); }

/* Illustrations */
.onb-art { display: block; overflow: visible; }
.onb-art-shadow { fill: var(--nav-bg); }
.onb-art-white { fill: var(--key-white); }
.onb-art-black { fill: var(--key-black); }
.onb-art-lit { fill: var(--v2); }
.onb-gold { fill: var(--gold-light); }
.onb-lav { fill: var(--v2); }
.onb-hp-band-out { fill: none; stroke: var(--v-border); stroke-width: 14; stroke-linecap: round; }
.onb-hp-band { fill: none; stroke: var(--v); stroke-width: 6; stroke-linecap: round; }
.onb-hp-cup { fill: var(--v); }
.onb-hp-shine { fill: var(--v3); opacity: 0.7; }
.onb-hp-wave { fill: none; stroke: var(--gold-light); stroke-width: 4; stroke-linecap: round; }
.onb-met-body { fill: var(--v-surface); stroke: var(--v-border); stroke-width: 3; }
.onb-met-base { fill: var(--v-border); }
.onb-met-arm { fill: var(--key-white); }
.onb-met-weight { fill: var(--gold); }
.onb-met-pivot { fill: var(--v); }
.onb-gift-halo { fill: var(--gold); opacity: 0.18; }
.onb-gift-box { fill: var(--v); }
.onb-gift-rim { fill: var(--v-shadow); }
.onb-gift-lid { fill: var(--v2); }
.onb-gift-ribbon { fill: var(--gold); }
.onb-gift-ribbon-l { fill: var(--gold-light); }

/* Animations (maquettes V5) : transform et opacity seulement */
@keyframes onb-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes onb-swing { 0%, 100% { transform: rotate(-16deg); } 50% { transform: rotate(16deg); } }
@keyframes onb-shake { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-6deg); } 80% { transform: rotate(6deg); } 85% { transform: rotate(-4deg); } 90% { transform: rotate(4deg); } }
@keyframes onb-twinkle { 0%, 100% { opacity: 0.2; transform: scale(0.6); } 50% { opacity: 1; transform: scale(1); } }
@keyframes onb-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
@keyframes onb-glow { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.9; } }
@keyframes onb-halo { 0%, 100% { opacity: 0.1; } 50% { opacity: 0.3; } }
@keyframes onb-listen { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.onb-bob { animation: onb-bob 2.6s ease-in-out infinite; }
.onb-swing { transform-origin: 60px 100px; animation: onb-swing 1.2s ease-in-out infinite; }
.onb-shake { transform-origin: 75px 120px; animation: onb-shake 2.4s ease-in-out infinite; }
.onb-tw { transform-box: fill-box; transform-origin: center; animation: onb-twinkle 1.8s ease-in-out infinite; }
.onb-d1 { animation-delay: 0.5s; }
.onb-d2 { animation-delay: 1s; }
.onb-d3 { animation-delay: 1.4s; }
.onb-pulse { animation: onb-pulse 1.4s ease-in-out infinite; }
.onb-glow { animation: onb-glow 2.2s ease-in-out infinite; }
.onb-gift-halo.onb-glow { animation-name: onb-halo; }

@media (prefers-reduced-motion: reduce) {
  .onb-bob, .onb-swing, .onb-shake, .onb-tw, .onb-pulse, .onb-glow, .onb-listen.is-playing i, .train-onboarding.onb { animation: none !important; }
  .onb-listen.is-playing i { transform: scaleX(1); }
  .onb-bar-fill { transition: none; }
}

/* Revue B3 : lien « J'ai déjà un compte » sous COMMENCER */
.onb-has-account { margin-top: 4px; }
