/* Play screens that fit the window (loaded last).
   1. Game screen on laptop-height screens: the chat gets its own full-height column beside the game panel (compact-layout.js
      sets #play[data-chat-column] when the stacked chat would be a sliver and the board can keep most of its size).
   2. Play page (#playHome): board and panel share one row that fits the window height, the panel compacted to match.
   3. Expand / collapse of the game board animates (View Transitions in compact-layout.js; full motion only). */

/* 1. Chat column. */
html body:not([data-board-expanded=true]) #playView #play.play-area[data-chat-dock=true][data-chat-column=true]:has(>#board[data-presentation]){--pl-panel-min:280px;--pl-panel-max:400px;--pl-chat-min:270px;--pl-chat-max:380px;--pl-board:max(280px,min(calc(100dvh - 2*var(--pl-pad) - 2*var(--pl-bar) - 2*var(--pl-gap)),calc(100cqw - 2*var(--pl-hpad) - var(--pl-panel-min) - var(--pl-chat-min) - 2*var(--pl-col))));grid-template-columns:var(--pl-board) minmax(var(--pl-panel-min),var(--pl-panel-max)) minmax(var(--pl-chat-min),var(--pl-chat-max))!important;grid-template-rows:var(--pl-bar) var(--pl-board) var(--pl-bar)!important}
html body:not([data-board-expanded=true]) #playView #play.play-area[data-chat-dock=true][data-chat-column=true]:has(>#board[data-presentation])>:is(#board,#stakeBadge){grid-row:2!important}
html body:not([data-board-expanded=true]) #playView #play.play-area[data-chat-dock=true][data-chat-column=true]:has(>#board[data-presentation])>#focusSidebar{grid-column:2!important;grid-row:1/-1!important}
html body:not([data-board-expanded=true]) #playView #play.play-area[data-chat-dock=true][data-chat-column=true]:has(>#board[data-presentation])>.chatDock{grid-column:3!important;grid-row:1/-1!important;height:auto!important;max-height:none!important}
/* Expand mode with room to spare: the chat takes a full-height column on the right (bars and panel stay beside the board). */
html body[data-board-expanded=true] #playView #play.play-area[data-chat-dock=true][data-chat-column=true]:has(>#board[data-presentation]){--pl-board:max(280px,min(calc(100dvh - 2*var(--pl-pad)),calc(100cqw - 2*var(--pl-hpad) - var(--pl-side-min) - 270px - 2*var(--pl-col))));grid-template-columns:var(--pl-board) minmax(var(--pl-side-min),var(--pl-side-max)) minmax(270px,380px)!important;grid-template-rows:var(--pl-bar) calc(var(--pl-board) - 2*var(--pl-bar) - 2*var(--pl-gap)) var(--pl-bar)!important}
html body[data-board-expanded=true] #playView #play.play-area[data-chat-dock=true][data-chat-column=true]:has(>#board[data-presentation])>#focusSidebar{grid-column:2!important;grid-row:2!important}
html body[data-board-expanded=true] #playView #play.play-area[data-chat-dock=true][data-chat-column=true]:has(>#board[data-presentation])>.chatDock{grid-column:3!important;grid-row:1/-1!important;height:auto!important;max-height:none!important}
/* The chat in the docked spots reads like a side panel: a normal-size title and tighter header, wherever it sits. */
html body #playView #play.play-area:has(>#board[data-presentation])>.chatDock :is(.msgr-title,.msgr-side-head h2,.msgr-side-head h1){margin:0!important;font:700 22px/1.2 Georgia,'Noto Serif KR',serif!important;letter-spacing:0!important}
html body #playView #play.play-area:has(>#board[data-presentation])>.chatDock .msgr-side-head{padding:12px 12px 8px!important;gap:8px!important}
html body #playView #play.play-area:has(>#board[data-presentation])>.chatDock .msgr-side-head :is(button,a){min-height:34px!important;padding:4px 10px!important;font-size:13px!important}
html body #playView #play.play-area:has(>#board[data-presentation])>.chatDock .msgr-empty{padding:16px 12px!important;gap:6px!important}
html body #playView #play.play-area:has(>#board[data-presentation])>.chatDock .msgr-empty :is(h3,strong){font-size:17px!important}
html body #playView #play.play-area:has(>#board[data-presentation])>.chatDock .msgr-empty-icon{width:34px!important;height:34px!important}

