/* Stockings obscure only the engraving. Counter art, rings and side geometry stay intact. */
body[data-fetish-stockings="1"] {
  --stockings-ink-fallback: #2c222e;
  --stockings-weave-shadow: repeating-linear-gradient(134deg, #100b168c 0 .7px, transparent .7px 2.8px);
  --stockings-weave-light: repeating-linear-gradient(44deg, #ffc8e435 0 .55px, transparent .55px 3.1px);
  --stockings-ink-gradient: linear-gradient(112deg,
    #211824 0%, #302431 25%, #79536c 40%, #bb859f 47%, #e7bbd0 50%,
    #a06e8c 54%, #503949 63%, #251c29 76%, #201722 100%);
}

body[data-fetish-stockings="1"] .board :is(.piece-label, .board-move-fx-label),
body[data-fetish-stockings="1"] :is(.switch-cheat-flight-piece, .revive-cheat-flight-piece,
  .advantage-reversal-missing-outline, .advantage-reversal-stolen-ghost,
  .advantage-reversal-revive-ghost) > span,
body[data-fetish-stockings="1"] .dead-piece-label {
  color: var(--stockings-ink-fallback) !important;
  background-image: var(--stockings-weave-shadow), var(--stockings-weave-light), var(--stockings-ink-gradient);
  background-position: center, center, 12% 42%;
  background-size: 100% 100%, 100% 100%, 235% 152%;
  background-repeat: no-repeat;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: clamp(.35px, .017em, .55px) #c99db586;
  text-shadow: none !important;
  opacity: .91;
}

body[data-fetish-stockings="1"] .board :is(.piece-label:not(.piece-name-corrupted), .board-move-fx-label),
body[data-fetish-stockings="1"] :is(.switch-cheat-flight-piece, .revive-cheat-flight-piece,
  .advantage-reversal-missing-outline, .advantage-reversal-stolen-ghost,
  .advantage-reversal-revive-ghost) > span,
body[data-fetish-stockings="1"] .dead-piece-label {
  animation: none;
}

.dead-piece-label { position: relative; z-index: 1; }



/* An unmarked pointer target keeps the same appearance as a resting square. */
.board.move-hints-hidden .cell:hover:not(:focus-visible, .selected, .last-from, .last-to,
  .checked-general, .checkmated-general, .checkmate-attacker, .switch-cheat-source, .switch-cheat-target,
  .revive-cheat-target, .advantage-reversal-stolen, .advantage-reversal-revived, .fatal-blunder-mistake) {
  background-color: transparent;
}

.is-move-slip .board-move-flight-carrier {
  animation: boardMoveSlip var(--board-move-duration) linear both;
}

.is-move-slip .board-move-flight-piece {
  animation: boardMoveSlipCounter var(--board-move-duration) ease-out both;
}

.board.move-slip-active {
  animation: boardMoveSlipShake 180ms ease-out both;
}

.board-move-slip-intent {
  position: absolute;
  left: var(--slip-x);
  top: var(--slip-y);
  width: 10.8%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border: 2px dashed #ffc5de;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #1f1238a6;
  z-index: 3;
  animation: boardMoveSlipIntent 800ms ease-out both;
}

.board-move-slip-track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  animation: boardMoveSlipTrack var(--board-move-duration) ease-out both;
}

.board-move-slip-track line {
  stroke: #ffacd6;
  stroke-width: .05;
  stroke-dasharray: .12 .1;
  stroke-linecap: round;
}

.is-move-slip .board-move-landing-cue {
  animation: boardMoveSlipLanding calc(var(--board-move-duration) + 80ms) ease-out both;
}

@keyframes boardMoveSlip {
  0% { transform: translate3d(0, 0, 0); animation-timing-function: cubic-bezier(.22, .65, .34, 1); }
  48%, 60% { transform: translate3d(var(--move-intended-dx), var(--move-intended-dy), 0); }
  60% { animation-timing-function: cubic-bezier(.36, .04, .36, 1); }
  86% { transform: translate3d(calc(var(--move-end-dx) * 1.02), calc(var(--move-end-dy) * 1.02), 0); }
  100% { transform: translate3d(var(--move-end-dx), var(--move-end-dy), 0); }
}

@keyframes boardMoveSlipCounter {
  0%, 100% { transform: scale(1); }
  28% { transform: translate(-3px, -1px) rotate(-4deg) scale(1.07); }
  34% { transform: translate(4px, -2px) rotate(5deg) scale(1.06); }
  42% { transform: translate(-4px, 2px) rotate(-5deg) scale(1.05); }
  50% { transform: translate(3px, -2px) rotate(4deg) scale(1.02); }
  58% { transform: translate(-2px, 1px) rotate(-3deg) scale(1.025); }
  72% { transform: scale(1.055); }
  90% { transform: scale(.98); }
}

@keyframes boardMoveSlipShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15% { transform: translate3d(2px, 1px, 0); }
  27% { transform: translate3d(-2px, -1px, 0); }
  43% { transform: translate3d(2px, -1px, 0); }
  60% { transform: translate3d(-1.5px, 1px, 0); }
  76% { transform: translate3d(1px, 0, 0); }
}

@keyframes boardMoveSlipIntent {
  0%, 44% { opacity: 0; }
  50%, 75% { opacity: .95; }
  100% { opacity: 0; }
}

@keyframes boardMoveSlipTrack {
  0%, 60%, 100% { opacity: 0; }
  73%, 87% { opacity: .85; }
}

@keyframes boardMoveSlipLanding {
  0%, 78% { opacity: 0; transform: scale(.9); }
  83% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0; transform: scale(1.25); }
}

