.chess{--ink:#1b3a4b;--rule:#cdded8;--accent:#09685f;--paper:#fffefa;padding-block:1.25rem;color:var(--ink);line-height:1.7}
.chess .chess-mast,.chess .row,.chess .actions{display:flex;align-items:center;gap:.7rem;flex-wrap:wrap}
.chess .chess-mast,.chess .row{justify-content:space-between}
.chess .chess-mast{border-bottom:2px solid var(--ink);padding:.4rem 0 1rem;margin-bottom:1rem}
.chess :is(h2,h3,h4,p){margin:0}
.chess .eyebrow{font-size:.87rem;color:var(--accent);font-weight:800}
.chess h2{font-size:clamp(2.2rem,6vw,3.5rem);line-height:1.24}
.chess h3{font-size:1.5rem;line-height:1.5}
.chess h4{font-size:1.1rem}
.chess .chess-mark{display:grid;place-items:center;inline-size:3.8rem;aspect-ratio:1;background:var(--ink);color:#ffe295;border-radius:50% 50% 12% 50%;font:2.6rem/1 'Segoe UI Symbol',serif}
.chess .chess-layout,.chess .match-layout,.chess .ranking-layout{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:clamp(1rem,3vw,2rem);align-items:start}
.chess .sheet,.chess .guide,.chess dialog{border-radius:var(--radius);border:1px solid var(--rule);padding:clamp(1rem,3vw,1.75rem);background:var(--paper);box-shadow:0 8px 24px #1b3a4b0d;min-width:0}
.chess .guide{background:#e5f2e9;border-top:4px solid var(--accent)}
.chess .guide p:not(.eyebrow){margin:.7rem 0}
.chess hr{border:0;border-top:1px solid #adcac0;margin:1.2rem 0}
.chess .field,.chess legend{display:block;font-weight:bold;margin:.8rem 0 .3rem}
.chess .choices{padding:0;margin:.8rem 0;border:0;min-width:0}
.chess .choices label{display:inline-flex;align-items:center;gap:.4rem;min-height:44px;padding:.3rem .7rem;margin:.1rem;border:1px solid #acbeb8;border-radius:.8rem;cursor:pointer}
.chess .choices label:has(:checked){background:#deeee7;border-color:var(--accent)}
.chess input[type=radio]{accent-color:var(--accent);margin:0}
.chess input:not([type=radio]),.chess select{width:100%;border:1.5px solid #718a8e;border-radius:.65rem;background:white;padding:.55rem .8rem;min-height:44px}
.chess .hint,.chess small{color:#455e68;font-size:.93rem}
.chess .hint{margin:.45rem 0 .9rem}
.chess .actions{margin-top:.8rem}
.chess button{font-family:inherit}
.chess .caution{color:#923525;border-color:#b16e63}
.chess .caution:hover{background:#813022;color:white}
.chess :focus-visible{outline:3px solid #644287;outline-offset:2px}
.chess .feedback:not(:empty),.chess .callout,.chess .turn{margin:.8rem 0;padding:.7rem 1rem;border-inline-start:4px solid #ad7300;border-radius:.5rem;background:#fff2ce;overflow-wrap:anywhere}
.chess .feedback:empty,.chess #connection:empty{margin:0;padding:0}
.chess .turn{background:#e4f4ee;border-color:var(--accent);font-weight:800;font-size:1.08rem}
.chess .room-code,.chess .moves{font-family:ui-monospace,monospace}
.chess .room-code{letter-spacing:.12em;text-transform:uppercase}
.chess #board{width:100%;max-width:36rem;aspect-ratio:1;margin-inline:auto;container-type:inline-size;display:grid;grid-template:repeat(8,minmax(0,1fr)) / repeat(8,minmax(0,1fr));border:3px solid var(--ink);border-radius:.45rem;overflow:hidden;--pale:#e6eddc;--deep:#7aa399}
.chess #board.night{--pale:#a4b8ab;--deep:#49736e}
.chess .square{position:relative;display:grid;place-items:center;min-width:0;min-height:0;padding:0;border:0;border-radius:0;background:var(--pale);color:#182d37;cursor:pointer;touch-action:manipulation}
.chess .square.dark{background:var(--deep)}
.chess .square[aria-disabled=true]{cursor:default}
.chess .square[aria-pressed=true]{background:#f4cf64;box-shadow:inset 0 0 0 3px #704900}
.chess .square.check{box-shadow:inset 0 0 0 4px #ae301c}
.chess .square.legal::after{content:'';position:absolute;inset:37%;border-radius:100%;background:#11483f}
.chess .square.capture::after{inset:5%;background:transparent;border:3px dashed #752f11}
.chess .square:focus-visible{z-index:1;outline:3px solid #7229a3;outline-offset:-4px;box-shadow:inset 0 0 0 6px #fff}
.chess .piece{font:clamp(1rem,9vw,3.5rem)/1 'Segoe UI Symbol','DejaVu Sans',serif;font-size:9.5cqi;color:#152936;text-shadow:0 1px 0 #fff9}
.chess .piece.white{color:#fffdf1;-webkit-text-stroke:1px #283b44;text-shadow:0 1px 2px #223e45}
.chess .coord{position:absolute;font:700 clamp(.47rem,1.8cqi,.74rem)/1 sans-serif;color:#132e31;pointer-events:none}
.chess .rank{top:3%;left:4%}.chess .file{bottom:2%;right:4%}
.chess .match-notes{min-width:0;overflow-wrap:anywhere;padding-inline-start:1rem;border-inline-start:1px solid var(--rule)}
.chess details{border-top:1px solid var(--rule);margin-top:.65rem}
.chess summary{padding:.65rem 0;font-weight:bold;cursor:pointer}
.chess .moves,.chess #messages{max-height:12rem;overflow:auto;margin:.5rem 0;padding:.5rem;background:#f2f5ef;border-radius:.5rem}
.chess .moves{list-style-position:inside;font-size:.9rem;columns:2}
.chess #messages:empty::before{content:'لا رسائل بعد.'}
.chess #messages p+p{border-top:1px solid var(--rule);padding-top:.3rem;margin-top:.3rem}
.chess #chat-form button{margin-top:.4rem}
.chess .lower-actions{border-top:1px solid var(--rule);padding-top:1rem}
.chess .ranking-layout{grid-template-columns:repeat(2,minmax(0,1fr))}
.chess table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.chess caption{text-align:start;font-weight:800;padding-block:.8rem}
.chess td,.chess th{text-align:start;padding:.36rem .2rem;border-bottom:1px solid var(--rule)}
.chess th{background:#e8f2eb}
.chess dialog{max-width:min(92vw,26rem);color:var(--ink)}
.chess dialog::backdrop{background:#10252dbf}
@media(max-width:700px){
  .chess .chess-layout,.chess .match-layout,.chess .ranking-layout{grid-template-columns:minmax(0,1fr)}
  .chess #table-view{padding:.8rem}
  .chess .match-notes{border-inline-start:0;padding-inline-start:0}
}
