/* Échecs — édition familiale : relief sculpté, plateau bois, sans changer les règles.
   Rendu 2.5D CSS (pas de moteur 3D). Styles confinés au jeu d'échecs. */
.chess-screen .cframe{
  background:radial-gradient(ellipse at 50% 0%,#72523a 0%,#3c291c 48%,#211711 100%);
  border:1px solid #a57a4e;
  box-shadow:inset 0 2px 0 #ffffff25,inset 0 -5px 14px #0007,0 16px 32px #0005;
  padding:clamp(9px,2.6vw,18px);
}
.chess-screen .board{
  position:relative;overflow:hidden;
  border:clamp(5px,1.5vw,11px) solid #58371f;
  border-radius:7px;
  box-shadow:0 0 0 2px #c39a65,0 0 0 5px #2c1b12,0 12px 22px #0008,inset 0 0 0 2px #0005;
  background:#e6c69b;
}
.chess-screen .sq{
  isolation:isolate;
  background:linear-gradient(140deg,#f9e6c5,#dfbd91);
}
.chess-screen .sq.d{
  background:linear-gradient(140deg,#a8754d,#815433);
}
.chess-screen .sq::before{
  content:"";position:absolute;inset:0;pointer-events:none;z-index:0;
  box-shadow:inset 1px 1px 1px #fff3,inset -1px -1px 1px #0002;
}
.chess-screen .sq:has(>.pc)::after{
  content:"";position:absolute;z-index:0;pointer-events:none;
  left:17%;right:17%;bottom:7%;height:17%;border-radius:50%;
  background:radial-gradient(ellipse,#120c08a8 0%,#120c0835 55%,transparent 76%);
  filter:blur(2px);
}
.chess-screen .sq.tg:has(.pc)::after{
  left:4%;right:4%;bottom:4%;height:90%;
  background:transparent;border:4px solid #285f3c99;border-radius:50%;filter:none;
}
.chess-screen .sq .pc{
  position:relative;z-index:2;display:inline-block;
  font-family:"DejaVu Sans","Segoe UI Symbol","Apple Symbols",serif;
  font-size:clamp(25px,8.7vw,57px);
  line-height:1;
  transform:translateY(-3%) perspective(180px) rotateX(8deg);
  transition:transform .16s ease,filter .16s ease;
  -webkit-text-stroke:.55px #292018;
  filter:drop-shadow(1px 2px 0 #382517b8) drop-shadow(2px 4px 1px #170d09a6) drop-shadow(3px 6px 3px #0008);
}
.chess-screen .sq .pc.pw{
  color:#fff2d6;
  background:linear-gradient(115deg,#fffef3 8%,#e7d3aa 44%,#fff9e7 62%,#b9a17c 100%);
  -webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;
  -webkit-text-stroke:.7px #80694c;
  text-shadow:1px 1px 0 #fff6,-1px -1px 0 #fff7;
}
.chess-screen .sq .pc.pb{
  color:#241b18;
  background:linear-gradient(115deg,#746153 0%,#211b1b 40%,#5c4b40 58%,#120e0c 100%);
  -webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;
  -webkit-text-stroke:.7px #0e0b0a;
  text-shadow:-1px -1px 0 #fff3;
}
.chess-screen .sq.sel .pc{transform:translateY(-9%) scale(1.09);filter:drop-shadow(0 4px 5px #0007)}
.chess-screen .co{z-index:3}
.chess-screen .cbar{background:#1b130fb8;border-color:#ad865744}
.chess-screen .cbar.on{border-color:#f4c64a}
.chess-screen .ccap .pc{background:none!important;-webkit-text-fill-color:currentColor!important;text-shadow:none;transform:none;filter:none}
@media(max-width:400px){
  .chess-screen .cframe{padding:7px;gap:7px}
  .chess-screen .board{border-width:5px}
  .chess-screen .sq .pc{font-size:clamp(25px,9vw,38px)}
}
@media(prefers-reduced-motion:reduce){
  .chess-screen .sq .pc{transition:none}
}

/* Deuxième passe : repères tactiles, lumière et accessibilité sans toucher au moteur. */
.chess-screen .board {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.chess-screen .sq {
  transition: filter .14s ease, box-shadow .14s ease;
}
.chess-screen .sq.sel {
  box-shadow: inset 0 0 0 3px #f4ca62, inset 0 0 18px #ffdf725c;
}
.chess-screen .sq.tg:not(:has(.pc))::after {
  content: "";
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: #2c734a99;
  box-shadow: 0 0 0 3px #f7e5b35e;
  pointer-events: none;
  z-index: 1;
}
.chess-screen .sq.tg:has(.pc) {
  box-shadow: inset 0 0 0 3px #3e925f;
}
.chess-screen .sq .pc {
  user-select: none;
  -webkit-user-select: none;
  transform-origin: 50% 85%;
  will-change: transform;
}
.chess-screen .sq.sel .pc {
  transform: translateY(-10%) scale(1.12) perspective(180px) rotateX(4deg);
}
.chess-screen .sq:focus-visible {
  outline: 3px solid #ffe48a;
  outline-offset: -3px;
  z-index: 5;
}
@media (hover:hover) and (pointer:fine) {
  .chess-screen .sq:has(.pc):hover .pc {
    transform: translateY(-7%) scale(1.06);
  }
}
@media (prefers-reduced-motion:reduce) {
  .chess-screen .sq, .chess-screen .sq .pc { transition: none; }
}
