/* Match table: red-light timer, the two piles, the player chips.
   Portrait: piles stacked; landscape: side by side. Everything sits inside
   .caf-shell, so the chips keep the 40px bottom margin. */
.game {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.5rem;
}
.timer-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #fff5da;
  font-weight: 700;
  text-shadow: 0 1px 0 #38531d;
}
.timer-bar p { margin: 0; }
.timer-light { width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #8e7a64; box-shadow: 0 0 0 0.4rem #00000018; }
.timer-light.on { background: #f13a2c; box-shadow: 0 0 1.4rem #f13a2c; }
.board {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.6rem;
}
.pile-shell {
  min-height: 0;
  display: flex;
  padding: 0.5rem;
  border-radius: 1.4rem;
  background: radial-gradient(circle at top, #88b055, transparent 25%), repeating-linear-gradient(135deg, #789c48 0 20px, #6f9347 20px 40px), linear-gradient(180deg, var(--table), var(--table-dark));
  box-shadow: inset 0 0 0 3px #cde39c1f, 0 1rem 1.8rem #0000002b;
}
.pile-shell.active { outline: 5px solid #f5d46f; outline-offset: -4px; }
.pile-hit {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  padding: 0.4rem;
  overflow: hidden;
  border: 2px solid #9daa7f;
  border-radius: 1.1rem;
  background: linear-gradient(180deg, #cfe2a7, #b6ca86);
  cursor: pointer;
  touch-action: manipulation;
}
.pile {
  position: relative;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #dbe9bc, #bfd095), repeating-linear-gradient(45deg, #ffffff24 0 18px, #00000008 18px 36px);
  box-shadow: inset 0 0 0 2px #ffffff7a;
}
.pile-message {
  padding: 0.5rem 0.9rem;
  border-radius: 1rem;
  background: #fff9e8d8;
  border: 2px solid #d4bd85;
  font-weight: 700;
  box-shadow: 0 0.5rem 1rem #00000018;
}
/* Cards are centred in the pile and fill most of its height. */
.card {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 88%;
  aspect-ratio: 2.35 / 4.06;
  border: 3px solid #f6edd7;
  border-radius: 8% / 5%;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0.8rem 1.8rem #00000055;
  transform: translate(-50%, -50%) var(--card-move, none);
}
.card-new { animation: drop 320ms cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -90%) scale(0.86); } to { opacity: 1; } }
.players {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 0.4rem;
  padding-top: 0.7rem;
}
.player-chip {
  width: max(40px, 2.6rem);
  height: max(40px, 2.6rem);
  border: none;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #111827;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 0.4rem 0.9rem rgba(0, 0, 0, 0.35);
}
.player-chip.active { transform: translateY(-0.6rem); box-shadow: 0 0 0 3px #fff, 0 0.4rem 0.9rem rgba(0, 0, 0, 0.35); }
.player-0 { background: #facc15; }
.player-1 { background: #38bdf8; }
.player-2 { background: #4ade80; }
.player-3 { background: #fb7185; }
.player-4 { background: #a855f7; }
.player-5 { background: #f97316; }
.player-6 { background: #2dd4bf; }
.player-7 { background: #f9a8d4; }

@media (orientation: landscape) {
  .board { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (orientation: landscape) and (max-height: 500px) {
  .game { gap: 0.3rem; }
  .pile-shell { padding: 0.3rem; }
  .players { padding-top: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .card-new { animation: none; }
}
