/* Trainer visuals (shared/zsa-track.js): the progress track, the drawing stage and the animations on a right or a
   missed answer. Load after zsa-activity.css. Trainer roots carry the class zsa-tracked. Every animation is
   decoration: the state it leads to is drawn already, and zsa-base.css turns animations off for reduced motion.
   Animations never fade text (axe would read its contrast mid-fade) and never move or resize a button. */

/* Progress track: the sentence, then one pip per question and one bar per step. These are the question-set practice
   engine's pips (shared/zsa-practice.css, "Session header"): the same height, rounding, fill, stripes, ring and
   breathing, and the same data-state names. Only the color comes from the page: --zsa-track-accent is the trainers'
   blue here and teal on practice pages. A missed pip is striped as well as red, so it differs without color; a review
   item not yet reached is hollow. tests/unit/track-css.test.js keeps the two stylesheets in step. */
.zsa-tracked {--zsa-track-accent:var(--zsa-blue); --zsa-track-current:#bfdbfe; --zsa-track-breathe:#dbeafe; --zsa-track-empty:#e1e9f1;
  --zsa-track-red:#b91c1c;}
.zsa-track {display:flex;flex-wrap:wrap;align-items:center;column-gap:12px;row-gap:4px;}
.zsa-track .zsa-progress {margin:0;}
.zsa-track-pips {flex:1 1 140px;display:flex;align-items:center;gap:4px 12px;min-width:0;min-height:14px;}
.zsa-track-items {flex:1 1 auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(8px,1fr));align-items:center;gap:5px;min-width:0;max-width:260px;}
.zsa-track-steps {flex:none;display:grid;grid-auto-flow:column;grid-auto-columns:16px;align-items:center;gap:3px;}
.zsa-track-pip, .zsa-track-step {position:relative;display:block;height:10px;border-radius:999px;background:var(--zsa-track-empty);overflow:hidden;}
.zsa-track-pip::after, .zsa-track-step::after {content:"";position:absolute;inset:0;border-radius:inherit;transform:scaleX(0);transform-origin:left;transition:transform .45s cubic-bezier(.2,.7,.2,1);}
.zsa-track-pip[data-state="current"] {background:var(--zsa-track-current);box-shadow:0 0 0 2px #fff, 0 0 0 4px var(--zsa-track-accent);animation:zsa-track-breathe 1.6s ease-in-out infinite;}
.zsa-track-pip[data-state="correct"]::after, .zsa-track-step[data-state="done"]::after {transform:scaleX(1);background:var(--zsa-track-accent);}
.zsa-track-pip[data-state="missed"]::after {transform:scaleX(1);background:repeating-linear-gradient(135deg,var(--zsa-track-red) 0 3px,#e0605f 3px 6px);}
.zsa-track-pip[data-zsa-review][data-state=""] {background:transparent;box-shadow:inset 0 0 0 1.5px #94a3b8;}
.zsa-track-step[data-state="current"] {background:var(--zsa-track-current);box-shadow:inset 0 0 0 1.5px var(--zsa-track-accent);}
@keyframes zsa-track-breathe {50% {background-color:var(--zsa-track-breathe);}}

/* The stage: a dark bench panel for the drawing, as in the virtual labs. */
.zsa-stage {position:relative;border-radius:var(--zsa-radius-lg);background:linear-gradient(160deg,#16386f 0%,#0b2a5b 55%,#081f45 100%);color:#e2e8f0;box-shadow:inset 0 1px 0 rgba(255,255,255,.08);overflow:hidden;}
.zsa-stage-eyebrow {margin:0;font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:#bfdbfe;}
.zsa-stage-pill {display:inline-block;margin:0;padding:2px 10px;border-radius:var(--zsa-radius-pill);font-size:13px;font-weight:600;line-height:1.35;color:#0b2a5b;background:#dbeafe;}
.zsa-stage-pill.is-good {background:#bbf7d0;color:#14532d;}
.zsa-stage-line {margin:0;font-size:13px;line-height:1.4;color:#e2e8f0;}
.zsa-stage svg {display:block;overflow:visible;}

/* A right answer: the stage glows once. A miss: it shifts gently from side to side. */
.zsa-stage.is-cheer {animation:zsa-track-glow .7s ease-out;}
.zsa-stage.is-nudge {animation:zsa-track-nudge .4s ease-in-out;}

/* The engine's own parts, inside a trainer. */
/* A wrong pick rings once; buttons never move, so their size and place stay exact while it plays. */
.zsa-tracked .zsa-choice.zsa-tried {animation:zsa-track-ring .6s ease-out;}
.zsa-tracked .zsa-feedback--wrong.is-again {animation:zsa-track-nudge .36s ease-in-out;}
.zsa-tracked .zsa-trail li:last-child {animation:zsa-track-pop .45s cubic-bezier(.34,1.56,.64,1);transform-origin:left center;}
.zsa-tracked .zsa-last.zsa-feedback--correct {animation:zsa-track-slide .35s ease-out;}
.zsa-tracked .zsa-summary h3 {animation:zsa-track-pop .5s cubic-bezier(.34,1.56,.64,1);transform-origin:left center;}

@keyframes zsa-track-pop {0% {transform:scale(.4);} 70% {transform:scale(1.15);} 100% {transform:scale(1);}}
@keyframes zsa-track-nudge {0%,100% {transform:translateX(0);} 25% {transform:translateX(-4px);} 50% {transform:translateX(3px);} 75% {transform:translateX(-2px);}}
@keyframes zsa-track-ring {0% {box-shadow:0 0 0 0 rgba(185,28,28,.55);} 100% {box-shadow:0 0 0 9px rgba(185,28,28,0);}}
@keyframes zsa-track-slide {0% {transform:translateX(-8px);} 100% {transform:translateX(0);}}
@keyframes zsa-track-glow {0% {box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 0 0 0 rgba(34,197,94,.7);} 100% {box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 0 0 14px rgba(34,197,94,0);}}

/* Reduced motion: zsa-base.css stops animations and transitions on elements; this also stops them on the pips' fill
   (a ::after), as zsa-practice.css does on practice pages. */
@media(prefers-reduced-motion:reduce) {
  .zsa-tracked *::before, .zsa-tracked *::after {animation:none!important;transition:none!important;}
}
