:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #5d6863;
  --paper: #f4f5f0;
  --surface: #ffffff;
  --line: #d9ddd6;
  --table: #14523f;
  --table-deep: #0e3d30;
  --table-line: #3d806b;
  --red: #a62d3f;
  --red-soft: #f8e8eb;
  --blue: #1f568c;
  --blue-soft: #e7f0f8;
  --gold: #d4a84d;
  --danger: #a32935;
  --header: #595959;
  --lime: #43dc20;
  --shadow: 0 16px 40px rgba(24, 39, 34, 0.12);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  min-height: 100vh;
  background-image:
    linear-gradient(rgba(20, 82, 63, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 82, 63, 0.025) 1px, transparent 1px);
  background-size: 24px 24px;
}

button,
input,
select {
  font: inherit;
}

button,
input[type="checkbox"] {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #f0b84a;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  min-height: 64px;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(14, 61, 48, 0.16);
  background: rgba(244, 245, 240, 0.94);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 3px solid #ff1f2d;
  border-radius: 50%;
  background: var(--table);
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
}

.header-context {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.setup-shell {
  width: min(1180px, 100%);
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 68px) clamp(18px, 5vw, 64px);
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(560px, 1.28fr);
  gap: clamp(34px, 6vw, 84px);
  align-items: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--table);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow sup {
  font-size: 0.65em;
  line-height: 0;
  vertical-align: super;
}

.setup-copy h1 {
  max-width: 520px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 4.8vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.setup-intro {
  max-width: 480px;
  margin: 22px 0 24px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.team-key {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.team-key-item {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 700;
}

.team-red {
  color: var(--red);
}

.team-blue {
  color: var(--blue);
}

.team-symbol {
  margin-right: 3px;
}

.table-directory {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.table-directory h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
}

.table-list {
  max-height: 320px;
  margin-top: 14px;
  display: grid;
  gap: 8px;
  overflow-y: auto;
}

.table-list-item {
  padding: 12px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--table);
  border-radius: 4px;
  background: var(--surface);
}

.table-list-summary h3,
.table-list-summary p {
  margin: 0;
}

.table-list-summary h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.table-list-summary p,
.table-list-summary span,
.empty-directory {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.history-raw-json {
  max-height: 70vh;
  overflow: auto;
  padding: 16px;
  border: 1px solid #cbd2cc;
  border-radius: 6px;
  background: #f4f7f5;
  font-size: 0.76rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.table-list-actions,
.table-list-actions form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-list-actions a {
  text-decoration: none;
}

.table-list-actions .button {
  min-height: 36px;
  padding: 0 11px;
  font-size: 0.72rem;
}

.setup-form {
  min-width: 0;
}

.setup-auth-required {
  min-width: 0;
  padding: clamp(24px, 5vw, 48px) 0;
  border-top: 4px solid var(--table);
  border-bottom: 1px solid var(--line);
}

.setup-auth-required h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: 0;
}

.setup-auth-required > p:not(.eyebrow) {
  max-width: 480px;
  color: var(--muted);
  line-height: 1.6;
}

.setup-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.setup-auth-actions a {
  text-decoration: none;
}

.table-name-field {
  margin-bottom: 22px;
  display: grid;
  gap: 5px;
  font-size: 0.84rem;
  font-weight: 700;
}

.table-name-field input {
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid #aeb6b0;
  border-radius: 4px;
  background: var(--surface);
}

.table-name-field small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 400;
}

.seat-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.setup-table {
  position: relative;
  width: 100%;
  aspect-ratio: 1.55 / 1;
  min-height: 360px;
  border: 10px solid #ff1f2d;
  border-radius: 48%;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.06) 0 45%, transparent 46%),
    var(--table);
  box-shadow: inset 0 0 0 2px #721c2a, var(--shadow);
}

.setup-table-center {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 36%;
  aspect-ratio: 1.5 / 1;
  display: grid;
  place-content: center;
  text-align: center;
  color: rgba(255, 255, 255, 0.82);
}

.setup-table-center strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.6rem;
  color: white;
  line-height: 1;
}

