@font-face{font-family:BrainyNavigation;src:url('/letterclash-home/nunito-variable.ttf') format('truetype');font-weight:200 1000;font-display:swap}
:root{--bd-nav-height:64px}
/* Use the supplied wordmark instead of rebuilding the brand with text. */
#brainy-navigation .bd-home img{width:82px;height:50px;object-fit:contain}
@media(max-width:700px){#brainy-navigation .bd-home img{width:62px;height:40px}}
#brainy-navigation{--bd-nav-ink:#f9f2ff;--bd-nav-muted:#cbb9e5;--bd-nav-bg:#211039;--bd-nav-border:#9b6fdc55;--bd-nav-panel:#35204f;transform:translateZ(0);isolation:isolate;position:fixed;z-index:1000;inset:0 0 auto;height:var(--bd-nav-height);display:flex;align-items:center;gap:18px;padding:8px clamp(16px,2.5vw,40px);box-sizing:border-box;color:var(--bd-nav-ink);background:linear-gradient(110deg,#35205a,#211039);border-bottom:1px solid var(--bd-nav-border);font:800 15px/1.25 BrainyNavigation,ui-rounded,system-ui,sans-serif;box-shadow:0 2px 12px #160a2920}
#brainy-navigation[data-theme=light]{--bd-nav-ink:#4b255c;--bd-nav-muted:#796381;--bd-nav-bg:#fffaf6;--bd-nav-border:#d3b4d7;--bd-nav-panel:#fffaf6;background:#fffaf6f7;box-shadow:0 2px 12px #5d326010}
#brainy-navigation *{box-sizing:border-box}#brainy-navigation a{text-decoration:none;color:inherit}#brainy-navigation button{font:inherit;cursor:pointer}#brainy-navigation a:focus-visible,#brainy-navigation button:focus-visible{outline:3px solid #ffda4f;outline-offset:4px}#brainy-navigation [hidden]{display:none!important}
.bd-home{display:flex;align-items:center;gap:9px;white-space:nowrap;font-size:20px;font-weight:1000}.bd-home img{object-fit:contain;width:36px;height:38px}.bd-home:hover span{text-decoration:underline;text-underline-offset:4px}
.bd-switcher{position:relative;border-left:1px solid var(--bd-nav-border);padding-left:18px}.bd-switch-button{min-height:38px;display:flex;align-items:center;gap:18px;border:1px solid var(--bd-nav-border);border-radius:13px;padding:7px 16px;color:var(--bd-nav-ink);background:linear-gradient(#ffffff18,#ffffff06);box-shadow:inset 0 1px 0 #ffffff26,0 2px 3px #160a2926}.bd-switch-button[aria-expanded=true]{border-color:#b78ae9;background:#8f5bd02a}
.bd-current-game{position:absolute;left:50%;transform:translateX(-50%);display:flex;align-items:center;justify-content:center;height:50px}.bd-current-game img{width:clamp(140px,18vw,255px);max-height:48px;object-fit:contain}.bd-splitem{font-size:35px;font-weight:1000;color:#3269d8;letter-spacing:-1.5px}.bd-splitem b{color:#e8a42f}
.bd-nav-end{display:flex;align-items:center;gap:22px;margin-left:auto;font-size:13px}.bd-overview{color:var(--bd-nav-muted)!important}.bd-overview:hover{text-decoration:underline}.bd-enter{border-radius:12px;background:#ffda4f;color:#28123e!important;padding:10px 16px;white-space:nowrap}.bd-playing .bd-enter{display:none}.bd-site-links{display:flex;align-items:center;gap:28px;margin:auto}.bd-site-links a:hover{color:#ffda4f!important}
#bd-game-picker{position:absolute;top:48px;left:18px;width:340px;padding:16px;border:1px solid var(--bd-nav-border);border-radius:20px;background:var(--bd-nav-panel);box-shadow:0 18px 45px #10051d65;color:var(--bd-nav-ink)}.bd-picker-heading{font-size:12px;letter-spacing:.6px;color:var(--bd-nav-muted);margin-bottom:12px}.bd-game-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px}.bd-game-choice{display:flex;flex-direction:column;align-items:center;text-align:center;gap:7px;padding:12px 6px;border:1px solid var(--bd-nav-border);border-radius:13px;background:#ac7deb0d}.bd-game-choice[aria-current]{border-color:#f1c746;box-shadow:inset 0 0 0 1px #f1c746}.bd-game-choice:hover{background:#9878c729;transform:translateY(-1px)}.bd-game-choice img{border-radius:12px;width:48px;height:48px;object-fit:contain}.bd-game-choice strong{font-size:14px}.bd-game-choice small{font-size:10px;color:var(--bd-nav-muted)}.bd-picker-footer{display:flex;justify-content:space-between;margin-top:14px;padding:13px 0 8px;border-top:1px solid var(--bd-nav-border);font-size:13px}.bd-picker-about{display:block;font-size:12px;padding:7px 0;color:var(--bd-nav-muted)!important}
.bd-marketing body{padding-top:var(--bd-nav-height)}.bd-marketing .site-header,.bd-marketing .lh-header{display:none!important}.bd-marketing [id]{scroll-margin-top:calc(var(--bd-nav-height) + 20px)}
.bd-playing #root{position:fixed!important;top:var(--bd-nav-height)!important;bottom:0!important;left:0;right:0;height:calc(100dvh - var(--bd-nav-height))!important;overflow:hidden}.bd-playing .lc-app{height:calc(100dvh - var(--bd-nav-height))!important;margin-top:var(--bd-nav-height)}
.bd-playing #game-toolbar{min-height:42px!important;padding:4px 3px!important;box-shadow:none!important}.bd-playing #game-toolbar [aria-label="CodeCrack"],.bd-playing #game-toolbar img,.bd-playing #game-wordmark{display:none!important}.bd-playing #game-toolbar [aria-label^='Back to'],.bd-playing #game-back{width:auto!important;min-width:110px;border-radius:12px!important;padding:5px 10px!important;min-height:32px!important;height:auto!important}.bd-playing #game-toolbar [data-part=back-label]{display:block!important;font-size:13px}.bd-playing #game-toolbar [role=button]:not([aria-label^='Back to']){height:34px!important;width:34px!important}
@media(max-width:1050px){.bd-current-game img{width:170px}.bd-home{font-size:17px}.bd-nav-end .bd-overview{display:none}.bd-site-links{gap:16px;font-size:13px}}
@media(max-width:700px){:root{--bd-nav-height:52px}#brainy-navigation{padding:6px 10px;gap:10px}.bd-home{font-size:13px;gap:5px}.bd-home img{width:26px;height:30px}.bd-switcher{margin-left:auto;order:3;border:0;padding:0}.bd-switch-button{min-height:32px;padding:5px 9px;gap:7px;font-size:12px}.bd-current-game{position:static;transform:none;flex:1;height:36px}.bd-current-game img{width:clamp(95px,28vw,145px);max-height:34px}.bd-splitem{font-size:25px}.bd-nav-end{display:none}.bd-site-links{margin-left:auto;margin-right:0}.bd-site-links a{display:none}.bd-site-links a:first-child{display:block}.bd-marketing .bd-site-links{display:none}#bd-game-picker{position:fixed;top:58px;left:auto;right:10px;width:min(340px,calc(100vw - 20px));max-height:calc(100dvh - 75px);overflow:auto}.bd-playing #game-toolbar{min-height:36px!important}.bd-playing #game-toolbar [data-part=back-label]{font-size:12px}.bd-playing #game-save-status{min-height:16px!important}}
@media(prefers-reduced-motion:reduce){#brainy-navigation *{transition:none!important;scroll-behavior:auto!important}}

.bd-playing #splitem-app #game-toolbar{grid-template-columns:auto 1fr!important}.bd-playing #game-back [data-part=back-label]{display:block!important;font-size:13px!important}.bd-playing #game-toolbar-actions{grid-column:2;justify-self:end}

/* Mobile play protects game surfaces before spending space on site chrome.
   Short windows scroll within the game instead of scaling every control down. */
.bd-play-back{display:none}
.bd-play-actions{display:none}
@media(max-width:700px){
  html.bd-active-game{--bd-nav-height:calc(48px + env(safe-area-inset-top))}
  .bd-active-game #brainy-navigation{padding-top:calc(2px + env(safe-area-inset-top));padding-bottom:2px;gap:6px}
  .bd-active-game #brainy-navigation .bd-home{display:none}
  .bd-active-game .bd-play-back{display:block;min-width:70px;min-height:44px;border:0;background:transparent;color:inherit;padding:5px 8px;font-size:14px;text-align:left}
  .bd-active-game .bd-switch-button{min-height:44px;border:0;background:transparent;box-shadow:none;padding:6px 8px;gap:4px}
  .bd-active-game .bd-menu-label{font-size:0}.bd-active-game .bd-menu-label::after{content:'Menu';font-size:14px}
  .bd-active-game .bd-current-game{pointer-events:none}
  .bd-active-game #bd-game-picker{top:var(--bd-nav-height);max-height:calc(100dvh - var(--bd-nav-height) - 12px)}
  .bd-active-game .bd-play-actions{display:grid;gap:5px;margin-bottom:10px}
  .bd-play-actions button{min-height:44px;text-align:left;padding:9px 12px;border:1px solid var(--bd-nav-border);border-radius:10px;background:#9878c718;color:inherit}
  .bd-active-game .lc-game[data-match]>.lc-game-header,
  .bd-active-game #pw-game #pw-header,
  .bd-active-game #splitem-app #game-toolbar,
  .bd-active-game #codecrack-app #game-toolbar{display:none!important}
  .bd-active-game .lc-app{padding-top:0}

  /* LetterClash: full-width 9x9 board, compact word row, history in its sheet. */
  .bd-active-game .lc-game[data-match]{padding:5px 6px 8px;gap:5px;overflow-y:auto;overscroll-behavior:contain;grid-template-areas:'scores' 'word' 'board' 'actions' 'details';grid-template-rows:auto auto minmax(min(calc(100vw - 12px),520px),1fr) auto auto}
  .bd-active-game .lc-score-row{gap:4px;flex-wrap:wrap}
  .bd-active-game .lc-score{min-height:32px;padding:2px 5px;font-size:12px;gap:4px}
  .bd-active-game .lc-score-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .bd-active-game .lc-score strong{height:24px;min-width:24px}
  .bd-active-game .lc-word-box{height:42px!important;min-height:42px;padding:4px 10px;border-radius:12px}
  .bd-active-game .lc-word-placeholder p,.bd-active-game .lc-word-alert{font-size:12px;line-height:1.2}
  .bd-active-game .lc-rack{height:32px}
  .bd-active-game .lc-board-slot{margin:0;min-height:min(calc(100vw - 12px),520px)}
  .bd-active-game .lc-game-actions button{min-height:44px}
  .bd-active-game .lc-last-move{gap:0}
  .bd-active-game .lc-last-move .lc-move-view{padding:6px 9px;min-height:36px;gap:0}
  .bd-active-game .lc-last-move .lc-standings,.bd-active-game .lc-last-move .lc-react,.bd-active-game .lc-move-hint,.bd-active-game .lc-move-empty{display:none}
  .bd-active-game .lc-last-move .lc-move-card{border-radius:12px}
  .bd-active-game .lc-last-footer{min-height:32px;gap:8px}
  .bd-active-game .lc-history-link{min-height:32px;padding:4px}
  .bd-active-game .lc-turns{font-size:11px}
  .bd-active-game .lc-deadline{font-size:10px;margin:0}

  /* PatchWord: keep the letter grid readable; tray remains independently
     scrollable with its original hit-testing and piece sizes. */
  .bd-active-game #pw-content{overflow-y:auto!important;overscroll-behavior:contain;padding:4px 6px 8px!important;gap:4px}
  .bd-active-game #pw-play-area{flex-shrink:0!important;min-height:min(calc(100vw - 12px),520px);gap:5px!important}
  .bd-active-game #pw-board-area{min-height:min(calc(100vw - 12px),520px);flex-shrink:0!important}
  .bd-active-game #pw-controls{flex-shrink:0!important;padding:4px;gap:4px;box-shadow:none}
  .bd-active-game #pw-theme{flex-shrink:0}
  .bd-active-game #pw-theme>div{padding:2px 12px}
  .bd-active-game #pw-progress{flex-shrink:0}
  .bd-active-game #pw-panel-tabs [role=tab]{min-height:36px}
  .bd-active-game #pw-action-row [role=button]{min-height:44px}

  /* SplitEm: answers stay above the source tray in portrait. The board
     scrolls only on genuinely short browser windows. */
  .bd-active-game #splitem-app{padding:4px 6px 8px!important}
  .bd-active-game #split-play{gap:5px}
  .bd-active-game #split-progress{gap:8px;padding:0 0 2px}
  .bd-active-game #split-progress>div{padding:3px 7px 3px 4px;gap:4px}
  .bd-active-game #split-progress>div>div:last-child{font-size:12px}
  .bd-active-game #split-progress>div+div::before{width:9px}
  .bd-active-game #split-progress [data-part=step-number]{width:20px;height:20px;line-height:20px;font-size:12px}
  .bd-active-game #split-round-header{padding:0 4px;gap:2px}
  .bd-active-game #split-prompt{font-size:16px;line-height:1.2;letter-spacing:0}
  .bd-active-game #split-subtitle{display:none}
  .bd-active-game #split-table{border-width:2px;padding:6px;border-radius:18px;box-shadow:0 3px 0 #263d88}
  .bd-active-game #split-round-content{gap:7px;padding-bottom:6px;overflow-y:auto;overscroll-behavior:contain}
  .bd-active-game #split-pool-side{order:1;gap:4px;padding:6px;flex-shrink:0}
  .bd-active-game #split-pool{width:100%;max-width:340px;gap:6px;flex:none;align-content:center}
  .bd-active-game #split-pool>div,.bd-active-game #split-pool:has(>div:nth-child(7))>div{width:calc((100% - 12px)/3)!important;height:48px!important;min-height:48px}
  .bd-active-game #split-pool [data-part=tile]>div:last-child{font-size:11px!important;line-height:1.15!important}
  .bd-active-game #split-instruction{display:none}
  .bd-active-game #split-answers{gap:5px;padding:6px;flex-shrink:0}
  .bd-active-game [data-part=answer-row]{height:44px!important;min-height:44px;max-height:44px}
  .bd-active-game [data-part=answer-slot],.bd-active-game [data-part=answer-slot] [role=button]{min-height:42px}
  .bd-active-game #split-meta{height:32px;min-height:32px;padding:4px 8px!important;gap:10px}
  .bd-active-game #split-actions{padding-top:5px!important;gap:6px}
  .bd-active-game #split-actions>[role=button],.bd-active-game #split-actions [data-part=primary-button]>div{min-height:44px}

  /* CodeCrack: protect the clue canvas; keep all four answers and code slots.
     Tiny windows scroll the play surface rather than reducing clue legibility. */
  .bd-active-game #codecrack-app{padding:4px 6px 8px!important}
  .bd-active-game #code-play{gap:8px;padding:0!important;overflow-y:auto;overscroll-behavior:contain}
  .bd-active-game #code-board-body{min-height:440px;flex-shrink:0}
  .bd-active-game #code-round{grid-template-rows:auto minmax(240px,1fr) auto auto;gap:6px!important}
  .bd-active-game #code-stage{padding:6px!important;border-radius:16px!important}
  .bd-active-game #code-clue-heading{margin-bottom:4px;gap:6px}
  .bd-active-game #code-prompt{padding:2px 6px!important}
  .bd-active-game #code-prompt>div{font-size:18px!important;line-height:1.18!important}
  .bd-active-game #code-options [data-part=answer-option]{height:48px!important}
  .bd-active-game #code-round-nav [role=button]{min-height:44px;padding:8px!important}
  .bd-active-game #code-scoreboard{padding:7px 9px!important;gap:6px;border-radius:16px!important}
  .bd-active-game #code-console-action>[role=button]{min-height:44px}
  .bd-active-game #code-board-body:has(#code-finale){min-height:0;flex:1}
}
@media(max-width:700px){
  .bd-active-game #split-pool>div,.bd-active-game #split-pool:has(>div:nth-child(7))>div{height:44px!important;min-height:44px}
  .bd-active-game #split-pool-side,.bd-active-game #split-answers{padding:4px;gap:3px}
  .bd-active-game #split-round-content{gap:4px;padding-bottom:4px}
  .bd-active-game #split-pool-label,.bd-active-game #split-answer-label{font-size:8px;line-height:10px;margin:0}
  .bd-active-game #pw-play-area{flex:0 0 auto!important;min-height:0}
  .bd-active-game #pw-board-area{flex:0 0 auto!important;height:min(calc(100vw - 12px),520px)}
  .bd-active-game #pw-action-row{order:-1;padding:0!important;margin:0!important}
  .bd-active-game #pw-progress{margin-top:5px!important}
}

/* Lobby chrome and primary actions stay in the viewport. Only collections
   (saved matches, previews or long descriptions) may scroll inside it. */
.bd-playing .lc-lobby-body{min-height:0;overflow:hidden}
.bd-playing .lc-lobby-start{min-height:0;padding-bottom:0;gap:clamp(6px,1.5dvh,15px)}
.bd-playing .lc-lobby-welcome{padding-bottom:clamp(0px,1dvh,12px)}
.bd-playing .lc-lobby-welcome img{width:clamp(48px,11dvh,100px);margin-bottom:clamp(6px,1.5dvh,16px)}
.bd-playing .lc-lobby-welcome h1{font-size:clamp(24px,4.5dvh,40px);margin-bottom:8px}
.bd-playing .lc-lobby-action{min-height:clamp(52px,10dvh,82px);padding:10px 12px}
.bd-playing .lc-lobby-empty{min-height:0;height:100%;padding:12px;gap:7px}
.bd-playing .lc-lobby-empty img{width:clamp(32px,7dvh,64px)}
.bd-playing .lc-lobby-empty h3{font-size:clamp(16px,2.8dvh,22px)}
.bd-playing .lc-lobby-empty p{font-size:13px;line-height:1.35}
.bd-playing .lc-lobby-list{flex:1}
.bd-playing #game-lobby{min-height:0}
.bd-playing #game-lobby-footer,.bd-playing #game-lobby-tabs{flex-shrink:0}
.bd-playing #codecrack-app:has(#game-lobby)>#game-lobby-tabs{position:relative;inset:auto}
.bd-playing #game-lobby-footer{padding:clamp(8px,2dvh,20px);gap:6px}
.bd-playing #game-lobby-footer [role=button]{flex-shrink:0}
.bd-playing #split-lobby-rounds{gap:clamp(8px,2dvh,22px);margin:clamp(8px,2dvh,22px) 0}
.bd-playing #split-lobby-rounds>div>div{min-height:clamp(90px,22dvh,190px);padding:clamp(12px,3dvh,25px)}
.bd-playing #game-lobby>div:first-child>div{padding:clamp(8px,2dvh,24px) clamp(12px,3vw,30px)}
.bd-playing #code-lobby-art{width:clamp(70px,18dvh,166px);height:clamp(70px,18dvh,166px)}
.bd-playing #code-lobby-icon{width:88%!important;height:88%!important}
.bd-playing #code-lobby-ring{width:98%!important;height:98%!important}
@media(min-width:900px) and (min-aspect-ratio:6/5){
  .bd-playing #codecrack-app #game-lobby{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(260px,.8fr);gap:24px;max-width:1120px}
  .bd-playing #codecrack-app #game-lobby>div:first-child{min-height:0}
  .bd-playing #codecrack-app #game-lobby [data-part=surface]{min-height:0}
  .bd-playing #code-lobby-hero{min-height:0}
}

@media(max-width:759px),(max-aspect-ratio:6/5){
  .bd-playing .lc-lobby{padding:4px 8px 8px;gap:6px}
  .bd-playing .lc-lobby-body{display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto minmax(0,1fr);gap:8px!important;padding:0!important}
  .bd-playing .lc-lobby-start{gap:6px}
  .bd-playing .lc-lobby-welcome{display:grid;grid-template-columns:clamp(38px,8dvh,56px) minmax(0,1fr);gap:3px 12px;align-items:center;padding:4px}
  .bd-playing .lc-lobby-welcome img{display:block;grid-row:1/3;width:100%;margin:0}
  .bd-playing .lc-lobby-welcome h1{grid-column:2;font-size:clamp(21px,3.8dvh,28px);margin:0;max-width:none}
  .bd-playing .lc-lobby-welcome p{grid-column:2;font-size:13px;margin:0;white-space:normal}
  .bd-playing .lc-lobby-action{min-height:52px;padding:7px 10px;gap:9px;border-radius:14px}
  .bd-playing .lc-lobby-action strong{font-size:16px}
  .bd-playing .lc-lobby-action small{font-size:11px;margin-top:1px}
  .bd-playing .lc-lobby-action-icon{flex-basis:32px;height:32px}
  .bd-playing .lc-lobby-action-icon svg{width:21px;height:21px}
  .bd-playing .lc-how-to-button{min-height:28px;font-size:12px}
  .bd-playing .lc-lobby-games{padding:10px!important;border-radius:18px;overflow:hidden}
  .bd-playing .lc-lobby-list-header{margin-bottom:6px;flex-shrink:0}
  .bd-playing .lc-lobby-list-header h2{font-size:21px!important}
  .bd-playing .lc-lobby-open{min-height:82px;padding:9px 28px 9px 8px;gap:8px}
  .bd-playing .lc-card-players{gap:6px;padding:0}
  .bd-playing .lc-player-name{font-size:12px}
  .bd-playing .lc-player-row{gap:5px}
  .bd-playing .lc-player-row strong{font-size:16px}
  .bd-playing .lc-initial{width:24px;height:24px;flex-basis:24px;font-size:13px}
  .bd-playing .lc-match-preview{display:none}
  .bd-playing .lc-card-resume{min-width:60px;gap:5px;padding-left:6px}
  .bd-playing .lc-card-resume small{font-size:10px}
  .bd-playing .lc-continue{padding:7px;font-size:11px;gap:4px}
}
@media(max-width:700px){
  /* The fifteen-piece preview flexes between the date and the pinned CTA. */
  .bd-playing #pw-lobby-column{padding:4px 10px calc(68px + env(safe-area-inset-bottom))!important;gap:4px;min-height:0}
  .bd-playing #pw-lobby-column>div:not(#pw-lobby-preview){flex-shrink:0}
  .bd-playing #pw-lobby-header{min-height:32px}
  .bd-playing #pw-lobby-date{font-size:10px;margin-top:0;letter-spacing:.5px}
  .bd-playing #pw-lobby-theme{margin-top:0;padding:4px 12px}
  .bd-playing #pw-lobby-theme>div{font-size:11px}
  .bd-playing #pw-lobby-score{margin-top:2px}
  .bd-playing #pw-lobby-score [role=img]{width:18px!important;height:18px!important}
  .bd-playing #pw-lobby-preview{margin:3px 0;min-height:0}
  .bd-playing #pw-lobby-preview>div{padding:4px}
  .bd-playing #pw-lobby-claimed{padding:3px 12px}
  .bd-playing #pw-lobby-claimed>div{font-size:11px}
  .bd-playing #pw-lobby-actions>[role=button]{margin-top:2px}
  .bd-playing #pw-lobby-actions>[role=button]>div{min-height:44px}
  .bd-playing #pw-lobby-tabs{padding:0 10px calc(5px + env(safe-area-inset-bottom))!important}
  .bd-playing #pw-lobby-tabs>[role=tablist]{padding:4px 6px}
  .bd-playing #pw-lobby-tabs [role=tab]{min-height:44px}
  .bd-playing #pw-lobby-tabs [role=tab]>div:first-child{height:28px}

  .bd-playing #splitem-app:has(#game-lobby),.bd-playing #codecrack-app:has(#game-lobby){padding:4px 8px 6px!important;gap:4px}
  .bd-playing #game-lobby>div:first-child>div{padding:6px 4px!important;gap:8px;justify-content:center}
  .bd-playing #split-lobby-heading{gap:3px}
  .bd-playing #split-lobby-topic{font-size:clamp(20px,3.7dvh,26px)}
  .bd-playing #split-lobby-rounds{gap:clamp(5px,1.1dvh,10px);margin:4px 0}
  .bd-playing #split-lobby-rounds>div>div{min-height:0;padding:clamp(6px,1.2dvh,12px)!important}
  .bd-playing #splitem-app #game-lobby>div:first-child>div{min-height:0;justify-content:flex-start}
  .bd-playing #split-lobby-rounds [data-part=round-description]{font-size:12px;line-height:16px}
  .bd-playing #split-lobby-rounds [data-part=surface]>div:last-child{gap:5px}
  .bd-playing #game-lobby-footer{padding:6px 2px!important;gap:4px}
  .bd-playing #game-lobby-footer [data-part=primary-button]>div{min-height:44px;padding:8px!important}
  .bd-playing #game-lobby-tabs{margin-top:2px;padding-top:4px}
  .bd-playing #game-lobby-tabs [role=tab]{min-height:44px;gap:2px}
  .bd-playing #codecrack-app #game-lobby-tabs{padding:2px 0 0}
  .bd-playing #codecrack-app #game-lobby-tabs>div{padding:4px}
  .bd-playing #codecrack-app #game-lobby-tabs [role=tab]>div:first-child{height:27px}
  .bd-playing #codecrack-app #game-lobby [data-part=surface]{min-height:0;padding:clamp(8px,2dvh,16px)!important;gap:8px}
  .bd-playing #code-lobby-hero{min-height:0;gap:5px}
  .bd-playing #code-lobby-art{width:clamp(64px,16dvh,124px);height:clamp(64px,16dvh,124px)}
  .bd-playing #code-lobby-title{font-size:clamp(20px,3.8dvh,26px);line-height:1.1}
  .bd-playing #codecrack-app #game-lobby-footer>[role=button]:not([data-part]){min-height:36px;padding:5px 9px}
  .bd-playing #codecrack-app #game-lobby-footer>[role=button]:not([data-part])>div:first-child:not([dir=auto]){width:24px;height:24px}

  /* Preserve history's two-line card and all four players. Use compact
     controls before borrowing any room from the board. */
  /* Grow the square board to its width limit first, then give every spare
     pixel to the word box instead of centering the board in an empty row. */
  .bd-active-game .lc-game[data-match]{
    --lc-board-min:min(calc(100vw - 20px),360px);
    --lc-board-max:calc(100vw - 12px);
    display:flex;
    flex-direction:column;
    gap:4px;
  }
  .bd-active-game .lc-game[data-compact=true]{--lc-board-min:min(calc(100vw - 32px),330px)}
  .bd-active-game .lc-game[data-match]>.lc-score-row,
  .bd-active-game .lc-game[data-match]>.lc-game-actions,
  .bd-active-game .lc-game[data-match]>.lc-match-detail{flex-shrink:0}
  .bd-active-game .lc-game[data-match]>.lc-win{flex:1 0 auto}
  .bd-active-game .lc-game[data-compact=true] .lc-score-row{grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}
  .bd-active-game .lc-game[data-compact=true] .lc-score{min-height:29px;padding:1px 5px}
  .bd-active-game .lc-game[data-compact=true] .lc-score strong{height:22px;min-width:22px}
  .bd-active-game .lc-game[data-match] .lc-word-box{flex:1 0 34px;height:auto!important;min-height:34px;padding:3px 8px}
  .bd-active-game .lc-game[data-match] .lc-board-slot{flex:0 1 var(--lc-board-max);min-height:min(var(--lc-board-min),var(--lc-board-max))}
  .bd-active-game .lc-game[data-match] .lc-game-actions{gap:8px}
  .bd-active-game .lc-game[data-match] .lc-game-actions button{min-height:36px;height:36px;padding:3px 10px;font-size:14px;border-radius:13px}
  .bd-active-game .lc-game[data-match] .lc-last-move .lc-move-view{min-height:0;gap:5px;padding:6px 8px}
  .bd-active-game .lc-last-move .lc-standings{display:flex;flex-wrap:nowrap;gap:4px;padding-right:48px}
  .bd-active-game .lc-last-move .lc-standing{min-width:0;padding:2px 6px;font-size:10px;gap:3px}
  .bd-active-game .lc-last-move .lc-standing-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .bd-active-game .lc-last-move .lc-standing strong{flex-shrink:0}
  .bd-active-game .lc-last-move .lc-react{display:block;min-height:26px;padding:3px 8px;font-size:10px;bottom:4px;right:5px}
  .bd-active-game .lc-last-move .lc-move-top{gap:5px;font-size:12px}
  .bd-active-game .lc-move-top>.lc-score-dot{display:block;width:6px;height:6px;flex-basis:6px}
  .bd-active-game .lc-last-move .lc-move-top>strong{max-width:70px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .bd-active-game .lc-last-move .lc-move-hint{display:none}
  .bd-active-game .lc-last-footer{min-height:26px;padding-inline:3px;gap:4px}
  .bd-active-game .lc-history-link{min-height:26px;padding:3px}
}
@media(max-width:700px) and (max-height:620px){
  .bd-playing #code-lobby-hero{display:grid;grid-template-columns:64px minmax(0,1fr);gap:5px 10px;align-content:center}
  .bd-playing #code-lobby-hero>div:first-child{grid-column:1/3;justify-self:center}
  .bd-playing #code-lobby-art{grid-row:2/4;width:64px;height:64px}
  .bd-playing #code-lobby-title{grid-column:2;font-size:20px;text-align:left}
  .bd-playing #code-lobby-hero>div:last-child{grid-column:2;text-align:left}
}
@media(min-width:760px) and (min-aspect-ratio:6/5) and (min-height:601px) and (max-height:760px){
  .bd-playing .lc-game[data-compact=true]{row-gap:8px}
  .bd-playing .lc-game[data-compact=true] .lc-score{min-height:42px;padding:4px 6px}
  .bd-playing .lc-game[data-compact=true] .lc-word-box{height:112px;padding:10px}
  .bd-playing .lc-game[data-compact=true] .lc-game-actions button{min-height:40px;font-size:16px}
  .bd-playing .lc-game[data-compact=true] .lc-last-move{gap:6px}
  .bd-playing .lc-game[data-compact=true] .lc-last-move .lc-move-view{min-height:90px;padding:10px 10px 32px;gap:8px}
  .bd-playing .lc-game[data-compact=true] .lc-last-move .lc-standing{padding:3px 7px;font-size:11px}
}

/* Every game uses the same lobby destination, on desktop and phones alike. */
.bd-active-game #brainy-navigation .bd-home{display:none}
.bd-active-game #brainy-navigation .bd-play-back{display:flex;align-items:center;min-width:70px;min-height:44px;padding:5px 8px;border:0;background:transparent;color:inherit;font-size:14px;font-weight:800;text-decoration:none;white-space:nowrap}

/* PatchWord mobile: reserve the viewport for the grid and all 15 shapes.
   The tray's existing measured geometry sizes previews and hit targets together. */
.bd-patch-theme{display:none}
@media(max-width:700px){
 html.bd-active-game[data-brainy-game="patchword"]{overflow:hidden}
 .bd-active-game[data-brainy-game="patchword"] .bd-current-game{display:none}
 .bd-active-game[data-brainy-game="patchword"] .bd-play-back{display:flex;align-items:center;flex:0 0 98px;min-width:0;padding:4px}
 .bd-active-game[data-brainy-game="patchword"] .bd-play-back img{display:block;width:90px;height:28px;object-fit:contain}
 .bd-active-game[data-brainy-game="patchword"] .bd-patch-theme{display:flex;flex:1;min-width:0;align-items:center;justify-content:center;text-align:center;font-size:11px;font-weight:900;line-height:1.15;color:#684299;overflow-wrap:anywhere;max-height:44px;overflow:hidden}
 .bd-active-game[data-brainy-game="patchword"] .bd-switcher{flex-shrink:0;margin-left:0}
 .bd-active-game[data-brainy-game="patchword"] .bd-switch-button{padding:4px;font-size:12px}
 .bd-active-game[data-brainy-game="patchword"] #pw-theme{display:none!important}
 .bd-active-game[data-brainy-game="patchword"] #pw-game{min-height:0;overflow:hidden}
 .bd-active-game[data-brainy-game="patchword"] #pw-content{min-height:0;overflow:hidden!important;padding:2px 5px max(4px,env(safe-area-inset-bottom))!important;gap:2px}
 .bd-active-game[data-brainy-game="patchword"] #pw-progress{margin:0!important;padding:2px!important;flex-shrink:0}
 .bd-active-game[data-brainy-game="patchword"] #pw-play-area{flex:1 1 0%!important;min-height:0;gap:3px!important}
 .bd-active-game[data-brainy-game="patchword"] #pw-board-area{flex:1 1 0%!important;height:auto!important;min-height:0;touch-action:none}
 .bd-active-game[data-brainy-game="patchword"] #pw-controls{flex:0 0 auto!important;min-height:0;padding:3px!important;gap:3px!important;border-radius:12px}
 .bd-active-game[data-brainy-game="patchword"] #pw-panel{touch-action:none;user-select:none;-webkit-user-select:none}
 .bd-active-game[data-brainy-game="patchword"] #pw-action-row [role=button]{min-height:32px!important;padding:5px!important}
 .bd-active-game[data-brainy-game="patchword"] #pw-panel-tabs{margin:0 0 2px!important}
 .bd-active-game[data-brainy-game="patchword"] #pw-panel-tabs [role=tab]{min-height:26px!important;padding:3px!important}
 .bd-active-game[data-brainy-game="patchword"] #pw-keyboard-help{padding:0!important;font-size:10px;line-height:12px}
}

/* Home/lobby belongs to Brainy Day; the game logo returns from play to its lobby. */
.bd-active-game #brainy-navigation .bd-current-game{display:none}
.bd-active-game #brainy-navigation .bd-play-back img{width:130px;height:34px;object-fit:contain}
@media(max-width:700px){
 .bd-active-game #brainy-navigation .bd-play-back{min-width:0;flex-shrink:0}
 .bd-active-game #brainy-navigation .bd-play-back img{width:115px;height:30px}
 .bd-active-game[data-brainy-game="patchword"] #brainy-navigation .bd-play-back img{width:90px;height:28px}
 .bd-active-game[data-brainy-game="patchword"] .bd-patch-theme{color:#fff;border:1px solid #a665e4;background:linear-gradient(#ac6cff,#7c2ce7);box-shadow:inset 0 1px 0 #e4c6ff,0 3px 6px #7030b820;border-radius:18px;padding:5px 9px;letter-spacing:.3px;font-size:10px;text-transform:uppercase}
 .bd-active-game[data-brainy-game="patchword"] #pw-progress{order:-1!important}
}

/* One browser-wide appearance preference. Only game surfaces change; clue,
   ownership, shape, and scoring colors retain their meaning in both modes. */
.bd-appearance-setting{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:15px 16px;border:1px solid #d8cfe7;border-radius:16px;background:#f6f1fc;color:#241b3c;font:600 14px/1.4 Nunito,system-ui,sans-serif;flex-shrink:0}
.bd-appearance-setting strong{font-size:16px}.bd-appearance-setting p{margin:3px 0 0;font-size:12px;color:#655775}
.bd-appearance-setting button[role=switch]{display:flex;align-items:center;flex:none;width:50px;height:30px;min-height:30px;padding:3px;border:1px solid #9b8dad;border-radius:99px;background:#c1b6d1;cursor:pointer;box-shadow:none}
.bd-appearance-setting button[role=switch]>span{display:block;width:22px;height:22px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #16102540;transform:translateX(0)}
.bd-appearance-setting button[role=switch][aria-checked=true]{background:#8254e8;border-color:#b89aff}.bd-appearance-setting button[role=switch][aria-checked=true]>span{transform:translateX(20px)}
.bd-appearance-setting button[role=switch]:focus-visible{outline:2px solid #926dff;outline-offset:4px}
#brainy-navigation .bd-menu-appearance{margin:6px 0 12px;background:#342347;color:#fff;border-color:#69517f}
#brainy-navigation .bd-menu-appearance p{color:#d6c8e4}
html[data-bd-appearance=dark]{
  --bd-night-bg:#121020;--bd-night-panel:#211d33;--bd-night-raised:#302a45;--bd-night-edge:#51465f;--bd-night-ink:#f5efff;--bd-night-muted:#c4b8d7;
  --pw-light-screen:#181420;--pw-light-surface:#292235;--pw-light-surfaceStrong:#382f47;--pw-light-border:#4b3e5b;--pw-light-borderStrong:#78628f;
  --pw-light-text:#f9f2ff;--pw-light-textSecondary:#d0c0df;--pw-light-textTertiary:#b3a2c5;--pw-light-boardEdge:#a581c6;--pw-light-gridBg:#1b1626;--pw-light-gridLine:#342840;
  --pw-light-control:#433452;--pw-light-controlBorder:#79648f;--pw-light-controlText:#f6edff;--pw-light-controlDisabled:#31283f;--pw-light-controlDisabledBorder:#53435e;--pw-light-brandDisabled:#4a3367;--pw-light-textDisabled:#b2a0c4;
  --pw-light-danger:#ff9e95;--pw-light-dangerBg:#461e2d;--pw-light-dangerBorder:#955065;--pw-light-brandTint:#3b2855;--pw-light-brandTintStrong:#65438d;--pw-light-ink:#f7efff;--pw-light-success:#59dfae;
  --split-palette-bg0:#121a2b;--split-palette-bg1:#1a2438;--split-palette-bg2:#222f48;--split-palette-surface:#202c42;--split-palette-surfaceStrong:#2b3b55;--split-palette-surfaceBorder:#405576;--split-palette-surfaceBorderStrong:#6986af;
  --split-palette-text:#f3f6ff;--split-palette-textSecondary:#c0cce0;--split-palette-textTertiary:#a8b8ce;--split-palette-tile:#263b5d;--split-palette-tileBorder:#6e91c5;--split-palette-tileText:#f6f8ff;--split-palette-success:#55dbaf;--split-palette-error:#ff93ad;--split-palette-warning:#ffd075;
  --split-fun-card:#202c42;--split-fun-ink:#f3f6ff;--split-fun-inkSoft:#c0cce0;--split-fun-inkFaint:#a8b8ce;--split-fun-fieldBg:#172238;--split-fun-fieldBorder:#526b8d;
  --code-palette-bg0:#100c17;--code-palette-bg1:#17111f;--code-palette-bg2:#251b30;--code-palette-surface:#241b2f;--code-palette-surfaceStrong:#32253f;--code-palette-surfaceBorder:#51405f;--code-palette-surfaceBorderStrong:#85649b;
  --code-palette-text:#fff5ff;--code-palette-textSecondary:#dfcde9;--code-palette-textTertiary:#bda7cb;--code-fun-card:#241b2f;--code-fun-ink:#fff5ff;--code-fun-inkSoft:#dfcde9;--code-fun-inkFaint:#bda7cb;--code-fun-fieldBg:#17111f;--code-fun-fieldBorder:#695078;
}
html[data-bd-appearance=dark].bd-playing{color-scheme:dark}
html[data-bd-appearance=dark] .bd-appearance-setting{background:var(--bd-night-raised);border-color:var(--bd-night-edge);color:var(--bd-night-ink)}
html[data-bd-appearance=dark] .bd-appearance-setting p{color:var(--bd-night-muted)}
html[data-bd-appearance=dark].bd-playing #brainy-navigation{background:#1b152b;border-color:#4e3b65;color:#f7efff}
html[data-bd-appearance=dark].bd-playing #brainy-navigation :is(.bd-switch-button,.bd-play-back,.bd-overview){color:#f5edff}
html[data-bd-appearance=dark].bd-playing #brainy-navigation .bd-switch-button{background:#332343;border-color:#66517b}

/* LetterClash keeps bright player tiles against a quiet night-time table. */
html[data-bd-appearance=dark] :is(.lc-app,.lc-app:has(.lc-lobby-native),.lc-tutorial-screen){background:linear-gradient(150deg,#29204d,#13182f 72%,#142a3c)!important}
html[data-bd-appearance=dark] :is(.lc-app,.lc-tutorial-screen)::before{opacity:.12}
html[data-bd-appearance=dark] :is(.lc-game,.lc-game[data-match],.lc-tutorial-screen){--lc-ink:#f5efff;--lc-secondary:#c4b8d7}
html[data-bd-appearance=dark] .lc-board-felt{background:linear-gradient(140deg,#35304b,#211e34)!important;border-color:#6b5e84!important}
html[data-bd-appearance=dark] :is(.lc-score,.lc-word-box,.lc-move-card,.lc-lobby-native .lc-lobby-action,.lc-lobby-native .lc-lobby-match,.lc-tutorial-card,.lc-tutorial-win){background:#282239!important;color:var(--bd-night-ink)!important;border-color:#5e5075!important}
html[data-bd-appearance=dark] .lc-score[data-active=true]{background:#39304f!important;border-color:var(--player-color)!important}
html[data-bd-appearance=dark] :is(.lc-word-placeholder,.lc-word-placeholder p,.lc-move-word,.lc-tutorial-caption,.lc-player-name,.lc-lobby-native .lc-player-row,.lc-lobby-native .lc-lobby-action small){color:var(--bd-night-muted)!important}
html[data-bd-appearance=dark] :is(.lc-sheet,.lc-history){background:#211d33;color:#f5efff;border:1px solid #51465f}
html[data-bd-appearance=dark] :is(.lc-info-scores,.lc-info-rules,.lc-best-words,.lc-settings-link,.lc-settings-download,.lc-preferences,.lc-profile-counts>div,.lc-profile-record>div,.lc-chat-message,.lc-reaction-picker){background:#302a45;color:#f5efff;border-color:#51465f}
html[data-bd-appearance=dark] :is(.lc-sheet-close,.lc-history-close,.lc-react,.lc-secondary,.lc-tutorial-back,.lc-tutorial-counter,.lc-settings-download a,.lc-chat-reactions button){background:#443653!important;color:#e6d5f7!important;border-color:#75618b!important}
html[data-bd-appearance=dark] :is(.lc-react,.lc-secondary,.lc-sheet-close):enabled:hover{background:#59456c!important}
html[data-bd-appearance=dark] :is(.lc-delete,.lc-submit:disabled){background:#3c3454!important;color:#d1c2e1!important}
html[data-bd-appearance=dark] :is(.lc-sheet-fields input,.lc-rule-select select,.lc-chat-compose input,.lc-friend-inputs input){background:#171322;color:#f5efff;border-color:#69577e}
html[data-bd-appearance=dark] :is(.lc-create-sheet .lc-setup-choices button:not([aria-pressed=true]),.lc-setup-info){background:#352a47;color:#dfccee;border-color:#59466c}
html[data-bd-appearance=dark] :is(.lc-sheet-fields p,.lc-sheet-fields label small,.lc-info-rules dt,.lc-settings-account p,.lc-settings-download p,.lc-settings-legal,.lc-preferences p,.lc-chat-empty,.lc-chat-message time,.lc-chat-players summary,.lc-chat-players>a,.lc-chat-reactions summary,.lc-details-content h3,.lc-profile h3,.lc-info-date,.lc-profile-counts span,.lc-profile-record span,.lc-setup-rule-label,.lc-setup-info-button){color:#c4b8d7}
html[data-bd-appearance=dark] .lc-chat-message[data-mine=true]{background:#263957}
html[data-bd-appearance=dark] .lc-info-scores .lc-player-name{color:#f5efff!important}
html[data-bd-appearance=dark] :is(.lc-info-scores strong,.lc-best-words strong,.lc-profile-counts strong,.lc-profile-record strong){color:#c3a0ff}
html[data-bd-appearance=dark] .lc-lobby-native .lc-lobby-tabbar{background:#211d33;border-color:#51465f}

/* PatchWord: dark graph paper, readable empty cells, unchanged colored pieces. */
html[data-bd-appearance=dark][data-brainy-game=patchword] body{background:#1b1626}
html[data-bd-appearance=dark] :is(#pw-game,#pw-lobby){background:radial-gradient(ellipse at 20% 0,#362442,transparent 65%),#1b1626}
html[data-bd-appearance=dark] :is(#pw-controls,#pw-lobby-preview>div){background:#292235;border-color:#63506f;box-shadow:inset 0 1px 0 #65516d,0 4px 0 #100d17}
html[data-bd-appearance=dark] #pw-board-frame{background:#32273c!important;border-color:#745c85!important;box-shadow:0 3px 0 #100b17}
html[data-bd-appearance=dark] [data-part=pw-cell]{background:linear-gradient(135deg,#44364c,#34293f)!important;border-color:#77627f!important;box-shadow:inset 0 1px 0 #89728b55}
html[data-bd-appearance=dark] [data-part=pw-cell]>div{color:#fff1e7!important}
html[data-bd-appearance=dark] [data-part=pw-cell][data-black=true]{background:#110d19!important;border-color:#22182d!important}
html[data-bd-appearance=dark] [data-part=pw-shape-card]{background:#2c2438!important;border-color:#725c85!important;box-shadow:inset 0 1px 0 #977da333,0 3px 5px #0004}
html[data-bd-appearance=dark] #pw-header [role=button]{background:#413151;border-color:#79628b}
html[data-bd-appearance=dark] :is(#pw-back>div,#pw-keyboard-help){color:#dac7e8}
html[data-bd-appearance=dark] #pw-action-row [role=button]{box-shadow:0 3px 0 #130c21;border-color:#7e6199}
html[data-bd-appearance=dark] .pw-words-popup{background:#292235!important;color:#f9efff!important;border-color:#78628f!important}
html[data-bd-appearance=dark] .pw-words-popup button{background:#48345e!important;color:#f6ebff!important}

/* SplitEm: blue tile pool and amber answer wells remain visibly distinct. */
html[data-bd-appearance=dark][data-brainy-game=splitem]{--paper:#121a2b;--ink:#f3f6ff;--edge:#58729b;--raised:inset 0 1px 0 #748aa333,0 3px 0 #0b1222}
html[data-bd-appearance=dark][data-brainy-game=splitem] #game-background{background:radial-gradient(ellipse at 20% 0,#223b60,transparent 60%),#121a2b!important}
html[data-bd-appearance=dark][data-brainy-game=splitem] [data-part=surface]{background:linear-gradient(145deg,#253650,#1c283d)!important;border-color:#526c92!important}
html[data-bd-appearance=dark] #split-table{background:linear-gradient(115deg,#202e48,#1b263a 55%,#362c31);border-color:#6583d2;box-shadow:inset 0 1px 0 #7488b8,0 4px 0 #0b1327}
html[data-bd-appearance=dark] #split-pool-side{background:#203c62;border-color:#577cb0;box-shadow:inset 0 1px 0 #7a9cd333}
html[data-bd-appearance=dark] #split-answers{background:#413126;border-color:#95704e;box-shadow:inset 0 1px 0 #d2a36d33}
html[data-bd-appearance=dark] [data-part=answer-slot]{background:#2a211e!important;border-color:#967350!important;box-shadow:inset 0 2px 5px #0d091855}
html[data-bd-appearance=dark] [data-part=answer-slot][data-filled=false]>div{color:#dec4aa}
html[data-bd-appearance=dark] [data-part=answer-slot][data-hover=valid]{background:#205a48!important}
html[data-bd-appearance=dark] [data-part=answer-slot][data-hover=banned]{background:#672b3b!important}
html[data-bd-appearance=dark] :is(#split-pool-label,#split-instruction,#split-subtitle){color:#c1d4ef}
html[data-bd-appearance=dark] #split-answer-label{color:#f5d1a9}
html[data-bd-appearance=dark] #split-meta{background:linear-gradient(#2a3551,#202a43);border-color:#647395;box-shadow:0 3px 0 #10182c}
html[data-bd-appearance=dark][data-brainy-game=splitem] :is(#game-back,#game-toolbar-actions>[role],#split-actions>[role=button]:not([data-part])){background:linear-gradient(#3a5074,#253955);border-color:#6b87b1;color:#f3f6ff}
html[data-bd-appearance=dark][data-brainy-game=splitem] #game-lobby-tabs{background:#1c283d;border-color:#526c92}
html[data-bd-appearance=dark][data-brainy-game=splitem] [data-part=primary-button][aria-disabled=true]>div{background:#3a4963!important;border-color:#667d9f}
html[data-bd-appearance=dark] [data-part=match-label]>div{color:#f5ddc3}

/* CodeCrack already has a dark palette. Night mode lowers its ambient light. */
html[data-bd-appearance=dark][data-brainy-game=codecrack] #game-background{background:radial-gradient(ellipse at 30% 0,#2b1e38,transparent 60%),#100c17!important}
html[data-bd-appearance=dark] :is(#code-stage,#code-control-panel,#code-scoreboard,#code-your-code,#code-results){background:linear-gradient(145deg,#2b2035,#191321);border-color:#6f5183!important}
html[data-bd-appearance=dark][data-brainy-game=codecrack] [data-part=surface]{background:#241b2f!important;border-color:#695078!important}
html[data-bd-appearance=dark]{--pw-palette-boardCell:#1e1728;--pw-palette-boardBlack:#110d19}
html[data-bd-appearance=dark] :is(.lc-lobby-native .lc-lobby-tabs,.lc-scoreboard,.lc-word-bests){background:#302a45;color:#f5efff;border-color:#51465f}
html[data-bd-appearance=dark] .lc-lobby-tabs button:not([aria-current=page]){color:#c7b9dc}
html[data-bd-appearance=dark] .lc-lobby-tabs button:is(:hover,:focus-visible){background:#443653;color:#f3eaff}
html[data-bd-appearance=dark] .lc-sheet .lc-scoreboard .lc-player-name{color:#f5efff}
html[data-bd-appearance=dark] .lc-sheet .lc-scoreboard .lc-player-row>strong{color:var(--player-color)}
html[data-bd-appearance=dark] :is(.lc-word-bests strong,.lc-word-bests small){color:#c3a0ff}
html[data-bd-appearance=dark][data-brainy-game=splitem] #game-back>div:last-child{color:#f3f6ff}
html[data-bd-appearance=dark]{--pw-brandInk:#c7a5ff;--split-brandInk:#9bbfff}

/* Common game utilities. Local lobby links remain only as navigation hooks;
   the game logo in the shared header is the single route back to the lobby. */
.bd-playing :is(.lc-game-header .lc-context-back,.lc-game-header .lc-location-label,#pw-game #pw-back,#game-back,#game-toolbar [aria-label$="lobby"],#game-toolbar [aria-label$="archive"]){display:none!important}
.bd-game-tools{position:relative;display:flex;align-items:center;justify-content:flex-end;flex:none;gap:10px;color:inherit}
.bd-tool-button{display:inline-flex;align-items:center;justify-content:center;flex:none;width:36px;height:36px;min-height:36px;padding:7px;border:0;border-radius:10px;background:transparent;color:inherit;cursor:pointer;font:inherit;box-shadow:none}
.bd-tool-button svg{display:block;width:22px;height:22px}
.bd-tool-button:is(:hover,:focus-visible){background:#8e6fb326}
.bd-tool-button:focus-visible{outline:2px solid #9373c4;outline-offset:2px}
.bd-tool-notice{position:absolute;right:0;top:100%;width:260px;padding:12px;border-radius:12px;background:#332843;color:#f7efff;font-size:13px;z-index:10}
.bd-playing #game-toolbar>.bd-game-tools,.bd-playing #game-toolbar-actions>.bd-game-tools{display:flex!important;width:auto!important;height:auto!important;border:0!important;border-radius:0!important;background:none!important;box-shadow:none!important;gap:10px}
.bd-playing #game-toolbar:has(.bd-game-tools){justify-content:flex-end}
.bd-playing #game-toolbar>div:has(>.bd-game-tools){width:auto;max-width:none;margin-left:auto;align-items:flex-end}
.bd-playing #pw-header .bd-game-tools{margin-left:auto;color:var(--pw-palette-text,#4b3566)}
.bd-playing #pw-header .bd-game-tools>[role=button]{background:transparent;border:0}
.bd-tool-dialog{--tool-bg:#faf7ff;--tool-ink:#292037;--tool-edge:#d7c9e5;box-sizing:border-box;width:min(600px,calc(100vw - 24px));max-height:calc(100dvh - 32px);padding:0;border:1px solid var(--tool-edge);border-radius:24px;background:var(--tool-bg);color:var(--tool-ink);box-shadow:0 22px 90px #09041366;font-family:BrainyNavigation,system-ui,sans-serif;overflow:hidden}
.bd-tool-dialog::backdrop{background:#100a286e;backdrop-filter:blur(5px)}
.bd-tool-dialog-layout{display:flex;flex-direction:column;max-height:calc(100dvh - 34px)}
.bd-tool-dialog header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 20px;border-bottom:1px solid var(--tool-edge);flex:none}
.bd-tool-dialog h2{margin:0;font-size:22px;line-height:1.2}
.bd-tool-dialog header button{background:#9c7aba20;font-size:28px;line-height:1}
.bd-tool-content{min-height:0;overflow:auto;overscroll-behavior:contain;padding:16px;display:flex;flex-direction:column;gap:12px}
.bd-tool-content #game-panel-scroll{flex:0 0 auto;overflow:visible}
.bd-tool-content #game-panel-scroll>div{padding:4px!important}
.bd-tool-setting{display:flex;align-items:center;justify-content:space-between;min-height:48px;padding:12px 16px;background:#8e6fb316;border:1px solid var(--tool-edge);border-radius:14px;color:inherit;cursor:pointer;font:800 15px BrainyNavigation,system-ui,sans-serif}
.bd-tool-setting:hover{background:#8e6fb32a}
html[data-brainy-game=codecrack] .bd-tool-dialog,html[data-bd-appearance=dark] .bd-tool-dialog{--tool-bg:#211b30;--tool-ink:#f7efff;--tool-edge:#655473}
/* Night mode must theme the inner buttons too, including hover and focus. */
html[data-bd-appearance=dark].bd-playing #brainy-navigation{--bd-nav-ink:#f7efff;--bd-nav-muted:#c5b8d8;--bd-nav-bg:#1b152b;--bd-nav-panel:#292137;--bd-nav-border:#635174}
html[data-bd-appearance=dark] .bd-game-choice[aria-current]{border-color:#9a80bc;box-shadow:inset 0 0 0 1px #9a80bc}
html[data-bd-appearance=dark] .bd-tool-button:is(:hover,:focus-visible){background:#8e73b12e;color:#f7efff}
html[data-bd-appearance=dark] .lc-lobby-native .lc-lobby-open{background:transparent;color:#f5efff}
html[data-bd-appearance=dark] .lc-lobby-native .lc-lobby-open:is(:hover,:focus-visible){background:#39304c!important;color:#f5efff}
html[data-bd-appearance=dark] .lc-lobby-native :is(.lc-player-name,.lc-player-row,.lc-lobby-action strong){color:#f5efff!important}
html[data-bd-appearance=dark] .lc-lobby-native .lc-lobby-action:is(:hover,:focus-visible){background:#39304c!important;border-color:#8a73a5!important}
html[data-bd-appearance=dark] .lc-lobby-native :is(.lc-card-info,.lc-invite-actions button){background:#443653;color:#e8dcf5}
html[data-bd-appearance=dark] .lc-lobby-native .lc-card-info:is(:hover,:focus-visible){background:#5b4571;color:#fff}
html[data-bd-appearance=dark] .lc-lobby-native .lc-lobby-match[data-my-turn=true]{border-color:#4e9f8e!important}
html[data-bd-appearance=dark] .lc-lobby-native .lc-lobby-match[data-invitation=true]{border-color:#bb884f!important}
html[data-bd-appearance=dark] .lc-lobby-native .lc-invite-actions{border-color:#635174}
html[data-bd-appearance=dark] .lc-lobby-native .lc-invite-actions>span{color:#c4b8d7}
html[data-bd-appearance=dark] .lc-lobby-native .lc-player-0{--player-dark:#8bacff}
html[data-bd-appearance=dark] .lc-lobby-native .lc-player-1{--player-dark:#ff82a8}
html[data-bd-appearance=dark] .lc-lobby-native .lc-player-2{--player-dark:#ffca7b}
html[data-bd-appearance=dark] .lc-lobby-native .lc-player-3{--player-dark:#72ddc0}
html[data-bd-appearance=dark] :is(.lc-game-header,.lc-lobby-welcome) .lc-icon-button:is(:hover,:focus-visible){background:#4a3b5f;color:#f5efff}
html[data-bd-appearance=dark] .lc-lobby-native .lc-lobby-message{background:#332b45;color:#ede5fa}

/* Give the desktop game its available width, rather than a compact promo frame. */
@media(min-width:900px){
 .bd-playing #splitem-app{max-width:1920px!important;width:100%!important}
 .bd-playing #split-table{max-width:none!important;width:100%!important}
 .bd-playing #game-lobby{max-width:1500px!important}
}
@media(min-width:740px) and (min-aspect-ratio:1.15){
 .bd-active-game #pw-progress{position:fixed;top:0;left:50%;transform:translateX(-50%);height:var(--bd-nav-height);width:auto;z-index:1001;justify-content:center}
 .bd-active-game #pw-play-area{display:grid!important;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:minmax(0,1fr) auto;gap:10px 28px!important;flex:1;align-items:stretch}
 .bd-active-game #pw-board-area{grid-column:1;grid-row:1;min-height:0}
 .bd-active-game #pw-action-row{grid-column:1;grid-row:2;justify-self:center;order:0!important}
 .bd-active-game #pw-controls{grid-column:2;grid-row:1 / 3;align-self:stretch;justify-content:center}
}
@media(max-width:700px){
 .bd-active-game[data-brainy-game="patchword"] #pw-action-row{order:0!important;flex-shrink:0;align-self:center;width:100%!important}
 .bd-active-game[data-brainy-game="patchword"] #pw-board-area{flex:0 1 auto!important;height:calc(100vw - 10px)!important;max-height:calc(100vw - 10px)}
 .bd-active-game[data-brainy-game="patchword"] #pw-controls{flex:1 0 auto!important;justify-content:center;align-self:stretch;width:100%!important}
}

.bd-active-game #brainy-navigation #pw-progress{position:absolute;top:0;left:50%;transform:translateX(-50%);height:100%;width:auto;display:flex;justify-content:center;z-index:1}
.bd-active-game #pw-content #pw-progress{position:relative;top:auto;left:auto;transform:none;height:auto;width:100%;z-index:auto}
html [data-part=pw-cell][data-black=true],html[data-bd-appearance=dark] [data-part=pw-cell][data-black=true]{background:#000!important;border-color:#000!important;box-shadow:none!important}

/* Equal square desktop surfaces, with geometry shared with the measured board. */
@media(min-width:740px) and (min-aspect-ratio:1.15){
 .bd-active-game #pw-play-area{grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important}
 .bd-active-game #pw-controls{grid-row:1!important;align-self:center!important;justify-self:center;padding:12px!important;gap:0!important}
 .bd-active-game #pw-keyboard-help{display:none}
}
@media(max-width:700px){
 .bd-active-game[data-brainy-game="patchword"] #pw-controls{flex:0 0 auto!important;height:auto!important}
 .bd-active-game[data-brainy-game="patchword"] #pw-action-row{flex:1 0 40px!important;min-height:40px;align-items:center;justify-content:center}
}

/* Desktop theme owns the space above the two aligned square surfaces. */
@media(min-width:740px) and (min-aspect-ratio:1.15){
 .bd-active-game #pw-content{position:relative;padding-top:0!important;gap:0!important}
 .bd-active-game #pw-header{position:absolute;top:8px;right:28px;z-index:2}
 .bd-active-game #pw-theme{height:96px;flex:0 0 96px;justify-content:center;align-items:center;padding:0!important}
 .bd-active-game #pw-theme>div{padding:10px 30px;border-radius:24px;max-width:calc(100% - 380px)}
 .bd-active-game #pw-theme [dir=auto]{font-size:18px!important;line-height:24px!important;text-align:center}
 .bd-active-game #pw-play-area{padding-top:0!important}
 .bd-active-game #pw-board-area{justify-content:flex-start!important}
 .bd-active-game #pw-controls{align-self:start!important}
}
/* SVG tools inherit these explicit chrome colors; puzzle colors stay separate. */
html[data-bd-appearance=dark] .bd-playing #pw-header .bd-game-tools,
html[data-bd-appearance=dark].bd-playing #pw-header .bd-game-tools{color:#fff}
html[data-bd-appearance=dark] :is(#pw-header,#pw-lobby-settings) :is(.bd-tool-button,[role=button],[role=button]>div){color:#fff!important}
html[data-bd-appearance=dark] #pw-header .bd-tool-button:is(:hover,:focus-visible){background:#554166;color:#fff}
html:not([data-bd-appearance=dark]) #pw-header .bd-game-tools{color:#4b3566}

@media(min-width:740px) and (min-aspect-ratio:1.15){
 .bd-active-game #pw-words-button{grid-column:2;grid-row:2;justify-self:center;align-self:center;min-height:46px;min-width:180px;padding:10px 28px;border-radius:16px;background:#7830d4;border:1px solid #a779eb;align-items:center;justify-content:center;cursor:pointer}
 .bd-active-game #pw-words-button:hover{background:#6924be}
 html[data-bd-appearance=dark] .bd-active-game #pw-words-button{background:#583183;border-color:#9067b4}
 html[data-bd-appearance=dark] .bd-active-game #pw-words-button:hover{background:#6a3d99}
}
