/* The browser viewport already excludes browser chrome and the OS taskbar. */
html:has(#app),body:has(#app){height:100%;overflow:hidden;overscroll-behavior:none}
#app{height:100dvh;min-height:0;overflow:hidden}
html:has(.legal-page),body:has(.legal-page){height:100%;overflow:hidden}
.legal-page{height:100dvh;min-height:0;overflow:auto;overscroll-behavior:contain}
.portal-shell{height:100%;min-height:0}
.portal-topbar{flex:0 0 auto;padding:10px 18px;gap:10px;background:var(--panel)}
.portal-content{min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:18px 0}
.portal-footer{flex:0 0 auto;padding:6px 0;font-size:12px;letter-spacing:0;gap:10px;flex-wrap:wrap}
.support-link{border:0;padding:4px;background:transparent;color:var(--text);text-decoration:underline;cursor:pointer}
.technical-report-form{display:grid;gap:12px;max-width:800px}
.technical-report-form label{display:grid;gap:6px}
.technical-report-form input,.technical-report-form textarea{width:100%;padding:10px;font:inherit;border:1px solid var(--line-strong);border-radius:6px;background:var(--bg-2);color:var(--text)}
.technical-report-form textarea{resize:vertical;min-height:100px;max-height:40dvh}
.portal-shell>.sponsor-slot{flex:0 0 auto;margin:6px auto;padding:3px}
.sponsor-creative{width:320px;height:50px;margin:auto;max-width:100%}
.sponsor-slot{width:min(100%,340px)}
.home-details-actions{display:none;gap:6px;margin-top:8px}
.home-details-actions button{flex:1;min-height:36px;padding:5px;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--text);font:inherit;font-size:12px}
.home-details-dialog{width:min(900px,94vw);max-height:90dvh;overflow:auto;padding:16px;border:1px solid var(--line-strong);border-radius:14px;background:var(--bg);color:var(--text)}
.home-details-dialog::backdrop{background:#0009}
.home-details-close{display:block;margin:0 0 12px auto;min-height:40px;padding:6px 16px;background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:8px;cursor:pointer}
.home-details-dialog .play-side-stack{display:grid;gap:12px}.home-details-dialog .community-gallery{margin:0;padding:12px}
/* A populated gallery opens in its own window instead of extending the home. */
[data-hub-view="play"]:has(.gallery-list article)>.community-gallery{display:none}
[data-hub-view="play"]:has(.gallery-list article)>.home-details-actions{display:flex}
@media(min-width:900px){.home-details-info{display:none}}
/* Home uses the available viewport, with readable overflow as an accessibility
   fallback for enlarged text, a virtual keyboard or unusually small windows. */
.portal-topbar{display:flex;flex-wrap:wrap;min-height:58px;padding:6px 16px}
.portal-brand{margin-right:auto}.portal-brand small{font-size:11px;letter-spacing:.06em}
.portal-topbar>.language-control{order:0;margin-inline-start:0}
.portal-nav{width:auto;order:0;overflow:visible}
.portal-content:has(>[data-hub-view="play"].active){padding:10px 0;scrollbar-gutter:auto}
[data-hub-view="play"] .play-heading{gap:16px;margin-bottom:10px;align-items:center}
[data-hub-view="play"] .play-heading h1{font-size:clamp(28px,3vw,42px);margin:2px 0 5px;line-height:1.05}
[data-hub-view="play"] .play-heading p{font-size:14px;line-height:1.35}
[data-hub-view="play"] .fairplay-seal{width:76px;height:76px;flex-shrink:0;margin:0}
[data-hub-view="play"] .fairplay-seal strong{font-size:26px}
[data-hub-view="play"] .fairplay-seal span,[data-hub-view="play"] .fairplay-seal small{font-size:10px}
[data-hub-view="play"] .play-grid{grid-template-columns:minmax(0,1.8fr) minmax(280px,1fr);gap:12px;align-items:start}
[data-hub-view="play"] .play-card-main,[data-hub-view="play"] .event-card,[data-hub-view="play"] .philosophy-card{padding:12px}
[data-hub-view="play"] .section-title-row h2,[data-hub-view="play"] .event-card h3,[data-hub-view="play"] .philosophy-card h3{font-size:22px}
[data-hub-view="play"] .section-kicker{font-size:11px}
[data-hub-view="play"] .mode-switch{grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;margin:10px 0;padding:3px}
[data-hub-view="play"] .mode-btn{padding:6px 3px;min-height:40px;font-size:13px}
[data-hub-view="play"] .preset-grid{gap:8px;margin:8px 0}
[data-hub-view="play"] .cadence-group{gap:4px}
[data-hub-view="play"] .cadence-group h4{font-size:12px;margin:0 0 2px}
[data-hub-view="play"] .cadence-group .preset{min-width:0;flex:1 0 40%;min-height:42px;padding:4px 2px}
[data-hub-view="play"] .preset strong{font-size:17px}
[data-hub-view="play"] .preset span{font-size:11px;margin:0}
[data-hub-view="play"] .custom-time{margin:6px 0 10px}
[data-hub-view="play"] .custom-time-toggle{min-height:34px;padding:5px}
[data-hub-view="play"] .custom-time-fields{padding:6px;margin-top:4px}
[data-hub-view="play"] .setup-row{gap:8px}
[data-hub-view="play"] .setup-row label{min-width:0}
[data-hub-view="play"] .setup-row input,[data-hub-view="play"] .setup-row select{min-width:0;padding:6px;width:100%;min-height:38px}
[data-hub-view="play"] .full-action{margin-top:10px;min-height:42px;padding:8px}
[data-hub-view="play"] .setup-note{margin:7px 0 0;font-size:12px;line-height:1.35}
[data-hub-view="play"] .play-side-stack{display:flex;gap:10px}
[data-hub-view="play"] .event-card>p,[data-hub-view="play"] .philosophy-card>p{margin:6px 0;line-height:1.35;font-size:13px}
[data-hub-view="play"] .event-card .subtle-action{margin:4px 0 0;padding:6px;min-height:36px}
[data-hub-view="play"] .score-pair{margin-top:6px;gap:6px}
[data-hub-view="play"] .score-pair span{padding:5px 9px;display:flex;align-items:center;justify-content:space-between;gap:6px}
[data-hub-view="play"] .score-pair small{font-size:11px}
[data-hub-view="play"] .score-pair strong{font-size:24px}
[data-hub-view="play"] .community-gallery{margin-top:10px;padding:10px}
[data-hub-view="play"] .community-gallery h2{font-size:19px;margin:0}
[data-hub-view="play"] .community-gallery .empty-state{padding:7px}
.portal-shell>.sponsor-slot{margin:3px auto}
.portal-footer{flex-direction:row;align-items:center;font-size:11px;padding:4px 0;gap:5px}
.portal-footer nav{gap:10px}
@media(min-width:900px) and (max-height:740px){
 [data-hub-view="play"] .play-heading h1{font-size:28px}
 [data-hub-view="play"] .play-heading{margin-bottom:7px}
 [data-hub-view="play"] .fairplay-seal{width:62px;height:62px}
 .portal-brand-mark{width:32px;height:32px}.portal-brand small{max-width:230px}
 [data-hub-view="play"] .play-card-main,[data-hub-view="play"] .event-card,[data-hub-view="play"] .philosophy-card{padding:9px}
}
@media(min-width:900px){
 .portal-shell:has([data-hub-view="play"].active){display:grid;grid-template-columns:minmax(0,1fr) 350px;grid-template-rows:auto minmax(0,1fr) auto}
 .portal-shell:has([data-hub-view="play"].active)>.portal-topbar,.portal-shell:has([data-hub-view="play"].active)>.portal-content{grid-column:1/-1}
 .portal-shell:has([data-hub-view="play"].active)>.sponsor-slot{grid-column:2;grid-row:3}
 .portal-shell:has([data-hub-view="play"].active)>.portal-footer{grid-column:1;grid-row:3;align-self:center;justify-content:flex-start;gap:8px 18px}
 .portal-topbar .portal-brand small{white-space:nowrap;max-width:none;font-size:10px}
 [data-hub-view="play"] .play-heading>div:first-child{max-width:none}
 [data-hub-view="play"] .play-heading p{max-width:none}
 [data-hub-view="play"] .play-heading .eyebrow{display:none}
 [data-hub-view="play"] .preset-grid{grid-template-columns:1fr 2fr 3fr 2fr}
 [data-hub-view="play"] .cadence-group{flex-wrap:nowrap;position:relative;padding-top:19px}
 [data-hub-view="play"] .cadence-group h4{position:absolute;top:0}
 [data-hub-view="play"] .cadence-group .preset{flex:1 1 0}
 [data-hub-view="play"] .section-title-row h2{line-height:1.15}
 [data-hub-view="play"] .community-gallery{display:grid;grid-template-columns:1fr auto;gap:5px 12px}
 [data-hub-view="play"] .community-gallery>button{padding:4px 10px;min-height:32px}
 [data-hub-view="play"] .gallery-list{grid-column:1/-1;grid-template-columns:repeat(5,minmax(0,1fr))}
 [data-hub-view="play"] .gallery-list>p{margin:0;font-size:13px}
 [data-hub-view="play"] .community-gallery>[data-gallery-status]:empty{display:none}
 [data-hub-view="play"] .community-gallery:has(.gallery-list>p){grid-template-columns:auto 1fr auto;align-items:center}
 [data-hub-view="play"] .community-gallery:has(.gallery-list>p) .gallery-list{grid-column:2;grid-row:1;text-align:center;display:block}
 [data-hub-view="play"] .community-gallery:has(.gallery-list>p)>button{grid-column:3;grid-row:1}
}
@media(min-width:900px) and (max-height:740px){
 [data-hub-view="play"] .play-heading>div:first-child{display:flex;align-items:center;gap:16px}
 [data-hub-view="play"] .play-heading h1{white-space:nowrap;font-size:26px;margin:0}
 [data-hub-view="play"] .play-heading{min-height:44px}
 [data-hub-view="play"] .fairplay-seal{border-radius:9px;display:flex;gap:6px;width:auto;height:36px;padding:6px;box-shadow:none}
 [data-hub-view="play"] .section-title-row>div{display:flex;align-items:center;gap:10px}
 [data-hub-view="play"] .section-title-row h2{font-size:19px;margin:0}
 [data-hub-view="play"] .mode-switch{margin:6px 0}
 [data-hub-view="play"] .preset-grid{margin:6px 0}
 [data-hub-view="play"] .custom-time{margin:4px 0 6px}
 [data-hub-view="play"] .setup-row label>span{margin-bottom:3px}
 [data-hub-view="play"] .event-card h3,[data-hub-view="play"] .philosophy-card h3{font-size:20px;display:inline;margin-left:8px;line-height:1.2}
 [data-hub-view="play"] .event-card .section-kicker,[data-hub-view="play"] .philosophy-card .section-kicker{display:inline}
 [data-hub-view="play"] .event-card>p,[data-hub-view="play"] .philosophy-card>p{line-height:1.3}
}
@media(max-width:899px){
 .portal-topbar{padding:5px 10px;gap:5px}
 .portal-topbar .portal-brand small{display:none}
 .portal-topbar>.language-control{margin-left:auto}
 .portal-nav{order:3;width:100%;justify-content:space-around;padding:2px}
 .portal-nav-btn{min-height:36px;padding:5px 8px}
 [data-hub-view="play"] .play-grid{grid-template-columns:1fr}
 [data-hub-view="play"] .play-side-stack{display:grid;grid-template-columns:1fr 1fr}
 [data-hub-view="play"] .play-heading{display:flex}
 [data-hub-view="play"] .setup-row{grid-template-columns:repeat(2,minmax(0,1fr))}
 [data-hub-view="play"] .setup-row.three-fields{grid-template-columns:repeat(3,minmax(0,1fr))}
 .portal-footer>span{font-size:10px}
 .portal-content:has(>[data-hub-view="play"].active){padding:6px 0}
 [data-hub-view="play"] .play-heading{margin-bottom:6px;gap:6px}
 [data-hub-view="play"] .play-heading .eyebrow,[data-hub-view="play"] .play-heading p:not(.eyebrow){display:none}
 [data-hub-view="play"] .play-heading h1{font-size:26px;margin:0}
 [data-hub-view="play"] .fairplay-seal{width:auto;height:auto;border-radius:6px;padding:4px 6px;display:flex;gap:5px}
 [data-hub-view="play"] .fairplay-seal strong{font-size:19px}
 [data-hub-view="play"] .fairplay-seal small{display:none}
 [data-hub-view="play"] .play-card-main{padding:8px}
 [data-hub-view="play"] .section-title-row{gap:5px;align-items:center}
 [data-hub-view="play"] .section-title-row h2{font-size:18px;line-height:1.15}
 [data-hub-view="play"] .rated-pill{font-size:10px;padding:4px}
 [data-hub-view="play"] .preset-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
 [data-hub-view="play"] .cadence-group{flex-direction:column;flex-wrap:nowrap}
 [data-hub-view="play"] .cadence-group .preset{width:100%;flex:none;min-height:32px;padding:3px 1px}
 [data-hub-view="play"] .preset strong{font:600 13px/1.3 system-ui}
 [data-hub-view="play"] .preset span{display:none}
 [data-hub-view="play"] .mode-switch{margin:6px 0}
 [data-hub-view="play"] .mode-btn{font-size:11px;min-height:40px}
 [data-hub-view="play"] .setup-row label>span{font-size:12px;margin-bottom:3px}
 [data-hub-view="play"] .setup-row input,[data-hub-view="play"] .setup-row select{font-size:16px}
 [data-hub-view="play"] .setup-note{font-size:11px}
 [data-hub-view="play"] .play-side-stack,[data-hub-view="play"]>.community-gallery{display:none}
 .home-details-actions{display:flex}
 .portal-footer{justify-content:center}
 .portal-footer>span{display:none}
 .portal-footer nav{gap:4px 10px}
}
.game-shell{height:100%;min-height:0;padding:6px 10px;display:flex;flex-direction:column;gap:6px;overflow:hidden}
@media(max-width:899px) and (max-height:780px){
 .portal-content:has(>[data-hub-view="play"].active){padding:3px 0}
 [data-hub-view="play"] .cadence-group{display:contents}
 [data-hub-view="play"] .cadence-group h4{display:none}
 [data-hub-view="play"] .preset-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}
.game-shell .game-topbar{flex:0 0 auto;width:100%;padding:0;margin:0;gap:6px}
.game-shell .arena{flex:1;min-height:0;width:100%;display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,340px);grid-template-rows:minmax(0,1fr);align-items:stretch;gap:10px}
.game-shell .board-wrap{height:100%;min-height:0;min-width:0;display:flex;gap:4px;overflow:hidden;container-type:size}
.game-shell .board-frame{flex:0 0 auto;min-width:0;width:min(100%,calc(100cqh - 158px));max-width:none;align-self:center;padding:7px}
.game-shell .board-caption{display:none}
.game-shell .board-wrap .player-card{flex:0 0 auto;min-height:48px;height:52px;padding:3px 8px;gap:5px;grid-template-columns:minmax(0,1fr) auto}
.game-shell .board-wrap .clock{font-size:26px;padding:0;min-width:5ch;grid-row:1/3}
.game-shell .player-avatar{height:32px;width:32px;font-size:18px}
.game-shell .material{white-space:nowrap;overflow:hidden;height:16px;font-size:12px}
.game-shell .material img{height:16px;width:12px}
.game-shell .player-meta small{font-size:12px}
.game-shell .player-card.active .clock::after{font-size:12px}
.game-shell .side-panel,.game-shell .side-panel[data-sheet]{position:relative;inset:auto;grid-column:2;grid-row:1;width:100%;height:100%;min-height:0;max-height:none;display:flex;flex-direction:column;overflow:auto;padding:0;background:var(--panel);box-shadow:none;overscroll-behavior:contain}
.game-shell .side-panel .panel-stack{flex:1 0 100px;min-height:100px;height:auto;max-height:none;grid-area:auto}
.game-shell .panel-view{min-height:0;overflow:auto}
.game-shell .panel-view[data-game-view="moves"],.game-shell .panel-view[data-game-view="chat"]{position:absolute;inset:0}
.game-shell .moves{min-height:0;color:var(--text);overflow-anchor:none;overscroll-behavior:contain}
.game-shell .sheet-handle{display:none}
.game-shell .status-card{display:grid;background:var(--panel);padding:7px;margin:0;flex:0 0 auto}
.game-shell .tabs,.game-shell .controls,.game-shell .draw-offer{flex:0 0 auto;grid-area:auto}
.game-shell .controls{padding:5px;gap:4px}
.game-shell .controls button{min-height:36px;font-size:12px}
.game-shell .game-actions{flex:0 0 auto;display:flex;justify-content:center;gap:8px;width:100%;order:10}
.game-actions button{min-height:44px;padding:6px 12px;border:1px solid var(--line-strong);border-radius:6px;background:var(--panel);color:var(--text);font-size:14px}
.game-shell .game-actions #offer-draw{max-width:none}
.game-shell .result-strip,.game-shell .network-lobby,.game-shell .connection-banner{flex:0 0 auto;margin:0;padding:5px;min-height:0}
.game-shell .result-summary{flex:0 0 auto;padding:10px}
.confirm-card,.promotion-card{max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain}
.focus-mode .game-actions{display:flex}
/* Semantic surface/text pairs also cover the OS-selected light theme. */
.side-panel,.status-card,.account-card,.analysis-box{background:var(--panel);color:var(--text)}
.eyebrow,.section-kicker,.play-heading h1 span,.fairplay-seal span,.fairplay-seal small,.fairplay-seal strong,.rated-pill,.provisional-tag,.provisional-mini,.setting-card span,.tournament-card>span,.match-title b,.tab.active,.custom-time-toggle.active,.time-plus{color:var(--gold-bright)}
.move-san,.chat-message p,.subtle-action,.controls button,.controls button.active,.connection-banner{color:var(--text)}
.ghost-btn,.analysis-actions button,.draw-offer button,.network-lobby button,.chat-compose button{color:var(--text);background:var(--panel-2)}
.setup-error,.danger-action,.field-error{color:var(--text);background:var(--danger-bg)}
.tab.active{background:var(--gold-soft)}
.game-shell button:disabled{opacity:1;color:var(--muted);border-style:dashed}
.game-shell .move-san:disabled{color:var(--text);border:0}
@media(max-width:650px) and (orientation:portrait){
 .portal-topbar{padding:6px;gap:5px}.portal-brand small{display:none}.portal-nav{width:100%;justify-content:space-around}.portal-nav-btn{padding:8px;font-size:12px}
 .game-shell{padding:4px}.game-shell .arena{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 126px;gap:4px}
 .game-shell .side-panel,.game-shell .side-panel[data-sheet]{grid-column:1;grid-row:2}
 .game-shell .side-panel .status-card{display:none}.game-shell .tabs .tab{padding:4px;min-height:32px}
 .game-shell .side-panel .panel-stack{flex-basis:75px;min-height:75px}
 .game-shell .board-frame{width:min(100%,calc(100cqh - 158px))}
 .game-shell .game-actions button{font-size:12px;padding:4px 8px}
 .game-shell .top-actions{flex-wrap:nowrap;width:100%;gap:4px}.game-shell .top-actions button,.game-shell .top-actions summary{padding:5px;font-size:12px;min-height:36px}
 .game-shell .top-actions .language-control{font-size:0}.game-shell .language-control select{font-size:12px;max-width:70px}
 .game-shell .mini-brand,.game-shell .match-title{display:none}
 .game-shell.game-over .arena{grid-template-rows:minmax(0,1fr) minmax(150px,42%)}
}
@media(max-height:500px) and (orientation:landscape){
 .game-shell .mini-brand,.game-shell .match-title{display:none}.game-shell .top-actions{width:100%;justify-content:flex-end;flex-wrap:nowrap}
 .game-shell .arena{grid-template-columns:minmax(0,1fr) minmax(240px,38%)}
 .game-shell .board-wrap .player-card{height:44px;min-height:44px}.game-shell .player-avatar,.game-shell .material{display:none}.game-shell .board-frame{width:min(100%,calc(100cqh - 142px))}
 .game-shell .board-wrap .clock{font-size:20px}
}
