/* SPADES — BlakCade table. Premium felt + gold, animated DOM cards, responsive. */
:root {
  --felt-1: #1f6a44;
  --felt-2: #124a2d;
  --felt-3: #0c331f;
  --gold: #e8a54b;
  --gold-soft: #d9982f;
  --ink: #0b1a12;
  --line: #1f3d2c;
  --panel: #10241a;
  --panel-2: #16362450;
  /* Fluid card width drives the whole layout. */
  --card-w: clamp(46px, 12.5vw, 64px);
  --card-h: calc(var(--card-w) * 1.4);
}

* { box-sizing: border-box; }

.spades-body {
  background:
    radial-gradient(1200px 700px at 50% -10%, #143a26 0%, #0b1a12 60%, #071009 100%);
  color: #eaf2ec;
  -webkit-tap-highlight-color: transparent;
}

#spades-root {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 10px max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: calc(100dvh - 50px);
  overflow-x: hidden;
}
/* Flex children must be allowed to shrink below their content width, or the
   no-wrap hand fan forces the whole column wider than the viewport. */
.score-bar, .table, .you-row, .my-hand { min-width: 0; }
.card-svg { display: block; width: 100%; height: 100%; }

/* ── Scoreboard ─────────────────────────────────────────────────────────── */
.score-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #14301f, #10241a);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.team-score { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.team-score b { font-size: 11px; color: #9fc9ac; font-weight: 700; letter-spacing: 0.2px; }
.team-score .pts {
  font-size: clamp(20px, 6vw, 26px); font-weight: 800; color: #fff;
  transition: transform 0.25s ease, color 0.25s ease;
}
.team-score .pts.bump { transform: scale(1.25); color: var(--gold); }
.team-score i { font-size: 10px; color: #7c9c86; font-style: normal; }
.team-score i .books { color: #cbe6d3; font-weight: 700; }
.team-score.them { text-align: right; align-items: flex-end; }
.round-info { display: flex; flex-direction: column; align-items: center; gap: 2px; white-space: nowrap; }
.hand-no { font-size: 10px; color: #86a690; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.mode-pill {
  padding: 2px 8px;
  border: 1px solid rgba(232, 165, 75, 0.42);
  border-radius: 999px;
  background: rgba(232, 165, 75, 0.1);
  color: #f4c579;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.broken { font-size: 11px; font-weight: 800; color: #6e8a78; letter-spacing: 0.3px; }
.broken.on { color: var(--gold); text-shadow: 0 0 10px rgba(232, 165, 75, 0.5); }
.to-win { font-size: 10px; color: #6e8a78; }

/* ── Table + felt ───────────────────────────────────────────────────────── */
.table {
  position: relative;
  flex: 1;
  min-height: 300px;
  border-radius: 22px;
  padding: 10px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 78% 62% at 50% 44%, var(--felt-1) 0%, var(--felt-2) 55%, var(--felt-3) 100%);
  border: 3px solid #23130a;
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.55),
    inset 0 0 0 6px rgba(232, 165, 75, 0.14),
    0 10px 30px rgba(0, 0, 0, 0.45);
}
.felt-glow {
  position: absolute; inset: 14px; border-radius: 16px; pointer-events: none;
  background: radial-gradient(ellipse 50% 40% at 50% 46%, rgba(232, 165, 75, 0.10), transparent 70%);
}

.card-table {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(275px, 40vw, 380px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
}
.wood-table {
  position: absolute;
  inset: 6%;
  z-index: 2; /* sits in front of the far seats (z1), behind South (z3) */
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 42% 38%, rgba(255,255,255,0.10), transparent 28%),
    repeating-radial-gradient(ellipse at center, rgba(255,255,255,0.025) 0 3px, transparent 4px 11px),
    linear-gradient(135deg, #432819, #17100c 58%, #0d0907);
  border: 5px solid #130b06;
  box-shadow:
    inset 0 0 0 2px rgba(232, 165, 75, 0.18),
    inset 0 18px 30px rgba(255,255,255,0.05),
    inset 0 -22px 32px rgba(0,0,0,0.45),
    0 18px 36px rgba(0,0,0,0.42);
}
.wood-table::after {
  content: '';
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  border: 1px solid rgba(232, 165, 75, 0.16);
}
.table-people {
  position: absolute;
  inset: 0;
  /* No stacking context here, so each seat's z-index competes with the wood
     table: the three far seats (N/W/E) sit behind the rim, South in front. */
}
.table-person {
  --skin: #c68642;
  --shirt: #284f7a;
  --shirt-d: #18324f;
  --chair: #25170f;
  position: absolute;
  width: clamp(66px, 9vw, 90px);
  height: clamp(72px, 10vw, 98px);
  transform-origin: center;
  opacity: 0.98;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.34));
}
.table-person.team0 { --shirt: #7a4f23; --shirt-d: #4a3017; }
.table-person.team1 { --shirt: #285f7a; --shirt-d: #16394d; --skin: #e0ac69; }
/* Seats sit at the wood rim: the three far seats (N/W/E) are z1 so the wood
   (z2) tucks their lower half — head + torso clear the rim. South is the near
   seat (z3), fully in front. Offsets are tuned so each body straddles the rim. */
.person-north { top: -15%; left: 50%; transform: translateX(-50%); z-index: 1; }
.person-south { bottom: -11%; left: 50%; transform: translateX(-50%); z-index: 3; }
.person-west  { left: -14%; top: 50%; transform: translateY(-50%); z-index: 1; }
.person-east  { right: -14%; top: 50%; transform: translateY(-50%); z-index: 1; }

/* One chair per seat, on the OUTER side (away from center), behind the avatar —
   so every player reads as seated in a chair around the table. */
.chair {
  position: absolute;
  z-index: 1;
  border-radius: 16px;
  background: linear-gradient(180deg, #3c2417, var(--chair));
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.08), 0 5px 9px rgba(0,0,0,0.36);
}
.person-north .chair { left: 15%; right: 15%; top: -6%; height: 56%; border-radius: 16px 16px 9px 9px; }
.person-south .chair { left: 15%; right: 15%; bottom: -4%; height: 56%; border-radius: 9px 9px 16px 16px; }
.person-west  .chair { top: 15%; bottom: 15%; left: -6%; width: 56%; border-radius: 16px 9px 9px 16px; }
.person-east  .chair { top: 15%; bottom: 15%; right: -6%; width: 56%; border-radius: 9px 16px 16px 9px; }

.person-shadow {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 2%;
  height: 18%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.24);
  z-index: 0;
}
.person-canvas {
  position: absolute;
  inset: -5% -3% 0;
  width: 106%;
  height: 100%;
  z-index: 2;
}
/* The old separate chair-back / armrest pieces folded into .chair. */
.chair-back { display: none; }
.dealer-token {
  position: absolute;
  right: 9%;
  top: 14%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff2c2;
  color: #0b1a12;
  font: 900 10px/1 ui-monospace, monospace;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
}
.table-person.active {
  opacity: 1;
  filter: drop-shadow(0 0 14px rgba(232, 165, 75, 0.48)) drop-shadow(0 8px 12px rgba(0, 0, 0, 0.34));
}
.table-person.active .person-canvas {
  filter: drop-shadow(0 0 10px rgba(232, 165, 75, 0.45));
}

/* ── Seats + chips ──────────────────────────────────────────────────────── */
.seat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 2; }
.seat-north { top: 8px; left: 50%; transform: translateX(-50%); }
.seat-west  { left: 6px; top: 46%; transform: translateY(-50%); }
.seat-east  { right: 6px; top: 46%; transform: translateY(-50%); }

.seat-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(8, 20, 13, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  backdrop-filter: blur(3px);
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.seat-chip.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 16px rgba(232, 165, 75, 0.5);
  animation: chip-pulse 1.4s ease-in-out infinite;
}
@keyframes chip-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--gold), 0 0 12px rgba(232, 165, 75, 0.35); }
  50% { box-shadow: 0 0 0 1px var(--gold), 0 0 22px rgba(232, 165, 75, 0.7); }
}
.chip-av {
  position: relative;
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px; color: #0b1a12;
  background: radial-gradient(circle at 35% 30%, #f0d090, var(--gold-soft));
}
.seat-chip.team1 .chip-av { background: radial-gradient(circle at 35% 30%, #9fd7ff, #4a90c8); color: #06121c; }
.deal-btn {
  position: absolute; bottom: -3px; right: -4px;
  background: #fff; color: #0b1a12; font-size: 8px; font-weight: 900; font-style: normal;
  width: 13px; height: 13px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.chip-body { display: flex; flex-direction: column; line-height: 1.1; }
.chip-name { font-size: 11px; font-weight: 700; color: #eaf2ec; }
.chip-stat { font-size: 9.5px; color: #8fb59c; }
.chip-stat b { color: #fff; font-weight: 800; }
.chip-stat em { font-style: normal; color: #6f9280; font-size: 8.5px; }
.seat-chip.is-nil .chip-name::after {
  content: 'NIL'; margin-left: 5px; font-size: 8px; font-weight: 900;
  color: var(--gold); border: 1px solid var(--gold); border-radius: 4px; padding: 0 3px;
}

/* opponent mini fans */
.opp-fan { display: flex; }
.mini-back { width: 18px; height: 25px; margin-left: -12px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
.mini-back:first-child { margin-left: 0; }
.seat-west .opp-fan, .seat-east .opp-fan { }

/* ── Trick area ─────────────────────────────────────────────────────────── */
.trick-area { display: grid; grid-template-rows: auto auto auto; place-items: center; gap: 6px; z-index: 4; }
.trick-mid { display: flex; gap: clamp(44px, 16vw, 76px); }
.trick-slot {
  width: calc(var(--card-w) * 0.86); height: calc(var(--card-h) * 0.86);
  border-radius: 8px;
  display: grid; place-items: center;
}
.trick-slot:empty {
  border: 1px dashed rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.08);
}
.tcard { width: 100%; height: 100%; }
.tcard .card-svg { filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
.tcard.won { animation: win-flash 0.34s ease; }
@keyframes win-flash {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(232, 165, 75, 0)); }
  50% { transform: scale(1.14) translateY(-3px); filter: drop-shadow(0 0 14px rgba(232, 165, 75, 0.9)); }
  100% { transform: scale(1); }
}

/* fly-in from a seat toward the center */
.tcard.from-south { animation: fly-south 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.tcard.from-north { animation: fly-north 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.tcard.from-west  { animation: fly-west 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.tcard.from-east  { animation: fly-east 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes fly-south { from { transform: translateY(80px) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fly-north { from { transform: translateY(-80px) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fly-west  { from { transform: translateX(-90px) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fly-east  { from { transform: translateX(90px) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }

/* collect the pile toward the winner */
.tcard.collecting { transition: transform 0.5s cubic-bezier(0.5, 0, 0.9, 0.4), opacity 0.5s ease; }
.tcard.collecting.to-south { transform: translateY(160px) scale(0.6) rotate(8deg); opacity: 0; }
.tcard.collecting.to-north { transform: translateY(-160px) scale(0.6) rotate(-8deg); opacity: 0; }
.tcard.collecting.to-west  { transform: translateX(-200px) scale(0.6) rotate(-10deg); opacity: 0; }
.tcard.collecting.to-east  { transform: translateX(200px) scale(0.6) rotate(10deg); opacity: 0; }

/* ── Your row: chip + status ────────────────────────────────────────────── */
.you-row { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 30px; }
.seat-slot.you .seat-chip { padding: 3px 10px 3px 3px; }
.status-line { text-align: center; font-size: 13px; color: #d6ece0; font-weight: 600; min-height: 16px; }

/* ── Your hand — a fan ──────────────────────────────────────────────────── */
.my-hand {
  display: flex; justify-content: center; align-items: flex-end;
  padding: 4px 6px 2px; flex-wrap: nowrap; min-height: var(--card-h);
}
.hand-card {
  width: var(--card-w); height: var(--card-h);
  margin-left: calc(var(--card-w) * -0.36);
  padding: 0; border: none; background: none; cursor: pointer;
  border-radius: 8px;
  transition: transform 0.14s ease, filter 0.14s ease;
  transform-origin: bottom center;
}
.hand-card:first-child { margin-left: 0; }
.hand-card .card-svg { filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5)); }
.hand-card.playable { cursor: pointer; }
.hand-card.playable:hover,
.hand-card.playable:focus-visible { transform: translateY(-16px) scale(1.04); z-index: 6; outline: none; }
.hand-card.dim { filter: grayscale(0.55) brightness(0.6); cursor: default; }
.my-hand.your-turn .hand-card.playable { animation: card-ready 2.2s ease-in-out infinite; }
@keyframes card-ready {
  0%, 92%, 100% { transform: translateY(0); }
  96% { transform: translateY(-5px); }
}
.my-hand.your-turn .hand-card.playable:hover { animation: none; }
.hand-card.deal-in { animation: deal-in 0.36s ease both; }
@keyframes deal-in {
  from { transform: translateY(40px) rotate(-6deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ── Overlay + modals ───────────────────────────────────────────────────── */
#spades-overlay { position: fixed; inset: 0; pointer-events: none; }
#spades-overlay:not(:empty) {
  display: grid; place-items: center; pointer-events: auto;
  background: rgba(4, 10, 7, 0.74); z-index: 40; padding: 16px;
  animation: fade-in 0.2s ease;
  backdrop-filter: blur(2px);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: linear-gradient(180deg, #143024, #0f2117);
  border: 1px solid #2a5540; border-radius: 18px;
  padding: 22px 20px; max-width: 380px; width: 100%; text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: modal-pop 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modal-pop { from { transform: translateY(14px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 6px; font-size: 20px; color: #fff; letter-spacing: 0.2px; }
.modal-sub { margin: 0 0 15px; font-size: 12.5px; color: #9fc9ac; line-height: 1.5; }
.modal-sub b { color: var(--gold); }

.bid-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 10px; }
.bid-btn {
  border: 1px solid #2a5540; background: var(--panel-2); color: #eaf2ec;
  font: 800 15px ui-monospace, monospace; padding: 11px 0; border-radius: 9px; cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease, border-color 0.12s ease;
}
.bid-btn:hover { background: #1e4a33; border-color: #3a7a56; transform: translateY(-1px); }
.bid-btn:active { transform: translateY(0) scale(0.96); }
.bid-btn.nil {
  width: 100%; color: var(--gold); border-color: var(--gold);
  font-size: 15px; letter-spacing: 2px; background: rgba(232, 165, 75, 0.08);
}
.bid-btn.nil:hover { background: rgba(232, 165, 75, 0.18); }
.bid-btn.wide {
  width: 100%; margin-top: 16px; background: linear-gradient(180deg, #f0b45f, var(--gold-soft));
  color: #241503; border: none; font-size: 15px; padding: 13px 0; font-weight: 800;
  box-shadow: 0 6px 18px rgba(232, 165, 75, 0.3);
}
.bid-btn.wide:hover { filter: brightness(1.06); transform: translateY(-1px); }
.bid-btn.ghost.wide {
  margin-top: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: #dcebe1;
  border: 1px solid rgba(232, 165, 75, 0.35);
  box-shadow: none;
}
.bid-btn.ghost.wide:hover { background: rgba(232, 165, 75, 0.12); }

.score-lines { text-align: left; margin: 6px 0 12px; }
.score-lines p {
  margin: 0 0 7px; font-size: 12.5px; line-height: 1.45; padding-left: 14px; position: relative;
}
.score-lines p::before { content: '•'; position: absolute; left: 2px; }
.score-lines p.good { color: #b6e6c5; }
.score-lines p.good::before { color: #57c97e; }
.score-lines p.bad { color: #e6b6b6; }
.score-lines p.bad::before { color: #d86a6a; }
.tally { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; font-size: 13px; color: #9fc9ac; }
.tally .lead { color: #fff; }
.tally b { color: #fff; font-size: 17px; margin-left: 5px; }
.coin-line { color: var(--gold); font-weight: 800; margin: 12px 0 0; font-size: 15px; animation: coin-pop 0.4s ease 0.15s both; }
@keyframes coin-pop { from { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.15); } to { transform: scale(1); opacity: 1; } }
.winner { margin: 14px 0 0; font-size: 15px; font-weight: 800; color: #fff; }

/* Mode select */
.mode-select {
  min-height: calc(100dvh - 66px);
  display: grid;
  place-items: center;
  padding: 16px 0;
}
.mode-panel {
  width: min(100%, 560px);
  padding: 20px;
  border: 1px solid rgba(232, 165, 75, 0.28);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(20, 48, 31, 0.94), rgba(10, 24, 16, 0.94));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.mode-kicker {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}
.mode-panel h2 {
  margin: 4px 0 16px;
  color: #fff;
  font-size: clamp(24px, 7vw, 38px);
  line-height: 1;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.mode-card {
  min-height: 112px;
  padding: 14px;
  border: 1px solid rgba(159, 201, 172, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: #eaf2ec;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.mode-card:hover, .mode-card:focus-visible {
  border-color: var(--gold);
  background: rgba(232, 165, 75, 0.12);
  transform: translateY(-1px);
  outline: none;
}
.mode-card strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font: 900 16px ui-monospace, monospace;
  letter-spacing: 0.3px;
}
.mode-card span {
  display: block;
  color: #a9c9b3;
  font-size: 12.5px;
  line-height: 1.4;
}

/* Bidding: keep the hand in full view. The scrim darkens the top (where the
   picker sits) and fades to clear over the hand so you bid on what you see. */
.hand-card.viewing { cursor: default; }
#spades-overlay.bidding {
  background: linear-gradient(180deg, rgba(4, 10, 7, 0.62) 0%, rgba(4, 10, 7, 0.3) 46%, rgba(4, 10, 7, 0) 70%);
  align-items: flex-start;
  padding-top: 58px;
  backdrop-filter: none;
}
#spades-overlay.bidding .bid-modal { box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(232, 165, 75, 0.25); }

/* How-to-play affordance in the scoreboard */
.help-btn {
  background: none; border: none; color: var(--gold); font: inherit; font-size: 10px;
  cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; opacity: 0.85;
}
.help-btn:hover { opacity: 1; }

/* First-run tutorial */
.modal.tutorial { max-width: 350px; }
.tut-badge {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; font-size: 25px; color: #241503;
  background: radial-gradient(circle at 35% 30%, #f0d090, var(--gold-soft));
  box-shadow: 0 5px 16px rgba(232, 165, 75, 0.42);
}
.tut-body { font-size: 13px; color: #cfe6d6; line-height: 1.6; margin: 0 0 16px; }
.tut-body b { color: var(--gold); }
.tut-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.tut-dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); transition: background 0.2s ease; }
.tut-dots span.on { background: var(--gold); }
.tut-actions { display: flex; align-items: center; gap: 10px; }
.tut-actions .bid-btn.wide { margin-top: 0; flex: 1; }
.tut-skip {
  background: none; border: none; color: #7c9c86; font-size: 12px; cursor: pointer;
  padding: 10px 8px; min-width: 48px;
}
.tut-skip:hover { color: #cfe6d6; }

/* ── Responsive: portrait / small phones ────────────────────────────────── */
@media (max-width: 560px) {
  :root { --card-w: clamp(42px, 15vw, 58px); }
  .mode-select { align-items: stretch; padding-top: 8px; }
  .mode-panel { padding: 16px; border-radius: 14px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 86px; }
  .table { min-height: 250px; border-radius: 18px; }
  .trick-mid { gap: clamp(36px, 14vw, 56px); }
  .chip-name { font-size: 10px; }
  .seat-chip { padding: 3px 8px 3px 3px; gap: 5px; }
  .chip-av { width: 23px; height: 23px; flex-basis: 23px; font-size: 11px; }
  .mini-back { width: 15px; height: 21px; margin-left: -10px; }
  .score-bar { padding: 7px 10px; border-radius: 12px; }
}
@media (max-width: 380px) {
  .hand-card { margin-left: calc(var(--card-w) * -0.44); }
  /* Collapse side chips to just the avatar so every seat still reads. */
  .seat-west .chip-body, .seat-east .chip-body { display: none; }
  .seat-west .seat-chip, .seat-east .seat-chip { padding: 3px; }
}

/* ── Landscape phones: keep the table wide and short ────────────────────── */
@media (max-height: 480px) and (orientation: landscape) {
  #spades-root { min-height: calc(100dvh - 40px); }
  .table { min-height: 180px; }
  :root { --card-w: clamp(40px, 7vw, 56px); }
  .my-hand { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tcard, .hand-card, .seat-chip, .pts, .modal, #spades-overlay, .coin-line { animation: none !important; transition: none !important; }
}
