:root {
  --bg-top: #0c1634;
  --bg-mid: #172850;
  --bg-bottom: #261f4f;
  --accent: #ff8a3d;
  --accent-2: #ffd166;
  --mint: #59f4c5;
  --danger: #ff5d8f;
  --text: #f5f8ff;
  --muted: #aac0f0;
  --panel: rgba(17, 27, 58, 0.75);
  --panel-border: rgba(255, 255, 255, 0.15);
  --felt: #257f6e;
  --felt-dark: #1f6459;
  --felt-edge: #133f3a;
  --card-bg: #ffffff;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);

  --font-title: 'Cinzel', serif;
  --font-ui: 'Outfit', sans-serif;

  /* ── Type scale ── */
  --fs-2xs:  10px;
  --fs-xs:   11px;
  --fs-sm:   12px;
  --fs-base: 13px;
  --fs-md:   14px;
  --fs-lg:   16px;
  --fs-xl:   20px;
  --fs-2xl:  24px;
  --fs-3xl:  34px;
  --fs-hero: 38px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; }
body {
  overflow-x: hidden;
  overflow-y: auto;
  font-family: var(--font-ui);
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-top) 0%, var(--bg-mid) 55%, var(--bg-bottom) 100%);
}
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: flex; animation: screenFadeIn 320ms ease both; }
@keyframes screenFadeIn { from { opacity: 0; } to { opacity: 1; } }
.screen.active.scrollable { position: relative; inset: auto; min-height: 100vh; overflow-y: auto; }

#lobby {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 0;
}
#waitingRoom {
  align-items: flex-start;
  justify-content: center;
  padding: 12px 0 24px;
}
.lobby-bg, .waiting-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(89, 244, 197, 0.22) 0%, transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(255, 138, 61, 0.18) 0%, transparent 42%),
    radial-gradient(circle at 60% 90%, rgba(255, 93, 143, 0.12) 0%, transparent 38%);
}
.lobby-header {
  position: relative;
  top: auto;
  width: min(980px, 96vw);
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  z-index: 2;
}
.logo { text-align: center; }
.logo-suit { font-size: 36px; color: var(--accent-2); }
.logo-text { font-family: var(--font-title); font-size: 30px; letter-spacing: 0.08em; }
.logo-sub { color: var(--muted); font-size: var(--fs-sm); letter-spacing: 0.14em; text-transform: uppercase; }

.lobby-main { position: relative; z-index: 2; width: min(560px, 94vw); }
.lobby-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  padding: 16px 20px;
}
.lobby-panel.wide { max-width: min(700px, 94vw); max-height: calc(100vh - 130px); overflow-y: auto; scrollbar-width: none; }
.lobby-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.lobby-col-left { display: flex; flex-direction: column; gap: 10px; }
.lobby-col-right { display: flex; flex-direction: column; gap: 12px; border-left: 1px solid var(--panel-border); padding-left: 28px; }
.lobby-col-left .panel-sub,
.lobby-col-left .game-grid,
.lobby-col-left .name-row,
.lobby-col-left .rules-toggle-row { margin-bottom: 0; }
.lobby-col-right .avatar-picker { margin-bottom: 0; }

