/* Dama de Praça: estilos só deste jogo (prefixo .dama-) */

/* ---------------------------------------------------------------- palco: placar em cima, tabuleiro, placar embaixo */
.dama-root {
  position: absolute;
  inset: 0;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  --dm-red: #e3192f;
  --dm-red-hi: #ff7d8b;
  --dm-red-deep: #8f0d1c;
  --dm-red-edge: #4f0510;
  --dm-gold: #f5c22b;
  --dm-gold-hi: #fff2b8;
  --dm-gold-deep: #a87200;
  --dm-gold-edge: #5e3f00;
}

/* ---------------------------------------------------------------- tabuleiro: couro escuro, casas de madeira e couro, filete dourado */
.dama-board {
  position: relative;
  flex: none;
  width: 100cqw;
  height: 100cqw;
  padding: 3.6cqw;
  border-radius: 2.4cqw;
  background:
    radial-gradient(120% 90% at 30% 10%, rgba(255, 220, 160, 0.07), transparent 60%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.018) 0 0.25cqw, transparent 0.25cqw 1.1cqw),
    linear-gradient(160deg, #2a170c, #170c06 55%, #0f0804);
  box-shadow:
    inset 0 0 0 0.3cqw var(--dm-gold),
    inset 0 0 0 0.55cqw #5a3a10,
    inset 0 0 0 0.7cqw rgba(0, 0, 0, 0.6),
    inset 0 0.5cqw 1.4cqw rgba(255, 230, 180, 0.08),
    0 2.2cqw 4.5cqw -1cqw rgba(0, 0, 0, 0.75);
}
.dama-field {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 0.35cqw;
  box-shadow:
    0 0 0 0.4cqw var(--dm-gold),
    0 0 0 0.7cqw #1b0f07,
    0 0 0 0.85cqw rgba(245, 194, 43, 0.35),
    0 0.6cqw 2cqw rgba(0, 0, 0, 0.7);
}
.dama-root.can-play .dama-field {
  touch-action: none;
  cursor: pointer;
}
.dama-stud {
  position: absolute;
  width: 2.2cqw;
  height: 2.2cqw;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6cc, var(--dm-gold) 45%, var(--dm-gold-deep));
  box-shadow:
    0 0.25cqw 0.4cqw rgba(0, 0, 0, 0.7),
    inset 0 -0.2cqw 0 rgba(0, 0, 0, 0.25);
}
.dama-stud.s1 {
  left: 0.7cqw;
  top: 0.7cqw;
}
.dama-stud.s2 {
  right: 0.7cqw;
  top: 0.7cqw;
}
.dama-stud.s3 {
  left: 0.7cqw;
  bottom: 0.7cqw;
}
.dama-stud.s4 {
  right: 0.7cqw;
  bottom: 0.7cqw;
}
.dama-files,
.dama-ranks {
  position: absolute;
  display: flex;
  font-family: var(--mono);
  font-weight: 700;
  font-size: max(7px, 1.8cqw);
  color: rgba(245, 194, 43, 0.62);
  text-transform: lowercase;
  pointer-events: none;
}
.dama-files {
  left: 3.6cqw;
  right: 3.6cqw;
  bottom: 0.1cqw;
  height: 3.4cqw;
}
.dama-ranks {
  top: 3.6cqw;
  bottom: 3.6cqw;
  left: 0.2cqw;
  width: 3.4cqw;
  flex-direction: column;
}
.dama-files span,
.dama-ranks span {
  flex: 1;
  display: grid;
  place-items: center;
}

