/* BitSize Algorithms — builds on python_patterns/patterns.css + python_data/data.css (the same lesson
   components) with a rose accent, the algoviz.js player and renderers, the rules poster and the quiz. */
.px.al, .px-panel.al { --px-accent: #E11D48; --px-accent-2: #FB7185; --px-soft-bg: #FFF1F3;
  --av-ink: #1F1A1C; --av-soft: #64748B; --av-line: #EADDE0; --av-ok: #15803D; --av-bad: #DC2626;
  --av-cmp: #F59E0B; --av-cur: #2563EB; --av-best: #E11D48; --av-seen: #F3E8EA; }
.px.al code { background: #FDECEF; }
.al .px-callout--rose { background: #FFF1F3; border-color: #FBCFD8; color: #4C0519; }

/* ── the course page ── */
.al-hero-viz { border: 1px solid var(--av-line); border-radius: 16px; overflow: hidden; background: #fff; text-decoration: none; display: block; }
.av-hero { height: 190px; display: flex; align-items: flex-end; gap: 6px; padding: 18px 18px 0; background: linear-gradient(180deg, #FFF7F8, #fff); }
.av-hero span { flex: 1; border-radius: 6px 6px 0 0; background: #FBCFD8; transition: height .16s ease, background .16s; }
.av-hero span.is-done { background: var(--px-accent); }
.av-hero span.is-cur { background: var(--av-cmp); }
.al-hero-viz__cap { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; font-size: 13px; color: #475569; border-top: 1px solid #F3E4E7; }
.al-hero-viz__cap b { color: var(--px-accent); }
.al-soon summary { cursor: pointer; font-weight: 700; color: #475569; }
.al-soon ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; color: #64748B; }
.al-soon ol li { display: flex; gap: 10px; }
.al-soon ol span { font-family: var(--px-mono, ui-monospace, monospace); color: #94A3B8; min-width: 2ch; }
.al-cost { font: 700 11px var(--px-mono, ui-monospace, monospace); color: var(--px-accent); background: #FFF1F3; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }

/* ── lesson: the problem ── */
.al-story { margin: 0 0 12px; padding: 18px 20px; border-radius: 16px; background: linear-gradient(120deg, #2A0A12, #881337 60%, #E11D48); color: #fff; }
.al-story span { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .8; margin-bottom: 4px; }
.al-story h2 { margin: 0 0 8px; font-size: 21px; color: #fff; }
.al-story p { margin: 0; font-size: 15.5px; line-height: 1.6; opacity: .95; }
.al-story code { background: rgba(255,255,255,.16); color: #fff; }
.al-goal { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: 14px; border: 2px solid var(--px-accent); background: #fff; font-size: 16.5px; font-weight: 600; }
.al-goal i { font-style: normal; font-size: 26px; }
.al-goal small { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--px-accent); }

/* ── lesson: Watch it ── */
.al-predict { border: 2px dashed var(--px-accent); border-radius: 14px; padding: 12px 14px; margin: 8px 0 12px; background: #FFFBFC; }
.al-predict.is-done { border-style: solid; border-color: #FBCFD8; }
.al-watch { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 960px) { .al-watch { grid-template-columns: minmax(0, 1fr); } }
.al-watch__code { position: sticky; top: 64px; }
@media (max-width: 960px) { .al-watch__code { position: static; } }
.al-try { margin: 12px 0 0; padding: 12px 16px; border-radius: 14px; background: #FFF7ED; border: 1px solid #FED7AA; font-size: 14.5px; }
.al-try > b { display: block; margin-bottom: 4px; }
.al-try ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }

.av-host { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 4px 0 2px; min-width: 0; }
.av-host > *, .av-player > * { min-width: 0; }
.av-ctl { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(180deg, #FFF7F8, #FFEFF2); border: 1px solid #FBD5DD; transition: opacity .25s; }
.av-host.is-locked .av-ctl, .av-host.is-locked .av-transport, .av-host.is-locked .av-side .av-btn { opacity: .38; pointer-events: none; filter: saturate(.4); }
.av-host.is-locked > .av-ctl:first-child::before { content: '🔒 Answer the prediction above to unlock the controls'; flex-basis: 100%; font-size: 12.5px; font-weight: 700; color: #4C0519; }
.av-seg { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.av-seg__lab { font-size: 12.5px; color: #475569; margin-right: 4px; }
.av-seg button, .av-btn { border: 1px solid #F5C2CD; background: #fff; color: var(--av-ink); border-radius: 999px; padding: 6px 12px; font: 600 13px inherit; cursor: pointer; }
.av-seg button.is-on { background: var(--px-accent); border-color: var(--px-accent); color: #fff; }
.av-btn:hover, .av-seg button:hover { border-color: var(--px-accent); }
.av-slider { display: grid; gap: 3px; min-width: 150px; flex: 1 1 150px; font-size: 12.5px; color: #475569; }
.av-slider > span { display: flex; justify-content: space-between; gap: 8px; }
.av-slider b { font: 800 13px var(--px-mono, ui-monospace, monospace); color: var(--px-accent); }
.av-slider input { width: 100%; accent-color: var(--px-accent); height: 22px; cursor: pointer; }
.av-hint { margin: 0; flex-basis: 100%; font-size: 12.5px; color: #64748B; }

.av-player { display: grid; gap: 10px; border: 1px solid var(--av-line); border-radius: 16px; background: #fff; padding: 14px; min-width: 0; }
.av-stage { display: grid; gap: 12px; min-height: 90px; align-content: start; overflow-x: auto; }
.av-say { margin: 0; min-height: 48px; padding: 11px 14px; border-radius: 12px; background: #FFF1F3; border: 1px solid #FBD5DD; color: #4C0519; font-size: 15px; line-height: 1.5; }
.av-counters { display: flex; flex-wrap: wrap; gap: 6px; }
.av-count { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 11px; border-radius: 999px; background: #1F1A1C; color: #fff; font-size: 12.5px; }
.av-count b { font: 800 15px var(--px-mono, ui-monospace, monospace); }
.av-count--soft { background: #F1F5F9; color: #334155; }
.av-transport { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.av-tbtn { min-width: 38px; height: 36px; border-radius: 10px; border: 1px solid #F5C2CD; background: #fff; font: 700 14px inherit; cursor: pointer; color: var(--av-ink); }
.av-tbtn:hover:not(:disabled) { border-color: var(--px-accent); }
.av-tbtn:disabled { opacity: .35; cursor: default; }
.av-tbtn--next { min-width: 84px; padding: 0 12px; background: var(--px-accent); border-color: var(--px-accent); color: #fff; }
.av-scrub { flex: 1 1 140px; accent-color: var(--px-accent); }
.av-pos { font: 700 12px var(--px-mono, ui-monospace, monospace); color: #64748B; min-width: 58px; text-align: right; }

/* tiles */
.av-tiles { display: flex; gap: clamp(2px, .8vw, 6px); padding: 22px 14px 4px; justify-content: center; flex-wrap: nowrap; container-type: inline-size; }
.av-t { position: relative; display: grid; justify-items: center; gap: 3px; flex: 1 1 0; min-width: 0; max-width: 52px; transition: opacity .25s, transform .2s; }
.av-t__v { display: grid; place-items: center; box-sizing: border-box; width: 100%; aspect-ratio: 1; border-radius: clamp(5px, 1.2vw, 10px); border: 2px solid #E7D6DA;
  background: #fff; font: 800 clamp(10.5px, calc(55cqw / var(--n, 8)), 17px) var(--px-mono, ui-monospace, monospace); color: var(--av-ink); transition: background .2s, border-color .2s, color .2s, box-shadow .2s; }
.av-t__i { font: 600 10.5px var(--px-mono, ui-monospace, monospace); color: #94A3B8; }
.av-t__ptr { position: absolute; top: -20px; font: 800 11px var(--px-mono, ui-monospace, monospace); color: var(--av-cur); white-space: nowrap; opacity: 0; transition: opacity .2s; }
.av-t__ptr.is-on { opacity: 1; }
.av-t__ptr.is-on::after { content: ' ▾'; }
.av-t.is-seen .av-t__v { background: var(--av-seen); border-color: #EBCFD5; color: #8B6B73; }
.av-t.is-cur .av-t__v { border-color: var(--av-cur); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.av-t.is-cmp .av-t__v { background: #FEF3C7; border-color: var(--av-cmp); }
.av-t.is-best .av-t__v { background: #FFE4E9; border-color: var(--av-best); color: #9F1239; }
.av-t.is-hit .av-t__v { background: #DCFCE7; border-color: var(--av-ok); color: #14532D; transform: scale(1.06); }
.av-t.is-out { opacity: .28; }
.av-t.is-ghost .av-t__v { border-style: dashed; background: none; color: #CBD5E1; }
.av-t.is-insert .av-t__v { box-shadow: -5px 0 0 -1px var(--av-ok); }
.av-tiles.is-pickable .av-t:not(.is-ghost) { cursor: pointer; }
.av-tiles.is-pickable .av-t:not(.is-ghost):hover .av-t__v { border-color: var(--px-accent); }
.av-tiles--small { justify-content: flex-start; padding: 20px 0 2px; gap: 5px; flex-wrap: wrap; container-type: normal; }
.av-tiles--small .av-t { flex: 0 0 auto; max-width: none; }
.av-tiles--small .av-t__v { width: 36px; height: 36px; font-size: 14px; border-radius: 8px; }
.av-badge { justify-self: center; padding: 6px 14px; border-radius: 999px; background: #FFE4E9; color: #9F1239; font-size: 13.5px; }
.av-badge b { font: 800 16px var(--px-mono, ui-monospace, monospace); margin-left: 6px; }
.av-note { margin: 0; font-size: 13.5px; color: #475569; text-align: center; }
.av-cap { margin: 4px 0 0; font-size: 13px; color: #64748B; }

/* grid (nested loops) */
.av-grid { display: grid; grid-template-columns: repeat(var(--n), minmax(26px, 40px)); gap: 3px; justify-content: center; }
.av-g { aspect-ratio: 1; border-radius: 5px; background: #F8F3F4; border: 1px solid #F0E3E6; transition: background .15s; }
.av-g--h, .av-g--corner { background: none; border: 0; display: grid; place-items: center; font: 700 11px var(--px-mono, ui-monospace, monospace); color: #64748B; line-height: 1.05; text-align: center; aspect-ratio: auto; min-height: 26px; }
.av-g--h small { display: block; font-weight: 600; color: #94A3B8; }
.av-g--corner { font-size: 9.5px; color: #94A3B8; }
.av-g.is-diag { background: repeating-linear-gradient(45deg, #fff, #fff 3px, #F1F5F9 3px, #F1F5F9 6px); border-color: #E2E8F0; }
.av-g.is-skip { background: #fff; border-style: dashed; border-color: #E2E8F0; }
.av-g.is-seen { background: #FDA4AF; border-color: #FB7185; }
.av-g.is-cur { background: var(--av-cmp); border-color: #D97706; }
.av-g.is-hit { background: var(--av-ok); border-color: #166534; }

/* number line */
.av-nl { display: grid; gap: 8px; padding: 24px 6px 4px; }
.av-nl__line { position: relative; height: 22px; border-radius: 999px; background: #F1F5F9; border: 1px solid #E2E8F0; }
.av-nl__range { position: absolute; top: -1px; bottom: -1px; border-radius: 999px; background: #FDA4AF; border: 1px solid #FB7185; transition: left .35s, width .35s; }
.av-nl__mid { position: absolute; top: -26px; transform: translateX(-50%); font: 800 12px var(--px-mono, ui-monospace, monospace); color: var(--av-cur); white-space: nowrap; transition: left .35s; }
.av-nl__mid::after { content: ''; position: absolute; left: 50%; top: 18px; width: 2px; height: 30px; background: var(--av-cur); transform: translateX(-50%); }
.av-nl__mid.is-hit { color: var(--av-ok); }
.av-nl__mid.is-hit::after { background: var(--av-ok); }
.av-nl__secret { position: absolute; top: 24px; transform: translateX(-50%); color: var(--px-accent); font-size: 16px; transition: left .35s; }
.av-nl__ends { display: flex; justify-content: space-between; font: 600 12px var(--px-mono, ui-monospace, monospace); color: #64748B; padding-top: 6px; }
.av-nl__ends b { color: var(--px-accent); font-size: 14px; }
.av-nl__hist { display: flex; flex-wrap: wrap; gap: 5px; }
.av-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 10px; border-radius: 999px; background: #F8FAFC; border: 1px solid #E2E8F0; font: 700 12.5px var(--px-mono, ui-monospace, monospace); }
.av-chip small { color: #94A3B8; }
.av-chip.is-hit { background: #DCFCE7; border-color: #86EFAC; }

/* charts */
.av-svg { display: block; width: 100%; height: auto; background: #fff; font-family: var(--px-font, system-ui, sans-serif); }
.av-axis { stroke: #94A3B8; stroke-width: 1.2; }
.av-gridline { stroke: #F1F5F9; stroke-width: 1; }
.av-tick { font-size: 11px; fill: #64748B; }
.av-vline { stroke: #1F1A1C; stroke-width: 1.4; stroke-dasharray: 4 4; }
.av-vlab { font-size: 11.5px; font-weight: 700; fill: #1F1A1C; }
.av-shade.is-bad { fill: #DC2626; fill-opacity: .12; }
.av-curve { fill: none; stroke: #94A3B8; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.av-curve.is-soft { stroke: #FDA4AF; stroke-dasharray: 6 5; stroke-width: 2; }
.av-curve.is-f { stroke: #1F1A1C; stroke-width: 3; }
.av-curve.is-up { stroke: var(--px-accent); stroke-dasharray: 7 5; }
.av-curve.is-lo { stroke: var(--av-cur); stroke-dasharray: 7 5; }
.av-curve.is-logn { stroke: #15803D; } .av-curve.is-n { stroke: #0E7490; } .av-curve.is-nlogn { stroke: #2563EB; }
.av-curve.is-n2 { stroke: #7C3AED; } .av-curve.is-n3 { stroke: #C026D3; } .av-curve.is-2n { stroke: #EA580C; } .av-curve.is-n { stroke: #0E7490; }
.av-clab { font-size: 12px; font-weight: 800; fill: #334155; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.av-clab.is-f { fill: #1F1A1C; } .av-clab.is-up { fill: var(--px-accent); } .av-clab.is-lo { fill: var(--av-cur); }
.av-clab.is-logn { fill: #15803D; } .av-clab.is-nlogn { fill: #2563EB; } .av-clab.is-n2 { fill: #7C3AED; } .av-clab.is-n3 { fill: #C026D3; } .av-clab.is-2n { fill: #EA580C; }
.av-dot { fill: var(--px-accent); stroke: #fff; stroke-width: 1.5; }
.av-side { border: 1px solid var(--av-line); border-radius: 16px; background: #fff; padding: 12px 14px; display: grid; gap: 8px; }
.av-side__h { margin: 0; display: grid; gap: 2px; font-size: 14px; }
.av-side__h span { font-size: 12.5px; color: #64748B; }
.av-side .av-btn { justify-self: start; }

/* tables */
.av-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff; border: 1px solid var(--av-line); border-radius: 12px; overflow: hidden; }
.av-table th, .av-table td { padding: 7px 10px; text-align: center; border-bottom: 1px solid #F3E8EA; }
.av-table thead th { background: #FFF1F3; color: #881337; font-weight: 700; }
.av-table tbody th { text-align: left; color: #334155; font-weight: 700; white-space: nowrap; }
.av-table td { font-family: var(--px-mono, ui-monospace, monospace); }
.av-table--q { margin: 6px 0 8px; width: auto; min-width: 60%; }
.av-table--growth td:last-child { color: var(--px-accent); font-weight: 800; }

/* histogram (linear search, every target) */
.av-hist:empty { display: none; }
.av-hist { border: 1px solid var(--av-line); border-radius: 16px; background: #fff; padding: 12px 14px; display: grid; gap: 10px; }
.av-hist__bars { position: relative; display: flex; align-items: flex-end; gap: 5px; height: 150px; padding-top: 16px; border-bottom: 1.5px solid #94A3B8; }
.av-hist__bars span { position: relative; flex: 1; height: var(--h); border-radius: 6px 6px 0 0; background: #FDA4AF; display: flex; justify-content: center; }
.av-hist__bars span.is-best { background: var(--av-ok); }
.av-hist__bars span.is-worst, .av-hist__bars span.is-miss { background: var(--px-accent); }
.av-hist__bars span.is-miss { background: repeating-linear-gradient(45deg, #E11D48, #E11D48 4px, #FB7185 4px, #FB7185 8px); }
.av-hist__bars b { position: absolute; top: -17px; font: 800 11.5px var(--px-mono, ui-monospace, monospace); }
.av-hist__bars small { position: absolute; bottom: -18px; font: 600 10.5px var(--px-mono, ui-monospace, monospace); color: #64748B; white-space: nowrap; }
.av-hist__avg { position: absolute; left: 0; right: 0; bottom: var(--a); border-top: 2px dashed #1F1A1C; pointer-events: none; }
.av-hist__avg em { position: absolute; left: 0; top: -18px; font: 700 11px inherit; font-style: normal; background: #fff; padding: 0 4px; }
.av-hist .av-note { margin-top: 14px; text-align: left; }

/* the code panel */
.al-code { border-radius: 14px; overflow: hidden; border: 1px solid #3B1F27; background: #1E1418; }
.al-code__h { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; font: 600 12.5px var(--px-mono, ui-monospace, monospace); color: #F5C2CD; background: #160E11; border-bottom: 1px solid #3B1F27; flex-wrap: wrap; }
.al-code pre { margin: 0; padding: 10px 0; overflow-x: auto; font: 13.5px/1.65 var(--px-mono, ui-monospace, monospace); color: #F3E8EA; background: none; }
.al-line { display: block; padding: 0 14px 0 0; white-space: pre; transition: background .15s; }
.al-line::before { content: attr(data-n); display: inline-block; width: 2.6em; margin-right: 12px; text-align: right; color: #7D5C66; user-select: none; }
.al-line.has-note { cursor: pointer; }
.al-line.has-note::before { color: #FDA4AF; }
.al-line.is-on { background: rgba(251, 113, 133, .2); box-shadow: inset 3px 0 0 #FB7185; }
.al-line.is-live { background: rgba(250, 204, 21, .22); box-shadow: inset 3px 0 0 #FACC15; }
.al-line.is-live::before { color: #FACC15; }
.al-verified { font-size: 12px; font-weight: 600; color: #86EFAC; }
.al-output { margin-top: 10px; border-radius: 12px; border: 1px solid var(--av-line); background: #fff; overflow: hidden; }
.al-output__h { padding: 6px 12px; font-size: 12px; font-weight: 700; color: #64748B; background: #FFF7F8; border-bottom: 1px solid #F3E4E7; }
.al-output pre { margin: 0; padding: 10px 14px; font: 13px/1.5 var(--px-mono, ui-monospace, monospace); overflow-x: auto; }
.al-notes { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.al-notes li { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border: 1px solid var(--av-line); border-radius: 12px; background: #fff; font-size: 14.5px; cursor: pointer; }
.al-notes li.is-on, .al-notes li:focus { border-color: var(--px-accent); background: #FFF7F8; outline: none; }
.al-notes li > span:first-child { font: 700 12px var(--px-mono, ui-monospace, monospace); color: var(--px-accent); white-space: nowrap; }

/* key points */
.al-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 10px; counter-reset: pt; }
.al-point { position: relative; display: grid; gap: 6px; align-content: start; padding: 16px 16px 14px; border: 1px solid var(--av-line); border-radius: 16px; background: #fff; counter-increment: pt; }
.al-point::after { content: counter(pt); position: absolute; top: 12px; right: 14px; font: 800 12px var(--px-mono, ui-monospace, monospace); color: #FDA4AF; }
.al-point__i { font-size: 28px; line-height: 1; }
.al-point b { font-size: 16px; line-height: 1.3; }
.al-point span { font-size: 14.5px; color: #334155; line-height: 1.55; }
.al-takeaway { margin-top: 14px; padding: 12px 16px; border-radius: 14px; background: #FFF1F3; color: #4C0519; font-size: 14.5px; }

/* the rules poster */
.al-poster { border-radius: 20px; overflow: hidden; border: 1px solid #3B1F27; background: #fff; box-shadow: 0 10px 30px -18px rgba(76, 5, 25, .45); }
.al-poster__top { padding: 18px 20px 16px; background: linear-gradient(120deg, #1F0A10, #881337 70%, #BE123C); color: #fff; display: grid; gap: 12px; }
.al-poster__name { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.al-poster__name h3 { margin: 0; font-size: 20px; color: #fff; }
.al-poster__name span { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.al-badges { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.al-badge { display: grid; gap: 2px; padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); }
.al-badge small { font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; opacity: .75; }
.al-badge b { font: 800 17px var(--px-mono, ui-monospace, monospace); }
.al-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.al-tags span { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #fff; color: #881337; }
.al-rules { list-style: none; margin: 0; padding: 8px 10px; display: grid; gap: 4px; }
.al-rule { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; padding: 10px 10px; border-radius: 12px; font-size: 15.5px; line-height: 1.5; }
.al-rule + .al-rule { border-top: 1px dashed #F3E4E7; }
.al-rule__k { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font-size: 16px; }
.al-rule small { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 1px; }
.al-rule--use .al-rule__k { background: #DCFCE7; } .al-rule--use small { color: #15803D; }
.al-rule--avoid .al-rule__k { background: #FEE2E2; } .al-rule--avoid small { color: #B91C1C; }
.al-rule--tip .al-rule__k { background: #E0F2FE; } .al-rule--tip small { color: #0369A1; }
.al-rule--trap .al-rule__k { background: #FEF3C7; } .al-rule--trap small { color: #B45309; }
.al-hook { margin: 0; padding: 14px 20px; background: #FFF1F3; border-top: 1px solid #FBD5DD; font-size: 16px; color: #4C0519; display: flex; gap: 10px; align-items: baseline; }
.al-hook i { font-style: normal; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--px-accent); white-space: nowrap; }
.al-hook b { font-weight: 700; }

/* the quiz */
.al-kind { display: inline-block; font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--px-accent); background: #FFF1F3; border-radius: 999px; padding: 2px 9px; margin-bottom: 6px; }
.al-qshow { margin: 4px 0 8px; overflow-x: auto; }
.px-opt .av-row { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.px-opt .av-row i { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 7px; border: 1.5px solid #E7D6DA; background: #fff; font: 800 13px var(--px-mono, ui-monospace, monospace); font-style: normal; }
.al-bug { border-radius: 12px; overflow: hidden; border: 1px solid #3B1F27; background: #1E1418; margin: 6px 0 8px; }
.al-bug pre { margin: 0; padding: 8px 0; overflow-x: auto; font: 13.5px/1.6 var(--px-mono, ui-monospace, monospace); color: #F3E8EA; }
.al-bug .al-line { width: 100%; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.al-bug button.al-line { cursor: pointer; }
.al-bug button.al-line:hover:not(:disabled) { background: rgba(251, 113, 133, .16); }
.al-bug .al-line.is-right { background: rgba(34, 197, 94, .25); }
.al-bug .al-line.is-wrong { background: rgba(239, 68, 68, .3); }
.al-order { display: grid; gap: 10px; margin: 6px 0 8px; }
.al-order__pool, .al-order__seq { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; padding: 8px; border-radius: 12px; border: 1px dashed #F5C2CD; background: #FFFBFC; }
.al-order__seq { counter-reset: step; border-style: solid; background: #fff; }
.al-order__pool button, .al-order__seq span { border: 1px solid #F5C2CD; background: #fff; border-radius: 10px; padding: 7px 11px; font: 600 13.5px inherit; text-align: left; }
.al-order__pool button { cursor: pointer; }
.al-order__pool button:hover { border-color: var(--px-accent); }
.al-order__seq span { background: #FFF1F3; counter-increment: step; }
.al-order__seq span::before { content: counter(step) '. '; color: var(--px-accent); font-weight: 800; }
.al-order__seq:empty::before { content: 'Tap the steps in order'; color: #94A3B8; font-size: 13px; padding: 4px; }
.al-order.is-ok .al-order__seq { border-color: var(--av-ok); }
.al-order.is-bad .al-order__seq { border-color: var(--av-bad); }
.al-order__right { font-size: 13.5px; margin: 0; }
.al-recap { margin-top: 14px; }

/* the rules sheet */
.al-sheet { display: grid; gap: 22px; }
.al-sheet__part h2 { margin: 0 0 10px; font-size: 19px; display: flex; gap: 8px; align-items: center; }
.al-sheet__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.al-sheet .al-poster__top { padding: 14px 16px 12px; gap: 10px; }
.al-sheet .al-poster__name h3 { font-size: 17px; }
.al-sheet .al-rule { font-size: 14.5px; padding: 8px; }
.al-sheet .al-hook { font-size: 14.5px; padding: 11px 16px; }
.al-locked { display: grid; gap: 6px; align-content: center; min-height: 130px; padding: 16px 18px; border-radius: 20px; border: 1.5px dashed #F5C2CD; background: #FFFBFC; color: #64748B; font-size: 14px; }
.al-locked b { color: var(--av-ink); font-size: 15.5px; }
.al-locked a { color: var(--px-accent); font-weight: 700; }

@media (max-width: 640px) {
  .al-story h2 { font-size: 18px; }
  .al-rule { font-size: 14.5px; }
  .av-tiles { justify-content: flex-start; }
}
.av-ylab { font-weight: 700; fill: #475569; }
.av-t.is-ghost.is-hit .av-t__v { border-color: var(--av-ok); background: #F0FDF4; color: var(--av-ok); }
.av-table--sheet td:nth-child(3) { color: var(--px-accent); font-weight: 800; }
.av-table--sheet td:last-child { font-family: inherit; text-align: left; }
.av-table--sheet tbody th { font-family: var(--px-mono, ui-monospace, monospace); }
.al-sheet .al-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.al-sheet .al-badge b { font-size: 15px; }

/* bars (Part 3 sorts) */
.av-bars { display: grid; gap: 4px; padding: 4px 4px 0; }
.av-bars__lane { position: relative; height: clamp(170px, 28vw, 230px); border-bottom: 2px solid #CBD5E1; }
.av-bar { position: absolute; bottom: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  padding: 0 clamp(1px, .5vw, 4px); box-sizing: border-box; transition: left .32s ease, transform .25s ease, opacity .2s; }
.av-bar__b { width: 100%; border-radius: 6px 6px 0 0; background: #FDA4AF; transition: height .3s ease, background .2s; order: 2; }
.av-bar__v { order: 1; font: 800 clamp(10px, 1.6vw, 13px) var(--px-mono, ui-monospace, monospace); color: #475569; margin-bottom: 3px; }
.av-bar__tag { order: 3; position: absolute; bottom: 4px; font: 700 clamp(9px, 1.5vw, 11.5px) inherit; font-style: normal; color: #fff; }
.av-bar.has-hue .av-bar__b { background: hsl(var(--hue) 65% 55%); }
.av-bar.is-sorted .av-bar__b { background: #BBF7D0; }
.av-bar.is-done .av-bar__b { background: #22C55E; }
.av-bar.is-done.has-hue .av-bar__b { background: hsl(var(--hue) 65% 45%); }
.av-bar.is-cmp .av-bar__b { background: var(--av-cmp); }
.av-bar.is-swap .av-bar__b { background: var(--px-accent); }
.av-bar.is-best .av-bar__b { background: var(--av-cur); }
.av-bar.is-key .av-bar__b, .av-bar.is-hand .av-bar__b { background: #7C3AED; }
.av-bar.is-hit .av-bar__b { background: var(--av-ok); }
.av-bar.has-hue.is-cmp .av-bar__b, .av-bar.has-hue.is-key .av-bar__b { outline: 3px solid var(--av-cmp); outline-offset: -3px; }
.av-bar.has-hue.is-swap .av-bar__b { outline: 3px solid var(--px-accent); outline-offset: -3px; }
.av-bar.is-cmp .av-bar__v, .av-bar.is-swap .av-bar__v, .av-bar.is-key .av-bar__v, .av-bar.is-hand .av-bar__v { color: var(--av-ink); }
.av-bar.is-lift, .av-bar.is-hand { transform: translateY(-14px); }
.av-bar.is-gone { opacity: 0; pointer-events: none; }
.av-bars__handbox { position: absolute; left: 0; bottom: -2px; top: 0; border: 2px dashed #DDD6FE; border-radius: 10px; background: #FAF5FF; transition: border-color .2s; }
.av-bars__handbox small { position: absolute; top: 4px; left: 0; right: 0; text-align: center; font: 700 10px inherit; color: #7C3AED; text-transform: uppercase; letter-spacing: .06em; }
.av-bars__handbox.is-full { border-color: #7C3AED; }
.av-bars__foot { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); box-sizing: border-box; }
.av-bars__foot span { text-align: center; font: 600 10.5px var(--px-mono, ui-monospace, monospace); color: #94A3B8; white-space: nowrap; overflow: visible; }
.av-bars__foot span.is-ptr { color: var(--av-cur); font-weight: 800; }
.av-count--ok { background: #DCFCE7; color: #14532D; }
.av-count--bad { background: #FEE2E2; color: #991B1B; }

/* Part 4: merge halves, partitions, windows */
.av-bar.is-L .av-bar__b { background: #93C5FD; }
.av-bar.is-R .av-bar__b { background: #C4B5FD; }
.av-bar.is-taken { opacity: .3; }
.av-bar.is-out { opacity: .22; }
.av-legend { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: #475569; }
.av-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.av-legend i.is-L { background: #93C5FD; } .av-legend i.is-R { background: #C4B5FD; }
.av-legend i.is-key { background: #7C3AED; } .av-legend i.is-done { background: #22C55E; }
.av-stack { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; }
.av-stack__h { font-weight: 800; color: #64748B; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; margin-right: 4px; }
.av-stack__none { color: #94A3B8; }
.av-stack i { color: #94A3B8; font-style: normal; }
.av-stack .av-chip { padding: 2px 8px; font-size: 11.5px; }
.av-stack .av-chip.is-top { background: #FFF1F3; border-color: var(--px-accent); color: #9F1239; }
.av-row { display: grid; gap: 0; }
.av-row__h { margin: 0; font-size: 11px; font-weight: 800; color: #64748B; text-transform: uppercase; letter-spacing: .06em; }
.av-row.is-empty .av-tiles { min-height: 60px; }
.av-row .av-tiles--small { padding-top: 18px; }

/* heap tree */
.av-heap { max-width: 560px; margin-inline: auto; border: 0; }
.av-heap__edge { stroke: #CBD5E1; stroke-width: 2; }
.av-heap__edge.is-off { stroke-dasharray: 3 4; opacity: .4; }
.av-heap__node { transition: transform .35s ease, opacity .2s; }
.av-heap__node circle { fill: #fff; stroke: #FDA4AF; stroke-width: 2.5; }
.av-heap__node text { font: 800 13px var(--px-mono, ui-monospace, monospace); fill: var(--av-ink); }
.av-heap__node.is-key circle { fill: #EDE9FE; stroke: #7C3AED; }
.av-heap__node.is-cmp circle { fill: #FEF3C7; stroke: var(--av-cmp); }
.av-heap__node.is-swap circle { fill: #FFE4E9; stroke: var(--px-accent); }
.av-heap__node.is-hit circle { fill: #DCFCE7; stroke: var(--av-ok); }
.av-heap__node.is-out { opacity: .35; }
.av-heap__node.is-out circle { fill: #DCFCE7; stroke: #22C55E; }
.av-heap__node.is-gone { opacity: 0; }

/* buckets */
.av-buckets { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.av-bucket { display: flex; flex-direction: column; justify-content: flex-end; min-height: 120px; border: 1px solid #E2E8F0; border-top: 0; border-radius: 0 0 8px 8px; background: #F8FAFC; transition: background .2s; }
.av-bucket.is-on { background: #FFF1F3; border-color: #FDA4AF; }
.av-bucket__chips { display: flex; flex-direction: column-reverse; gap: 2px; padding: 3px; }
.av-bucket__chips i { font: 800 11.5px var(--px-mono, ui-monospace, monospace); font-style: normal; text-align: center; background: #fff; border: 1px solid #FDA4AF; border-radius: 5px; padding: 1px 0; }
.av-bucket small { font: 600 9.5px var(--px-mono, ui-monospace, monospace); color: #64748B; text-align: center; border-top: 1px solid #E2E8F0; padding: 2px 0; }

/* race */
.av-race__rows { display: grid; gap: 7px; }
.av-race__row { display: grid; grid-template-columns: minmax(110px, 11em) minmax(0, 1fr) 5.5em auto; gap: 8px; align-items: center; font-size: 13.5px; }
.av-race__row b { font: 800 13px var(--px-mono, ui-monospace, monospace); text-align: right; }
.av-race__row small { color: #64748B; font-size: 11.5px; }
.av-race__track { position: relative; height: 16px; border-radius: 999px; background: #F1F5F9; overflow: visible; }
.av-race__track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: #FDA4AF; }
.av-race__row.is-done .av-race__track i { background: var(--px-accent); }
.av-race__track em { position: absolute; top: -3px; bottom: -3px; border-left: 2px dashed #1F1A1C; }
.av-race__lb { margin: 4px 0 0; font-size: 12.5px; color: #475569; }
@media (max-width: 640px) { .av-race__row { grid-template-columns: 1fr 4.5em; } .av-race__track { grid-column: 1 / -1; grid-row: 2; } .av-race__row small { display: none; } }

/* trees */
.av-tree { max-width: 640px; margin-inline: auto; border: 0; }
.av-tree__edge { stroke: #CBD5E1; stroke-width: 2.2; transition: stroke .2s; }
.av-tree__edge.is-seen, .av-tree__edge.is-hit, .av-tree__edge.is-cur, .av-tree__edge.is-cmp { stroke: #FDA4AF; }
.av-tree__node { transition: transform .4s ease, opacity .25s; }
.av-tree__node circle { fill: #fff; stroke: #CBD5E1; stroke-width: 2.5; transition: fill .2s, stroke .2s; }
.av-tree__node text { font: 800 13px var(--px-mono, ui-monospace, monospace); fill: var(--av-ink); }
.av-tree__node .av-tree__tag { font: 700 10.5px var(--px-mono, ui-monospace, monospace); fill: #7C3AED; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.av-tree__node.is-cur circle { fill: #DBEAFE; stroke: var(--av-cur); }
.av-tree__node.is-cmp circle { fill: #FEF3C7; stroke: var(--av-cmp); }
.av-tree__node.is-hit circle { fill: #DCFCE7; stroke: var(--av-ok); }
.av-tree__node.is-seen circle { fill: #FFF1F3; stroke: #FDA4AF; }
.av-tree__node.is-key circle { fill: #EDE9FE; stroke: #7C3AED; }
.av-tree__node.is-bad circle { fill: #FEE2E2; stroke: var(--av-bad); }
.av-tree__node.is-gone { opacity: 0; }
.av-tree__node.is-pickable { cursor: pointer; }
.av-twotrees { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.av-twotrees > div { border: 1px dashed #F5C2CD; border-radius: 12px; }
.av-treeinfo:empty { display: none; }
.av-treeinfo { text-align: left; padding: 10px 14px; border-radius: 12px; background: #FFF7F8; border: 1px solid #FBD5DD; }
.av-tree--mini { margin: 4px 0; display: block; }
@media (max-width: 640px) { .av-twotrees { grid-template-columns: 1fr; } }

/* graphs */
.av-graph { max-width: 640px; margin-inline: auto; border: 0; }
.av-graph__edge { stroke: #CBD5E1; stroke-width: 2.4; transition: stroke .2s; }
.av-graph__edge.is-hit { stroke: #FB7185; stroke-width: 3; }
.av-graph__edge.is-seen { stroke: #FDA4AF; }
.av-graph__edge.is-skip { stroke: #E2E8F0; stroke-dasharray: 4 4; }
.av-graph__edge.is-path { stroke: var(--av-ok); stroke-width: 4; }
.av-graph__head { fill: #CBD5E1; } .av-graph__head.is-hit { fill: #FB7185; } .av-graph__head.is-path { fill: var(--av-ok); } .av-graph__head.is-skip { fill: #E2E8F0; }
.av-graph__node circle { fill: #fff; stroke: #CBD5E1; stroke-width: 2.5; transition: fill .2s, stroke .2s; }
.av-graph__node text { font: 800 13px var(--px-mono, ui-monospace, monospace); fill: var(--av-ink); }
.av-graph__node text.is-long { font-size: 9.5px; }
.av-graph__node .av-graph__tag { font: 700 10.5px var(--px-mono, ui-monospace, monospace); fill: #7C3AED; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.av-graph__node.is-cur circle { fill: #DBEAFE; stroke: var(--av-cur); }
.av-graph__node.is-cmp circle { fill: #FEF3C7; stroke: var(--av-cmp); }
.av-graph__node.is-hit circle { fill: #DCFCE7; stroke: var(--av-ok); }
.av-graph__node.is-seen circle { fill: #FFF1F3; stroke: #FDA4AF; }
.av-graph__node.is-done circle { fill: #E2E8F0; stroke: #64748B; }
.av-graph__node.is-key circle { fill: #EDE9FE; stroke: #7C3AED; }
.av-graph__node.is-key2 circle { fill: #FFE4E6; stroke: var(--px-accent); }
.av-graph__node.is-bad circle { fill: #FEE2E2; stroke: var(--av-bad); }
.av-graph__node.is-c0 circle { fill: #DBEAFE; stroke: #2563EB; } .av-graph__node.is-c1 circle { fill: #DCFCE7; stroke: #16A34A; }
.av-graph__node.is-c2 circle { fill: #FEF3C7; stroke: #D97706; } .av-graph__node.is-c3 circle { fill: #F3E8FF; stroke: #9333EA; }
/* grid maze */
.av-maze { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 40px)); gap: 3px; justify-content: center; }
.av-cell { aspect-ratio: 1; border-radius: 6px; background: #F8FAFC; border: 1px solid #E2E8F0; display: grid; place-items: center; font: 800 12px var(--px-mono, ui-monospace, monospace); color: #64748B; cursor: pointer; transition: background .15s; }
.av-cell.is-wall { background: #334155; border-color: #1E293B; }
.av-cell.is-seen { background: #FFE4E9; border-color: #FDA4AF; color: #9F1239; }
.av-cell.is-front { background: #FEF3C7; border-color: var(--av-cmp); }
.av-cell.is-cur { background: #DBEAFE; border-color: var(--av-cur); }
.av-cell.is-path { background: #BBF7D0; border-color: var(--av-ok); color: #14532D; }
.av-cell.is-start, .av-cell.is-goal { background: var(--px-accent); color: #fff; border-color: #9F1239; }
.av-cell.is-goal { background: #15803D; border-color: #14532D; }
/* matrix vs lists */
.av-store { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; justify-content: center; }
@media (max-width: 560px) { .av-store { grid-template-columns: 1fr; } }
.av-mtable { border-collapse: collapse; font: 700 13px var(--px-mono, ui-monospace, monospace); }
.av-mtable th { color: #94A3B8; padding: 2px 6px; font-weight: 700; }
.av-mtable td { width: 30px; height: 30px; text-align: center; border: 1px solid #F1F5F9; color: #CBD5E1; }
.av-mtable td.is-one { color: #9F1239; background: #FFF1F3; }
.av-mtable td.is-new { background: #FB7185; color: #fff; }
.av-lists { display: grid; gap: 4px; }
.av-list { display: flex; gap: 4px; align-items: center; font: 700 13px var(--px-mono, ui-monospace, monospace); padding: 3px 6px; border-radius: 8px; }
.av-list.is-new { background: #FFF1F3; }
.av-list b { width: 24px; color: #64748B; }
.av-list i { font-style: normal; padding: 2px 8px; border-radius: 6px; background: #fff; border: 1px solid #FDA4AF; }
.av-list em { color: #94A3B8; font-style: normal; font-size: 12px; }
.av-graph--mini { max-width: 420px; margin: 4px 0; display: block; }

/* Part 7 · shortest paths and spanning trees */
.av-graph__w { font: 800 17px var(--px-mono, ui-monospace, monospace); fill: #475569; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.av-graph--mini .av-graph__w { font-size: 13px; }
.av-mtable th.is-k { color: var(--px-accent); }
.av-mtable td.is-k { background: #EDE9FE; color: #5B21B6; }
.av-mtable td { min-width: 30px; width: auto; padding: 0 4px; }
.av-matrix { overflow-x: auto; max-width: 100%; }
.av-rounds { overflow-x: auto; margin-top: 8px; }
.av-rounds .av-table { width: auto; min-width: 70%; margin-inline: auto; }
.av-table tr.is-on td { background: #FFF1F3; color: #9F1239; font-weight: 800; }
.av-puzwrap { display: flex; gap: 18px; align-items: flex-end; justify-content: center; flex-wrap: wrap; }
.av-puzzle { display: grid; grid-template-columns: repeat(3, 56px); gap: 5px; justify-content: center; }
.av-puzzle span { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; background: #fff; border: 2px solid #CBD5E1;
  font: 800 22px var(--px-mono, ui-monospace, monospace); color: var(--av-ink); transition: background .2s, border-color .2s; }
.av-puzzle span.is-home { background: #DCFCE7; border-color: #86EFAC; }
.av-puzzle span.is-blank { background: #F1F5F9; border-style: dashed; }
.av-puzzle span.is-moved { background: #DBEAFE; border-color: var(--av-cur); }
.av-puzzle--small { grid-template-columns: repeat(3, 30px); gap: 3px; }
.av-puzzle--small span { font-size: 13px; border-radius: 6px; border-width: 1.5px; }
.av-puzgoal { text-align: center; }

/* Parts 8–9 · greedy algorithms and dynamic programming */
.av-t.is-bad .av-t__v { background: #FEE2E2; border-color: var(--av-bad); color: #991B1B; }
.av-tl { display: grid; gap: 4px; margin: 4px 0 8px; }
.av-tl__row { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 6px; }
.av-tl__row > b { font: 800 12.5px var(--px-mono, ui-monospace, monospace); color: var(--av-ink); text-align: right; }
.av-tl__track { position: relative; height: 24px; background: #F8FAFC; border-radius: 6px; }
.av-tl__bar { position: absolute; top: 2px; bottom: 2px; border-radius: 5px; background: #E2E8F0; border: 1.5px solid #CBD5E1; font: 700 10.5px var(--px-mono, ui-monospace, monospace);
  color: #475569; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; transition: background .2s, border-color .2s; box-sizing: border-box; }
.av-tl__bar.is-cur { background: #DBEAFE; border-color: var(--av-cur); color: #1E3A8A; }
.av-tl__bar.is-keep { background: #DCFCE7; border-color: var(--av-ok); color: #14532D; }
.av-tl__bar.is-skip { background: #F8FAFC; border-style: dashed; color: #94A3B8; }
.av-tl__bar.is-bad { background: #FEE2E2; border-color: var(--av-bad); color: #991B1B; }
.av-tl__mark { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1.5px; background: #7C3AED; border-radius: 2px; }
.av-tl__axis .av-tl__track { background: none; height: 16px; border-top: 1px solid #CBD5E1; border-radius: 0; }
.av-tl__axis span { position: absolute; top: 1px; transform: translateX(-50%); font: 600 10px var(--px-mono, ui-monospace, monospace); color: #94A3B8; }
.av-dp { overflow-x: auto; max-width: 100%; margin: 6px 0; }
.av-dptable { border-collapse: collapse; font: 700 12.5px var(--px-mono, ui-monospace, monospace); margin-inline: auto; }
.av-dptable th { color: #64748B; padding: 2px 5px; font-weight: 800; white-space: nowrap; }
.av-dptable tr:first-child th { color: #94A3B8; font-size: 11px; }
.av-dptable td { min-width: 26px; height: 26px; padding: 0 4px; text-align: center; border: 1px solid #E2E8F0; background: #fff; color: #334155; transition: background .15s; }
.av-dptable td.is-empty { background: #F8FAFC; }
.av-dptable td.is-cur { background: #DBEAFE; box-shadow: inset 0 0 0 2px var(--av-cur); color: #1E3A8A; }
.av-dptable td.is-src { background: #FEF3C7; box-shadow: inset 0 0 0 2px var(--av-cmp); }
.av-dptable td.is-look { background: #F1F5F9; color: #94A3B8; }
.av-dptable td.is-best { background: #FFE4E9; box-shadow: inset 0 0 0 2px var(--av-best); color: #9F1239; }
.av-dptable td.is-path { background: #DCFCE7; color: #14532D; box-shadow: inset 0 0 0 2px var(--av-ok); }
.av-forest { max-width: 640px; margin-inline: auto; display: block; }
.av-forest .av-tree__node text.is-long { font-size: 10px; }
.av-series .av-svg { max-width: 640px; display: block; margin-inline: auto; }
.av-series__a, .av-series__b { fill: none; stroke-width: 2.5; }
.av-series__a { stroke: var(--px-accent); } .av-series__b { stroke: #2563EB; }
.av-series__dot.is-a { fill: var(--px-accent); } .av-series__dot.is-b { fill: #2563EB; }
.av-series__pair { stroke: #94A3B8; stroke-width: 1.2; stroke-dasharray: 3 3; }
.av-brackets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.av-brackets .av-row__h { flex-basis: 100%; margin: 0; }
.av-brackets code { padding: 3px 8px; border-radius: 6px; background: #F3E8FF; color: #5B21B6; font-weight: 800; }
.av-tree__node.is-done circle { fill: #E2E8F0; stroke: #64748B; }

/* Parts 10–11 · strings, hashing, numbers and geometry */
.av-hbk { display: grid; grid-template-columns: repeat(auto-fit, minmax(38px, 1fr)); gap: 3px; align-items: end; margin: 6px 0; }
.av-hbk__col { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; }
.av-hbk__chips { display: flex; flex-direction: column-reverse; gap: 3px; min-height: 120px; justify-content: flex-start; padding: 3px 2px; border-radius: 8px;
  background: #F8FAFC; border: 1.5px solid #E2E8F0; }
.av-hbk__col.is-clash .av-hbk__chips { border-color: #FDA4AF; background: #FFF1F3; }
.av-hbk__col.is-cur .av-hbk__chips { border-color: var(--av-cur); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.av-hbk__chips span { font: 700 10px var(--px-mono, ui-monospace, monospace); letter-spacing: -.3px; background: #fff; border: 1px solid #CBD5E1; border-radius: 5px; padding: 2px 0;
  text-align: center; overflow: hidden; white-space: nowrap; }
.av-hbk__chips span.is-new { background: #DBEAFE; border-color: var(--av-cur); }
.av-hbk__col > b { text-align: center; font: 800 12px var(--px-mono, ui-monospace, monospace); color: #64748B; }
.av-tri { display: grid; gap: 4px; justify-items: center; margin: 6px 0; overflow-x: auto; }
.av-tri__row { display: flex; gap: 4px; }
.av-tri span { min-width: 30px; height: 28px; padding: 0 3px; display: grid; place-items: center; border-radius: 7px; background: #fff; border: 1.5px solid #E2E8F0;
  font: 800 12px var(--px-mono, ui-monospace, monospace); color: #334155; box-sizing: border-box; }
.av-tri.is-small span { min-width: 18px; height: 18px; font-size: 8.5px; border-radius: 4px; padding: 0 1px; }
.av-tri.is-small .av-tri__row { gap: 2px; } .av-tri.is-small { gap: 2px; }
.av-tri span.is-cur { background: #DBEAFE; border-color: var(--av-cur); color: #1E3A8A; }
.av-tri span.is-src { background: #FEF3C7; border-color: var(--av-cmp); }
.av-tri span.is-odd { background: var(--px-accent); border-color: #9F1239; color: #fff; }
.av-curve .av-svg { max-width: 640px; display: block; margin-inline: auto; }
.av-curve__axis { stroke: #94A3B8; stroke-width: 1.5; }
.av-curve__f { fill: none; stroke: #2563EB; stroke-width: 3; }
.av-curve__span { fill: #FEF3C7; opacity: .7; }
.av-curve__mid { stroke: var(--av-cmp); stroke-width: 2; stroke-dasharray: 4 3; }
.av-curve__tan { stroke: var(--px-accent); stroke-width: 2.5; }
.av-curve__pt { fill: #fff; stroke: var(--px-accent); stroke-width: 2.5; }
.av-curve__x { fill: var(--av-ok); }
.av-px { position: relative; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; width: 100%; max-width: 520px; margin: 6px auto; box-sizing: border-box; }
.av-px span { aspect-ratio: 1; background: #F1F5F9; border-radius: 3px; cursor: pointer; transition: background .15s; }
.av-px span.is-on { background: #1F2937; }
.av-px span.is-cur { background: var(--px-accent); }
.av-px span.is-end { box-shadow: inset 0 0 0 2px var(--av-ok); }
.av-px__ideal { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.av-px__ideal line { stroke: #22C55E; stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
.av-bchart__bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; padding: 0 4px; border-bottom: 1.5px solid #CBD5E1; }
.av-bchart__bars > div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.av-bchart__bars span { width: 100%; background: var(--px-accent); border-radius: 4px 4px 0 0; transition: height .25s; min-height: 1px; }
.av-bchart__bars b { position: absolute; bottom: -17px; font: 700 10px var(--px-mono, ui-monospace, monospace); color: #94A3B8; }
.av-bchart { margin: 6px 0 22px; }
.av-mats { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.av-curve__tk { stroke: #94A3B8; stroke-width: 1.5; }
.av-curve__lab { font: 700 19px var(--px-mono, ui-monospace, monospace); fill: #64748B; }
/* steady.js measuring pass: every frame drawn once with motion off (see AV.player) */
.av-measuring, .av-measuring * { transition: none !important; animation: none !important; }
