/* ============================================================
   AA — week 14 animations (anim-w14.js)
   Every selector is prefixed with .w14- ; theme tokens only.
   ============================================================ */

.anim .w14-lead { font-size: .9rem; margin: 0 0 .6rem; }
.anim .w14-lead code, .anim .w14-q code, .anim .w14-fb code { font-size: .8em; }
.anim .w14-h { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: .2rem 0 .3rem; }
.anim .w14-hide { display: none !important; }
.anim .w14-panel { margin-top: 1rem; padding-top: .85rem; border-top: 1px dashed var(--border-strong); }

/* static / clickable code blocks (reuse .ct-code look) */
.anim .w14-code { max-height: none; }
.anim .w14-pick .ct-line { cursor: pointer; }
.anim .w14-pick .ct-line:hover { background: var(--surface-2); }
.anim .w14-pick .ct-line:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.anim .ct-line.w14-hit { background: var(--red-soft); border-left-color: var(--red); }
.anim .ct-line.w14-near { background: var(--accent-soft); border-left-color: var(--accent); }
.anim .ct-line.w14-fine { background: var(--surface-2); }
.anim .ct-line.w14-pickd { background: var(--blue-soft); border-left-color: var(--blue); }
.anim .w14-tag { font-family: var(--font-mono); font-size: .58rem; color: var(--red); margin-left: .8rem; white-space: nowrap; }

/* labelled rows of cells */
.anim .w14-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.anim .w14-row > .lab { font-family: var(--font-mono); font-size: .64rem; color: var(--muted); min-width: 7.4rem; }
.anim .w14-row .arr { margin-top: 0; }
.anim .arr .cell.w14-ord { height: auto; min-height: 2.5rem; line-height: 1.15; padding: .2rem .4rem; text-align: center; }
.anim .arr .cell.w14-ord small { position: static; display: block; font-size: .56rem; color: var(--muted); }
.anim .arr .cell.w14-empty { border-style: dashed; color: var(--muted); min-width: 3.2rem; }
.anim .w14-brace { font-family: var(--font-mono); font-size: 1.1rem; color: var(--muted); }
.anim .w14-flag { font-family: var(--font-mono); font-size: .68rem; color: var(--muted); }
.anim .w14-flag.good { color: var(--green); }
.anim .w14-flag.bad { color: var(--red); }
.anim .w14-text { font-family: var(--font-mono); font-size: .74rem; padding: .3rem .55rem; border: 1px solid var(--border); border-radius: 6px; background: var(--code-bg); min-height: 1.9rem; overflow-wrap: anywhere; flex: 1 1 12rem; color: var(--text); }
.anim .w14-text .cp { background: var(--accent-soft); color: var(--accent); }
.anim .w14-text .nw { color: var(--green); }

/* style.css gives every table min-width: 460px; let ours shrink (the wrap still scrolls if needed) */
.anim .w14-tw .anim-table { min-width: 0; }
.anim .w14-tw .anim-table th, .anim .w14-tw .anim-table td { white-space: nowrap; }

/* segmented controls that may wrap */
.anim .w14-seg { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .25rem .35rem; max-width: 100%; }
.anim .w14-seg .seg { flex-wrap: wrap; max-width: 100%; }

/* quiz-style questions */
.anim .w14-q { margin-top: .9rem; }
.anim .w14-q .q { font-size: .9rem; margin: 0 0 .45rem; color: var(--text); }
.anim .w14-q .anim-opts { margin-bottom: 0; }
.anim .w14-q button.right { border-color: var(--green); color: var(--green); background: var(--green-soft); opacity: 1; }
.anim .w14-q button.wrong { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.anim .w14-q.long .anim-opts { flex-direction: column; align-items: stretch; }
.anim .w14-q.long button { text-align: left; white-space: normal; font-family: var(--font-body); font-size: .86rem; line-height: 1.4; }
.anim .w14-fb { font-size: .86rem; margin: .45rem 0 0; min-height: 1.2em; }
.anim .w14-yn { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.anim .w14-yn .qq { flex: 1 1 16rem; font-size: .88rem; }
.anim .w14-yn .w14-fb { flex: 1 1 100%; margin: 0; }
.anim .w14-yn .w14-fb:empty { display: none; }

/* offender / fix code pair */
.anim .w14-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .7rem; }
.anim .w14-pair > div { min-width: 0; }
.anim .w14-pair .ct-code { font-size: .7rem; }

/* work maps */
.anim .w14-maps { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .7rem; margin-top: .8rem; }
.anim .w14-map { border: 1px solid var(--border); border-radius: 10px; padding: .5rem .6rem; background: var(--surface); min-height: 10.5rem; min-width: 0; }
.anim .w14-map .w14-h b { color: var(--accent); font-weight: 700; }
.anim .w14-mrow { display: flex; gap: 2px; margin-bottom: 2px; align-items: center; min-height: 11px; }
.anim .w14-sq { width: 11px; height: 11px; border-radius: 2px; background: var(--border-strong); flex: none; }
.anim .w14-sq.cmp { background: var(--red); }
.anim .w14-sq.cpy { background: var(--accent); }
.anim .w14-sq.prep { background: var(--blue); }
.anim .w14-sq.hit { background: var(--green); }
.anim .w14-mrow.now .w14-sq { outline: 1px solid var(--heading); outline-offset: 0; }
.anim .w14-rl { font-family: var(--font-mono); font-size: .55rem; color: var(--muted); margin-left: .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anim .w14-legend { font-family: var(--font-mono); font-size: .6rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: .45rem; }
.anim .w14-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }

/* stacked bar (task 1 breakdown) */
.anim .w14-stack { display: flex; height: 16px; border-radius: 5px; overflow: hidden; border: 1px solid var(--border); margin-top: .3rem; }
.anim .w14-stack span { height: 100%; transition: width .35s ease; }

/* profiler output + progress */
.anim .w14-prof { font-family: var(--font-mono); font-size: .68rem; line-height: 1.5; white-space: pre; overflow-x: auto; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: .55rem .7rem; margin: .6rem 0 0; color: var(--text); min-height: 3.2rem; max-width: 100%; }
.anim .w14-prof .top { color: var(--accent); font-weight: 700; }
.anim .w14-prof .dim { color: var(--muted); }
.anim .w14-bar { height: 12px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--border); overflow: hidden; margin-top: .5rem; }
.anim .w14-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--accent)); transition: width .25s ease; }

/* peer review */
.anim .w14-draft { border-left: 3px solid var(--blue); background: var(--blue-soft); padding: .55rem .8rem; border-radius: 0 10px 10px 0; font-size: .88rem; margin-top: .4rem; }
.anim .w14-draft p { margin: .35rem 0; }
.anim .w14-draft .anim-table { margin-top: .2rem; }
.anim .w14-sum { border: 1px dashed var(--green); border-radius: 10px; padding: .6rem .85rem; font-size: .88rem; margin-top: .8rem; }
.anim .w14-sum p { margin: .3rem 0; }

@media (max-width: 640px) {
  .anim .w14-pair { grid-template-columns: minmax(0, 1fr); }
  .anim .w14-row > .lab { min-width: 100%; }
  .anim .w14-tag { display: none; }
}
@media (max-width: 420px) {
  .anim .w14-sq { width: 9px; height: 9px; }
  .anim .w14-map { padding: .45rem .45rem; }
}
