/* WebKit's native menulist ignores overflow; keep the select's own text contained. */
#analysis-quality{min-width:0;max-width:100%;appearance:none;-webkit-appearance:none;overflow:hidden;text-overflow:ellipsis;padding-inline-end:38px;background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);background-position:right 19px center,right 13px center;background-size:6px 6px;background-repeat:no-repeat}
[dir=rtl] #analysis-quality{background-position:left 13px center,left 19px center}
/* Small landscape tables share a grid; board nodes never move or rebuild. */
body[data-embed=true][data-viewport-layout=compact-landscape]{--table-width:100vw;--table-height:var(--portal-table-height,320px);--table-console-width:clamp(280px,36vw,400px);--table-board-size:min(calc(var(--table-width) - var(--table-console-width) - 28px),calc(var(--table-height) - 12px))}
body[data-viewport-layout=compact-landscape][data-game-focus=true]{--table-width:var(--game-focus-width,100vw);--table-height:var(--game-focus-height,100dvh)}
body[data-viewport-layout=compact-landscape] main{padding:6px 8px}
body[data-viewport-layout=compact-landscape] #play-view .workspace{grid-template-columns:minmax(0,var(--table-board-size)) minmax(0,var(--table-console-width));grid-template-rows:44px 34px 44px minmax(0,1fr);gap:4px 12px;justify-content:center;align-content:stretch;align-items:start;min-height:0;height:calc(var(--table-height) - 12px);width:100%;max-width:none;margin:0}
body[data-viewport-layout=compact-landscape] #play-view .workspace>.board-column{display:contents}
body[data-viewport-layout=compact-landscape] #play-view .board-column>.board-frame{grid-column:1;grid-row:1/5;width:var(--table-board-size);max-width:100%;margin:0;align-self:start}
body[data-viewport-layout=compact-landscape] #play-view #board{width:100%;height:auto;aspect-ratio:1}
body[data-viewport-layout=compact-landscape] #play-view .board-column>.player-row{grid-column:2;grid-row:1;height:44px;min-height:44px;padding:0;gap:6px;width:100%;min-width:0;border:0;transform:none}
body[data-viewport-layout=compact-landscape] #play-view .board-column>.player-row.bottom{grid-row:2;height:34px;min-height:34px;padding:0}
body[data-viewport-layout=compact-landscape] #play-view .player-row>div{flex:1;min-width:0}
body[data-viewport-layout=compact-landscape] #play-view .player-row strong{display:block;font-size:15px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body[data-viewport-layout=compact-landscape] #play-view .player-row small{display:none}
body[data-viewport-layout=compact-landscape] #play-view .player-row .avatar{display:grid;width:24px;height:24px;flex:0 0 24px;font-size:16px;border-radius:4px}
body[data-viewport-layout=compact-landscape] #play-view .clock{min-width:78px;padding:2px 6px;font-size:25px;line-height:1.1;letter-spacing:0;transform:none;border-radius:4px}
body[data-viewport-layout=compact-landscape] #play-view .game-focus-toggle{display:inline-grid;width:44px;height:44px;min-width:44px;min-height:44px;flex:0 0 44px;padding:8px}
body[data-viewport-layout=compact-landscape] #play-view #history-controls{grid-column:2;grid-row:3;display:flex;height:44px;min-height:44px;margin:0;padding:0;gap:4px;width:100%;min-width:0;flex-wrap:nowrap}
body[data-viewport-layout=compact-landscape] #play-view #history-controls>button{width:40px;height:44px;min-width:40px;min-height:44px;flex:0 0 40px;padding:3px;font-size:17px}
body[data-viewport-layout=compact-landscape] #play-view #history-controls>strong{flex:1;min-width:0;font-size:13px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body[data-viewport-layout=compact-landscape] #play-view #history-controls>#history-live{width:auto;flex:0 0 auto;padding-inline:6px;font-size:13px}
body[data-viewport-layout=compact-landscape] #play-view .workspace>.control-panel{display:flex;flex-direction:column;grid-column:2;grid-row:4;align-self:stretch;width:100%;height:100%;min-height:0;max-height:none;min-width:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--line);border-radius:6px}
body[data-viewport-layout=compact-landscape] #play-view .control-panel>*{flex-shrink:0;min-width:0;grid-column:auto;grid-row:auto}
body[data-viewport-layout=compact-landscape] #play-view .control-panel .mode-tabs{display:flex;flex-direction:row;border-right:0;border-bottom:1px solid var(--line);padding:3px;gap:2px}
body[data-viewport-layout=compact-landscape] #play-view .control-panel .mode-tabs button{flex:1;min-height:44px;font-size:14px;padding:6px 3px;text-align:center}
body[data-viewport-layout=compact-landscape] #play-view .control-panel .panel-body{padding:10px 12px}
body[data-viewport-layout=compact-landscape] #play-view .control-panel .game-play-status{padding:7px 12px;font-size:15px;line-height:1.35}
body[data-viewport-layout=compact-landscape] #play-view .control-panel .game-utility-panel,body[data-viewport-layout=compact-landscape] #play-view .control-panel .notation{padding:10px 12px}
body[data-viewport-layout=compact-landscape] #play-view .control-panel .move-list{max-height:180px;min-height:40px}
body[data-viewport-layout=compact-landscape] #play-view .control-panel .panel-body>.eyebrow,body[data-viewport-layout=compact-landscape] #play-view .control-panel .bot-profile,body[data-viewport-layout=compact-landscape] #play-view .control-panel .gentle-note{display:none}
body[data-viewport-layout=compact-landscape] #play-view .eval-bar{left:0;width:8px;z-index:3;pointer-events:none}
/* The portrait tablet keeps a large board above its console. */
body[data-embed=true][data-viewport-layout=portrait]:not([data-game-focus=true]) #play-view .workspace{grid-template-columns:minmax(0,1fr);gap:20px;max-width:none;margin:0}
body[data-embed=true][data-viewport-layout=portrait]:not([data-game-focus=true]) #play-view .workspace>.board-column{grid-column:1;grid-row:1;width:100%;max-width:none}
body[data-embed=true][data-viewport-layout=portrait]:not([data-game-focus=true]) #play-view .workspace>.control-panel{grid-column:1;grid-row:2;display:block;width:100%}
/* Larger touch targets remain usable even in a compact settings dialog. */
@media(pointer:coarse){dialog.appearance-dialog[data-settings-compact=true]{--settings-control-height:44px}}
@media(pointer:coarse) and (min-width:561px){dialog.appearance-dialog:not([data-settings-compact=true]){height:min(540px,calc(var(--settings-visible-height,100dvh) - 24px))}}
@media(max-width:380px){body[data-embed=true] #play-view .player-row .avatar{display:none}body[data-embed=true] #play-view .player-row{gap:6px}body[data-embed=true] #play-view .player-row>div{min-width:0}body[data-embed=true] #play-view .clock{min-width:82px;padding-inline:7px;font-size:27px}}

/* Standalone full-screen pages have their own real viewport height. */
@media(min-width:540px) and (max-height:600px){
body[data-game-focus=true]{--table-width:var(--game-focus-width,100vw);--table-height:var(--game-focus-height,100dvh);--table-console-width:clamp(280px,36vw,400px);--table-board-size:min(calc(var(--table-width) - var(--table-console-width) - 28px),calc(var(--table-height) - 12px))}
body[data-game-focus=true] main{padding:6px 8px}
body[data-game-focus=true] #play-view .workspace{grid-template-columns:minmax(0,var(--table-board-size)) minmax(0,var(--table-console-width));grid-template-rows:44px 34px 44px minmax(0,1fr);gap:4px 12px;justify-content:center;align-content:stretch;align-items:start;min-height:0;height:calc(var(--table-height) - 12px);width:100%;max-width:none;margin:0}
body[data-game-focus=true] #play-view .workspace>.board-column{display:contents}
body[data-game-focus=true] #play-view .board-column>.board-frame{grid-column:1;grid-row:1/5;width:var(--table-board-size);max-width:100%;margin:0;align-self:start}
body[data-game-focus=true] #play-view #board{width:100%;height:auto;aspect-ratio:1}
body[data-game-focus=true] #play-view .board-column>.player-row{grid-column:2;grid-row:1;height:44px;min-height:44px;padding:0;gap:6px;width:100%;min-width:0;border:0;transform:none}
body[data-game-focus=true] #play-view .board-column>.player-row.bottom{grid-row:2;height:34px;min-height:34px;padding:0}
body[data-game-focus=true] #play-view .player-row>div{flex:1;min-width:0}
body[data-game-focus=true] #play-view .player-row strong{display:block;font-size:15px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body[data-game-focus=true] #play-view .player-row small{display:none}
body[data-game-focus=true] #play-view .player-row .avatar{display:grid;width:24px;height:24px;flex:0 0 24px;font-size:16px;border-radius:4px}
body[data-game-focus=true] #play-view .clock{min-width:78px;padding:2px 6px;font-size:25px;line-height:1.1;letter-spacing:0;transform:none;border-radius:4px}
body[data-game-focus=true] #play-view .game-focus-toggle{display:inline-grid;width:44px;height:44px;min-width:44px;min-height:44px;flex:0 0 44px;padding:8px}
body[data-game-focus=true] #play-view #history-controls{grid-column:2;grid-row:3;display:flex;height:44px;min-height:44px;margin:0;padding:0;gap:4px;width:100%;min-width:0;flex-wrap:nowrap}
body[data-game-focus=true] #play-view #history-controls>button{width:40px;height:44px;min-width:40px;min-height:44px;flex:0 0 40px;padding:3px;font-size:17px}
body[data-game-focus=true] #play-view #history-controls>strong{flex:1;min-width:0;font-size:13px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body[data-game-focus=true] #play-view #history-controls>#history-live{width:auto;flex:0 0 auto;padding-inline:6px;font-size:13px}
body[data-game-focus=true] #play-view .workspace>.control-panel{display:flex;flex-direction:column;grid-column:2;grid-row:4;align-self:stretch;width:100%;height:100%;min-height:0;max-height:none;min-width:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--line);border-radius:6px}
body[data-game-focus=true] #play-view .control-panel>*{flex-shrink:0;min-width:0;grid-column:auto;grid-row:auto}
body[data-game-focus=true] #play-view .control-panel .mode-tabs{display:flex;flex-direction:row;border-right:0;border-bottom:1px solid var(--line);padding:3px;gap:2px}
body[data-game-focus=true] #play-view .control-panel .mode-tabs button{flex:1;min-height:44px;font-size:14px;padding:6px 3px;text-align:center}
body[data-game-focus=true] #play-view .control-panel .panel-body{padding:10px 12px}
body[data-game-focus=true] #play-view .control-panel .game-play-status{padding:7px 12px;font-size:15px;line-height:1.35}
body[data-game-focus=true] #play-view .control-panel .game-utility-panel,body[data-game-focus=true] #play-view .control-panel .notation{padding:10px 12px}
body[data-game-focus=true] #play-view .control-panel .move-list{max-height:180px;min-height:40px}
body[data-game-focus=true] #play-view .control-panel .panel-body>.eyebrow,body[data-game-focus=true] #play-view .control-panel .bot-profile,body[data-game-focus=true] #play-view .control-panel .gentle-note{display:none}
body[data-game-focus=true] #play-view .eval-bar{left:0;width:8px;z-index:3;pointer-events:none}
}
/* Portrait focus uses the same generous board-first composition. */
@media(max-width:1366px) and (orientation:portrait){
body[data-game-focus=true]{--focus-panel-width:100%;--focus-gap:12px;--focus-board-size:min(calc(var(--focus-width) - 24px),max(160px,calc(var(--focus-height) - 154px)))}
body[data-game-focus=true] main{padding:8px 12px}
body[data-game-focus=true] #play-view .workspace{grid-template-columns:minmax(0,1fr);gap:12px;align-content:start;min-height:0}
body[data-game-focus=true] #play-view .workspace>.board-column{grid-column:1;grid-row:1}
body[data-game-focus=true] #play-view .workspace>.control-panel{grid-column:1;grid-row:2;justify-self:center;width:min(100%,700px);max-height:calc(var(--focus-height) - 16px)}
body[data-game-focus=true] #play-view #history-controls{min-height:44px;height:44px}
body[data-game-focus=true] #play-view #history-controls>button{min-height:44px;height:44px;width:44px;min-width:44px}
}

/* Standalone tables reserve the two compact navigation rows above the game. */
@media(min-width:540px) and (max-height:600px){
body:not([data-embed=true]):not([data-game-focus=true]){--table-width:100vw;--table-height:calc(100dvh - 108px);--table-console-width:clamp(280px,36vw,400px);--table-board-size:min(calc(var(--table-width) - var(--table-console-width) - 28px),calc(var(--table-height) - 12px))}
body:not([data-embed=true]):not([data-game-focus=true]) .sidebar{position:relative;inset:auto;width:100%;height:108px;padding:6px 8px;gap:6px}
body:not([data-embed=true]):not([data-game-focus=true]) .sidebar nav{margin:0;min-height:44px;height:44px}
body:not([data-embed=true]):not([data-game-focus=true]) .sidebar-bottom{margin:0;padding:0;min-height:44px;height:44px}
body:not([data-embed=true]):not([data-game-focus=true]) .sidebar-appearance-controls{padding:0;border:0;grid-template-columns:repeat(4,minmax(0,1fr))}
body:not([data-embed=true]):not([data-game-focus=true]) main{margin-left:0;width:100%;min-width:0}
body:not([data-embed=true]):not([data-game-focus=true]) main{padding:6px 8px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .workspace{grid-template-columns:minmax(0,var(--table-board-size)) minmax(0,var(--table-console-width));grid-template-rows:44px 34px 44px minmax(0,1fr);gap:4px 12px;justify-content:center;align-content:stretch;align-items:start;min-height:0;height:calc(var(--table-height) - 12px);width:100%;max-width:none;margin:0}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .workspace>.board-column{display:contents}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .board-column>.board-frame{grid-column:1;grid-row:1/5;width:var(--table-board-size);max-width:100%;margin:0;align-self:start}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view #board{width:100%;height:auto;aspect-ratio:1}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .board-column>.player-row{grid-column:2;grid-row:1;height:44px;min-height:44px;padding:0;gap:6px;width:100%;min-width:0;border:0;transform:none}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .board-column>.player-row.bottom{grid-row:2;height:34px;min-height:34px;padding:0}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .player-row>div{flex:1;min-width:0}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .player-row strong{display:block;font-size:15px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .player-row small{display:none}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .player-row .avatar{display:grid;width:24px;height:24px;flex:0 0 24px;font-size:16px;border-radius:4px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .clock{min-width:78px;padding:2px 6px;font-size:25px;line-height:1.1;letter-spacing:0;transform:none;border-radius:4px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .game-focus-toggle{display:inline-grid;width:44px;height:44px;min-width:44px;min-height:44px;flex:0 0 44px;padding:8px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view #history-controls{grid-column:2;grid-row:3;display:flex;height:44px;min-height:44px;margin:0;padding:0;gap:4px;width:100%;min-width:0;flex-wrap:nowrap}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view #history-controls>button{width:40px;height:44px;min-width:40px;min-height:44px;flex:0 0 40px;padding:3px;font-size:17px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view #history-controls>strong{flex:1;min-width:0;font-size:13px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view #history-controls>#history-live{width:auto;flex:0 0 auto;padding-inline:6px;font-size:13px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .workspace>.control-panel{display:flex;flex-direction:column;grid-column:2;grid-row:4;align-self:stretch;width:100%;height:100%;min-height:0;max-height:none;min-width:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--line);border-radius:6px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel>*{flex-shrink:0;min-width:0;grid-column:auto;grid-row:auto}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel .mode-tabs{display:flex;flex-direction:row;border-right:0;border-bottom:1px solid var(--line);padding:3px;gap:2px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel .mode-tabs button{flex:1;min-height:44px;font-size:14px;padding:6px 3px;text-align:center}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel .panel-body{padding:10px 12px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel .game-play-status{padding:7px 12px;font-size:15px;line-height:1.35}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel .game-utility-panel,body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel .notation{padding:10px 12px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel .move-list{max-height:180px;min-height:40px}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel .panel-body>.eyebrow,body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel .bot-profile,body:not([data-embed=true]):not([data-game-focus=true]) #play-view .control-panel .gentle-note{display:none}
body:not([data-embed=true]):not([data-game-focus=true]) #play-view .eval-bar{left:0;width:8px;z-index:3;pointer-events:none}
}

/* A square board uses the available height, and the console fills the remaining width. */
body[data-embed=true][data-viewport-layout=compact-landscape]{--table-console-width:280px}
body[data-embed=true][data-viewport-layout=compact-landscape] #play-view .workspace{grid-template-columns:minmax(0,var(--table-board-size)) minmax(280px,1fr);justify-content:stretch}
body[data-embed=true][data-viewport-layout=compact-landscape] #play-view .board-column>.board-frame{align-self:center}
/* Leave a touch target for the parent portal's menu, clear of either clock. */
body[data-embed=true][data-viewport-layout=compact-landscape]:not([data-game-focus=true]) #play-view .board-column>.player-row{padding-inline-end:54px}
