/* The speaker emerges from the lower edge of the world. */
#modal-root .modal-backdrop:has(.dialogue-scene){padding:20px!important;display:flex;align-items:flex-end;justify-content:flex-start;background:rgba(15,35,29,.58);backdrop-filter:none;overflow:hidden!important}
#modal-root .modal-backdrop:has(.dialogue-scene[data-dialogue-side="right"]){justify-content:flex-end}
#modal-root .dialog.child-dialog.dialogue-scene{position:relative;display:flex!important;flex-direction:row!important;align-items:flex-end;gap:18px!important;width:min(900px,100%);max-width:900px;height:auto!important;min-height:0!important;max-height:calc(var(--view-height,100dvh) - 40px)!important;padding:0!important;margin:0;background:none!important;border:0!important;box-shadow:none!important;border-radius:0;overflow:visible!important;scrollbar-gutter:auto;isolation:isolate}
#modal-root .dialog.child-dialog.dialogue-scene[data-dialogue-side="left"]{flex-direction:row-reverse!important;margin-right:auto}
#modal-root .dialogue-scene[data-dialogue-side="right"]{margin-left:auto}
.dialogue-scene>.dialogue-avatar{position:relative;flex:0 0 var(--speech-avatar-width,240px);width:var(--speech-avatar-width,240px);margin:0;padding:0;line-height:0;z-index:2;align-self:flex-end;pointer-events:none}
.dialogue-avatar>.avatar-bust{display:block;width:100%!important;height:auto!important;max-width:100%;max-height:none;overflow:hidden}
.avatar-bust .avatar-head{display:initial!important;width:190px!important;height:178px!important;margin:0!important}
.dialogue-bubble{position:relative;display:flex;flex-direction:column;gap:10px;flex:1;min-width:0;max-height:var(--speech-max-height,620px);padding:17px 20px;margin-bottom:var(--speech-lift,145px);border:3px solid #cbb477;border-radius:38px 42px 34px 40px;background:#fff9e9;color:#234f41;box-shadow:0 6px 0 #e1d0a0,0 10px 24px #244c381a;overflow:visible;text-align:left}
.dialogue-bubble:before,.dialogue-bubble:after{content:"";position:absolute;pointer-events:none;width:34px;height:34px;bottom:24px;transform:rotate(45deg);border-radius:0 0 7px 0}
.dialogue-scene[data-dialogue-side="left"] .dialogue-bubble:before{left:-20px;background:#cbb477}
.dialogue-scene[data-dialogue-side="left"] .dialogue-bubble:after{left:-15px;background:#fff9e9}
.dialogue-scene[data-dialogue-side="right"] .dialogue-bubble:before{right:-20px;background:#cbb477}
.dialogue-scene[data-dialogue-side="right"] .dialogue-bubble:after{right:-15px;background:#fff9e9}
.dialogue-scene:not(.speech-stacked) .dialogue-bubble:before,.dialogue-scene:not(.speech-stacked) .dialogue-bubble:after{top:var(--speech-tail-top,55%);bottom:auto;width:65px;height:38px;border-radius:0;transform:none;clip-path:polygon(0 0,100% 50%,0 100%)}
.dialogue-scene:not(.speech-stacked)[data-dialogue-side="right"] .dialogue-bubble:before{right:-63px}.dialogue-scene:not(.speech-stacked)[data-dialogue-side="right"] .dialogue-bubble:after{right:-57px;width:61px;height:30px;margin-top:4px}
.dialogue-scene:not(.speech-stacked)[data-dialogue-side="left"] .dialogue-bubble:before{left:-63px;clip-path:polygon(100% 0,0 50%,100% 100%)}.dialogue-scene:not(.speech-stacked)[data-dialogue-side="left"] .dialogue-bubble:after{left:-57px;width:61px;height:30px;margin-top:4px;clip-path:polygon(100% 0,0 50%,100% 100%)}
.speech-header{display:flex;align-items:center;gap:8px;min-height:48px;flex:none;position:relative;z-index:3}
.speech-heading{min-width:0;flex:1}.dialogue-name{display:block;font:700 21px/1.2 var(--font-child);color:#315b45}
.dialogue-scene #dialog-title{font:600 14px/1.35 var(--font-child)!important;padding:0!important;margin:4px 0 0!important;overflow-wrap:anywhere}
#modal-root .dialogue-scene #dialog-title{min-height:0!important;text-align:left}#modal-root .dialogue-scene #dialog-title:focus{outline:none!important}.dialogue-scene .tutorial-step{display:inline;font-size:13px!important;margin-left:6px}
#modal-root .dialogue-scene .close-dialog{position:static!important;flex:none;margin:0!important;inset:auto!important}.speech-back{flex:none;width:48px;height:48px;padding:10px!important}.speech-back svg{width:24px;height:24px}
#modal-root .dialogue-scene .speech-back{width:48px!important;min-width:48px!important;max-width:48px!important;flex:0 0 48px!important;margin:0!important}body.access-large-targets #modal-root .dialogue-scene .speech-back{width:56px!important;min-width:56px!important;max-width:56px!important;flex-basis:56px!important}
.speech-content{flex:none;min-height:0;max-height:var(--fit-budget,var(--speech-body-height,400px));width:100%;display:flex;flex-direction:column;gap:9px;overflow:hidden;font:20px/1.5 var(--font-child)}
.speech-content p{font-size:inherit!important;line-height:1.5!important;margin:0;color:#234f41}.speech-content h2,.speech-content h3{font-size:21px;line-height:1.25;margin:0}
.speech-content .fit-text-part{font-size:inherit!important;line-height:inherit!important}
.speech-content .dialogue-message{border:0!important;background:none!important;padding:0!important;border-radius:0!important;text-align:left}.speech-content .modal-eyebrow{font-size:14px!important}
.speech-content .fit-unit{margin-top:0!important;margin-bottom:0!important}.speech-content .fit-art{height:min(160px,var(--fit-budget,160px))!important}.speech-content .fit-art svg,.speech-content .fit-art img{max-width:100%;max-height:100%;object-fit:contain}
.speech-options{display:flex;flex-wrap:wrap;gap:9px;justify-content:center}
#modal-root .speech-options .kid-action{width:100%!important;min-width:56px!important;max-width:100%!important;height:auto!important;min-height:56px!important;--control-size:56px;padding:0 0 6px!important}
#modal-root .speech-options .kid-action>.toy-face{display:flex!important;flex-direction:row!important;align-items:center;justify-content:center;gap:8px!important;height:auto!important;min-height:50px!important;padding:7px 10px!important}
#modal-root .speech-options .kid-action .icon{width:28px!important;height:28px!important;flex:none}#modal-root .speech-options .kid-label{display:block!important;position:static!important;width:auto!important;height:auto!important;clip:auto!important;font-size:18px!important;line-height:1.2!important;white-space:normal!important;margin:0!important}
body.large-text #modal-root .speech-options .kid-label{font-size:20px!important}
.dialogue-actions{display:flex;gap:10px;margin:0!important;flex:none;flex-wrap:nowrap!important;width:100%;position:relative;z-index:3}
.dialogue-actions>button.brotemar-control{flex:1 1 0!important;min-width:48px!important;width:auto!important;max-width:100%!important;min-height:56px!important;height:auto!important;padding:10px 14px!important;font-size:18px!important}
.dialogue-actions>.kid-action>.toy-face{position:relative!important;inset:auto!important;width:100%;min-height:46px;padding:8px 12px;flex-direction:row!important;gap:8px}
#modal-root .dialogue-actions>button:not(.kid-action)>.toy-face,#modal-root .speech-header button:not(.kid-action)>.toy-face{display:flex!important;flex-direction:row!important;align-items:center;justify-content:center;width:100%;min-height:0!important;padding:0!important;gap:6px}
.dialogue-actions>.kid-action{padding:0 0 7px!important}.dialogue-actions .kid-label{display:block!important;position:static!important;width:auto;height:auto;clip:auto;font-size:17px!important;white-space:normal}.dialogue-actions .kid-action .icon{width:28px;height:28px;flex:none}
#modal-root .dialogue-actions>button.brotemar-control{flex:1 1 0!important;width:100%!important;max-width:100%!important;height:auto!important}
#modal-root .dialogue-actions>.kid-action>.toy-face{height:auto!important;min-height:46px!important;padding:8px 12px!important;flex-direction:row!important;gap:8px!important}
#app .child-ui .resume-compact .kid-label{white-space:nowrap!important}#app .child-ui .resume-compact .toy-face{gap:8px!important;padding:7px 12px!important}
@media(min-width:621px){#app .child-ui .resume-compact.kid-action{width:180px!important}}
body.large-text #modal-root .dialogue-actions>button.brotemar-control,body.large-text #modal-root .dialogue-actions .kid-label{font-size:20px!important}
body.large-text #app .child-ui .world-nav .toy-face{padding:4px!important;gap:3px!important}body.large-text #app .child-ui .world-nav .kid-label{white-space:nowrap!important}
.dialogue-controls{display:flex;flex:none;gap:4px}.dialogue-control{width:48px;height:48px;padding:10px!important;flex:none}.dialogue-control .control-label{display:none}.dialogue-control svg{width:24px;height:24px}
.speech-pager{flex:none;min-height:48px;gap:8px;padding:0;margin:0;width:100%}.speech-pager>span{font:600 13px/1.3 var(--font-child)}.speech-pager .fit-page-button{width:48px;height:48px;padding:8px;flex:none}
body.large-text .speech-content,body.large-text .speech-content .fit-text-part{font-size:24px}body.access-large-targets .speech-header{min-height:56px}body.access-large-targets .speech-back,body.access-large-targets .dialogue-control,body.access-large-targets .speech-pager .fit-page-button{width:56px;height:56px}
.speech-open{display:none}.dialogue-scene[data-dialogue-state="playing"][data-dialogue-still="false"] .speech-open{display:initial;animation:speech-mouth .26s steps(2,end) infinite;transform-box:fill-box;transform-origin:center}.dialogue-scene[data-dialogue-state="playing"][data-dialogue-still="false"] .speech-closed{visibility:hidden}
.dialogue-scene[data-dialogue-still="false"] .speech-eye{animation:speech-blink 6.4s ease-in-out infinite;transform-box:fill-box;transform-origin:center}.dialogue-scene[data-dialogue-state="playing"][data-dialogue-still="false"] .avatar-arm-near{animation:speech-wave 2.4s ease-in-out infinite;transform-box:fill-box;transform-origin:80% 85%}
@keyframes speech-mouth{0%,100%{transform:scaleY(.4)}50%{transform:scaleY(1)}}@keyframes speech-blink{0%,45%,49%,100%{transform:scaleY(1)}47%{transform:scaleY(.12)}}@keyframes speech-wave{0%,100%{transform:rotate(-2deg)}50%{transform:rotate(4deg)}}
.dialogue-scene[data-dialogue-still="true"] .dialogue-avatar *{animation:none!important}
body.high-contrast .dialogue-bubble{background:#fff;border-color:#284b3d;color:#173e30}body.high-contrast .dialogue-bubble:before{background:#284b3d!important}body.high-contrast .dialogue-bubble:after{background:#fff!important}
#modal-root .dialog.child-dialog.dialogue-scene.speech-stacked{flex-direction:column!important;align-items:stretch;gap:12px!important;width:min(540px,100%)}.speech-stacked .dialogue-bubble{margin-bottom:0;padding:15px 17px;border-radius:32px 36px 30px 35px}.speech-stacked .dialogue-avatar{flex-basis:auto;align-self:flex-end}.speech-stacked[data-dialogue-side="left"] .dialogue-avatar{align-self:flex-start}
.speech-stacked .dialogue-bubble:before,.speech-stacked .dialogue-bubble:after{bottom:-19px;left:auto!important;right:65px!important;transform:rotate(45deg)}.speech-stacked[data-dialogue-side="left"] .dialogue-bubble:before,.speech-stacked[data-dialogue-side="left"] .dialogue-bubble:after{left:65px!important;right:auto!important}.speech-stacked .dialogue-bubble:after{bottom:-14px}
#modal-root .dialogue-scene.speech-compact{gap:12px!important}.speech-compact .dialogue-bubble{margin-bottom:7px;padding:12px 15px;gap:8px}.speech-compact .dialogue-name{display:none}.speech-compact #dialog-title{font-size:14px!important;margin:0!important}.speech-compact .tutorial-step{display:block;margin-left:0}
.speech-compact .speech-pager{width:100%;flex-wrap:nowrap;gap:8px;min-height:48px}.speech-compact .speech-pager>span{font-size:13px}.speech-compact .dialogue-actions>button{font-size:16px!important;padding:8px 10px!important}.speech-compact .dialogue-actions .kid-label{font-size:16px!important}
#modal-root .speech-compact .dialogue-actions>button:not(.kid-action){padding:4px!important}
.speech-response-short{display:none}.speech-compact .speech-response-full{display:none}.speech-compact .speech-response-short{display:inline}
@media(max-width:360px){.dialogue-scene .speech-response-full{display:none}.dialogue-scene .speech-response-short{display:inline}}
.speech-content label:has(>input){display:flex;align-items:center;gap:8px;min-width:0}.speech-content label>input{flex:1;width:0;min-width:56px;max-width:100%}
/* Spatial examples keep their window controls beside the board. Main paging
   and the real action share the header when the available height is small. */
.speech-board-scene .speech-heading{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
#modal-root .speech-board-scene .speech-header{gap:4px;justify-content:flex-end;flex-wrap:wrap}
#modal-root .speech-board-scene .dialogue-actions{display:flex!important}
#modal-root .speech-board-scene .speech-header .dialogue-actions>button{width:56px!important;min-width:56px!important;max-width:56px!important;flex:0 0 56px!important;min-height:56px!important;padding:0!important}
#modal-root .speech-board-scene .speech-header .dialogue-actions .kid-label,.speech-board-scene .speech-header .dialogue-actions .control-label{display:none!important}
#modal-root .speech-board-scene .speech-header .dialogue-actions .toy-face{min-height:50px!important;padding:7px!important}
#modal-root .speech-board-scene .speech-pager{position:relative;width:auto!important;flex:none;gap:4px;min-height:56px}
.speech-board-scene .speech-pager>span{position:absolute;left:50%;top:0;transform:translate(-50%,-50%);background:#fff9e9;border-radius:8px;padding:0 4px;font-size:13px;line-height:18px;pointer-events:none;white-space:nowrap}
.speech-board-scene .speech-content .fit-pager{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;min-height:0;padding:0;align-items:center;width:100%}
.speech-board-scene .speech-content .fit-position{grid-column:1/3;grid-row:1;text-align:left;font-size:13px;line-height:1.25;padding-right:0}
.speech-board-scene .speech-content .fit-overview{position:relative!important;grid-column:3;grid-row:1;justify-self:center}
.speech-board-scene .speech-content .fit-axis{grid-column:1;grid-row:2}.speech-board-scene .speech-content .fit-pager button{grid-row:2}
.speech-board-scene .speech-content .fit-pager button,.speech-board-scene .speech-content .fit-axis{min-width:0;width:100%;min-height:56px;padding:6px}
body.large-text .speech-board-scene .speech-content .fit-position{font-size:16px}
#modal-root .speech-board-scene .speech-content .solid-net.fit-region .net-piece{height:calc(var(--fit-cell,56px) + 16px)!important;min-height:calc(var(--fit-cell,56px) + 16px)!important}
#modal-root .speech-board-scene .speech-content .fit-region{padding:0!important;margin:0!important}
.speech-board-scene .speech-content{gap:4px}.speech-board-scene .speech-content .fit-overview{max-height:none;max-width:none}
@media(max-width:520px){#modal-root .modal-backdrop:has(.dialogue-scene){padding:10px!important}#modal-root .dialog.child-dialog.dialogue-scene{max-height:calc(var(--view-height,100dvh) - 20px)!important}.dialogue-name{font-size:18px}.speech-content{font-size:20px}.speech-header{gap:5px}.dialogue-actions{gap:8px}.dialogue-actions>button.brotemar-control{font-size:16px!important;padding:8px!important}}
@media(prefers-reduced-motion:reduce){.dialogue-avatar *{animation:none!important}}

/* Distinct contours for the paired decisions, always at the bottom of the bubble. */
#modal-root .dialogue-actions{display:flex!important;margin-top:auto!important;order:3;align-items:stretch}
#modal-root .dialogue-actions>button[data-dialogue-action="primary"]{--object-shape:24px 36px 24px 8px;--toy-radius:24px 36px 24px 8px}
#modal-root .dialogue-actions>button[data-dialogue-action="secondary"]{--object-shape:50%;--toy-radius:50%}
#modal-root .dialogue-actions>button[data-dialogue-action]>.toy-face{border-radius:var(--object-shape)!important}
#modal-root .dialogue-actions>button[data-dialogue-action="secondary"]{flex:.85 1 0!important}

@media(max-width:380px){
 #modal-root .dialogue-actions>button[data-dialogue-action]{flex:1 1 0!important}
 #modal-root .dialogue-actions .kid-action .icon{display:none!important}
 #modal-root .dialogue-actions>.kid-action>.toy-face{gap:0!important;padding:8px!important}
}

/* Route choices share the middle row with paging in short viewports. Keep the
   given text/targets and the real footer actions inside the speech bubble. */
#modal-root .modal-practice-routes .speech-content>.kid-action{width:100%!important;height:auto!important;min-height:56px!important;padding:0 0 6px!important}
#modal-root .modal-practice-routes .speech-content>.kid-action>.toy-face{position:relative!important;inset:auto!important;width:100%!important;height:auto!important;min-height:50px!important;display:flex!important;flex-direction:row!important;gap:8px!important;padding:7px 10px!important}
#modal-root .modal-practice-routes .speech-content>.kid-action .kid-label{display:block!important;position:static!important;width:auto!important;height:auto!important;clip:auto!important;white-space:normal!important;font-size:18px!important;line-height:1.2!important}
body.large-text #modal-root .modal-practice-routes .speech-content>.kid-action .kid-label{font-size:20px!important}
#modal-root .modal-practice-routes .speech-content>.kid-action .icon{width:28px!important;height:28px!important;flex:none}
#modal-root .speech-side-pager .dialogue-bubble{display:grid;grid-template-columns:minmax(0,1fr) 128px;grid-template-rows:auto auto auto}
#modal-root .speech-side-pager .speech-header{grid-column:1/-1;grid-row:1}
#modal-root .speech-side-pager .speech-content{grid-column:1;grid-row:2}
#modal-root .speech-side-pager .speech-pager{grid-column:2;grid-row:2;display:grid;grid-template-columns:56px 56px;gap:8px;align-self:center;justify-content:center;position:relative;width:128px}
#modal-root .speech-side-pager .speech-pager>span{position:absolute;top:0;left:0;right:0;text-align:center;line-height:18px;font-size:13px;pointer-events:none}
#modal-root .speech-side-pager .speech-pager>button{min-height:56px;height:56px;padding:16px 0 0}
#modal-root .speech-side-pager .dialogue-actions{grid-column:1/-1;grid-row:3}
#modal-root .speech-side-pager .dialogue-actions>button[data-dialogue-action]{flex:1 1 0!important}
#modal-root .speech-side-pager .dialogue-actions .icon{display:none!important}
