:root {
  --bg: #09111f;
  --panel: rgba(10, 19, 37, 0.84);
  --line: rgba(126, 203, 255, 0.18);
  --ink: #f4f8ff;
  --muted: rgba(244, 248, 255, 0.72);
  --cyan: #7ecbff;
  --gold: #ffd36a;
  --red: #c54b62;
  --dark: #1c1920;
}
* { 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(126,203,255,0.18), transparent 24%), linear-gradient(180deg, #08101d 0%, #02050c 100%);
}
.game-shell { width: min(1240px, calc(100vw - 18px)); margin: 0 auto; padding: 14px 0 24px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
}
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.eyebrow, .label { margin: 0; text-transform: uppercase; letter-spacing: 0.18em; color: var(--cyan); font-size: 12px; }
h1 { margin: 8px 0; font-family: "Syne", sans-serif; font-size: clamp(36px, 8vw, 66px); line-height: 0.95; }
.subtitle, .rules-note { margin: 0; color: var(--muted); }
.rules-block { display: grid; gap: 10px; }
.rules-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.back-link, button {
  border-radius: 999px;
  border: 1px solid var(--line);
}
.back-link {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
}
.stats-grid, .lower-row, .arc-row, .actions, .seat-head { display: flex; gap: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 14px 0; }
.notice { margin-bottom: 14px; }
#status { margin: 0 0 10px; font-size: 18px; }
select, button { padding: 12px 16px; font: inherit; }
button {
  cursor: pointer;
  border: 0;
  background: linear-gradient(180deg, #ffe08a, #e9aa45);
  color: #1f1607;
  font-weight: 700;
}
button.ghost { background: rgba(255,255,255,0.09); color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: 0.48; cursor: not-allowed; }
.table { background: radial-gradient(circle at center, #1f6f56 0%, #194c3c 55%, #0d2a20 100%); }
.top-seat, .human-seat, .side-seat { min-width: 0; }
.seat-head { justify-content: space-between; margin-bottom: 10px; color: var(--muted); }
.back-row, .back-column, .player-row { display: flex; gap: 8px; }
.back-column { flex-direction: column; align-items: center; justify-content: center; min-height: 220px; }
.arc-row { align-items: stretch; margin: 10px 0; }
.side-seat { width: 126px; }
.center-play { flex: 1; min-width: 0; }
.lower-row { align-items: end; }
.human-seat { flex: 1.4; }
.trick-grid {
  min-height: 310px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas:
    ". north ."
    "west . east"
    ". south .";
  gap: 10px;
  align-items: center;
  justify-items: center;
}
#slot-0 { grid-area: north; }
#slot-1 { grid-area: east; }
#slot-2 { grid-area: south; }
#slot-3 { grid-area: west; }
.trick-slot {
  width: 94px;
  height: 134px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,0.2);
  display: grid;
  place-items: center;
}
.card, .trick-card, .card-back {
  border-radius: 16px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.22);
}
.card, .trick-card {
  width: 88px;
  height: 128px;
  background: #fff7ea;
  color: var(--dark);
  padding: 10px;
  border: 1px solid rgba(0,0,0,0.14);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-back {
  width: 56px;
  height: 82px;
  background: repeating-linear-gradient(45deg, #204984 0 8px, #2e67b5 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: 28px; font-weight: 700; }
.suit { font-size: 28px; align-self: flex-end; }
.hearts, .diamonds { color: var(--red); }
.spades, .clubs { color: var(--dark); }
.actions { justify-content: center; margin-top: 8px; }
.scoreboard { margin-top: 14px; }
#scoreboard { display: grid; gap: 8px; }
.score-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
}
@media (max-width: 980px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar, .arc-row, .lower-row { flex-direction: column; }
  .side-seat { width: auto; }
  .back-column { flex-direction: row; justify-content: flex-start; min-height: auto; overflow-x: auto; }
}
@media (max-width: 720px) {
  .game-shell { width: min(100vw - 10px, 100%); padding-top: 8px; }
  .panel { padding: 14px; border-radius: 20px; }
  h1 { font-size: clamp(30px, 12vw, 46px); }
  .stats-grid { grid-template-columns: 1fr; }
  .player-row, .back-row, .back-column { overflow-x: auto; padding-bottom: 6px; }
  .player-row .card, .back-row .card-back, .back-column .card-back { flex: 0 0 auto; }
  .card, .trick-card { width: 74px; height: 108px; padding: 8px; }
  .trick-slot { width: 80px; height: 114px; }
  .rank, .suit { font-size: 24px; }
}
