:root {
  --bg: #0f0a07;
  --felt: #7a4a1f;
  --felt-2: #5b3215;
  --ink: #f8efe3;
  --muted: rgba(248, 239, 227, 0.72);
  --line: rgba(255, 231, 191, 0.18);
  --panel: rgba(45, 24, 11, 0.76);
  --gold: #d9b566;
  --red: #ae4952;
  --black: #1a1613;
}
* { 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(217,181,102,0.18), transparent 24%), linear-gradient(180deg, #28170e 0%, #100a07 100%);
}
.table-shell { width: min(1220px, calc(100vw - 20px)); margin: 0 auto; padding: 16px 0 24px; }
.topbar, .seat-head, .actions, .contract-strip { display: flex; align-items: center; }
.topbar { 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(40px, 7vw, 64px); line-height: 0.95; }
.subtitle, .rules-note { margin: 0; color: var(--muted); }
.back-link {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
}
.info-grid { margin: 16px 0 14px; display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 12px; }
.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.24);
}
.panel strong { font-size: 28px; }
.notice, .auction-panel { margin-bottom: 14px; }
#status { margin: 0 0 6px; font-size: 18px; }
.auction-panel { display: flex; justify-content: space-between; gap: 16px; }
.auction-log, .scores-list { display: grid; gap: 8px; }
.auction-row, .score-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
}
.auction-controls {
  min-width: 230px;
  display: grid;
  gap: 10px;
  align-content: start;
}
select, button {
  font: inherit;
  padding: 12px 16px;
  border-radius: 999px;
}
.table {
  background: radial-gradient(circle at center, var(--felt) 0%, var(--felt-2) 62%, #341a0b 100%);
  border-radius: 34px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) minmax(0, 1fr) minmax(120px, 180px);
  grid-template-areas:
    ". north north ."
    "west trick trick east"
    ". southeast south .";
  gap: 14px;
  align-items: stretch;
}
.seat-head { justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--muted); }
.seat { min-width: 0; }
.opponent-seat {
  padding: 12px 14px;
  border-radius: 22px;
  background: rgba(45, 24, 11, 0.34);
  border: 1px solid rgba(255,255,255,0.08);
}
.top-seat { grid-area: north; justify-self: center; width: min(100%, 420px); }
.west-seat { grid-area: west; }
.east-seat { grid-area: east; }
.southeast-seat { grid-area: southeast; justify-self: center; width: min(100%, 340px); }
.south { grid-area: south; }
.card-row, .card-column { display: flex; gap: 8px; }
.card-column { min-height: 260px; align-items: center; justify-content: center; flex-direction: column; }
.card, .trick-card, .card-back { border-radius: 16px; box-shadow: 0 10px 18px rgba(0,0,0,0.2); }
.card, .trick-card {
  width: 90px;
  height: 132px;
  background: #faf1e2;
  color: var(--black);
  border: 1px solid rgba(0,0,0,0.16);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-back {
  width: 60px;
  height: 86px;
  background: repeating-linear-gradient(45deg, #7a2326 0 8px, #b13b41 8px 16px);
  border: 2px solid rgba(255,255,255,0.2);
}
.card.playable { cursor: pointer; transition: transform 140ms ease; }
.card.playable:hover { transform: translateY(-6px); }
.card.locked { opacity: 0.44; }
.rank { font-size: 24px; font-weight: 700; }
.label-mini { font-size: 13px; }
.suit { font-size: 28px; align-self: flex-end; }
.coins, .cups { color: var(--red); }
.swords, .clubs { color: var(--black); }
.trick-area { grid-area: trick; min-height: 420px; display: grid; grid-template-rows: auto 1fr auto; }
.contract-strip { justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.contract-strip span {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  font-size: 13px;
}
.trick-grid {
  min-height: 280px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
}
.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; }
.southeast-slot { grid-column: 3; 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; }
button {
  border: 0;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(180deg, #f0d291, #cc9b46);
  color: #28170e;
}
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; }
.touch-hint { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: 14px; }
.human-panel { background: rgba(45, 24, 11, 0.6); }
@media (max-width: 980px) {
  .info-grid { grid-template-columns: 1fr; }
  .topbar, .auction-panel { flex-direction: column; align-items: flex-start; }
  .auction-controls { min-width: 100%; width: 100%; }
  .table {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "north north"
      "west east"
      "trick trick"
      "southeast southeast"
      "south south";
  }
  .card-column { flex-direction: row; justify-content: flex-start; min-height: auto; overflow-x: auto; }
  .top-seat, .southeast-seat { width: 100%; }
}
@media (max-width: 720px) {
  .table-shell { width: min(100vw - 10px, 100%); padding-top: 8px; }
  .panel, .table { padding: 12px; border-radius: 20px; }
  h1 { font-size: clamp(32px, 12vw, 50px); }
  .table { grid-template-columns: 1fr; grid-template-areas: "north" "west" "east" "trick" "southeast" "south"; }
  .opponent-seat { padding: 10px 12px; }
  .card-row, .card-column { overflow-x: auto; padding-bottom: 6px; }
  .card-row .card, .card-back { flex: 0 0 auto; }
  .card, .trick-card { width: 74px; height: 110px; padding: 8px; }
  .trick-slot { width: 80px; height: 114px; }
  .rank { font-size: 20px; }
  .label-mini, .touch-hint, .subtitle, .rules-note, .contract-strip span { font-size: 14px; }
}
