/* ============================================================
   AA — week 8 animation extras (anim-w8.js). Theme tokens only.
   ============================================================ */

/* shared bits */
.w8-anim .anim-table { min-width: 0; }   /* style.css gives every table min-width: 460px */
.anim .w8-cap { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .04em; color: var(--muted); margin: .7rem 0 .15rem; }
.anim .w8-cap code { font-size: inherit; }
.anim p.w8-fb { font-size: .88rem; min-height: 1.5em; margin: .2rem 0 .6rem; color: var(--text); }
.anim p.w8-fb strong, .anim p.w8-verdict strong { color: var(--heading); font-weight: 500; }
.anim .w8-quiz { margin-bottom: .3rem; }
.anim .w8-quiz button.right { border-color: var(--green); color: var(--green); background: var(--green-soft); opacity: 1; }
.anim .w8-quiz button.wrong { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.anim .w8-code { max-height: none; }
.anim p.w8-verdict { font-size: .88rem; margin: .5rem 0 0; padding: .5rem .7rem; border-left: 3px solid var(--green); background: var(--green-soft); border-radius: 0 8px 8px 0; }
.anim .w8-codewrap:empty { display: none; }
.anim .w8-codewrap { margin-top: .3rem; }
.anim .arr .cell.w8-gap { margin-left: 10px; }
.anim .arr .cell.w8-empty { border-style: dashed; background: transparent; color: var(--muted); }

/* Task 1: line picker, stage, pair grid */
.anim .w8-lines { display: flex; flex-direction: column; gap: 3px; margin-bottom: .7rem; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: .35rem; }
.anim button.w8-line { display: flex; justify-content: space-between; align-items: center; gap: .6rem; width: 100%; text-align: left; background: transparent; border: 1px solid transparent; border-left: 3px solid transparent; border-radius: 6px; padding: .3rem .55rem; min-height: 30px; }
.anim button.w8-line code { font-size: .74rem; background: none; border: 0; padding: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.anim button.w8-line.sel { background: var(--accent-soft); border-left-color: var(--accent); }
.anim .w8-mark { flex: none; font-size: .68rem; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 6px; padding: .05rem .4rem; }
.anim .w8-line.done .w8-mark { color: var(--green); border: 1px solid var(--green); background: var(--green-soft); }
.anim .w8-stage { min-height: 120px; }
.anim .w8-stage .arr.idx, .anim .w8-watch .arr.idx { row-gap: 1.15rem; }
.anim .w8-chips { font-family: var(--font-mono); font-size: .7rem; color: var(--muted); min-height: 1.6em; margin-top: .2rem; white-space: pre-wrap; }
.anim .w8-chips.on { color: var(--accent); }
.anim .w8-grid { display: grid; gap: 2px; margin-top: .4rem; }
.anim .w8-grid i { aspect-ratio: 1; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--border); transition: background .15s; }
.anim .w8-grid i.on { background: var(--accent-soft); border-color: var(--accent); }
.anim .w8-grid i.now { background: var(--accent); border-color: var(--accent); }

/* Task 2: printed column + ratio ruler */
.anim .w8-study { color: var(--heading); font-size: .7rem; margin-top: 0; }
.anim pre.w8-pre { min-height: 7.6rem; max-height: none; white-space: pre; overflow-x: auto; }
.anim .w8-gauge { margin: .6rem 0 .9rem; }
.anim .w8-gtrack { position: relative; height: 54px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin: 0 4px; }
.anim .w8-gtick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.anim .w8-gtick b { position: absolute; bottom: 2px; left: 4px; font-family: var(--font-mono); font-size: .6rem; font-weight: 400; color: var(--muted); }
.anim .w8-gdot { position: absolute; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--blue); opacity: .55; transition: left .3s ease; }
.anim .w8-gdot.last { background: var(--accent); opacity: 1; box-shadow: 0 0 0 3px var(--accent-soft); }
.anim .w8-gdot em { position: absolute; left: 14px; top: -3px; font-style: normal; font-family: var(--font-mono); font-size: .66rem; color: var(--accent); background: var(--bg); padding: 0 3px; border-radius: 3px; white-space: nowrap; }

