:root {
  --neutral-950: #070b0a;
  --neutral-900: #0c1110;
  --neutral-850: #111816;
  --neutral-800: #141c19;
  --neutral-700: #1a2521;
  --neutral-600: #24302d;
  --neutral-300: #aab5ad;
  --neutral-050: #f7f1e6;
  --felt-900: #07140f;
  --felt-800: #0d2119;
  --felt-700: #173a2d;
  --felt-600: #225443;
  --felt-500: #2e6e58;
  --felt-400: #5f9c7d;
  --brass-700: #8a621d;
  --brass-600: #a87924;
  --brass-500: #c59a3f;
  --brass-400: #d6b160;
  --brass-300: #e7d08b;
  --date-red-700: #7a2e2a;
  --date-red-500: #b85a4c;
  --date-red-300: #e1a398;
  --slate-blue-700: #294c58;
  --slate-blue-500: #5d8291;
  --slate-blue-300: #9bc3ce;
  --bg: var(--neutral-950);
  --bg-soft: var(--neutral-900);
  --surface-1: var(--neutral-850);
  --surface-2: var(--neutral-800);
  --surface-3: var(--neutral-700);
  --felt: var(--felt-700);
  --felt-mid: var(--felt-600);
  --felt-edge: var(--felt-900);
  --panel: rgba(17, 24, 22, 0.94);
  --panel-soft: rgba(20, 28, 25, 0.9);
  --panel-deep: rgba(7, 11, 10, 0.9);
  --line: rgba(247, 241, 230, 0.14);
  --line-strong: rgba(247, 241, 230, 0.26);
  --text: var(--neutral-050);
  --muted: var(--neutral-300);
  --subtle: #7f8c84;
  --gold: var(--brass-500);
  --gold-soft: var(--brass-300);
  --gold-deep: var(--brass-700);
  --green: var(--felt-500);
  --green-soft: #83b99a;
  --blue: var(--slate-blue-500);
  --red: var(--date-red-500);
  --rail: #4a2f20;
  --rail-light: #6a4428;
  --accent: var(--brass-500);
  --accent-hover: var(--brass-400);
  --accent-fg: #171207;
  --focus-ring: var(--brass-300);
  --team-us: var(--brass-400);
  --team-them: var(--slate-blue-300);
  --status-success: #83b99a;
  --status-warning: #d6a84a;
  --status-error: var(--date-red-300);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.54);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  --radius-lg: 16px;
  --font-ar: "Noto Sans Arabic", "Tajawal", Tahoma, Arial, sans-serif;
  --font-display: "Noto Kufi Arabic", "Noto Sans Arabic", "Tajawal", sans-serif;
  font-family: var(--font-ar);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(115% 85% at 50% 42%, rgba(34, 84, 67, 0.26), rgba(13, 33, 26, 0.12) 48%, transparent 74%),
    radial-gradient(circle at 50% -10%, rgba(197, 154, 63, 0.09), transparent 28rem),
    radial-gradient(circle at 50% 36%, rgba(34, 84, 67, 0.16), transparent 38rem),
    linear-gradient(180deg, rgba(12, 17, 16, 0.98), rgba(7, 11, 10, 0.99));
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 24px 70px rgba(0, 0, 0, 0.42),
    inset 0 -32px 90px rgba(0, 0, 0, 0.46);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.card:focus-visible,
.phase-action:focus-visible,
.mode-button:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

h1,
h2,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  padding: 12px 16px calc(14px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 8px;
  z-index: 60;
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  direction: ltr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    rgba(12, 17, 16, 0.96);
  box-shadow: var(--shadow-soft);
  backdrop-filter: none;
}

.topbar > * {
  direction: rtl;
}

.topbar-score {
  justify-self: center;
  min-width: min(260px, 64vw);
}

/* Top bar shows the brand on the home screen, the score during a game. */
.topbar .topbar-score {
  display: none;
}

body.in-game .topbar .topbar-score {
  display: grid;
}

body.in-game .brand-block {
  display: none;
}

.brand-block {
  justify-self: end;
  min-width: 0;
}

.brand-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(160deg, var(--brass-300), var(--brass-500) 58%, var(--brass-700));
  color: var(--accent-fg);
  font-size: 23px;
  font-weight: 950;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    0 0 0 1px rgba(231, 208, 139, 0.28),
    0 8px 18px rgba(0, 0, 0, 0.34);
}

h1 {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: 0;
}

#championLine {
  max-width: min(32vw, 330px);
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(247, 241, 230, 0.045);
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.icon-button:hover {
  border-color: rgba(231, 208, 139, 0.42);
  background: rgba(247, 241, 230, 0.075);
}

.invite-button {
  border-color: rgba(95, 156, 125, 0.42);
  background: linear-gradient(180deg, rgba(34, 84, 67, 0.96), rgba(23, 58, 45, 0.96));
}

.session-pill {
  justify-self: center;
  min-width: 168px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 11, 10, 0.78);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.session-pill strong {
  color: var(--text);
  font-size: 13px;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--status-success);
  box-shadow: 0 0 0 4px rgba(131, 185, 154, 0.14);
}

.lobby {
  width: min(930px, 100%);
  margin: 26px auto 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.lobby-main,
.lobby-side,
.side {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, rgba(20, 28, 25, 0.95), rgba(7, 11, 10, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    var(--shadow-soft);
}

.lobby-main {
  position: relative;
  overflow: hidden;
}

.lobby-main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 80% at 85% -10%, rgba(197, 154, 63, 0.09), transparent 60%);
}

.lobby-title h2 {
  font-family: var(--font-display);
  background: linear-gradient(180deg, var(--brass-300), var(--brass-500) 72%, var(--brass-700));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold-soft);
}

.lobby-main {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: clamp(20px, 3vw, 34px);
}

.lobby-title span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.lobby-title h2 {
  margin-top: 6px;
  font-size: clamp(25px, 3.2vw, 36px);
  line-height: 1.12;
  letter-spacing: 0;
}

.field-row,
.join-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.field-row label {
  width: 64px;
  padding-bottom: 12px;
  color: var(--muted);
  font-weight: 850;
}

input {
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  background: rgba(7, 11, 10, 0.72);
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

input::placeholder {
  color: var(--muted);
}

input:focus {
  border-color: rgba(231, 208, 139, 0.62);
  box-shadow: 0 0 0 3px rgba(231, 208, 139, 0.16);
}

#playerName,
#roomInput {
  flex: 1;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

.mode-button {
  min-height: 108px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 55%),
    rgba(247, 241, 230, 0.035);
  color: var(--text);
  text-align: right;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.mode-button.primary {
  border-color: rgba(231, 208, 139, 0.42);
  background:
    linear-gradient(180deg, rgba(197, 154, 63, 0.16), rgba(197, 154, 63, 0.04) 60%),
    rgba(247, 241, 230, 0.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 10px 24px rgba(0, 0, 0, 0.28);
}

.mode-button:hover {
  transform: translateY(-2px);
  border-color: rgba(231, 208, 139, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 14px 30px rgba(0, 0, 0, 0.3);
}

.mode-button span {
  display: block;
  font-size: 19px;
  font-weight: 950;
}

.mode-button small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.join-row button {
  height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(197, 154, 63, 0.66);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--brass-400), var(--brass-600));
  color: var(--accent-fg);
  font-weight: 950;
}

.lobby-side {
  max-width: none;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat-tile {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0)),
    rgba(7, 11, 10, 0.45);
  box-shadow: inset 2px 0 0 rgba(197, 154, 63, 0.28);
}

.stat-tile span,
.room-card span,
.score-grid span,
.details-grid span,
.side-head span,
.declaration-card span,
.invite-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
}

