/* Java Collections diagrams: arraylist, java-hashmap, treemap, priority-queue, array-deque,
   fail-fast, collections-chooser (js/viz/*.js + js/viz/vc-kit.js). Every class is prefixed vc-. */

/* ---------- shared ---------- */
.vc-wrap { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.vc-bar { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; justify-content: center; }
.vc-stat { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); font-size: .78rem; color: var(--muted); white-space: nowrap; transition: border-color .3s, background-color .3s; }
.vc-stat b { font: 700 .82rem var(--font-mono); color: var(--ink); }
.vc-stat.hl { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 12%, var(--surface)); }
.vc-stat.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.vc-stat.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.vc-stat.sig { border-color: var(--signal); background: color-mix(in srgb, var(--signal) 22%, var(--surface)); }
.vc-call { font: 600 .86rem/1.5 var(--font-mono); padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--java); overflow-x: auto; white-space: pre; min-width: 0; }
.vc-cm { color: var(--muted); font-weight: 400; }
.vc-ret { color: var(--ok); }
.vc-label { font: 700 .74rem var(--font-mono); color: var(--muted); text-align: center; margin-bottom: 8px; }
.vc-h { font: 700 .74rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.vc-panel { padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); min-width: 0; }
.vc-note { font-size: .86rem; line-height: 1.5; color: var(--muted); margin: 0; }
.vc-note b { color: var(--ink); }
.vc-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: .78rem; color: var(--muted); }
.vc-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 5px; vertical-align: -2px; border: 2px solid var(--ink); background: var(--surface); }
.vc-legend i.red { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, var(--surface)); }
.vc-legend i.ring { border-color: var(--rule); box-shadow: 0 0 0 2px var(--focus); }
.vc-legend i.res { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 22%, var(--surface)); }
@keyframes vc-fade { from { opacity: 0; } }
.vc-fade { animation: vc-fade .35s var(--ease-out) both; }
@keyframes vc-rise { from { opacity: 0; transform: translateY(6px); } }
.vc-rise { animation: vc-rise .35s var(--ease-out) both; }

/* code listing */
.vc-code { margin: 0; padding: 10px 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-sm); font: .8rem/1.6 var(--font-mono); color: var(--ink); overflow-x: auto; white-space: pre; min-width: 0; }
.vc-ln { display: block; padding: 0 12px; border-left: 3px solid transparent; transition: background-color .25s, border-color .25s; }
.vc-ln.on { background: color-mix(in srgb, var(--focus) 14%, transparent); border-left-color: var(--focus); }
.vc-ln.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); border-left-color: var(--bad); }
.vc-ln.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); border-left-color: var(--ok); }

/* array rows (arraylist, array-deque, priority-queue, fail-fast) */
.vc-rows { display: flex; flex-direction: column; gap: 18px; align-items: center; min-width: 0; }
.vc-row { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: 100%; }
.vc-row.vc-old { opacity: .85; }
.vc-grid { display: grid; justify-content: center; }
.vc-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.vc-box.cell { width: var(--vc-s, 46px); height: var(--vc-s, 46px); min-width: 0; padding: 0; font-size: clamp(.78rem, calc(var(--vc-s, 46px) * .33), .98rem); }
.vc-box.vc-empty { width: var(--vc-s, 46px); height: var(--vc-s, 46px); border: 2px dashed var(--rule); border-radius: 10px; display: grid; place-items: center; font: 700 .9rem var(--font-mono); color: var(--focus); transition: border-color .25s, background-color .25s; }
.vc-box.vc-empty.hl { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 8%, transparent); }
.vc-box.vc-empty.bad { border-color: var(--bad); }
.vc-ghost { opacity: .3; border-style: dashed !important; }
.vc-idx { font: .72rem/1 var(--font-mono); color: var(--muted); min-height: 12px; transition: color .2s; }
.vc-idx.on { color: var(--focus); font-weight: 700; }

