html{--bg:#d6e0e8;--surface:#eef2f5;--field:#e3eaf0;--line:#b4c4d0;--text:#213747;--sub:#456073;--accent:#345f83;--sq1:#cddae2;--sq2:#82a0b5}html[data-theme=dark]{color-scheme:dark;--bg:#131c25;--surface:#202d39;--field:#2b3b49;--line:#425462;--text:#e5edf3;--sub:#b4c5d1;--accent:#456f92;--sq1:#9cabb3;--sq2:#516e80}html body{background:var(--bg);color:var(--text)}html body header,html body :is(article,section,aside,form,dialog){background:var(--surface);color:var(--text);border-color:var(--line)}html body :is(article,section,aside,form,dialog){border-radius:24px}html body :is(button:not(.sq),select,input:not([type=checkbox])){border-radius:14px;background:var(--field);color:var(--text);border-color:var(--line);transition:background .15s,transform .15s}html body button:not(.sq):active{transform:scale(.97)}html body :is(.primary,#settingsButton){background:var(--accent);color:white}html body :is(p,.back,dialog h3,header strong,.score strong){color:var(--sub)}html body .score{background:var(--field);border-radius:15px}html body #board{position:relative;border-radius:12px}html body .sq{background:var(--sq1)}html body .sq.dark{background:var(--sq2)}html body .sq.previous{background:#a2bd98}html body .sq.dark.previous{background:#82a482}html body .sq.sel{outline:3px solid #ffda6a}.hint-arrow{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:4}html body .move-badge{width:clamp(21px,2.8vw,33px);font-size:clamp(13px,1.6vw,20px);top:1px;right:1px;animation:badge-in .15s ease-out both}html body dialog{width:min(440px,92vw);max-height:85dvh;padding:22px;box-shadow:0 18px 70px #0c172855}dialog[open]{animation:panel-in .19s cubic-bezier(.2,.8,.2,1)}dialog::backdrop{background:#101b288a}html body #settings label{padding:7px 0;justify-content:flex-start;font-size:15px}#settings input[type=checkbox]{appearance:none;flex:none;width:44px;height:24px;border:1px solid #c15e64;border-radius:20px;background:#723e45;box-shadow:0 0 7px #d9696c55;position:relative;cursor:pointer;transition:background .18s,box-shadow .18s}#settings input[type=checkbox]:before{content:'×';position:absolute;display:grid;place-items:center;left:2px;top:2px;width:18px;height:18px;color:#802931;background:#ffdee1;border-radius:50%;font:bold 15px/1 system-ui;transition:transform .18s}#settings input:checked{background:#2f7258;border-color:#5bba8f;box-shadow:0 0 8px #60bd8555}#settings input:checked:before{content:'✓';color:#145a3b;background:#d5f8df;transform:translateX(19px)}.pick-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:8px 0}.pick-grid button{padding:10px 4px}.pick-grid button.picked{outline:2px solid #639bbf}.pick-open{min-width:120px}html body .reviewMoves button.active{background:var(--accent);color:white}html body form input{background:var(--field)}@keyframes panel-in{from{opacity:0;transform:translateY(10px) scale(.97)}to{opacity:1;transform:none}}@keyframes badge-in{from{opacity:0;transform:scale(.72)}to{opacity:1;transform:scale(1)}}@media(prefers-reduced-motion:reduce){*,*:before{animation-duration:.01ms!important;transition-duration:.01ms!important}}
html[data-theme=dark]{--bg:#0c0b0a;--surface:#191714;--field:#24211b;--line:#534529;--text:#faf8f1;--sub:#d5c9af;--accent:#715522;--sq1:#d9caa8;--sq2:#79623f}
html[data-theme=dark] body :is(.back,header strong,dialog h3){color:#dec592}html[data-theme=dark] body :is(button,input,select):focus-visible{outline:2px solid #e0cda7;outline-offset:2px}
html[data-theme=dark] body .sq.previous{background:#c4ab6a}html[data-theme=dark] body .sq.dark.previous{background:#998044}html[data-theme=dark] body form:before{background-color:#c6af7f}
html body :is(#settings,.picker){scrollbar-width:none;max-height:calc(100dvh - 24px);overscroll-behavior:contain}
html body :is(#settings,.picker)::-webkit-scrollbar{display:none;width:0;height:0}
.setting-tabs{display:grid;grid-template-columns:1fr 1fr;gap:4px;margin:10px 0}.setting-tabs button{font-size:14px}.setting-page{padding:6px 0}.bot-pages{display:flex;justify-content:center;margin:6px}.bot-pages button{min-width:36px}
html body :is(.setting-tabs,.bot-pages) button[aria-pressed=true]{background:var(--accent);color:#fff}
html[data-theme=dark] body .pick-grid button.picked{outline-color:#b69853}html[data-theme=dark] body dialog::backdrop{background:#060503bc}
#games{min-width:0;max-width:100%;overflow-x:hidden;scrollbar-width:none}
#games::-webkit-scrollbar{display:none}
#games.list button{box-sizing:border-box;width:100%;min-width:0;max-width:100%;margin:0;text-align:start;white-space:normal;overflow-wrap:anywhere}
#games.list button+button{margin-block-start:6px}
.lobby #room>section{min-width:0}

html body{background-image:linear-gradient(color-mix(in srgb,var(--bg) 86%,transparent),color-mix(in srgb,var(--bg) 86%,transparent)),var(--wall,none)}
html body #board .sq{background-image:var(--tile-a);background-size:cover}html body #board .sq.dark{background-image:var(--tile-b)}html body #board .sq.previous{box-shadow:inset 0 0 0 4px #f4cb5fa6}
.swatch-nav{display:flex;align-items:center;justify-content:center;flex-wrap:wrap}.swatch-nav button{font-size:14px}.swatches{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.swatch{min-width:0;font-size:13px;overflow:hidden}.sample{height:45px;display:grid;grid-template-columns:repeat(4,1fr);border-radius:5px;overflow:hidden;margin:0 0 4px}.sample i{background-size:cover}.sample.pieces{background-position:10% center,90% center;background-size:50% 100%;background-repeat:no-repeat}.sample.wall{background-size:125px}.swatch[aria-pressed=true],.swatch-nav button[aria-pressed=true]{outline:2px solid #bc934c}
html body #board .move-badge{right:2%;top:2%;width:clamp(20px,3vw,32px);height:auto;line-height:1;border:2px solid #fff9;color:white;box-shadow:0 2px 5px #0006;font-family:system-ui;font-weight:850;letter-spacing:-1px}.move-badge.Best{background:#648d38}.move-badge.Good{background:#759764}.move-badge.Brilliant{background:#169ba6}.move-badge.Inaccuracy{background:#c9911a}.move-badge.Mistake{background:#d16b24}.move-badge.Blunder{background:#cb3c44}

html body #board .move-badge:is(.Brilliant,.Great){background:#164d67;border-color:#a8eeff;color:#a8eeff;font-weight:1000;font-family:system-ui,sans-serif;font-style:italic;letter-spacing:-.08em;z-index:6}
html body #board .move-badge.Great{color:#b7ceff;border-color:#93baff;background:#264ba1}
.grade-flash{position:absolute;inset:0;z-index:5;pointer-events:none;display:grid;place-items:center;color:#fff;font:1000 clamp(9px,2vw,21px)/1 system-ui,sans-serif;letter-spacing:-.06em;text-shadow:0 1px 3px #103e65,0 0 5px #123d60;background:radial-gradient(ellipse,#51cbeaeb,#7ee5ffab);animation:grade-flash 1.6s both}
.grade-flash.Great{background:radial-gradient(ellipse,#3f74deed,#709af1ae);text-shadow:0 1px 4px #162f72}.grade.Great{color:#4479d9}
@keyframes grade-flash{0%{opacity:0}15%,62%{opacity:1}100%{opacity:0}}
@media(prefers-reduced-motion:reduce){.grade-flash{animation:none;opacity:.93}}

html body .swatch[aria-pressed=true]{position:relative;outline:2px solid var(--choice,#326e99);outline-offset:-2px;box-shadow:inset 5px 0 var(--choice,#326e99)}
html[dir=rtl] body .swatch[aria-pressed=true]{box-shadow:inset -5px 0 var(--choice,#326e99)}
html[data-theme=dark]{--choice:#d6b668}
html body .swatch[aria-pressed=true]::after{content:'✓';position:absolute;inset-block-start:4px;inset-inline-start:5px;border-radius:100%;width:18px;height:18px;display:grid;place-items:center;background:var(--choice,#326e99);color:var(--surface);font:bold 12px system-ui}

#reviewPanel .reviewMoves{max-height:none;overflow:visible;min-width:0}#reviewPanel .reviewMoves button{min-width:0;max-width:100%;white-space:normal}#reviewPanel .reviewMoves [hidden],#reviewPanel .reviewPager[hidden]{display:none!important}.reviewPager{align-items:center;justify-content:center;direction:ltr;gap:8px}.reviewPager button{flex:0 0 auto}

body.match #room{position:relative;display:block;max-width:1120px;margin:auto}
body.match #room>article{width:min(100%,max(340px,calc(100dvh - 225px)),720px);margin-inline:auto;position:relative;left:0;transition:width .42s cubic-bezier(.2,.75,.22,1),left .42s cubic-bezier(.2,.75,.22,1)}
body.match #actions{display:flex;justify-content:center;flex-wrap:wrap;gap:4px;margin-top:8px}
body.match #turn{text-align:center;margin:4px}body.match #room>section{display:none}
body.match.review-open #room>article{width:min(53%,600px);left:20%}
body.match.review-open #room>section{display:block;position:absolute;top:0;left:0;width:39%;animation:ratingReveal .4s cubic-bezier(.2,.8,.2,1) both}
@keyframes ratingReveal{from{opacity:0;transform:translateY(14px) scale(.96)}to{opacity:1;transform:none}}
@media(max-width:720px){body.match.review-open #room>article{width:90%;left:5%}body.match.review-open #room>section{position:relative;width:100%;margin-top:10px}}
body.match #room[hidden]{display:none!important}
