/* Maple and walnut marquetry. The grain runs across adjacent squares as one sheet. */
.wd-game {
  --wd-grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='160' viewBox='0 0 280 160'%3E%3Cg fill='none' stroke='%23462d1b' stroke-opacity='.15' stroke-width='.85'%3E%3Cpath d='M-5 13C38 9 72 18 114 15S219 4 287 11M-4 18C58 12 77 25 132 20s93-12 153-3M-5 64C49 66 75 48 118 48s62 15 107 16 44-6 60-6M-3 68C51 71 79 54 113 54s54 12 99 12 49-4 72-6M-3 103C52 101 87 114 132 109s84-12 149-6M-6 144C28 138 55 150 93 147s67-10 109-6 54 5 85 1'/%3E%3C/g%3E%3C/svg%3E");
  --wd-ivory:#fbebcc;
  --wd-ebony:#3e232c;
  --wd-size:min(100%,36rem);
  --wd-rail:clamp(6px,.8vw,12px);
  display:grid;
  justify-items:center;
  min-width:0;
  width:100%;
  margin:auto;
  padding:10px clamp(7px,1.25vw,16px) clamp(9px,1.1vw,15px);
  border:1px solid #533a30;
  border-radius:10px;
  background:
    radial-gradient(ellipse at 40% 8%,#83604640,transparent 65%),
    linear-gradient(118deg,#49382f,#332923 59%,#46352f);
  box-shadow:inset 0 0 0 1px #dcb68d23;
  color:#fff2da;
}
.wd-status {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  width:var(--wd-size);
  min-height:28px;
  margin:0 0 8px;
}
.wd-turn { min-width:0; display:flex; align-items:baseline; flex-wrap:wrap; gap:2px 10px; }
.wd-turn strong { color:#fff2dd; font:700 clamp(.85rem,1.5vw,1rem)/1.2 Portal,system-ui,sans-serif; }
.wd-turn small { color:#edcfb3; font:.78rem/1.25 Portal,system-ui,sans-serif; }
.wd-material { display:flex; gap:10px; flex:none; font-weight:700; font-variant-numeric:tabular-nums; }
.wd-count { display:inline-flex; gap:5px; align-items:center; font-size:.83rem; }
.wd-token { width:14px; height:14px; border-radius:50%; box-shadow:0 1px 1px #211612; }
.wd-ivory { background:var(--wd-ivory); border:1px solid #fcf3e1; }
.wd-ebony { background:var(--wd-ebony); border:1px solid #c8a498; }
.wd-rail {
  position:relative;
  width:var(--wd-size);
  padding:var(--wd-rail);
  border:1px solid #352519;
  border-radius:5px;
  background:
    var(--wd-grain) center / 75% 65%,
    linear-gradient(138deg,#ad8662,#64452f 50%,#6b4933 76%,#93674b);
  box-shadow:inset 0 0 0 1px #ba9673,0 3px 7px #20160e6e;
}
.wd-rail::after { content:''; position:absolute; inset:calc(var(--wd-rail) / 2); border:1px solid #d7b58983; border-radius:1px; pointer-events:none; }
.wd-board {
  position:relative;
  display:grid;
  grid-template:repeat(10,minmax(0,1fr))/repeat(10,minmax(0,1fr));
  width:100%; aspect-ratio:1;
  border:1px solid #503a2d;
  background:#ecd0a4;
  box-shadow:0 0 0 1px #debd91;
  isolation:isolate;
  container-type:inline-size;
}
.wd-board::after {
  content:''; position:absolute; inset:0; z-index:1; pointer-events:none;
  background:var(--wd-grain) 50% 50% / 80% 36%;
  opacity:.59;
}
.wd-light { background:linear-gradient(108deg,#f3dfbd,#e9cfa6); }
.wd-board button.wd-field {
  position:relative; display:grid; place-items:center;
  min-width:0; min-height:0; width:100%; height:100%; margin:0; padding:0;
  border:0; border-radius:0; appearance:none; touch-action:manipulation;
  background:linear-gradient(105deg,#936f50,#866044); color:#fff4dd;
  cursor:pointer; line-height:1;
}
@media(hover:hover) {
  .wd-board button.wd-field:hover { background:linear-gradient(105deg,#91664d,#76513c); }
}
.wd-number { position:absolute; top:2%; left:4%; z-index:2; color:#fff4dd; font:600 clamp(7px,1.55cqi,11px)/1.1 Portal,sans-serif; pointer-events:none; }
.wd-disc {
  --wd-top:#fae7c5; --wd-middle:#f1d6a8; --wd-shade:#cbb083;
  --wd-rim:#9f7f59; --wd-foot:#80654c; --wd-glint:#fff5dd; --wd-groove:#b49467;
  position:relative; z-index:2; display:grid; place-items:center;
  width:76%; aspect-ratio:1; margin-top:2%; border-radius:50%;
  background:linear-gradient(145deg,var(--wd-glint) 3%,var(--wd-top) 23%,var(--wd-middle) 66%,var(--wd-shade));
  border:1px solid var(--wd-rim);
  box-shadow:0 2px 0 var(--wd-foot),0 3px 3px #321b1e88,inset 0 1px 1px var(--wd-glint);
  color:#725132; pointer-events:none;
}
.wd-black {
  --wd-top:#65434d; --wd-middle:#462d35; --wd-shade:#302229;
  --wd-rim:#35232a; --wd-foot:#21191c; --wd-glint:#8d7377; --wd-groove:#34252a;
  color:#f7ddb0;
}
.wd-disc::before {
  content:''; position:absolute; inset:10%; border-radius:50%;
  border:1px solid var(--wd-groove);
  box-shadow:0 .7px .5px var(--wd-glint),inset 0 1px 1px var(--wd-glint),inset 0 -1px 1px var(--wd-rim);
}
.wd-disc:not(.wd-king)::after {
  content:''; position:absolute; inset:22%; border-radius:50%;
  border:1px solid var(--wd-groove); opacity:.7;
  box-shadow:0 1px 0 var(--wd-glint),inset 0 1px 0 var(--wd-glint);
}
.wd-crown { position:relative; width:54%; height:48%; filter:drop-shadow(0 .6px .4px var(--wd-glint)); }
.wd-disc.wd-captured { opacity:.55; }
.wd-disc.wd-captured::after { content:'×'; inset:0; display:grid; place-items:center; border:0; box-shadow:none; opacity:1; font:800 clamp(15px,4cqi,25px)/1 system-ui; color:#fff; text-shadow:0 1px 2px #211713; }
.wd-field.wd-previous::after {
  content:''; position:absolute; inset:auto 4% 4% auto; width:15%; aspect-ratio:1;
  clip-path:polygon(100% 0,100% 100%,0 100%); background:#ffe0a1; pointer-events:none;
}
.wd-board .wd-field.wd-selected { box-shadow:inset 0 0 0 3px #ffe3a0,inset 0 0 0 5px #4b3326; }
.wd-dot { z-index:2; width:28%; aspect-ratio:1; border:2px solid #fff1c5; border-radius:50%; background:#4c3029; box-shadow:0 0 0 1px #604235; pointer-events:none; }
.wd-board button.wd-field:focus-visible { z-index:3; outline:3px dashed #fff8dd; outline-offset:-4px; }
@media(min-width:900px) {
  .wd-game { --wd-size:min(100%,clamp(275px,calc(100svh - 286px),645px)); }
  .is-expanded .wd-game { --wd-size:min(100%,clamp(300px,calc(100dvh - 150px - env(safe-area-inset-top)),800px)); }
}
@media(max-width:600px) {
  /* Use the page and case gutters for playing space, while controls keep their inset. */
  body.has-game-page .game-spread > .play-room[data-play-room="warcaby"]:not(.is-expanded) {
    width:calc(100% + 12px);
    margin-inline:-6px;
  }
  [data-classic="warcaby"] .classic-panel > .classic-table {
    width:calc(100% + 12px);
    margin-inline:-6px;
  }
  .wd-game {
    --wd-rail:4px; --wd-size:100%;
    grid-template-columns:minmax(0,1fr);
    padding:5px 2px 6px;
  }
  .wd-status { min-height:25px; margin-bottom:4px; }
  .wd-turn small,.wd-count { font-size:.73rem; }
  .wd-token { width:11px; height:11px; }
  .wd-number { font-size:clamp(7px,2.15cqi,10px); }
  .wd-disc { width:75%; }
}
@media(forced-colors:active) {
  .wd-game { color:CanvasText; background:Canvas; border:1px solid CanvasText; }
  .wd-turn :is(strong,small) { color:CanvasText; }
  .wd-board,.wd-board>* { forced-color-adjust:none; }
  .wd-board .wd-field[aria-pressed=true] { outline:3px solid Highlight; outline-offset:-3px; }
}