.dama-sq {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
}
.dama-sq.light {
  background:
    repeating-linear-gradient(
      var(--a, 96deg),
      rgba(110, 62, 18, 0.1) 0 0.28cqw,
      transparent 0.28cqw 0.9cqw,
      rgba(110, 62, 18, 0.06) 0.9cqw 1.05cqw,
      transparent 1.05cqw 2.1cqw
    ),
    radial-gradient(140% 90% at var(--g, 50%) 40%, #ecd3a2, #d6b077 70%, #c49a5e);
}
.dama-sq.dark {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 210, 150, 0.07), transparent 55%),
    repeating-radial-gradient(circle at var(--g, 40%) 60%, rgba(0, 0, 0, 0.14) 0 0.12cqw, transparent 0.12cqw 0.5cqw),
    linear-gradient(140deg, #4a2b18, #2c180c 60%, #1f1108);
  box-shadow:
    inset 0 0 0 0.08cqw rgba(0, 0, 0, 0.5),
    inset 0 0 1.4cqw rgba(0, 0, 0, 0.35);
}
/* última jogada: saída e chegada em dourado; onde estavam as capturadas, um × apagado */
.dama-sq.is-last {
  box-shadow:
    inset 0 0 0 0.45cqw rgba(245, 194, 43, 0.6),
    inset 0 0 2.2cqw rgba(245, 194, 43, 0.28);
}
.dama-sq.is-lastcap::before {
  content: '×';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font);
  font-weight: 900;
  font-size: 7cqw;
  line-height: 1;
  color: rgba(227, 25, 47, 0.55);
  text-shadow: 0 0 1.2cqw rgba(0, 0, 0, 0.6);
}
/* destinos legais da peça escolhida */
.dama-sq.is-dest::after {
  content: '';
  position: absolute;
  inset: 37%;
  border-radius: 50%;
  z-index: 1;
  background: radial-gradient(circle at 40% 35%, #fff4c4, var(--dm-gold) 55%, var(--dm-gold-deep));
  box-shadow:
    0 0 1.6cqw rgba(245, 194, 43, 0.85),
    0 0.2cqw 0.4cqw rgba(0, 0, 0, 0.5);
  animation: dama-dot 1.1s ease-in-out infinite alternate;
}
.dama-sq.is-dest.is-cap::after {
  inset: 12%;
  background: radial-gradient(circle, rgba(227, 25, 47, 0.28), transparent 66%);
  border: 0.55cqw solid #ff4256;
  box-shadow:
    0 0 2cqw rgba(227, 25, 47, 0.85),
    inset 0 0 1.4cqw rgba(227, 25, 47, 0.55);
}
.dama-sq.is-dest[data-n]::before {
  content: attr(data-n);
  position: absolute;
  right: 4%;
  top: 4%;
  z-index: 2;
  padding: 0.3cqw 0.8cqw;
  border-radius: 99px;
  font-family: var(--font);
  font-weight: 900;
  font-size: max(9px, 2.1cqw);
  line-height: 1.1;
  color: #fff;
  background: var(--dm-red);
  box-shadow: 0 0.2cqw 0 var(--dm-red-deep);
}
.dama-sq.is-hover::after {
  animation: none;
  transform: scale(1.18);
}
.dama-sq.is-step::after {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  z-index: 1;
  border: 0.5cqw dashed var(--dm-gold-hi);
  box-shadow: 0 0 1.6cqw rgba(255, 226, 122, 0.75);
  animation: dama-spin 3s linear infinite;
}
@keyframes dama-dot {
  from {
    transform: scale(0.82);
    opacity: 0.8;
  }
  to {
    transform: scale(1.08);
    opacity: 1;
  }
}
@keyframes dama-spin {
  to {
    transform: rotate(360deg);
  }
}

/* caminho da última jogada e prévia do caminho escolhido */
.dama-trail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}
.dama-trail .lm {
  fill: none;
  stroke: rgba(245, 194, 43, 0.55);
  stroke-width: 0.07;
  stroke-dasharray: 0.16 0.12;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dama-trail .lm-end {
  fill: rgba(245, 194, 43, 0.5);
}
.dama-trail .pv {
  fill: none;
  stroke: #fff2b8;
  stroke-width: 0.09;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 0.08px rgba(245, 194, 43, 0.9));
  opacity: 0.9;
}
.dama-trail .pv-end {
  fill: #fff2b8;
}

