/* ROSA Chess: shared sapphire chrome, carved metal and dimensional game pieces. */
#chess-dialog{position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:12px 18px 24px;border:0;color:var(--rosa-text);font-family:var(--rosa-font-interface);overflow:auto;background:linear-gradient(#03121e38,#03121e77),url('assets/chess/royal-lake.webp') center/cover fixed;}
#chess-dialog::backdrop{background:#03121e;}#chess-dialog *{box-sizing:border-box;}#chess-dialog [hidden]{display:none!important;}
#chess-dialog .ch-header{position:relative;display:flex;gap:22px;align-items:center;max-width:1800px;margin:auto;padding:7px 20px;min-height:84px;border:1px solid var(--rosa-gold);border-radius:16px;background:var(--rosa-menu-fill);box-shadow:inset 0 0 0 3px #d7a64b22,0 9px 24px #0008;}
#chess-dialog .ch-header::after,#chess-dialog .ch-board-frame::after{content:'';position:absolute;inset:-1px;pointer-events:none;border:0 solid transparent;border-image:url('assets/mahjong-reference/filigree-frame.webp') 115 / 36px / 0 stretch;z-index:5;}
#chess-dialog .ch-brand{padding-right:24px;border-right:1px solid #d7a64b55;}#chess-dialog .ch-brand img{width:168px;height:auto;display:block;}
#chess-dialog .ch-header nav{display:flex;flex:1;align-self:stretch;max-width:650px;}#chess-dialog .ch-header nav button{display:flex;flex-direction:column;justify-content:center;gap:3px;flex:1;background:transparent;border:0;border-radius:0;box-shadow:none;font-size:13px;min-width:0;padding:4px 12px;color:var(--rosa-ivory);}
#chess-dialog .ch-header nav button.rosa-current{background:radial-gradient(ellipse at bottom,#d7a64b77,transparent 80%);box-shadow:inset 0 -2px #ffde91;}#chess-dialog .ch-header .rosa-art-icon{width:35px;height:35px;}#chess-dialog .ch-header-actions{display:flex;margin-left:auto;gap:10px;}#chess-dialog .ch-header-actions button{width:46px;height:46px;border-radius:50%;padding:8px;background:var(--rosa-menu-item-fill);font-size:30px;}#chess-dialog .ch-header-actions [data-ch-label]{display:none;}#chess-dialog .ch-header-actions .rosa-art-icon{width:28px;height:28px;}
#chess-dialog .ch-main{display:grid;grid-template-columns:minmax(185px,230px) minmax(0,1fr) minmax(180px,230px);gap:28px;max-width:1590px;margin:16px auto 0;align-items:start;}
#chess-dialog .ch-left,#chess-dialog .ch-right{margin-top:102px;}#chess-dialog .rosa-carved-panel{position:relative;padding:24px 18px;border-radius:17px;color:var(--rosa-text);background:var(--rosa-menu-fill);}
#chess-dialog h2{margin:0 0 15px;padding-bottom:12px;border-bottom:1px solid #d7a64b4a;color:var(--rosa-gold-light);font:650 16px/1.4 var(--rosa-font-interface);}#chess-dialog p{font-size:13px;line-height:1.7;color:var(--rosa-text-muted);}
#chess-dialog .ch-modes{display:grid;gap:10px;}#chess-dialog .ch-modes button{justify-content:flex-start;gap:10px;text-align:left;min-height:65px;padding:9px;background:var(--rosa-menu-item-fill);font-size:13px;}#chess-dialog .ch-modes button[aria-pressed=true]{background:var(--rosa-primary-fill);color:#17212a;box-shadow:inset 0 2px #fff0bb,0 0 15px #dcaa4644;}#chess-dialog .ch-modes .rosa-art-icon{width:35px;height:35px;}
#chess-dialog .ch-level{padding-bottom:15px;margin-bottom:19px;border-bottom:1px solid #d7a64b44;color:var(--rosa-gold-light);}#chess-dialog #ch-save{font-size:11px;margin:18px 0 0;opacity:.85;}
#chess-dialog .ch-center{min-width:0;display:flex;flex-direction:column;align-items:center;--ch-size:min(100%,calc(100dvh - 335px),720px);}
#chess-dialog .ch-heading{display:flex;align-items:center;justify-content:center;gap:10px;min-height:82px;margin-bottom:3px;filter:drop-shadow(0 3px 4px #000b);text-align:center;}#chess-dialog .ch-heading>img{width:48px;height:74px;object-fit:contain;}#chess-dialog #ch-title{margin:0;font:700 clamp(36px,4vw,61px)/1.1 var(--rosa-font-display);letter-spacing:2px;text-transform:uppercase;background-image:linear-gradient(#fff4cb,#ffe2a0 35%,#d9a03a 57%,#96631f 80%,#ffe3a2);filter:drop-shadow(0 2px #68441c) drop-shadow(0 3px 2px #0008);}#chess-dialog .ch-heading p{margin:7px 0 0;color:var(--rosa-gold-light);font-size:10px;letter-spacing:2px;}
#chess-dialog .ch-board-frame{position:relative;width:var(--ch-size);padding:17px;border:4px solid #b88c40;border-radius:16px;background:linear-gradient(135deg,#fff0b6,#a06b29 14%,#4c321c 45%,#d4ac5d 74%,#674520);box-shadow:inset 0 0 0 2px #ffe7a5,0 4px 0 #4c3217,0 7px 0 #c29948,0 18px 30px #000b;isolation:isolate;}#chess-dialog .ch-board-frame::after{inset:-4px;border-image-width:45px;}
#chess-dialog #ch-board{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));aspect-ratio:1;border:2px solid #5f4624;border-radius:3px;box-shadow:0 0 0 1px #e6c174,inset 0 4px 8px #0008;overflow:visible;}
#chess-dialog .ch-square{position:relative;isolation:isolate;min-width:0;min-height:0;aspect-ratio:1;width:100%;border:0;border-radius:0;padding:0;display:grid;place-items:center;cursor:pointer;touch-action:manipulation;transition:filter .15s;box-shadow:inset 1px 1px #fff2,inset -1px -1px #0003;background-size:100%;}
#chess-dialog .ch-square.light{background:radial-gradient(ellipse at 20% 10%,#fff4dc88,transparent 65%),repeating-linear-gradient(132deg,#dacaa455 0px,#fff0 1px,#fff0 22px,#b69c7522 23px,#fff0 25px),linear-gradient(120deg,#f4e7c5,#d7c299);color:#614b29;}
#chess-dialog .ch-square.dark{background:radial-gradient(ellipse at 20% 15%,#47849b77,transparent 75%),repeating-linear-gradient(132deg,#6596b622 0px,#fff0 1px,#fff0 22px,#203a5211 23px,#fff0 25px),linear-gradient(135deg,#164761,#072536);color:#e9cb8a;}
#chess-dialog .ch-piece{position:relative;display:block;width:95%;height:108%;object-fit:contain;pointer-events:none;z-index:2;transform-origin:50% 85%;filter:drop-shadow(2px 5px 2px #0009);align-self:end;margin-bottom:3%;}#chess-dialog .ch-square:has(.ch-piece){z-index:1;}
#chess-dialog .ch-square.last{box-shadow:inset 0 0 0 3px #e6b963bb,inset 0 0 24px #efbe4f55;}#chess-dialog .ch-square.selected{box-shadow:inset 0 0 0 3px #ffdf86,inset 0 0 25px #ffc74caa;z-index:3;}#chess-dialog .ch-square.selected .ch-piece{filter:drop-shadow(0 0 4px #ffca63) drop-shadow(2px 5px 2px #0009);}
#chess-dialog .ch-square.legal::after{content:'';width:23%;height:23%;border-radius:50%;position:absolute;background:#2cbadcaa;border:2px solid #b9eff9;box-shadow:0 2px 4px #0005;z-index:3;pointer-events:none;}#chess-dialog .ch-square.legal:has(.ch-piece)::after{width:88%;height:88%;background:transparent;border:3px solid #ffce68;}
#chess-dialog .ch-square.checked{background:radial-gradient(#c13a32,#631f28);box-shadow:inset 0 0 0 3px #ef8e68;}#chess-dialog .ch-square:focus-visible{outline:3px solid #52d7ed;outline-offset:-3px;z-index:4;}#chess-dialog .ch-square:hover{filter:brightness(1.12);}
#chess-dialog .ch-rank,#chess-dialog .ch-file{position:absolute;z-index:4;font:650 clamp(9px,.85vw,12px)/1 var(--rosa-font-numbers);pointer-events:none;}#chess-dialog .ch-rank{left:3px;top:3px;}#chess-dialog .ch-file{right:3px;bottom:2px;}
#chess-dialog .ch-player{width:var(--ch-size);display:flex;align-items:center;gap:8px;height:27px;margin:3px 0;color:var(--rosa-ivory);text-shadow:0 1px 3px #000;font-size:12px;}#chess-dialog .ch-bottom{margin-top:10px;}#chess-dialog .ch-player-dot{width:10px;height:10px;border-radius:50%;background:#30455c;box-shadow:inset 0 1px 2px #fff8,0 1px 3px #000;}#chess-dialog [data-color=w] .ch-player-dot{background:linear-gradient(#fff1ba,#d5a84e);}#chess-dialog .ch-to-move strong{color:#ffe2a0;}#chess-dialog .ch-captures{display:flex;flex:1;justify-content:flex-end;overflow:hidden;}#chess-dialog .ch-captures .ch-piece{width:18px;height:25px;margin:0;}
#chess-dialog #ch-status{margin:2px 0 8px;min-height:23px;text-align:center;color:var(--rosa-gold-light);font-weight:600;font-size:13px;}
#chess-dialog .ch-actions{display:grid;grid-template-columns:1.2fr 1fr 1.1fr 1fr;gap:9px;width:100%;max-width:780px;padding:10px;}#chess-dialog .ch-actions button{display:flex;gap:7px;justify-content:center;min-height:52px;padding:8px;background:var(--rosa-menu-item-fill);font-size:12px;}#chess-dialog .ch-actions button.rosa-button--primary{background:var(--rosa-primary-fill);color:#17212a;}#chess-dialog .ch-actions .rosa-art-icon{width:26px;height:26px;}
#chess-dialog .ch-right{min-width:0;}#chess-dialog #ch-history{max-height:min(62dvh,600px);overflow:auto;scrollbar-color:#a67e3e #041421;}#chess-dialog #ch-history ol{list-style:none;margin:0;padding:0;}#chess-dialog #ch-history li{display:grid;grid-template-columns:28px 1fr 1fr;gap:8px;padding:9px 5px;border-bottom:1px solid #d7a64b22;font:550 14px/1.3 var(--rosa-font-numbers);}#chess-dialog #ch-history li:nth-child(odd){background:#6195ae0c;}#chess-dialog #ch-history small{color:var(--rosa-gold);}#chess-dialog #ch-history p{margin:0;}
#chess-dialog .ch-overlay{position:fixed;inset:0;display:grid;place-items:center;padding:18px;background:#010c16c9;backdrop-filter:blur(7px);z-index:20;}#chess-dialog .ch-popup{width:min(100%,450px);max-height:90dvh;overflow:auto;padding:28px;}#chess-dialog .ch-popup h2{padding-right:36px;font-size:22px;}#chess-dialog .ch-panel-close{position:absolute;right:14px;top:12px;width:40px;height:40px;font-size:26px;padding:4px;}#chess-dialog .ch-popup label{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:19px 0;font-size:14px;}#chess-dialog .ch-popup select{max-width:57%;background:#061b2d;color:var(--rosa-ivory);border:1px solid #b58b43;border-radius:8px;min-height:44px;padding:8px;font:inherit;}#chess-dialog .ch-popup input{width:22px;height:22px;accent-color:var(--rosa-gold);}#chess-dialog .ch-confirm{display:flex;flex-wrap:wrap;gap:10px;}#chess-dialog .ch-promotions{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;}#chess-dialog .ch-promotions button{height:100px;padding:6px;}#chess-dialog .ch-promotions .ch-piece{width:100%;height:100%;}
@media(min-width:1700px){#chess-dialog .ch-main{grid-template-columns:260px minmax(0,1fr) 260px;gap:35px;}#chess-dialog .ch-center{--ch-size:min(100%,calc(100dvh - 335px),760px);}}
@media(max-width:1100px){#chess-dialog .ch-main{grid-template-columns:175px minmax(0,1fr) 170px;gap:16px;}#chess-dialog .rosa-carved-panel{padding:20px 12px;}#chess-dialog .ch-actions{padding:9px;}#chess-dialog .ch-actions button{flex-direction:column;font-size:10px;}#chess-dialog .ch-heading p{font-size:8px;letter-spacing:1px;}#chess-dialog .ch-left p{font-size:12px;}#chess-dialog .ch-modes button{font-size:12px;}#chess-dialog .ch-header{gap:12px;}#chess-dialog .ch-brand img{width:145px;}}
@media(max-width:850px){#chess-dialog{padding:7px 10px 22px;}#chess-dialog .ch-main{grid-template-columns:1fr 1fr;max-width:700px;gap:18px;margin-top:10px;}#chess-dialog .ch-center{grid-column:1/-1;grid-row:1;--ch-size:min(100%,calc(100dvh - 300px),630px);}#chess-dialog .ch-left,#chess-dialog .ch-right{margin:0;}#chess-dialog #ch-history{max-height:260px;}#chess-dialog .ch-actions{grid-template-columns:repeat(4,1fr);}#chess-dialog .ch-actions button{flex-direction:row;font-size:12px;}#chess-dialog .ch-header{padding:5px 12px;min-height:72px;}#chess-dialog .ch-header nav button{font-size:11px;padding:4px;}#chess-dialog .ch-brand{padding-right:12px;}#chess-dialog .ch-brand img{width:125px;}#chess-dialog .ch-header-actions{gap:6px;}#chess-dialog .ch-header-actions button{width:40px;min-width:40px;height:40px;min-height:40px;}#chess-dialog .ch-heading{min-height:69px;}#chess-dialog .ch-heading>img{height:61px;width:38px;}#chess-dialog .ch-heading h1{font-size:40px;}}
@media(max-width:500px){#chess-dialog{padding:5px 6px 18px;background-image:linear-gradient(#03121e55,#03121e88),url('assets/chess/royal-lake-mobile.webp');}#chess-dialog .ch-header{gap:5px;flex-wrap:wrap;padding:6px 10px;}#chess-dialog .ch-brand{border:0;padding:0;}#chess-dialog .ch-brand img{width:110px;}#chess-dialog .ch-header-actions{margin-left:auto;}#chess-dialog .ch-header nav{order:3;flex-basis:100%;min-height:49px;}#chess-dialog .ch-header nav button{min-height:49px;flex-direction:row;font-size:11px;gap:6px;}#chess-dialog .ch-header nav .rosa-art-icon{width:26px;height:26px;}#chess-dialog .ch-header-actions button{width:40px;height:40px;}#chess-dialog .ch-header::after{border-image-width:27px;}#chess-dialog .ch-main{gap:13px;grid-template-columns:1fr;}#chess-dialog .ch-center{grid-column:1;--ch-size:100%;}#chess-dialog .ch-heading{min-height:56px;margin:0;}#chess-dialog #ch-title{font-size:34px;}#chess-dialog .ch-heading>img{width:33px;height:49px;}#chess-dialog .ch-heading p{font-size:7px;}#chess-dialog .ch-board-frame{padding:11px;border-width:3px;border-radius:12px;}#chess-dialog .ch-board-frame::after{inset:-3px;border-image-width:32px;}#chess-dialog .ch-actions{gap:6px;padding:9px;}#chess-dialog .ch-actions button{flex-direction:column;font-size:10px;gap:5px;min-height:62px;padding:5px;}#chess-dialog .ch-actions .rosa-art-icon{width:25px;height:25px;}#chess-dialog .ch-left{grid-row:2;}#chess-dialog .ch-right{grid-row:3;}#chess-dialog .ch-modes{grid-template-columns:1fr 1fr;}#chess-dialog .ch-modes button{min-height:52px;font-size:12px;}#chess-dialog .ch-left .rosa-carved-panel{padding:20px;}#chess-dialog #ch-history{max-height:200px;}#chess-dialog .ch-popup{padding:23px 18px;}#chess-dialog .ch-player{height:23px;font-size:11px;}#chess-dialog .ch-square .ch-piece{width:97%;height:112%;filter:drop-shadow(1px 3px 1px #0009);}#chess-dialog .ch-rank,#chess-dialog .ch-file{font-size:8px;}}
@media(prefers-reduced-motion:reduce){#chess-dialog *{animation:none!important;transition:none!important;}}#chess-dialog.ch-no-motion *{animation:none!important;transition:none!important;}
/* Guard game typography and controls from the portal's editorial styles. */
#chess-dialog h2{letter-spacing:normal;}#chess-dialog .rosa-button{display:flex;align-items:center;gap:8px;justify-content:center;}#chess-dialog .ch-modes .rosa-button{justify-content:flex-start;}#chess-dialog .ch-center{--ch-size:min(100%,calc(100dvh - 385px),720px);}#chess-dialog .ch-heading{min-height:74px;}#chess-dialog .ch-heading #ch-title{line-height:1;font-size:clamp(35px,3.6vw,54px);}
@media(min-width:1700px){#chess-dialog .ch-center{--ch-size:min(100%,calc(100dvh - 385px),760px);}}
@media(max-width:850px){#chess-dialog .ch-center{--ch-size:min(100%,calc(100dvh - 330px),630px);}}
@media(max-width:500px){#chess-dialog .ch-center{--ch-size:100%;}#chess-dialog .ch-heading{min-height:56px;}#chess-dialog .ch-heading #ch-title{font-size:33px;}}
/* Pieces are positioned within a square, never influence grid track sizing. */
#chess-dialog .ch-square .ch-piece{position:absolute;left:0;bottom:3%;width:100%;height:110%;margin:0;align-self:auto;}
#chess-dialog .ch-promotions button{position:relative;}#chess-dialog .ch-captures .ch-piece{position:static;}
#chess-dialog{padding-top:max(12px,env(safe-area-inset-top));padding-left:max(18px,env(safe-area-inset-left));padding-right:max(18px,env(safe-area-inset-right));padding-bottom:max(24px,env(safe-area-inset-bottom));}#chess-dialog .ch-panel-close{width:44px;height:44px;}
@media(max-width:850px){#chess-dialog{padding-top:max(7px,env(safe-area-inset-top));padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right));}}
@media(max-width:500px){#chess-dialog{padding-top:max(5px,env(safe-area-inset-top));padding-left:max(6px,env(safe-area-inset-left));padding-right:max(6px,env(safe-area-inset-right));}#chess-dialog .ch-header-actions button{width:44px;min-width:44px;height:44px;min-height:44px;}}
@media(max-width:360px){#chess-dialog .ch-header nav button{flex-direction:column;gap:2px;font-size:10px;}#chess-dialog .ch-header nav .rosa-art-icon{width:22px;height:22px;}#chess-dialog .ch-header nav [data-ch-label]{white-space:nowrap;}}
