/* Loaded last. This is one viewport, not a draggable/floating number pad.
   JavaScript activates it only for numeric answers at compact/touch sizes. */
body.numeric-workspace{overflow:hidden;overscroll-behavior:none}
body.numeric-workspace .screen[data-numeric-active]{position:fixed;z-index:30;inset:var(--numeric-visible-top,0px) 0 auto;display:flex;flex-direction:column;width:100%;max-width:none;height:var(--numeric-visible-height,100dvh);margin:0;padding:max(.4rem,env(safe-area-inset-top)) max(.65rem,env(safe-area-inset-right)) 0 max(.65rem,env(safe-area-inset-left));box-sizing:border-box;background:var(--paper);overflow:hidden;min-height:0}
body.studio-app.numeric-workspace .screen[data-numeric-active]{background:var(--studio-sky)}
body.numeric-workspace .screen[data-numeric-active]>.active-game-title{flex:none;margin:0;text-align:center;font-size:1rem;line-height:1.25;letter-spacing:0}
body.numeric-workspace .screen[data-numeric-active]>.play-top{flex:none;gap:.3rem;flex-wrap:wrap;margin:0;padding:0;min-height:44px;font-size:.8rem}
body.numeric-workspace .screen[data-numeric-active]>.play-top button{min-height:44px;padding:.3rem .45rem;font-size:.8rem;white-space:normal}
body.numeric-workspace .screen[data-numeric-active]>.play-top .score{font-size:.75rem}
body.numeric-workspace .screen[data-numeric-active]>.play-top .score b{font-size:1rem}
body.numeric-workspace :is(#gameContent,#gameBoard,#longLayout).numeric-layout{display:flex;flex:1 1 0;flex-direction:column;min-height:0;width:100%;max-width:none;margin:0;padding:0;gap:0;overflow:hidden}
body.numeric-workspace .numeric-layout>:not(.numeric-shell){display:none!important}
body.numeric-workspace .numeric-shell{display:flex;flex:1 1 0;flex-direction:column;min-height:0;overflow:hidden;width:100%;max-width:760px;margin-inline:auto}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll{flex:1 1 0;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scroll-padding:.75rem;padding:.4rem .25rem .75rem}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll:focus-visible{outline-offset:-3px}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll :is(.question-panel,.adventure-question){min-height:0;padding:.6rem .75rem;border-radius:18px}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll #gameDisplay{font-size:clamp(1.4rem,5vw,2.25rem);line-height:1.3;overflow-wrap:anywhere;word-spacing:normal}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll #gamePrompt{font-size:1rem;line-height:1.4;margin:.2rem 0 .6rem}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll .equation{font-size:2.5rem;line-height:1.08;max-width:200px;width:100%}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll .answer{min-height:1.5em;font-size:inherit}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll :is(#feedback,#gameFeedback,#longFeedback){height:auto;min-height:1.4em;margin:.4rem 0;font-size:.85rem;line-height:1.4}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll #mathInputHint{display:block;margin:.4rem;text-align:center;font-size:.8rem;line-height:1.35}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll .timer-label{display:none}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll #timer{font-size:1.1rem;margin:0}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll .timer-track{margin:.3rem auto .5rem}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll .listen-row{margin:.4rem 0;gap:.4rem;flex-wrap:wrap}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll #gameResponse{min-height:1.5em;margin:.4rem 0;font-size:1.6rem}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll #longPrompt{font-size:1.1rem;margin:.6rem 0 .3rem}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll #longHelp{font-size:.85rem;line-height:1.4;margin:.3rem 0}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll .long-answer{font-size:1.8rem;min-height:1.4em;margin:.4rem auto}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock{flex:none;position:relative;touch-action:manipulation;padding:.5rem .25rem max(.75rem,env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--paper);width:100%;min-width:0}
body.studio-app.numeric-workspace .numeric-dock{background:var(--studio-sky)}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock .keypad-panel{padding:0}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock :is(.keypad-title,.keyboard-note){display:none}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock :is(.keypad,#gameChoices.number-choices){display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.35rem;margin:0;width:100%;max-width:none}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock :is(.keypad button,#gameChoices button){height:44px;min-height:44px;min-width:0;width:100%;padding:.2rem .4rem;font-size:1.2rem;line-height:1.15;box-shadow:none;touch-action:manipulation}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock .keypad .utility{font-size:.8rem}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock .answer-tools{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,2fr);gap:.35rem;margin:.35rem 0 0}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock :is(#check,#gameSubmit,#longCheck){position:static;inset:auto;transform:none;display:flex;width:100%;max-width:none;min-height:48px;margin:.35rem 0 0;padding:.45rem .6rem;box-shadow:none;font-size:1rem;line-height:1.25;gap:.3rem}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock #gameSubmit{margin:0}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock .answer-tools .secondary{min-height:48px;min-width:0;padding:.4rem .2rem;font-size:.8rem}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock :is(button,summary){scroll-margin:0}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock #longDone{text-align:center}
body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock #longDone .long-product{font-size:1.3rem;margin:.4rem}
@media(max-height:34rem){
 body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock :is(.keypad,#gameChoices.number-choices){grid-template-columns:repeat(6,minmax(0,1fr));gap:.25rem}
 body.numeric-workspace .screen[data-numeric-active]>.active-game-title{font-size:.85rem}
 body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll .equation{font-size:2rem}
 body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-question-scroll :is(.question-panel,.adventure-question){padding:.35rem .6rem}
}

/* Correct-answer feedback remains above the full-viewport activity shell. */
body.numeric-workspace .celebration{z-index:35}
/* The guided controller still owns its existing right/wrong state. */
body.numeric-workspace #longLayout>.long-controls.wrong~.numeric-shell #longFeedback{color:#8b3b21;background:#f4d3b8;padding:8px;border-radius:10px}
body.numeric-workspace #longLayout>.long-controls.right~.numeric-shell #longFeedback{color:#23543b}

/* VisualViewport can be shorter than the layout viewport when browser chrome
   expands. Use measured height, not just orientation/media-query height. */
html[data-number-short=true] body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock :is(.keypad,#gameChoices.number-choices){grid-template-columns:repeat(6,minmax(0,1fr));gap:.25rem}
html[data-number-tiny=true] body.numeric-workspace .screen[data-numeric-active]>.active-game-title{display:none}
html[data-number-tiny=true] body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock,
html[data-number-tiny=true] body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock .keypad-panel{display:grid;grid-template-columns:minmax(0,1fr) 150px;gap:.5rem;align-items:stretch}
html[data-number-tiny=true] body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock:has(.keypad-panel){display:block}
html[data-number-tiny=true] body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock #gameChoices.number-choices{grid-template-columns:repeat(5,minmax(0,1fr))}
html[data-number-tiny=true] body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock .answer-tools{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:44px 44px;margin:0;gap:.25rem}
html[data-number-tiny=true] body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock .answer-tools .secondary{min-height:44px}
html[data-number-tiny=true] body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock #gameSubmit{grid-column:1/-1;min-height:44px}
html[data-number-tiny=true] body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock :is(#check,#longCheck){height:100%;margin:0;min-height:44px}
html[data-number-tiny=true] body.numeric-workspace :is(#play,#gamePlay,#longPlay) .numeric-dock #longDone{grid-column:1/-1}
