/* Chapter 20: real mesh viewport, demand rendering, ordinary touch scrolling. */
.perspective-overview{margin:0;border:1px solid var(--line);border-radius:13px;overflow:hidden;background:var(--surface)}.perspective-overview img{display:block;width:100%;height:auto}.perspective-overview figcaption{display:grid;gap:8px;padding:20px 24px;color:var(--muted);font-size:14px;line-height:1.7}.perspective-overview figcaption strong{color:var(--ink);font:600 20px/1.4 var(--display)}
.perspective-lab-shell{border:1px solid var(--line);border-radius:14px;overflow:hidden;background:var(--surface)}.perspective-workbench{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(320px,.9fr);align-items:start}.perspective-preview{min-width:0;background:#090f17}.perspective-stage{position:relative;aspect-ratio:4/3;background:#090f17}.perspective-stage canvas,.perspective-stage>img{display:block;width:100%;height:100%;object-fit:contain}.perspective-stage:has(>img:not([hidden]))>canvas{display:none}.perspective-stage [hidden]{display:none!important}.perspective-stage canvas{touch-action:pan-y pinch-zoom;cursor:default}.perspective-stage canvas:focus-visible{outline-offset:-3px}
.perspective-legend{display:flex;flex-wrap:wrap;gap:10px 18px;padding:15px 20px;border-top:1px solid var(--line);font:400 10px/1.6 var(--mono);color:var(--muted)}.perspective-legend span{display:inline-flex;align-items:center;gap:8px}.perspective-legend i{width:10px;height:10px;display:inline-block;border-radius:50%;flex:none}.perspective-point-color{background:#ffcf4f}.perspective-depth-color{border:2px solid #3de0f0}.perspective-plane-color{border:1px solid #bacbd9;border-radius:0!important}.perspective-x-color{border:2px solid #ff9147}.perspective-y-color{border:2px solid #66de8f;border-radius:0!important}.perspective-z-color{border:2px solid #66a8ff;border-radius:0!important;transform:rotate(45deg)}
.perspective-view-note,.perspective-fallback-message{padding:0 20px;color:var(--dim);font-size:11px;line-height:1.7;margin:0 0 18px}.perspective-fallback-message{color:var(--muted);padding-top:16px}.perspective-controls{min-width:0;padding:20px;border-left:1px solid var(--line)}.perspective-heading-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.perspective-heading-row h3{margin:0;font:500 18px/1.4 var(--display)}.perspective-controls button{padding:8px 10px;font-size:10px;border-radius:7px;min-height:36px}.perspective-heading-row button{flex:none}.perspective-mode-row{display:flex;gap:12px;align-items:center;margin-top:17px}.perspective-mode-row label{font:400 11px/1.5 var(--mono);color:var(--muted)}.perspective-mode-row select{flex:1;min-width:0;max-width:100%;background:#0b111b;border:1px solid var(--line);border-radius:7px;color:var(--ink);padding:9px;font:400 11px/1.5 var(--mono)}
.perspective-controls fieldset{margin:18px 0 0;padding:0;border:0;min-width:0}.perspective-controls legend{padding:0;color:var(--ink);font:500 14px/1.5 var(--display)}.perspective-input-row{display:grid;grid-template-columns:57px minmax(0,1fr) 96px;gap:8px;align-items:center;margin-top:8px}.perspective-input-row label{font:400 10px/1.5 var(--mono);color:var(--muted)}.perspective-input-row input[type=range]{min-width:0;width:100%;margin:0;min-height:30px;accent-color:#3de0f0}.perspective-input-row input[type=number]{width:100%;min-width:0;border:1px solid var(--line);background:#0b111b;color:var(--ink);border-radius:6px;padding:7px 4px;font:400 11px/1.5 var(--mono);font-variant-numeric:tabular-nums}.perspective-preset-buttons{display:flex;flex-wrap:wrap;gap:8px;margin-top:17px}.perspective-option-row{display:flex;flex-wrap:wrap;gap:11px 18px;margin-top:17px}.perspective-option-row label{display:flex;gap:7px;align-items:center;font-size:11px;line-height:1.5;color:var(--muted)}.perspective-option-row input{accent-color:#3de0f0;flex:none}.perspective-help{margin-top:17px;border-top:1px solid var(--line);padding-top:12px}.perspective-help summary{font-size:11px;line-height:1.6;color:var(--muted);cursor:pointer}.perspective-help p{font-size:11px;line-height:1.7;color:var(--dim);margin:10px 0 0}#perspective-shader-status{font:400 10px/1.7 var(--mono);color:var(--accent);margin:16px 0 0;min-height:20px}
.perspective-readouts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px 20px;padding:22px;border-block:1px solid var(--line);margin:0;background:#0b111b}.perspective-readouts>div{min-width:0}.perspective-readouts dt{color:var(--dim);font:400 10px/1.6 var(--mono);margin:0 0 6px}.perspective-readouts dd{margin:0;color:var(--ink);font:400 13px/1.6 var(--mono);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.perspective-geometry-note{padding:14px 22px;margin:0;border-bottom:1px solid var(--line);font-size:12px;line-height:1.7;color:var(--muted)}.perspective-readout-note,.perspective-control-help{padding:0 22px;font-size:12px;line-height:1.75;color:var(--muted);margin:16px 0}.perspective-readout-note{color:var(--dim);font-size:11px}#perspective-error{white-space:pre-wrap;overflow-wrap:anywhere;color:#ffb6a4;background:#291717;padding:16px;border-radius:8px;font-size:12px}#perspective-lab .code-panel{min-width:0}
@media(max-width:900px){.perspective-workbench{grid-template-columns:1fr}.perspective-stage{max-width:700px;margin-inline:auto}.perspective-controls{border-left:0;border-top:1px solid var(--line)}.perspective-readouts{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:580px){.perspective-controls{padding:18px}.perspective-heading-row h3{font-size:16px}.perspective-input-row{grid-template-columns:54px minmax(0,1fr) 90px;gap:7px}.perspective-readouts{gap:17px 15px;padding:18px}.perspective-readouts dd{font-size:12px}.perspective-legend{padding:14px 18px;gap:10px 15px}.perspective-view-note,.perspective-fallback-message,.perspective-geometry-note,.perspective-readout-note,.perspective-control-help{padding-inline:18px}}

.perspective-lab-shell [hidden]{display:none!important}.perspective-stage{overflow:hidden}.perspective-stage:has(>img:not([hidden])){aspect-ratio:5/4!important}.perspective-stage:has(>img:not([hidden])) .perspective-corner-marker{display:none}.perspective-corner-marker{position:absolute;display:block;width:14px;height:14px;border:2px solid #ffcf4f;box-shadow:0 0 0 1px #141b27;border-radius:50%;transform:translate(-50%,-50%);pointer-events:none}.perspective-near-color{background:#3de0f0}.perspective-far-color{background:#be95ff}.perspective-reference-color{border:2px solid #ffcf4f}.perspective-mode-row label{min-width:74px}.perspective-controls input:disabled{opacity:.45;cursor:not-allowed}.perspective-control-status{margin:14px 0 0;font:400 10px/1.7 var(--mono);color:var(--muted)}.perspective-readouts dd{font-size:12px}.perspective-frustum-panel{border-top:1px solid var(--line);padding:17px 20px}.perspective-frustum-panel h4{font:500 12px/1.6 var(--mono);color:var(--ink);margin:0 0 12px}.perspective-frustum-panel>svg{display:block;width:100%;height:auto;max-width:600px;margin:auto}.perspective-frustum-panel>p{font-size:11px;line-height:1.7;color:var(--dim);margin:12px 0 0}.perspective-editor-label{display:block;font:500 12px/1.6 var(--mono);margin:18px 0 10px;color:var(--ink)}.perspective-copy-row{display:flex;justify-content:flex-end;margin:10px 0 20px}.perspective-copy-row button{font-size:11px}#perspective-vertex-code{min-height:330px}#perspective-fragment-code{min-height:390px}
@media(max-width:580px){.perspective-readouts dd{font-size:11px}.perspective-frustum-panel{padding:16px 18px}.perspective-mode-row label{min-width:70px}}
