/* Cartas da Fazenda — visual próprio do jogo (o comum está em base.css).
   As medidas em px (--cf-...) vêm de cartas.js e são refeitas quando a tela muda de tamanho. */
:root {
  --tema: #ef8f8a; --tema-escuro: #c9534d;
  --cf-morango: #e53935; --cf-gema: #f9a825; --cf-galinheiro: #3f86d0; --cf-grama: #43a047;
  --cf-folga: 6px;
}

/* ---------- a carta ---------- */
.cf-cor-morango { --cor-carta: var(--cf-morango); --cor-escura: #c62828; }
.cf-cor-gema { --cor-carta: var(--cf-gema); --cor-escura: #b86e00; }
.cf-cor-galinheiro { --cor-carta: var(--cf-galinheiro); --cor-escura: #1f5fa8; }
.cf-cor-grama { --cor-carta: var(--cf-grama); --cor-escura: #2e7d32; }

.cf-carta {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: var(--cf-l); height: var(--cf-a); padding: 0; overflow: hidden;
  border: max(3px, calc(var(--cf-l) * 0.07)) solid var(--cor-carta); border-radius: calc(var(--cf-l) * 0.16);
  background: var(--branco); color: var(--cor-carta); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}
.cf-carta svg { display: block; width: 100%; height: 100%; }
.cf-valor { font-size: calc(var(--cf-a) * 0.42); font-weight: 900; line-height: 1; color: var(--cor-escura); }
.cf-simbolo { height: calc(var(--cf-a) * 0.36); aspect-ratio: 1; }
.cf-canto { position: absolute; top: 3%; left: 4%; width: calc(var(--cf-l) * 0.22); aspect-ratio: 1; }
.cf-figura { height: calc(var(--cf-a) * 0.5); max-width: 78%; aspect-ratio: 1; }
.cf-nome { font-size: calc(var(--cf-l) * 0.14); font-weight: bold; line-height: 1.15; white-space: nowrap; letter-spacing: -0.02em; color: var(--cor-escura); }

/* o verso: xadrez verde, como a toalha do piquenique na grama, com a porta azul do galinheiro */
.cf-verso {
  border-color: var(--branco);
  background: repeating-conic-gradient(#a8d8a0 0 25%, #fffdf7 0 50%) 0 0 / calc(var(--cf-l) * 0.25) calc(var(--cf-l) * 0.25);
}
.cf-verso::before {
  content: ""; position: absolute; left: 28%; top: 50%; width: 44%; aspect-ratio: 1; transform: translateY(-50%);
  border-radius: 50%; background: var(--cf-galinheiro); border: max(2px, calc(var(--cf-l) * 0.04)) solid var(--branco);
}

/* miniaturas (as cartas dos amigos) */
.cf-mini { --cf-l: var(--cf-mini-l); --cf-a: var(--cf-mini-a); flex: 0 0 auto; border-width: 2px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(29, 43, 58, 0.35); }
.cf-mini .cf-valor { font-size: calc(var(--cf-a) * 0.62); }
.cf-mini .cf-figura { height: auto; width: 96%; max-width: none; }

/* ---------- a mesa ---------- */
.cf-mesa { gap: calc(var(--cf-folga) * 2); align-items: stretch; justify-content: flex-start; }
.cf-coluna { flex: 0 0 var(--cf-coluna); min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: var(--cf-folga); }
.cf-pilhas { --cf-l: var(--cf-pilha-l); --cf-a: var(--cf-pilha-a); display: flex; gap: var(--cf-folga); }
.cf-monte { cursor: pointer; }
.cf-monte.vazio { opacity: 0.45; }
.cf-conta {
  position: absolute; right: 3px; bottom: 3px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
  display: grid; place-items: center; background: var(--branco); color: var(--azul); font-size: 15px; font-weight: bold;
}
.cf-cesta { position: relative; border-radius: calc(var(--cf-l) * 0.16); }
.cf-cesta.chegou .cf-carta { animation: entra 0.25s ease-out; }
.cf-cesta[data-cor="morango"] { --cor-da-vez: var(--cf-morango); }
.cf-cesta[data-cor="gema"] { --cor-da-vez: var(--cf-gema); }
.cf-cesta[data-cor="galinheiro"] { --cor-da-vez: var(--cf-galinheiro); }
.cf-cesta[data-cor="grama"] { --cor-da-vez: var(--cf-grama); }
.cf-cesta .cf-carta { border-color: var(--cor-da-vez); }

.cf-info { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 24px; font-size: 15px; font-weight: bold; }
.cf-cor-vez {
  display: flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px 0 4px; border-radius: 999px;
  background: var(--branco); border: 2px solid var(--cor-carta); color: var(--cor-escura);
}
.cf-cor-vez svg { width: 18px; height: 18px; }
.cf-cor-vez b { display: none; font-size: 14px; white-space: nowrap; }
.cf-estrelas { padding: 0 8px; height: 24px; display: flex; align-items: center; border-radius: 999px; background: var(--branco); color: var(--azul); }
.cf-passar {
  min-height: var(--alvo); width: 100%; border: 0; border-radius: 999px; background: var(--branco); color: var(--azul);
  font-size: 17px; font-weight: bold; box-shadow: var(--sombra);
}

/* escolher a cor (carta Ajuda): quatro botões no lugar do monte; a cesta fica pequena embaixo */
.cf-cesta-mini { --cf-a: var(--cf-cesta-mini-a); --cf-l: var(--cf-cesta-mini-l); align-self: center; }
.cf-cores { display: grid; grid-template-columns: 1fr 1fr; gap: var(--cf-folga); }
.cf-escolher-cor {
  min-width: var(--alvo); min-height: var(--alvo); aspect-ratio: 1; padding: 12%; border: 5px solid var(--cor-carta);
  border-radius: 18px; background: var(--branco); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}
.cf-escolher-cor svg { display: block; width: 100%; height: 100%; }

/* os amigos */
.cf-lado { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--cf-folga); }
.cf-amigos { flex: 0 0 var(--cf-faixa); min-height: 0; display: flex; gap: 8px; }
.cf-amigo {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 4px; border-radius: 14px;
  background: rgba(255, 253, 247, 0.72); outline: 3px solid transparent; outline-offset: -3px;
}
.cf-amigo.vez { background: var(--branco); outline-color: var(--amarelo); }
.cf-rosto { flex: 0 0 auto; }
.cf-rosto img { height: calc(var(--cf-faixa) - 8px); width: auto; max-width: min(calc(var(--cf-faixa) * 1.2), 9vw); object-fit: contain; }
.cf-amigo-lado { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cf-nome-amigo { font-size: 16px; font-weight: bold; color: var(--azul); }
.cf-quantas { min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; display: grid; place-items: center; background: var(--azul); color: #fff; font-size: 15px; font-weight: bold; }
.cf-amigo.terminou .cf-quantas { background: var(--amarelo); }
.cf-minis { flex: 1 1 0; min-width: 0; display: flex; align-items: center; }
.cf-vaga { flex: 1 1 0; min-width: 0; max-width: calc(var(--cf-mini-l) + 2px); }
.cf-vaga:last-child { flex: 0 0 var(--cf-mini-l); }

/* a mão da criança: uma ou duas fileiras, cada carta com pelo menos o tamanho do alvo de toque */
.cf-mao {
  flex: 1 1 0; min-height: 0; display: grid; gap: var(--cf-folga); justify-content: center; align-content: center;
  border-radius: var(--raio); background: rgba(255, 253, 247, 0.5); outline: 3px dashed transparent; outline-offset: -3px;
}
.cf-mao.vez { outline-color: var(--amarelo); }
.cf-mao .cf-carta { cursor: pointer; }
.cf-mao-vazia { margin: 0; padding: 0 12px; font-size: 18px; font-weight: bold; text-align: center; color: var(--azul); }
.cf-mais {
  width: var(--cf-l); height: var(--cf-a); padding: 0; border: 0; border-radius: calc(var(--cf-l) * 0.16);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--amarelo); color: var(--azul); font-size: 28px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}
.cf-mais small { font-size: 13px; font-weight: bold; }

/* o que pode ser tocado agora fica levantado e com um brilho calmo (nada pisca) */
.cf-mao .cf-carta.pode { transform: translateY(-4px); }
.cf-carta.pode, .cf-mais.pode, .cf-escolher-cor.pode, .cf-modo.pode {
  box-shadow: 0 0 0 4px var(--amarelo), 0 6px 0 rgba(0, 0, 0, 0.18); animation: cf-brilho 1.8s ease-in-out infinite;
}
.cf-carta.nova { outline: 3px solid var(--azul); outline-offset: -1px; }
.cf-carta.volta { animation: volta 0.35s ease-out; }
@keyframes cf-brilho { 50% { box-shadow: 0 0 0 7px rgba(255, 213, 79, 0.75), 0 6px 0 rgba(0, 0, 0, 0.18); } }

/* só para leitor de tela (as jogadas dos amigos) */
.cf-so-leitor { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cf-espera-toque { pointer-events: none; }
.cf-modo-figura.cf-cor-grama { color: var(--cor-carta); }

/* ---------- o fim da partida ---------- */
.cf-fim { align-items: center; justify-content: center; gap: 3%; }
.cf-fim-turma { flex: 0 1 34%; min-width: 0; height: min(70%, 320px); display: flex; align-items: flex-end; justify-content: center; }
.cf-fim-turma img { flex: 1 1 0; min-width: 0; height: 70%; object-fit: contain; object-position: bottom; }
.cf-fim-turma img:first-child { height: 100%; flex-grow: 1.4; }
.cf-fim-textos {
  flex: 0 1 auto; max-width: 560px; padding: 12px 20px; text-align: center; border-radius: var(--raio);
  background: var(--branco); box-shadow: var(--sombra);
}
.cf-fim-textos h2 { margin: 0 0 4px; color: var(--azul); font-size: clamp(22px, 3.4vw, 36px); }
.cf-fim-textos p { margin: 2px 0; font-size: clamp(16px, 2vw, 20px); }
.cf-fim-estrelas { font-weight: bold; color: var(--azul); }
.cf-fim-botoes { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
.cf-fim-botoes .botao-acao { min-width: 0; padding: 0 20px; white-space: nowrap; }

/* ---------- o menu ---------- */
.cf-menu { flex-direction: column; align-items: center; justify-content: center; gap: clamp(8px, 3vh, 26px); overflow-y: auto; }
.cf-menu-amigos, .cf-menu-modos { display: flex; justify-content: center; gap: 10px; width: 100%; max-width: 780px; }
.cf-quantos {
  flex: 1 1 0; min-width: var(--alvo); height: clamp(var(--alvo), 24vh, 170px); padding: 4px 6px; border: 0; border-radius: var(--raio);
  display: flex; align-items: center; justify-content: center; gap: 2px;
  background: var(--branco); box-shadow: var(--sombra); outline: 4px solid transparent; outline-offset: -4px;
}
.cf-quantos img { flex: 0 1 auto; min-width: 0; height: 84%; width: auto; max-width: 32%; object-fit: contain; }
.cf-quantos[data-amigos="1"] img { max-width: 80%; }
.cf-quantos[data-amigos="2"] img { max-width: 46%; }
.cf-quantos[aria-pressed="true"] { background: #fff3c4; outline-color: var(--azul); }
.cf-modo {
  flex: 1 1 0; min-width: var(--alvo); height: clamp(var(--alvo), 26vh, 180px); padding: 4px 10px; border: 0; border-radius: var(--raio);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--amarelo); color: var(--azul); font-size: clamp(15px, 2vw, 22px); font-weight: bold; box-shadow: var(--sombra);
}
.cf-modo-figura { flex: 0 0 auto; height: 76%; display: flex; align-items: center; --cf-mini-a: clamp(34px, 9vh, 70px); --cf-mini-l: calc(var(--cf-mini-a) * 0.72); }
.cf-modo-figura img, .cf-modo-figura svg { height: 100%; width: auto; }
.cf-modo-figura .cf-mini + .cf-mini { margin-left: calc(var(--cf-mini-l) * -0.45); }
.cf-regra-hoje { margin: 0; padding: 4px 14px; border-radius: 999px; background: var(--branco); color: var(--azul); font-size: 16px; font-weight: bold; }

/* ---------- telas maiores: nome da cor por extenso ---------- */
@media (min-width: 1000px) and (min-height: 560px) {
  .cf-cor-vez b { display: inline; }
  .cf-info { font-size: 17px; }
}

/* ---------- celular deitado (pouca altura) ---------- */
@media (max-height: 460px) {
  .cf-nome-amigo { display: none; }
  .cf-amigos { gap: 6px; }
  .cf-amigo { gap: 4px; padding: 0 4px 0 2px; }
  .cf-rosto img { max-width: 6vw; }
  .cf-fim-textos { padding: 6px 14px; }
  .cf-fim-textos h2 { font-size: 22px; }
  .cf-fim-botoes { margin-top: 6px; }
  .cf-fim-botoes .botao-acao { font-size: 17px; padding: 0 14px; }
  .cf-modo { flex-direction: column; gap: 0; font-size: 15px; line-height: 1.1; }
  .cf-modo-figura { height: 52%; --cf-mini-a: 34px; }
}
@media (max-height: 460px) and (max-width: 700px) {
  .cf-fim-turma { display: none; }
}

/* 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; }
.cf-quantos { flex-direction: column; }
.cf-quantos-figuras { display: flex; align-items: center; justify-content: center; min-height: 0; flex: 1 1 auto; }
