/* Size the play area to browser space, not the phone's physical screen. */
@media(max-width:639px),(max-height:500px) and (max-width:980px){
 body.playing-mode,body.final-mode{height:var(--screen-height,100dvh)!important;min-height:0!important;overflow:hidden!important}
 .playing-mode .shell,.final-mode .shell{height:var(--screen-height,100dvh)!important;min-height:0!important;max-height:var(--screen-height,100dvh)!important;max-width:980px!important;display:flex;flex-direction:column;padding:env(safe-area-inset-top) max(8px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px,env(safe-area-inset-left))!important;overflow:hidden!important}
 .playing-mode .compact-header,.final-mode .compact-header,.playing-mode .format-title,.final-mode .format-title,.playing-mode .producer,.final-mode .producer{display:none!important}
 .playing-mode #game:not([hidden]),.final-mode #game:not([hidden]){height:100%!important;min-height:0!important;flex:1!important;display:flex!important;flex-direction:column;gap:4px!important;overflow:hidden!important}
 .playing-mode .lower-panel,.final-mode .lower-panel{display:contents!important}
 .playing-mode #game-heading{flex:none;padding:2px 0!important}
 .playing-mode .game-heading h1{font-size:20px!important;line-height:1.15!important;max-height:70px;overflow:auto;margin:0!important}
 .playing-mode .round-toolbar{height:30px!important;min-height:30px!important;margin:0!important}
 .playing-mode #play{flex:1 1 0!important;min-height:60px!important;height:0!important;overflow:hidden!important}
 .playing-mode .board-area,.playing-mode .board-frame{height:100%!important;min-height:0!important}
 .playing-mode .board-frame{padding:3px!important;box-shadow:none!important}
 .playing-mode .board-scroll{height:100%!important;max-height:100%!important;aspect-ratio:auto!important;align-items:safe center!important;justify-content:safe center!important;overflow:auto!important;overscroll-behavior:contain;touch-action:pan-x pan-y;-webkit-overflow-scrolling:touch}
 .playing-mode #board{margin:auto!important;flex:none}
 .playing-mode #game-keyboard,.final-mode #game-keyboard{position:relative!important;bottom:auto!important;flex:none!important;width:100%!important;min-width:0;margin:0!important;padding:3px 0!important;align-self:stretch}
 .playing-mode #game-keyboard #controls{margin:0 0 3px!important}
 .playing-mode #selectors{margin:0 0 3px!important}
 .playing-mode #entry,.final-mode #final-form{margin:0!important}
 .playing-mode #game-keyboard #message{max-height:32px;overflow:auto}
 .final-mode #final{flex:1 1 0!important;height:0!important;min-height:60px!important;overflow:auto!important;margin:0!important;padding:8px!important;overscroll-behavior:contain}
 .final-mode #final-pattern{margin:10px 0!important}
 #keyboard-note{margin:2px 0!important}
 #keyboard-keys{gap:3px!important;--keyboard-gap:3px}
 .keyboard-row button{height:42px!important;min-height:42px!important}
}
@media(max-height:500px) and (min-width:640px) and (max-width:980px){
 .playing-mode #game:not([hidden]),.final-mode #game:not([hidden]){display:grid!important;grid-template-columns:minmax(0,1fr) minmax(330px,1fr);grid-template-rows:auto minmax(0,1fr);column-gap:10px!important}
 .playing-mode #game-heading{grid-column:1;grid-row:1}
 .playing-mode #play{grid-column:1;grid-row:2;height:100%!important}
 .playing-mode #game-keyboard,.final-mode #game-keyboard{grid-column:2;grid-row:1 / 3;align-self:center;max-height:100%;overflow:auto}
 .final-mode #final{grid-column:1;grid-row:1 / 3;height:100%!important}
}
@media(max-height:520px) and (max-width:639px){
 .playing-mode .game-heading h1{font-size:18px!important;line-height:1.12!important;max-height:42px}
 .playing-mode .round-toolbar{height:24px!important;min-height:24px!important}
 .playing-mode #game:not([hidden]){gap:2px!important}
}
@media(max-width:639px),(max-height:500px) and (max-width:980px){
 body.playing-mode:not(.viewing-page) .legal-links,body.final-mode:not(.viewing-page) .legal-links{display:none!important}
 .mobile-game-info{padding:2px 7px!important;min-width:28px;min-height:28px!important;height:28px;font-size:18px;color:#ffe7a5}
 body.viewing-page{height:auto!important;overflow:auto!important}
 body.viewing-page .shell{height:auto!important;max-height:none!important;min-height:100dvh!important;overflow:visible!important}
 body.viewing-page .compact-header{display:flex!important}
 body.viewing-page .legal-links{display:flex!important}
 body.viewing-page #rules,body.viewing-page #history{overflow:visible!important}
}
@media(max-height:520px) and (max-width:639px){#keyboard-note{line-height:1!important;margin:0!important}}

/* Optional Polish letters share the same keys; no extra keyboard row. */
#keyboard-note{display:none!important}
#keyboard-keys .keyboard-space{width:100%!important;grid-template-columns:56px minmax(0,1fr) 56px!important;gap:4px!important}
#keyboard-keys .keyboard-space::after{content:''}
#polish-toggle{font-size:16px!important}
#polish-toggle[aria-pressed="true"]{background:#f6cd62!important;color:#291032!important}
#word-input::placeholder,#final-input::placeholder{font:400 13px/1.2 Inter,sans-serif!important;letter-spacing:-.2px}
@media(max-width:359px){#word-input::placeholder,#final-input::placeholder{font-size:12px!important}}