/* ---------------------------------------------------------------- peças: pedra com relevo (anéis), dama empilhada com coroa */
.dama-pieces {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.dama-pc {
  position: absolute;
  left: 0;
  top: 0;
  width: 12.5%;
  height: 12.5%;
  will-change: transform;
}
.dama-pc.is-moving {
  z-index: 5;
}
.dama-pc.is-drag {
  z-index: 6;
}
.dama-disc {
  position: absolute;
  inset: 9% 9% 13%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition:
    transform 0.18s var(--ease-out),
    filter 0.25s,
    opacity 0.25s;
}
.dama-disc::before {
  /* anel de borda em baixo-relevo */
  content: '';
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  box-shadow:
    inset 0 0.35cqw 0.45cqw rgba(0, 0, 0, 0.42),
    0 0.18cqw 0 rgba(255, 255, 255, 0.22);
}
.dama-disc::after {
  /* frisos concêntricos no meio */
  content: '';
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(0, 0, 0, 0.16) 0 0.18cqw, transparent 0.18cqw 0.62cqw);
  box-shadow:
    0 0.14cqw 0 rgba(255, 255, 255, 0.16),
    inset 0 0.2cqw 0.3cqw rgba(0, 0, 0, 0.35);
}
.dama-pc.p1 .dama-disc {
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 190, 196, 0.85) 0 7%, transparent 28%),
    radial-gradient(circle at 50% 42%, #f6324a, var(--dm-red) 48%, #a80d20 76%, #6e0614);
  box-shadow:
    0 0.55cqw 0 var(--dm-red-edge),
    0 0.6cqw 0 0.08cqw rgba(0, 0, 0, 0.4),
    0 1.3cqw 1.3cqw rgba(0, 0, 0, 0.55),
    inset 0 -0.25cqw 0.3cqw rgba(0, 0, 0, 0.3);
}
.dama-pc.p2 .dama-disc {
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 240, 0.95) 0 8%, transparent 30%),
    radial-gradient(circle at 50% 42%, #ffe27a, var(--dm-gold) 46%, #cf9606 74%, #8a5d00);
  box-shadow:
    0 0.55cqw 0 var(--dm-gold-edge),
    0 0.6cqw 0 0.08cqw rgba(0, 0, 0, 0.4),
    0 1.3cqw 1.3cqw rgba(0, 0, 0, 0.55),
    inset 0 -0.25cqw 0.3cqw rgba(0, 0, 0, 0.25);
}
/* dama: duas pedras empilhadas (sobe um pouco) com a coroa por cima */
.dama-pc.king .dama-disc {
  transform: translateY(-0.55cqw);
}
.dama-pc.p1.king .dama-disc {
  box-shadow:
    0 0.5cqw 0 var(--dm-red-edge),
    0 0.62cqw 0 #c3142a,
    0 1.1cqw 0 var(--dm-red-edge),
    0 1.9cqw 1.4cqw rgba(0, 0, 0, 0.6);
}
.dama-pc.p2.king .dama-disc {
  box-shadow:
    0 0.5cqw 0 var(--dm-gold-edge),
    0 0.62cqw 0 #d9a10e,
    0 1.1cqw 0 var(--dm-gold-edge),
    0 1.9cqw 1.4cqw rgba(0, 0, 0, 0.6);
}
.dama-crown {
  position: relative;
  z-index: 1;
  width: 58%;
  height: 58%;
  filter: drop-shadow(0 0.25cqw 0.2cqw rgba(0, 0, 0, 0.55));
}
.dama-pc.p1 .dama-crown .c-body,
.dama-pc.p1 .dama-crown .c-base {
  fill: #ffd34d;
  stroke: #7d5200;
  stroke-width: 1;
  stroke-linejoin: round;
}
.dama-pc.p1 .dama-crown .c-gem {
  fill: #fff3c0;
  stroke: #7d5200;
  stroke-width: 0.7;
}
.dama-pc.p2 .dama-crown .c-body,
.dama-pc.p2 .dama-crown .c-base {
  fill: var(--dm-red);
  stroke: #4f0510;
  stroke-width: 1;
  stroke-linejoin: round;
}
.dama-pc.p2 .dama-crown .c-gem {
  fill: #ffd34d;
  stroke: #4f0510;
  stroke-width: 0.7;
}
.dama-pc.is-crowned .dama-crown {
  animation: dama-crown 0.5s var(--ease-back);
}
@keyframes dama-crown {
  0% {
    transform: translateY(-60%) scale(1.8);
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: none;
  }
}

