/* A tela inteira é desenhada num palco de 118 × 82 rem (proporção de iPad deitado).
   O app.js ajusta o tamanho do rem para o palco caber na tela, então tudo cresce junto. */

@font-face { font-family: 'Atk'; src: url(../fonts/atkinson-400.ttf) format('truetype'); font-weight: 400; font-display: block; }
@font-face { font-family: 'Atk'; src: url(../fonts/atkinson-700.ttf) format('truetype'); font-weight: 700; font-display: block; }
@font-face { font-family: 'Atk'; src: url(../fonts/atkinson-800.ttf) format('truetype'); font-weight: 800; font-display: block; }

:root {
  --fundo: #0e1f18;
  --fundo-2: #173127;
  --feltro: #1d6b45;
  --feltro-escuro: #145236;
  --madeira: #6e4524;
  --carta: #fbf7ee;
  --tinta: #1b1915;
  --tinta-fraca: #4f4a40;
  --cinza-carta: #d6cfbf;
  --verde: #1f8a50;
  --verde-escuro: #0f5a32;
  --verde-claro: #dff2e5;
  --ouro: #f4b63c;
  --ouro-escuro: #5c3d00;
  --vermelho: #b23a2b;
  --claro: #f4efe3;
  --claro-fraco: #b9c8bf;
  font-size: 10px;
}

* { box-sizing: border-box; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--fundo); color: var(--claro);
  font-family: 'Atk', system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-text-size-adjust: 100%;
}

#palco {
  position: absolute; left: 50%; top: 50%;
  width: 118rem; height: 82rem;
  transform: translate(-50%, -50%);
}
#tela { position: absolute; inset: 0; }

