/* ---------- Game table ---------- */
.table {
  --deck-w: clamp(78px, 23vw, 120px);
  --card-w: min(80vw, 340px, calc((100dvh - var(--deck-w) * 1.4 - 210px) * 5 / 7));

  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: max(14px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
}

.table__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.table__bar .soft-btn { justify-self: start; padding: 0; width: 44px; }
.table__bar .soft-btn svg { width: 20px; height: 20px; }
.table__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.1rem, 4.6vw, 1.45rem);
  letter-spacing: -.02em;
  white-space: nowrap;
}

/* Free-card counter */
.counter {
  justify-self: end;
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
}
.counter__led {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3ee08f;
}
.counter__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.counter__label {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .6;
}
.counter.is-low .counter__led { background: #ffb020; }
.counter.is-out .counter__led { background: #ff4a3d; }
.counter.is-unlocked .counter__led { background: #7a6bff; }
.counter.is-bump .counter__value { animation: tick .3s var(--ease-out); }
@keyframes tick { 40% { transform: translateY(-3px); opacity: .4; } }

/* Area where the drawn card lands: flat, same surface as the table */
.table__play {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 18px 0;
}

.slot {
  position: relative;
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  border-radius: var(--radius-card);
  touch-action: manipulation;
}
.slot__hint {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 20%;
  border-radius: inherit;
  border: 2px dashed rgba(27,26,25,.14);
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--ink-soft);
  transition: opacity .4s;
}
.slot.has-card .slot__hint { opacity: 0; }

/* ---------- Decks ---------- */
.table__decks {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(14px, 5vw, 36px);
  padding-top: 6px;
}

.deck {
  width: var(--deck-w);
  padding: 0;
  border: 0;
  background: none;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.deck:focus-visible { outline: none; }
.deck:focus-visible .deck__top { outline: 3px solid #4b4dff; outline-offset: 3px; }

.deck__pile {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;
}
.deck__pile::before {
  /* contact shadow under the pile */
  content: "";
  position: absolute; inset: 10% 4% -3%;
  border-radius: var(--radius-card);
  background: rgba(40,30,20,.22);
  filter: blur(8px);
}
.deck .deck__top {
  display: block;
  position: absolute; inset: 0;
  --radius-card: 10px;
  transform: translateY(calc(var(--thickness, 0px) * -1));
  box-shadow: var(--stack, 0 0 0 transparent);
  transition: transform .2s var(--ease-out);
}
.deck:hover .deck__top,
.deck:focus-visible .deck__top { transform: translateY(calc(var(--thickness, 0px) * -1 - 5px)); }
.deck:active .deck__top { transform: translateY(calc(var(--thickness, 0px) * -1 + 1px)); }

/* ---------- Discard pile ---------- */
.discard {
  width: calc(var(--deck-w) * .9);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.discard__pile {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  border: 2px dashed rgba(27,26,25,.14);
}
.discard__pile .card { --radius-card: 10px; }
.discard__pile .card__shadow { filter: blur(3px); transform: translate(0, 2px); opacity: .6; }
.discard .engraved { opacity: .6; }
