:root {
  --bg: #0f0b07;
  --felt: #1e5a43;
  --felt-2: #174633;
  --ink: #f7efdf;
  --muted: rgba(247, 239, 223, 0.72);
  --line: rgba(255, 244, 220, 0.16);
  --panel: rgba(34, 20, 10, 0.72);
  --gold: #d6b36a;
  --red: #a54646;
  --black: #1c1814;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(214,179,106,0.14), transparent 24%),
    linear-gradient(180deg, #23160d 0%, #100b07 100%);
}
.table-shell {
  width: min(1240px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 20px 0 28px;
}
.topbar, .info-grid, .seat-head, .scores, .actions {
  display: flex;
  align-items: center;
}
.topbar, .info-grid { justify-content: space-between; gap: 16px; }
.eyebrow, .label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  font-size: 12px;
}
h1 {
  margin: 8px 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(42px, 6vw, 68px);
  line-height: 0.95;
}
.subtitle, .rules-note { margin: 0; color: var(--muted); }
.back-link {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
}
.info-grid {
  margin: 18px 0 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 18px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.22);
}
.panel strong { font-size: 28px; }
.score-panel .scores { justify-content: space-between; gap: 18px; margin-top: 8px; }
.notice { margin-bottom: 14px; }
#status { margin: 0 0 6px; font-size: 18px; }
.mobile-note { margin-top: 8px; }
.table {
  background: radial-gradient(circle at center, var(--felt) 0%, var(--felt-2) 68%, #133626 100%);
  border-radius: 36px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.04), 0 24px 90px rgba(0,0,0,0.3);
}
.seat-head { justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--muted); }
.mid-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 180px;
  gap: 16px;
  align-items: stretch;
  margin: 12px 0;
}
.card-row, .card-column { display: flex; gap: 10px; }
.card-row { min-height: 140px; }
.card-column { min-height: 320px; align-items: center; justify-content: center; }
.back-row, .back-column { opacity: 0.92; }
.back-column { flex-direction: column; }
.card, .card-back, .trick-card {
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.18);
  background: #f7f0e3;
  color: var(--black);
  box-shadow: 0 10px 18px rgba(0,0,0,0.18);
}
.card, .trick-card {
  width: 92px;
  height: 132px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-back {
  width: 72px;
  height: 104px;
  background:
    linear-gradient(135deg, rgba(214,179,106,0.15), rgba(255,255,255,0.1)),
    repeating-linear-gradient(45deg, #6f1d1b 0 8px, #8d2f2f 8px 16px);
  border: 2px solid rgba(255,240,210,0.38);
}
.card.playable { cursor: pointer; transform: translateY(0); transition: transform 140ms ease, box-shadow 140ms ease; }
.card.playable:hover { transform: translateY(-8px); box-shadow: 0 16px 24px rgba(0,0,0,0.24); }
.card.locked { opacity: 0.48; }
.rank { font-size: 28px; font-weight: 700; line-height: 1; }
.suit { font-size: 30px; align-self: flex-end; }
.hearts, .diamonds { color: var(--red); }
.spades, .clubs { color: var(--black); }
.trick-area { display: grid; grid-template-rows: 1fr auto; min-height: 380px; }
.trick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  place-items: center;
  min-height: 290px;
}
.north-slot { grid-column: 2; grid-row: 1; }
.west-slot { grid-column: 1; grid-row: 2; }
.east-slot { grid-column: 3; grid-row: 2; }
.south-slot { grid-column: 2; grid-row: 3; }
.trick-slot {
  width: 100px;
  height: 140px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,0.18);
  display: grid;
  place-items: center;
}
.actions { justify-content: center; gap: 12px; }
.touch-hint {
  margin: 12px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
button {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(180deg, #edd197, #c79a4b);
  color: #22150c;
}
button.ghost { background: rgba(255,255,255,0.1); color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.human-panel { background: rgba(34,20,10,0.55); }
@media (max-width: 980px) {
  .info-grid { grid-template-columns: 1fr; }
  .mid-row { grid-template-columns: 1fr; }
  .west, .east { order: 2; }
  .trick-area { order: 1; }
  .card-column { flex-direction: row; min-height: auto; }
}
@media (max-width: 720px) {
  body { overscroll-behavior-y: contain; }
  .table-shell { width: min(100vw - 12px, 100%); padding: 10px 0 22px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .back-link { width: 100%; justify-content: center; text-align: center; }
  h1 { font-size: clamp(34px, 12vw, 52px); }
  .subtitle, .rules-note, .touch-hint { font-size: 14px; }
  .table { padding: 12px; border-radius: 24px; }
  .seat-head { font-size: 13px; }
  .card-row {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 10px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .player-row {
    gap: 8px;
    padding-bottom: 14px;
  }
  .player-row .card {
    flex: 0 0 auto;
    scroll-snap-align: center;
  }
  .card-column {
    flex-direction: row;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: auto;
    padding-bottom: 6px;
  }
  .card-back { flex: 0 0 auto; }
  .card, .trick-card {
    width: 74px;
    height: 108px;
    padding: 8px;
    border-radius: 14px;
  }
  .card-back {
    width: 54px;
    height: 78px;
  }
  .rank { font-size: 24px; }
  .suit { font-size: 24px; }
  .trick-area { min-height: 300px; }
  .trick-grid { min-height: 220px; gap: 4px; }
  .trick-slot {
    width: 82px;
    height: 112px;
  }
  .actions {
    position: sticky;
    bottom: 0;
    padding-top: 10px;
    background: linear-gradient(180deg, rgba(34,20,10,0), rgba(34,20,10,0.72) 30%);
  }
  button {
    min-height: 46px;
    padding: 12px 18px;
  }
}
