/* Direção visual: o "teste de mesa" no caderno quadriculado.
 * Papel branco frio, tinta azul de caneta, correção em vermelho e
 * marca-texto amarelo na linha de código que está rodando.
 * No tema escuro o mesmo caderno vira lousa, com giz.
 * O único elemento chamativo é o marca-texto; o resto fica quieto. */
:root {
  /* lousa: o fundo fica sempre escuro */
  --paper: #18221f; --sheet: #1e2a26; --well: #15201c; --grid: #24332e; --grid-strong: #30423b;
  --ink: #ecebe2; --muted: #a3b0a9; --rule: #32433d;
  --pen: #9cc0ff; --pen-soft: #263a4c; --red: #ff8f85; --red-soft: #4a2e2c;
  --green: #8fdcab; --green-soft: #22402f; --marker: #f3dc4a; --marker-soft: rgba(243, 220, 74, .28);
  --node: #1e2a26; --code-bg: #131c19; --code-ink: #e4e6dd; --code-num: #61736c;
  --c0: #9aa6a0; --c1: #8fdcab; --c2: #9cc0ff; --c3: #c9a8f2; --c4: #f5b26b; --c5: #ff8f85;
  --sans: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --hand: "Kalam", "Comic Neue", cursive;
  color-scheme: dark;
}
* { box-sizing: border-box; min-width: 0; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--sans); overflow-x: clip; }
a { color: var(--pen); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--mono); font-size: .86em; background: var(--pen-soft); padding: .05em .3em; border-radius: 3px; overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.15; text-wrap: balance; }

/* cabeçalho */
.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.5rem;
  padding: .55rem max(4vw, 16px); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.02rem; }
.logo { width: 34px; height: 21px; fill: none; stroke: var(--pen); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.nav { display: flex; flex-wrap: wrap; gap: .1rem .2rem; }
.nav a { padding: .35rem .6rem; text-decoration: none; color: var(--muted); font-size: .95rem; border-radius: 6px; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--pen); font-weight: 700; background: var(--pen-soft); }

main { max-width: 1220px; margin: 0 auto; padding: 1.5rem max(4vw, 16px) 3.5rem; }
.foot { color: var(--muted); font-size: .92rem; padding: 2rem max(4vw, 16px) 2.5rem; border-top: 1px solid var(--rule); max-width: 1220px; margin: 0 auto; }

/* início */
.hero { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); gap: 2.5rem; align-items: center; padding: 1.5rem 0 2.5rem; }
.hero h1 { font-size: clamp(2.1rem, 4.2vw, 3.25rem); line-height: 1.05; margin: 0 0 1rem; letter-spacing: -.01em; }
.hero p { color: var(--muted); font-size: 1.08rem; max-width: 46ch; margin: 0 0 .8rem; }
.hero .hero-hint { font-family: var(--hand); color: var(--pen); font-size: 1.15rem; }
.hero-demo { background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: .9rem; box-shadow: 0 24px 60px -36px #000; }
.hero-demo.compact .ops, .hero-demo.compact .vars { display: none; }
.hero-demo.compact .stage, .hero-demo.compact .code { min-height: 0; }
.hero-demo.compact .stage svg { max-height: 330px; }
.hero-demo.compact .code pre { max-height: 132px; }

.index h2, .growth h2 { font-size: 1.45rem; margin: 0 0 .6rem; }
.toc { list-style: none; margin: 0 0 2rem; padding: 0; border-top: 2px solid var(--ink); }
.toc li { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) minmax(0, 1.3fr); gap: .2rem 2rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.toc-main { display: flex; align-items: baseline; gap: .9rem; text-decoration: none; color: var(--ink); }
.toc-main:hover .toc-title { color: var(--pen); text-decoration: underline; }
.toc-num { font-weight: 700; color: var(--pen); font-size: 1.5rem; width: 2.6rem; flex: none; }
.toc-title { font-weight: 700; font-size: 1.2rem; }
.toc-sum { margin: 0; color: var(--muted); font-size: .97rem; }
.toc-modes { margin: 0; display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .95rem; }

/* blocos */
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 1.2rem 1.4rem; margin: 1.2rem 0; }
.panel h2 { margin: 0 0 .7rem; font-size: 1.2rem; }
.panel > p { max-width: 70ch; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1.2rem; }
.grid2 .panel { margin: .4rem 0; }