/* Task 3: stopwatch lanes */
.anim .w8-lane { margin-top: .9rem; }
.anim .w8-lhead { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem; font-family: var(--font-mono); font-size: .7rem; color: var(--muted); margin-bottom: .25rem; }
.anim .w8-lhead .who { color: var(--heading); }
.anim .w8-clock { color: var(--accent); font-weight: 700; }
.anim .w8-clock.done { color: var(--green); }
.anim .w8-ltrack { position: relative; height: 26px; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--border); margin-bottom: 1.3rem; }
.anim .w8-lfill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 7px; background: linear-gradient(90deg, var(--blue), var(--accent)); }
.anim .w8-lane.l .w8-lfill { background: linear-gradient(90deg, var(--blue), var(--green)); }
.anim .w8-lmark { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--border-strong); }
.anim .w8-lmark.on { background: var(--heading); }
.anim .w8-lmark b { position: absolute; top: 100%; margin-top: 3px; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: .58rem; font-weight: 400; color: var(--muted); white-space: nowrap; }
.anim .w8-lmark.end b { left: auto; right: 0; transform: none; }
.anim .w8-lmark.on b { color: var(--heading); }
.anim .w8-lmark.nolab b { display: none; }

/* Task 4: the receipt */
.anim .w8-receipt { margin-top: .8rem; padding: .7rem .9rem; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--surface); font-family: var(--font-mono); font-size: .72rem; }
.anim .w8-rhead { color: var(--heading); font-weight: 700; margin: .45rem 0 .2rem; }
.anim .w8-rhead:first-child { margin-top: 0; }
.anim .w8-ritem { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .18rem .35rem; border-radius: 6px; border: 1px solid transparent; }
.anim .w8-ritem.total { border-top: 1px dashed var(--border-strong); border-radius: 0; margin-top: .15rem; padding-top: .35rem; }
.anim .w8-ritem.good { background: var(--green-soft); border-color: var(--green); border-radius: 6px; }
.anim .w8-ritem.bad { background: var(--red-soft); border-color: var(--red); border-radius: 6px; }
.anim .w8-rlab { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.anim .w8-rlab code { font-size: inherit; }
.anim .w8-given { color: var(--muted); padding: 0 .7rem; }
.anim .w8-receipt select { flex: none; min-width: 7.2rem; }
.anim .w8-checkrow { margin: .8rem 0 0; }
.anim .w8-tally { color: var(--accent); min-height: 1.4em; }

/* Task 5: predictions + canvas */
.anim .w8-wrapseg .seg { flex-wrap: wrap; }
.anim .w8-predict { border: 1px solid var(--border); border-radius: 10px; padding: .5rem .8rem .1rem; background: var(--surface); margin-bottom: .9rem; }
.anim .w8-prow { display: grid; grid-template-columns: 4.4rem minmax(0, 8rem) minmax(0, 8rem) 1.2rem; margin-bottom: .35rem; padding: 2px 4px; border-radius: 8px; }
.anim .w8-prow input[type=number], .anim .w8-prow select { width: 100%; min-width: 0; }
.anim .w8-prow.good { background: var(--green-soft); }
.anim .w8-prow.bad { background: var(--red-soft); }
.anim .w8-pmark { font-weight: 700; min-width: 1rem; }
.anim .w8-prow.good .w8-pmark { color: var(--green); }
.anim .w8-prow.bad .w8-pmark { color: var(--red); }
.anim canvas.w8-cv { border: 1px solid var(--border); }

@media (max-width: 560px) {
  .anim .w8-stage .arr .cell, .anim .w8-watch .arr .cell { min-width: 1.6rem; height: 1.9rem; padding: 0 .2rem; font-size: .66rem; }
  .anim .w8-stage .arr, .anim .w8-watch .arr { gap: 3px; }
  .anim .w8-stage .arr .cell.w8-gap { margin-left: 6px; }
  .anim .w8-ritem { flex-wrap: wrap; }
  .anim .w8-receipt select { margin-left: auto; }
  .anim .w8-prow { grid-template-columns: 1fr 1fr 1rem; gap: .3rem; }
  .anim .w8-prow .lab { grid-column: 1 / -1; margin-bottom: -.2rem; }
  .w8-anim .anim-table th, .w8-anim .anim-table td { padding: .3rem .3rem; }
}