.setup-table-center > span:last-child {
  margin-top: 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.table-suit-row {
  color: #111111;
  font-size: 0.86rem;
  letter-spacing: 0.16em;
}

.table-suit-row b {
  color: #d11f32;
}

.seat-choice {
  position: absolute;
  width: clamp(98px, 24%, 132px);
  min-height: 74px;
  cursor: pointer;
  color: var(--ink);
}

.seat-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seat-choice-body {
  width: 100%;
  min-height: 74px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 5px 14px rgba(8, 27, 21, 0.16);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.seat-choice:hover .seat-choice-body {
  transform: translateY(-2px);
}

.seat-choice input:focus-visible + .seat-choice-body {
  outline: 3px solid #f0b84a;
  outline-offset: 3px;
}

.seat-choice input:checked + .seat-choice-body {
  border-color: currentColor;
  box-shadow: 0 0 0 3px currentColor, 0 7px 16px rgba(8, 27, 21, 0.18);
}

.seat-choice input:checked + .seat-choice-body .seat-role {
  color: white;
  background: currentColor;
}

.seat-number {
  grid-row: 1 / 3;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.85rem;
  line-height: 1;
}

.seat-team {
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
}

.seat-role {
  width: fit-content;
  padding: 2px 6px;
  border-radius: 3px;
  background: #edf0ec;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.seat-1 {
  left: 50%;
  bottom: -26px;
  transform: translateX(-50%);
}

.seat-2 {
  right: -25px;
  bottom: 18%;
}

.seat-3 {
  right: -25px;
  top: 18%;
}

.seat-4 {
  left: 50%;
  top: -26px;
  transform: translateX(-50%);
}

.seat-5 {
  left: -25px;
  top: 18%;
}

.seat-6 {
  left: -25px;
  bottom: 18%;
}

.field-help {
  margin: 42px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.setup-controls {
  margin-top: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.seed-field {
  display: grid;
  grid-template-columns: auto 92px;
  gap: 3px 10px;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 700;
}

.seed-field input {
  width: 92px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #aeb6b0;
  border-radius: 4px;
  background: var(--surface);
}

.seed-field small {
  grid-column: 1 / 3;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 400;
}

.setup-submit {
  display: flex;
  align-items: center;
  gap: 12px;
}

.selection-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.button {
  min-height: 46px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.button-primary {
  background: var(--table-deep);
  color: white;
}

.button-primary:hover:not(:disabled) {
  background: #082f25;
}

.button-secondary {
  border-color: var(--table-deep);
  background: var(--surface);
  color: var(--table-deep);
}

.button-danger {
  border-color: #cf9ba1;
  background: var(--surface);
  color: var(--danger);
}

.notice {
  min-height: 44px;
  margin-top: 16px;
  padding: 11px 14px;
  border: 1px solid;
  border-radius: 4px;
  line-height: 1.4;
}

.notice-error {
  border-color: #d7a4aa;
  background: #fff1f2;
  color: var(--danger);
}

[hidden] {
  display: none !important;
}

.account-nav,
.account-nav form {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--lime);
}

.account-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.account-shell {
  min-height: calc(100vh - 64px);
  padding: 40px 18px;
  display: grid;
  place-items: center;
}

.account-card {
  width: min(460px, 100%);
  padding: 30px;
  border: 2px solid var(--table);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-card h1,
.account-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.account-intro {
  color: var(--muted);
  line-height: 1.55;
}

.account-notice {
  padding: 8px 12px;
  border: 1px solid #e7b877;
  border-radius: 5px;
  background: #fff8e8;
  color: #8a5a1e;
  font-size: 0.85rem;
}

.account-form {
  display: grid;
  gap: 16px;
}

.account-form label,
.account-form p {
  margin: 0;
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

.account-form input {
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
}

.account-form small,
.account-form .helptext {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 400;
  line-height: 1.4;
}

.account-form .errorlist {
  margin: 0;
  padding-left: 18px;
  color: var(--danger);
  font-size: 0.75rem;
}

.account-links {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.account-links a,
.account-card a:not(.button) {
  color: var(--table-deep);
  font-weight: 700;
}

@media (max-width: 920px) {
  .setup-shell {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .setup-copy {
    text-align: center;
  }

  .setup-copy h1,
  .setup-intro {
    margin-left: auto;
    margin-right: auto;
  }

  .team-key {
    justify-content: center;
  }

  .setup-form {
    width: min(650px, 100%);
    margin: 0 auto;
  }
}

@media (max-width: 560px) {
  .app-header {
    min-height: 56px;
    padding: 0 16px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .setup-shell {
    min-height: calc(100vh - 56px);
    padding: 24px 14px 30px;
    gap: 28px;
  }

  .setup-copy h1 {
    font-size: 2.35rem;
  }

  .setup-intro {
    margin: 14px auto 18px;
    font-size: 0.94rem;
    line-height: 1.5;
  }

  .setup-table {
    min-height: 330px;
    aspect-ratio: 1 / 1.08;
    border-width: 7px;
    border-radius: 44%;
  }

  .setup-table-center {
    width: 38%;
  }

  .setup-table-center strong {
    font-size: 2rem;
  }

  .seat-choice {
    width: 92px;
    min-height: 66px;
  }

  .seat-choice-body {
    min-height: 66px;
    padding: 7px 8px;
    grid-template-columns: 26px 1fr;
  }

  .seat-number {
    font-size: 1.5rem;
  }

  .seat-1 {
    bottom: -22px;
  }

  .seat-5,
  .seat-6 {
    left: -5px;
  }

  .seat-4 {
    top: -22px;
  }

  .seat-2,
  .seat-3 {
    right: -5px;
  }

  .field-help {
    margin-top: 34px;
  }

  .setup-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .seed-field {
    grid-template-columns: 1fr 100px;
  }

  .seed-field input {
    width: 100px;
  }

  .setup-submit {
    justify-content: space-between;
  }

  .button-primary {
    min-width: 156px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.game-page {
  background-color: #edf0eb;
}

.game-header {
  position: relative;
  z-index: 20;
}

.game-header-actions,
.game-header-actions form {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--lime);
}

.game-account-name {
  font-size: 0.76rem;
  font-weight: 700;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bf8d25;
}

.connection-status.is-online .connection-dot {
  background: #287c52;
}

.connection-status.is-offline .connection-dot {
  background: var(--danger);
}

.text-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--table-deep);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.game-shell {
  width: min(1240px, 100%);
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  padding: 16px clamp(12px, 3vw, 36px) 32px;
}

.game-loading {
  min-height: calc(100vh - 112px);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  color: var(--muted);
  text-align: center;
}

.game-loading strong {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #cbd3cd;
  border-top-color: var(--table);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.match-strip {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid #ccd3cd;
}

.score-team {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-team > span:not(.score-symbol) {
  display: grid;
  gap: 1px;
}

.score-team small {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 500;
}

.score-team > b {
  min-width: 42px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.85rem;
  line-height: 1;
  text-align: center;
}

.score-symbol {
  font-size: 1.05rem;
}

.score-team.team-blue {
  justify-content: flex-end;
  text-align: right;
}

.match-meta {
  min-width: 110px;
  display: grid;
  justify-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.score-target {
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: none;
}

.game-notice {
  position: sticky;
  top: 8px;
  z-index: 30;
  width: min(680px, calc(100% - 24px));
  margin: 10px auto -54px;
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(23, 32, 29, 0.18);
}

.game-notice.is-error {
  border-color: #d7a4aa;
  color: var(--danger);
}

.game-notice.is-info {
  border-color: #9cb9b0;
  color: var(--table-deep);
}

.table-stage {
  width: min(800px, 100%);
  margin: 14px auto 0;
}

.game-table {
  position: relative;
  width: 100%;
  aspect-ratio: 1.9 / 1;
  min-height: 430px;
  border: 12px solid #ff1f2d;
  border-radius: 48%;
  background:
    radial-gradient(ellipse at center, rgba(255,255,255,0.05) 0 47%, transparent 48%),
    repeating-radial-gradient(ellipse at center, rgba(255,255,255,0.022) 0 1px, transparent 1px 7px),
    var(--table);
  box-shadow: inset 0 0 0 2px var(--table-line), 0 18px 44px rgba(17, 39, 31, 0.18);
}

.player-seat {
  position: absolute;
  z-index: 3;
  width: clamp(116px, 18%, 152px);
  min-height: 76px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(4, 24, 17, 0.2);
}

.player-seat.is-red {
  border-left: 6px solid var(--red);
  background: #ffedef;
}

.player-seat.is-blue {
  border-left: 6px solid var(--blue);
  background: #eaf1ff;
}

.player-seat.is-turn {
  box-shadow: 0 0 0 4px #f0b84a, 0 7px 18px rgba(4, 24, 17, 0.24);
}

.player-seat.is-opening-leader {
  box-shadow: 0 0 0 4px #45a56b, 0 7px 18px rgba(4, 24, 17, 0.24);
}

.player-seat.is-turn.is-opening-leader {
  box-shadow: 0 0 0 4px #f0b84a, inset 0 0 0 3px #45a56b, 0 7px 18px rgba(4, 24, 17, 0.24);
}

.player-seat.is-redoubler {
  box-shadow: 0 0 0 4px #d97706, inset 0 0 0 2px #fff4d6, 0 7px 18px rgba(4, 24, 17, 0.24);
}

.player-seat.is-doubler {
  box-shadow: 0 0 0 2px #e7b877, inset 0 0 0 1px #fff4d6, 0 7px 18px rgba(4, 24, 17, 0.24);
}

.player-seat.is-self::after {
  content: "You";
  position: absolute;
  right: 7px;
  top: 7px;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--ink);
  color: white;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
}

.seat-position-tag {
  position: absolute;
  right: 6px;
  bottom: 4px;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.7;
  line-height: 1;
}

.seat-line {
  display: flex;
  align-items: center;
  gap: 7px;
}

.seat-position {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf0ec;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.seat-name {
  min-width: 0;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-badge {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #1d9bf0;
  color: #fff;
  font-size: 0.55rem;
  line-height: 1;
}

.seat-meta {
  margin: 6px 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 600;
}

.seat-status {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}
.seat-played-card {
  position: absolute;
  right: -18px;
  top: 50%;
  width: 34px;
  aspect-ratio: 0.714 / 1;
  transform: translateY(-50%);
  border: 2px solid #f7f9f6;
  border-radius: 4px;
  background: white;
  box-shadow: 0 6px 12px rgba(7, 28, 21, 0.28);
  overflow: hidden;
}
.seat-played-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.seat-auction-call {
  position: absolute;
  top: 50%;
  z-index: 8;
  min-width: 72px;
  min-height: 32px;
  padding: 6px 9px;
  border: 2px solid #c9d3cd;
  border-radius: 5px;
  background: #ffffff;
  color: #111111;
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.28);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.seat-auction-call.is-redouble {
  border-color: #d97706;
  background: #fff4d6;
  color: #713600;
}

.seat-auction-call.is-double {
  border-color: #e7b877;
  background: #fff8e8;
  color: #8a5a1e;
}

.seat-auction-call.is-pass {
  border-color: #d7ddd9;
  background: #f3f5f3;
  color: var(--muted);
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

.bid-suit-symbol {
  width: 1.35em;
  height: 1.35em;
  margin: -0.15em 0.12em;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: #111111;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4em;
  line-height: 1;
  vertical-align: middle;
}

.bid-suit-diamonds,
.bid-suit-hearts {
  color: #c52233;
}

.seat-pos-1 .seat-auction-call {
  left: 50%;
  top: auto;
  bottom: -12px;
  transform: translate(-50%, 100%);
}

.seat-pos-5 .seat-auction-call,
.seat-pos-6 .seat-auction-call {
  left: -12px;
  transform: translate(-100%, -50%);
}

.seat-pos-4 .seat-auction-call {
  left: 50%;
  top: -12px;
  transform: translate(-50%, -100%);
}

.seat-pos-2 .seat-auction-call,
.seat-pos-3 .seat-auction-call {
  right: -12px;
  transform: translate(100%, -50%);
}

.controller-badge {
  padding: 2px 5px;
  border-radius: 3px;
  background: #edf0ec;
  text-transform: uppercase;
}

.turn-label {
  color: #795713;
  font-weight: 800;
}

.lead-label {
  color: #17613c;
  font-weight: 800;
}

.seat-pos-1 {
  left: 50%;
  bottom: -28px;
  transform: translateX(-50%);
}

.seat-pos-2 {
  right: -32px;
  bottom: 16%;
}

.seat-pos-3 {
  right: -32px;
  top: 16%;
}

.seat-pos-4 {
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
}

.seat-pos-5 {
  left: -32px;
  top: 16%;
}

.seat-pos-6 {
  left: -32px;
  bottom: 16%;
}

.table-center {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 52%;
  height: 60%;
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(88px, 38%);
  grid-template-rows: auto 1fr auto;
  align-items: center;
  gap: 4px 14px;
  color: white;
  text-align: left;
}

.phase-heading {
  min-width: 0;
  display: grid;
}

.phase-kicker,
.contract-display > span {
  color: #bcd5cc;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.phase-heading strong {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 2.4vw, 1.55rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-heading > span:last-child {
  overflow: hidden;
  color: #d8e7e2;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-display {
  max-width: 100%;
  min-width: 88px;
  display: grid;
  justify-items: end;
}

.contract-display strong {
  max-width: 100%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
  line-height: 1.05;
  text-align: right;
  text-wrap: balance;
}

.contract-display small {
  max-width: 100%;
  color: #d8e7e2;
  font-size: 0.58rem;
  line-height: 1.15;
  text-align: right;
  text-wrap: balance;
}

.trick-zone {
  position: relative;
  grid-column: 1 / 3;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 26px;
}

.trick-empty {
  color: #c9ddd6;
  font-size: 0.7rem;
}

.trick-card {
  position: relative;
  width: clamp(44px, 10vw, 66px);
  aspect-ratio: 0.714 / 1;
  margin-left: -12px;
  border: 2px solid white;
  border-radius: 4px;
  background: white;
  object-fit: cover;
  box-shadow: 0 5px 10px rgba(0,0,0,0.26);
}

.trick-card:first-child {
  margin-left: 0;
}

.last-trick-button {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 3px;
  background: rgba(5, 39, 29, 0.82);
  color: white;
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 700;
}

.last-trick-button:hover:not(:disabled) {
  background: #082f25;
}

.bots-pause-button {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 3px;
  background: rgba(5, 39, 29, 0.82);
  color: white;
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 700;
}

.bots-pause-button:hover:not(:disabled) {
  background: #082f25;
}

.bots-pause-button.is-paused {
  background: #a1580f;
  border-color: rgba(255, 255, 255, 0.7);
}

.last-trick-dialog {
  width: min(720px, calc(100% - 24px));
  padding: 20px;
  border: 1px solid #aab7af;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(4, 24, 17, 0.34);
}

.last-trick-dialog::backdrop {
  background: rgba(8, 24, 19, 0.7);
}

.last-trick-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.last-trick-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.last-trick-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.last-trick-meta {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 0.8rem;
}

.last-trick-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.last-trick-play {
  min-width: 0;
  margin: 0;
  text-align: center;
}

.last-trick-play img {
  width: 100%;
  aspect-ratio: 0.714 / 1;
  display: block;
  border: 1px solid #cbd2cc;
  border-radius: 4px;
  object-fit: cover;
}

.last-trick-play figcaption {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.team-hands-seats {
  display: grid;
  gap: 16px;
}

.team-hand-seat {
  display: grid;
  gap: 8px;
}

.team-hand-title {
  font-size: 0.78rem;
  font-weight: 700;
}

.team-hand-cards {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}

.team-hand-cards img {
  width: 100%;
  aspect-ratio: 0.714 / 1;
  display: block;
  border: 1px solid #cbd2cc;
  border-radius: 4px;
  object-fit: cover;
}

@media (max-width: 560px) {
  .last-trick-dialog {
    padding: 16px;
  }

  .last-trick-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .team-hand-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.bot-thinking {
  grid-column: 1 / 3;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #d8e7e2;
  font-size: 0.67rem;
}

.thinking-dots {
  display: flex;
  gap: 3px;
}

.thinking-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  animation: think 1s ease-in-out infinite alternate;
}

.thinking-dots i:nth-child(2) { animation-delay: 160ms; }
.thinking-dots i:nth-child(3) { animation-delay: 320ms; }

@keyframes think {
  to { transform: translateY(-3px); opacity: 0.45; }
}

.lobby-panel,
.play-panel,
.result-panel {
  width: min(1000px, 100%);
  margin: 22px auto 0;
  padding-top: 16px;
  border-top: 1px solid #cbd2cc;
}

.lobby-heading,
.hand-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.lobby-heading h1,
.hand-heading h2,
.result-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
}

.lobby-heading p:last-child,
.hand-heading > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.name-field {
  max-width: 360px;
  margin-top: 18px;
  display: grid;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
}

.name-field input {
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid #aeb6b0;
  border-radius: 4px;
  background: var(--surface);
}

.lobby-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.seat-action {
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid #9ba8a1;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
}

.seat-action.host-action {
  border-style: dashed;
  color: var(--table-deep);
}

.seat-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hand-heading {
  margin-bottom: 10px;
}

.hand-scroll {
  width: 100%;
  min-height: 146px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: #9da9a2 transparent;
  scrollbar-width: thin;
}

.card-hand {
  min-width: min-content;
  min-height: 144px;
  padding: 6px 10px 12px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.playing-card {
  position: relative;
  width: clamp(82px, 9vw, 104px);
  aspect-ratio: 0.714 / 1;
  flex: 0 0 auto;
  margin-left: clamp(-30px, -2.2vw, -19px);
  padding: 0;
  border: 2px solid #c4c9c5;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  box-shadow: 0 5px 12px rgba(21, 32, 28, 0.16);
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.playing-card:first-child {
  margin-left: 0;
}

.playing-card img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
  object-fit: cover;
}

.playing-card:hover:not(:disabled) {
  transform: translateY(-6px);
}

.playing-card.is-selected {
  transform: translateY(-12px);
  border-color: var(--gold);
  box-shadow: 0 0 0 4px #f0b84a, 0 8px 18px rgba(21, 32, 28, 0.2);
}

.playing-card:disabled {
  cursor: not-allowed;
  filter: saturate(0.35);
  opacity: 0.5;
}

.playing-card.is-bidding:disabled {
  cursor: default;
  filter: none;
  opacity: 1;
}

.card-empty-state {
  width: 100%;
  min-height: 140px;
  display: grid;
  place-content: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.action-dock {
  min-height: 62px;
  padding: 8px 0;
  border-top: 1px solid #ccd2cd;
}

.contract-reached-actions {
  padding: 10px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.contract-reached-actions[hidden] {
  display: none;
}

.contract-reached-actions > div {
  margin-right: 8px;
  display: grid;
  gap: 2px;
}

.contract-reached-actions strong {
  color: var(--table-deep);
  font-family: Georgia, "Times New Roman", serif;
}

.contract-reached-actions span {
  color: var(--muted);
  font-size: 0.74rem;
}

@media (min-width: 721px) and (max-height: 820px) {
  .game-shell {
    padding: 6px clamp(12px, 3vw, 36px) 8px;
  }

  .game-shell[data-phase="bidding"] .match-strip,
  .game-shell[data-phase="playing"] .match-strip {
    min-height: 48px;
  }

  .game-shell[data-phase="bidding"] .table-stage,
  .game-shell[data-phase="playing"] .table-stage {
    width: min(620px, 100%);
    margin-top: 5px;
  }

  .game-shell[data-phase="bidding"] .game-table,
  .game-shell[data-phase="playing"] .game-table {
    min-height: 320px;
  }

  .table-center {
    width: 68%;
  }

  .game-shell[data-phase="bidding"] .play-panel,
  .game-shell[data-phase="playing"] .play-panel {
    margin-top: 5px;
    padding-top: 5px;
  }

  .game-shell[data-phase="bidding"] .hand-heading,
  .game-shell[data-phase="playing"] .hand-heading {
    margin-bottom: 2px;
  }

  .game-shell[data-phase="bidding"] .hand-heading .eyebrow,
  .game-shell[data-phase="playing"] .hand-heading .eyebrow {
    display: none;
  }

  .game-shell[data-phase="bidding"] .hand-heading h2,
  .game-shell[data-phase="playing"] .hand-heading h2 {
    font-size: 1.18rem;
  }

  .game-shell[data-phase="bidding"] .hand-scroll,
  .game-shell[data-phase="playing"] .hand-scroll {
    min-height: 90px;
  }

  .game-shell[data-phase="bidding"] .card-hand,
  .game-shell[data-phase="playing"] .card-hand {
    min-height: 88px;
    padding-top: 2px;
    padding-bottom: 4px;
  }

  .game-shell[data-phase="bidding"] .playing-card,
  .game-shell[data-phase="playing"] .playing-card {
    width: clamp(64px, 7vw, 70px);
  }

  .game-shell[data-phase="bidding"] .action-dock,
  .game-shell[data-phase="playing"] .action-dock {
    min-height: 54px;
    padding: 4px 0;
  }

  .game-shell[data-phase="bidding"] .bid-controls select,
  .game-shell[data-phase="bidding"] .suit-picker-trigger {
    min-height: 42px;
  }

  .game-shell[data-phase="bidding"] .button,
  .game-shell[data-phase="playing"] .button {
    min-height: 42px;
  }
}

@media (min-width: 721px) and (max-height: 740px) {
  .table-stage {
    width: min(570px, 100%);
  }

  .game-table {
    min-height: 300px;
  }

  .hand-scroll {
    min-height: 98px;
  }

  .card-hand {
    min-height: 96px;
  }

  .playing-card {
    width: 68px;
  }
}

.bid-controls,
.play-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: center;
  gap: 10px;
}

.final-bid-shortcut {
  width: 100%;
  margin: 10px auto 0;
  padding: 10px 14px;
  border: 1px dashed #9da8a1;
  border-radius: 6px;
  background: #f4f6f3;
}

.final-bid-shortcut summary {
  cursor: pointer;
  color: var(--table);
  font-size: 0.78rem;
  font-weight: 700;
}

.final-bid-hint {
  margin: 8px 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.final-bid-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
}

.final-bid-fields label,
.final-bid-fields .bid-suit-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.final-bid-fields select {
  min-width: 92px;
  min-height: 42px;
  padding: 6px 26px 6px 9px;
  border: 1px solid #aeb6b0;
  border-radius: 4px;
  background: white;
}

.final-bid-team,
.final-bid-challenge {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.final-bid-team legend,
.final-bid-challenge legend {
  padding: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.final-bid-team label,
.final-bid-challenge label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 600;
}

.bid-pattern-field select {
  min-width: 190px;
}

.bid-controls label,
.bid-suit-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.bid-controls select {
  min-width: 92px;
  min-height: 46px;
  padding: 8px 30px 8px 10px;
  border: 1px solid #aeb6b0;
  border-radius: 4px;
  background: white;
}

.suit-picker {
  position: relative;
  min-width: 142px;
}

.suit-picker-trigger {
  width: 100%;
  min-height: 46px;
  padding: 6px 34px 6px 9px;
  display: flex;
  align-items: center;
  border: 1px solid #aeb6b0;
  border-radius: 4px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.suit-picker-trigger::after {
  content: "⌄";
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-56%);
  color: var(--muted);
  font-size: 1rem;
}

.suit-picker-trigger > span,
.suit-picker-option {
  display: flex;
  align-items: center;
  gap: 7px;
}

.suit-picker-options {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 5px);
  z-index: 50;
  padding: 4px;
  border: 1px solid #9da8a1;
  border-radius: 5px;
  background: white;
  box-shadow: 0 12px 30px rgba(4, 24, 17, 0.22);
}

.suit-picker-option {
  width: 100%;
  min-height: 42px;
  padding: 5px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.suit-picker-option:hover,
.suit-picker-option:focus-visible {
  background: #dbe4ec;
}

.suit-picker-option[aria-selected="true"] {
  background: #bfe3c9;
  color: var(--ink);
}

.suit-picker-option[aria-selected="true"]:hover,
.suit-picker-option[aria-selected="true"]:focus-visible {
  background: #a3d4b1;
  color: var(--ink);
}

.button-secondary {
  border-color: #89958e;
  background: transparent;
  color: var(--ink);
}

.button-double {
  border-color: #c2410c;
  background: #f97316;
  color: white;
}

.button-double:hover:not(:disabled) {
  background: #ea580c;
}

.button-redouble {
  border-color: #991b1b;
  background: #dc2626;
  color: white;
}

.button-redouble:hover:not(:disabled) {
  background: #b91c1c;
}

.button-pass {
  border-color: #9ecbb0;
  background: #dff3e6;
  color: #0e3d30;
}

.button-pass:hover:not(:disabled) {
  background: #c9ead6;
}

.play-controls p {
  min-width: 150px;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.next-deal-button {
  margin: 16px auto 0;
}

.result-panel {
  text-align: center;
}

.result-score {
  margin-top: 8px;
  display: block;
  color: var(--table-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
}

.result-panel p:last-child {
  margin: 8px auto 0;
  color: var(--muted);
  line-height: 1.5;
}

.game-management {
  width: min(1000px, 100%);
  margin: 34px auto 0;
  padding-top: 14px;
  border-top: 1px solid #cbd2cc;
  text-align: right;
}

.game-management summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
}

.game-management .button {
  margin-top: 12px;
}

.bidding-mode-toggle {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  text-align: right;
}

.bidding-mode-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.bidding-mode-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.bidding-mode-buttons .button {
  margin-top: 0;
}

.bidding-mode-buttons .button.is-active {
  border-color: var(--table);
  background: var(--table);
  color: white;
}

.shuffle-settings {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  text-align: right;
}

.shuffle-settings-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.shuffle-settings-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.shuffle-settings-fields label {
  color: var(--muted);
  font-size: 0.72rem;
}

.shuffle-settings-fields select,
.shuffle-settings-fields input {
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid #89958e;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}

.shuffle-settings-fields input[type="number"] {
  width: 64px;
}

.shuffle-settings-fields .button {
  margin-top: 0;
}

.team-hands-toggle {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  text-align: right;
}

.team-hands-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.team-hands-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.team-hands-buttons .button {
  margin-top: 0;
}

.vacate-seat-actions {
  margin-top: 12px;
  display: grid;
  gap: 14px;
}

.seat-control-group {
  display: grid;
  gap: 6px;
}

.seat-control-label {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.seat-control-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.vacate-seat-actions .button {
  margin-top: 0;
  min-width: 116px;
}

@media (max-width: 720px) {
  .game-shell {
    min-height: calc(100vh - 56px);
    padding: 8px 8px 24px;
  }

  .connection-status {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .game-header .brand > span:last-child {
    display: none;
  }

  .game-account-name,
  .game-header-actions form {
    display: none;
  }

  .match-strip {
    min-height: 50px;
  }

  .score-team {
    gap: 4px;
  }

  .score-team > b {
    min-width: 28px;
    font-size: 1.4rem;
  }

  .score-team small,
  .score-symbol {
    display: none;
  }

  .match-meta {
    min-width: 76px;
  }

  .table-stage {
    margin-top: 10px;
    padding: 0 3px;
  }

  .game-table {
    min-height: 344px;
    aspect-ratio: 1.08 / 1;
    border-width: 7px;
    border-radius: 43%;
  }

  .player-seat {
    width: 104px;
    min-height: 64px;
    padding: 6px 7px;
  }

  .seat-line {
    gap: 5px;
  }

  .seat-position {
    width: 23px;
    height: 23px;
    flex-basis: 23px;
  }

  .seat-meta {
    margin: 4px 0 0;
    gap: 4px;
  }

  .seat-pos-1 { bottom: -20px; }
  .seat-pos-5,
  .seat-pos-6 { left: 45px; }
  .seat-pos-4 { top: -20px; }
  .seat-pos-2,
  .seat-pos-3 { right: 45px; }

  .seat-played-card {
    right: -14px;
    width: 28px;
  }

  .seat-auction-call {
    min-width: 54px;
    min-height: 28px;
    padding: 4px 6px;
    border-width: 2px;
    font-size: 0.62rem;
  }

  .seat-pos-1 .seat-auction-call {
    bottom: -8px;
  }

  .seat-pos-5 .seat-auction-call,
  .seat-pos-6 .seat-auction-call {
    left: -6px;
  }

  .seat-pos-4 .seat-auction-call {
    top: -8px;
  }

  .seat-pos-2 .seat-auction-call,
  .seat-pos-3 .seat-auction-call {
    right: -6px;
  }

  .table-center {
    width: 48%;
    height: 62%;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 2px;
    text-align: center;
  }

  .phase-heading strong {
    font-size: 1rem;
  }

  .phase-heading > span:last-child {
    font-size: 0.58rem;
  }

  .contract-display {
    justify-items: center;
  }

  .contract-display strong {
    font-size: 1.05rem;
    text-align: center;
  }

  .contract-display small {
    text-align: center;
  }

  .trick-zone,
  .bot-thinking {
    grid-column: 1;
  }

  .trick-zone {
    min-height: 92px;
    padding: 2px 0;
  }

  .trick-card {
    width: 48px;
    margin-left: -19px;
  }

  .lobby-panel,
  .play-panel,
  .result-panel {
    margin-top: 12px;
    padding: 16px 6px 0;
  }

  .lobby-heading,
  .hand-heading {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .lobby-heading h1,
  .hand-heading h2,
  .result-panel h2 {
    font-size: 1.35rem;
  }

  .name-field {
    max-width: none;
  }

  .hand-scroll {
    min-height: 126px;
  }

  .card-hand {
    min-height: 124px;
    padding-left: 2px;
    padding-right: 2px;
    justify-content: flex-start;
  }

  .playing-card {
    width: 78px;
    margin-left: -22px;
  }

  .bid-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .bid-controls label,
  .bid-controls .bid-suit-field,
  .bid-controls select,
  .bid-controls .button {
    width: 100%;
  }

  .bid-controls .bid-pattern-field {
    grid-column: 1 / -1;
  }

  .bid-pattern-field select {
    min-width: 0;
  }

  .play-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .play-controls p {
    min-width: 0;
    text-align: center;
  }
}

@media (max-width: 370px) {
  .game-shell {
    padding-top: 4px;
  }

  .match-strip {
    min-height: 46px;
  }

  .game-table {
    min-height: 310px;
    aspect-ratio: 1.16 / 1;
  }

  .lobby-panel,
  .play-panel,
  .result-panel {
    margin-top: 8px;
  }
}

.spectator-banner {
  width: min(800px, 100%);
  min-height: 46px;
  margin: 12px auto 0;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 2px solid var(--lime);
  border-radius: 5px;
  background: var(--header);
  color: white;
  font-size: 0.78rem;
  line-height: 1.35;
}

.spectator-banner strong,
.spectator-banner a {
  color: var(--lime);
}

.directory-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 6px 12px;
}

.directory-heading .eyebrow {
  flex-basis: 100%;
}

.directory-delete-all {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .game-shell {
    padding: 4px 8px 20px;
  }

  .match-strip {
    min-height: 44px;
  }

  .table-stage {
    margin-top: 6px;
  }

  .game-table {
    min-height: 306px;
    aspect-ratio: 1.18 / 1;
    border-width: 6px;
  }

  .player-seat {
    width: 88px;
    min-height: 52px;
    padding: 4px 5px;
    border-width: 1px;
  }

  .player-seat.is-red,
  .player-seat.is-blue {
    border-left-width: 4px;
  }

  .player-seat.is-self::after {
    right: 4px;
    top: 4px;
    padding: 1px 3px;
    font-size: 0.5rem;
  }

  .seat-position {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    font-size: 0.78rem;
  }

  .seat-name {
    font-size: 0.7rem;
  }

  .seat-meta {
    margin: 3px 0 0;
    gap: 3px;
    font-size: 0.57rem;
  }

  .controller-badge {
    display: none;
  }

  .seat-pos-1 {
    bottom: -14px;
  }

  .seat-pos-5,
  .seat-pos-6 {
    left: 24px;
  }

  .seat-pos-4 {
    top: -14px;
  }

  .seat-pos-2,
  .seat-pos-3 {
    right: 24px;
  }

  .seat-played-card {
    right: -11px;
    width: 24px;
    border-width: 1px;
  }

  .seat-auction-call {
    min-width: 46px;
    min-height: 24px;
    padding: 3px 5px;
    border-width: 2px;
    font-size: 0.56rem;
  }

  .seat-pos-1 .seat-auction-call {
    top: -5px;
    bottom: auto;
    transform: translate(-50%, -100%);
  }

  .seat-pos-5 .seat-auction-call,
  .seat-pos-6 .seat-auction-call {
    left: calc(100% + 4px);
    transform: translateY(-50%);
  }

  .seat-pos-4 .seat-auction-call {
    top: auto;
    bottom: -5px;
    transform: translate(-50%, 100%);
  }

  .seat-pos-2 .seat-auction-call,
  .seat-pos-3 .seat-auction-call {
    right: calc(100% + 4px);
    transform: translateY(-50%);
  }

  .table-center {
    width: 44%;
    height: 58%;
  }

  .phase-heading strong {
    font-size: 0.9rem;
  }

  .contract-display strong {
    font-size: 0.95rem;
  }

  .trick-zone {
    min-height: 70px;
  }

  .trick-card {
    width: 40px;
    margin-left: -16px;
  }

  .lobby-panel,
  .play-panel,
  .result-panel {
    margin-top: 8px;
    padding-top: 12px;
  }

  .hand-scroll {
    min-height: 104px;
  }

  .card-hand {
    min-height: 102px;
    padding: 2px;
  }

  .playing-card {
    width: 68px;
    margin-left: -30px;
    border-width: 1px;
  }

  .action-dock {
    padding-top: 6px;
  }

  .bid-controls {
    gap: 7px;
  }

  .bid-controls select {
    min-height: 42px;
  }

  .suit-picker,
  .suit-picker-trigger {
    width: 100%;
  }

  .suit-picker-trigger {
    min-height: 42px;
  }

  .spectator-banner {
    min-height: 0;
    margin-top: 6px;
    padding: 7px 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 10px;
    justify-content: stretch;
    font-size: 0.7rem;
  }

  .spectator-banner span {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .spectator-banner strong {
    grid-column: 1;
    grid-row: 1;
  }

  .spectator-banner a {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .player-seat:has(.seat-auction-call) .seat-meta {
    display: none;
  }

  .player-seat .seat-auction-call {
    left: 25px;
    right: auto;
    top: auto;
    bottom: 3px;
    min-width: 0;
    min-height: 0;
    max-width: calc(100% - 30px);
    padding: 1px 3px;
    transform: none;
    border-width: 1px;
    box-shadow: none;
    font-size: 0.48rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .player-seat .bid-suit-symbol {
    width: 1.55em;
    height: 1.55em;
    margin-inline: 0.08em;
    font-size: 1.6em;
  }
}

@media (max-width: 370px) {
  .game-table {
    min-height: 286px;
    aspect-ratio: 1.12 / 1;
  }
}