/* Number tiles are sized by available width, never by leftover viewport height. */
.game-layout .thinking-board{container-type:inline-size;min-height:0;overflow:visible}
.game-layout .thinking-board .note-grid{flex:none;min-height:auto;grid-template-columns:repeat(12,minmax(0,1fr));grid-template-rows:none;grid-auto-rows:auto;gap:5px;margin-top:10px;align-items:start}
.game-layout .thinking-board .note-grid .tile{width:100%;height:auto;min-height:0;max-height:none;max-width:80px;aspect-ratio:1/1.04;justify-self:center;touch-action:manipulation}
@container(max-width:579px){
 .game-layout .thinking-board .note-grid{grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}
 .game-layout .thinking-board .note-grid .tile{max-width:72px}
}
@media(min-width:900px){
 .playing main#app{height:auto;min-height:calc(100dvh - 62px);overflow:visible}
 .playing .game-layout{height:auto;min-height:0;align-items:start}
 .playing .game-center{height:auto;display:grid;grid-template-rows:auto auto auto auto;min-height:0}
 .game-sidebar{height:auto;align-self:start;position:sticky;top:10px}
 .game-sidebar .chat{max-height:250px;flex:none}
 .game-sidebar .messages{height:140px;max-height:140px;flex:none}
 .game-layout .thinking-board{min-height:0}
 .game-center>.restored-clues{min-height:85px;max-height:180px}
 .game-center>.restored-clues .clue-scroll{max-height:140px}
}
/* A wide, short screen puts choices beside the numbers rather than above them. */
@media(min-width:1280px){
 .playing main#app{padding:7px 12px 12px}
 .playing .game-layout{grid-template-columns:96px minmax(0,1fr) 190px;gap:9px}
 .playing .game-center{display:grid;grid-template-columns:minmax(580px,1fr) minmax(260px,.48fr);grid-template-rows:auto auto auto;gap:8px;height:auto}
 .game-center>.opponents{grid-column:1;grid-row:1;align-self:start}
 .game-center>.opponents{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}
 .playing:not(.double-rack-mode) .opponents .player>.rack{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));max-width:250px;margin:auto;gap:4px}
 .playing:not(.double-rack-mode) .opponents .player>.rack>.tile{width:100%;max-width:44px;justify-self:center}
 .game-center>.thinking-board{grid-column:1;grid-row:3;align-self:start}
 .game-center>.table{grid-column:2;grid-row:1/4;align-self:start;position:sticky;top:6px;display:flex;flex-direction:column;justify-content:center}
 .game-center>.restored-clues{grid-column:1;grid-row:2;min-height:70px;max-height:110px}
 .game-layout .table .revealed-rack{gap:9px;display:grid;grid-template-columns:repeat(3,1fr);justify-items:center;margin:10px 0}
 .game-layout .table .revealed-rack>.tile{width:clamp(46px,4vw,62px)}
 .game-layout .table .clue-methods{flex-direction:row;gap:6px;flex-wrap:nowrap}
 .game-layout .table .clue-methods button{width:auto;min-width:0;padding:6px}
 .game-layout .pile-panel{padding:7px 5px}
 .game-layout .tile-pile{scale:.55;height:160px}
 .game-layout .pile-panel .supply{gap:4px}
 .game-layout .pile-panel .supply button{width:100%;padding:5px 2px}
 .game-layout .own-rack .secret-entries{gap:3px}
 .game-layout .own-rack .secret-face .tile{width:28px}
 .game-layout .own-rack .secret-entry input{width:100%;min-width:0;font-size:17px}
 .game-layout .thinking-board .notes-head{flex-wrap:wrap}
 .game-layout .thinking-board .legend{flex-wrap:wrap;font-size:11px;gap:5px}
}
@media(min-width:1280px) and (max-height:650px){
 .playing header{height:48px;min-height:48px;padding:4px 14px}
 .playing .room-toolbar{min-height:20px;margin-bottom:5px}
 .playing .room-toolbar .pill{font-size:10px;padding:3px 6px}
 .game-layout .opponents .clue-history{margin-top:3px}
 .game-layout .opponents .public-clues>summary{padding:1px 0;min-height:15px;line-height:13px;font-size:10px}
 .game-layout .opponents .player>.rack>.tile{max-width:32px;width:32px}
 .game-layout .opponents .player{padding:5px 7px}
 .game-layout .opponents .player h3{margin-bottom:3px}
 .game-center>.restored-clues{min-height:65px;max-height:74px;padding:5px 9px}
 .game-center>.restored-clues .clue-scroll{max-height:52px;overflow:auto}
 .game-center>.restored-clues .clue-panel-title h3{font-size:13px}
 .game-center>.restored-clues .clue-lane{padding:3px 0}
 .game-center>.restored-clues .clue-scroll>p{display:none}
 .game-layout .thinking-board .notes-head .small,.game-layout .thinking-board .legend{display:none}
 .game-layout .thinking-board .notes-head h2{font-size:15px}
 .game-layout .thinking-board{padding:7px 10px}
 .game-layout .thinking-board .note-grid{margin-top:6px;gap:4px}
 .game-layout .thinking-board .notes-head button{min-height:28px}
}
@media(min-width:900px) and (max-width:1279px){
 .game-center>.table{position:sticky;top:6px;z-index:8;box-shadow:0 5px 22px #160d25aa}
}
@media(max-width:899px){
 .game-layout .thinking-board .note-grid{grid-template-columns:repeat(12,minmax(0,1fr));gap:5px}
 .game-layout .thinking-board .notes-head{flex-wrap:wrap}
 .game-layout .thinking-board .legend{display:flex;flex-wrap:wrap;font-size:11px}
 .game-center>.table{position:sticky;top:0;z-index:8;box-shadow:0 5px 18px #160d2570}
}
@media(max-width:660px){
 .game-layout .thinking-board .note-grid{grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}
}
/* Keep the explanation inside a compact, touch-friendly action button. */
#categorise.illustrated-method,#compare.illustrated-method{display:grid;grid-template-columns:68px minmax(0,1fr);grid-template-rows:auto auto;column-gap:6px;row-gap:2px;min-width:0;min-height:54px;padding:7px 8px;border-radius:12px;text-align:left}
.illustrated-method .method-picture{grid-column:1;grid-row:1/3;align-self:center;height:28px;gap:3px;width:68px}
.illustrated-method .method-name{grid-column:2;font-size:13px;align-self:end;overflow-wrap:anywhere}
.illustrated-method>small{grid-column:2;font-size:10px;line-height:1.2;align-self:start;overflow-wrap:anywhere}
.illustrated-method .demo-face{width:16px;height:21px;border-radius:5px}
.illustrated-method .demo-face:before,.illustrated-method .demo-face:after{top:4px;width:5px;height:6px}
.illustrated-method .demo-face:before{left:2px}.illustrated-method .demo-face:after{right:2px}
.illustrated-method .demo-gap{width:20px;height:22px;border-radius:5px;font-size:12px}
.illustrated-method .demo-gap b{top:-9px;font-size:10px}
.illustrated-method .gap-picture>.blue-face,.illustrated-method .demo-direction{display:none}
.illustrated-method .demo-number{width:21px;height:25px;border-radius:5px;font-size:13px}
.illustrated-method .demo-number small{font-size:6px;letter-spacing:0;margin-top:2px}
.illustrated-method .demo-match{font-size:12px;white-space:nowrap}
.illustrated-method .secret-demo{width:21px;height:25px;padding-bottom:2px}
.illustrated-method .secret-demo b{font-size:10px}.illustrated-method .secret-demo small{font-size:6px}
@media(min-width:1280px){
 #categorise.illustrated-method,#compare.illustrated-method{grid-template-columns:53px minmax(0,1fr);min-height:64px;column-gap:4px}
 .game-layout .table .illustrated-method .method-picture{grid-row:1;zoom:.78}
 .game-layout .table .illustrated-method .method-name{grid-row:1;font-size:11px;align-self:center}
 .game-layout .table .illustrated-method>small{grid-column:1/-1;grid-row:2;text-align:center;font-size:9px;align-self:center}
}


/* Saved clues remain fully visible, including multiple clues in a gap. */
.game-center>.restored-clues{min-height:0;max-height:none;overflow:visible;height:auto;padding:7px 10px;align-self:start}
.game-center>.restored-clues .clue-scroll{flex:none;min-height:0;height:auto;max-height:none;overflow:visible;margin:0}
.game-center>.restored-clues .clue-lane{min-width:0;padding:4px 0;gap:3px;align-items:center}
.game-center>.restored-clues .saved-gap{min-height:24px;padding:1px;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:center;gap:3px;background:none}
.game-center>.restored-clues .saved-gap .saved-number{width:24px;max-width:100%;flex:none}
.game-center>.restored-clues .clue-face{max-width:32px}
.game-center>.restored-clues .clue-scroll>p{display:none}
.double-rack-mode .game-center>.restored-clues .ten-clue-lane{grid-template-columns:repeat(11,minmax(0,1fr));min-width:0;width:100%;gap:5px 2px}
.double-rack-mode .game-center>.restored-clues .ten-clue-lane:before{content:'\21B3';grid-row:2;grid-column:1;color:var(--accent);text-align:center}
.double-rack-mode .game-center>.restored-clues .ten-clue-lane>.clue-colour:nth-child(12){grid-row:2;grid-column:2}
@media(min-width:1280px){
 .playing .game-center{grid-template-rows:auto auto}
 .game-center>.restored-clues{grid-column:1;grid-row:1;max-height:none;min-height:0;align-self:end}
 .game-center>.thinking-board{grid-column:1;grid-row:2}
 .game-center>.opponents{grid-column:2;grid-row:1;grid-template-columns:1fr;max-height:180px;min-height:0;overflow:auto}
 .game-center .opponents .public-clue-board{position:fixed;top:100px;left:50%!important;right:auto!important;transform:translateX(-50%);max-width:calc(100vw - 30px);z-index:50}
 .game-center>.table{grid-column:2;grid-row:2;align-self:start;padding:6px}
 .game-layout .table .revealed-rack>.tile{width:46px}
 .game-layout .table .revealed-rack{gap:6px;margin:7px 0}
 .game-layout .table .status{font-size:12px}
 .double-rack-mode .opponents .player>.rack{grid-template-columns:repeat(5,minmax(0,1fr));max-width:230px;gap:3px}
 .game-layout .opponents .player>.rack>.tile{width:32px;max-width:32px;justify-self:center}
}

@media(min-width:1280px) and (max-height:650px){.game-center>.opponents{max-height:135px;overflow:auto;min-height:0}}
@media(min-width:1280px) and (max-height:650px){
 .game-layout .table .revealed-rack{grid-template-columns:repeat(6,minmax(0,1fr));gap:4px}
 .game-layout .table .revealed-rack>.tile{width:100%;max-width:46px}
 .game-layout .table .played-button{min-height:28px;padding:3px 7px;margin-top:3px;font-size:11px;line-height:1.2}
 .game-layout .table .played-button b{padding:2px 5px}
}

