/* Dominó de Boteco: estilos só deste jogo (prefixo .domino-) */

/* palco: mesa mais larga que alta no computador; em pé no celular */
.stage[data-game='domino'] {
  aspect-ratio: 6 / 5;
}
.match:has(.stage[data-game='domino']) {
  --board-w: min(760px, 96vw, calc((100svh - 190px) * 6 / 5));
}
.match:has(.stage[data-game='domino']) .duel {
  width: min(var(--board-w), 700px);
}
@media (max-aspect-ratio: 4 / 5) {
  .stage[data-game='domino'] {
    aspect-ratio: 3 / 4.6;
  }
  .match:has(.stage[data-game='domino']) {
    --board-w: min(100vw, calc((100svh - 170px) * 3 / 4.6));
  }
}

/* ---------- mesa de feltro escuro com borda dourada ---------- */
.domino-root {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 24px;
  isolation: isolate;
  container-type: size;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(120, 255, 190, 0.07), transparent 58%),
    repeating-radial-gradient(circle at 23% 31%, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
    repeating-radial-gradient(circle at 71% 64%, rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 50% 50%, #134632 0%, #0b2d21 52%, #051710 100%);
  box-shadow:
    inset 0 0 0 2px #f5c22b,
    inset 0 0 0 5px #1b1209,
    inset 0 0 0 6.5px rgba(245, 194, 43, 0.55),
    inset 0 0 70px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 26px 50px -22px rgba(0, 0, 0, 0.95);
}
/* brilho do lado de quem está na vez (embaixo = você; em cima = o outro) */
.domino-root::before,
.domino-root::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 32%;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s;
}
.domino-root::before {
  bottom: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(245, 194, 43, 0.24), transparent 70%);
}
.domino-root::after {
  top: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(246, 240, 230, 0.13), transparent 70%);
}
.domino-root.turn-me::before {
  opacity: 1;
}
.domino-root.turn-opp::after {
  opacity: 1;
}