/* unidade */
.unit-head { display: flex; align-items: flex-start; gap: 1.2rem; margin: .8rem 0 1.4rem; }
.unit-num { font-size: clamp(3rem, 7vw, 5rem); line-height: .85; font-weight: 700; color: var(--pen); letter-spacing: -.03em; flex: none; }
.unit-head h1 { margin: .1rem 0 .4rem; font-size: clamp(1.9rem, 3.6vw, 2.6rem); }
.lead { color: var(--muted); margin: 0; max-width: 66ch; font-size: 1.05rem; }
.theory { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 0 2rem; border-top: 2px solid var(--ink); padding-top: .4rem; }
.theory > div { padding: .6rem 0 .4rem; }
.theory h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.theory p, .theory ul { margin: .3rem 0; font-size: .98rem; }
.theory ul { padding-left: 1.1rem; }
.theory pre { font-family: var(--mono); font-size: .8rem; background: var(--pen-soft); padding: .6rem .75rem; border-radius: 6px; overflow-x: auto; margin: .5rem 0 0; }

.tabs { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; border-bottom: 1px solid var(--rule); margin: -.2rem 0 .9rem; }
.tab { padding: .5rem 0; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 700; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--pen); border-color: var(--pen); }
.mode:focus { outline: none; }

/* controles */
.ops { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.op { display: flex; }
.op input { width: 5.4rem; height: 44px; padding: 0 .6rem; border: 1.5px solid var(--rule); border-right: 0; border-radius: 8px 0 0 8px; background: var(--sheet); color: var(--ink); font: 16px var(--mono); }
.op input[type=text] { width: 10rem; }
.op input.err { border-color: var(--red); animation: shake .3s; }
.btn { height: 44px; padding: 0 1rem; border: 1.5px solid var(--rule); border-radius: 8px; background: var(--sheet); color: var(--ink); font: 700 .95rem var(--sans); cursor: pointer; }
.btn:hover { border-color: var(--pen); color: var(--pen); }
.btn.primary { background: var(--pen); border-color: var(--pen); color: var(--sheet); }
.btn.primary:hover { color: var(--sheet); filter: brightness(1.1); }
.btn.ghost { color: var(--muted); margin-left: auto; font-weight: 400; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* palco quadriculado + listagem com marca-texto */
.stage { border: 1px solid var(--rule); border-radius: 8px; min-height: 280px; display: flex; align-items: center;
  background-color: var(--sheet);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px; background-position: -1px -1px; }
.stage svg { width: 100%; height: auto; max-height: 440px; display: block; }
.code { background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; min-height: 280px; }
.code-head { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .9rem; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--rule); }
.code-title { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.code-head a { text-decoration: none; }
.code-head a:hover { text-decoration: underline; }
.code pre { margin: 0; padding: .6rem 0; font: .8rem/1.75 var(--mono); overflow: auto; flex: 1; max-height: 420px; counter-reset: ln; }
.ln { display: block; padding: 0 .9rem 0 0; white-space: pre; }
.ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 2.4em; margin-right: .8em; text-align: right; color: var(--code-num); }
.ln.on { background-image: linear-gradient(100deg, transparent .4%, var(--marker) 1.4%, var(--marker-soft) 6%, var(--marker-soft) 92%, var(--marker) 97%, transparent 99%);
  background-repeat: no-repeat; background-size: 100% 78%; background-position: 2.6em 55%; animation: marker .35s ease-out; font-weight: 600; }
@keyframes marker { from { background-size: 0% 78%; } to { background-size: 100% 78%; } }
.ln.muted { color: var(--muted); }
.ln.muted::before { content: ''; }

/* anotação do passo, como nota de margem a caneta */
.msg { margin: .9rem 0 .3rem; padding: .35rem 0 .35rem 1rem; border-left: 3px solid var(--pen); min-height: 2.4rem; font: 1.18rem/1.45 var(--hand); color: var(--pen); }
.msg.ok { border-color: var(--green); color: var(--green); }
.msg.bad { border-color: var(--red); color: var(--red); }
.side:empty { display: none; }
.side { font-size: .95rem; margin: .4rem 0; color: var(--muted); }
.side .kv { display: inline-flex; gap: .4rem; margin: 0 1.2rem .2rem 0; }
.side .kv b { font-family: var(--mono); color: var(--ink); }
.player { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .7rem; }
.player button { width: 44px; height: 40px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--sheet); color: var(--ink); cursor: pointer; font-size: .9rem; }
.player button:hover { border-color: var(--pen); color: var(--pen); }
.player button.play { width: 56px; background: var(--pen); border-color: var(--pen); color: var(--sheet); }
.count { color: var(--muted); font-size: .92rem; margin-left: .5rem; font-variant-numeric: tabular-nums; }
.speed { margin-left: auto; color: var(--muted); font-size: .92rem; display: flex; align-items: center; gap: .5rem; }
input[type=range] { accent-color: var(--pen); }