.stat-tile strong,
.room-card strong,
.score-grid strong,
.details-grid strong,
.side-head strong,
.declaration-card strong,
.invite-card strong {
  display: block;
  min-width: 0;
  margin-top: 5px;
  overflow: hidden;
  color: var(--text);
  font-weight: 950;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game {
  width: 100%;
  margin-top: 12px;
}

.game-layout {
  min-height: calc(100svh - 92px);
  display: grid;
  grid-template-columns: clamp(178px, 14vw, 220px) minmax(720px, 1fr) clamp(178px, 14vw, 220px);
  gap: 12px;
  direction: ltr;
}

.game-layout > * {
  direction: rtl;
}

.side {
  position: relative;
  min-height: 0;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(20, 28, 25, 0.82), rgba(7, 11, 10, 0.88));
}

.side::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(197, 154, 63, 0.055), transparent 22rem);
}

.side-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.side-head strong {
  margin-top: 0;
  font-size: 16px;
}

.declaration-card,
.voice-card,
.invite-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 60%),
    rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.declaration-card {
  min-height: 72px;
  padding: 12px;
}

.declaration-card strong {
  margin-top: 8px;
  overflow: visible;
  font-size: 14px;
  line-height: 1.45;
  white-space: normal;
}

.voice-card,
.invite-card {
  min-height: 62px;
  padding: 11px;
}

.voice-card {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-icon {
  width: 32px;
  height: 32px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius);
  background: var(--felt-600);
  color: var(--text);
  font-size: 16px;
  font-weight: 950;
}

.voice-card strong,
.voice-card span {
  display: block;
}

.voice-card strong {
  font-size: 13px;
}

.voice-card span,
.invite-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.invite-card {
  margin-top: auto;
}

.table-wrap {
  position: relative;
  min-width: 0;
  min-height: calc(100svh - 92px);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.table-board {
  position: relative;
  width: 100%;
  min-height: calc(100svh - 92px);
  height: calc(100svh - 92px);
  overflow: hidden;
  perspective: 1180px;
  perspective-origin: 50% 44%;
  transform-style: preserve-3d;
}

.table-board::before {
  display: none;
}

.score-panel {
  position: absolute;
  left: 50%;
  top: 12px;
  z-index: 30;
  width: min(430px, calc(100% - 28px));
  /* Score moved into the top bar; this panel is kept in the DOM (for JS) but hidden. */
  display: none;
  grid-template-columns: minmax(98px, 112px) minmax(220px, 286px);
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.score-panel > * {
  pointer-events: auto;
}

.room-card,
.score-grid {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 50%),
    rgba(7, 11, 10, 0.86);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 30px rgba(0, 0, 0, 0.32);
  backdrop-filter: none;
}

.room-card {
  min-width: 0;
  padding: 8px 10px;
}

.score-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
}

.score-grid > div {
  min-width: 0;
  padding: 6px 14px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1px;
  text-align: center;
}

.score-grid > div + div {
  border-right: 1px solid var(--line);
}

.score-grid strong {
  margin-top: 1px;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.score-grid > div:first-child strong {
  color: var(--team-us);
  text-shadow: none;
}

.score-grid > div:last-child strong {
  color: var(--team-them);
  text-shadow: none;
}

.score-grid .score-contract {
  padding-inline: 13px;
  background: rgba(197, 154, 63, 0.08);
}

.score-grid .score-contract strong {
  font-size: 13px;
  font-weight: 950;
  color: var(--gold-soft);
  white-space: nowrap;
  text-shadow: none;
}

.declarer-mini {
  max-width: 180px;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.details-grid {
  display: none;
}

.center-table {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: min(590px, calc(100svh - 250px), calc(100% - 260px));
  aspect-ratio: 1 / 1;
  isolation: isolate;
  transform: translate(-50%, -50%) rotateX(8deg) rotateZ(0.35deg);
  transform-origin: 50% 58%;
  transform-style: preserve-3d;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.06)),
    url("/assets/premium-table-mat-cropped.png") center / 100% 100% no-repeat;
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.32),
    inset 0 22px 44px rgba(255, 255, 255, 0.035),
    inset 0 -34px 58px rgba(0, 0, 0, 0.34),
    0 0 0 4px var(--rail),
    0 0 0 7px var(--rail-light),
    0 0 0 9px rgba(0, 0, 0, 0.42),
    0 12px 0 rgba(45, 27, 16, 0.88),
    0 36px 82px rgba(0, 0, 0, 0.68);
}

.center-table::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 24%, transparent 64%, rgba(0, 0, 0, 0.2)),
    radial-gradient(70% 58% at 50% 34%, rgba(247, 241, 230, 0.055), transparent 68%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -10px 18px rgba(0, 0, 0, 0.28);
  transform: translateZ(2px);
}

.center-table::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -34px;
  z-index: -1;
  height: 44px;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.58), transparent 72%);
  filter: blur(12px);
  transform: translateZ(-18px);
}

.table-core {
  position: absolute;
  top: 88px;
  right: 18px;
  z-index: 34;
  min-width: 164px;
  max-width: min(300px, calc(100% - 28px));
  min-height: 34px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 11, 10, 0.88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: none;
}

.table-core span {
  min-width: 34px;
  display: grid;
  place-items: center;
  padding: 4px 7px;
  border-radius: var(--radius);
  background: rgba(197, 154, 63, 0.18);
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 900;
}

.table-core strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-phase="PLAY_TRICKS"] .table-core {
  display: none;
}

.seat {
  position: absolute;
  z-index: 24;
  min-width: 0;
}

.seat.active {
  z-index: 42;
}

.seat-head {
  position: relative;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 7px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 11, 10, 0.82);
  color: var(--text);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  backdrop-filter: none;
}

.seat.active .seat-head {
  border-color: rgba(231, 208, 139, 0.74);
  box-shadow:
    0 0 0 3px rgba(231, 208, 139, 0.18),
    0 12px 26px rgba(0, 0, 0, 0.28);
}

.seat.active .seat-avatar {
  box-shadow:
    0 0 0 3px rgba(231, 208, 139, 0.9),
    0 9px 18px rgba(0, 0, 0, 0.3);
}

/* Active player's nameplate also picks up a clear gold ring. */
.seat.active .seat-copy {
  box-shadow: 0 0 0 2px rgba(231, 208, 139, 0.82), 0 8px 18px rgba(0, 0, 0, 0.3);
}

body.is-your-turn .seat.viewer.active .hand .card.playable {
  box-shadow:
    0 0 0 4px rgba(231, 208, 139, 0.66),
    0 14px 24px rgba(0, 0, 0, 0.34);
}

@keyframes active-seat-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.07);
  }
}

@keyframes playable-card-ready {
  0%, 100% {
    box-shadow:
      0 0 0 3px rgba(231, 208, 139, 0.58),
      0 14px 24px rgba(0, 0, 0, 0.32);
  }
  50% {
    box-shadow:
      0 0 0 4px rgba(231, 208, 139, 0.72),
      0 16px 28px rgba(0, 0, 0, 0.36);
  }
}

.seat-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brass-400), var(--brass-700));
  color: var(--accent-fg);
  font-size: 15px;
  font-weight: 950;
}

.seat:not(.viewer) .seat-avatar {
  background: linear-gradient(180deg, var(--slate-blue-500), var(--slate-blue-700));
  color: var(--text);
}

.seat-right .seat-avatar {
  background: linear-gradient(180deg, var(--slate-blue-500), var(--slate-blue-700));
}

.seat-copy {
  min-width: 0;
}

.viewer-role-markers {
  display: none;
}

.seat-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.1;
}

