/* Fit Match: graphite sports club, with unchanged board geometry and controls. */
body:has(#fitMatchScript){--match-ink:#edf7fa;--match-muted:#a9bec8;--match-panel:#101f29;--match-line:#304c59;background:#09141c;color:var(--match-ink)}
html[data-theme] #gameWindow{color:var(--match-ink);background:#0b1720!important;border:1px solid #355a69!important;border-radius:22px!important;box-shadow:0 24px 90px #0009!important}
html[data-theme] #gameWindow::backdrop{background:#061018df;backdrop-filter:blur(5px)}
html[data-theme] #gameWindow .match-play{background:transparent!important;box-shadow:none!important}
html[data-theme] #gameWindow .eyebrow{color:#83acba;letter-spacing:.16em}
html[data-theme] #gameWindow h2{font-weight:750;letter-spacing:-.035em;color:#f5fbfd}
html[data-theme] #gameWindow .match-metrics>div{background:#132833!important;border:1px solid #294651!important;border-radius:12px!important;box-shadow:none!important;color:#afc4cd}
html[data-theme] #gameWindow .match-metrics strong{color:#fff!important;font-variant-numeric:tabular-nums}
html[data-theme] #gameWindow #movesLeft{color:#64ddcc!important}
html[data-theme] #gameWindow progress{height:7px;border:0;border-radius:10px;background:#203743;box-shadow:none!important}
html[data-theme] #gameWindow progress::-webkit-progress-bar{background:#203743;border-radius:10px}
html[data-theme] #gameWindow progress::-webkit-progress-value{background:linear-gradient(90deg,#24bca6,#7ce0cb);border-radius:10px}
html[data-theme] #gameWindow progress::-moz-progress-bar{background:#4dd0b6;border-radius:10px}
html[data-theme] #gameWindow #board{background:#07131b!important;border:1px solid #35525f!important;border-radius:16px!important;box-shadow:inset 0 1px 10px #0005!important;padding:7px;gap:5px;isolation:isolate;overflow:hidden;touch-action:none}
html[data-theme] #gameWindow #board .match-tile{position:relative;aspect-ratio:1;border:1px solid #314956!important;border-radius:12px!important;background:linear-gradient(145deg,#233b48,#142631)!important;box-shadow:inset 0 1px 0 #ffffff10,0 2px 3px #0004!important;padding:3px!important;overflow:visible;transition:border-color .12s,background .12s;min-width:0;min-height:0}
html[data-theme] #gameWindow #board .match-tile img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;filter:none!important;user-select:none;-webkit-user-drag:none}
html[data-theme] #gameWindow #board .match-tile:disabled{opacity:1!important;filter:none!important;cursor:default}
html[data-theme] #gameWindow #board .match-tile[aria-pressed="true"]{border:2px solid #7af0d8!important;background:#235345!important;box-shadow:0 0 0 2px #123f35,inset 0 0 10px #6aebc51a!important;z-index:2}
html[data-theme] #gameWindow #board .match-tile:focus-visible{outline:3px solid #f9cf75!important;outline-offset:1px;z-index:3}
html[data-theme] #gameWindow #board .match-tile.move-hint{border-color:#efcb77!important;animation:match-hint-ring 1s ease-in-out infinite}
html[data-theme] #gameWindow #board .match-tile.clearing{animation:match-clear .18s ease-in forwards!important}
html[data-theme] #gameWindow button:not(.match-tile){border-radius:11px;color:#eaf5fa;background:#1c3442!important;border:1px solid #42606c!important;box-shadow:none;min-height:44px}
html[data-theme] #gameWindow button:disabled{opacity:.45}
html[data-theme] #gameWindow #begin{background:#64dcc2!important;color:#08251e!important;border-color:#7cebd2!important;font-weight:750}
html[data-theme] #gameWindow #pause{background:#64dcc2!important;color:#08251e!important;border-color:#7cebd2!important;font-weight:750}
html[data-theme] #gameWindow .close-game{background:#1c303c!important;border-color:#42606c!important}
html[data-theme] #gameWindow .match-extra-tools>summary{color:#c3d6df;border-color:#35505e;background:#10232e;font-size:.85rem}
html[data-theme] #gameWindow #boostBar [aria-pressed="true"]{border-color:#70e6ce;background:#214c43;outline:2px solid #70e6ce}
html[data-theme] #gameWindow #comboReward{color:#76e4cd;min-height:1.2em;font-size:.85rem;font-weight:650;margin-block:6px}
html[data-theme] #gameWindow #status{color:#afc4cd;font-size:.82rem}
.match-lobby .lobby-scene{border:1px solid #35505e;border-radius:20px;overflow:hidden;box-shadow:0 12px 36px #0003}
.match-lobby .lobby-scene>div{background:#102530ed}
.match-lobby #launchGame{background:#64dcc2;color:#08251e;border:1px solid #7cebd2;border-radius:12px;font-weight:750;min-height:48px}
@keyframes match-clear{0%{transform:scale(1);opacity:1}45%{transform:scale(1.08);opacity:1}100%{transform:scale(.25);opacity:0}}
@keyframes match-hint-ring{0%,100%{box-shadow:0 0 0 0 #efcb7700}50%{box-shadow:0 0 0 2px #efcb7777}}
@media(max-width:600px){html[data-theme] #gameWindow #board{padding:5px;gap:3px;border-radius:13px!important}html[data-theme] #gameWindow #board .match-tile{border-radius:9px!important;padding:1px!important}html[data-theme] #gameWindow .match-metrics>div{padding:7px 4px!important}}
@media(prefers-reduced-motion:reduce){html[data-theme] #gameWindow #board .match-tile{transition:none!important}html[data-theme] #gameWindow #board .match-tile.clearing,html[data-theme] #gameWindow #board .match-tile.move-hint{animation:none!important}}

html[data-theme] #gameWindow #firstSwapHint{margin:4px 0 8px;padding:8px 10px;border:1px solid #efcb77;border-radius:10px;color:#ffe4a2;background:#293027;font-size:.82rem;line-height:1.35}
html[data-theme] #gameWindow #firstSwapHint[hidden]{display:none!important}
html[data-theme] #gameWindow #board .tutorial-move{border:2px solid #efcb77!important;box-shadow:inset 0 0 0 1px #efcb77!important}


/* Fit the board to available height while keeping ordinary controls reachable. */
html[data-theme] #gameWindow{box-sizing:border-box;width:min(620px,calc(100% - 12px))!important;max-width:calc(100% - 12px)!important;max-height:calc(100dvh - 12px)!important;margin:6px auto!important;padding:0!important;overflow:auto;overscroll-behavior:contain;scroll-padding-block:12px 64px}
html[data-theme] #gameWindow .match-play{box-sizing:border-box;display:flex;flex-direction:column;gap:5px!important;min-width:0;padding:14px 16px max(12px,env(safe-area-inset-bottom))!important}
html[data-theme] #gameWindow .match-play>*{flex-shrink:0}
html[data-theme] #gameWindow .match-heading{padding-right:46px!important;min-height:44px;gap:4px!important}
html[data-theme] #gameWindow .match-heading p{margin:2px 0!important;font-size:.82rem;line-height:1.3}
html[data-theme] #gameWindow .match-heading h2{font-size:1.2rem!important;line-height:1.2;margin:3px 0!important}
html[data-theme] #gameWindow .close-game{top:10px!important;right:10px!important;width:44px;min-width:44px;z-index:4}
html[data-theme] #gameWindow .match-metrics{gap:4px!important;margin:2px 0!important;font-size:.75rem}
html[data-theme] #gameWindow .match-metrics>div{padding:6px 3px!important;line-height:1.3}
html[data-theme] #gameWindow .match-metrics strong{font-size:1.05rem!important}
html[data-theme] #gameWindow #goal{width:100%;height:7px!important;flex-basis:7px;margin:0!important}
html[data-theme] #gameWindow #comboReward{margin:0!important;min-height:18px;line-height:18px;font-size:.78rem}
html[data-theme] #gameWindow #firstSwapHint{margin:0 0 3px;padding:6px 8px;line-height:1.3}
html[data-theme] #gameWindow #board{box-sizing:border-box;width:100%!important;max-width:min(100%,max(240px,calc(100dvh - 330px)))!important;aspect-ratio:1;align-self:center;grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:repeat(8,minmax(0,1fr));margin:0 auto!important;padding:5px;gap:3px;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
html[data-theme] #gameWindow:has(#firstSwapHint:not([hidden])) #board{max-width:min(100%,max(240px,calc(100dvh - 395px)))!important}
html[data-theme] #gameWindow .challenge-controls{position:sticky;bottom:0;z-index:3;display:flex;flex-wrap:wrap;gap:4px!important;margin:0!important;padding:5px 0;background:#0b1720;box-shadow:0 -5px 12px #0b1720}
html[data-theme] #gameWindow .challenge-controls button{flex:1;min-height:44px;padding:6px!important;font-size:.8rem;line-height:1.2}
html[data-theme] #gameWindow .challenge-controls [hidden]{display:none!important}
html[data-theme] #gameWindow .match-extra-tools{margin:0!important}
html[data-theme] #gameWindow .match-extra-tools>summary{box-sizing:border-box;min-height:44px;padding:6px 8px;font-size:.78rem}
html[data-theme] #gameWindow #status{margin:0!important;line-height:1.3;font-size:.78rem}
body.game-open:has(#fitMatchScript){overflow:hidden;overscroll-behavior:none}
@media(max-width:380px){html[data-theme] #gameWindow .match-play{padding-inline:8px!important}html[data-theme] #gameWindow #board .match-tile{border-radius:7px!important}}