/* minhas peças que podem jogar; as que são OBRIGADAS a capturar pulsam em vermelho */
.dama-pc.is-movable:hover .dama-disc {
  transform: translateY(-0.5cqw);
}
.dama-pc.king.is-movable:hover .dama-disc {
  transform: translateY(-1cqw);
}
.dama-pc.is-must::after {
  content: '';
  position: absolute;
  inset: 1%;
  border-radius: 50%;
  pointer-events: none;
  border: 0.5cqw solid #ff3b50;
  box-shadow:
    0 0 1.8cqw rgba(227, 25, 47, 0.9),
    inset 0 0 1cqw rgba(227, 25, 47, 0.5);
  animation: dama-must 1s ease-in-out infinite;
}
@keyframes dama-must {
  50% {
    transform: scale(1.08);
    opacity: 0.55;
  }
}
.dama-pc.is-sel .dama-disc {
  transform: translateY(-1cqw) scale(1.07);
}
.dama-pc.king.is-sel .dama-disc {
  transform: translateY(-1.5cqw) scale(1.07);
}
.dama-pc.is-sel::before {
  content: '';
  position: absolute;
  inset: 3%;
  border-radius: 50%;
  pointer-events: none;
  box-shadow:
    0 0 0 0.45cqw var(--dm-gold-hi),
    0 0 2.6cqw 0.4cqw rgba(245, 194, 43, 0.85);
}
.dama-pc.is-drag .dama-disc {
  transform: translateY(-1cqw);
  filter: drop-shadow(0 1.6cqw 1cqw rgba(0, 0, 0, 0.55));
}
/* capturada no meio do lance: escurece; no fim do lance some */
.dama-pc.is-hit .dama-disc {
  filter: grayscale(0.55) brightness(0.62);
  transform: scale(0.94);
}
.dama-pc.is-gone .dama-disc {
  opacity: 0;
  transform: scale(0.25) rotate(35deg);
  transition:
    transform 0.32s var(--ease-out),
    opacity 0.3s;
}
.dama-pc.is-win .dama-disc {
  animation: dama-win 1.4s ease-in-out infinite;
}
.dama-pc.is-lost .dama-disc {
  filter: grayscale(0.5) brightness(0.6);
}
@keyframes dama-win {
  50% {
    filter: brightness(1.25) drop-shadow(0 0 1.6cqw rgba(255, 226, 122, 0.9));
  }
}

/* recado curto em cima do tabuleiro (jogada recusada, escolha de caminho) */
.dama-hint {
  position: absolute;
  left: 50%;
  top: 3%;
  z-index: 8;
  max-width: 94%;
  transform: translate(-50%, -0.8cqw);
  padding: 1.1cqw 2.6cqw;
  border-radius: 99px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 800;
  font-size: max(12px, 2.7cqw);
  color: var(--paper);
  background: rgba(14, 12, 11, 0.9);
  border: 1px solid rgba(245, 194, 43, 0.5);
  box-shadow: 0 1cqw 2.4cqw rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.25s var(--ease-out);
}
.dama-hint.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.dama-hint.bad {
  border-color: var(--dm-red);
  color: #ffc2c9;
}

/* ---------------------------------------------------------------- placar de peças (em cima o oponente, embaixo você) */
.dama-side {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 2cqw;
  padding: 0 1.2cqw;
}
.dama-tally {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 0.9cqw;
  min-width: 15cqw;
}
.dama-count {
  font-family: var(--display);
  font-weight: 400;
  font-size: max(18px, 5.2cqw);
  line-height: 1;
  color: var(--paper);
  transition: color 0.25s;
}
.dama-count.bump {
  animation: dama-bump 0.45s var(--ease-back);
}
@keyframes dama-bump {
  40% {
    transform: scale(1.3);
  }
}
.dama-count-label {
  font-size: max(9px, 2cqw);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}