button {
  font: inherit; color: inherit; border: 0; background: none; margin: 0; padding: 0; cursor: pointer;
}
svg.i { width: 1em; height: 1em; vertical-align: -0.14em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 1.2rem;
  min-height: 7.6rem; padding: 0 3.2rem; border-radius: 1.6rem;
  font-size: 3.2rem; font-weight: 800; line-height: 1;
  background: var(--carta); color: var(--tinta);
  box-shadow: 0 .5rem 0 rgba(0,0,0,.28);
  transition: transform .08s;
}
.btn:active, .btn.apertado { transform: translateY(.4rem); box-shadow: 0 .1rem 0 rgba(0,0,0,.28); }
.btn.verde { background: var(--verde); color: #fff; }
.btn.ouro { background: var(--ouro); color: var(--ouro-escuro); }
.btn.contorno { background: transparent; color: var(--claro); box-shadow: inset 0 0 0 .35rem rgba(244,239,227,.55); }
.btn.contorno:active { transform: translateY(.2rem); }
.btn.pequeno { min-height: 6rem; font-size: 2.5rem; padding: 0 2.4rem; }
.btn.enorme { min-height: 9.6rem; font-size: 4.4rem; padding: 0 4.4rem; border-radius: 2rem; min-width: 22rem; }
.btn.duas { flex-direction: column; gap: .5rem; min-height: 9rem; min-width: 26rem; padding: 0 2.6rem; }
.btn.duas small { font-size: 2.2rem; font-weight: 700; opacity: .85; }

/* Segurar para confirmar: a barra enche enquanto o dedo fica no botão. */
.btn.segurar { position: relative; overflow: hidden; }
.btn.segurar .enche {
  position: absolute; inset: 0; background: rgba(178,58,43,.35);
  transform: scaleX(0); transform-origin: left center;
}
.btn.segurar.segurando .enche { transform: scaleX(1); transition: transform 1.6s linear; }
.btn.segurar span { position: relative; }

/* ---------- Tela inicial ---------- */
.inicio {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3rem;
  background: radial-gradient(ellipse at 50% 40%, var(--feltro) 0%, var(--feltro-escuro) 45%, var(--fundo) 100%);
}
.logo { text-align: center; }
.logo .naipes { display: flex; gap: 2.2rem; justify-content: center; margin-bottom: 1rem; }
.logo .naipes svg { width: 6rem; height: 6rem; }
.logo h1 { font-size: 15rem; font-weight: 800; margin: 0; letter-spacing: -0.2rem; line-height: 1; color: var(--carta); }
.logo p { font-size: 3rem; margin: 1.4rem 0 0; color: var(--claro-fraco); }
.inicio .acoes { display: flex; flex-direction: column; gap: 2.2rem; width: 52rem; margin-top: 2rem; }
.inicio .acoes .btn { width: 100%; }

/* ---------- Mesa ---------- */
.topo {
  position: absolute; left: 0; right: 0; top: 0; height: 8.5rem;
  display: flex; align-items: center; justify-content: space-between; padding: 0 3rem;
}
.topo .titulo { font-size: 3.6rem; font-weight: 800; }
.topo .titulo small { font-weight: 400; color: var(--claro-fraco); font-size: 2.8rem; margin-left: 1rem; }
.topo .final { background: var(--ouro); color: var(--ouro-escuro); padding: .2rem 1.6rem; border-radius: 99rem; }
.topo .dinheiro { font-size: 3.4rem; font-weight: 800; color: var(--ouro); display: flex; align-items: center; gap: 1rem; }
.topo .dinheiro .rot { font-weight: 400; color: var(--claro-fraco); font-size: 2.8rem; }

.salao { position: absolute; left: 0; right: 0; top: 8.5rem; height: 64.5rem; }

.mesa-feltro {
  position: absolute; left: 24rem; top: 18.5rem; width: 70rem; height: 28rem;
  border-radius: 4rem; background: var(--feltro);
  box-shadow: 0 0 0 1.2rem var(--madeira), 0 0 0 1.5rem #3f2512, 0 2rem 4rem rgba(0,0,0,.5), inset 0 0 6rem rgba(0,0,0,.35);
}
.centro {
  position: absolute; left: 24rem; top: 18.5rem; width: 70rem; height: 28rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.3rem;
  text-align: center; padding: 2.6rem 4rem;
}
.centro .rotulo { font-size: 2.6rem; color: var(--verde-claro); opacity: .9; }
.centro .grande { font-size: 5.4rem; font-weight: 800; line-height: 1.05; color: #fff; }
.centro .medio { font-size: 3.6rem; font-weight: 800; color: #fff; line-height: 1.15; }
.centro .leve { font-weight: 400; color: var(--verde-claro); }
.centro .medio.leve { font-size: 3rem; }
.centro .grande, .centro .medio, .centro .dica { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.centro .dica { font-size: 2.3rem; color: var(--verde-claro); opacity: .85; }
.centro .linha { display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; }
.centro .faixa {
  font-size: 2.4rem; font-weight: 800; letter-spacing: .3rem; text-transform: uppercase;
  background: var(--ouro); color: var(--ouro-escuro); padding: .6rem 2rem; border-radius: 99rem;
}
.centro .contador { display: flex; align-items: center; gap: 2rem; font-size: 3rem; font-weight: 800; }
.centro .contador .btn { min-height: 6rem; width: 7rem; padding: 0; font-size: 4rem; }

/* Cadeiras */
.lugar {
  position: absolute; width: 20rem; height: 15.5rem; padding-top: 1rem;
  border-radius: 1.8rem; background: var(--carta); color: var(--tinta);
  border: .5rem solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 .6rem 0 rgba(0,0,0,.3);
  transition: transform .35s cubic-bezier(.3,1.3,.5,1), background-color .2s;
}
.lugar .nome { font-size: 3.2rem; font-weight: 800; line-height: 1.15; max-width: 18.4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lugar .pontos { font-size: 6.6rem; font-weight: 800; line-height: 1; margin: .2rem 0 .4rem; font-variant-numeric: tabular-nums; position: relative; }
.lugar .estado {
  font-size: 2rem; font-weight: 800; letter-spacing: .15rem; text-transform: uppercase;
  padding: .3rem 1.4rem; border-radius: 99rem; background: rgba(0,0,0,.07); color: var(--tinta-fraca);
}
.lugar.joga { border-color: var(--verde); }
.lugar.joga .estado { background: var(--verde); color: #fff; }
.lugar.fora { background: var(--cinza-carta); }
.lugar.fora .nome, .lugar.fora .pontos { color: var(--tinta-fraca); }
.lugar.ganhar { border-color: var(--ouro); }
.lugar.ganhar .estado { background: var(--ouro); color: var(--ouro-escuro); display: inline-flex; align-items: center; gap: .5rem; }
.lugar.borracha .estado { background: var(--ouro); color: var(--ouro-escuro); }
.lugar.vez { border-color: var(--ouro); }
.lugar.vez::after {
  content: ''; position: absolute; inset: -1.4rem; border-radius: 2.8rem;
  border: .5rem solid var(--ouro); animation: pulsa 1.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pulsa { 0%, 100% { opacity: .15; } 50% { opacity: .9; } }
.lugar.elim { background: rgba(255,255,255,.07); box-shadow: none; color: var(--claro-fraco); }
.lugar.elim .estado { background: transparent; color: var(--claro-fraco); }
.lugar.vazio { background: transparent; box-shadow: none; border: .35rem dashed rgba(244,239,227,.35); color: var(--claro-fraco); }
.lugar.vazio .nome { font-size: 2.6rem; font-weight: 400; }
.lugar.montando .nome { font-size: 3.6rem; margin-bottom: 1.4rem; }
.lugar.vazio.quieto { border-color: rgba(244,239,227,.12); }
.lugar.vazio.quieto .nome { opacity: 0; }
.lugar.alvo { border-color: var(--ouro); border-style: solid; }
.lugar.sorteio { border-color: var(--ouro); background: #fff3d1; }
.lugar.final .pontos { font-size: 3rem; letter-spacing: .2rem; margin: 1rem 0; color: var(--tinta-fraca); }

.lugar .fichas { position: absolute; top: -2.5rem; left: 0; right: 0; display: flex; justify-content: center; gap: .8rem; }
.ficha {
  font-size: 1.9rem; font-weight: 800; letter-spacing: .1rem; text-transform: uppercase; white-space: nowrap;
  padding: .4rem 1.2rem; border-radius: 99rem; display: inline-flex; align-items: center; gap: .6rem;
  box-shadow: 0 .3rem 0 rgba(0,0,0,.3);
}
.ficha.mao { background: var(--ouro); color: var(--ouro-escuro); }
.ficha.da { background: #2b2620; color: var(--carta); }

.delta {
  position: absolute; left: 100%; top: 0; margin-left: .6rem;
  font-size: 3.4rem; color: var(--vermelho); font-weight: 800;
  animation: sobe 1.8s ease-out forwards; pointer-events: none;
}
@keyframes sobe { 0% { opacity: 0; transform: translateY(1rem); } 15% { opacity: 1; transform: translateY(0); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-3rem); } }

/* Rodapé */
.rodape {
  position: absolute; left: 0; right: 0; bottom: 0; height: 9rem;
  display: flex; align-items: center; gap: 2rem; padding: 0 3rem 1rem;
}
.rodape .ultima {
  flex: 1; min-width: 0; font-size: 2.6rem; color: var(--claro-fraco); line-height: 1.2;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.rodape .ultima b { color: var(--claro); }
.rodape .btn { min-height: 8rem; }
.rodape .desfazer { min-width: 26rem; }

/* ---------- Janelas por cima ---------- */
#camada:empty { display: none; }
#camada { position: absolute; inset: -100vmax; background: rgba(4,12,9,.78); display: flex; align-items: center; justify-content: center; }
.janela {
  width: 96rem; max-height: 76rem; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  background: var(--carta); color: var(--tinta); border-radius: 2.6rem; padding: 3.4rem 4rem;
  box-shadow: 0 2rem 6rem rgba(0,0,0,.5);
}
.janela.larga { width: 110rem; }
.janela h2 { font-size: 4.4rem; font-weight: 800; margin: 0 0 2.4rem; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.janela h3 { font-size: 3rem; font-weight: 800; margin: 3rem 0 1.4rem; }
.janela p { font-size: 2.8rem; line-height: 1.35; margin: 0 0 1.6rem; color: var(--tinta-fraca); }
.janela .btn { background: #efe8d8; box-shadow: 0 .5rem 0 rgba(0,0,0,.15); }
.janela .btn.verde { background: var(--verde); color: #fff; }
.janela .btn.ouro { background: var(--ouro); }
.janela .btn.perigo { background: #f6dcd6; color: var(--vermelho); }
.janela .acoes { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 2.6rem; }
.janela .acoes.fim { justify-content: flex-end; }
.janela .coluna { display: flex; flex-direction: column; gap: 1.8rem; }
.janela .coluna .btn { width: 100%; justify-content: flex-start; }

.nomes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; }
.nomes .btn { width: 100%; min-height: 8.6rem; font-size: 3.2rem; padding: 0 1.6rem; flex-direction: column; gap: .4rem; }
.nomes .btn small { font-size: 1.9rem; font-weight: 400; color: var(--tinta-fraca); }
.nomes .btn.novo { background: transparent; box-shadow: inset 0 0 0 .35rem var(--verde); color: var(--verde-escuro); }

.campo {
  width: 100%; font: inherit; font-size: 4.4rem; font-weight: 700; color: var(--tinta);
  padding: 1.8rem 2.4rem; border-radius: 1.6rem; border: .4rem solid #cfc6b2; background: #fff;
  -webkit-user-select: text; user-select: text;
}
.campo:focus { outline: none; border-color: var(--verde); }
.erro { color: var(--vermelho); font-size: 2.6rem; font-weight: 700; min-height: 3.4rem; margin-top: 1.2rem; }

.abas { display: flex; gap: 1.4rem; margin-bottom: 2.4rem; }
.abas .btn { min-height: 6.4rem; font-size: 2.8rem; }
.abas .btn.ativa { background: var(--tinta); color: var(--carta); }

table.placar { width: 100%; border-collapse: collapse; font-size: 2.9rem; }
table.placar th { font-size: 2.1rem; font-weight: 700; color: var(--tinta-fraca); text-align: right; padding: 0 1.2rem 1.2rem; vertical-align: bottom; line-height: 1.2; }
table.placar th:first-child, table.placar td:first-child { text-align: left; }
table.placar td { padding: 1.5rem 1.2rem; border-top: .2rem solid #e6dfcf; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
table.placar td:first-child { font-weight: 800; }
table.placar td small { display: block; font-size: 1.9rem; font-weight: 400; color: var(--tinta-fraca); }
.pos { color: var(--verde-escuro); }
.neg { color: var(--vermelho); }

.noite { display: flex; justify-content: space-between; align-items: center; gap: 2rem; width: 100%; text-align: left; }
.noite .quando { font-size: 3rem; font-weight: 800; }
.noite .resumo { font-size: 2.3rem; font-weight: 400; color: var(--tinta-fraca); margin-top: .6rem; }
.lista-noites { display: flex; flex-direction: column; gap: 1.4rem; }
.lista-noites .btn { min-height: 10rem; padding: 1.4rem 2.6rem; }

.ajuste { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1.8rem 0; border-top: .2rem solid #e6dfcf; font-size: 3rem; font-weight: 700; }
.ajuste .contador { display: flex; align-items: center; gap: 2rem; font-size: 3.4rem; font-weight: 800; }
.ajuste .contador .btn { min-height: 6.4rem; width: 7.4rem; padding: 0; font-size: 4rem; }

.vazio-txt { font-size: 2.8rem; color: var(--tinta-fraca); padding: 2rem 0; }

/* Aviso rápido no meio da tela */
#aviso {
  position: absolute; left: 50%; top: 9rem; transform: translateX(-50%);
  background: var(--ouro); color: var(--ouro-escuro); font-size: 3rem; font-weight: 800;
  padding: 1.6rem 3.4rem; border-radius: 1.6rem; box-shadow: 0 1rem 3rem rgba(0,0,0,.4);
  opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap;
}
#aviso.mostra { opacity: 1; }

/* Com o tablet em pé tudo ficaria pequeno demais: pede para deitar. */
#vire { display: none; }
@media (max-aspect-ratio: 9/10) {
  #vire {
    display: flex; position: fixed; inset: 0; z-index: 10; background: var(--fundo);
    flex-direction: column; align-items: center; justify-content: center; gap: 4vw; text-align: center; padding: 8vw;
  }
  #vire svg { width: 22vw; height: 22vw; fill: none; stroke: var(--carta); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  #vire b { font-size: 8vw; font-weight: 800; color: var(--carta); }
  #vire span { font-size: 4.6vw; color: var(--claro-fraco); }
}