@media (prefers-reduced-motion: reduce) {
  body[data-fetish-stockings="1"] .board :is(.piece-label:not(.piece-name-corrupted), .board-move-fx-label),
  body[data-fetish-stockings="1"] :is(.switch-cheat-flight-piece, .revive-cheat-flight-piece,
    .advantage-reversal-missing-outline, .advantage-reversal-stolen-ghost,
    .advantage-reversal-revive-ghost) > span,
  body[data-fetish-stockings="1"] .dead-piece-label {
    transition: none;
    animation: none !important;
    background-position: center, center, 63% 52%;
    opacity: .94;
  }

  .board.move-slip-active { animation: none; }
  .board.move-hints-hidden .cell.selected .piece-motion,
  body[data-vision-debuff="3"] .board.move-hints-hidden .piece-label,
  body[data-vision-debuff="3"] .board.move-hints-hidden .board-atmosphere-layer::before,
  body[data-vision-debuff="3"] .board.move-hints-hidden .board-atmosphere-layer::after {
    animation: none;
  }

  .board.move-slip-active .cell.board-move-arrival .piece-motion { opacity: 1; }
  .is-move-slip :is(.board-move-flight-carrier, .board-capture-exit-piece, .board-move-slip-track) { display: none; }
  .is-move-slip :is(.board-move-slip-intent, .board-move-landing-cue) {
    animation: none;
    opacity: .9;
  }
}