.dama-side.on .dama-count {
  color: var(--gold-hi);
  text-shadow: 0 0 1.6cqw rgba(245, 194, 43, 0.55);
}
.dama-tray {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 0.6cqw;
  overflow: hidden;
}
.dama-tray i {
  position: relative;
  flex: none;
  width: 2.8cqw;
  height: 2.8cqw;
  border-radius: 50%;
  transition:
    background 0.3s,
    box-shadow 0.3s,
    opacity 0.3s;
}
.dama-tray i.off {
  box-shadow: inset 0 0 0 0.25cqw rgba(255, 240, 220, 0.16);
}
.dama-side.p1 .dama-tray i.on {
  background: radial-gradient(circle at 35% 30%, var(--dm-red-hi), var(--dm-red) 50%, var(--dm-red-deep));
  box-shadow: 0 0.25cqw 0 var(--dm-red-edge);
}
.dama-side.p2 .dama-tray i.on {
  background: radial-gradient(circle at 35% 30%, var(--dm-gold-hi), var(--dm-gold) 50%, var(--dm-gold-deep));
  box-shadow: 0 0.25cqw 0 var(--dm-gold-edge);
}
.dama-tray i.king::after {
  content: '';
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: #fff3c0;
  box-shadow: 0 0 0.6cqw rgba(255, 243, 192, 0.9);
}
.dama-side.p2 .dama-tray i.king::after {
  background: var(--dm-red);
  box-shadow: none;
}
.dama-chip {
  flex: none;
  margin-left: auto;
  padding: 0.8cqw 1.8cqw;
  border-radius: 99px;
  white-space: nowrap;
  font-weight: 900;
  font-size: max(10px, 2.2cqw);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dama-chip:empty {
  display: none;
}
.dama-chip.turn {
  color: #241600;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  box-shadow: 0 0.35cqw 0 var(--gold-deep);
}
.dama-chip.must {
  color: #fff;
  background: linear-gradient(180deg, #ff4a5d, var(--dm-red));
  box-shadow:
    0 0.35cqw 0 var(--dm-red-deep),
    0 0 2cqw rgba(227, 25, 47, 0.55);
  animation: dama-chip 1.2s ease-in-out infinite;
}
.dama-chip.note {
  color: var(--gold-hi);
  border: 1px solid rgba(245, 194, 43, 0.45);
  background: rgba(14, 12, 11, 0.55);
}
@keyframes dama-chip {
  50% {
    box-shadow:
      0 0.35cqw 0 var(--dm-red-deep),
      0 0 3.4cqw rgba(227, 25, 47, 0.9);
  }
}

/* ---------------------------------------------------------------- pôster do catálogo: tabuleiro de couro em perspectiva */
.dama-poster {
  position: absolute;
  left: 50%;
  top: 35%;
  width: 62cqi;
  aspect-ratio: 1;
  padding: 2.6cqi;
  border-radius: 2cqi;
  transform: translate(-50%, -50%) perspective(80cqi) rotateX(34deg) rotateZ(-9deg);
  background: linear-gradient(160deg, #2a170c, #120904);
  box-shadow:
    inset 0 0 0 0.5cqi var(--gold),
    inset 0 0 0 0.9cqi #4a2f0d,
    0 2.4cqi 0 #6b4400,
    0 3cqi 0 #2b1a05,
    0 6cqi 7cqi rgba(0, 0, 0, 0.7);
  transition: transform 0.4s var(--ease-out);
}
.dama-poster-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  box-shadow: 0 0 0 0.5cqi var(--gold);
}
.dama-poster-grid i {
  position: relative;
  background: linear-gradient(135deg, #e6c896, #c99e62);
}
.dama-poster-grid i.d {
  background: linear-gradient(135deg, #46291a, #24130a);
}
.dama-poster-grid b {
  position: absolute;
  inset: 7% 7% 13%;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.dama-poster-grid b.p1 {
  background: radial-gradient(circle at 35% 28%, #ff9aa5 0 8%, #e3192f 45%, #8f0d1c);
  box-shadow:
    0 0.6cqi 0 #4f0510,
    0 1cqi 0.8cqi rgba(0, 0, 0, 0.5);
}
.dama-poster-grid b.p2 {
  background: radial-gradient(circle at 35% 28%, #fff6d0 0 9%, #f5c22b 45%, #9a6a00);
  box-shadow:
    0 0.6cqi 0 #5e3f00,
    0 1cqi 0.8cqi rgba(0, 0, 0, 0.5);
}
.dama-poster-grid b.k {
  transform: translateY(-0.6cqi);
}
.dama-poster-grid b.p1.k {
  box-shadow:
    0 0.55cqi 0 #4f0510,
    0 0.7cqi 0 #c3142a,
    0 1.2cqi 0 #4f0510,
    0 1.8cqi 1cqi rgba(0, 0, 0, 0.55),
    0 0 3cqi rgba(255, 226, 122, 0.55);
}
.dama-poster-grid b.p2.k {
  box-shadow:
    0 0.55cqi 0 #5e3f00,
    0 0.7cqi 0 #d9a10e,
    0 1.2cqi 0 #5e3f00,
    0 1.8cqi 1cqi rgba(0, 0, 0, 0.55);
}
.dama-poster-grid .dama-crown {
  width: 62%;
  height: 62%;
  filter: none;
}
.dama-poster-grid b.p1 .c-body,
.dama-poster-grid b.p1 .c-base {
  fill: #ffd34d;
  stroke: #7d5200;
  stroke-width: 1;
}
.dama-poster-grid b.p1 .c-gem {
  fill: #fff3c0;
}
.dama-poster-grid b.p2 .c-body,
.dama-poster-grid b.p2 .c-base {
  fill: #e3192f;
  stroke: #4f0510;
  stroke-width: 1;
}
.dama-poster-grid b.p2 .c-gem {
  fill: #ffd34d;
}
@media (max-width: 640px) {
  .dama-poster {
    top: 30%;
    width: 42cqi;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dama-sq.is-dest::after,
  .dama-sq.is-step::after,
  .dama-pc.is-must::after,
  .dama-chip.must,
  .dama-pc.is-win .dama-disc {
    animation: none;
  }
}
