/* Shared image bounds: preserve aspect ratio and offer deliberate enlargement. */
body .board>svg,body .board>svg[class]{display:block;width:100%;min-width:0;max-width:780px;height:auto;max-height:520px;margin-inline:auto}
body .stage svg,body .stage svg[class],body .guided-diagram>svg{min-width:0;max-width:100%;height:auto;max-height:300px;object-fit:contain}
body img{max-width:100%;object-fit:contain}
.board,.guided-page,.graphic-state,.graphic-paper{min-width:0}
.board>button{display:block;margin:12px auto}
.graphic-responsive{max-width:1020px;margin-inline:auto;color:#182d23;font-size:16px}
.graphic-responsive h4{font-size:17px;margin:0 0 16px}
.graphic-brief{display:grid;grid-template-columns:minmax(150px,220px) minmax(0,1fr);gap:24px;align-items:center;background:#f5f7f1;border:1px solid #d2ddce;border-radius:12px;padding:20px;max-width:760px;margin:0 auto 24px}
.graphic-orders{min-width:0}.graphic-orders h4{margin-bottom:14px}.graphic-orders h5{font-size:14px;margin:16px 0 6px}.graphic-orders p{margin:5px 0;line-height:1.55;overflow-wrap:break-word}
.graphic-answers{border-top:2px solid #d2ddce;padding-top:20px;margin-top:20px}
.graphic-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;align-items:start}
.exercise-figure{min-width:0;margin:0;text-align:center;padding:12px;background:#fff;border:1px solid #d7dfd2;border-radius:10px}
.exercise-figure figcaption{font-size:15px;font-weight:700;margin-bottom:9px;color:#203d2d}
.exercise-paper{min-width:0;display:grid;place-items:center}
.exercise-paper>svg{display:block;width:100%;height:auto;min-width:0;max-width:176px;max-height:240px;margin:auto}
.graphic-brief .exercise-paper>svg{max-width:176px;max-height:240px}
.figure-zoom{font-size:12px;padding:7px 10px;min-height:36px;margin-top:8px}
.graphic-series{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:12px}
.graphic-series .exercise-paper>svg{max-height:176px}.graphic-series .exercise-figure{padding:9px}
.graphic-missing{min-height:140px;display:flex;flex-direction:column;gap:10px;align-items:center;justify-content:center;border:1px dashed #879d85;border-radius:10px}
.graphic-missing strong{font-size:36px}.graphic-missing span{font-size:13px}
.graphic-relation{margin:auto;max-width:650px;text-align:center}
.graphic-relation>svg{display:block;width:100%;max-height:380px;height:auto;min-width:0;margin:auto}
.graphic-relation .figure-zoom{display:block;margin:10px auto}
.graphic-transition{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:18px}
.graphic-transition button{min-height:44px;white-space:normal}.graphic-transition button[aria-pressed=true]{border-color:#eaff36;background:#eaff36;color:#163226}
.graphic-transition input[type=range]{width:100%;accent-color:#c9e95d;min-height:40px;margin:0}
.graphic-operation{color:#edffc0;font-weight:700;font-size:17px;line-height:1.5;margin:18px 0 0}
.graphic-reasoning{margin-top:20px;border-top:1px solid #ffffff40;padding-top:18px}.graphic-reasoning h4{margin:0 0 8px;font-size:16px;color:#edffc0}
.graphic-reasoning ul{margin:0;padding-left:22px;font-size:15px;line-height:1.7;color:#eff8ed}.graphic-reasoning li+li{margin-top:8px}
.graphic-blackboard .graphic-paper>svg{width:100%;height:auto;min-height:0;max-height:250px;max-width:380px}
.graphic-blackboard .graphic-state-caption{min-height:0;margin:8px 0}
.graphic-context{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.graphic-context figure{margin:0;min-width:0}.graphic-context figcaption{font-size:13px}.graphic-context .graphic-paper{padding:8px}
.graphic-zoom-scroll>svg{min-width:0;width:100%;height:auto;max-height:none}
.graphic-zoom-head{flex-wrap:wrap}.graphic-zoom-scroll{max-height:65vh}.graphic-zoom-head button{max-width:100%}
@media(max-width:1100px){.graphic-options{grid-template-columns:repeat(2,minmax(0,1fr));max-width:620px;margin:auto}.graphic-brief{gap:16px;padding:16px}}
@media(max-width:620px){
 .graphic-brief{grid-template-columns:minmax(0,1fr);padding:14px;gap:16px}.graphic-brief>.exercise-figure{width:min(100%,210px);margin:auto}
 .graphic-orders h4{margin-top:0}.graphic-brief .exercise-paper>svg{max-height:210px}
 .graphic-options{gap:10px}.exercise-figure{padding:8px}.exercise-paper>svg{max-height:210px}.exercise-figure figcaption{font-size:14px}
 .graphic-responsive{font-size:15px}.graphic-series{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 .graphic-figures.has-previous{grid-template-columns:minmax(0,1fr);gap:12px}
 .graphic-figures.has-previous .graphic-state{padding:12px}.graphic-figures.has-previous .graphic-paper{padding:10px}
 .graphic-figures.has-previous .graphic-paper>svg{min-height:0;max-height:230px}
 .graphic-figures.has-previous .graphic-state-caption{font-size:14px;min-height:0}.graphic-figures.has-previous .graphic-state-label{font-size:12px}
 .graphic-transition button{flex:1;min-width:100px;font-size:13px;padding:10px}.graphic-caption{font-size:16px}
 body .board>svg,body .board>svg[class]{max-height:360px}.graphic-reasoning ul{font-size:14px}
 .lesson-controls{min-width:0}.lesson-controls>*{min-width:0;max-width:100%}
}
@media(prefers-reduced-motion:reduce){.graphic-state,.graphic-overlay{animation:none!important}}

/* V3.119: the new private numeric sequences remain legible on narrow screens. */
.numeric-blackboard:has([data-stock], [data-event], [data-quantity], [data-percent-step], [data-applied-step], [data-pro-context-step], [data-symbol-chain-step], [data-percent-context-step], [data-digit-step], [data-table-step], [data-application-step], [data-operation-step], [data-equation-step]) .motion-controls,
.numeric-blackboard:has([data-stock], [data-event], [data-quantity], [data-percent-step], [data-applied-step], [data-pro-context-step], [data-symbol-chain-step], [data-percent-context-step], [data-digit-step], [data-table-step], [data-application-step], [data-operation-step], [data-equation-step]) .play-speed { color: #123a30; }
@media (max-width: 760px) {
  .numeric-lesson .guided-pair:has([data-stock], [data-event], [data-quantity], [data-percent-step], [data-applied-step], [data-pro-context-step], [data-symbol-chain-step], [data-percent-context-step], [data-digit-step], [data-table-step], [data-application-step], [data-operation-step], [data-equation-step]) { grid-template-columns: minmax(0, 1fr); }
  .numeric-lesson .guided-pair:has([data-stock], [data-event], [data-quantity], [data-percent-step], [data-applied-step], [data-pro-context-step], [data-symbol-chain-step], [data-percent-context-step], [data-digit-step], [data-table-step], [data-application-step], [data-operation-step], [data-equation-step]) figure { min-width: 0; }
}

/* V3.125: only the new table exercises use this semantic responsive layout. */
.agc-table-wrap { max-width: 780px; margin: 12px auto; color: #173d31; }
.agc-data-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.agc-data-table caption { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.agc-data-table th, .agc-data-table td { padding: 11px 8px; border: 1px solid #b9cabc; text-align: center; }
.agc-data-table thead, .agc-data-table tbody th { background: #edf3e7; }
.agc-data-table .table-unknown { color: #123a30; background: #f6facf; font-weight: 700; }
.table-cell-label { display: none; }
@media(max-width:620px) {
 .agc-data-table { display:block; }
 .agc-data-table caption { display:block; text-align:left; }
 .agc-data-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
 .agc-data-table tbody { display:grid; grid-template-columns:minmax(0,1fr); gap:12px; }
 .agc-data-table tbody tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); border:1px solid #b9cabc; border-radius:8px; overflow:hidden; }
 .agc-data-table tbody th { grid-column:1/-1; border:0; padding:8px; }
 .agc-data-table tbody td { display:flex; gap:6px; flex-wrap:wrap; justify-content:space-between; align-items:center; border:0; border-top:1px solid #d8e1d5; padding:10px 8px; font-size:16px; }
 .table-cell-label { display:inline; font-size:13px; color:#355846; }
 .table-cell-value { font-weight:600; }
}

body .board>svg.pending-digit-board[class]{width:100%;max-width:380px;height:auto;max-height:270px;margin-inline:auto;display:block}



/* Percent context: readable diagrams on narrow screens. */
body .numeric-lesson .guided-pair .guided-diagram>svg[data-percent-context-step]{max-height:520px;max-width:340px!important}
@media(max-width:900px){
 .numeric-lesson .guided-pair:has([data-percent-context-step]){grid-template-columns:minmax(0,1fr)}
}
@media(max-width:600px){
 .numeric-lesson .guided-page:has([data-percent-context-step]){padding:8px}
 .numeric-blackboard:has([data-percent-context-step]){padding:14px 8px}
 .numeric-blackboard:has([data-percent-context-step]) .blackboard-heading{flex-direction:column;align-items:flex-start}
 .numeric-lesson .guided-pair:has([data-percent-context-step]) figure{padding:10px 6px}
 .numeric-blackboard:has([data-percent-context-step]) .motion-controls{padding:8px}
 .numeric-blackboard:has([data-percent-context-step]) .motion-controls .play-primary{padding:10px 6px;overflow-wrap:normal;word-break:normal;font-size:16px}
 .numeric-blackboard:has([data-percent-context-step]) .play-speed{display:flex;flex-direction:column;align-items:stretch;gap:6px}
 .numeric-blackboard:has([data-percent-context-step]) .play-speed select{width:100%;min-width:0}
}

body .board>svg.pending-symbol-question[class]{display:block;width:100%;max-width:300px;height:auto;max-height:480px;margin-inline:auto}

/* Symbol substitutions: readable diagrams on narrow screens. */
body .numeric-lesson .guided-pair .guided-diagram>svg[data-symbol-chain-step]{max-height:520px;max-width:340px!important}
@media(max-width:900px){
 .numeric-lesson .guided-pair:has([data-symbol-chain-step]){grid-template-columns:minmax(0,1fr)}
}
@media(max-width:600px){
 .numeric-lesson .guided-page:has([data-symbol-chain-step]){padding:8px}
 .numeric-blackboard:has([data-symbol-chain-step]){padding:14px 8px}
 .numeric-blackboard:has([data-symbol-chain-step]) .blackboard-heading{flex-direction:column;align-items:flex-start}
 .numeric-lesson .guided-pair:has([data-symbol-chain-step]) figure{padding:10px 6px}
 .numeric-blackboard:has([data-symbol-chain-step]) .motion-controls{padding:8px}
 .numeric-blackboard:has([data-symbol-chain-step]) .motion-controls .play-primary{padding:10px 6px;overflow-wrap:normal;word-break:normal;font-size:16px}
 .numeric-blackboard:has([data-symbol-chain-step]) .play-speed{display:flex;flex-direction:column;align-items:stretch;gap:6px}
 .numeric-blackboard:has([data-symbol-chain-step]) .play-speed select{width:100%;min-width:0}
}

/* Applied contexts: readable diagrams on narrow screens. */
body .numeric-lesson .guided-pair .guided-diagram>svg[data-pro-context-step]{max-height:520px;max-width:340px!important}
@media(max-width:900px){
 .numeric-lesson .guided-pair:has([data-pro-context-step]){grid-template-columns:minmax(0,1fr)}
}
@media(max-width:600px){
 .numeric-lesson .guided-page:has([data-pro-context-step]){padding:8px}
 .numeric-blackboard:has([data-pro-context-step]){padding:14px 8px}
 .numeric-blackboard:has([data-pro-context-step]) .blackboard-heading{flex-direction:column;align-items:flex-start}
 .numeric-lesson .guided-pair:has([data-pro-context-step]) figure{padding:10px 6px}
 .numeric-blackboard:has([data-pro-context-step]) .motion-controls{padding:8px}
 .numeric-blackboard:has([data-pro-context-step]) .motion-controls .play-primary{padding:10px 6px;overflow-wrap:normal;word-break:normal;font-size:16px}
 .numeric-blackboard:has([data-pro-context-step]) .play-speed{display:flex;flex-direction:column;align-items:stretch;gap:6px}
 .numeric-blackboard:has([data-pro-context-step]) .play-speed select{width:100%;min-width:0}
}

/* Applied scenarios: readable diagrams on narrow screens. */
body .numeric-lesson .guided-pair .guided-diagram>svg[data-applied-step]{max-height:520px;max-width:340px!important}
@media(max-width:900px){
 .numeric-lesson .guided-pair:has([data-applied-step]){grid-template-columns:minmax(0,1fr)}
}
@media(max-width:600px){
 .numeric-lesson .guided-page:has([data-applied-step]){padding:8px}
 .numeric-blackboard:has([data-applied-step]){padding:14px 8px}
 .numeric-blackboard:has([data-applied-step]) .blackboard-heading{flex-direction:column;align-items:flex-start}
 .numeric-lesson .guided-pair:has([data-applied-step]) figure{padding:10px 6px}
 .numeric-blackboard:has([data-applied-step]) .motion-controls{padding:8px}
 .numeric-blackboard:has([data-applied-step]) .motion-controls .play-primary{padding:10px 6px;overflow-wrap:normal;word-break:normal;font-size:16px}
 .numeric-blackboard:has([data-applied-step]) .play-speed{display:flex;flex-direction:column;align-items:stretch;gap:6px}
 .numeric-blackboard:has([data-applied-step]) .play-speed select{width:100%;min-width:0}
}
