@media(max-width:639px){
/* Mobile layout: readable square and one finale word per line. */
body.playing-mode,body.final-mode{overflow:auto!important}
.playing-mode .shell,.final-mode .shell{height:auto!important;min-height:100dvh;max-width:580px!important;padding:0 8px 8px!important}
.playing-mode #game:not([hidden]),.final-mode #game:not([hidden]){display:flex!important;flex-direction:column;overflow:visible!important;gap:6px;flex:none!important}
.playing-mode #play{height:auto!important;min-height:0;padding:0;overflow:visible!important;flex:none}
.playing-mode .board-area,.playing-mode .board-frame{height:auto!important}
.playing-mode .board-frame{display:block;padding:4px}
.playing-mode .board-scroll{aspect-ratio:1;min-height:0;max-height:none!important;height:auto!important;padding:2px;display:flex;align-items:center;justify-content:center;overflow:auto!important}
.playing-mode #board{margin:auto}
.playing-mode #controls{display:block!important;max-height:none!important;overflow:visible!important;padding:0}
.playing-mode .word-selectors{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;margin:0}
.playing-mode .word-selectors button{height:32px;min-height:32px;font-size:18px;padding:2px}
.playing-mode #help-panel{display:grid!important;grid-template-columns:90px minmax(0,1fr);align-items:center;gap:4px;padding:3px 0}
.playing-mode #help-panel .question-top{display:block!important}
.playing-mode .word-pattern{margin:0;justify-content:flex-start}
.playing-mode .word-pattern .word-tile{height:30px;min-height:30px;width:27px;flex-basis:27px;font-size:21px}
.playing-mode #question{grid-column:1/-1;font-size:14px;margin:0;padding:2px 0}
.playing-mode .direct-help{display:flex!important;flex-direction:row!important;position:static;gap:4px;margin:0;padding:0}
.playing-mode .direct-help .secondary{flex:1;width:auto;min-height:36px;font-size:13px;padding:3px;display:flex;flex-direction:row;justify-content:center;gap:3px}
.playing-mode .game-heading h1{font-size:18px;line-height:1.25;margin:0}
.playing-mode .game-heading .host-avatar{width:32px;height:40px}
.playing-mode .round-toolbar{height:28px;min-height:28px;margin:2px 0}
.playing-mode .round-toolbar #size{min-height:28px;height:28px;padding:2px 8px}
.playing-mode #game-keyboard,.final-mode #game-keyboard{position:static!important;margin:0;width:100%;flex:none;align-self:stretch}
#game-keyboard #entry{margin:0}
#game-keyboard .input-row input,#game-keyboard .input-row button{height:42px!important;min-height:42px!important}
.keyboard-tools{height:28px;min-height:28px}
#keyboard-keys{gap:3px;--keyboard-gap:3px;--keyboard-letter-size:21px;--keyboard-polish-size:17px}
.keyboard-row button{height:36px!important;min-height:36px!important}
.final-mode #final{padding:8px 0!important;overflow:visible!important;flex:none;margin:0}
.final-mode #final-pattern{display:flex!important;flex-direction:column!important;align-items:center!important;gap:9px!important;margin:16px 0!important;--final-cell:clamp(32px,8.8vw,42px)}
.final-mode #final-pattern .phrase-word{display:flex;flex-wrap:nowrap;justify-content:center;gap:4px;max-width:100%;white-space:nowrap}
.final-mode #final-pattern .word-tile{width:var(--final-cell)!important;flex:0 0 var(--final-cell)!important;height:calc(var(--final-cell)*1.12)!important;font-size:clamp(25px,7vw,33px)!important;border-radius:5px}
.final-mode #final-pattern .space-tile{display:none!important}
.final-mode #final-question{font-size:19px;line-height:1.3;margin:12px 0}
.final-mode #final-message:empty{display:none}
.final-mode #final-hint{min-height:42px;margin-top:6px}
.final-mode .final-top h2{font-size:25px!important}.final-mode .final-clock span{font-size:36px!important}
.final-mode #bonus{font-size:14px;margin:8px 0}
.final-mode #bank-description{font-size:14px;margin:4px 0}
@media(max-width:359px){.final-mode #final-pattern{--final-cell:31px}.final-mode #final-pattern .phrase-word{gap:3px}.playing-mode .direct-help .secondary{font-size:12px}}

.final-mode #final-pattern .phrase-word{overflow-x:auto;justify-content:safe center}

}
.final-mode #final-pattern{display:flex;flex-direction:column;align-items:center;gap:9px}
.final-mode #final-pattern .space-tile{display:none}

/* Readable mobile inputs: legacy 8–9px top padding clipped the glyphs. */
.playing-mode #board .tile input{
 display:block;box-sizing:border-box;width:100%;height:100%;min-height:0;
 margin:0!important;padding:0!important;line-height:normal!important;
 font-size:var(--letter-size)!important;text-align:center;
 appearance:none;-webkit-appearance:none;
}
@media(max-width:639px){
 .playing-mode .board-scroll{justify-content:safe center;align-items:safe center}
 .playing-mode .game-heading h1{font-size:20px;line-height:1.25}
 .playing-mode .round-toolbar{height:36px;min-height:36px;margin:4px 0}
 .playing-mode .word-selectors button{height:40px;min-height:40px;font-size:20px}
 .playing-mode #help-panel{grid-template-columns:62px minmax(0,1fr);gap:6px;padding:6px 0}
 .playing-mode .word-pattern{display:flex;flex-wrap:nowrap;overflow-x:auto;min-width:0;padding:2px 1px 4px}
 .playing-mode .word-pattern .word-tile{width:32px;flex:0 0 32px;height:36px;min-height:36px;font-size:24px;padding:0}
 .playing-mode #question{font-size:16px;line-height:1.4}
 .playing-mode .direct-help .secondary{min-height:44px;font-size:14px;padding:6px}
 .keyboard-row button{height:42px!important;min-height:42px!important}
 .keyboard-row.polish-row button{height:36px!important;min-height:36px!important}
 .playing-mode .board .start-number{font-size:8px;line-height:1;top:1px;left:1px}
}
@media(max-width:639px){
 /* Word numbers remain on the large selectors below the board. */
 .playing-mode #board .start-number{display:none}
}