/* 2. Play page that fits the window on desktop. */
@media (min-width:1001px){
 html body #playView #playHome .play-hub{--hub-board:min(calc(100dvh - 64px),calc(100vw - var(--rail-width,196px) - 436px),780px);grid-template-columns:var(--hub-board) minmax(340px,400px)!important;gap:20px!important;align-items:stretch!important;padding:12px!important}
 html body #playView #playHome .hub-board{width:var(--hub-board)!important;height:var(--hub-board)!important;align-self:center!important}
 html body #playView #playHome .hub-panel{box-sizing:border-box;min-height:var(--hub-board);justify-content:space-between!important;gap:8px!important;padding:16px!important}
 html body #playView #playHome .hub-panel h1{margin:0!important;font-size:30px!important;line-height:1.1!important}
 html body #playView #playHome .hub-label{margin:0!important;font-size:11.5px!important}
 html body #playView #playHome .hub-time-picker{gap:6px!important}
 html body #playView #playHome :is(.hub-time-picker,.hub-time-group,.hub-time){row-gap:6px!important}
 html body #playView #playHome .hub-chip{min-height:32px!important;padding:4px 8px!important}
 html body #playView #playHome .hub-primary{min-height:0!important;padding:10px 14px!important;font-size:19px!important}
 html body #playView #playHome .hub-modes{gap:8px!important}
 html body #playView #playHome .hub-mode{padding:10px 12px!important;gap:8px 10px!important}
 html body #playView #playHome .hub-mode-icon{width:40px!important;height:40px!important}
 html body #playView #playHome .hub-mode-text :is(strong,h3,b){font-size:15px!important}
 html body #playView #playHome .hub-mode-text :is(small,p,span){font-size:12.5px!important;line-height:1.35!important}
 html body #playView #playHome .hub-secondary{min-height:36px!important;padding:6px 14px!important}
 html body #playView #playHome .hub-levels{gap:6px!important}
 html body #playView #playHome .hub-levels .hub-chip{min-height:30px!important;padding:4px 2px!important;font-size:12px!important;letter-spacing:-.01em}
 html body #playView #playHome .hub-panel{container:hubpanel/inline-size}
 /* Quick links: an even grid of equal tiles instead of pills that wrap unevenly. */
 html body #playView #playHome .hub-links{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important;margin:0!important;padding-top:10px!important}
 html body #playView #playHome .hub-links>*{display:flex!important;align-items:center!important;justify-content:center!important;gap:6px!important;width:auto!important;min-width:0!important;min-height:36px!important;margin:0!important;padding:4px 6px!important;border-radius:10px!important;text-align:center!important;white-space:nowrap!important;line-height:1.15!important;font-size:12.5px!important}
 html body #playView #playHome .hub-links>* .hub-icon{width:15px!important;height:15px!important}
}
@media (min-width:1001px) and (max-height:700px){
 html body #playView #playHome .play-hub{--hub-board:min(calc(100dvh - 52px),calc(100vw - var(--rail-width,196px) - 436px),780px);padding:8px 12px!important}
 html body #playView #playHome .hub-panel{padding:12px 14px!important;gap:6px!important}
 html body #playView #playHome .hub-panel h1{font-size:26px!important}
 html body #playView #playHome .hub-chip{min-height:30px!important}
 html body #playView #playHome .hub-primary{padding:8px 12px!important;font-size:18px!important}
 html body #playView #playHome .hub-mode{padding:8px 10px!important}
 html body #playView #playHome .hub-mode-icon{width:36px!important;height:36px!important}
}

/* 3. Expand / collapse: the board, bars and panel glide to their new places (View Transitions, compact-layout.js). */
html[data-motion=full] body[data-match-active=true] #playView #play.play-area:has(>#board[data-presentation])>#board{view-transition-name:realm-board}
html[data-motion=full] body[data-match-active=true] #playView #play.play-area:has(>#board[data-presentation])>.playerbar:has(>#clockTop){view-transition-name:realm-bar-top}
html[data-motion=full] body[data-match-active=true] #playView #play.play-area:has(>#board[data-presentation])>.playerbar:has(>#clockBottom){view-transition-name:realm-bar-bottom}
html[data-motion=full] body[data-match-active=true] #playView #play.play-area:has(>#board[data-presentation])>#focusSidebar{view-transition-name:realm-panel}
html[data-motion=full] body[data-match-active=true] #playView #play.play-area:has(>#board[data-presentation])>.chatDock{view-transition-name:realm-chat}
html[data-motion=full] body[data-match-active=true]>header{view-transition-name:realm-rail}
::view-transition-group(realm-board),::view-transition-group(realm-bar-top),::view-transition-group(realm-bar-bottom),::view-transition-group(realm-panel),::view-transition-group(realm-chat),::view-transition-group(realm-rail){animation-duration:.42s;animation-timing-function:cubic-bezier(.2,.8,.2,1)}
::view-transition-old(realm-board),::view-transition-new(realm-board){animation-duration:.42s;height:100%;object-fit:fill}
::view-transition-old(root),::view-transition-new(root){animation-duration:.3s}
@container hubpanel (max-width:350px){html body #playView #playHome .hub-levels{grid-template-columns:repeat(2,minmax(0,1fr))!important}html body #playView #playHome .hub-links>*{font-size:11.5px!important}}
/* Time odds in the custom game settings. */
#setupView .odds-box{display:grid;gap:6px;margin:10px 0 4px;padding:10px 12px;border:1px solid rgba(215,180,90,.35);border-radius:12px;background:rgba(5,20,22,.35)}
#setupView .odds-toggle{display:flex!important;align-items:center;gap:8px;margin:0!important;font-weight:700;color:#f3d68a}
#setupView .odds-toggle input{width:18px;height:18px;margin:0;accent-color:#d7b45a}
#setupView .odds-box select:disabled{opacity:.55}
#setupView .odds-box small{color:#b9cbc2;line-height:1.4}
