/* Keep diagrams inside the actual available reading area, including browser zoom. */
.stage{container-name:reading-area;container-type:size}
.stage .diagram{box-sizing:border-box}
.stage .diagram>*{flex-shrink:0}
.stage .value-card.loss{margin:0}
@container reading-area (max-width:350px){
.payoff text{font-size:19px}
}
@container reading-area (max-width:700px) and (max-height:600px){
.stage .lesson-diagram{padding:8px 12px 16px;gap:8px}
.stage .lesson-diagram h2{margin:0;line-height:1.4}
.lesson-diagram .diagram-kicker{line-height:1.4}
.lesson-diagram .diagram-footer{padding:6px 8px;line-height:1.4}
.lesson-diagram .equation,.lesson-diagram .formula{padding:8px;line-height:1.4}
.formula{gap:4px}
.value-grid{gap:8px}
.value-card{padding:8px 6px;gap:4px}
.calculation{padding:8px 6px;gap:4px}
.limits th,.limits td{padding:7px 5px;line-height:1.4}
.limits caption{padding-bottom:6px;line-height:1.4}
.review-cards{gap:6px}
.review-cards li{padding:8px;gap:10px}
.review-cards li>div{gap:3px}
.payoff{width:min(100%,340px);height:auto}
.stage[data-scene="18"] .review-cards{gap:4px}
.stage[data-scene="18"] .review-cards li{padding:6px}
.stage[data-scene="18"] .review-cards li>div{gap:1px}
}
/* Existing dialogue steps reveal the relevant part, without omitting a condition. */
@container reading-area (max-width:700px) and (max-height:540px){
.stage[data-scene="13"]:is([data-page="0"],[data-page="1"]) .payoff{display:none}
.stage[data-scene="13"]:not([data-page="0"]):not([data-page="1"]) :is(.equation,.value-grid){display:none}
.stage[data-scene="11"]:is([data-page="0"],[data-page="1"]) .formula{display:none}
.stage[data-scene="11"]:not([data-page="0"]):not([data-page="1"]) :is(.equation,.calculation){display:none}
}
@container reading-area (max-width:700px) and (max-height:380px){
.stage[data-scene="13"]:not([data-page="0"]):not([data-page="1"]) .diagram-kicker{display:none}
.stage[data-scene="14"][data-page="0"] .equation{display:none}
.stage[data-scene="14"]:not([data-page="0"]) .limits{display:none}
.stage[data-scene="16"] .limits th,.stage[data-scene="16"] .limits td{padding:4px}
.stage[data-scene="16"] .lesson-diagram{gap:4px}
.stage[data-scene="16"] .diagram-footer{padding:4px 8px}
.stage[data-scene="18"][data-page="0"] .diagram-footer{display:none}
.stage[data-scene="18"]:not([data-page="0"]) .review-cards{display:none}
}
