/* Circuit Atlas: a compact lab attached to the original vector drawing. */
.circuit-lab { position: relative; max-width: 540px; min-width: 0; margin-bottom: 12px; color: #b7c5b7; }
.circuit-lab .gate-art { height: 220px; margin: 14px 0 0 -6px; }
.lab-ui { animation: enter-art 350ms ease both; }
.lab-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 2px 0 8px; }
.lab-modes { display: flex; align-items: center; gap: 2px; min-width: 0; }
.lab-modes button, .lab-disclosure, .lab-actions button, .lab-start, #lab-tune { min-height: 36px; padding: 6px 9px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #a7b6a5; font-size: 10px; line-height: 1.5; transition: color 180ms, background 180ms, border-color 180ms; }
.lab-modes button:hover, .lab-actions button:hover, .lab-disclosure:hover, #lab-tune:hover { color: #e2efcf; background: #c3e69b0a; }
.lab-modes button[aria-pressed=true] { color: #d3f2a3; background: #bde88e0c; border-color: #bde88e20; }
.lab-disclosure { display: flex; align-items: center; gap: 6px; padding-right: 0; white-space: nowrap; }
.lab-disclosure > span { color: #c0d99d; font-size: 15px; }
.lab-mobile-picker { display: none; }
.lab-panel { position: relative; margin: 10px 0 14px; padding: 18px; border: 1px solid #a9c5af26; border-radius: 9px; background: #10251dc9; animation: lab-panel-enter 250ms var(--ease-out) both; }
.lab-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lab-panel h3 { margin: 5px 0 0; font-size: 17px; font-weight: 500; line-height: 1.5; letter-spacing: -.025em; color: #e3ebdc; }
.lab-overline { color: #94a68e; font-size: 8px; letter-spacing: .12em; line-height: 1.5; }
.lab-close { display: grid; place-items: center; flex: none; width: 40px; height: 40px; margin: -8px -8px 0 0; border: none; border-radius: 5px; color: #b7c5b7; background: transparent; font-size: 23px; font-weight: 400; }
.lab-close:hover { color: #e9f3d9; background: #bde88e0b; }
.lab-location { display: flex; align-items: center; gap: 12px; margin: 15px 0; }
.lab-location svg { flex: none; width: 78px; height: 28px; fill: none; stroke: #587461; stroke-width: 1; }
.lab-location .lab-location-dot { fill: #d3f2a3; stroke: none; }
.lab-location span { font-size: 10px; color: #a3b19c; line-height: 1.6; }
.lab-component-metrics { display: grid; grid-template-columns: .85fr 1.1fr 1.15fr; gap: 12px; padding: 13px 0; border-top: 1px solid #9ab58d20; border-bottom: 1px solid #9ab58d20; }
.lab-component-metrics > div, .lab-response > div { min-width: 0; }
.lab-component-metrics span, .lab-response span { display: block; margin-bottom: 7px; color: #91a68c; font-size: 9px; line-height: 1.5; }
.lab-component-metrics strong { display: block; color: #d4e3c9; font: 14px/1.6 Georgia, serif; overflow-wrap: anywhere; }
.lab-formula { color: #d0e4b6; font: italic 15px/1.8 Georgia, serif; margin: 14px 0 8px; overflow-wrap: anywhere; }
.lab-formula > span { display: block; }
.lab-explanation { margin: 8px 0; font-size: 11px; line-height: 1.9; color: #b3c1ac; }
.lab-rectangular { margin: 10px 0; font: 13px/1.8 Georgia, serif; color: #a2b897; overflow-wrap: anywhere; }
.lab-convention, .lab-playback, .lab-controls-hint, .lab-instant { color: #98ad90; font-size: 10px; line-height: 1.8; }
.lab-convention { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #9ab58d20; }
.lab-controls-hint { margin: 12px 0 14px; }
.lab-current-balance, .lab-analysis dl { margin: 12px 0; font-size: 11px; line-height: 1.8; }
.lab-current-balance > div, .lab-analysis dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lab-current-balance dt, .lab-analysis dt { color: #a1b695; font-family: Georgia, serif; font-style: italic; }
.lab-current-balance dd, .lab-analysis dd { margin: 0; color: #d4e0c9; text-align: right; overflow-wrap: anywhere; }
.lab-residual { margin: 10px 0; padding: 8px 10px; border-left: 1px solid #aac68a; background: #bde88e05; color: #adc19c; font: 11px/1.8 var(--body-font); overflow-wrap: anywhere; }
.lab-analysis { padding-top: 6px; border-top: 1px solid #9ab58d20; }
.lab-analysis .lab-formula { font-size: 14px; }
.lab-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.lab-actions button { font-size: 10px; }
.lab-start { color: #d3f2a3; padding-left: 0; text-align: left; margin-bottom: 10px; }
.lab-sliders { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 24px; min-width: 0; border: 0; padding: 0; margin: 12px 0 20px; }
.lab-sliders:disabled { opacity: .45; }
.lab-slider { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: baseline; min-width: 0; gap: 5px 6px; }
.lab-slider label { font-size: 10px; line-height: 1.5; color: #b2c2a9; }
.lab-slider output { color: #d6e9bd; font-size: 11px; font-variant-numeric: tabular-nums; }
.lab-slider input { width: 100%; height: 28px; grid-column: 1/-1; margin: 0; border-radius: 6px; appearance: none; background: transparent; cursor: pointer; accent-color: #c6e5a1; }
.lab-slider input::-webkit-slider-runnable-track { height: 2px; border-radius: 2px; background: #6a856454; }
.lab-slider input::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -5px; border: 1px solid #c6e5a1; border-radius: 50%; background: #c6e5a1; box-shadow: 0 0 0 4px #bde88e08; }
.lab-slider input::-moz-range-track { height: 2px; background: #6a856454; }
.lab-slider input::-moz-range-thumb { width: 11px; height: 11px; border: 0; border-radius: 50%; background: #c6e5a1; }
.lab-slider input:focus-visible { outline: 2px solid #bde88e; outline-offset: 4px; }
.lab-slider input:disabled { cursor: default; }
.lab-response { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; padding: 14px 0; border-block: 1px solid #9ab58d20; }
.lab-response strong { display: block; font: 18px/1.5 Georgia, serif; color: #d3e8b6; }
.lab-wavebox { margin: 16px 0 10px; }
.lab-wave-legend { display: flex; align-items: center; gap: 14px; color: #90a088; font: italic 12px/1.6 Georgia, serif; }
.lab-wave-legend > span:nth-child(2) { color: #d3f2a3; }
.lab-wave-legend > span:last-child { margin-left: auto; font: 9px/1.6 var(--body-font); }
.lab-wavechart { display: block; width: 100%; height: auto; margin: 10px 0; overflow: visible; fill: none; }
.lab-wavechart text { fill: #91a68c; font: 9px Georgia, serif; }
.lab-chart-grid { stroke: #688774; stroke-width: .5; opacity: .16; }
.lab-wave-input { stroke: #809778; stroke-width: 1.2; stroke-dasharray: 3 4; fill: none; }
.lab-wave-output { stroke: #d3f2a3; stroke-width: 1.5; fill: none; }
.lab-wave-equation { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0; color: #a3b897; font: italic 12px/1.8 Georgia, serif; }
.lab-resonance { padding: 13px 0 0; margin-top: 16px; border-top: 1px solid #9ab58d20; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.lab-resonance > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 10px; line-height: 1.8; }
.lab-resonance strong { font-weight: 500; color: #c6d6b8; }
.lab-resonance-title { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.lab-resonance-title i { width: 5px; height: 5px; border-radius: 50%; background: #5d7654; }
.lab-resonance > p { grid-column: 1/-1; margin: 0; font: italic 12px/1.8 Georgia, serif; color: #91a68c; }
.is-resonant .lab-resonance-title { color: #d3f2a3; }
.is-resonant .lab-resonance-title i { background: #d3f2a3; box-shadow: 0 0 8px #bde88e30; }
#lab-tune { border-color: #91b27130; color: #c8dda9; }
#lab-tune:disabled { opacity: .4; cursor: default; }
.lab-playback { margin: 14px 0 4px; }
.lab-instant { margin: 0; color: #b9cfa6; font-variant-numeric: tabular-nums; min-height: 18px; }
.lab-tooltip { position: absolute; z-index: 5; box-sizing: border-box; max-width: 100%; padding: 11px 13px; border: 1px solid #a8c18c36; border-radius: 7px; background: #11251df7; color: #c7d6bb; box-shadow: 0 8px 24px #0003; opacity: 0; visibility: hidden; transform: translateY(5px); pointer-events: none; transition: opacity 180ms, transform 180ms, visibility 180ms; }
.lab-tooltip.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.lab-tooltip strong, .lab-tooltip span, .lab-tooltip em { display: block; }
.lab-tooltip strong { color: #d4e4c3; font-size: 11px; font-weight: 500; line-height: 1.6; }
.lab-tooltip span { margin: 5px 0; color: #acbfa1; font-size: 10px; line-height: 1.7; }
.lab-tooltip em { font: italic 13px/1.7 Georgia, serif; color: #c8dda9; }
.circuit-lab .atlas-pulse { display: none; animation: none; }
.circuit-lab[data-mode=simulate] .atlas-pulse { display: block; }
.circuit-lab .atlas-node-main, .circuit-lab .atlas-return-r, .circuit-lab .atlas-return-l, .circuit-lab .atlas-return-c, .circuit-lab .atlas-wave-flow { animation: none; }
.lab-ready .atlas-output, .lab-ready .atlas-scope { animation: none; }
.circuit-lab .atlas-equation { display: none; }
.circuit-lab .atlas-component.is-active .atlas-symbol { filter: drop-shadow(0 0 2px #d3f2a333); }
.circuit-lab .atlas-current.is-active { stroke: #d3f2a3; }
.circuit-lab .atlas-current.is-active text { fill: #d3f2a3; }
.circuit-lab.is-kcl .atlas-current > path { animation: lab-current-emphasis 1.3s ease-in-out 3; }
.circuit-lab.is-lab-paused[data-mode=simulate] .atlas-current > path { animation-play-state: paused; }
.circuit-lab.is-resonant[data-mode=simulate] :is([data-component=r2],[data-component=l1],[data-component=c1]) .atlas-symbol { stroke: #b3cd99; }
.circuit-lab .atlas-component.is-active .atlas-symbol { stroke: #d3f2a3; }
.is-offscreen *, .is-offscreen *::before, .is-offscreen *::after { animation-play-state: paused !important; }
.lab-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes lab-panel-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes lab-current-emphasis { 0%,100% { opacity: .55; } 50% { opacity: 1; filter: drop-shadow(0 0 2px #c6e5a160); } }
@container atelier (min-width:760px) {
  .gate.lab-expanded .gate-main { align-items: start; }
  .gate.lab-expanded .gate-story { margin-top: var(--lab-story-offset,0px); }
  .gate.lab-expanded .gate-access { align-self: start; margin-top: var(--lab-card-offset,0px); position: sticky; top: 32px; }
}
@media (min-width:901px) and (max-height:850px) { .circuit-lab .gate-art { height: 182px; margin-top: 12px; } }
@media (min-width:901px) and (max-height:760px) { .circuit-lab .gate-art { height: 155px; } }
@container atelier (max-width:1100px) and (min-width:760px) {
  .lab-toolbar { flex-wrap: wrap; gap: 0; }
  .lab-disclosure { margin-left: auto; min-height: 30px; }
}
@container atelier (max-width:759px) { .circuit-lab { max-width: 500px; margin-inline: auto; } .circuit-lab .gate-art { max-width: 440px; height: 202px; margin: 10px auto 0; } }
@container atelier (max-width:600px) {
  .circuit-lab { margin-bottom: 0; }
  .circuit-lab .gate-art { max-width: 360px; height: 176px; margin: 8px auto 0; }
  .lab-ui { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 0 10px; }
  .lab-toolbar { display: contents; }
  .lab-modes { grid-column: 1/-1; grid-row: 1; justify-content: space-between; }
  .lab-modes button { flex: 1; min-height: 44px; font-size: 11px; padding-inline: 6px; }
  .lab-disclosure { grid-column: 2; grid-row: 2; min-height: 44px; font-size: 10px; }
  .lab-mobile-picker { display: block; grid-column: 1; grid-row: 2; min-width: 0; font-size: 10px; }
  .lab-mobile-picker > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .lab-mobile-picker select { color-scheme: dark; min-width: 0; width: 100%; max-width: 100%; height: 44px; padding: 0 4px; border: 0; border-radius: 4px; background: transparent; color: #bfd2ad; font: 10px var(--body-font); }
  .lab-mobile-picker select:focus-visible { outline: 2px solid #bde88e; outline-offset: 2px; }
  .lab-panel { grid-column: 1/-1; min-width: 0; padding: 16px; margin-block: 10px; }
  .lab-panel h3 { font-size: 16px; }
  .lab-panel-heading { gap: 6px; }
  .lab-overline { font-size: 7px; }
  .lab-actions button { padding-inline: 6px; min-height: 44px; }
  .lab-close { width: 44px; height: 44px; }
  .lab-component-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .lab-component-metrics > div:first-child { grid-column: 1/-1; }
  .lab-component-metrics strong { font-size: 13px; }
  .lab-sliders { gap: 12px 18px; }
  .lab-slider { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0; }
  .lab-slider label { flex-basis: 100%; font-size: 10px; }
  .lab-slider output { margin-top: 5px; }
  .lab-slider input { height: 44px; }
  .lab-slider input::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -7px; }
  .lab-response { gap: 10px; }
  .lab-response strong { font-size: 16px; }
  .lab-wave-equation { display: block; }
  .lab-wave-equation > span { display: block; }
  .lab-current-balance > div, .lab-analysis dl > div { align-items: flex-start; }
  .lab-current-balance dd { font-size: 10px; }
  .lab-location svg { width: 65px; }
  .lab-location span { font-size: 9px; }
}
@media (pointer:coarse) { .circuit-lab .atlas-hit { stroke-width: 16px; } }
@media (prefers-reduced-motion:reduce) {
  .circuit-lab *, .circuit-lab *::before { animation: none !important; transition: none !important; }
  .circuit-lab .atlas-pulse { display: none !important; }
}
