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

/* shared bits */
.w9-anim .anim-table { min-width: 0; }   /* style.css gives every table min-width: 460px */
.anim .w9-cap { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .04em; color: var(--muted); margin: .7rem 0 .15rem; }
.anim .w9-cap code, .anim .w9-h code { font-size: inherit; }
.anim .w9-h { font-family: var(--font-mono); font-size: .72rem; color: var(--heading); font-weight: 700; margin-bottom: .55rem; }
.anim p.w9-fb { font-size: .88rem; margin: .5rem 0 0; color: var(--text); }
.anim p.w9-fb:empty { display: none; }
.anim p.w9-fb strong { color: var(--heading); font-weight: 500; }
.anim p.w9-note { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }
.anim .w9-panel { margin-top: 1rem; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.anim .w9-panel .anim-opts { margin-bottom: .5rem; }
.anim .w9-wrapseg .seg { flex-wrap: wrap; }
.anim .w9-quiz { margin-bottom: .35rem; }
.anim .w9-quiz button.right { border-color: var(--green); color: var(--green); background: var(--green-soft); opacity: 1; }
.anim .w9-quiz button.wrong { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.anim .w9-code { max-height: 300px; }
.anim .w9-text { font-family: var(--font-mono); font-size: .75rem; width: 9.5rem; min-height: 32px; padding: .3rem .55rem; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); }
.anim .w9-panel input[type=number] { width: 7rem; }
.w9-anim .ct-extra .arr.idx { row-gap: 1.15rem; }
.anim .arr .cell.w9-none { opacity: .45; font-size: .6rem; text-decoration: line-through; }
.anim .arr .cell.w9-empty { border-style: dashed; background: transparent; color: var(--muted); font-size: .65rem; padding: 0 .6rem; }
.w9-anim .arr .cell sub { font-size: .55rem; color: var(--muted); margin-left: 1px; }
.anim canvas.w9-cv { margin-top: .5rem; border: 1px solid var(--border); }

/* Task 6: code on top, wide unwrapped output */
.w9-stack .ct { grid-template-columns: 1fr; }
.w9-stack .ct-code { max-height: 300px; }
.w9-stack .ct-vars { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); column-gap: .8rem; }
.w9-stack .ct-out { white-space: pre; overflow-x: auto; min-height: 6.2rem; max-height: none; }

/* Task 1: search-length bars */
.anim .w9-lens { display: flex; align-items: flex-end; gap: 4px; min-height: 52px; }
.anim .w9-len { position: relative; width: 2.2rem; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 4px 4px 0 0; transition: height .25s ease; }
.anim .w9-len b { position: absolute; top: -1.05rem; left: 0; right: 0; text-align: center; font-family: var(--font-mono); font-size: .62rem; color: var(--accent); }
.anim .w9-lens { padding-top: 1rem; }

/* Task 2: candidate chips */
.anim .w9-chips { display: flex; flex-wrap: wrap; gap: 4px; min-height: 2rem; }
.anim .w9-chip { font-family: var(--font-mono); font-size: .7rem; padding: .15rem .4rem; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--bg-soft); color: var(--text); }
.anim .w9-chip i { font-style: normal; font-size: .55rem; color: var(--muted); margin-left: .3rem; }
.anim .w9-chip.now { border-color: var(--blue); background: var(--blue-soft); }
.anim .w9-chip.hit { border-color: var(--green); background: var(--green-soft); color: var(--green); }

/* Task 4: two panels */
.anim .w9-duo { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem; }
.anim .w9-side { min-width: 0; }
.anim .w9-slots { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 2px; }
.anim .w9-slot { display: flex; flex-direction: column; align-items: center; padding: 1px 0; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-soft); font-family: var(--font-mono); line-height: 1.15; transition: background .2s, border-color .2s; }
.anim .w9-slot i { font-style: normal; font-size: .52rem; color: var(--muted); }
.anim .w9-slot b { font-size: .7rem; font-weight: 400; color: var(--muted); }
.anim .w9-slot.full b { color: var(--heading); font-weight: 700; }
.anim .w9-slot.now { border-color: var(--accent); background: var(--accent-soft); }
.anim .w9-slot.seen { opacity: .55; }
.anim .w9-slot.ok { border-color: var(--green); background: var(--green-soft); }
.anim .w9-slot.bad { border-color: var(--red); background: var(--red-soft); }
.anim .w9-dict { font-family: var(--font-mono); font-size: .72rem; min-height: 2.2rem; padding: .4rem .55rem; border: 1px solid var(--border); border-radius: 8px; background: var(--code-bg); color: var(--text); overflow-wrap: anywhere; }
.anim .w9-dict span { border-radius: 3px; padding: 0 2px; }
.anim .w9-dict span.now { background: var(--accent-soft); color: var(--accent); }
.anim .w9-dict span.cmp { background: var(--green-soft); color: var(--green); }
.anim .w9-duo .anim-stats { margin-top: .55rem; }
.anim .w9-crash .anim-stat:last-child b { color: var(--red); }

/* Task 5: the 10-slot tally */
.anim .w9-dig { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; max-width: 460px; }
.anim .w9-d { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 74px; padding-bottom: 2px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg-soft); font-family: var(--font-mono); transition: border-color .2s, background .2s; }
.anim .w9-d .bar { width: 60%; border-radius: 3px 3px 0 0; background: transparent; transition: height .25s ease; }
.anim .w9-d b { font-size: .8rem; color: var(--heading); }
.anim .w9-d i { font-style: normal; font-size: .55rem; color: var(--muted); }
.anim .w9-d.pos .bar { background: var(--accent); }
.anim .w9-d.neg .bar { background: var(--blue); }
.anim .w9-d.neg b { color: var(--blue); }
.anim .w9-d.up { border-color: var(--accent); background: var(--accent-soft); }
.anim .w9-d.down { border-color: var(--blue); background: var(--blue-soft); }
.anim .w9-d.zero { border-color: var(--green); }
.anim .w9-d.zero.now { background: var(--green-soft); }
.anim .w9-d.bad { border-color: var(--red); background: var(--red-soft); }

@media (max-width: 640px) {
  .anim .w9-duo { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .w9-anim .ct-extra .arr .cell { min-width: 1.75rem; height: 1.95rem; padding: 0 .2rem; font-size: .68rem; }
  .anim .w9-slots { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .anim .w9-text { width: 100%; }
  .anim .w9-panel input[type=number] { width: 5.6rem; }
  .anim .w9-len { width: 1.75rem; }
  .w9-anim .anim-table th, .w9-anim .anim-table td { padding: .3rem .3rem; }
  .w9-anim input[type=number] { width: 5.6rem; }
}