.seat-title span:first-child {
  flex: 0 1 auto;
  max-width: 92px;
  min-width: 0;
  padding-block: 0.12em 0.2em;
  margin-block: -0.12em -0.2em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-meta {
  max-width: 118px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buyer-badge,
.dealer-badge,
.declarer-badge {
  min-height: 17px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid rgba(197, 154, 63, 0.45);
  border-radius: 999px;
  background: rgba(197, 154, 63, 0.18);
  color: var(--gold-soft);
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
}

.declarer-badge {
  border-color: rgba(95, 156, 125, 0.58);
  background: rgba(34, 84, 67, 0.3);
  color: #c8ead8;
}

.seat.contract-declarer .seat-avatar {
  box-shadow: 0 0 0 3px rgba(231, 208, 139, 0.32);
}

.card-count {
  min-width: 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(197, 154, 63, 0.14);
  color: var(--gold-soft);
  font-size: 11px;
  font-weight: 950;
}

.seat-top {
  left: 50%;
  top: 86px;
  width: min(320px, calc(100% - 280px));
  display: grid;
  justify-items: center;
  gap: 0;
  transform: translateX(-50%);
}

.seat-left,
.seat-right {
  top: 50%;
  width: 166px;
  display: grid;
  gap: 0;
  /* Centre so the fan sits in the middle of the avatar. */
  justify-items: center;
  transform: translateY(-50%);
}

.seat-left {
  left: clamp(28px, calc(50% - 492px), calc(50% - 278px));
}

.seat-right {
  right: clamp(28px, calc(50% - 492px), calc(50% - 278px));
}

.seat-left .seat-head,
.seat-right .seat-head {
  max-width: 166px;
}

.seat-bottom {
  left: 50%;
  bottom: 24px;
  width: min(730px, calc(100% - 34px));
  display: grid;
  justify-items: center;
  gap: 7px;
  transform: translateX(-50%);
}

.seat-bottom .seat-head {
  order: 2;
  margin-top: -7px;
}

.seat-bottom .hand {
  order: 1;
  width: 100%;
  min-height: 118px;
  padding: 2px 8px 0;
  /* Fan left-to-right so each card's top-left rank/suit index stays visible. */
  direction: ltr;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: nowrap;
  overflow: visible;
  scrollbar-width: none;
}

.seat-bottom .hand::-webkit-scrollbar {
  display: none;
}

.seat-top .hand,
.seat-left .hand,
.seat-right .hand {
  order: 1;
}

.seat-top .seat-head,
.seat-left .seat-head,
.seat-right .seat-head {
  /* Let the name, avatar and count become direct items so we can reorder them:
     name on top, then the fan, then the avatar at the fan's base. */
  display: contents;
}

.seat-top .seat-avatar,
.seat-left .seat-avatar,
.seat-right .seat-avatar {
  position: relative;
  z-index: 20;
  order: 3;
  margin-top: -8px;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(247, 241, 230, 0.74);
  background: radial-gradient(circle at 50% 42%, #efe7d8 0 38%, #cbbfaa 39% 100%);
  color: rgba(5, 15, 13, 0.58);
  box-shadow: 0 7px 14px rgba(0, 0, 0, 0.28);
}

.seat-top .seat-copy,
.seat-left .seat-copy,
.seat-right .seat-copy {
  order: 0;
  min-width: 68px;
  max-width: 92px;
  margin-top: 0;
  margin-bottom: 2px;
  padding: 5px 6px 4px;
  border: 1px solid rgba(54, 39, 21, 0.22);
  border-radius: 7px;
  background: linear-gradient(180deg, #efe7d8, #c7b899);
  color: #2a2112;
  text-align: center;
  box-shadow: 0 7px 15px rgba(0, 0, 0, 0.25);
}

/* Side players: name goes BELOW the avatar instead of on top. */
.seat-left .seat-copy,
.seat-right .seat-copy {
  order: 4;
  margin-top: 9px;
  margin-bottom: 0;
  position: relative;
  z-index: 21;
}

.seat-top .seat-title,
.seat-left .seat-title,
.seat-right .seat-title {
  justify-content: center;
  color: #2a2112;
  font-size: 10px;
}

.seat-top .seat-title span:first-child,
.seat-left .seat-title span:first-child,
.seat-right .seat-title span:first-child {
  max-width: 78px;
}

.seat-top .card-count,
.seat-left .card-count,
.seat-right .card-count {
  position: relative;
  z-index: 22;
  order: 3;
  display: grid;
  width: 23px;
  min-width: 23px;
  height: 23px;
  margin-inline-start: -10px;
  margin-top: -18px;
  border: 1px solid rgba(231, 208, 139, 0.58);
  background: rgba(26, 37, 33, 0.96);
  color: var(--brass-300);
  font-size: 10px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.32);
}

.hand {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
}

.seat-top .hand,
.seat-left .hand,
.seat-right .hand {
  min-height: 54px;
  /* Centre the fan symmetrically above the name. */
  direction: ltr;
}

.seat-top .hand {
  max-width: 96px;
  min-height: 62px;
  align-items: flex-end;
  flex-wrap: nowrap;
  overflow: visible;
}

.seat-left .hand,
.seat-right .hand {
  max-width: 82px;
  min-height: 66px;
  align-items: flex-end;
  flex-wrap: nowrap;
  overflow: visible;
}

.seat-right .hand {
  justify-content: flex-end;
}

.seat-top .card.back,
.seat-left .card.back,
.seat-right .card.back {
  width: 30px;
  height: auto;
  margin-left: -19px;
  /* Pivot at the bottom so the cards meet at one point below and fan out on top. */
  transform-origin: 50% 100%;
  transform: rotate(var(--fan-rot, 0deg));
}

.seat-top .card.back:first-child,
.seat-left .card.back:first-child,
.seat-right .card.back:first-child {
  margin-left: 0;
}

.seat-top .card.back {
  width: 32px;
  height: auto;
  margin-left: -32px;
}

.seat-left .card.back,
.seat-right .card.back {
  width: 32px;
  height: auto;
  margin-left: -32px;
}

.seat-top .card.back:nth-child(1),
.seat-left .card.back:nth-child(1),
.seat-right .card.back:nth-child(1) { z-index: 1; }
.seat-top .card.back:nth-child(2),
.seat-left .card.back:nth-child(2),
.seat-right .card.back:nth-child(2) { z-index: 2; }
.seat-top .card.back:nth-child(3),
.seat-left .card.back:nth-child(3),
.seat-right .card.back:nth-child(3) { z-index: 3; }
.seat-top .card.back:nth-child(4),
.seat-left .card.back:nth-child(4),
.seat-right .card.back:nth-child(4) { z-index: 4; }
.seat-top .card.back:nth-child(5),
.seat-left .card.back:nth-child(5),
.seat-right .card.back:nth-child(5) { z-index: 5; }
.seat-top .card.back:nth-child(6),
.seat-left .card.back:nth-child(6),
.seat-right .card.back:nth-child(6) { z-index: 6; }
.seat-top .card.back:nth-child(7),
.seat-left .card.back:nth-child(7),
.seat-right .card.back:nth-child(7) { z-index: 7; }
.seat-top .card.back:nth-child(8),
.seat-left .card.back:nth-child(8),
.seat-right .card.back:nth-child(8) { z-index: 8; }

.card {
  position: relative;
  width: 62px;
  /* The Vector Cards 3.2 bordered source ratio is authoritative everywhere. */
  aspect-ratio: 63 / 88;
  min-width: 0;
  min-height: 0;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: visible;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #151515;
  font-weight: 900;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 12px 22px rgba(0, 0, 0, 0.34);
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.card img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: block;
  object-fit: fill;
  border-radius: 0;
  pointer-events: none;
}

.card.back {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.card.back img.card-back-art {
  object-fit: fill;
  /* Trim only the pale raster rim with minimal resampling. */
  transform: scale(1.055);
}

.seat-bottom .card {
  width: clamp(70px, 6.2vw, 86px);
  margin-left: clamp(-44px, -3vw, -32px);
  transform-origin: 50% 150%;
  /* Symmetric fan: JS sets --rot/--ty per card so the hand stays centred for any card count. */
  transform: rotate(var(--rot, 0deg)) translateY(var(--ty, 0px));
}

.seat-bottom .card:nth-child(1) { z-index: 1; }
.seat-bottom .card:nth-child(2) { z-index: 2; }
.seat-bottom .card:nth-child(3) { z-index: 3; }
.seat-bottom .card:nth-child(4) { z-index: 4; }
.seat-bottom .card:nth-child(5) { z-index: 5; }
.seat-bottom .card:nth-child(6) { z-index: 6; }
.seat-bottom .card:nth-child(7) { z-index: 7; }
.seat-bottom .card:nth-child(8) { z-index: 8; }

.seat-bottom .card:first-child {
  margin-left: 0;
}

.card.playable {
  border-color: var(--gold-soft);
  box-shadow:
    0 0 0 3px rgba(231, 208, 139, 0.58),
    0 14px 24px rgba(0, 0, 0, 0.32);
}

/* Bidding: give the hand the same highlighted look as the playable cards mid-game so the formatting stays consistent across phases. */
body[data-phase="BID_FIRST"] .seat-bottom .hand .card:not(.back),
body[data-phase="BID_SECOND"] .seat-bottom .hand .card:not(.back),
body[data-phase="PREPLAY_DOUBLE"] .seat-bottom .hand .card:not(.back) {
  border-color: var(--gold-soft);
  box-shadow:
    0 0 0 3px rgba(231, 208, 139, 0.58),
    0 14px 24px rgba(0, 0, 0, 0.32);
}

.seat-bottom .card.premove {
  z-index: 30;
}

.seat-bottom .card.selected {
  /* Lift the chosen card a little but keep its place in the fan (no z-index jump) so it doesn't cover its neighbours. */
  transform: translateY(-22px) !important;
  border-color: var(--gold);
  box-shadow:
    0 0 0 3px rgba(231, 208, 139, 0.72),
    0 16px 26px rgba(0, 0, 0, 0.36);
}

body.is-your-turn .seat.viewer.active .hand .card.selected {
  animation: none;
}

@media (hover: hover) and (pointer: fine) {
  .card.playable:hover {
    transform: translateY(-16px) scale(1.03) !important;
  }

  .seat-bottom .card.playable:hover {
    z-index: 30;
  }
}

.card.premove-ready {
  border-color: rgba(155, 195, 206, 0.82);
}

.card.premove {
  border-color: var(--blue);
  box-shadow:
    0 0 0 3px rgba(155, 195, 206, 0.44),
    0 13px 24px rgba(0, 0, 0, 0.3);
}

.card.premove::after {
  content: "";
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 2px white;
}

.card.dim {
  opacity: 1;
  filter: saturate(0.96) brightness(0.96);
}

.play-slot {
  position: absolute;
  min-width: 90px;
  min-height: 124px;
  display: grid;
  place-items: center;
  z-index: 10;
  transform-style: preserve-3d;
}

.play-slot .card {
  width: clamp(84px, 6.9vw, 102px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 4px 7px rgba(0, 0, 0, 0.2),
    0 20px 34px rgba(0, 0, 0, 0.42);
}

.play-slot-top {
  top: 29%;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
}

.play-slot-right {
  right: 22%;
  top: 52%;
  transform: translateY(-50%) rotate(4deg);
}

.play-slot-bottom {
  bottom: 27%;
  left: 50%;
  transform: translateX(-50%) rotate(2deg);
}

.play-slot-left {
  left: 22%;
  top: 52%;
  transform: translateY(-50%) rotate(-4deg);
}

.play-slot.winner .card {
  border-color: var(--gold-soft);
  box-shadow:
    0 0 0 4px rgba(231, 208, 139, 0.72),
    0 14px 24px rgba(0, 0, 0, 0.36);
  transform: scale(1.08);
}

.play-slot.winner::after {
  content: "الفائز";
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  padding: 4px 9px;
  border-radius: var(--radius);
  background: var(--gold);
  color: var(--accent-fg);
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

/* ===== Card play + trick-collect animations ===== */
@keyframes card-throw-top {
  0%   { opacity: 0; transform: translate(0, -135px) scale(0.6) rotate(-11deg); }
  55%  { opacity: 1; }
  82%  { transform: translate(0, 6px) scale(1.03) rotate(0); }
  100% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
}
@keyframes card-throw-bottom {
  0%   { opacity: 0; transform: translate(0, 135px) scale(0.6) rotate(11deg); }
  55%  { opacity: 1; }
  82%  { transform: translate(0, -6px) scale(1.03) rotate(0); }
  100% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
}
@keyframes card-throw-left {
  0%   { opacity: 0; transform: translate(-155px, 0) scale(0.6) rotate(-13deg); }
  55%  { opacity: 1; }
  82%  { transform: translate(7px, 0) scale(1.03) rotate(0); }
  100% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
}
@keyframes card-throw-right {
  0%   { opacity: 0; transform: translate(155px, 0) scale(0.6) rotate(13deg); }
  55%  { opacity: 1; }
  82%  { transform: translate(-7px, 0) scale(1.03) rotate(0); }
  100% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
}

.play-slot-top .card.just-played    { animation: card-throw-top 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.play-slot-bottom .card.just-played { animation: card-throw-bottom 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.play-slot-left .card.just-played   { animation: card-throw-left 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.play-slot-right .card.just-played  { animation: card-throw-right 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes winner-pop {
  0%   { scale: 1; }
  45%  { scale: 1.14; }
  100% { scale: 1; }
}

.play-slot.winner .card {
  animation: winner-pop 460ms ease-out;
}

/* ===== Deal animation (new hand) ===== */
@keyframes deal-in {
  from { opacity: 0; translate: 0 38px; }
  to   { opacity: 1; translate: 0 0; }
}

body.dealing .hand .card {
  animation: deal-in 360ms ease both;
}

/* The 3 cards revealed on the viewer's first turn deal in one by one.
   Uses the standalone translate/scale properties so the fan's transform (rotation) is preserved. */
@keyframes deal-late-in {
  from { opacity: 0; translate: 0 72px; scale: 0.82; }
  55%  { opacity: 1; }
  to   { opacity: 1; translate: 0 0; scale: 1; }
}
.card.deal-late {
  animation: deal-late-in 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.dealing .hand .card:nth-child(1) { animation-delay: 0ms; }
body.dealing .hand .card:nth-child(2) { animation-delay: 55ms; }
body.dealing .hand .card:nth-child(3) { animation-delay: 110ms; }
body.dealing .hand .card:nth-child(4) { animation-delay: 165ms; }
body.dealing .hand .card:nth-child(5) { animation-delay: 220ms; }
body.dealing .hand .card:nth-child(6) { animation-delay: 275ms; }
body.dealing .hand .card:nth-child(7) { animation-delay: 330ms; }
body.dealing .hand .card:nth-child(8) { animation-delay: 385ms; }

@keyframes card-collect-top    { to { opacity: 0; transform: translate(0, -190px) scale(0.5) rotate(-14deg); } }
@keyframes card-collect-bottom { to { opacity: 0; transform: translate(0, 190px) scale(0.5) rotate(14deg); } }
@keyframes card-collect-left   { to { opacity: 0; transform: translate(-230px, 0) scale(0.5) rotate(-14deg); } }
@keyframes card-collect-right  { to { opacity: 0; transform: translate(230px, 0) scale(0.5) rotate(14deg); } }

.play-slot .card.collect-top    { animation: card-collect-top 340ms ease-in both; }
.play-slot .card.collect-bottom { animation: card-collect-bottom 340ms ease-in both; }
.play-slot .card.collect-left   { animation: card-collect-left 340ms ease-in both; }
.play-slot .card.collect-right  { animation: card-collect-right 340ms ease-in both; }

/* While waiting for the winner to tap and sweep their trick. */
@keyframes collect-pulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.16); }
}
body.awaiting-collect .center-table {
  cursor: pointer;
}
body.awaiting-collect .center-table .play-slot .card {
  cursor: pointer;
  animation: collect-pulse 0.9s ease-in-out infinite;
}

/* Tap-anywhere overlay + countdown shown when the viewer must collect their trick. */
.collect-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: transparent;
  cursor: pointer;
}

.collect-prompt {
  position: absolute;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  animation: collect-pulse 0.9s ease-in-out infinite;
}

.collect-prompt-count {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: -12px;
  border-radius: 50%;
  background: rgba(7, 11, 10, 0.95);
  border: 3px solid var(--gold);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.collect-prompt-text {
  padding: 12px 20px 8px;
  border-radius: 12px;
  background: rgba(18, 16, 12, 0.92);
  border: 1px solid rgba(231, 208, 139, 0.4);
  color: var(--gold-soft);
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  .play-slot .card.just-played,
  .play-slot.winner .card,
  body.dealing .hand .card,
  .play-slot .card.collect-top,
  .play-slot .card.collect-bottom,
  .play-slot .card.collect-left,
  .play-slot .card.collect-right {
    animation: none !important;
  }
}

.exposed-card-view {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 35;
  display: none;
  justify-items: center;
  gap: 6px;
  transform: translate(-50%, -50%) translateZ(84px);
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
}

.exposed-card-view.visible {
  display: grid;
}

.exposed-card-view .card {
  width: 58px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 5px 8px rgba(0, 0, 0, 0.22),
    0 22px 36px rgba(0, 0, 0, 0.46);
}

.exposed-label {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 11, 10, 0.84);
  box-shadow: var(--shadow-soft);
}

.seat-speech {
  position: absolute;
  left: 50%;
  top: -10px;
  z-index: 26;
  max-width: min(260px, calc(100vw - 32px));
  padding: 7px 13px;
  transform: translate(-50%, -100%);
  border: 1px solid rgba(231, 208, 139, 0.55);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(38, 31, 17, 0.96), rgba(18, 15, 10, 0.96));
  color: var(--gold-soft);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
  animation: seat-speech-pop 200ms ease-out;
}

@keyframes seat-speech-pop {
  0%   { opacity: 0; transform: translate(-50%, -85%) scale(0.85); }
  100% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

.seat-speech::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%) rotate(45deg);
  border-right: 1px solid rgba(231, 208, 139, 0.55);
  border-bottom: 1px solid rgba(231, 208, 139, 0.55);
  background: rgba(18, 15, 10, 0.96);
}

.seat-speech.has-cards {
  white-space: normal;
  border-radius: 14px;
  padding: 7px 10px 9px;
  /* No pop here: it hardcodes translate(-50%) and would fight the per-seat shift,
     and it would re-fire on every render while the bubble persists. */
  animation: none;
}

/* Keep the project bubble on-screen for the side players (anchor inward). */
.seat-left .seat-speech.has-cards {
  transform: translate(-8%, -100%);
}

.seat-right .seat-speech.has-cards {
  transform: translate(-130%, -100%);
}

.seat-left .seat-speech.has-cards::after {
  left: 10%;
}

.seat-right .seat-speech.has-cards::after {
  left: 90%;
}

.seat-speech-cards {
  display: flex;
  direction: ltr;
  justify-content: center;
  margin-top: 6px;
}

.seat-speech-cards .mini-card {
  width: 38px;
  height: auto;
  margin-left: -17px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.seat-speech-cards .mini-card:first-child {
  margin-left: 0;
}

.project-showcase {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: none;
  pointer-events: none;
}

.project-showcase.visible {
  display: block;
}

.project-mat {
  position: absolute;
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(5, 15, 13, 0.8);
  box-shadow: var(--shadow-soft);
}

.project-mat-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
}

.project-mat-cards {
  display: flex;
  gap: 4px;
}

.project-mat .card {
  width: 40px;
}

.project-mat-top {
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
}

.project-mat-right {
  right: 9%;
  top: 50%;
  transform: translateY(-50%);
}

.project-mat-bottom {
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
}

.project-mat-left {
  left: 9%;
  top: 50%;
  transform: translateY(-50%);
}

.projects-panel {
  position: relative;
  display: none;
  gap: 8px;
}

.projects-panel:not(:empty) {
  display: grid;
}

.project-head,
.project-row,
.project-sub {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
}

.project-head strong {
  font-size: 14px;
}

.project-sub {
  width: fit-content;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.project-list {
  display: grid;
  gap: 7px;
}

.project-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px;
}

.project-row.shown {
  border-color: rgba(131, 185, 154, 0.42);
}

.project-row strong,
.project-row span {
  display: block;
  min-width: 0;
}

.project-row span,
.project-state {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.project-cards {
  display: flex;
  gap: 3px;
  align-items: center;
}

.mini-card {
  width: 25px;
  height: auto;
  aspect-ratio: 63 / 88;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #111;
  font-size: 10px;
  font-weight: 900;
}

.mini-card img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: block;
  object-fit: fill;
  border-radius: 0;
}

.players-list {
  position: relative;
  display: grid;
  gap: 7px;
}

.player-line {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 60%),
    rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.player-line strong,
.player-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-line strong {
  font-size: 13px;
}

.player-line span {
  color: var(--muted);
  font-size: 11px;
}

.table-phase-actions {
  position: static;
  z-index: auto;
  width: min(560px, 100%);
  min-width: 0;
  flex: 1 1 420px;
  display: none;
  padding: 0;
  transform: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.table-phase-actions.visible {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.table-phase-action-head {
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 950;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: right;
  white-space: nowrap;
}

.phase-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
}

.phase-action {
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 60%),
    rgba(247, 241, 230, 0.04);
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.phase-action:hover {
  transform: translateY(-1px);
  border-color: rgba(231, 208, 139, 0.5);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 60%),
    rgba(255, 255, 255, 0.075);
}

.phase-action.primary {
  border-color: rgba(197, 154, 63, 0.68);
  background: linear-gradient(180deg, var(--brass-400), var(--brass-500) 54%, var(--brass-700));
  color: var(--accent-fg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 6px 16px rgba(0, 0, 0, 0.3);
}

.phase-action.muted {
  background: rgba(36, 48, 45, 0.6);
}

.phase-action.danger {
  border-color: rgba(225, 163, 152, 0.48);
  background: rgba(122, 46, 42, 0.42);
  color: var(--text);
}

body[data-phase="BID_FIRST"] .table-core,
body[data-phase="BID_SECOND"] .table-core,
body[data-phase="PREPLAY_DOUBLE"] .table-core {
  display: none;
}

body[data-phase="BID_FIRST"] .seat-bottom .seat-head,
body[data-phase="BID_SECOND"] .seat-bottom .seat-head,
body[data-phase="PREPLAY_DOUBLE"] .seat-bottom .seat-head {
  opacity: 0;
  pointer-events: none;
}

body[data-phase="BID_FIRST"] .seat-bottom .hand,
body[data-phase="BID_SECOND"] .seat-bottom .hand,
body[data-phase="PREPLAY_DOUBLE"] .seat-bottom .hand {
  /* Keep the hand in the player's zone during bidding; the action rail sits below it. */
  transform: none;
  transform-origin: center bottom;
}

body[data-phase="BID_FIRST"] .table-phase-actions,
body[data-phase="BID_SECOND"] .table-phase-actions,
body[data-phase="PREPLAY_DOUBLE"] .table-phase-actions {
  bottom: auto;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 100;
  max-width: calc(100% - 36px);
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(7, 11, 10, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
}

@media (max-width: 1280px) {
  .game-layout {
    grid-template-columns: 190px minmax(640px, 1fr) 190px;
  }

  .center-table {
    width: min(550px, calc(100svh - 250px), calc(100% - 230px));
  }
}

@media (max-width: 1050px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .side {
    display: none;
  }

  .center-table {
    width: min(590px, calc(100svh - 245px), calc(100% - 170px));
  }

  .seat-left {
    left: max(14px, 2vw);
  }

  .seat-right {
    right: max(14px, 2vw);
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 6px 6px calc(10px + var(--safe-bottom));
  }

  .topbar {
    min-height: 54px;
    padding: 6px 8px;
  }

  .brand-row {
    gap: 7px;
  }

  .mark,
  .icon-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .icon-button {
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .icon-button::before {
    font-size: 18px;
  }

  #copyInviteButton::before {
    content: "...";
    letter-spacing: 2px;
  }

  #newMatchButton {
    display: none;
  }

  #homeButton::before {
    content: "◐";
  }

  .mark {
    font-size: 21px;
  }

  h1 {
    font-size: 23px;
  }

  #championLine,
  .session-pill {
    display: none;
  }

  .lobby {
    margin-top: 12px;
  }

  .lobby-main {
    padding: 16px;
  }

  .lobby-title h2 {
    font-size: 25px;
  }

  .mode-grid,
  .lobby-side {
    grid-template-columns: 1fr;
  }

  .field-row,
  .join-row {
    align-items: stretch;
    flex-direction: column;
  }

  .field-row label {
    width: auto;
    padding-bottom: 0;
  }

  .game {
    margin-top: 8px;
  }

  .game-layout,
  .table-wrap,
  .table-board {
    min-height: calc(100svh - 90px);
  }

  .table-board {
    height: calc(100svh - 90px);
  }

  .score-panel {
    top: 8px;
    width: calc(100% - 18px);
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .room-card {
    display: none;
  }

  .score-grid {
    width: min(270px, 100%);
  }

  .score-grid > div {
    padding: 5px 10px;
  }

  .score-grid span {
    font-size: 9px;
  }

  .score-grid strong {
    font-size: 21px;
  }

  .center-table {
    top: 46.5%;
    width: min(88vw, calc(100svh - 372px), 410px);
    box-shadow:
      0 15px 34px rgba(0, 0, 0, 0.42),
      0 0 0 6px rgba(74, 47, 32, 0.76);
  }

  .seat-top {
    top: 98px;
    width: min(270px, calc(100% - 64px));
  }

  .seat-left,
  .seat-right {
    top: 47%;
    width: 142px;
  }

  .seat-left {
    left: -30px;
  }

  .seat-right {
    right: -30px;
  }

  .seat-head,
  .seat-left .seat-head,
  .seat-right .seat-head {
    max-width: 142px;
    min-height: 38px;
    grid-template-columns: 28px minmax(0, 1fr) 24px;
    gap: 5px;
    padding: 5px 6px;
  }

  .seat-top .seat-head,
  .seat-left .seat-head,
  .seat-right .seat-head {
    grid-template-columns: 1fr;
    justify-items: center;
    max-width: 88px;
    min-width: 58px;
    min-height: 0;
    gap: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .seat-title {
    font-size: 11px;
  }

  .seat-title span:first-child {
    max-width: 74px;
  }

  .seat-avatar {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .seat-top .seat-avatar,
  .seat-left .seat-avatar,
  .seat-right .seat-avatar {
    width: 36px;
    height: 36px;
    font-size: 12px;
  }

  .seat-top .seat-copy,
  .seat-left .seat-copy,
  .seat-right .seat-copy {
    min-width: 58px;
    max-width: 80px;
    margin-top: -5px;
    padding: 4px 5px 3px;
  }

  .seat-top .seat-title,
  .seat-left .seat-title,
  .seat-right .seat-title {
    font-size: 9px;
  }

  .seat-top .seat-title span:first-child,
  .seat-left .seat-title span:first-child,
  .seat-right .seat-title span:first-child {
    max-width: 68px;
  }

  .card-count {
    width: 24px;
    min-width: 24px;
    height: 24px;
  }

  .seat-top .card-count,
  .seat-left .card-count,
  .seat-right .card-count {
    width: 20px;
    min-width: 20px;
    height: 20px;
    font-size: 9px;
  }

  .seat-meta {
    display: none;
  }

  .buyer-badge,
  .declarer-badge {
    position: absolute;
    right: 40px;
    bottom: -18px;
    min-height: 16px;
    padding-inline: 5px;
    font-size: 8px;
  }

  .seat-left .buyer-badge,
  .seat-right .buyer-badge,
  .seat-left .declarer-badge,
  .seat-right .declarer-badge {
    background: rgba(197, 154, 63, 0.22);
  }

  .seat-top .card.back,
  .seat-left .card.back,
  .seat-right .card.back {
    width: 25px;
    height: auto;
    margin-left: -16px;
  }

  .seat-left .card.back,
  .seat-right .card.back {
    width: 26px;
    height: auto;
    margin-left: -26px;
  }

  .seat-top .card.back {
    width: 26px;
    height: auto;
    margin-left: -26px;
  }

  .seat-top .card.back:first-child,
  .seat-left .card.back:first-child,
  .seat-right .card.back:first-child {
    margin-left: 0;
  }

  .seat-left .hand,
  .seat-right .hand {
    max-width: 62px;
    min-height: 48px;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .seat-top .hand {
    max-width: 68px;
    min-height: 48px;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .seat-top .card.back:nth-child(1),
  .seat-left .card.back:nth-child(1),
  .seat-right .card.back:nth-child(1) { transform: rotate(-42deg); }
  .seat-top .card.back:nth-child(2),
  .seat-left .card.back:nth-child(2),
  .seat-right .card.back:nth-child(2) { transform: rotate(-30deg); }
  .seat-top .card.back:nth-child(3),
  .seat-left .card.back:nth-child(3),
  .seat-right .card.back:nth-child(3) { transform: rotate(-18deg); }
  .seat-top .card.back:nth-child(4),
  .seat-left .card.back:nth-child(4),
  .seat-right .card.back:nth-child(4) { transform: rotate(-6deg); }
  .seat-top .card.back:nth-child(5),
  .seat-left .card.back:nth-child(5),
  .seat-right .card.back:nth-child(5) { transform: rotate(6deg); }
  .seat-top .card.back:nth-child(6),
  .seat-left .card.back:nth-child(6),
  .seat-right .card.back:nth-child(6) { transform: rotate(18deg); }
  .seat-top .card.back:nth-child(7),
  .seat-left .card.back:nth-child(7),
  .seat-right .card.back:nth-child(7) { transform: rotate(30deg); }
  .seat-top .card.back:nth-child(8),
  .seat-left .card.back:nth-child(8),
  .seat-right .card.back:nth-child(8) { transform: rotate(42deg); }

  .seat-bottom {
    bottom: calc(10px + var(--safe-bottom));
    width: calc(100% - 8px);
  }

  .seat-bottom .hand {
    min-height: 138px;
    padding: 0 2px;
  }

  .seat-bottom .seat-head {
    margin-top: -5px;
  }

  .seat-bottom .card {
    width: clamp(66px, 19vw, 84px);
    /* Tighter overlap so all 8 cards fit the phone width without shrinking them. */
    margin-left: clamp(-46px, -10vw, -32px);
    transform-origin: 50% 150%;
  }

  .play-slot {
    min-width: 58px;
    min-height: 82px;
  }

  .play-slot .card {
    width: clamp(60px, 15vw, 72px);
  }

  .play-slot-top {
    top: 29%;
  }

  .play-slot-right {
    right: 28%;
  }

  .play-slot-bottom {
    bottom: 26%;
  }

  .play-slot-left {
    left: 28%;
  }

  .exposed-card-view {
    top: 46.5%;
  }

  .exposed-card-view .card {
    width: 72px;
  }

  .table-core {
    top: clamp(210px, 30svh, 254px);
    right: auto;
    left: 50%;
    min-width: 156px;
    min-height: 31px;
    max-width: min(250px, calc(100% - 36px));
    padding: 5px 8px;
    transform: translateX(-50%);
  }

  /* Mobile bidding: no panel box — just the buttons, in a single compact row. */
  .table-phase-actions {
    bottom: calc(150px + var(--safe-bottom));
    width: min(370px, calc(100% - 14px));
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
    gap: 6px;
  }

  .table-phase-action-head {
    font-size: 11px;
    font-weight: 850;
    color: var(--gold-soft);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  }

  .phase-action-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .phase-action {
    min-height: 44px;
    min-width: 0;
    padding: 6px 13px;
    font-size: 13px;
    white-space: nowrap;
    border-radius: 9px;
    background: rgba(20, 28, 25, 0.9);
    border-color: rgba(231, 208, 139, 0.28);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.42);
  }

  .phase-action.muted {
    background: rgba(36, 48, 45, 0.86);
  }

  body[data-phase="BID_FIRST"] .seat-bottom .hand,
  body[data-phase="BID_SECOND"] .seat-bottom .hand,
  body[data-phase="PREPLAY_DOUBLE"] .seat-bottom .hand {
    transform: none;
  }
}

/* ===== Canonical post-H playable review readiness ===== */
.review-mode-button {
  grid-column: 1 / -1;
  border-color: rgba(231, 208, 139, 0.55);
  background:
    linear-gradient(135deg, rgba(231, 208, 139, 0.16), rgba(32, 80, 65, 0.2)),
    rgba(17, 25, 22, 0.94);
}

.review-pack {
  display: grid;
  gap: 18px;
  margin-top: 20px;
  padding: 20px;
  direction: rtl;
  border: 1px solid rgba(231, 208, 139, 0.34);
  border-radius: var(--radius-lg);
  background: rgba(7, 12, 10, 0.72);
}

.review-pack-head,
.review-section-head,
.review-modal-head,
.review-timeline-head,
.review-context-tools,
.review-feedback-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.review-pack-head span,
.review-modal-head span,
.review-section-head span,
.review-meta span,
.review-context-tools span,
.review-feedback-actions span {
  color: var(--muted);
  font-size: 12px;
}

.review-pack-head h3,
.review-modal-head h2 {
  margin: 4px 0 0;
  color: var(--text);
}

.review-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.review-pack-guide {
  margin: -6px 0 0;
  padding: 10px 12px;
  border-inline-start: 3px solid var(--gold);
  border-radius: 8px;
  background: rgba(197, 154, 63, 0.08);
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.review-feedback-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(95, 156, 125, 0.42);
  border-radius: 10px;
  background: rgba(34, 84, 67, 0.13);
}

.review-feedback-progress span,
.review-feedback-progress strong {
  display: block;
}

.review-feedback-progress span {
  color: var(--muted);
  font-size: 11px;
}

.review-feedback-progress strong {
  margin-top: 3px;
  color: var(--text);
  font-size: 13px;
}

.review-feedback-progress button {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid rgba(95, 156, 125, 0.58);
  border-radius: 9px;
  background: rgba(34, 84, 67, 0.36);
  color: #d8f1e4;
  font-weight: 850;
}

.review-feedback-progress button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.review-meta > div,
.review-identity > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.review-meta strong,
.review-identity strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-section {
  display: grid;
  gap: 10px;
}

.review-section-head strong {
  color: var(--gold);
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.review-match-button,
.review-scenario-button {
  min-height: 58px;
  padding: 10px;
  text-align: right;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(25, 36, 32, 0.9);
  color: var(--text);
}

.review-match-button span,
.review-scenario-button span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.review-match-button:hover,
.review-scenario-button:hover {
  border-color: var(--gold-soft);
  transform: translateY(-1px);
}

.review-match-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.review-match-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.review-scenario-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.review-identity {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.42fr);
  gap: 8px;
  margin: 10px 14px 0;
  padding: 10px;
  direction: rtl;
  border: 1px solid rgba(231, 208, 139, 0.32);
  border-radius: 12px;
  background: rgba(7, 12, 10, 0.9);
}

.review-match-heading,
.review-contract-owner {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.review-match-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-match-heading > div {
  min-width: 0;
}

.review-match-heading small,
.review-contract-owner span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.review-contract-owner {
  border-color: rgba(231, 208, 139, 0.44);
  background: rgba(197, 154, 63, 0.1);
}

.review-contract-owner strong {
  margin-top: 5px;
  color: var(--gold-soft);
  font-size: 14px;
  white-space: normal;
}

.review-contract-owner.pending {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.review-identity span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.review-identity-copy {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(231, 208, 139, 0.32);
  border-radius: 9px;
  background: rgba(231, 208, 139, 0.1);
  color: var(--gold);
  font-size: 11px;
  white-space: nowrap;
}

.review-technical-details,
.review-feedback-disclosure {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.review-identity > .review-technical-details,
.review-identity > .review-feedback-disclosure {
  grid-column: 1 / -1;
}

.review-technical-details > summary,
.review-feedback-disclosure > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.review-feedback-disclosure > summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.review-technical-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 10px 10px;
}

.review-technical-grid > div {
  min-width: 0;
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.review-technical-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.review-technical-grid strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
}

.review-modal-card {
  display: grid;
  gap: 16px;
  width: min(980px, 100%);
  max-height: calc(100svh - 48px);
  padding: 20px;
  overflow: auto;
  direction: rtl;
  border: 1px solid rgba(231, 208, 139, 0.42);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #16201c, #090d0b);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
}

.review-scenario-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.review-summary-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.review-summary-card h3 {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 13px;
}

.review-summary-card ul {
  margin: 0;
  padding-inline-start: 20px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.review-summary-card.questions {
  border-color: rgba(231, 208, 139, 0.32);
}

.review-summary-card.expected {
  border-color: rgba(95, 156, 125, 0.42);
}

.review-summary-card.privacy {
  border-color: rgba(225, 163, 152, 0.32);
}

.review-context-card dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.review-context-card dl > div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.review-context-card dt {
  color: var(--muted);
  font-size: 11px;
}

.review-context-card dd {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-timeline {
  display: grid;
  gap: 8px;
}

.review-step-card {
  min-height: 260px;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(5, 8, 6, 0.82);
}

.review-step-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-step-heading span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(197, 154, 63, 0.14);
  color: var(--gold-soft);
  font-size: 11px;
  font-weight: 900;
}

.review-step-heading strong {
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.review-step-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.review-step-facts > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.review-step-facts span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.review-step-facts strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-step-card .review-summary-card {
  padding: 10px 12px;
}

.review-automated-check {
  padding: 11px 12px;
  border-inline-start: 3px solid var(--status-success);
  border-radius: 8px;
  background: rgba(95, 156, 125, 0.1);
  color: var(--text);
  font-size: 12px;
}

.review-step-technical pre {
  max-height: 34svh;
  margin: 0 10px 10px;
  padding: 12px;
  overflow: auto;
  border-radius: 8px;
  background: #050806;
  color: #d9e8df;
  font: 11px/1.55 Consolas, "Cascadia Mono", monospace;
  white-space: pre-wrap;
}

.review-context-tools {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.review-context-tools button,
.review-copy-feedback {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid rgba(231, 208, 139, 0.42);
  border-radius: 9px;
  background: rgba(197, 154, 63, 0.14);
  color: var(--gold-soft);
  font-weight: 850;
}

.review-feedback-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  direction: rtl;
  border: 1px solid rgba(231, 208, 139, 0.32);
  border-radius: 11px;
  background: rgba(10, 16, 13, 0.82);
}

.review-feedback-disclosure .review-feedback-form {
  margin: 0 10px 10px;
}

.review-feedback-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.review-feedback-form legend,
.review-note-field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.review-verdict-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.review-verdict-option {
  min-width: 0;
  min-height: 64px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.review-verdict-option:has(input:checked) {
  border-color: rgba(231, 208, 139, 0.72);
  background: rgba(197, 154, 63, 0.12);
  box-shadow: 0 0 0 2px rgba(231, 208, 139, 0.12);
}

.review-verdict-option input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--gold);
}

.review-verdict-option span {
  min-width: 0;
}

.review-verdict-option strong,
.review-verdict-option small,
.review-verdict-option code {
  display: block;
}

.review-verdict-option strong {
  color: var(--text);
  font-size: 13px;
}

.review-verdict-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.review-verdict-option code {
  margin-top: 4px;
  color: var(--gold-soft);
  font-size: 9px;
}

.review-note-field textarea {
  width: 100%;
  min-height: 86px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(7, 11, 10, 0.9);
  color: var(--text);
  line-height: 1.6;
}

.review-note-field textarea::placeholder {
  color: var(--muted);
}

.review-feedback-status {
  color: var(--text) !important;
  line-height: 1.5;
}

.review-copy-feedback:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.review-feedback-boundary {
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 900px) {
  .review-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .review-meta,
  .review-identity {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .review-pack {
    padding: 13px;
  }

  .review-grid,
  .review-scenario-list,
  .review-scenario-summary,
  .review-meta,
  .review-identity,
  .review-verdict-grid,
  .review-step-facts,
  .review-technical-grid {
    grid-template-columns: 1fr;
  }

  .review-match-heading,
  .review-step-heading,
  .review-context-tools,
  .review-feedback-actions,
  .review-feedback-progress,
  .review-feedback-disclosure > summary {
    align-items: stretch;
    flex-direction: column;
  }

  .review-identity-copy,
  .review-context-tools button,
  .review-feedback-progress button,
  .review-copy-feedback {
    width: 100%;
  }

  .review-step-heading strong {
    text-align: right;
  }

  .review-modal {
    padding: 8px;
  }

  .review-modal-card {
    max-height: calc(100svh - 16px);
    padding: 14px;
  }
}

@media (max-width: 430px) {
  .center-table {
    width: min(88vw, calc(100svh - 390px), 356px);
  }

  .seat-left,
  .seat-right {
    width: 136px;
  }

  .seat-head,
  .seat-left .seat-head,
  .seat-right .seat-head {
    max-width: 136px;
  }

  .seat-title span:first-child {
    max-width: 68px;
  }

  .table-core {
    top: clamp(206px, 30svh, 246px);
  }

  .table-phase-action-head {
    font-size: 14px;
  }

  .phase-action {
    min-height: 46px;
    font-size: 14px;
  }
}

@media (max-width: 760px) and (max-height: 700px) {
  .exposed-card-view {
    top: 40%;
  }

}

/* ===== Bottom player bar (groups the player's name + options) ===== */
.bottom-bar {
  display: none;
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-bottom));
  z-index: 96;
  width: min(820px, calc(100% - 40px));
  min-height: 62px;
  grid-template-columns: minmax(92px, 1fr) minmax(92px, 1fr) auto minmax(92px, 1fr) minmax(92px, 1fr);
  align-items: center;
  justify-content: stretch;
  gap: 8px;
  padding: 8px 10px;
  transform: translateX(-50%);
  direction: rtl;
  border: 1px solid rgba(231, 208, 139, 0.26);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 56%),
    linear-gradient(180deg, rgba(20, 28, 25, 0.97), rgba(8, 11, 10, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 44px rgba(0, 0, 0, 0.5);
}

body[data-phase="BID_FIRST"] .bottom-bar,
body[data-phase="BID_SECOND"] .bottom-bar,
body[data-phase="PREPLAY_DOUBLE"] .bottom-bar {
  display: grid;
}

.bottom-bar-player {
  display: flex;
  align-items: center;
  justify-self: center;
  grid-column: 3;
  grid-row: 1;
  gap: 9px;
  min-width: 116px;
  flex: 0 0 auto;
  padding: 5px 12px;
  direction: rtl;
  border-radius: 999px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 60%),
    rgba(7, 11, 10, 0.55);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.bottom-bar .table-phase-actions {
  width: auto;
  max-width: none;
}

.bottom-bar .table-phase-actions.visible,
.bottom-bar .phase-action-grid {
  display: contents;
}

.bottom-bar .table-phase-action-head {
  display: none;
}

.bottom-bar .phase-action {
  width: 100%;
  min-width: 0;
  align-self: center;
  justify-self: stretch;
  direction: rtl;
  white-space: nowrap;
}

.bottom-bar .phase-action-left-1 {
  grid-column: 4;
  grid-row: 1;
}

.bottom-bar .phase-action-left-2 {
  grid-column: 5;
  grid-row: 1;
}

.bottom-bar .phase-action-right-1 {
  grid-column: 1;
  grid-row: 1;
}

.bottom-bar .phase-action-right-2 {
  grid-column: 2;
  grid-row: 1;
}

.bottom-bar .phase-action-overflow {
  grid-column: span 1;
}

body.has-canonical-phase-actions[data-phase="PROJECT_OPPORTUNITY"] .bottom-bar,
body.has-canonical-phase-actions[data-phase="PLAY_TRICKS"] .bottom-bar {
  display: flex;
  width: min(980px, calc(100% - 40px));
  overflow-x: auto;
}

body.has-canonical-phase-actions[data-phase="PROJECT_OPPORTUNITY"] .bottom-bar .table-phase-actions,
body.has-canonical-phase-actions[data-phase="PLAY_TRICKS"] .bottom-bar .table-phase-actions {
  display: flex;
  gap: 7px;
}

body.has-canonical-phase-actions[data-phase="PROJECT_OPPORTUNITY"] .bottom-bar .phase-action,
body.has-canonical-phase-actions[data-phase="PLAY_TRICKS"] .bottom-bar .phase-action {
  min-width: 110px;
}

body.is-your-turn .bottom-bar-player {
  border-color: var(--gold-soft);
  box-shadow:
    0 0 0 2px rgba(231, 208, 139, 0.45),
    0 0 18px rgba(231, 208, 139, 0.22);
}

.bottom-bar-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--gold-soft);
  background: radial-gradient(circle at 50% 40%, #f5f2e8 0 40%, #cbb489 41% 100%);
  color: #2a2112;
  font-weight: 950;
  font-size: 16px;
}

.bottom-bar-name {
  min-width: 0;
  max-width: 86px;
  color: var(--text);
  font-weight: 850;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .bottom-bar {
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 96;
    display: flex;
    width: auto;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 6px 8px calc(6px + var(--safe-bottom));
    min-height: calc(56px + var(--safe-bottom));
    transform: none;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    background: linear-gradient(180deg, rgba(20, 24, 22, 0.96), rgba(8, 11, 10, 0.98));
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.42);
  }

  body[data-phase="BID_FIRST"] .bottom-bar,
  body[data-phase="BID_SECOND"] .bottom-bar,
  body[data-phase="PREPLAY_DOUBLE"] .bottom-bar {
    display: grid;
    grid-template-columns: minmax(58px, 1fr) minmax(58px, 1fr) auto minmax(58px, 1fr) minmax(58px, 1fr);
    gap: 5px;
  }

  .bottom-bar-player {
    grid-column: 3;
    justify-self: center;
    min-width: 0;
    gap: 6px;
    padding: 3px 7px;
  }

  .bottom-bar-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .bottom-bar-name {
    max-width: 44px;
    font-size: 13px;
  }

  .bottom-bar .phase-action {
    min-height: 40px;
    padding: 6px 7px;
    font-size: 12px;
    line-height: 1.1;
    white-space: normal;
  }

  /* rest the hand just above the bar; the name now lives in the bar */
  .seat-bottom {
    bottom: calc(50px + var(--safe-bottom));
  }

  .seat-bottom .seat-head {
    display: none;
  }
}
