.cg-wrap{box-sizing:content-box;display:block;position:relative}cg-container{width:100%;height:100%;display:block;position:absolute;top:0}cg-board{-webkit-user-select:none;user-select:none;background-size:cover;width:100%;height:100%;line-height:0;position:absolute;top:0;left:0}.cg-wrap.manipulable cg-board{cursor:pointer}cg-board square{pointer-events:none;width:12.5%;height:12.5%;position:absolute;top:0;left:0}cg-board square.move-dest{pointer-events:auto}cg-board square.last-move{will-change:transform}.cg-wrap piece{z-index:2;will-change:transform;pointer-events:none;background-size:cover;width:12.5%;height:12.5%;position:absolute;top:0;left:0}cg-board piece.dragging{cursor:move;z-index:11!important}piece.anim{z-index:8}piece.fading{z-index:1;opacity:.5}.cg-wrap piece.ghost{opacity:.3}.cg-wrap piece svg{pointer-events:none;z-index:2;opacity:.6;width:100%;height:100%;position:relative;top:0;left:0;overflow:hidden}.cg-wrap cg-auto-pieces,.cg-wrap .cg-shapes,.cg-wrap .cg-custom-svgs{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;overflow:visible}.cg-wrap cg-auto-pieces{z-index:2}.cg-wrap cg-auto-pieces piece{opacity:.3}.cg-wrap .cg-shapes{opacity:.6;z-index:2;overflow:hidden}.cg-wrap .cg-custom-svgs{z-index:9}.cg-wrap .cg-custom-svgs svg{overflow:visible}.cg-wrap coords{pointer-events:none;opacity:.8;font-family:sans-serif;font-size:9px;display:flex;position:absolute}.cg-wrap coords.ranks{flex-flow:column-reverse;width:12px;height:100%;top:-20px;left:4px}.cg-wrap coords.ranks.black{flex-flow:column}.cg-wrap coords.ranks.left{align-items:flex-end;left:-15px}.cg-wrap coords.files{text-transform:uppercase;text-align:center;flex-flow:row;width:100%;height:16px;bottom:-4px;left:24px}.cg-wrap coords.files.black{flex-flow:row-reverse}.cg-wrap coords coord{flex:auto}.cg-wrap coords.ranks coord{transform:translateY(39%)}.cg-wrap coords.squares{text-transform:uppercase;text-align:right;flex-flow:column-reverse;width:12.5%;height:100%;bottom:0;left:0}.cg-wrap coords.squares.black{flex-flow:column}.cg-wrap coords.squares.left{text-align:left}.cg-wrap coords.squares coord{padding:6% 4%}.cg-wrap coords.squares.rank2{transform:translate(100%)}.cg-wrap coords.squares.rank3{transform:translate(200%)}.cg-wrap coords.squares.rank4{transform:translate(300%)}.cg-wrap coords.squares.rank5{transform:translate(400%)}.cg-wrap coords.squares.rank6{transform:translate(500%)}.cg-wrap coords.squares.rank7{transform:translate(600%)}.cg-wrap coords.squares.rank8{transform:translate(700%)}cg-board{background-image:url(/board.svg);background-size:cover}.cg-wrap piece{filter:drop-shadow(0 1px 1px #00000059)drop-shadow(2px 5px 3px #00000073);background-position:50%;background-size:92% 92%}.cg-wrap piece.dragging{filter:drop-shadow(0 2px 2px #00000059)drop-shadow(6px 14px 8px #00000080)}.cg-wrap piece.white.pawn{background-image:url(/pieces/wP.svg)}.cg-wrap piece.white.knight{background-image:url(/pieces/wN.svg)}.cg-wrap piece.white.bishop{background-image:url(/pieces/wB.svg)}.cg-wrap piece.white.rook{background-image:url(/pieces/wR.svg)}.cg-wrap piece.white.queen{background-image:url(/pieces/wQ.svg)}.cg-wrap piece.white.king{background-image:url(/pieces/wK.svg)}.cg-wrap piece.black.pawn{background-image:url(/pieces/bP.svg)}.cg-wrap piece.black.knight{background-image:url(/pieces/bN.svg)}.cg-wrap piece.black.bishop{background-image:url(/pieces/bB.svg)}.cg-wrap piece.black.rook{background-image:url(/pieces/bR.svg)}.cg-wrap piece.black.queen{background-image:url(/pieces/bQ.svg)}.cg-wrap piece.black.king{background-image:url(/pieces/bK.svg)}cg-board square.last-move{background-color:#eabe3c6b}cg-board square.selected{background-color:#eabe3c99}cg-board square.check{background:radial-gradient(#ff3c28f2 0%,#e61e1eb3 30%,#a000 75%)}cg-board square.move-dest{background:radial-gradient(#140c0673 22%,#0000 24%)}cg-board square.premove-dest{background:radial-gradient(#1455a080 22%,#0000 24%)}cg-board square.oc.move-dest{background:radial-gradient(#0000 0% 78%,#140c0673 80%)}cg-board square.move-dest:hover{background:#140c064d}.cg-wrap coords{opacity:1;font-family:inherit;font-size:10px;font-weight:700}.cg-wrap coords.ranks{width:auto;height:100%;top:0;left:0}.cg-wrap coords.ranks coord{flex:1 1 0;padding:2px 0 0 3px;transform:none}.cg-wrap coords.files{width:100%;height:auto;bottom:0;left:0}.cg-wrap coords.files coord{text-align:right;flex:1 1 0;padding:0 3px 1px 0}.cg-wrap coords coord:nth-child(odd){color:#f2e2c4}.cg-wrap coords coord:nth-child(2n),.cg-wrap coords.black coord:nth-child(odd){color:#6b4325}.cg-wrap coords.black coord:nth-child(2n){color:#f2e2c4}.cg-wrap coords.ranks coord:nth-child(odd){color:#6b4325}.cg-wrap coords.ranks coord:nth-child(2n),.cg-wrap coords.ranks.black coord:nth-child(odd){color:#f2e2c4}.cg-wrap coords.ranks.black coord:nth-child(2n){color:#6b4325}:root{--bg:#14110f;--bg2:#221c18;--bg3:#332a24;--fg:#f1e8da;--muted:#9b8e7e;--accent:#e0a85a;--accent2:#9bc48a;--danger:#e07b6a;--radius:14px;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px)}*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}html,body{background:var(--bg);color:var(--fg);overscroll-behavior:none;margin:0;font:16px/1.4 -apple-system,SF Pro Text,system-ui,Segoe UI,Roboto,sans-serif}#app{min-height:100dvh}.page{max-width:560px;padding:calc(var(--safe-top) + 8px) 12px calc(var(--safe-bottom) + 16px);flex-direction:column;gap:10px;margin:0 auto;display:flex}.page.center{text-align:center;justify-content:center;align-items:center;min-height:100dvh}.topbar{align-items:center;gap:10px;min-height:44px;display:flex}.title{letter-spacing:.3px;flex:1;margin:0;font-size:22px}.muted{color:var(--muted)}.small{font-size:13px}.center{text-align:center}.row{gap:8px;display:flex}.row .btn,.row input{flex:1;min-width:0}.stack{flex-direction:column;gap:8px;width:100%;max-width:320px;display:flex}input{font:inherit;border:1px solid var(--bg3);background:var(--bg2);color:var(--fg);border-radius:12px;min-width:0;padding:12px 14px;font-size:max(16px,1em)}input:focus{outline:2px solid var(--accent);outline-offset:-1px}.btn{appearance:none;border:1px solid var(--bg3);background:var(--bg2);color:var(--fg);font:inherit;cursor:pointer;border-radius:12px;min-height:44px;padding:12px 16px;font-weight:600}.btn:active{transform:scale(.98)}.btn:disabled{opacity:.5}.btn.primary{background:var(--accent);border-color:var(--accent);color:#1b140e}.btn.big{padding:16px;font-size:17px}.btn.ghost{background:0 0}.btn.danger{color:var(--danger)}.btn.small{white-space:nowrap;min-height:36px;padding:6px 12px;font-size:14px}.btn.round{border-radius:999px;min-height:36px;padding:8px 14px}.welcome .logo{background:url(/icon.svg) 50%/cover;border-radius:18px;width:72px;height:72px;margin-bottom:6px;box-shadow:0 10px 30px #00000080}.welcome .lead{margin:0 0 6px;font-size:18px}.welcome form.row{width:100%;max-width:320px}.partners,.games{flex-direction:column;gap:8px;display:flex}.card{border-radius:var(--radius);background:var(--bg2);border:1px solid var(--bg3);color:inherit;justify-content:space-between;align-items:center;gap:12px;padding:14px;text-decoration:none;display:flex}.card.invite{flex-direction:column;align-items:stretch;gap:10px}.card.partner{flex-wrap:wrap}.card.partner .row{flex:none;margin-left:auto}.card.partner .row .btn{flex:none}.card.my-turn{border-color:var(--accent);box-shadow:inset 3px 0 0 var(--accent)}.card.finished{opacity:.75}.card-title{font-weight:600}.card-sub{color:var(--muted);margin-top:2px;font-size:14px}.card.my-turn .card-sub{color:var(--accent)}.card-side{flex-direction:column;align-items:flex-end;gap:4px;display:flex}.pill{border:1px solid var(--bg3);border-radius:999px;padding:2px 8px;font-size:12px}.pill.white{color:#1b140e;background:#f1e8da}.pill.black{color:#f1e8da;background:#0c0a09}.code{background:var(--bg);border:1px dashed var(--bg3);word-break:break-all;border-radius:10px;padding:10px 12px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:14px}.code.big{letter-spacing:4px;text-align:center;color:var(--accent);font-size:28px}.page.game{gap:6px;padding-left:0;padding-right:0}.page.game .topbar,.page.game .playerbar.bottom,.page.game .status,.page.game .moves,.page.game .actions,.page.game .chat{margin-left:12px;margin-right:12px}.page.game .topbar{margin:0;padding:0 12px}.back{color:var(--muted);padding:0 8px 4px 0;font-size:30px;line-height:1;text-decoration:none}.playerbar{background:var(--bg2);border-radius:12px;flex:1;align-items:center;gap:10px;padding:8px 12px;display:flex}.playerbar.active{outline:1px solid var(--accent)}.playerbar .name{flex:1;font-weight:600}.playerbar .clock{font-variant-numeric:tabular-nums;color:var(--muted)}.playerbar.active .clock{color:var(--accent);font-weight:700}.dot{border:1px solid var(--bg3);border-radius:50%;width:12px;height:12px}.dot.white{background:#f1e8da}.dot.black{background:#0c0a09}.board-frame{background:linear-gradient(160deg,#4a2d19,#2e1b0f);width:100%;padding:10px;box-shadow:0 14px 30px #0009}.board{aspect-ratio:1;width:100%;position:relative;box-shadow:inset 0 0 12px #00000080}.board .cg-wrap{width:100%;height:100%}.cg-wrap.fx-layer{pointer-events:none;position:absolute;inset:0}@media (width>=560px){.board-frame{border-radius:8px}}.status{flex-wrap:wrap;justify-content:center;align-items:center;gap:8px;min-height:28px;font-size:15px;display:flex}.turn-me{color:var(--accent);font-weight:700}.result{color:var(--accent2);font-weight:700}.moves{white-space:nowrap;font-variant-numeric:tabular-nums;scrollbar-width:none;gap:10px;padding:6px 4px;display:flex;overflow-x:auto}.moves::-webkit-scrollbar{display:none}.moves .pair{gap:6px;display:inline-flex}.moves .num{color:var(--muted)}.moves .san{font-weight:600}.moves .think{margin-left:auto;padding-left:12px}.actions{justify-content:center;gap:8px;display:flex}.chat{background:var(--bg2);border-radius:var(--radius);flex-direction:column;gap:6px;padding:10px;display:flex}.chat h3{color:var(--muted);margin:0;font-size:14px;font-weight:600}.chat-log{flex-direction:column;gap:4px;min-height:60px;max-height:220px;display:flex;overflow-y:auto}.msg{background:var(--bg3);border-radius:12px 12px 12px 4px;align-self:flex-start;align-items:baseline;gap:8px;max-width:85%;padding:6px 10px;display:flex}.msg.mine{background:#46331f;border-radius:12px 12px 4px;align-self:flex-end}.msg-text{white-space:pre-wrap;word-break:break-word}.msg-time{color:var(--muted);font-size:11px}.chat-form{gap:6px;display:flex}.chat-form input{background:var(--bg);flex:1;padding:10px 12px}.chat-form .btn{padding:10px 14px}.scoreboard{border-radius:var(--radius);background:var(--bg2);border:1px solid var(--bg3);grid-template-columns:1fr auto 1fr;align-items:center;gap:12px;padding:16px;display:grid}.score-col{text-align:center}.score-name{margin-bottom:4px;font-weight:700}.score-big{color:var(--accent);font-variant-numeric:tabular-nums;font-size:48px;font-weight:800;line-height:1}.score-mid{text-align:center;color:var(--muted)}.score-draws{color:var(--fg);font-size:24px;font-weight:700}.streak{text-align:center;color:var(--accent);margin:0;font-weight:600}.stats-table{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;font-size:15px}.stats-table th{text-align:center;color:var(--muted);padding:6px;font-size:13px;font-weight:600}.stats-table td{border-top:1px solid var(--bg3);text-align:center;padding:8px 6px}.stats-table td.lbl{text-align:left;color:var(--muted);font-size:14px}.facts{flex-direction:column;gap:6px;display:flex}.fact{background:var(--bg2);border-radius:10px;padding:10px 12px;font-size:14px}h3.section{color:var(--muted);margin:10px 0 0;font-size:14px;font-weight:600}.overlay{z-index:50;background:#0009;justify-content:center;align-items:center;padding:20px;display:flex;position:fixed;inset:0}.dialog{background:var(--bg2);border-radius:18px;flex-direction:column;gap:10px;width:min(100%,380px);max-height:90dvh;padding:18px;display:flex;overflow-y:auto}.dialog h2{margin:0 0 4px;font-size:20px}.dialog p{margin:0}.promo{justify-content:center;gap:8px;display:flex}.piece-btn{background:linear-gradient(135deg,#dcbb8a,#9d6539);width:68px;height:68px;padding:4px}.piece-btn .cg-wrap{width:100%;height:100%;display:block;position:relative}.piece-btn piece{width:100%;height:100%;position:absolute;inset:0}.toast{left:50%;bottom:calc(var(--safe-bottom) + 24px);background:var(--bg3);color:var(--fg);opacity:0;z-index:60;text-align:center;border-radius:999px;max-width:90%;padding:10px 16px;transition:all .25s;position:fixed;transform:translate(-50%,20px)}.toast.show{opacity:1;transform:translate(-50%)}.fx-shatter{width:12.5%;height:12.5%;position:absolute}.fx-shatter piece.frag{animation:frag var(--d,.8s) ease-out forwards;animation-duration:calc(var(--d) * 1s);will-change:transform, opacity;filter:none;background-repeat:no-repeat;position:absolute}@keyframes frag{0%{opacity:1;transform:translate(0)rotate(0)}to{transform:translate(calc(var(--cx) * 45px), calc(var(--cy) * 45px + 30px)) rotate(var(--r));opacity:0}}.fx-flash{background:radial-gradient(circle,#ffe6a0f2 0%,#ffb43c80 35%,#0000 70%);border-radius:50%;animation:.5s ease-out forwards flash;position:absolute;inset:-40%}@keyframes flash{0%{opacity:1;transform:scale(.2)}to{opacity:0;transform:scale(1.4)}}.fx-check{animation:1.1s ease-out checkpulse;position:absolute;inset:0}@keyframes checkpulse{20%{box-shadow:inset 0 0 40px 6px #d6604dcc}to{box-shadow:inset 0 0 #d6604d00}}.fx-mate{background:radial-gradient(circle,#0000 30%,#000000d9 100%);animation:1.2s ease-out forwards fade-in;position:absolute;inset:0}.cg-wrap.fx-layer.mated{background:#00000059;transition:background 1.5s}.fx-castle{background:linear-gradient(100deg,#0000 30%,#ffffff59 50%,#0000 70%) 0 0/300% 100%;animation:.9s ease-in-out forwards sweep;position:absolute;inset:0}@keyframes sweep{0%{opacity:0;background-position:100% 0}30%{opacity:1}to{opacity:0;background-position:0 0}}.fx-promotion{background:radial-gradient(circle,#e0a85a80 0%,#0000 60%);animation:1s ease-out forwards flash;position:absolute;inset:0}.fx-enpassant{background:#78a0ff26;animation:.8s ease-out forwards fade-out;position:absolute;inset:0}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0}}@media (width>=700px){.page.game{grid-template-columns:1fr 300px;grid-template-areas:"top top""board chat""bottom chat""status chat""moves chat""actions chat";column-gap:16px;max-width:900px;padding-left:12px;padding-right:12px;display:grid}.page.game .topbar{grid-area:top}.board-frame{border-radius:8px;grid-area:board}.playerbar.bottom{grid-area:bottom}.status{grid-area:status}.moves{grid-area:moves}.actions{grid-area:actions}.chat{grid-area:chat}.page.game .playerbar.bottom,.page.game .status,.page.game .moves,.page.game .actions,.page.game .chat{margin-left:0;margin-right:0}.chat-log{flex:1;max-height:none}}