/* ── Lobby step wizard ── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 4px;
}
.step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.22);
  flex-shrink: 0;
  transition: background 260ms, border-color 260ms, box-shadow 260ms;
}
.step-dot.active {
  background: var(--mint);
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(89, 244, 197, 0.22);
}
.step-dot.done { background: rgba(89, 244, 197, 0.50); border-color: var(--mint); }
.step-line {
  flex: 1; max-width: 90px; height: 2px;
  background: rgba(255,255,255,0.18);
  transition: background 260ms;
}
.step-line.done { background: var(--mint); }
.step-label-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
}
.step-label {
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  flex: 1;
  text-align: center;
  transition: color 260ms;
}
.step-label.active { color: var(--mint); font-weight: 600; }
.step-label.done   { color: rgba(89, 244, 197, 0.60); }
.lobby-step { min-height: 0; }
@keyframes stepForward { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes stepBack    { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
.lobby-step.anim-forward { animation: stepForward 240ms cubic-bezier(0.2, 0.9, 0.4, 1) both; }
.lobby-step.anim-back    { animation: stepBack    240ms cubic-bezier(0.2, 0.9, 0.4, 1) both; }
.step-nav { display: flex; gap: 10px; margin-top: 18px; }
.step-nav-split { justify-content: space-between; }
.step-nav .btn-primary { flex: 1; }
.step-nav .btn-ghost   { flex-shrink: 0; }
input.input-error { border-color: rgba(255, 93, 143, 0.80); box-shadow: 0 0 0 2px rgba(255, 93, 143, 0.22); }
.panel-title { font-family: var(--font-title); color: var(--accent-2); font-size: var(--fs-2xl); margin-bottom: 4px; }
.panel-sub { color: var(--muted); margin-bottom: 12px; font-size: var(--fs-base); }

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.game-grid.single { grid-template-columns: 1fr; max-width: 360px; }

.avatar-picker { margin-bottom: 10px; }
.avatar-picker label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.avatar-btn {
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255,255,255,0.07);
  cursor: pointer;
  padding: 5px 3px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.avatar-btn:hover {
  background: rgba(255,255,255,0.13);
  transform: translateY(-2px);
}
.avatar-btn img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.avatar-btn span {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.avatar-btn.selected {
  border-color: var(--accent-2);
  background: rgba(255,209,102,0.1);
  box-shadow: 0 0 0 2px rgba(255,209,102,0.25);
}
.avatar-btn.selected span { color: var(--accent-2); }

.rules-toggle-row { margin-bottom: 10px; }
.game-tile {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 20px 16px;
  text-align: left;
  cursor: pointer;
  transition: background 140ms, border-color 140ms, transform 130ms, box-shadow 130ms;
}
.game-tile:hover:not(:disabled) { background: rgba(255,255,255,0.10); transform: translateY(-2px); }
.game-tile.selected { border-color: var(--mint); box-shadow: 0 0 0 2px rgba(89, 244, 197, 0.22); background: rgba(89, 244, 197, 0.07); }
.game-tile:disabled { opacity: 0.55; cursor: default; }
.game-icon { font-size: 38px; margin-bottom: 6px; line-height: 1; }
.game-title { font-size: 20px; font-weight: 700; }
.game-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.game-status { margin-top: 8px; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.08em; }
.game-status.live { color: var(--mint); }
.game-status.soon { color: var(--accent); }

.rules-panel {
  margin-bottom: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.18);
}
.rules-panel h3 { color: var(--accent-2); margin-bottom: 8px; }
.rules-panel ul { padding-left: 18px; display: grid; gap: 5px; font-size: var(--fs-md); color: #dbe5ff; }

.name-row { margin-bottom: 8px; }
.name-row label { font-size: var(--fs-sm); color: var(--muted); display: block; margin-bottom: 4px; letter-spacing: 0.08em; text-transform: uppercase; }
input[type="text"] {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  padding: 12px;
  font-size: var(--fs-lg);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.lobby-actions { display: grid; gap: 10px; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.divider { color: var(--muted); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; text-align: center; }

.btn {
  border: 0;
  border-radius: 10px;
  font-size: var(--fs-lg);
  font-weight: 700;
  padding: 12px 18px;
  cursor: pointer;
}
.btn-primary { background: linear-gradient(135deg, #ff9840 0%, var(--accent) 100%); color: #fff; font-weight: 700; }
.btn-secondary { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--panel-border); }

.error-msg {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 93, 143, 0.6);
  background: rgba(255, 93, 143, 0.18);
}

.waiting-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 94vw);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}
.waiting-panel h2 { font-family: var(--font-title); color: var(--accent-2); font-size: var(--fs-3xl); }
.room-code-display { margin: 10px 0 18px; font-size: var(--fs-xl); color: var(--muted); }
.room-code-display strong { color: var(--text); letter-spacing: 0.2em; }
.btn-copy { border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.seats-grid { display: grid; gap: 12px; justify-items: center; margin-bottom: 16px; }
.seats-middle-row { display: grid; grid-template-columns: 1fr 80px 1fr; align-items: center; gap: 16px; }
.seat-slot { display: grid; justify-items: center; gap: 4px; }
.seat-direction { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.table-center-icon { font-size: 44px; color: rgba(255, 255, 255, 0.28); }
.seat-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  display: grid;
  place-items: center;
  font-size: 13px;
  padding: 8px;
  text-align: center;
}
.seat-avatar.filled { border-style: solid; background: rgba(255, 255, 255, 0.12); }
.seat-avatar.bot { border-color: #66e0ff; color: #66e0ff; }
.seat-avatar.you { border-color: var(--accent-2); color: var(--accent-2); }

.waiting-actions { display: flex; justify-content: center; gap: 12px; }

#gameTable { display: none; flex-direction: row; background: transparent; height: 100vh; overflow: hidden; }
#gameTable.active { display: flex; }

/* ── Two-column layout ──────────────────────────────────────── */
.game-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.game-sidebar {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
  background: rgba(8, 16, 39, 0.55);
  border-left: 1px solid var(--panel-border);
}

.right-panel {
  flex-shrink: 0;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: rgba(8, 16, 39, 0.9);
  padding: 12px 14px;
}
.rp-section-title {
  font-size: var(--fs-md);
  color: var(--accent-2);
  font-weight: 700;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rp-divider {
  border: none;
  border-top: 1px solid var(--panel-border);
  margin: 8px 0;
}
.round-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: var(--fs-md);
  color: var(--muted);
}
.round-item span:last-child { color: var(--text); font-weight: 700; }

.hud-scores {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: rgba(8, 16, 39, 0.86);
  padding: 10px 10px;
}
.score-team { display: grid; justify-items: center; }
.team-label { font-size: var(--fs-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.team-score { font-size: var(--fs-hero); line-height: 1; font-weight: 700; font-family: var(--font-title); color: var(--accent-2); }
.team-bags { font-size: var(--fs-lg); color: var(--muted); }
.score-divider { font-size: var(--fs-xl); color: var(--mint); font-weight: 700; }
.hud-meta { display: grid; gap: 5px; justify-items: end; }
.badge {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 10px;
  font-size: var(--fs-sm);
  background: rgba(255, 255, 255, 0.08);
}

.scorecard-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: var(--fs-md); color: var(--muted); }
.scorecard-row span:last-child { color: var(--text); font-weight: 600; text-align: right; }

.judgement-guide {
  border-top: 1px solid var(--panel-border);
  margin-top: 8px;
  padding-top: 10px;
}
.guide-title {
  color: var(--mint);
  font-size: var(--fs-md);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 700;
}
.guide-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  font-size: var(--fs-md);
  color: var(--muted);
}
.guide-row span:last-child {
  color: var(--text);
  font-weight: 600;
}
.guide-note {
  margin-top: 8px;
  font-size: var(--fs-sm);
  color: #dce8ff;
  opacity: 0.9;
}

