/* SaKid Chess · pastel clay kingdom */
:root{color:#384166;background:#f7f2fc;font-family:system-ui,-apple-system,'Segoe UI',sans-serif}
body{min-height:100vh;background:radial-gradient(ellipse at 0% 10%,#d9f5f5 0,transparent 40%),radial-gradient(ellipse at 100% 35%,#ffe9dd 0,transparent 42%),linear-gradient(#f2f9fa,#f8f0fc 70%,#fff8e8)}
header{background:#ffffffec;border-bottom:1px solid #e5e1ed;gap:12px}
header nav{display:flex;gap:20px;font-size:14px;font-weight:750}
header nav a{color:#665b90}
.brand{color:#5e5184;line-height:1.15}
.brand span{display:block;font-size:10px;letter-spacing:.14em;color:#8e7c9e;margin-top:5px}
main{max-width:1160px;padding-top:24px}
a{color:#665494}.app-link{display:inline-block;font-weight:750;padding:10px 0}
.card{background:#fffefd;border:1px solid #e8deee;border-radius:24px;box-shadow:0 5px 0 #e4dcec70}
.identity{background:linear-gradient(115deg,#fff,#fffaf0);padding:18px 24px}
.identity .avatar{border:3px solid white;box-shadow:0 3px 8px #58477920;border-radius:20px}
.identity h1{color:#584f79}.identity p{color:#80758d}
.balance{background:#fff0bd;border:1px solid #efdc98;color:#7a5d28;box-shadow:0 3px 0 #f0dba270}
.sectionhead{position:relative;padding:8px 70px 5px 0;margin:26px 0 20px}
.eyebrow{color:#8a6cac;letter-spacing:.15em;font-size:11px;font-weight:850}
.sectionhead h2{color:#574479;font-size:clamp(25px,4vw,35px);margin:7px 0 9px;letter-spacing:-.035em}
.sectionhead p{color:#756985;font-size:14px;max-width:700px}
.hero-crown{position:absolute;right:0;top:0;font-family:serif;color:#d7a24d;font-size:64px;transform:rotate(10deg);text-shadow:0 3px 0 #fff2cf}
.soundbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:#ffffffbf;border:1px solid #e5dced;padding:15px 18px;border-radius:22px;margin-bottom:24px}
.soundbar>div{margin-right:auto}.soundbar strong{display:block;color:#7b6597;font-size:14px}.soundbar>div span{font-size:12px;color:#95859e}
.soundbar button{font-size:12px;min-height:44px;background:#f5f0fa;color:#6b5588;border:1px solid #e0d4ed;box-shadow:0 2px 0 #e5daee}
.soundbar button[aria-pressed=true]{background:#eee6fa;border-color:#baa3d4}
.soundbar label{margin:0;font-size:11px;color:#8b789c;max-width:125px}
.soundbar input{min-height:24px;padding:0;margin:0;accent-color:#a085bf}
.soundbar>span{width:100%;font-size:11px;color:#90829b}
.chesslayout{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:26px;align-items:start}
.boardcard{padding:22px;background:linear-gradient(145deg,#fffcf6,#fff9ff);min-width:0}
.teams{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:12px;font-weight:800;color:#5973a1}
.teams span{display:flex;align-items:center;gap:7px;padding:6px 9px;border-radius:12px;background:#edf3ff}
.teams span:last-child{background:#fff1c9;color:#937031}
.team-dot{display:inline-block;width:12px;height:12px;border-radius:50%;box-shadow:inset 0 2px 2px #ffffffa0,0 1px 2px #48385930}
.team-dot.blue{background:#7faee8}.team-dot.gold{background:#f1ca72}
#chessStatus{background:#f0e9f8;border:1px solid #e2d7ef;border-radius:13px;padding:12px 14px;min-height:48px;font-weight:650;font-size:14px;color:#70588d;margin:13px 0}
.board{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));width:100%;max-width:600px;aspect-ratio:1;overflow:hidden;border:9px solid #bbabd1;border-radius:17px;box-shadow:0 7px 0 #9c87ba,0 11px 0 #d5c6e7,0 18px 24px #8a719524;margin:16px auto 28px;background:#bbabd1;isolation:isolate}
.square{position:relative;aspect-ratio:1;min-width:0;display:grid;place-items:center;padding:0;border:0;border-radius:0;background:#fff2d5;box-shadow:inset -1px -2px 0 #dbba8d32,inset 1px 1px 0 #fffaf080;line-height:1;touch-action:manipulation;overflow:hidden;font-family:inherit}
.square.dark{background:#cdbce4;box-shadow:inset -1px -2px 0 #a189bf40,inset 1px 1px 0 #ece0fc80}
.square.whitepiece{color:inherit;text-shadow:none}
.square:disabled{opacity:1;cursor:default}
.chess-piece{display:block;width:94%;height:94%;background-image:url('art/chibi-pieces-v1.png');background-repeat:no-repeat;background-size:600% 200%;pointer-events:none;position:relative;z-index:1;transform:translateX(var(--piece-shift,0));filter:drop-shadow(0 2px 1px #47335b20);transition:filter .15s}
/* Center the generated silhouettes inside their fixed atlas cells. */
.piece-k{--piece-shift:-13.1%}.piece-q{--piece-shift:-9.7%}.piece-r{--piece-shift:-6.4%}.piece-b{--piece-shift:1.8%}.piece-n{--piece-shift:8.6%}.piece-p{--piece-shift:12.1%}
.square:hover:not(:disabled) .chess-piece{filter:drop-shadow(0 3px 2px #62478365) brightness(1.04)}
.square.selected{background:#ffe08c;box-shadow:inset 0 0 0 3px #b17d20;z-index:2}
.square.target:after{content:'';position:absolute;width:24%;height:24%;border-radius:50%;background:#247a74b8;box-shadow:0 0 0 3px #fff9;z-index:3;pointer-events:none}
.square.target.occupied:after{width:88%;height:88%;background:none;border:3px solid #b2495c;box-shadow:none;border-radius:14px}
.square.in-check{background:#ffc5c1;box-shadow:inset 0 0 0 3px #c34651}
.square:focus-visible{outline:3px solid #564a93;outline-offset:-3px;z-index:4}
.coordinate{position:absolute;bottom:2px;left:3px;font-size:10px;color:#65557c;text-shadow:none;font-family:system-ui;font-weight:800;z-index:3;pointer-events:none}
.piece-legend{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));background:#f7f1fb;border:1px solid #ebe0f1;border-radius:16px;padding:8px 3px;margin-bottom:15px;gap:2px}
.legend-item{display:flex;flex-direction:column;align-items:center;min-width:0;gap:5px;font-size:11px;color:#7d6694;font-weight:750}
.legend-item .chess-piece{width:42px;height:42px}
.move-feedback{font-size:13px;line-height:1.6;color:#7a648e;min-height:22px;margin:0}
.chessactions{display:flex;gap:10px;flex-wrap:wrap;margin-top:15px}
.primary{background:#9476b9;color:white;box-shadow:0 3px 0 #745693;border-radius:12px}
.quiet{background:#f0e9f8;color:#71558e;border:1px solid #e2d7ed;border-radius:12px}
button:focus-visible,a:focus-visible{outline-color:#a37c23}
.boardcard>.small{font-size:12px;color:#9885a3;line-height:1.7;margin-bottom:0}
.chesslayout aside>h3{color:#72558d;font-size:21px;margin:0 0 16px}
.opponent{border:1px solid #e5d9ed;background:#ffffffdf;box-shadow:0 4px 0 #e4d9ed99;border-radius:22px;padding:17px;margin-bottom:14px;gap:13px}
.opponent .avatar{width:58px;height:58px;border:3px solid #fff;border-radius:18px;box-shadow:0 2px 5px #5a497e25}
.opponent h3{color:#695280}.opponent p{color:#8d7c99;line-height:1.55}.opponent button{font-size:12px;min-height:40px}
footer{color:#9a85a7}main>.small{color:#93809f}
dialog{border-color:#e2d7ed;background:#fffaf5;color:#695280}
@media(max-width:850px){.chesslayout{grid-template-columns:1fr}.chesslayout aside{display:grid;grid-template-columns:1fr 1fr;gap:12px}.chesslayout aside>h3{grid-column:1/-1}.boardcard{max-width:690px;width:100%;margin-left:auto;margin-right:auto}.opponent{margin:0}}
@media(max-width:520px){header{padding:16px 14px}.brand{font-size:23px}header nav{gap:14px;font-size:13px}main{padding:18px 12px}.identity{padding:15px;gap:10px}.identity .avatar{width:56px;height:56px}.identity h1{font-size:22px}.balance{padding:8px 11px}.balance strong{font-size:22px}.sectionhead{padding-right:43px}.sectionhead h2{font-size:26px}.hero-crown{font-size:45px;top:10px}.sectionhead p{font-size:13px}.soundbar{padding:14px;gap:8px}.soundbar>div{width:100%}.soundbar label{max-width:95px}.soundbar button{padding:10px}.boardcard{padding:11px;border-radius:20px}.board{border-width:6px;border-radius:12px;margin-top:12px;margin-bottom:25px}.teams{font-size:10px;gap:4px}.teams span{padding:6px;gap:4px}.team-dot{width:10px;height:10px}.coordinate{font-size:8px;bottom:1px;left:2px}#chessStatus{font-size:12px;padding:10px;min-height:42px}.piece-legend{padding:7px 2px;gap:0}.legend-item{font-size:10px;gap:4px}.legend-item .chess-piece{width:34px;height:34px}.chessactions button{font-size:12px;min-height:44px;padding:10px 12px}.chesslayout aside{grid-template-columns:1fr}.square.target.occupied:after{border-width:2px;border-radius:9px}}
@media(prefers-reduced-motion:reduce){.chess-piece{transition:none}}
