#board .top{grid-template-columns:var(--game-top-template)!important}
#board #tabs{grid-template-columns:repeat(var(--game-columns,7),minmax(0,1fr))!important}
#board[data-game]::after{top:var(--game-logo-top,69%)!important}
#board .free-cell{border:0!important;border-radius:0;background:transparent!important;position:relative;min-width:0;box-shadow:none!important}

#board .card[role=button]:focus-visible,[data-pile]:focus-visible{outline:3px solid #e7c477;outline-offset:2px}
#board .card[data-loc]{touch-action:auto;-webkit-touch-callout:none}
#gameChoice{font:inherit;background:#143c32;color:#fff;border:1px solid #ffffff50;border-radius:8px;padding:8px;margin-bottom:12px}
#board [hidden]{display:none!important}

#board[data-game] .top .foundation[data-pile]{background-image:var(--pile-art,none)!important}
#board[data-game] .top .foundation[data-pile]:has(>.card){background-image:none!important}

/* One felt surface for every game: fixed grain scale/origin, independent of stack height. */
/* Empty-cell art and marker are supplied by layout configuration. */
#board .free-cell:not(:has(>.card))::before{content:"";position:absolute;inset:0;background:var(--empty-pile-art,none) center/100% 100% no-repeat;opacity:.36;pointer-events:none}
#board .free-cell[data-empty-mark]:not(:has(>.card))::after{content:"";position:absolute;left:50%;top:50%;width:var(--empty-mark-width,50%);aspect-ratio:var(--empty-mark-aspect,1);transform:translate(-50%,-50%);background:var(--empty-pile-mark) center/contain no-repeat;opacity:var(--empty-mark-opacity,.25);pointer-events:none}
#board .free-cell:has(>.card)::before,#board .free-cell:has(>.card)::after{content:none}
/* Mark the exposed card, just below its lower edge. */
#board .card.hint-destination::after{bottom:-10px!important}
#board #tabs .tableau-column{min-height:var(--tableau-required-height,420px)!important}
@media(max-width:650px){#board{--tableau-min-height:590px}}

#board .pile-hint-line{position:absolute;left:20%;top:var(--hint-dest-y,calc(100% + 6px));width:60%;height:5px;border-radius:999px;background:#c85f78;z-index:50;pointer-events:none}
#board .col.hint-destination:has(>.pile-hint-line)::after{content:none}
#board .hint-solver-source>.pile-hint-line{background:#4f9f6f}

/* Shared geometry and stable page coordinates. */
html{overflow-anchor:none;scrollbar-gutter:stable}
#board #tabs{min-height:var(--tableau-required-height,420px)!important;padding-bottom:0!important}
#board .auto-fly-card{position:absolute!important;z-index:12000!important}
.auto-finish-skip{left:var(--auto-control-left,12px)!important;right:auto!important;bottom:auto!important;top:var(--auto-control-top,76px)!important}
.game-choice-label{display:flex;align-items:center;gap:14px;padding:20px 0 24px;text-align:left;float:none}
#gameChoice{margin:0;color:#183d33;background:#fffaf0;border-color:#cbbd9c;padding:10px 14px;min-width:160px}
/* Override historic ID-specific close styles through one shared modal rule. */
body :is(dialog,.newgame-dialog,.win-overlay,#parkOverlay,#petDialog) :is(button.modal-close,#close,#cancelNew){position:absolute!important;right:18px!important;top:14px!important;width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;float:none!important;display:grid!important;place-items:center!important;border:0!important;border-radius:0!important;background:none!important;box-shadow:none!important;color:#173f35!important;padding:0!important;font:normal 28px/1 system-ui!important;cursor:pointer}
.modal-close:hover,.modal-close:focus-visible{color:#886121!important;outline:2px solid #bca77c;outline-offset:3px}
.newgame-card,dialog,.win-panel{position:relative}
#dealBadge{font-weight:600;font-size:.9em}
.numbered-deal h2,.stats-chooser h2{padding-right:30px}
.deal-number-quick{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0}
#dealNumberError{color:#9d263c;min-height:1.4em}
#statsChoices{display:grid;gap:12px;margin-top:22px}
#statsChoices button{text-align:left;display:flex;align-items:center;gap:12px;padding:16px}
#statsChoices .artwork,.stats-tabs .artwork{width:30px;height:30px;object-fit:contain;vertical-align:middle;margin-right:8px}
#board .free-cell:not(:has(>.card))::before{background:none;border:2px solid rgba(209,195,165,.40);border-radius:clamp(5px,1vw,15px);inset:8% 5%;opacity:1}
@media(max-width:650px){#board .free-cell:not(:has(>.card))::before{border-width:2px}.stats{white-space:normal}}

body :is(dialog,.newgame-dialog,.win-overlay,#parkOverlay,#petDialog) :is(button.modal-close,#close,#cancelNew)[hidden]{display:none!important}
header>div{display:flex;flex-wrap:wrap;gap:8px}

.stats-chooser{position:fixed;inset:76px 24px auto auto;margin:0;width:min(340px,calc(100vw - 32px));max-height:calc(100dvh - 100px);overflow:auto}

/* v0.28.2.8 shared navigation and compact game metadata */
header>div{position:relative;align-items:center;gap:clamp(8px,1.8vw,24px)}
header>div :is(#pet,#myStats,#new){background:transparent!important;border:0!important;box-shadow:none!important;border-radius:0!important;padding:8px 4px!important;color:#173c32!important;font:600 clamp(14px,1.45vw,18px)/1.35 inherit!important}
header>div :is(#pet,#myStats,#new):hover{text-decoration:underline;text-underline-offset:5px}
header>div :is(#pet,#myStats,#new):focus-visible{outline:2px solid #bca77c;outline-offset:3px}
.stats-nav-menu{position:absolute;z-index:300;top:calc(100% + 6px);right:0;min-width:180px;background:#fffdf7;border:1px solid #ddd3bf;border-radius:12px;padding:7px;box-shadow:0 12px 28px #142b2530;display:grid;gap:2px}
.stats-nav-menu[hidden]{display:none!important}
.stats-nav-menu button{display:block;width:100%;border:0;border-radius:7px;background:transparent;color:#193d34;padding:12px 15px;text-align:left;font:600 16px/1.3 system-ui;cursor:pointer}
.stats-nav-menu button:is(:hover,:focus-visible){background:#f1eee5}
.score-cluster .stats{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;column-gap:6px;row-gap:3px;max-width:100%;min-width:0;white-space:normal}
#dealBadge{display:inline-block;max-width:clamp(76px,14vw,155px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;cursor:help}
#dealBadge[hidden]{display:none!important}
body :is(dialog,.newgame-dialog,.win-overlay,#parkOverlay,#petDialog) :is(button.modal-close,#close,#cancelNew):focus:not(:focus-visible){outline:0!important}
body :is(dialog,.newgame-dialog,.win-overlay,#parkOverlay,#petDialog) :is(button.modal-close,#close,#cancelNew):focus-visible{outline:2px solid #bca77c!important;outline-offset:3px!important}
body :is(dialog,.newgame-dialog,.win-overlay,#parkOverlay,#petDialog) :is(button.modal-close,#close,#cancelNew):hover{outline:0!important}
#board #tabs .tableau-column{min-height:var(--tableau-required-height,420px)!important}

/* v0.28.2.8: shared geometry is based on card-state only; never viewport fill. */
#board #tabs,#board #tabs>.tableau-column{min-height:var(--tableau-required-height,0px)!important}
/* FreeCell alone has numbered deals. Shared utility elements remain unchanged. */
.score-cluster:has(#dealBadge:not([hidden])) .stats{display:grid!important;grid-template-columns:repeat(3,max-content);justify-content:center;gap:3px 12px!important;text-align:center;max-width:100%;white-space:nowrap!important}
.score-cluster:has(#dealBadge:not([hidden])) .stats #drawMode{grid-column:1;grid-row:1}
.score-cluster:has(#dealBadge:not([hidden])) .stats #dealBadge{grid-column:2 / 4;grid-row:1;max-width:none!important;overflow:visible!important;text-overflow:clip!important}
.score-cluster:has(#dealBadge:not([hidden])) .stats .utility-divider{display:none!important}
/* Header navigation: plain submenu items, no framed popover. */
.stats-nav-menu{background:transparent!important;border:0!important;box-shadow:none!important;border-radius:0!important;padding:4px 0!important;min-width:140px!important;gap:0!important}
.stats-nav-menu button{background:transparent!important;border:0!important;border-radius:0!important;padding:8px 12px!important;color:#193d34!important;text-align:left}
.stats-nav-menu button:hover,.stats-nav-menu button:focus-visible{background:transparent!important;text-decoration:underline;text-underline-offset:4px}
/* Park close is above artwork and legible against the dark header. */
#parkOverlay .park-v180 .park-close{position:absolute!important;z-index:100!important;top:12px!important;right:12px!important;color:#fffaf0!important;background:rgba(8,35,29,.68)!important;border:0!important;border-radius:0!important;text-shadow:0 1px 3px #061c17!important;opacity:1!important;visibility:visible!important;filter:none!important}
#parkOverlay .park-v180 .park-close:hover{background:rgba(8,35,29,.9)!important;color:white!important}

/* Two-row FreeCell utility, without affecting Klondike's single row. */
.score-cluster .stats .deal-identity,.score-cluster .stats .game-metrics{display:inline-flex;align-items:center;justify-content:center;gap:5px;white-space:nowrap}
.score-cluster .stats.has-numbered-deal{display:flex!important;flex-direction:column;gap:4px!important;align-items:center}
.score-cluster .stats.has-numbered-deal .deal-identity{display:flex;max-width:100%}
.score-cluster .stats.has-numbered-deal #dealBadge{max-width:none!important;overflow:visible!important;white-space:nowrap}
.score-cluster .stats.has-numbered-deal .game-metrics{display:block;white-space:nowrap}
@media(max-width:540px){.score-cluster .stats.has-numbered-deal .game-metrics{font-size:.9em}}

/* v0.28.2.8: numbered-deal layout is explicitly two rows. Target the
   existing two semantic spans rather than grid-positioning their children. */
.score-cluster:has(#dealBadge:not([hidden])) .stats,
.score-cluster .stats:has(#dealBadge:not([hidden])){
 display:flex!important;flex-direction:column!important;align-items:center!important;
 justify-content:center!important;flex-wrap:nowrap!important;gap:5px!important;
 white-space:nowrap!important;
}
.score-cluster .stats:has(#dealBadge:not([hidden])) .deal-identity,
.score-cluster .stats:has(#dealBadge:not([hidden])) .game-metrics{
 display:flex!important;flex:0 0 auto!important;align-items:center!important;
 justify-content:center!important;white-space:nowrap!important;
 grid-column:auto!important;grid-row:auto!important;
}
.score-cluster .stats:has(#dealBadge:not([hidden])) #drawMode,
.score-cluster .stats:has(#dealBadge:not([hidden])) #dealBadge{
 grid-column:auto!important;grid-row:auto!important;
}
/* Park close: the global modal-close rule used dark ink on a dark banner.
   Override its specificity, keeping an unframed and high-contrast X. */
body #parkOverlay .park-v180 button#closePark.modal-close,
body #parkOverlay .park-v180 button#closePark{
 color:#fffaf0!important;background:transparent!important;
 text-shadow:0 2px 5px #00140f,0 0 3px #00140f!important;
 z-index:1000!important;opacity:1!important;visibility:visible!important;
 position:absolute!important;top:14px!important;right:14px!important;
 border:0!important;box-shadow:none!important;
}
body #parkOverlay .park-v180 button#closePark:hover{color:#e8c783!important}

/* v0.28.2.8: shared modal close styling, including statistics dialog.
   Remove the inherited square border while retaining focus-visible access. */
body dialog.detailed-stats button#statsClose.result-close,
body dialog.detailed-stats button#statsClose.modal-close{
 position:absolute!important;top:14px!important;right:14px!important;
 width:44px!important;height:44px!important;min-width:44px!important;
 padding:0!important;display:grid!important;place-items:center!important;
 border:0!important;border-radius:0!important;background:transparent!important;
 box-shadow:none!important;outline:none!important;color:#173f35!important;
 font:normal 28px/1 system-ui!important;cursor:pointer!important;
}
body dialog.detailed-stats button#statsClose:focus-visible{
 outline:2px solid #bca77c!important;outline-offset:3px!important;
}

/* v0.28.2.8: close controls never show a rectangular frame. The dialog
   receives initial focus instead of the close button; keyboard focus on the
   button is indicated by a subtle underline, not a box. */
body dialog.detailed-stats button#statsClose,
body dialog.detailed-stats button#statsClose:is(:focus,:focus-visible,:hover,:active){
 border:0!important;outline:0!important;outline-offset:0!important;
 box-shadow:none!important;background:transparent!important;
 -webkit-appearance:none!important;appearance:none!important;
}
body dialog.detailed-stats button#statsClose:focus-visible{
 text-decoration:underline!important;text-underline-offset:6px!important;
}

/* v0.28.2.8: free-cell empty well corners match shared foundation pile corners. */
#board .free-cell:not(:has(>.card))::before{border-radius:10px!important}
@media(max-width:650px){#board .free-cell:not(:has(>.card))::before{border-radius:6px!important}}

/* v0.29.0.16: neutral and active tables use the same uninterrupted felt layer.
   An idle board has no horizontally overflowing card content; remove the
   legacy scroll container rather than allowing its pseudo-layers to clip. */
#board[data-idle="true"]{overflow:visible!important;overflow-x:visible!important;overflow-y:visible!important;}
#board[data-idle="true"]::before{inset:0!important;}
/* Empty foundation artwork is a persistent decorative layer, not the pile's
   background. Card changes therefore do not invalidate the well image. */
#board[data-game] .top .foundation[data-pile]{background-image:none!important;isolation:isolate!important}
#board[data-game] .top .foundation[data-pile]::before{content:""!important;display:block!important;position:absolute!important;inset:0!important;z-index:0!important;background-image:var(--pile-art,none)!important;background-size:100% 100%!important;background-position:center!important;background-repeat:no-repeat!important;pointer-events:none!important}
#board[data-game] .top .foundation[data-pile]>.card{z-index:5!important}

/* v0.29.0.16: foundation art is a persistent DOM image, never a pseudo-element
   or a background whose style is invalidated when cards are moved. */
#board[data-game] .top .foundation[data-pile]{background-image:none!important;isolation:auto!important}
#board[data-game] .top .foundation[data-pile]::before,
#board[data-game] .top .foundation[data-pile]::after{content:none!important;display:none!important;background-image:none!important}
#board[data-game] .top .foundation[data-pile] > .foundation-artwork{
 position:absolute!important;inset:0!important;width:100%!important;height:100%!important;
 object-fit:fill!important;display:block!important;z-index:0!important;pointer-events:none!important;
 user-select:none!important;opacity:1!important;
}
#board[data-game] .top .foundation[data-pile] > .card{z-index:5!important}
/* The skip control's left offset is computed relative to the gameboard. */
.auto-finish-skip{left:var(--auto-control-left,12px)!important;right:auto!important}

/* v0.29.0.16: hold the active felt surface through the last Auto Finish
   actions and win flourish, including the instant Skip path. */
#board[data-auto-finishing="true"]{
 min-height:var(--auto-finish-board-height,0px)!important;
 
}
#board[data-auto-finishing="true"]::before{
 inset:0!important;
 
 
 
 
}
/* Skip is positioned relative to .game and stays visible above the board. */
.game>.auto-finish-skip:not([hidden]):not(:disabled){z-index:5000!important;visibility:visible!important;opacity:1!important}

/* Shared completion presentation: hold the entire tableau layout, not only
   the outer board. This avoids a reflow during foundation moves/flourish. */
#board[data-auto-finishing="true"] #tabs,
#board[data-auto-finishing="true"] #tabs>.tableau-column{
 min-height:var(--auto-finish-tableau-height,var(--tableau-required-height,420px))!important;
}

/* v0.29.0.16: ONE shared felt surface, independent of game and lifecycle.
   Grain uses the approved full desktop board width (1180px main minus 24px padding).
   Responsive geometry crops this same surface rather than shrinking the fibres.
   Geometry and Auto Finish may resize the board, never rescale its texture. */
#board {
 background:var(--felt-base,#064b38)!important;
}
#board::before {
 content:""!important;position:absolute!important;inset:0!important;
 background-image:url("assets/pawshuffle-felt-texture-overlay.webp")!important;
 background-position:center top!important;
 background-size:1156px auto!important;
 background-repeat:repeat-y!important;
 mix-blend-mode:overlay!important;opacity:.88!important;
 filter:contrast(1.38) brightness(.98)!important;
 pointer-events:none!important;z-index:0!important;
}

/* QA fixtures keep the previous full-deal geometry through Auto Finish and
   the flourish. No alternate felt texture or game-specific CSS is introduced. */
#board[data-fixture-presentation="true"]{
 min-height:var(--fixture-board-height,0px)!important;
}
#board[data-fixture-presentation="true"] #tabs,
#board[data-fixture-presentation="true"] #tabs>.tableau-column{
 min-height:var(--fixture-tableau-height,0px)!important;
}


/* v0.29.2.4: lock the original felt painting surface while cards fly.
   The board height and the texture must use the same pre-animation snapshot. */
#board[data-auto-finishing="true"]::before {
 min-height:var(--auto-finish-felt-height,0px)!important;
 background-size:1156px auto!important;
 background-position:center top!important;
}
/* Read-only inspection consumes the same configured column count as play. */
#dealInspection .inspection-tableau{grid-template-columns:repeat(var(--game-columns,7),minmax(0,1fr))}

/* v0.30.2.4: the document is the board's only scroll surface. Keep the
   desktop felt, logo and state-driven dimensions on touch landscape too. */
#board[data-game]{overflow:visible!important;overflow-x:visible!important;overflow-y:visible!important;max-height:none!important}
