/* Dominó dos Amigos — visual próprio do jogo (o comum está em base.css).
   As medidas --dm-* da partida vêm de Logica.medidas (tela.js põe no palco). */
:root { --tema: #7cc35a; --tema-escuro: #4f9a35; --dm-pedra: #fffdf7; --dm-borda: #c9b79c; --dm-terra: #ecd3a0; --dm-l: 90px; }

/* ---------- a pedra ---------- */
.dm-pedra {
  display: flex; flex: 0 0 auto; background: var(--dm-pedra); border: 3px solid var(--dm-borda); border-radius: 16px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18); overflow: hidden;
}
.dm-lado { position: relative; flex: 1 1 50%; min-width: 0; min-height: 0; }
.dm-lado > * { position: absolute; inset: 7%; width: 86%; height: 86%; object-fit: contain; pointer-events: none; }
.dm-deitada { flex-direction: row; width: calc(var(--dm-l) * 2); height: var(--dm-l); }
.dm-deitada .dm-lado + .dm-lado { border-left: 3px solid var(--dm-borda); }
.dm-da-mao { flex-direction: column; width: var(--dm-mao-l); height: var(--dm-mao-a); position: relative; touch-action: none; cursor: grab; }
.dm-da-mao .dm-lado + .dm-lado { border-top: 3px solid var(--dm-borda); }
.dm-da-mao:focus-visible { outline: 4px solid var(--azul); outline-offset: 2px; }
.dm-da-mao.arrastando { z-index: 5; cursor: grabbing; box-shadow: 0 10px 12px rgba(0, 0, 0, 0.25); }
.dm-nova { animation: entra 0.3s ease-out; }
.dm-visita { opacity: 0.85; border-style: dashed; cursor: default; }

/* pedra virada para baixo */
.dm-costas {
  display: inline-block; width: 16px; height: 26px; border-radius: 5px; background: var(--tema-escuro);
  border: 2px solid var(--branco); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}
.dm-costas-grande { width: calc(var(--dm-monte, 96px) * 0.46); height: calc(var(--dm-monte, 96px) * 0.76); border-radius: 10px; border-width: 3px; }

/* pedrinhas da trilha e dos cartões */
.dm-passo { display: inline-block; width: 26px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, 0.4); border: 2px dashed var(--tema-escuro); }
.dm-passo.feito { background: var(--dm-pedra); border: 2px solid var(--dm-borda); }
.dm-galinheiro { display: block; height: 100%; width: auto; }