/* desenhos */
svg.viz text { font-family: var(--mono); text-anchor: middle; dominant-baseline: middle; fill: var(--ink); }
svg.viz .lbl { font-size: 15px; font-weight: 600; }
svg.viz .sub { font-size: 11px; fill: var(--muted); }
svg.viz .small { font-size: 12px; fill: var(--muted); }
svg.viz .title { font: 15px var(--hand); fill: var(--pen); text-anchor: start; }
svg.viz .box rect, svg.viz .circ circle { fill: var(--node); stroke: var(--pen); stroke-width: 1.8; transition: fill .25s, stroke .25s; }
svg.viz .box > line.edge { stroke: var(--pen); stroke-width: 1.4; }
svg.viz .empty rect { fill: transparent; stroke-dasharray: 4 3; stroke: var(--grid-strong); }
svg.viz .idx rect { fill: var(--pen-soft); stroke: var(--grid-strong); }
svg.viz .idx .lbl { font-size: 12px; fill: var(--muted); font-weight: 400; }
svg.viz .hl rect, svg.viz .hl circle { fill: var(--marker); stroke: var(--ink); }
svg.viz .hl .lbl { fill: #1b1f1d; }
svg.viz .ok rect, svg.viz .ok circle { fill: var(--green-soft); stroke: var(--green); stroke-width: 2.4; }
svg.viz .bad rect, svg.viz .bad circle { fill: var(--red-soft); stroke: var(--red); stroke-width: 2.4; }
svg.viz .bad .lbl { fill: var(--red); text-decoration: line-through; }
svg.viz .visit rect, svg.viz .visit circle { fill: var(--pen-soft); stroke: var(--pen); stroke-dasharray: 5 3; }
svg.viz .done rect, svg.viz .done circle { fill: var(--pen-soft); stroke: var(--pen); }
svg.viz .faded { opacity: .3; }
svg.viz .tomb rect { fill: transparent; stroke: var(--muted); stroke-dasharray: 3 3; }
svg.viz .tomb .lbl { fill: var(--muted); }
svg.viz .arrow, svg.viz .edge { stroke: var(--ink); stroke-width: 1.6; fill: none; transition: stroke .25s, stroke-width .25s, opacity .25s; }
svg.viz .arrow.hl, svg.viz .edge.hl { stroke: var(--red); stroke-width: 2.8; }
svg.viz .edge.tree { stroke: var(--pen); stroke-width: 3.2; }
svg.viz .edge.dim { opacity: .3; }
svg.viz .ahead { fill: var(--ink); }
svg.viz .ptr text, svg.viz .ptr2 text { font: 700 15px var(--hand); }
svg.viz .ptr text { fill: var(--red); }
svg.viz .ptr2 text { fill: var(--pen); }
svg.viz .wt { font: 700 13px var(--hand); fill: var(--red); paint-order: stroke; stroke: var(--sheet); stroke-width: 4px; }
svg.viz .enter { animation: pop .3s ease-out; }
svg.viz .exit { opacity: 0; transition: opacity .25s; }
@keyframes pop { from { opacity: 0; } to { opacity: 1; } }

/* tabelas */
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--rule); }
th { color: var(--muted); font-weight: 700; font-size: .88rem; }
.cx td:not(:first-child), .cx th:not(:first-child) { white-space: nowrap; }
.cx td:first-child { min-width: 8.5rem; }
.cx code { background: none; padding: 0; font-size: .85rem; }
.note { color: var(--muted); font-size: .93rem; margin: .8rem 0 0; }
.mini { font-family: var(--mono); font-size: .82rem; width: auto; margin-top: .3rem; }
.mini td, .mini th { padding: .15rem .55rem; text-align: center; }
.mini .on { background: var(--marker-soft); }