/* ---------- java-hashmap ---------- */
.vc-hash { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); min-height: 52px; min-width: 0; }
.vc-hrow { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(90px, .8fr) minmax(0, 1.4fr); gap: 4px 12px; align-items: baseline; padding: 3px 8px; border-radius: var(--r-sm); transition: background-color .3s; animation: vc-rise .3s var(--ease-out) both; }
.vc-hrow.on { background: color-mix(in srgb, var(--focus) 10%, transparent); }
.vc-hk { font: 600 .8rem var(--font-mono); color: var(--muted); }
.vc-hrow > b { font: 700 .88rem var(--font-mono); }
.vc-hrow > code { font-size: .8rem; color: var(--muted); }
.vc-bits { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 4px 16px; font: 700 .85rem var(--font-mono); }
.vc-bits i { font-style: normal; font-weight: 400; color: var(--muted); }
.vc-bits mark { background: color-mix(in srgb, var(--signal) 40%, transparent); color: var(--ink); border-radius: 3px; padding: 0 1px; }
.vc-buckets { display: grid; gap: 8px 6px; align-items: start; }
.vc-bucket { display: flex; flex-direction: column; align-items: stretch; gap: 0; min-width: 0; padding: 0 0 6px; border-radius: 10px; border: 1px solid var(--rule); background: var(--surface); transition: border-color .3s, background-color .3s, box-shadow .3s; }
.vc-bucket.on { border-color: var(--focus); box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 35%, transparent); }
.vc-bucket.sig { border-color: var(--signal); box-shadow: 0 0 0 2px color-mix(in srgb, var(--signal) 40%, transparent); }
.vc-bucket.tree { border-color: var(--ok); }
.vc-bhead { display: flex; justify-content: center; align-items: baseline; gap: 4px; font: 700 .74rem var(--font-mono); color: var(--muted); padding: 3px 0; border-bottom: 1px solid var(--rule); margin-bottom: 6px; }
.vc-bucket.on .vc-bhead { color: var(--focus); }
.vc-bhead small { font-size: .62rem; color: var(--ok); text-transform: uppercase; }
.vc-node-h { position: relative; margin: 0 5px; padding: 3px 4px; border-radius: 7px; border: 2px solid var(--rule); background: var(--surface-2); text-align: center; line-height: 1.15; transition: border-color .25s, background-color .25s; }
.vc-node-h + .vc-node-h { margin-top: 12px; }
.vc-node-h + .vc-node-h::before { content: ''; position: absolute; left: 50%; top: -14px; height: 10px; border-left: 2px solid var(--muted); }
.vc-node-h + .vc-node-h::after { content: ''; position: absolute; left: calc(50% - 4px); top: -7px; border: 4px solid transparent; border-top: 5px solid var(--muted); border-bottom: 0; }
.vc-node-h b { display: block; font: 700 .76rem var(--font-mono); overflow-wrap: anywhere; }
.vc-node-h small { display: block; font: .68rem var(--font-mono); color: var(--muted); }
.vc-node-h.hl { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 14%, var(--surface)); }
.vc-node-h.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, var(--surface)); }
.vc-node-h.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.vc-node-h.sig { border-color: var(--signal); background: color-mix(in srgb, var(--signal) 26%, var(--surface)); }
.vc-null { text-align: center; font: .7rem var(--font-mono); color: var(--muted); opacity: .6; padding: 4px 0; }
.vc-tnote { padding: 8px 12px; border-left: 3px solid var(--ok); background: var(--surface); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
@media (max-width: 600px) {
  .vc-hrow { grid-template-columns: minmax(0, 1fr) auto; }
  .vc-hrow > code { grid-column: 1 / -1; }
  .vc-bits { grid-column: 1 / -1; }
}

/* ---------- trees (treemap, priority-queue) ---------- */
.vc-scroll { overflow-x: auto; max-width: 100%; padding: 6px; -webkit-overflow-scrolling: touch; }
.vc-tree { position: relative; margin: 0 auto; }
.vc-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.vc-edges line { stroke: var(--rule); stroke-width: 2; transition: stroke .25s; }
.vc-edges line.on { stroke: var(--focus); stroke-width: 3; }
.vc-late { animation-delay: .18s; }
.vc-tn { position: absolute; width: var(--vc-n, 40px); height: var(--vc-n, 40px); border-radius: 50%; display: grid; place-items: center; font: 700 .85rem var(--font-mono); color: var(--ink); background: var(--surface); border: 2.5px solid var(--ink); transition: box-shadow .25s, background-color .25s, border-color .25s, opacity .25s; z-index: 1; }
.vc-tn.red { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.vc-tn.path { box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 5px color-mix(in srgb, var(--focus) 45%, transparent); }
.vc-tn.hl { box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 6px var(--focus); z-index: 2; }
.vc-tn.cand { box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 6px var(--signal); }
.vc-tn.new, .vc-tn.sig { box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 6px var(--signal); background: color-mix(in srgb, var(--signal) 26%, var(--surface)); z-index: 2; }
.vc-tn.ok { box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 6px var(--ok); background: color-mix(in srgb, var(--ok) 26%, var(--surface)); }
.vc-tn.bad { box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 6px var(--bad); }
.vc-tn.root { border-color: var(--ok); }
.vc-tn.dim { opacity: .3; }
.vc-sorted { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.vc-k { font: 700 .78rem var(--font-mono); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface); transition: background-color .25s, border-color .25s, opacity .25s; }
.vc-k.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 22%, var(--surface)); }
.vc-k.sig { border-color: var(--signal); background: color-mix(in srgb, var(--signal) 26%, var(--surface)); }
.vc-k.dim { opacity: .35; }
@media (max-width: 600px) { .vc-tn { font-size: .75rem; border-width: 2px; } }

