.container { width: min(76%, 1240px); margin-left: 21%; }
#toc { left: 2%; right: auto; width: 16%; max-width: 230px; top: 8%; font-size: .9rem; line-height: 1.7; }
#toc ul { list-style: none; padding: 0; }
#toc li { opacity: 1; padding: .14rem 0; }
#toc p { text-align: left; }
.container p::before, #toc p::before { content: none; }
section { scroll-margin-top: 24px; margin: 3rem 0; }
.eyebrow { letter-spacing: .16em; text-transform: uppercase; font-size: .8rem; }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; align-items: center; }
.hero-grid img { width: 100%; border-radius: 5px; }
.jump-links, .actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1rem 0; }
.actions .btn { font: inherit; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: wait; }
.lab { border: 1px solid var(--browne-boundary); background: var(--browne-title); padding: 1rem; border-radius: 6px; }
.lab-grid { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 1rem; }
.controls { min-width: 0; }
.controls label { display: block; font-size: .88rem; margin: .7rem 0 .2rem; }
.controls input:not([type=checkbox]), .controls select, .controls textarea, .filter-input {
  box-sizing: border-box; width: 100%; font: inherit; padding: .5rem;
  background: var(--browne-parchment); color: var(--browne-words);
  border: 1px solid var(--browne-boundary); border-radius: 3px;
}
.controls select { font-size: .85rem; }
.controls textarea { min-height: 90px; font-family: monospace; }
.controls details { margin-top: .8rem; }
.advanced-grid { max-height: 440px; overflow: auto; padding-right: .4rem; }
.view-area { min-width: 0; }
.viewport { height: 560px; position: relative; background: var(--browne-parchment); border: 1px solid var(--browne-boundary); touch-action: none; }
.viewport canvas { display: block; width: 100%; height: 100%; }
.placeholder { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 2rem; pointer-events: none; }
.placeholder img { width: min(100%, 380px); max-height: 430px; object-fit: contain; }
.placeholder p { background: var(--browne-parchment); padding: .5rem; }
.status { min-height: 2.8em; padding: .6rem .8rem; border-left: 3px solid var(--browne-button); overflow-wrap: anywhere; }
.status.error { border-color: var(--browne-highlight); color: var(--browne-highlight); }
.status.busy { animation: breathe 1.4s ease-in-out infinite alternate; }
@keyframes breathe { from { opacity: 1; } to { opacity: .6; } }
.viewer-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem; margin: .8rem 0; }
.viewer-controls input[type=range] { flex: 1; min-width: 100px; }
.metric-row { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; }
.metadata { max-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; }
th button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; text-align: left; }
td { vertical-align: top; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.sample-card { min-width: 0; border: 1px solid var(--browne-boundary); padding: .8rem; border-radius: 4px; }
.sample-card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--browne-title); }
.sample-card figure { margin: .4rem 0; }
.reference-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.reference-grid figure { margin: 0; }
.reference-grid img { width: 100%; height: 155px; object-fit: contain; }
.command-row summary { overflow-wrap: anywhere; }
.command-row .code-box { max-height: 380px; overflow: auto; }
.command-row.failed summary { color: var(--browne-highlight); }
.source-block .code-box { max-height: 480px; overflow: auto; }
.source-block .code-box pre { margin: 0; }
.filter-input { max-width: 420px; margin: .5rem 0 1rem; }
.callout { border-left: 3px solid var(--browne-highlight); padding: .3rem 1rem; }
.fact-label { color: var(--browne-code); font-weight: bold; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.chart-grid figure { margin: 0; min-width: 0; }
.chart-grid canvas { max-height: 280px; }
.mobile-toc { display: none; }
[hidden] { display: none !important; }
@media (max-width: 1050px) {
  .container { width: 92%; margin: 24px auto; }
  #toc { display: none; }
  .mobile-toc { display: block; }
}
@media (max-width: 720px) {
  .hero-grid, .lab-grid, .chart-grid, .gallery { grid-template-columns: 1fr; }
  .viewport { height: 430px; }
  .reference-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .advanced-grid { max-height: 250px; }
  .code-box { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .status.busy { animation: none; }
}
#python-source { box-sizing: border-box; width: 100%; min-height: 490px; resize: vertical; padding: 1rem; font: 13px/1.6 monospace; tab-size: 4; background: var(--browne-parchment); color: var(--browne-words); border: 1px solid var(--browne-boundary); white-space: pre; overflow: auto; }
#python-output { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 350px; overflow: auto; }
#effective-call { white-space: pre-wrap; overflow-wrap: anywhere; }
.editor-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0; }
.editor-head select { max-width: 100%; background: var(--browne-parchment); color: var(--browne-words); padding: .5rem; }
#signature { overflow-wrap: anywhere; }
.chart-wrap { min-height: 270px; }
@media (max-width: 720px) { #python-source { font-size: 12px; min-height: 360px; } .kpi-card { min-width: 100px; } }
input[type=range], input[type=checkbox] { accent-color: var(--browne-button); }
h1.title { line-height: 1.3; font-size: clamp(1.7rem, 3.2vw, 2.8rem); }