/* One pointer-transparent board fabric, including its two half-width equip folds. */
.fetish-board-fabric { position:absolute; inset:0; z-index:3; pointer-events:none; overflow:hidden; border-radius:inherit; }
.fetish-board-fabric[data-active="false"] { z-index:31; }
.fetish-board-fabric::before, .fetish-board-fabric::after { content:""; position:absolute; pointer-events:none; }
.fetish-board-fold {
  position:absolute; inset:0 50% 0 0; z-index:1; opacity:0;
  background:repeating-linear-gradient(42deg,#f2c9df55 0 1px,#35213455 1px 3px),linear-gradient(100deg,#653b58,#d8a6be);
}
.fetish-board-fold:nth-child(2) { inset:0 0 0 50%; }
.fetish-board-fabric[data-item="stockings"] {
  background:radial-gradient(ellipse,transparent 22%,#321e3322 67%,#1c101e44 100%),repeating-linear-gradient(40deg,#27182e30 0 .8px,transparent .8px 3px),repeating-linear-gradient(130deg,#e9bfdc28 0 .7px,transparent .7px 3px);
  transform:scale(calc(1 + var(--fx-breath,.5) * .02));
}
.fetish-board-fabric[data-item="stockings"]::before, .fetish-board-fabric[data-item="stockings"]::after {
  width:125%; height:38%; bottom:-15%; left:-15%;
  background:radial-gradient(ellipse,#d7becba8 0,#b4a3b968 25%,transparent 65%);
  transform:translate3d(calc(var(--fx-sway,0) * 8%),calc(var(--fx-rise,0) * -230%),0) rotate(-12deg);
  opacity:calc(.40 + var(--fx-breath,.5) * .18);
}
.fetish-board-fabric[data-item="stockings"]::after { left:0; bottom:18%; transform:translate3d(calc(var(--fx-sway,0) * -8%),calc(var(--fx-rise,0) * -160%),0) rotate(15deg); }
body[data-fetish-stockings="1"] .board .piece-label {
  background-position: center, center, 50% 52%;
  opacity:calc(1 - var(--fx-breath,.5) * .09);
  animation:none;
}
body[data-fetish-stockings="1"] .board:has(.fetish-board-fabric[data-sniff="true"]) .selected .piece-label {
  opacity:1; -webkit-text-stroke:.6px #f6d9e8;
}
/* Garment alpha supplies the obstruction; windows preserve ordinary engraving. */
body[data-vision-debuff="3"] .board[data-fabric-item="panties"] .piece-label:not(.piece-name-corrupted) {
  opacity:1; text-shadow:none; animation:none; transform:none;
}
/* Panties: only the garment itself covers the board; uncovered columns stay clear (no full-board haze). */
.fetish-board-fabric[data-item="panties"]::before { content:none; }
.board[data-fabric-item="panties"] .board-atmosphere-layer::before,
.board[data-fabric-item="panties"] .board-atmosphere-layer::after {
  content:none !important; animation:none !important;
}
.fetish-board-fabric[data-item="panties"]::after { content:none; }
/* Held garment crop with breathing width. */
.fetish-board-cloth {
  position:absolute; inset:0;
  --panties-image:url("../generated-assets/fetish-item/panties_mask.png");
  --panties-size:auto 104%;
  transform-origin:center;
  transform:scaleX(calc(1 + var(--fx-breath,0) * .06));
}
.fetish-board-cloth::before {
  content:""; position:absolute; inset:0; width:100%; height:100%;
  background:var(--panties-image) center / var(--panties-size) no-repeat;
  opacity:calc(.94 + var(--fx-breath,.5) * .04);
}
.fetish-board-fabric[data-static="true"] .fetish-board-cloth { transform:none; }
/* Wait above the board until the portrait mask is ready, then move one garment. */
.fetish-board-fabric[data-item="panties"] { transform-origin:50% 0; }
.fetish-board-fabric[data-item="panties"][data-motion="pending"] {
  transform:translate3d(0,-125%,0) rotate(0deg) scale(.85,1.2);
}
.fetish-board-marker {
  position:absolute; width:11.111111%; height:10%; z-index:2;
  border:2px solid #f0d489; box-shadow:inset 0 0 0 1px #32142b;
  box-sizing:border-box; pointer-events:none;
}
.fetish-board-marker[data-selected="true"] { border:3px solid #ff81c0; }
.fetish-board-fabric[data-item="bra"]::before {
  inset:-2%; background:radial-gradient(ellipse 48% 44% at 6% 0,#1d0b2db0 0,#5b295a99 30%,#ad6e9455 65%,transparent 100%),radial-gradient(ellipse 48% 44% at 94% 0,#1d0b2db0 0,#5b295a99 30%,#ad6e9455 65%,transparent 100%);
  transform:translate3d(calc(var(--fx-sway,0) * 1.5%),calc(var(--fx-breath,.5) * 1.1%),0);
}
.board[data-fabric-item="bra"] .selected .piece-motion { animation:fetish-hand-tremor 220ms linear infinite; }
@keyframes fetish-hand-tremor { 0%,100% {transform:translate(0,0)} 25% {transform:translate(1.6px,-1px)} 75% {transform:translate(-1.6px,1px)} }
.board[data-fx-paused="true"] *, .fetish-board-fabric[data-paused="true"] { animation-play-state:paused !important; }
@media (prefers-reduced-motion: reduce) {
  .fetish-board-fabric, .fetish-board-fabric::before, .fetish-board-fabric::after { transform:none !important; animation:none !important; }
  .board[data-fabric-item="bra"] .selected .piece-motion { animation:none; }
  .fetish-board-cloth { transform:none !important; }
}

/* Soften the traveling edge only; held and instant states have no mask. */
.fetish-board-fabric[data-item="panties"]:is([data-motion="wrapping"], [data-motion="removing"]) {
  -webkit-mask-image: linear-gradient(#000 0 85%, transparent 100%);
  mask-image: linear-gradient(#000 0 85%, transparent 100%);
  -webkit-mask-size: 100% 118%;
  mask-size: 100% 118%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 0 0;
  mask-position: 0 0;
}


/* The full garment shares the exact crop mapping at the instant hand-over. */
.fetish-board-full { position:absolute; display:none; max-width:none; transform-origin:center; opacity:calc(.94 + var(--fx-breath,.5) * .04); }
.fetish-board-fabric:is([data-motion="wrapping"],[data-motion="removing"]) .fetish-board-full { display:block; }

.fetish-board-fabric[data-motion="wrapping"] .fetish-board-cloth::before { animation:pantiesCropIn 1000ms linear both; }
.fetish-board-fabric[data-motion="removing"] .fetish-board-cloth::before { animation:pantiesCropOut 560ms linear both; }
.fetish-board-fabric[data-motion="wrapping"] .fetish-board-full { animation:pantiesFullIn 1000ms linear both; }
.fetish-board-fabric[data-motion="removing"] .fetish-board-full { animation:pantiesFullOut 560ms linear both; }
/* Composite once at fabric opacity, so the 40ms swap cannot reveal a glyph flash. */
.fetish-board-fabric:is([data-motion="wrapping"],[data-motion="removing"]) .fetish-board-cloth { opacity:calc(.94 + var(--fx-breath,.5) * .04); }
.fetish-board-fabric:is([data-motion="wrapping"],[data-motion="removing"]) .fetish-board-cloth::before { opacity:1; }
@keyframes pantiesCropIn { 0%,95.999% { visibility:hidden; } 96%,100% { visibility:visible; } }
@keyframes pantiesCropOut { 0%,7.142857% { visibility:visible; } 7.143%,100% { visibility:hidden; } }
@keyframes pantiesFullIn { 0%,96% { opacity:1; } 100% { opacity:0; } }
@keyframes pantiesFullOut { 0% { opacity:0; } 7.142857%,100% { opacity:1; } }