/* ---------- array-deque ---------- */
.vc-ptrs { display: flex; gap: 2px; min-height: 18px; }
.vc-ptr { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 3px; border-radius: 5px; font: 700 .7rem var(--font-mono); color: var(--surface); animation: vc-fade .3s var(--ease-out); }
.vc-ptr.h { background: var(--focus); }
.vc-ptr.t { background: var(--signal); color: var(--signal-ink); }
.vc-wrapnote { margin-top: 8px; padding: 2px 12px 4px; border: 2px dashed color-mix(in srgb, var(--focus) 55%, transparent); border-top: 0; border-radius: 0 0 14px 14px; font: 700 .74rem var(--font-mono); color: var(--focus); text-align: center; align-self: stretch; }
.vc-list { margin: 0; padding-left: 18px; font-size: .86rem; line-height: 1.5; color: var(--muted); display: grid; gap: 6px; }
.vc-list b { color: var(--ink); }

/* ---------- fail-fast ---------- */
.vc-cq { container-type: inline-size; }
.vc-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@container (min-width: 720px) { .vc-split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
.vc-codecol, .vc-state { min-width: 0; }
.vc-state { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.vc-cursor { position: relative; height: 34px; margin-top: 2px; }
.vc-caret { position: absolute; top: 0; width: 76px; margin-left: -38px; display: flex; flex-direction: column; align-items: center; font: 700 .8rem/1 var(--font-mono); color: var(--focus); }
.vc-caret small { margin-top: 3px; font-size: .7rem; white-space: nowrap; }
.vc-exc { margin: 0; align-self: stretch; padding: 10px 12px; border: 1px solid var(--bad); border-left-width: 4px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); color: var(--bad); font: 700 .76rem/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: break-word; animation: vc-rise .3s var(--ease-out) both; }
.vc-seg { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- collections-chooser ---------- */
.vc-trail { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }
.vc-crumb { font: 600 .8rem var(--font-body); color: var(--ink); padding: 5px 11px; border-radius: 999px; border: 1px solid var(--focus); background: color-mix(in srgb, var(--focus) 12%, var(--surface)); cursor: pointer; animation: vc-rise .3s var(--ease-out) both; }
.vc-crumb span { color: var(--muted); }
.vc-qcard { padding: 16px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); min-height: 168px; }
.vc-q { margin: 0 0 12px; font-size: 1.15rem; overflow-wrap: anywhere; }
.vc-q small { font: 600 .78rem var(--font-body); color: var(--muted); }
.vc-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.btn.vc-choice { min-height: 52px; white-space: normal; justify-content: flex-start; text-align: left; padding: 10px 14px; font-size: .92rem; line-height: 1.3; background: var(--surface-2); transition: border-color .2s, background-color .2s, transform .12s var(--ease-out); }
@media (hover: hover) { .btn.vc-choice:hover { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 8%, var(--surface-2)); } }
.vc-why { margin: 0 0 12px; font-size: .92rem; line-height: 1.5; }
.vc-ops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.vc-ops > div { padding: 6px 8px; border-radius: var(--r-sm); border: 1px solid var(--rule); background: var(--surface-2); text-align: center; min-width: 0; }
.vc-ops small { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.vc-ops b { font: 700 .82rem var(--font-mono); color: var(--ok); overflow-wrap: anywhere; }
.vc-ops b.slow { color: var(--bad); }
.vc-result .vc-call { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.vc-tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); -webkit-overflow-scrolling: touch; }
.vc-table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 500px; }
.vc-table th, .vc-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.vc-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }
.vc-table tbody th[scope=row] { font: 700 .8rem var(--font-mono); }
.vc-table .vc-o { font: .78rem var(--font-mono); }
.vc-table .vc-group th { padding-top: 10px; font: 700 .68rem var(--font-body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); background: transparent; }
.vc-table tbody tr { transition: opacity .35s var(--ease-out), background-color .35s; }
.vc-table tbody tr.out { opacity: .28; }
.vc-table tbody tr.pick { background: color-mix(in srgb, var(--signal) 20%, transparent); }
.vc-table tbody tr.pick th[scope=row] { box-shadow: inset 4px 0 0 var(--signal); }
@media (max-width: 600px) { .vc-ops { grid-template-columns: repeat(2, minmax(0, 1fr)); } .vc-qcard { padding: 12px; } }
.vc-hrow.sig { background: color-mix(in srgb, var(--signal) 18%, transparent); }