.table-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 0;
  min-height: 0;
}
.table-scene {
  display: grid;
  grid-template-areas:
    ". north ."
    "west table east"
    ". south .";
  grid-template-columns: 175px minmax(0, 560px) 175px;
  grid-template-rows: auto auto auto;
  align-items: center;
  justify-items: center;
  gap: 4px;
}
.felt-table {
  grid-area: table;
  width: 100%;
  height: min(420px, 50vh);
  border-radius: 220px;
  background: radial-gradient(ellipse at 38% 38%, #2d9175 0%, #1e7258 42%, #145040 78%, #0d3a2e 100%);
  border: 10px solid #0a2820;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.09), 0 0 0 6px rgba(0,0,0,0.35), var(--shadow);
  position: relative;
}

.player-zone { display: flex; flex-direction: row; align-items: center; gap: 8px; z-index: 20; }
.zone-north { grid-area: north; }
.zone-south { grid-area: south; }
.zone-west  { grid-area: west; }
.zone-east  { grid-area: east; }
.player-left { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.player-right { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.pname { font-size: var(--fs-base); font-family: var(--font-title); max-width: 72px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbid, .ptricks { font-size: var(--fs-base); color: #daf7f1; }
.player-illustration {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 34px;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.85), rgba(255,255,255,0.22));
  border: 2px solid rgba(255,255,255,0.45);
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
  overflow: hidden;
}
.player-illustration img {
  width: 110%;
  height: 110%;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
}

/* Team identity rings: South/North = allies (mint), West/East = opponents (danger) */
.zone-north .player-illustration,
.zone-south .player-illustration { border-color: rgba(89, 244, 197, 0.60); }
.zone-west .player-illustration,
.zone-east .player-illustration  { border-color: rgba(255, 93, 143, 0.50); }
.turn-clock {
  --progress: 1;
  --hand-angle: 0deg;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  position: relative;
  background: conic-gradient(#ffd166 calc(var(--progress) * 1turn), rgba(255,255,255,0.2) 0);
  border: 2px solid rgba(255,255,255,0.4);
  box-shadow: inset 0 0 12px rgba(0,0,0,0.25);
}
.clock-hand {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 14px;
  background: #fff3cf;
  transform-origin: bottom center;
  transform: translate(-50%, -100%) rotate(var(--hand-angle));
  border-radius: 2px;
}
.clock-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  background: #fff3cf;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.turn-clock.active { box-shadow: 0 0 0 2px rgba(255,223,128,0.3), inset 0 0 12px rgba(0,0,0,0.25); }
/* Smaller clocks on mobile */
.m-clock      { width: 28px; height: 28px; }
.m-clock-small{ width: 18px; height: 18px; }
.m-clock      .clock-hand { height: 9px; }
.m-clock-small .clock-hand { height: 5px; width: 1.5px; }
.m-clock-small .clock-dot  { width: 4px; height: 4px; }
.your-turn-badge {
  margin-top: 3px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid rgba(255, 209, 102, 0.8);
  color: var(--accent-2);
}

.opponent-hand { position: absolute; display: flex; pointer-events: none; }
.hand-north { top: 14px; left: 50%; transform: translateX(-50%); }
.hand-west  { left: 14px; top: 50%; transform: translateY(-50%); flex-direction: column; }
.hand-east  { right: 14px; top: 50%; transform: translateY(-50%); flex-direction: column; }

.card-back {
  width: 36px;
  height: 50px;
  margin: 0 -10px;
  border-radius: 6px;
  background: repeating-linear-gradient(45deg, #273f8a 0px, #273f8a 6px, #1b2e69 6px, #1b2e69 12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.hand-west .card-back { transform: rotate(90deg); margin: -17px 0; }
.hand-east .card-back { transform: rotate(-90deg); margin: -17px 0; }

.trick-area {
  width: 320px;
  height: 280px;
  position: absolute;
  inset: 0;
  margin: auto;
  display: grid;
  grid-template-areas: ". north ." "west center east" ". south .";
  grid-template-columns: 120px 80px 120px;
  grid-template-rows: 90px 100px 90px;
  place-items: center;
  z-index: 4;
}
.trick-north { grid-area: north; }
.trick-west { grid-area: west; }
.trick-center { grid-area: center; }
.trick-east { grid-area: east; }
.trick-south { grid-area: south; }
.center-suit { font-size: 58px; color: rgba(255, 255, 255, 0.13); }

.hand-area {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0;
  padding: 8px 20px 16px;
  overflow: visible;
  background: rgba(0, 0, 0, 0.30);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.card {
  width: 104px;
  height: 152px;
  border-radius: 14px;
  margin: 0 -15px;
  background: var(--card-bg);
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: transform 220ms ease, box-shadow 220ms ease;
}
.card:hover { transform: translateY(-20px) scale(1.05); box-shadow: 0 24px 40px rgba(0, 0, 0, 0.50); z-index: 20; }
.card.illegal { opacity: 0.65; filter: grayscale(0.30); cursor: not-allowed; }
.card.illegal:hover { transform: none; }
.rank { font-size: 24px; line-height: 1; font-weight: 700; display: grid; }
.rank-bottom { align-self: end; transform: rotate(180deg); }
.suit-mini { font-size: 18px; }
.pip-center { position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; font-size: 56px; line-height: 1; }
.card.hearts, .card.diamonds { color: #d81953; }
.card.spades, .card.clubs { color: #11152c; }
.suit-red { color: #e53935; font-weight: 700; }
.suit-black { color: #c9d6ff; font-weight: 700; }

.trick-card {
  width: 84px;
  height: 122px;
  margin: 0;
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.45);
  animation: trickIn 320ms ease;
}
@keyframes trickIn { from { transform: scale(0.7) translateY(-20px); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.trick-area.fly-south .trick-card { animation: flySouth 0.85s ease forwards 1s; }
.trick-area.fly-west .trick-card { animation: flyWest 0.85s ease forwards 1s; }
.trick-area.fly-north .trick-card { animation: flyNorth 0.85s ease forwards 1s; }
.trick-area.fly-east .trick-card { animation: flyEast 0.85s ease forwards 1s; }
@keyframes flySouth { to { transform: translateY(145px) scale(0.75); opacity: 0; } }
@keyframes flyNorth { to { transform: translateY(-145px) scale(0.75); opacity: 0; } }
@keyframes flyWest { to { transform: translateX(-170px) scale(0.75); opacity: 0; } }
@keyframes flyEast { to { transform: translateX(170px) scale(0.75); opacity: 0; } }

.turn-indicator {
  position: absolute;
  top: 12px;
  left: 16px;
  transform: none;
  font-size: var(--fs-md);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  background: rgba(8, 16, 39, 0.86);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 7px 14px;
  z-index: 55;
  opacity: 0;
  transition: opacity 200ms;
}
.turn-indicator.visible { opacity: 1; }

/* yourTurnBadge is redundant — turn-indicator already shows it */
.your-turn-badge { display: none !important; }

.game-mute-btn {
  position: absolute;
  top: 12px;
  right: 82px;
  z-index: 55;
  background: rgba(8, 16, 39, 0.82);
  border: 1px solid var(--panel-border);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: var(--fs-md);
  cursor: pointer;
  line-height: 1;
  transition: background 150ms, opacity 150ms;
}
.game-mute-btn:hover { background: rgba(30, 50, 100, 0.96); }
.game-mute-btn.muted { opacity: 0.55; }

.game-leave-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  left: auto;
  z-index: 55;
  background: rgba(8, 16, 39, 0.82);
  border: 1px solid var(--panel-border);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: var(--fs-base);
  cursor: pointer;
  line-height: 1;
  transition: background 150ms, color 150ms;
}
.game-leave-btn:hover { color: var(--danger); background: rgba(30, 50, 100, 0.96); }

.reactions-panel {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.reaction-btn {
  border: 1px solid var(--panel-border);
  background: rgba(8, 16, 39, 0.86);
  color: var(--text);
  border-radius: 14px;
  width: 54px;
  height: 54px;
  padding: 0;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.log-panel {
  flex-shrink: 0;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(8, 16, 39, 0.86);
  overflow: hidden;
}

.music-widget {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(8, 16, 39, 0.88);
  padding: 8px 10px;
}
.music-btn {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
}
.music-label { font-size: 12px; color: var(--muted); }
#musicVolume { width: 90px; }
#musicMode {
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-radius: 8px;
  padding: 4px;
}
.log-header { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; color: var(--muted); }
.log-body { max-height: 0; overflow: auto; transition: max-height 220ms ease; }
.log-panel.open .log-body { max-height: 220px; }
.log-entry { font-size: var(--fs-base); color: #eaf1ff; padding: 5px 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.modal:not(.hidden) .modal-box { animation: modalIn 240ms cubic-bezier(0.2, 0.9, 0.4, 1) both; }

.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 200; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.62); }
#bidModal .modal-backdrop, #trumpModal .modal-backdrop { background: rgba(0, 0, 0, 0.2); }
.modal-box {
  position: relative;
  width: min(520px, 92vw);
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: rgba(15, 25, 56, 0.95);
  padding: 22px;
}
.modal-box h3 { font-family: var(--font-title); color: var(--accent-2); font-size: var(--fs-3xl); }
.bid-tip { color: var(--muted); margin-top: 5px; margin-bottom: 12px; }
.bid-options { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; }
.bid-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.bid-btn { border: 1px solid var(--panel-border); background: rgba(255,255,255,0.08); color: var(--text); border-radius: 10px; padding: 12px 6px; font-size: var(--fs-lg); font-weight: 600; cursor: pointer; white-space: nowrap; text-align: center; transition: background 140ms, border-color 140ms, transform 100ms; }
.bid-btn:hover { background: rgba(255,255,255,0.18); transform: translateY(-2px); }
.bid-btn:active { transform: translateY(0); }
.bid-btn.nil { color: var(--accent); border-color: rgba(255,138,61,0.4); }

/* Trump suit colour coding */
.trump-btn.suit-hearts,
.trump-btn.suit-diamonds { color: #f25d5d; border-color: rgba(242,93,93,0.45); font-size: 18px; padding: 14px 8px; }
.trump-btn.suit-hearts:hover,
.trump-btn.suit-diamonds:hover { background: rgba(242,93,93,0.15); border-color: rgba(242,93,93,0.75); }
.trump-btn.suit-spades,
.trump-btn.suit-clubs { color: #c9d6ff; border-color: rgba(100,130,200,0.45); font-size: 18px; padding: 14px 8px; }
.trump-btn.suit-spades:hover,
.trump-btn.suit-clubs:hover { background: rgba(100,130,200,0.18); border-color: rgba(100,130,200,0.75); }
.nil-note { margin-top: 10px; color: var(--muted); }
.bid-timer-bar { height: 8px; background: rgba(255,255,255,0.12); border-radius: 4px; margin: 10px 0 3px; overflow: hidden; }
.bid-timer-fill { height: 100%; width: 100%; background: var(--mint); border-radius: 2px; transition: width 250ms linear; }
.bid-timer-row { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.bid-timer-text { font-size: var(--fs-sm); color: var(--muted); }
.round-score-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.12); }
.round-score-row:last-child { border-bottom: 0; }
.round-score-row.indent { padding-left: 12px; opacity: 0.80; }
.round-score-row.round-score-divider { padding: 6px 0 3px; border-bottom: none; }
.round-score-row.round-score-divider span:first-child { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.10em; color: var(--mint); font-weight: 700; }

/* ─── Deal / Shuffle Overlay ─────────────────────────────────────────────── */
.deal-overlay {
  position: absolute;
  inset: 0;
  z-index: 150;
  background: rgba(5, 10, 28, 0.82);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  overflow: hidden;
  pointer-events: none;
}
.deal-overlay.hidden { display: none; }
.deal-deck { position: relative; width: 78px; height: 110px; }
.dc {
  position: absolute; inset: 0;
  border-radius: 10px;
  background: repeating-linear-gradient(45deg, #273f8a 0px 6px, #1b2e69 6px 12px);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 6px 18px rgba(0,0,0,0.55);
}
.dc:nth-child(1)  { transform: translate(-4px,-6px) rotate(-4deg); }
.dc:nth-child(2)  { transform: translate(4px, -5px) rotate(3deg); }
.dc:nth-child(3)  { transform: translate(-3px,-3px) rotate(-2deg); }
.dc:nth-child(4)  { transform: translate(3px, -2px) rotate(2deg); }
.dc:nth-child(5)  { transform: translate(-1px,-1px) rotate(-1deg); }
.dc:nth-child(6)  { transform: translate(1px, 0px)  rotate(0.5deg); }
.deal-overlay.shuffling .dc:nth-child(odd)  { animation: sh-odd  0.13s ease-in-out infinite alternate; }
.deal-overlay.shuffling .dc:nth-child(even) { animation: sh-even 0.13s ease-in-out infinite alternate; }
.deal-overlay.shuffling .dc:nth-child(3) { animation-delay: 0.02s; }
.deal-overlay.shuffling .dc:nth-child(5) { animation-delay: 0.04s; }
.deal-overlay.shuffling .dc:nth-child(7) { animation-delay: 0.06s; }
.deal-overlay.shuffling .dc:nth-child(9) { animation-delay: 0.08s; }
@keyframes sh-odd  { from { transform: translateX(-16px) rotate(-5deg); } to { transform: translateX(16px) rotate(5deg); } }
@keyframes sh-even { from { transform: translateX(16px)  rotate(5deg);  } to { transform: translateX(-16px) rotate(-5deg); } }
.deal-pile {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 80px;
  border-radius: 9px;
  background: repeating-linear-gradient(45deg, #273f8a 0px 6px, #1b2e69 6px 12px);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 26px rgba(0,0,0,0.65);
  opacity: 0;
}
.deal-overlay.dealing .dc { animation: deck-shrink 0.3s ease forwards; }
@keyframes deck-shrink { to { transform: scale(0.4); opacity: 0; } }
.deal-overlay.dealing .dp-n { animation: fly-n 0.7s cubic-bezier(0.2,0.9,0.4,1)       both; }
.deal-overlay.dealing .dp-w { animation: fly-w 0.7s cubic-bezier(0.2,0.9,0.4,1) 0.06s both; }
.deal-overlay.dealing .dp-e { animation: fly-e 0.7s cubic-bezier(0.2,0.9,0.4,1) 0.10s both; }
.deal-overlay.dealing .dp-s { animation: fly-s 0.7s cubic-bezier(0.2,0.9,0.4,1) 0.14s both; }
@keyframes fly-n { from{opacity:1;transform:translate(-50%,-50%)scale(1.15)} to{opacity:0;transform:translate(-50%,calc(-50% - 55vh))scale(0.7)} }
@keyframes fly-s { from{opacity:1;transform:translate(-50%,-50%)scale(1.15)} to{opacity:0;transform:translate(-50%,calc(-50% + 55vh))scale(0.7)} }
@keyframes fly-w { from{opacity:1;transform:translate(-50%,-50%)scale(1.15)} to{opacity:0;transform:translate(calc(-50% - 55vw),-50%)scale(0.7)} }
@keyframes fly-e { from{opacity:1;transform:translate(-50%,-50%)scale(1.15)} to{opacity:0;transform:translate(calc(-50% + 55vw),-50%)scale(0.7)} }
.deal-overlay.done { animation: overlay-fade 0.35s ease forwards; }
@keyframes overlay-fade { to { opacity: 0; } }
.deal-label { color: rgba(200,220,255,0.8); font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; font-family: var(--font-title); }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  bottom: 90px;
  z-index: 250;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(8, 16, 39, 0.92);
  padding: 10px 18px;
  opacity: 0;
  transition: all 220ms;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.reactions-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 180;
}
.reaction-float {
  position: absolute;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(16, 28, 62, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: var(--text);
  font-size: 44px;
  animation: reactionUp 2.8s ease forwards;
}
@keyframes reactionUp {
  0% { opacity: 0; transform: translateY(16px) scale(0.9); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-70px) scale(1.1); }
}

.bid-flash {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  z-index: 170;
  background: rgba(8,16,39,0.92);
  border: 2px solid rgba(255,209,102,0.8);
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 36px;
  font-weight: 700;
  color: #ffe9b3;
  box-shadow: 0 14px 40px rgba(0,0,0,0.45);
  animation: bidFlashIn 1.5s ease forwards;
}

.bid-trump-banner {
  position: absolute;
  left: 50%;
  top: 128px;
  transform: translateX(-50%);
  z-index: 176;
  min-width: 420px;
  text-align: center;
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(8,16,39,0.95), rgba(24,48,90,0.95));
  border: 2px solid rgba(255,209,102,0.72);
  box-shadow: 0 16px 42px rgba(0,0,0,0.45);
  padding: 10px 16px;
  font-size: 22px;
  color: #f7fbff;
  animation: bidTrumpPulse 2.6s ease forwards;
}
@keyframes bidTrumpPulse {
  0% { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.94); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  88% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(1.02); }
}
@keyframes bidFlashIn {
  0% { opacity: 0; transform: translate(-50%, -58%) scale(0.85); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.03); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -44%) scale(1.04); }
}

.round-winner-banner {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translateX(-50%);
  z-index: 175;
  width: min(620px, 90vw);
  text-align: center;
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(8,16,39,0.95), rgba(32,40,82,0.95));
  border: 2px solid rgba(89,244,197,0.6);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  padding: 14px 20px;
  font-size: 32px;
  color: #f8fbff;
  animation: winnerBanner 4.8s ease forwards;
}
@keyframes winnerBanner {
  0% { opacity: 0; transform: translateX(-50%) translateY(-22px) scale(0.95); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(12px) scale(1.02); }
}

@media (max-width: 920px) {
  #gameTable { flex-direction: column; height: auto; min-height: 100vh; overflow: auto; }
  .game-left { overflow: visible; }
  .game-sidebar { width: 100%; border-left: none; border-top: 1px solid var(--panel-border); flex-direction: row; flex-wrap: wrap; }
  .table-scene { grid-template-columns: 110px minmax(0, 1fr) 110px; }
  .card { width: 88px; height: 130px; }
  .trick-card { width: 74px; height: 106px; }
  .bid-trump-banner { width: 90vw; font-size: 20px; }
  .round-winner-banner { font-size: 24px; }
}
@media (max-width: 620px) {
  .game-grid { grid-template-columns: 1fr; }
  .hud-scores { grid-template-columns: 1fr; justify-items: center; }
  .score-divider { display: none; }
  .felt-table { height: min(500px, 56vh); border-radius: 120px; }
  .card { width: 70px; height: 102px; margin: 0 -9px; }
  .pip-center { font-size: 40px; }
  .rank { font-size: 19px; }
  .trick-card { width: 60px; height: 88px; }
  .reactions-panel { width: 90vw; }
  .log-panel { width: 90vw; right: 5vw; }
}

/* ── Touch devices: bigger tap areas, no phantom hover ──────────────────── */
@media (hover: none) and (pointer: coarse) {
  .card { touch-action: manipulation; }
  .card:not(.played):hover { transform: translateY(-24px) scale(1.07); }
  .btn, button { touch-action: manipulation; }
  .avatar-option { touch-action: manipulation; }
}

/* ── Portrait mobile (phone held upright) ───────────────────────────────── */
@media (orientation: portrait) and (max-width: 768px) {
  .felt-table { height: min(420px, 48vw); border-radius: 80px; }
  .player-illustration img { width: 110%; height: 110%; object-fit: cover; }
  .pname { font-size: 12px; max-width: 72px; }
  .card { width: 58px; height: 86px; margin: 0 -8px; }
  .pip-center { font-size: 32px; }
  .rank { font-size: 15px; }
  .trick-card { width: 50px; height: 74px; }
  .turn-indicator { font-size: 14px; padding: 4px 12px; }
  .hud-scores { font-size: 13px; }
}

/* ─── Bid Float Bubble ── appears from the bidding player ─────────────────── */
.bid-float {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(255, 209, 102, 0.96);
  color: #0a1420;
  font-weight: 900;
  font-size: 36px;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 195;
  opacity: 0;
}
@keyframes bidFloatUp {
  0%   { opacity: 0;   transform: translate(-50%, -50%) scale(0.4); }
  18%  { opacity: 1;   transform: translate(-50%, -60%) scale(1.15); }
  75%  { opacity: 1;   transform: translate(-50%, -200%) scale(1); }
  100% { opacity: 0;   transform: translate(-50%, -230%) scale(0.85); }
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE PHONE GAME SCREEN  (#mobileGame)
   Separate portrait-first layout for phones (≤768px touch devices).
   Activated via body.is-mobile class set by JS.
══════════════════════════════════════════════════════════════════════════ */
#mobileGame {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  background: linear-gradient(160deg, var(--bg-top) 0%, var(--bg-mid) 55%, var(--bg-bottom) 100%);
  position: relative;
  overflow: hidden;
}
#mobileGame.active { display: flex; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.m-header {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  gap: 6px;
  background: rgba(8, 16, 39, 0.96);
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
  min-height: 48px;
}
.m-team-info { display: flex; flex-direction: column; align-items: flex-start; flex: 1; gap: 1px; }
.m-team-info.m-team-ew { align-items: flex-end; }
.m-team-label { font-size: var(--fs-2xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.m-score { font-size: var(--fs-2xl); font-weight: 700; color: var(--text); line-height: 1; }
.m-bags { font-size: var(--fs-2xs); color: var(--muted); }
.m-center-info { display: flex; flex-direction: column; align-items: center; gap: 3px; flex-shrink: 0; padding: 0 6px; }
.m-round-badge { font-size: var(--fs-md); font-weight: 700; color: var(--accent-2); }
.m-mute-btn { background: rgba(255,255,255,0.07); border: 1px solid var(--panel-border); border-radius: 8px; padding: 5px 9px; font-size: 16px; cursor: pointer; color: #fff; flex-shrink: 0; touch-action: manipulation; }
.m-mute-btn.muted { opacity: 0.5; }

/* ── Status bar ──────────────────────────────────────────────────────────── */
.m-status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 3px 10px;
  background: rgba(8, 16, 39, 0.7);
  border-bottom: 1px solid var(--panel-border);
  min-height: 26px;
  flex-shrink: 0;
  font-size: var(--fs-sm);
}
.m-status-label { color: var(--muted); }

/* ── Main game area ──────────────────────────────────────────────────────── */
.m-game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 4px 6px;
  gap: 4px;
  min-height: 0;
  overflow: hidden;
}

/* N / S compact player zones */
.m-player-zone {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 5px 10px;
  flex-shrink: 0;
  transition: background 200ms, border-color 200ms;
}
.m-player-zone.active-seat {
  background: rgba(89, 244, 197, 0.10);
  border-color: rgba(89, 244, 197, 0.38);
}
.m-avatar-wrap {
  width: 36px; height: 36px;
  border-radius: 50%; overflow: hidden;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.m-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.m-player-info-col { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.m-pname   { font-size: var(--fs-base); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-ptricks { font-size: var(--fs-xs); color: var(--muted); }
.m-pbid    { font-size: var(--fs-xs); color: var(--accent-2); }
.m-clock   { width: 24px; height: 24px; flex-shrink: 0; }

/* Middle row: W panel | Felt | E panel */
.m-middle-row {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  gap: 4px;
  align-items: stretch;
}

/* W/E side panels — outside the felt, same height as felt */
.m-side-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 54px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 6px 3px;
  transition: background 200ms, border-color 200ms;
}
.m-side-zone.active-seat {
  background: rgba(89, 244, 197, 0.10);
  border-color: rgba(89, 244, 197, 0.38);
}
.m-side-zone .m-avatar-small { width: 34px; height: 34px; }
.m-side-zone .m-pname-small  { font-size: var(--fs-xs); max-width: 50px; }
.m-side-zone .m-ptricks-small { font-size: var(--fs-2xs); }
.m-side-zone .m-pbid-small    { font-size: var(--fs-2xs); }
.m-side-zone .m-clock-small   { width: 24px; height: 24px; }
.m-side-zone .m-clock-small .clock-hand { height: 7px; }
.m-side-zone .m-clock-small .clock-dot  { width: 5px; height: 5px; }

/* Side zones (W / E) — superseded by .m-player-overlay */
.m-player-side { display: none; }
.m-player-side.active-seat { display: none; }
.m-avatar-small {
  width: 30px; height: 30px;
  border-radius: 50%; overflow: hidden;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
}
.m-avatar-small img { width: 100%; height: 100%; object-fit: cover; }
.m-pname-small   { font-size: var(--fs-2xs); color: var(--text); text-align: center; overflow: hidden; text-overflow: ellipsis; max-width: 48px; white-space: nowrap; }
.m-ptricks-small { font-size: var(--fs-2xs); color: var(--muted); text-align: center; }
.m-pbid-small    { font-size: var(--fs-2xs); color: var(--accent-2); text-align: center; }
.m-clock-small   { width: 18px; height: 18px; }

/* Felt area (trick table) */
.m-felt {
  flex: 1;
  width: 100%;
  position: relative;
  background: radial-gradient(ellipse at 38% 38%, #2d9175 0%, #1e7258 42%, #145040 78%, #0d3a2e 100%);
  border-radius: 16px;
  overflow: hidden;
  min-height: 0;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.06);
}

/* W/E player overlay chips: float on the felt surface */
.m-player-overlay {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  background: rgba(8, 16, 39, 0.78);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 10px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 52px;
  backdrop-filter: blur(4px);
  transition: background 200ms, border-color 200ms;
}
.m-overlay-west { left: 4px; }
.m-overlay-east { right: 4px; }
.m-player-overlay.active-seat {
  background: rgba(89, 244, 197, 0.16);
  border-color: rgba(89, 244, 197, 0.52);
}

/* Trick area sized for mobile */
.m-trick-area {
  width: 228px;
  height: 208px;
  grid-template-columns: 80px 64px 80px;
  grid-template-rows: 70px 68px 70px;
}
.m-trick-area .trick-card {
  width: 54px;
  height: 78px;
  margin: 0;
}

/* Opponent hand card backs on felt */
.m-opp-hand { position: absolute; display: flex; pointer-events: none; }
.m-hand-north { display: none; }
.m-hand-west  { display: none; }
.m-hand-east  { display: none; }
.m-felt .card-back { width: 22px; height: 32px; margin: 0 -6px; border-radius: 4px; }
.m-hand-west .card-back { transform: rotate(90deg);  margin: -9px 0; }
.m-hand-east .card-back { transform: rotate(-90deg); margin: -9px 0; }

/* Your hand */
.m-hand-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-shrink: 0;
  height: 112px;
  padding: 4px 6px 6px;
  overflow: visible;
}
.m-hand-area .card {
  width: 60px;
  height: 88px;
  margin: 0 -18px;
}
.m-hand-area .card:hover,
.m-hand-area .card:active {
  transform: translateY(-18px) scale(1.06);
  z-index: 20;
}

/* Turn bar */
.m-turn-bar {
  flex-shrink: 0;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(8, 16, 39, 0.88);
  border-top: 1px solid var(--panel-border);
  padding: 5px 10px;
  opacity: 0;
  transition: opacity 200ms;
  min-height: 28px;
}
.m-turn-bar.visible { opacity: 1; }

/* Reactions footer */
.m-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: rgba(8, 16, 39, 0.96);
  border-top: 1px solid var(--panel-border);
  flex-shrink: 0;
}
.m-react-toggle {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 4px 16px;
  font-size: var(--fs-lg);
  cursor: pointer;
  touch-action: manipulation;
  color: var(--muted);
  width: 100%;
  text-align: center;
  letter-spacing: 0.05em;
}
.m-reactions-inner {
  display: none;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}
.m-reactions-inner.open { display: flex; }
.m-footer .reaction-btn {
  font-size: 22px;
  padding: 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}

/* Mobile lobby: single-column */
body.is-mobile .lobby-columns           { grid-template-columns: 1fr; gap: 14px; }
body.is-mobile .lobby-col-right         { border-left: none; padding-left: 0; border-top: 1px solid var(--panel-border); padding-top: 14px; }
body.is-mobile #lobby {
  position: fixed !important;
  inset: 0 !important;
  min-height: 0 !important;
  overflow: hidden;
  padding: 6px 12px;
  justify-content: flex-start;
}
body.is-mobile .lobby-header    { margin-bottom: 4px; }
body.is-mobile .logo-text       { font-size: 18px; }
body.is-mobile .logo-suit       { font-size: 22px; }
body.is-mobile .lobby-main      { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 96vw; }
body.is-mobile .lobby-panel.wide        { width: 96vw; max-height: none; flex: 1; min-height: 0; overflow-y: auto; }
body.is-mobile .avatar-grid             { grid-template-columns: repeat(3, 1fr); }
body.is-mobile .game-grid               { gap: 8px; }
body.is-mobile #gameTable               { display: none !important; }
body.is-mobile .m-trick-area .center-suit { font-size: 23px; }
body.is-mobile .panel-title             { font-size: var(--fs-lg); }
body.is-mobile .panel-sub               { font-size: var(--fs-xs); margin-bottom: 6px; }
body.is-mobile .step-label-row          { margin-bottom: 10px; }

/* Mobile Card Overrides */
body.is-mobile .card .pip-center { display: none !important; }
body.is-mobile .card .rank { font-size: 20px; line-height: 1; }
body.is-mobile .card .suit-mini { font-size: 16px; }
body.is-mobile .card { padding: 4px 6px; }

body.is-mobile .m-trick-area .trick-card { padding: 4px; }
body.is-mobile .m-trick-area .trick-card .rank { font-size: 15px; }
body.is-mobile .m-trick-area .trick-card .suit-mini { font-size: 12px; }

body.is-mobile .avatar-btn img { width: 80px; height: 80px; object-fit: contain; }
body.is-mobile .avatar-btn { padding: 4px 2px; }
body.is-mobile .avatar-btn span { display: none; }
body.is-mobile .game-grid { grid-template-columns: 1fr 1fr; }
body.is-mobile .avatar-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 4px; }
body.is-mobile .m-hand-area .card:hover,
body.is-mobile .m-hand-area .card:active { transform: none; z-index: auto; }



/* Mobile Toast Overrides */
body.is-mobile .toast {
  bottom: auto;
  top: 60px;
  width: 92vw;
  text-align: center;
  transform: translateX(-50%) translateY(-30px);
}
body.is-mobile .toast.show {
  transform: translateX(-50%) translateY(0);
}


/* Mobile ingame avatar fix */
body.is-mobile .m-avatar-wrap img { object-fit: contain; }
body.is-mobile .m-avatar-small img { object-fit: contain; }

/* Mobile team identity rings */
#m-zoneNorth .m-avatar-wrap,
#m-zoneSouth .m-avatar-wrap { border: 2px solid rgba(89, 244, 197, 0.55); border-radius: 50%; }
#m-zoneWest .m-avatar-small,
#m-zoneEast .m-avatar-small  { border: 2px solid rgba(255, 93, 143, 0.45); border-radius: 50%; }
#m-zoneWest.active-seat .m-avatar-small,
#m-zoneEast.active-seat .m-avatar-small { border-color: rgba(89, 244, 197, 0.65); }

/* ─── Confetti ─────────────────────────────────────────────────────────────── */
.confetti-particle {
  position: fixed;
  border-radius: 2px;
  pointer-events: none;
  z-index: 300;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg);    opacity: 1; }
  100% { transform: translateY(105vh) rotate(900deg);  opacity: 0; }
}

/* ─── Game Over Modal ──────────────────────────────────────────────────────── */
.game-over-box {
  text-align: center;
  padding: 32px 28px;
  background: linear-gradient(160deg, rgba(15,25,62,0.97) 0%, rgba(30,48,88,0.97) 100%);
  border: 1px solid rgba(255, 209, 102, 0.45);
  box-shadow: 0 0 0 4px rgba(255,209,102,0.10), 0 30px 70px rgba(0,0,0,0.55);
}
.game-over-box .trophy { font-size: 72px; line-height: 1; margin-bottom: 10px; }
.game-over-box h2 { font-family: var(--font-title); font-size: 38px; color: var(--accent-2); margin-bottom: 18px; }
.game-over-box .final-scores { margin-bottom: 22px; border: 1px solid var(--panel-border); border-radius: 12px; overflow: hidden; }
.game-over-box .round-score-row { font-size: 16px; padding: 10px 16px; }
.game-over-box .btn-primary { width: 100%; font-size: 17px; padding: 14px; }
.game-over-sub { color: var(--muted); font-size: 15px; margin-bottom: 16px; margin-top: -12px; }