/* gráfico Big-O */
.bigo svg { width: 100%; max-width: 720px; height: auto; display: block; }
.bigo .axis { stroke: var(--rule); stroke-width: 1.4; }
.bigo .axis-l { font: 12px var(--sans); fill: var(--muted); }
.bigo .curve { fill: none; stroke-width: 2.6; }
.bigo .curve.off { opacity: .15; stroke-width: 1.6; }
.bigo .curve-l { font: 700 12px var(--mono); stroke: none; }
.bigo .curve-l.off { opacity: .25; }
.c0 { stroke: var(--c0); fill: var(--c0); } .c1 { stroke: var(--c1); fill: var(--c1); } .c2 { stroke: var(--c2); fill: var(--c2); }
.c3 { stroke: var(--c3); fill: var(--c3); } .c4 { stroke: var(--c4); fill: var(--c4); } .c5 { stroke: var(--c5); fill: var(--c5); }
.bigo path.curve { fill: none; }
.bigo-ctrl { margin: .5rem 0; font-size: .95rem; color: var(--muted); }
.bigo-ctrl input { vertical-align: middle; width: 200px; max-width: 60vw; }
.bigo-table table { font-size: .9rem; }
.bigo-table td:last-child, .bigo-table th:last-child { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.bigo-table tr.dim { opacity: .4; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .5rem; }
.dot.c0 { background: var(--c0); } .dot.c1 { background: var(--c1); } .dot.c2 { background: var(--c2); }
.dot.c3 { background: var(--c3); } .dot.c4 { background: var(--c4); } .dot.c5 { background: var(--c5); }
#home-bigo { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 0 2rem; align-items: start; }
#home-bigo .bigo-ctrl { grid-column: 1; }
#home-bigo .bigo-table { grid-column: 2; grid-row: 1 / span 2; }

.ex { padding-left: 1.2rem; } .ex li, .links li { margin: .35rem 0; }
.links { columns: 2 260px; padding-left: 1.2rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.8rem; }
.pager a { text-decoration: none; padding: .7rem 1rem; border: 1.5px solid var(--rule); border-radius: 8px; background: var(--sheet); font-weight: 700; }
.pager a:hover { border-color: var(--pen); }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 1.2rem; }
  .toc li { grid-template-columns: 1fr; }
  .toc-sum, .toc-modes { padding-left: 3.5rem; }
}
@media (max-width: 860px) {
  .stage-wrap, .grid2,   .code pre { max-height: 260px; }
  .speed { margin-left: 0; width: 100%; }
  #home-bigo { grid-template-columns: 1fr; }
  #home-bigo .bigo-table { grid-column: 1; grid-row: auto; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .unit-head { gap: .8rem; }
  .toc-sum, .toc-modes { padding-left: 0; }
  .hero-demo.compact .code { display: none; }
  .btn.ghost { margin-left: 0; }
  .pager { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* sem ligaduras no código: "->" tem que aparecer como o aluno digita */
code, .code pre, .ln, .theory pre, svg.viz text, .op input, .mini, .bigo text { font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; }

/* ===== bancada: desenho no centro, controles colados nele, código e variáveis ao lado ===== */
.bench { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: .2rem 1.2rem 1.2rem; margin: 0 0 2.5rem; }
.bench .tabs { margin: 0 0 .6rem; }
.mode-intro { margin: 0 0 1rem; color: var(--muted); max-width: 78ch; }
.ws { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 1rem; align-items: start; }
.ws-main { display: grid; grid-template-rows: auto auto auto auto; gap: 0; }
.ws-main .ops { margin: 0 0 .7rem; }
.ws-main .stage { border-radius: 10px 10px 0 0; border-bottom: 0; background-color: var(--well); }
.ws-main .msg { margin: 0; padding: .55rem 1rem; border: 1px solid var(--rule); border-top: 1px dashed var(--grid-strong); border-left: 3px solid var(--pen); background: var(--well); min-height: 3rem; }
.ws-main .msg.ok { border-left-color: var(--green); }
.ws-main .msg.bad { border-left-color: var(--red); }
.ws-main .player { margin: 0; padding: .55rem .7rem; border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 10px 10px; background: var(--well); }
.ws-side { display: grid; gap: .8rem; position: sticky; top: 4.2rem; }
.ws-side .code { min-height: 0; }
.ws-side .code pre { max-height: 330px; }
.vars { border: 1px solid var(--rule); border-radius: 8px; background: var(--code-bg); padding: .55rem .9rem .7rem; }
.vars h3, .code-title { font: 600 .82rem var(--mono); color: var(--muted); margin: 0 0 .3rem; }
.vars:has(.side:empty) { display: none; }
.vars .side { margin: 0; font-size: .9rem; }
.vars .kv { display: flex; justify-content: space-between; gap: 1rem; margin: 0; padding: .28rem 0; border-bottom: 1px dashed var(--grid-strong); }
.vars .kv:last-child { border-bottom: 0; }
.vars .kv b { text-align: right; overflow-wrap: anywhere; }
.vars .mini { margin-top: .5rem; }
.vars .scroll, .vars .mini { max-width: 100%; overflow-x: auto; display: block; }

/* abaixo da bancada: leitura à esquerda, referência rápida à direita */
.below { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 2.5rem; align-items: start; }
.read h2, .ref h2 { font-size: 1.2rem; margin: 0 0 .8rem; }
.read > h2 + .theory { margin-bottom: 2rem; }
.read .theory { display: grid; grid-template-columns: 1fr; gap: 0; border-top: 0; padding-top: 0; }
.read .theory > div { padding: .9rem 0 .9rem 1.1rem; border-left: 2px solid var(--grid-strong); margin-bottom: .6rem; }
.read .theory h3 { font-size: 1.08rem; }
.read .theory p, .read .theory ul { max-width: 68ch; }
.ex { padding-left: 1.4rem; max-width: 68ch; }
.ex li { margin: .5rem 0; padding-left: .3rem; }
.ex li::marker { color: var(--pen); font-weight: 700; }
.ref { display: grid; gap: 1rem; }
.ref section { background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.1rem; }
.ref .h-sub { display: block; font-size: .88rem; font-weight: 400; color: var(--muted); margin-top: .15rem; }
.ref .links { columns: 1; padding-left: 1.1rem; margin: 0; }
.ref .bigo-table { display: none; }
.pager a { display: flex; flex-direction: column; gap: .1rem; }
.pager a small { font-weight: 400; color: var(--muted); font-size: .82rem; }
.pager a.nx { text-align: right; }

@media (max-width: 1060px) {
  .ws, .below { grid-template-columns: 1fr; }
  .ws-side { position: static; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .ref { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (max-width: 700px) {
  .ws-side { grid-template-columns: 1fr; }
  .bench { padding: .2rem .8rem .9rem; border-radius: 10px; }
}
.hero-demo.compact .ws { grid-template-columns: 1fr; gap: .7rem; }
.hero-demo.compact .ws-side { position: static; }

/* campos com rótulo visível: o aluno sempre sabe o que é cada número */
.ops { align-items: flex-end; }
.op { align-items: flex-end; }
.fld { display: flex; flex-direction: column; }
.fld span { font-size: .78rem; color: var(--muted); padding: 0 0 .15rem .15rem; }
.op .fld + .fld input { border-radius: 0; }
.op .fld:first-child input { border-radius: 8px 0 0 8px; }
.op .fld + .btn { border-radius: 0 8px 8px 0; }
.ws-main .stage svg { max-height: 380px; }

/* ===== celular ===== */
.stage { overflow-x: auto; overscroll-behavior-x: contain; }
.scroll { overflow-x: auto; }
@media (max-width: 700px) {
  .top { position: static; flex-wrap: nowrap; flex-direction: column; align-items: stretch; gap: .3rem; padding: .6rem 16px .3rem; }
  .nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px .2rem; }
  .nav::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: .45rem .7rem; }
  .bench .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 1rem; }
  .tab { flex: none; padding: .7rem 0; }
  .unit-head { margin-top: .2rem; }
  .unit-num { font-size: 2.6rem; }
  .ops { gap: .6rem .5rem; }
  .op input { width: 4.6rem; }
  .op input[type=text] { width: 8.5rem; }
  .btn.ghost { order: 9; }
  .ws-main .player { gap: .3rem; }
  .player button { width: 42px; height: 42px; }
  .count { margin-left: .3rem; }
  .ws-side .code pre { max-height: 220px; }
  .stage, .code { min-height: 0; }
  .mode-intro { font-size: .95rem; }
  .cx { font-size: .85rem; }
  .cx td, .cx th { padding: .4rem .35rem; }
  .ref section, .bench { padding-left: .8rem; padding-right: .8rem; }
}

/* Trilha, lista de modos e referências */
.crumbs { font-size: .9rem; color: var(--muted); margin: 1rem 0 -.2rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--pen); }
.read h2 { margin-top: 2rem; }
.read h2:first-child { margin-top: 0; }
.modes-list { margin: 0; max-width: 68ch; }
.modes-list dt { font-weight: 700; margin-top: .7rem; }
.modes-list dd { margin: .15rem 0 0; color: var(--muted); }
.refs { list-style: none; padding: 0; margin: 0; max-width: 72ch; }
.refs li { padding: .6rem 0 .6rem 1rem; border-left: 2px solid var(--grid-strong); margin-bottom: .45rem; line-height: 1.5; }
.ref-who { font-size: .86rem; color: var(--muted); letter-spacing: .01em; }
.ref-note { display: block; color: var(--muted); font-size: .93rem; margin-top: .15rem; }
.refs-page { display: grid; gap: 2rem; margin-bottom: 1rem; }
.refs-group h2 { font-size: 1.25rem; margin: 0 0 .3rem; }
.refs-group .note { margin: 0 0 .9rem; }
svg.viz .zero rect { fill: transparent; stroke: var(--grid-strong); }
svg.viz .zero .lbl { fill: var(--muted); font-weight: 400; }
svg.viz .cyc circle { fill: var(--red-soft); stroke: var(--red); stroke-width: 2.4; }
