/* Scoped chapter additions; the reading theme and controls remain shared. */
.original-start { color: #245cb0; }
.original-removed { color: #b02e3d; }
.lecture-three .source-emphasis { color: #9a3f25; }
.lecture-three pre.python-code { padding: 12px 15px; overflow: auto; white-space: pre; font: 14px/1.55 Consolas, "Liberation Mono", monospace; }
.lecture-three .source-output { margin: 10px 0 18px; }
.lecture-three .source-output pre { background: #f4f6f8; max-height: 340px; overflow: auto; }
.lecture-three .source-output .small-label { font-family: var(--ui); }
.lecture-three .source-illustration { display: block; margin: 14px auto; max-width: 100%; height: auto; }
.lecture-three .katex-display { overflow-x: auto; overflow-y: hidden; }
.lecture-three .demo-body { font-family: var(--ui); }
.l3-form, .l3-operations { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; font: 13px/1.5 var(--ui); }
.l3-form label, .l3-operations label { display: flex; flex-direction: column; gap: 4px; }
.l3-wide { flex: 1; }
.l3-form input, .l3-operations input { min-height: 32px; width: 92px; padding: 6px 8px; border: 1px solid #bec5ce; color: var(--ink); background: white; font: 14px Consolas, monospace; }
.l3-wide input { width: 100%; min-width: 200px; }
.l3-form button, .l3-operations button { min-height: 32px; padding: 6px 10px; border: 1px solid #bec5ce; border-radius: 2px; color: var(--accent-dark); background: white; }
.l3-operations { margin-top: 10px; }
.l3-operations button { font-family: Consolas, monospace; }
.l3-operations :disabled { opacity: .45; cursor: default; }
.lecture-three .input-error { min-height: 20px; color: #9a362e; margin: 3px 0; font: 13px/1.5 var(--ui); }
.l3-heading { height: 64px; padding-top: 8px; }
.l3-heading h3 { font-size: 17px; margin: 0; }
.lecture-three .demo-explanation { height: 90px; margin-bottom: 12px; }
.l3-metrics { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 8px 0 12px; font: 13px/1.6 var(--ui); }
.l3-metrics > span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.l3-metrics strong { font: 14px Consolas, monospace; }
.l3-trace-layout { display: grid; grid-template-columns: minmax(0,1.08fr) minmax(0,1fr); gap: 20px; align-items: start; }
.l3-trace-layout > div { min-width: 0; }
.lecture-three .trace-code-wrap pre { max-height: 360px; font-size: 13px; overflow: auto; }
.l3-circle { height: 310px; overflow: auto; background: white; }
.l3-circle svg, .l3-chain svg, .l3-chart svg { display: block; }
.l3-circle .ring { fill: none; stroke: #d6dfeb; stroke-width: 1; stroke-dasharray: 4 4; }
.l3-circle .person circle { fill: #fff; stroke: #9dacc1; stroke-width: 1.5; }
.l3-circle .person text { fill: var(--ink); font: 14px var(--ui); }
.l3-circle .person .person-id { font: 12px Consolas, monospace; text-anchor: middle; }
.l3-circle .eliminated circle { fill: #f1f2f5; stroke: #b7bfc9; stroke-dasharray: 3 3; }
.l3-circle .eliminated text { fill: #858c98; }
.l3-circle .front circle, .l3-circle .winner circle { stroke: #2b60a5; stroke-width: 3; fill: #e4eefb; }
.l3-circle .counted circle { stroke: #b57427; stroke-width: 3; }
.l3-circle .removed-now circle { stroke: #b22e40; stroke-width: 3; }
.l3-legend { margin: 7px 0 12px !important; color: var(--muted); font: 12px/1.6 var(--ui); }
.l3-strip { display: flex; flex-wrap: wrap; gap: 5px; align-content: start; height: 96px; overflow: auto; padding: 5px 0; }
.l3-chip { flex: 0 0 auto; min-width: 30px; height: max-content; padding: 5px 7px; border: 1px solid #a6b9cf; background: white; font: 14px/1.5 Consolas, monospace; }
.l3-chip:first-child { border-left: 3px solid #2b60a5; }
.l3-chip small { display: block; color: var(--muted); font: 12px/1.5 var(--ui); }
.l3-result { min-height: 38px; margin: 5px 0 !important; font: 14px/1.6 var(--ui); overflow-wrap: anywhere; }
.l3-details { margin-top: 10px; font: 13px/1.7 var(--ui); overflow-wrap: anywhere; }
.l3-details p { margin: 5px 0; }
.l3-station { min-height: 64px; padding: 10px 12px; margin: 5px 0 12px; background: #edf2f9; border-left: 3px solid #6487b2; font: 14px/1.6 var(--ui); }
.l3-chart { height: 175px; overflow-x: auto; }
.l3-chart .axis { stroke: #a2afbe; stroke-width: 1; }
.l3-chart .series { fill: none; stroke: #336aab; stroke-width: 2; }
.l3-chart text { fill: var(--muted); font: 12px var(--ui); }
.l3-table-scroll { max-height: 210px; overflow: auto; margin: 14px 0; }
.l3-table { border-collapse: collapse; width: 100%; font: 13px/1.5 var(--ui); text-align: left; }
.l3-table th, .l3-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.l3-table th { background: #edf1f7; }
.l3-table caption { text-align: left; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.l3-chain { height: 265px; overflow: auto; border-bottom: 1px solid var(--line); background: white; }
.l3-chain text { fill: var(--ink); font: 14px Consolas, monospace; text-anchor: middle; }
.l3-chain .node-meta { fill: var(--muted); font: 12px var(--ui); }
.l3-chain .node-box { fill: #fff; stroke: #9eafc5; stroke-width: 1.5; }
.l3-chain .outside .node-box { fill: #f5f5f7; stroke-dasharray: 4 3; }
.l3-chain .active .node-box { stroke: #ae651b; stroke-width: 3; }
.l3-chain .edge { stroke: #7f96b1; stroke-width: 1.5; fill: none; }
.l3-chain .arrow { fill: #7f96b1; }
.l3-chain .reference { fill: #245e9f; font: 13px Consolas, monospace; }
.l3-compare { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; }
.l3-compare > section { min-width: 0; }
.l3-compare h4 { margin: 0 0 10px; font-size: 14px; }
.l3-verdict { min-height: 66px; font: 13px/1.6 var(--ui); margin: 8px 0 !important; }
[data-lecture3="encapsulation"] .input-error { display: none; }
@media(max-width:1000px) {
  .l3-trace-layout, .l3-compare { grid-template-columns: minmax(0,1fr); }
  .lecture-three .trace-code-wrap { border-left: 0; padding-left: 0; }
}
@media(max-width:900px) {
  .lecture-three .demo-controls { gap: 6px; }
  .lecture-three .step-buttons { gap: 4px; }
  .lecture-three .step-buttons button { padding-left: 6px; padding-right: 6px; }
}