/* ---------- 1 e 2. os cartões de escolher ---------- */
.dm-menu, .dm-modo { gap: 14px; align-items: center; }
.dm-cartao {
  flex: 1 1 0; min-width: var(--alvo); height: 100%; max-height: 400px; border: 0; border-radius: var(--raio); padding: 10px;
  background: var(--branco); box-shadow: var(--sombra); display: flex; align-items: center; justify-content: center;
}
.dm-cartao:active { transform: translateY(3px); }
.dm-amostra { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.dm-amostra .dm-pedra { --dm-l: clamp(84px, 12vw, 150px); }
.dm-marcas { display: flex; gap: 8px; align-items: center; }
/* a cena de cada modo é medida em "u": 1/12,5 da largura do cartão (dois cartões lado a lado) */
.dm-cena { --u: min(calc((50vw - 92px) / 12.5), 9vh, 44px); display: flex; align-items: flex-end; justify-content: center; gap: calc(var(--u) * 0.3); height: calc(var(--u) * 4); }
.dm-cena img { height: 100%; width: auto; }
.dm-cena .dm-galinheiro { height: 75%; }
.dm-cena .dm-marcas { gap: calc(var(--u) * 0.15); margin-bottom: calc(var(--u) * 0.2); }
.dm-cena .dm-passo { width: calc(var(--u) * 0.6); height: calc(var(--u) * 0.4); }
.dm-crianca { font-size: calc(var(--u) * 2.2); line-height: 1.1; }
.dm-lado-a, .dm-lado-b { display: flex; align-items: flex-end; gap: calc(var(--u) * 0.2); height: 100%; }
.dm-versus { align-self: center; font-size: calc(var(--u) * 1.5); color: var(--azul); font-weight: bold; }
.dm-cena .dm-pilha { display: flex; gap: 3px; width: auto; min-height: 0; margin-bottom: calc(var(--u) * 0.2); }
.dm-cena .dm-costas { width: calc(var(--u) * 0.5); height: calc(var(--u) * 0.85); }

/* ---------- 3. a partida: a mesa em cima, a mão embaixo ---------- */
.dm-jogo { flex-direction: column; gap: 8px; }
.dm-mesa {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(#a9de8b, #8fd16f); border: 4px solid #6fb551; border-radius: var(--raio); padding: 4px 8px; overflow: hidden;
}
.dm-trilha { display: flex; align-items: center; gap: 6px; height: 26px; }
.dm-trilha-fim { height: 26px; }
.dm-caminho {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 10px;
  background: var(--dm-terra); border-radius: 18px; box-shadow: inset 0 0 0 3px #d9b877;
}
.dm-vaga {
  flex: 0 0 auto; width: calc(var(--dm-l) * 0.7); height: var(--dm-l); border: 4px dashed #b08a4a; border-radius: 14px;
  background: rgba(255, 255, 255, 0.4);
}
.dm-ponta { background: #fff3b8; box-shadow: inset 0 0 0 5px var(--amarelo); }
.dm-miolo { flex: 0 0 auto; width: calc(var(--dm-l) * 0.55); display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.dm-pedrinha { width: calc(var(--dm-l) * 0.16); height: calc(var(--dm-l) * 0.1); border-radius: 4px; background: var(--dm-pedra); border: 1px solid var(--dm-borda); }
.dm-anterior { opacity: 0.8; transform: scale(0.6); margin: 0 calc(var(--dm-l) * -0.4); }
.dm-chegada { flex: 0 0 auto; height: var(--dm-l); }

.dm-baixo { flex: 0 0 var(--dm-faixa); display: flex; align-items: center; gap: 6px; min-height: 0; min-width: 0; }
.dm-mao { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px; }
.dm-monte {
  flex: 0 0 var(--dm-monte); height: var(--dm-mao-a); border: 0; border-radius: var(--raio); padding: 0;
  background: #fff7dc; box-shadow: var(--sombra); display: grid; place-items: center;
}
.dm-monte:active { transform: translateY(3px); }
.dm-monte.dm-vazio { background: rgba(255, 253, 247, 0.55); box-shadow: none; outline: 3px dashed var(--dm-borda); outline-offset: -6px; }
.dm-pilha-monte { display: grid; place-items: center; }
.dm-pilha-monte .dm-costas { grid-area: 1 / 1; }
.dm-pilha-monte .dm-costas:nth-child(2) { transform: translate(7px, -6px); }
.dm-pilha-monte .dm-costas:nth-child(3) { transform: translate(14px, -12px); }
.dm-seta { width: 70%; height: auto; }
.dm-gemalino { flex: 0 1 var(--dm-gema); min-width: 0; overflow: hidden; height: var(--dm-mao-a); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.dm-gemalino.dm-sem-espaco { display: none; } /* tela estreita: melhor sumir que ficar minúsculo */
.dm-gemalino img { flex: 1 1 auto; min-height: 0; max-width: 100%; object-fit: contain; }
.dm-pilha { flex: 0 0 auto; display: flex; justify-content: center; gap: 2px; width: 100%; min-height: calc(var(--dm-gema) * 0.2 + 4px); }
.dm-gemalino .dm-costas { flex: 0 0 auto; width: calc(var(--dm-gema) * 0.11); height: calc(var(--dm-gema) * 0.2); }

/* brilho calmo: mostra para onde olhar, sem piscar rápido */
.dm-brilha { outline: 6px solid var(--amarelo); outline-offset: -3px; animation: dm-brilhar 1.3s ease-in-out 2; }
.dm-monte.dm-brilha, .dm-da-mao.dm-brilha { outline-offset: 2px; }
@keyframes dm-brilhar { 50% { background-color: #ffe27a; outline-color: #ffb300; } }

/* ---------- 4. o fim ---------- */
.dm-fim { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 0; }
.dm-fim-figuras { flex: 0 1 46%; min-height: 0; display: flex; align-items: flex-end; justify-content: center; gap: 1.5vw; max-height: 300px; }
.dm-fim-figuras img { width: auto; height: 100%; }
.dm-fim-figuras .dm-galinheiro { height: 95%; }
.dm-fim-figuras .dm-fim-galinha { height: 84%; }
.dm-fim-figuras .dm-fim-saltitao { height: 82%; }
.dm-fim-figuras .dm-fim-bia { height: 40%; }
.dm-fim-figuras .dm-fim-tobias { height: 60%; }
.dm-fim-baixo { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 3vw; max-width: 100%; }
.dm-fim-titulo { flex: 0 1 auto; min-width: 0; text-align: center; line-height: 1.1; margin: 0; font-size: clamp(30px, 5vw, 54px); color: var(--azul); text-shadow: 0 3px 0 #fff; }
.dm-fim-botoes { flex: 0 0 auto; display: flex; gap: 16px; }
.dm-outras svg { width: 70%; height: 70%; display: block; margin: auto; }

@media (max-height: 460px) {
  .dm-menu, .dm-modo { gap: 10px; }
  .dm-amostra { gap: 10px; }
  .dm-fim { gap: 8px; }
}

/* nome escrito em cada cartão de escolha (qualidade: toda escolha mostra o nome; o adulto lê, a criança ouve) */
.rotulo-escolha { display: block; max-width: 100%; font-weight: 700; font-size: clamp(12px, 1.5vw, 16px); line-height: 1.15;
  color: #1f3b57; text-align: center; pointer-events: none; overflow-wrap: anywhere; }
.dm-cartao { position: relative; }
.dm-cartao .rotulo-escolha { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 2; padding: 3px 6px; border-radius: 12px; background: rgba(255, 255, 255, 0.94); font-size: clamp(12px, 1.5vw, 16px); }
