/* RGA Board Studio v1 — universal visual layer. Loaded after legacy themes.
   No JS gameplay or DOM board-cell mutation. Supports gameplay, replay, spectator. */
:root[data-rga-board-theme="wood"]{--rga-light:#ebd0a0;--rga-dark:#6d472e;--rga-frame:#74471f;--rga-frame-edge:#daa55c;--rga-texture:repeating-linear-gradient(87deg,transparent 0 5px,#00000009 5px 6px,transparent 6px 14px);}
:root[data-rga-board-theme="marble"]{--rga-light:#eceae3;--rga-dark:#37414b;--rga-frame:#222b31;--rga-frame-edge:#abb5bd;--rga-texture:linear-gradient(132deg,#ffffff1c 0%,transparent 21%,#00000013 53%,transparent 70%,#ffffff10 100%);}
:root[data-rga-board-theme="midnight"]{--rga-light:#859cb9;--rga-dark:#22384f;--rga-frame:#101d31;--rga-frame-edge:#5088bb;--rga-texture:linear-gradient(142deg,#ffffff10,transparent 45%,#00000016);}
:root[data-rga-board-theme="heritage"]{--rga-light:#d6a86b;--rga-dark:#744429;--rga-frame:#472712;--rga-frame-edge:#c58d48;--rga-texture:repeating-linear-gradient(95deg,#0000000a 0 2px,transparent 2px 8px,#ffffff08 8px 9px,transparent 9px 15px);}
:root[data-rga-board-size="compact"]{--rga-board-max:340px;}
:root[data-rga-board-size="medium"]{--rga-board-max:440px;}
:root[data-rga-board-size="large"]{--rga-board-max:540px;}
/* Specificity intentionally higher than existing royal-redesign and p2p override styles. */
html[data-rga-board-theme] #board,
html[data-rga-board-theme] #p2p-replay-board{
  box-sizing:border-box!important; border:7px solid var(--rga-frame-edge)!important;
  border-radius:12px!important; background:var(--rga-frame)!important;
  box-shadow:0 0 0 4px var(--rga-frame),0 12px 28px #0008,inset 0 1px 3px #fff3!important;
  max-width:100%!important; aspect-ratio:1/1!important;
}
html[data-rga-board-theme] #board{width:min(100%,var(--rga-board-max),calc(100dvh - 240px))!important;justify-self:center;}
html[data-rga-board-theme] #p2p-replay-board{width:min(100%,var(--rga-board-max),calc(100dvh - 240px))!important;}
/* Class names from live/computer, replay and spectator renderers. */
html[data-rga-board-theme] #board :is(.light,.tile:not(.dark)),
html[data-rga-board-theme] #p2p-replay-board .light{
  background:var(--rga-texture),var(--rga-light)!important;
}
html[data-rga-board-theme] #board :is(.dark,.tile.dark),
html[data-rga-board-theme] #p2p-replay-board .dark{
  background:var(--rga-texture),var(--rga-dark)!important;
}
html[data-rga-board-theme] #board :is(.selected,.target){outline-offset:-4px;}
/* Shared piece footprint never depends on changing font metrics or a king glyph. */
html[data-rga-piece-theme] #board :is(.piece,.disk),
html[data-rga-piece-theme] #p2p-replay-board .p2p-replay-disk{
  display:grid!important;place-items:center!important;position:relative!important;
  box-sizing:border-box!important;width:76%!important;height:76%!important;
  max-width:76%!important;max-height:76%!important;aspect-ratio:1/1!important;
  margin:auto!important;padding:0!important;flex-shrink:0!important;
  font-family:Georgia,serif!important;font-weight:800!important;
  font-size:clamp(13px,2.1vw,27px)!important;line-height:1!important;
  transform:none!important;filter:none!important;
  border:3px solid var(--rga-piece-edge)!important;
  box-shadow:inset 0 2px 2px #ffffff50,inset 0 -4px 5px #0007,0 3px 5px #0009!important;
  background:radial-gradient(ellipse at 28% 19%,var(--rga-piece-top),var(--rga-piece-mid) 50%,var(--rga-piece-bottom) 100%)!important;
  border-radius:50%!important;color:#f2dca9!important;text-shadow:0 1px 2px #000c!important;
}
html[data-rga-piece-theme] #board :is(.piece,.disk).red,html[data-rga-piece-theme] #p2p-replay-board .p2p-replay-disk.red{
  --rga-piece-top:#f49ba5;--rga-piece-mid:#b83d53;--rga-piece-bottom:#741d31;--rga-piece-edge:#e5a2a1;
}
html[data-rga-piece-theme] #board :is(.piece,.disk).black,html[data-rga-piece-theme] #p2p-replay-board .p2p-replay-disk.black{
  --rga-piece-top:#5f706e;--rga-piece-mid:#2e3533;--rga-piece-bottom:#111817;--rga-piece-edge:#cdb77b;
}
html[data-rga-piece-theme] #board :is(.piece,.disk)::before,
html[data-rga-piece-theme] #p2p-replay-board .p2p-replay-disk::before{
  content:""!important;position:absolute!important;inset:12%!important;border:1px solid #ffffff4d!important;
  border-radius:inherit!important;pointer-events:none!important;box-shadow:inset 0 1px 1px #ffffff22!important;
}
html[data-rga-piece-theme] #board :is(.piece,.disk)::after,
html[data-rga-piece-theme] #p2p-replay-board .p2p-replay-disk::after{content:none!important;}
/* Gold Crown is metallic, for BOTH sides; side color is still distinguishable. */
html[data-rga-piece-theme="gold"] #board :is(.piece,.disk),
html[data-rga-piece-theme="gold"] #p2p-replay-board .p2p-replay-disk{
  --rga-piece-edge:#edc666;box-shadow:inset 0 2px 2px #fff8,inset 0 -4px 5px #0009,0 3px 7px #000b!important;
  border-width:4px!important;
}
html[data-rga-piece-theme="gold"] #board :is(.piece,.disk)::before,
html[data-rga-piece-theme="gold"] #p2p-replay-board .p2p-replay-disk::before{border:2px solid #e9c66c!important;}
/* Heritage carved pieces have a woodgrain finish. */
html[data-rga-piece-theme="carved"] #board :is(.piece,.disk).red,
html[data-rga-piece-theme="carved"] #p2p-replay-board .p2p-replay-disk.red{
  --rga-piece-top:#e6aa73;--rga-piece-mid:#a26437;--rga-piece-bottom:#58301d;--rga-piece-edge:#edc18f;
}
html[data-rga-piece-theme="carved"] #board :is(.piece,.disk).black,
html[data-rga-piece-theme="carved"] #p2p-replay-board .p2p-replay-disk.black{
  --rga-piece-top:#7a6250;--rga-piece-mid:#49372a;--rga-piece-bottom:#20150e;--rga-piece-edge:#b3936f;
}
html[data-rga-piece-theme="carved"] #board :is(.piece,.disk),
html[data-rga-piece-theme="carved"] #p2p-replay-board .p2p-replay-disk{
  background:repeating-linear-gradient(93deg,#ffffff0d 0 2px,transparent 2px 7px,#00000015 7px 9px),radial-gradient(ellipse at 28% 19%,var(--rga-piece-top),var(--rga-piece-mid) 50%,var(--rga-piece-bottom) 100%)!important;
}
/* Square means square tokens, not stretched or oval pieces. */
html[data-rga-piece-theme="square"] #board :is(.piece,.disk),
html[data-rga-piece-theme="square"] #p2p-replay-board .p2p-replay-disk{border-radius:14%!important;}
/* Preserve shape and center for animated ghosts in online/replay modes. */
html[data-rga-piece-theme] #board>.p2p-live-piece-ghost :is(.piece,.disk),
html[data-rga-piece-theme] #p2p-replay-board>.p2p-replay-moving .p2p-replay-disk{width:76%!important;height:76%!important;max-width:76%!important;max-height:76%!important;}
/* Viewer-controllable settings. */
.rga-board-studio{box-sizing:border-box;width:min(100%,var(--rga-board-max));margin:0 auto 10px!important;justify-self:center;grid-column:auto!important;grid-row:auto!important;color:#f5e9d5;font:inherit;}
.rga-board-studio-toggle{background:#163d34!important;color:#ffe4ac!important;border:1px solid #a68c51!important;padding:9px 14px!important;border-radius:10px!important;font-size:14px!important;line-height:1.3!important;}
.rga-board-studio-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:10px 0 4px}
.rga-board-studio-fields[hidden]{display:none!important}
.rga-board-studio-fields label{display:flex;flex-direction:column;gap:5px;font-size:12px;font-weight:600;min-width:0}
.rga-board-studio-fields select{width:100%;min-width:0;background:#102d28;color:#fff2d8;border:1px solid #b29863;border-radius:8px;padding:8px 5px;font:inherit;font-size:12px;}
.rga-board-studio-fields small{grid-column:1/-1;font-size:11px;color:#b8c9c5;line-height:1.4}
/* Realistic finishes and an African-inspired carved design.
   Geometric border accents are contemporary design motifs, not an asserted reproduction of a named culture. */
html[data-rga-board-theme] #board>button,
html[data-rga-board-theme] #board>.light,
html[data-rga-board-theme] #board>.dark {min-width:0!important;min-height:0!important;aspect-ratio:1/1;box-sizing:border-box;}
html[data-rga-board-theme="wood"] #board,
html[data-rga-board-theme="wood"] #p2p-replay-board{
  background:linear-gradient(145deg,#e9bf7a,#57321b 48%,#a86e35)!important;
  border-color:#c49250!important;
  box-shadow:0 0 0 4px #412614,0 0 0 6px #a36c37,0 18px 32px #0009,inset 0 2px 4px #fff6!important;
}
html[data-rga-board-theme="marble"] #board,
html[data-rga-board-theme="marble"] #p2p-replay-board{
  background:linear-gradient(110deg,#f5f3ea,#5f6c75,#0f151a,#b2bbc1)!important;
  box-shadow:0 0 0 3px #171d21,0 0 0 5px #9faab0,0 16px 32px #000a,inset 0 1px 4px #fff9!important;
}
html[data-rga-board-theme="midnight"] #board,
html[data-rga-board-theme="midnight"] #p2p-replay-board{
  background:linear-gradient(135deg,#5e96ce,#071826 58%,#264d71)!important;
  box-shadow:0 0 0 3px #0b192a,0 0 0 5px #4a80a8,0 12px 30px #000b,inset 0 1px 3px #e6f4ff6b!important;
}
/* African Heritage: etched alternating geometric inlay around the timber frame;
   warm iroko-like amber and deep ebony tones. No external texture downloads. */
html[data-rga-board-theme="heritage"] #board,
html[data-rga-board-theme="heritage"] #p2p-replay-board{
  border:9px solid transparent!important;
  background:
    linear-gradient(140deg,#60351b,#2b160e 58%,#8a4c25) padding-box,
    repeating-conic-gradient(from 45deg,#d6a45d 0 12.5%,#482316 12.5% 25%,#b97b3d 25% 37.5%,#2d1c13 37.5% 50%) 0 0/25px 25px border-box!important;
  box-shadow:0 0 0 3px #2c170d,0 0 0 6px #b37b3c,0 0 0 8px #29170e,0 20px 35px #000a,inset 0 1px 2px #fff5!important;
}
html[data-rga-board-theme="heritage"] #board :is(.light,.tile:not(.dark)),
html[data-rga-board-theme="heritage"] #p2p-replay-board .light{
 background:repeating-linear-gradient(94deg,transparent 0 7px,#73452412 7px 9px,transparent 9px 17px),linear-gradient(135deg,#f1d09a,#c68e4d)!important;
}
html[data-rga-board-theme="heritage"] #board :is(.dark,.tile.dark),
html[data-rga-board-theme="heritage"] #p2p-replay-board .dark{
 background:repeating-linear-gradient(94deg,transparent 0 6px,#f3b6750d 6px 8px,transparent 8px 15px),linear-gradient(135deg,#87502b,#4a291c)!important;
}
/* Tokens are always 1:1, even if the board shrinks; accessibility labels remain on cells. */
html[data-rga-piece-theme] #board :is(.piece,.disk),
html[data-rga-piece-theme] #p2p-replay-board .p2p-replay-disk{
 min-width:0!important;min-height:0!important;letter-spacing:normal!important;
 box-shadow:inset 0 3px 3px #ffffff50,inset 0 -5px 6px #0008,0 3px 0 #0006,0 5px 7px #0007!important;
}
html[data-rga-piece-theme="carved"] #board :is(.piece,.disk),
html[data-rga-piece-theme="carved"] #p2p-replay-board .p2p-replay-disk{
 background:repeating-linear-gradient(104deg,#0000 0 3px,#00000013 3px 4px,#fff3 4px 5px,#0000 5px 10px),radial-gradient(ellipse at 30% 20%,var(--rga-piece-top),var(--rga-piece-mid) 56%,var(--rga-piece-bottom) 100%)!important;
}
html[data-rga-piece-theme="square"] #board :is(.piece,.disk)::before,
html[data-rga-piece-theme="square"] #p2p-replay-board .p2p-replay-disk::before{border-radius:8%!important;}
/* Strong contrast selection/capture indicators override any tile background. */
html[data-rga-board-theme] #board>.selected{outline:3px solid #ffd66f!important;outline-offset:-3px!important;}
html[data-rga-board-theme] #board>.target{box-shadow:inset 0 0 0 4px #47e6b0!important;}
@media(max-width:690px){
 .rga-board-studio{margin:8px auto!important;max-width:100%;}
 .rga-board-studio-fields{grid-template-columns:repeat(2,minmax(0,1fr));}
 .rga-board-studio-fields label:last-of-type{grid-column:1/-1;}
 html[data-rga-board-theme] #board{width:min(100%,var(--rga-board-max),72dvh)!important;}
}
@media(max-height:620px){html[data-rga-board-theme] #board,html[data-rga-board-theme] #p2p-replay-board{width:min(100%,var(--rga-board-max),48dvh)!important;}}
@media(prefers-reduced-motion:reduce){html[data-rga-board-theme] #board *,html[data-rga-piece-theme] #board *{animation:none!important;transition:none!important;}}