/* Touch controls: persistent game keyboard and unambiguous word selection. */
.playing-mode #show-question,.playing-mode #question,.playing-mode #word-pattern,
.playing-mode #word-length,.playing-mode #check,.keyboard-tools,
#keyboard-return,#final-keyboard-return{display:none!important}
.playing-mode #help-panel{display:block!important;padding:5px 0!important}
.playing-mode #word-label{font:700 15px/1.3 Inter;margin:0;color:#ffe7a5}
.playing-mode #board .tile{touch-action:manipulation}
.playing-mode #board .tile.active-word{outline:2px solid #ff46bd!important;outline-offset:0;box-shadow:inset 0 0 0 2px #ff46bd!important;background:#ffe8f7!important;z-index:1}
.playing-mode #board .tile.active-word input{color:#321035!important;-webkit-text-fill-color:#321035!important}
.playing-mode #board .tile:not(.active-word){outline:none!important}
#keyboard-keys .keyboard-polish{display:none!important}
@media(max-width:639px){
 .playing-mode #game-keyboard,.final-mode #game-keyboard{position:sticky!important;bottom:0;z-index:30;background:#100a19;padding:6px 0 max(6px,env(safe-area-inset-bottom));margin-top:4px}
 .playing-mode .word-selectors button{font-size:17px!important;min-height:36px;height:36px}
 .playing-mode .direct-help .secondary{font-size:13px;min-height:40px}
 .playing-mode #board{margin:auto}
 .keyboard-row button{height:42px!important;min-height:42px!important;padding:3px!important}
 #game-keyboard #message:empty{display:none}
 #game-keyboard #message{font-size:13px;margin:2px 0}
 .playing-mode .game-heading h1{font-size:20px!important;line-height:1.2}
}

@media(max-width:639px){.playing-mode .compact-header{display:none!important}.playing-mode #game-keyboard #controls{margin:0 0 5px}.playing-mode #game-keyboard .word-selectors{margin:0 0 3px}}

/* Compact word navigation; retain full-size keys and a real space bar. */
.playing-mode #help-panel{display:none!important}
.playing-mode #selectors{display:flex!important;flex-wrap:nowrap!important;justify-content:center;gap:4px!important;margin:3px auto 6px!important;width:100%}
.playing-mode #selectors button{flex:0 1 32px!important;width:32px!important;min-width:24px!important;height:32px!important;min-height:32px!important;font-size:14px!important;padding:2px!important}
#keyboard-keys .keyboard-space{display:grid;grid-template-columns:1fr;width:60%;margin:0 auto}
#keyboard-keys .keyboard-space button{height:42px!important;min-height:42px!important;font-size:15px!important}
#keyboard-note{font:400 12px/1.3 Inter,sans-serif;color:#c4b2d2;text-align:center;margin:3px 0}