.domino-mark {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 0;
  transform: translate(-50%, -50%) rotate(-7deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  color: #f5c22b;
  opacity: 0.085;
}
.domino-mark span {
  font: 400 clamp(40px, 17cqi, 128px)/1 var(--tag);
}
.domino-mark small {
  margin-top: 6px;
  font: 700 clamp(9px, 2cqi, 13px)/1 var(--mono);
  letter-spacing: 0.4em;
  text-transform: uppercase;
}

.domino-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* ---------- pedra: marfim com pintas pretas; carroça com friso dourado; costas laqueadas ---------- */
.domino-tile {
  position: absolute;
  left: 0;
  top: 0;
  width: 60px;
  height: 120px;
  transform-origin: 50% 50%;
  transition:
    transform 0.52s cubic-bezier(0.2, 0.75, 0.25, 1),
    opacity 0.35s;
  perspective: 520px;
  will-change: transform;
  touch-action: none;
}
.domino-instant,
.domino-instant * {
  transition: none !important;
}
.domino-lift {
  position: absolute;
  inset: 0;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.domino-flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.3, 0.7, 0.3, 1);
}
.domino-tile.down .domino-flip {
  transform: rotateY(180deg);
}
.domino-front,
.domino-back {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.domino-front {
  background:
    radial-gradient(ellipse at 30% 16%, rgba(255, 255, 255, 0.9) 0%, transparent 52%),
    linear-gradient(160deg, #fcf7ea 0%, #f1e6cf 55%, #dccaa5 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(150, 118, 76, 0.5),
    inset 0 0 0 4px rgba(255, 255, 255, 0.35),
    inset 0 0 12px rgba(120, 88, 50, 0.28),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 0 9px 1px rgba(0, 0, 0, 0.55),
    var(--domino-ring, 0 0 0 0 transparent);
  transition:
    box-shadow 0.25s,
    filter 0.25s;
}
.domino-tile.is-double .domino-front {
  background:
    radial-gradient(ellipse at 30% 16%, rgba(255, 255, 255, 0.9) 0%, transparent 52%),
    linear-gradient(160deg, #fff8e6 0%, #f4e6c8 55%, #ddc69a 100%);
}
.domino-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 1.4px 0 rgba(255, 255, 255, 0.75));
}
.domino-pip {
  fill: #17110b;
  stroke: rgba(0, 0, 0, 0.5);
  stroke-width: 1.2;
}
.domino-div {
  stroke: #3a2d20;
  stroke-width: 2.6;
  stroke-linecap: round;
}
.domino-div-hi {
  stroke: rgba(255, 255, 255, 0.8);
  stroke-width: 1.3;
  stroke-linecap: round;
}
.domino-friso {
  fill: none;
  stroke: #d9a514;
  stroke-width: 3.6;
}
.domino-pino {
  fill: #f0c24a;
  stroke: #8a6210;
  stroke-width: 1.2;
}
.domino-back {
  transform: rotateY(180deg);
  background:
    repeating-linear-gradient(45deg, rgba(245, 194, 43, 0.07) 0 4px, transparent 4px 10px),
    linear-gradient(160deg, #2c1e12, #120c07 70%);
  box-shadow:
    inset 0 0 0 2.5px #c8961c,
    inset 0 0 0 5px #120c07,
    inset 0 0 0 6px rgba(245, 194, 43, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 9px 1px rgba(0, 0, 0, 0.55);
}
.domino-back::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(45deg);
  background: linear-gradient(135deg, #ffe27a, #f5c22b 50%, #9a6a00);
  box-shadow:
    0 0 0 3px #120c07,
    0 0 0 4.5px rgba(245, 194, 43, 0.55);
}

/* minha mão: as que encaixam sobem; a escolhida sobe mais; as que não servem apagam na minha vez */
.domino-tile.mine {
  cursor: pointer;
}
.domino-tile.playable .domino-lift {
  transform: translateY(-11%);
}
.domino-tile.playable {
  --domino-ring: 0 0 0 2px rgba(245, 194, 43, 0.9), 0 0 16px 2px rgba(245, 194, 43, 0.45);
}
.domino-tile.selected .domino-lift {
  transform: translateY(-22%) scale(1.05);
}
.domino-tile.selected {
  --domino-ring: 0 0 0 3px #f5c22b, 0 0 26px 5px rgba(245, 194, 43, 0.75);
}
.domino-root.turn-me .domino-tile.mine:not(.playable) .domino-front {
  filter: brightness(0.7) saturate(0.8);
}
.domino-tile.last {
  --domino-ring: 0 0 0 3px var(--lastc, #f5c22b), 0 0 20px 3px var(--lastc, #f5c22b);
}
.domino-tile.nope .domino-lift {
  animation: domino-nope 0.38s;
}
@keyframes domino-nope {
  20% {
    transform: translateX(-9%) rotate(-4deg);
  }
  40% {
    transform: translateX(8%) rotate(3deg);
  }
  60% {
    transform: translateX(-5%);
  }
  80% {
    transform: translateX(3%);
  }
}
.domino-tile.domino-dragging {
  transition: none;
  cursor: grabbing;
}
.domino-tile.domino-dragging .domino-front {
  box-shadow:
    0 0 0 3px #f5c22b,
    0 18px 30px rgba(0, 0, 0, 0.65);
}
.domino-tile.domino-gone {
  opacity: 0;
}

/* lugar da pedra escolhida em cada ponta (toque para jogar ali) */
.domino-ghost {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 400;
  width: 60px;
  height: 120px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  transform-origin: 50% 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: rgba(245, 194, 43, 0.12);
  box-shadow: inset 0 0 0 4px rgba(245, 194, 43, 0.9);
  animation: domino-ghost 0.9s ease-in-out infinite alternate;
}
.domino-ghost::before {
  content: '';
  position: absolute;
  inset: -28% -45%;
} /* alvo de toque maior que a pedra */
.domino-ghost span {
  font: 400 46px/1 var(--display);
  color: #ffe27a;
  transform: rotate(var(--counter, 0deg));
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
@keyframes domino-ghost {
  from {
    background: rgba(245, 194, 43, 0.08);
  }
  to {
    background: rgba(245, 194, 43, 0.32);
    box-shadow:
      inset 0 0 0 4px #ffe27a,
      0 0 24px rgba(245, 194, 43, 0.65);
  }
}

/* ---------- monte, mão do outro, placar de mãos ---------- */
.domino-pile-badge {
  position: absolute;
  z-index: 30;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}
.domino-pile-badge b {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font: 800 13px/1 var(--mono);
  color: #241600;
  background: linear-gradient(180deg, #ffe27a, #f5c22b 60%, #d99a0b);
  box-shadow:
    0 2px 0 #7d5200,
    0 4px 10px rgba(0, 0, 0, 0.5);
  transition: background 0.3s;
}
.domino-pile-badge span {
  font: 700 9px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(246, 240, 230, 0.72);
  text-shadow: 0 1px 2px #000;
}
.domino-pile-badge.empty b {
  background: #3a342d;
  color: #b3a99c;
  box-shadow: none;
}
.domino-pile-badge.must {
  pointer-events: auto;
  cursor: pointer;
}
.domino-pile-badge.must b {
  animation: domino-pulse 0.8s ease-in-out infinite alternate;
}
@keyframes domino-pulse {
  to {
    transform: scale(1.18);
    box-shadow:
      0 2px 0 #7d5200,
      0 0 18px rgba(245, 194, 43, 0.9);
  }
}

.domino-opp-badge {
  position: absolute;
  z-index: 30;
  transform: translate(-50%, -50%);
  height: 18px;
  padding: 0 8px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #f6f0e6;
  background: rgba(8, 6, 4, 0.78);
  box-shadow: inset 0 0 0 1px rgba(245, 194, 43, 0.45);
  pointer-events: none;
}
.domino-opp-badge[hidden] {
  display: none;
}

.domino-hud {
  position: absolute;
  z-index: 20;
  top: 3.4%;
  right: 4%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  pointer-events: none;
  text-align: right;
}
.domino-hud-hand {
  font: 400 clamp(16px, 4.2cqi, 26px)/1 var(--display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffe27a;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}
.domino-hud small {
  font: 700 9px/1.2 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(246, 240, 230, 0.6);
}
.domino-hud-chips {
  display: flex;
  gap: 3px;
  margin-top: 3px;
}
.domino-chip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 800 10px/1 var(--font);
  font-style: normal;
  color: #241600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.domino-chip.p1 {
  background: radial-gradient(circle at 38% 30%, #ff6a78, #e3192f 45%, #8f0d1c);
  color: #fff;
}
.domino-chip.p2 {
  background: radial-gradient(circle at 38% 30%, #fff3b8, #f5c22b 40%, #9a6a00);
}
.domino-chip.tie {
  background: #3a342d;
  color: #b3a99c;
}

.domino-pts {
  position: absolute;
  left: 50%;
  z-index: 30;
  transform: translate(-50%, -50%) scale(0.9);
  padding: 4px 10px;
  border-radius: 99px;
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(246, 240, 230, 0.78);
  background: rgba(5, 12, 9, 0.6);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s,
    transform 0.3s;
}
.domino-pts.on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.domino-pts.reveal {
  font-size: 13px;
  font-weight: 800;
  color: #241600;
  background: linear-gradient(180deg, #ffe27a, #f5c22b);
  box-shadow: 0 3px 0 #7d5200;
}

/* ---------- avisos, resultado da mão, botões obrigatórios ---------- */
.domino-say {
  position: absolute;
  left: 50%;
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 8px 15px;
  border-radius: 99px;
  transform: translate(-50%, 6px);
  text-align: center;
  font: 800 14px/1.25 var(--font);
  color: #f6f0e6;
  background: rgba(8, 6, 4, 0.84);
  box-shadow:
    inset 0 0 0 1px rgba(245, 194, 43, 0.38),
    0 8px 20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.25s;
}
.domino-say.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.domino-say.top {
  top: 21%;
}
.domino-say.mid {
  top: 44%;
}
.domino-say.bottom {
  bottom: 29%;
}

.domino-banner {
  position: absolute;
  left: 50%;
  top: 47%;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 28px 13px;
  border-radius: 16px;
  text-align: center;
  transform: translate(-50%, -50%) scale(0.7);
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(22, 15, 8, 0.94), rgba(8, 6, 4, 0.94));
  box-shadow:
    inset 0 0 0 1.5px rgba(245, 194, 43, 0.75),
    0 22px 50px rgba(0, 0, 0, 0.75);
  transition:
    opacity 0.25s,
    transform 0.4s var(--ease-back);
}
.domino-banner.on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.domino-banner b {
  font: 400 clamp(36px, 11cqi, 68px)/0.95 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #ffe27a, #f5c22b 55%, #d99a0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #7d5200);
}
.domino-banner.opp b {
  background-image: linear-gradient(180deg, #ff9aa4, #e3192f 60%, #8f0d1c);
  filter: drop-shadow(0 3px 0 #4a0710);
}
.domino-banner.tie b {
  background-image: linear-gradient(180deg, #f6f0e6, #b3a99c);
  filter: drop-shadow(0 3px 0 #2a2520);
}
.domino-banner span {
  font: 800 15px/1.2 var(--font);
  color: #f6f0e6;
}
.domino-banner small {
  font: 700 12px/1.2 var(--mono);
  color: rgba(246, 240, 230, 0.72);
}

.domino-actions {
  position: absolute;
  left: 50%;
  z-index: 70;
  transform: translate(-50%, -100%);
  display: flex;
  gap: 8px;
}
.domino-btn {
  min-height: 46px;
  padding: 8px 20px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font: 400 21px/1 var(--display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #241600;
  background: linear-gradient(180deg, #ffe27a, #f5c22b 55%, #d99a0b);
  box-shadow:
    0 4px 0 #7d5200,
    0 12px 24px -6px rgba(0, 0, 0, 0.75);
  animation: domino-pop 0.32s var(--ease-back);
}
.domino-btn small {
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: none;
}
.domino-btn[hidden] {
  display: none;
}
.domino-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #7d5200;
}
.domino-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.domino-btn-pass {
  color: #fff;
  background: linear-gradient(180deg, #ff6a78, #e3192f 55%, #8f0d1c);
  box-shadow:
    0 4px 0 #4a0710,
    0 12px 24px -6px rgba(0, 0, 0, 0.75);
}
@keyframes domino-pop {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
}

@media (max-width: 480px) {
  .domino-say {
    font-size: 13px;
  }
  .domino-banner {
    padding: 12px 18px 11px;
  }
  .domino-banner span {
    font-size: 14px;
  }
  .domino-btn {
    font-size: 19px;
    padding: 8px 16px;
  }
}

/* ---------- mesa de 4 (duplas): etiqueta de cada jogador e brilho da vez nas laterais ---------- */
.domino-pile-badge[hidden] {
  display: none;
}
.domino-seat {
  position: absolute;
  z-index: 32;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 46%;
  height: 22px;
  padding: 0 9px 0 6px;
  border-radius: 99px;
  white-space: nowrap;
  pointer-events: none;
  color: #f6f0e6;
  background: rgba(8, 6, 4, 0.84);
  box-shadow:
    inset 0 0 0 1.5px color-mix(in srgb, var(--team, #f5c22b), transparent 35%),
    0 4px 10px rgba(0, 0, 0, 0.45);
  transition:
    box-shadow 0.25s,
    opacity 0.25s,
    transform 0.25s;
}
.domino-seat-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--team, #f5c22b);
  box-shadow: 0 0 6px var(--team, #f5c22b);
}
.domino-seat b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font: 800 11px/1 var(--font);
}
.domino-seat span {
  flex: none;
  font: 700 10px/1 var(--mono);
  color: rgba(246, 240, 230, 0.72);
}
.domino-seat.mate::after {
  content: 'parceiro';
  flex: none;
  font: 700 8px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--team, #f5c22b);
}
.domino-seat.turn {
  box-shadow:
    inset 0 0 0 2px #ffe27a,
    0 0 16px rgba(245, 194, 43, 0.7);
  transform: translate(-50%, -50%) scale(1.08);
}
.domino-seat.out {
  opacity: 0.6;
}
.domino-seat.out span {
  color: #ff8a8a;
  text-transform: uppercase;
}
/* nas laterais a etiqueta é estreita (duas linhas), para não cobrir a fileira */
.domino-seat:is([data-pos='left'], [data-pos='right']) {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  height: auto;
  max-width: 74px;
  padding: 4px 7px;
  border-radius: 10px;
  text-align: center;
}
.domino-seat:is([data-pos='left'], [data-pos='right']) .domino-seat-dot {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 7px;
  height: 7px;
  transform: translateX(-50%);
}
.domino-seat:is([data-pos='left'], [data-pos='right']) b {
  font-size: 10px;
}
.domino-seat:is([data-pos='left'], [data-pos='right']) span {
  font-size: 9px;
}
.domino-glow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s;
}
.domino-glow-l {
  left: 0;
  background: radial-gradient(ellipse at 0% 50%, rgba(246, 240, 230, 0.13), transparent 70%);
}
.domino-glow-r {
  right: 0;
  background: radial-gradient(ellipse at 100% 50%, rgba(246, 240, 230, 0.13), transparent 70%);
}
.domino-glow.on {
  opacity: 1;
}
@media (max-width: 480px) {
  .domino-seat {
    height: 20px;
    padding: 0 7px 0 5px;
    gap: 4px;
  }
  .domino-seat b {
    font-size: 10px;
  }
  .domino-seat.mate::after {
    display: none;
  }
}

/* ---------- pôster do catálogo ---------- */
.domino-poster {
  position: absolute;
  left: 50%;
  top: 35%;
  width: 96cqi;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.6));
}
@media (max-width: 640px) {
  .domino-poster {
    top: 28%;
    width: 56cqi;
  }
}

@media (prefers-reduced-motion: reduce) {
  .domino-tile,
  .domino-lift,
  .domino-flip {
    transition-duration: 0.01s !important;
  }
  .domino-ghost,
  .domino-pile-badge.must b {
    animation: none;
  }
}
