:root {
  --bg: #121622;
  --panel: #162657;
  --panel-2: #2b3659;
  --panel-3: #202844;
  --accent: #b74e91;
  --accent-2: #5e42a6;
  --accent-3: #6fd0c7;
  --line: rgba(255, 255, 255, 0.15);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: rgba(255, 255, 255, 0.74);
  --muted: rgba(255, 255, 255, 0.52);
  --white: #fff;
  --danger: #ff9aa8;
  --team-1: #6fd0c7;
  --team-2: #e6bd5a;
  --shadow: 0 1.25rem 2.75rem rgba(8, 12, 26, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
strong {
  color: var(--white);
}

h1 {
  font-size: 2.2rem;
  line-height: 1.15;
  margin-bottom: 0.25rem;
}

h2 {
  font-size: 1.35rem;
  margin-bottom: 0.45rem;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 18rem;
  overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 2.5rem 2rem;
}

.sidebar-inner {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  gap: 3rem;
  text-align: right;
}

.brand,
.sidebar a {
  display: block;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1.75;
  text-transform: uppercase;
}

.brand {
  color: var(--white);
  font-size: 0.78rem;
}

.sidebar ul {
  display: grid;
  gap: 1.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar a:hover,
.sidebar a:focus-visible {
  color: var(--white);
}

.page-shell {
  min-height: 100vh;
  margin-left: 18rem;
}

.section-primary {
  background: var(--panel);
}

.section-secondary {
  background: var(--panel-2);
}

body.has-karbosh-game .section-secondary {
  display: none;
}

body:not(.has-karbosh-game) .section-primary .section-inner {
  padding-bottom: 1.25rem;
}

body:not(.has-karbosh-game) .section-secondary .section-inner {
  padding-top: 1.25rem;
}

.section-inner {
  width: min(100%, 88rem);
  margin: 0;
  padding: 4rem;
}

.top-strip,
.meta-grid,
.score-row,
.setup-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.top-strip {
  margin-bottom: 1.25rem;
}

.eyebrow,
.meta-grid span,
.seat small,
.status-line {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.connection-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: 8rem 8rem minmax(0, 1fr) auto;
  margin-bottom: 1.25rem;
}

body:not(.has-karbosh-game) .meta-grid,
#game-root:empty {
  display: none;
}

.meta-grid > div {
  min-width: 0;
  display: grid;
  gap: 0.28rem;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  padding: 0.62rem 0.78rem;
}

.meta-grid > div strong {
  display: block;
  min-width: 0;
  min-height: 1.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: var(--shadow);
}

.empty-panel {
  min-height: 20rem;
  padding: 1.5rem;
}

.table-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

.table-panel,
.setup-panel {
  min-width: 0;
  padding: 1.35rem;
}

.table-panel {
  display: flex;
  flex-direction: column;
}

.panel-heading {
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
}

.table-panel > .panel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 1rem;
  align-items: center;
}

.table-panel > .panel-heading .eyebrow,
.table-panel > .panel-heading h1,
.table-panel > .panel-heading .status-line {
  grid-column: 1;
  min-width: 0;
}

.table-panel > .panel-heading h1,
.table-panel > .panel-heading .status-line {
  margin-bottom: 0;
}

.score-summary {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.score-summary-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.score-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.score-row span {
  border-left: 3px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  padding: 0.75rem 0.85rem;
}

.score-row strong {
  display: block;
  font-size: 1.25rem;
}

.game-over-panel {
  display: grid;
  gap: 0.15rem;
  border: 1px solid rgba(111, 208, 199, 0.55);
  border-radius: 8px;
  background: rgba(111, 208, 199, 0.1);
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  text-align: center;
}

.game-over-panel span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.game-over-panel strong {
  font-size: 1.4rem;
  line-height: 1.25;
}

.game-over-panel em {
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
}

.table-hand-status {
  position: absolute;
  top: 0.85rem;
  left: 50%;
  z-index: 7;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.4rem;
  align-items: baseline;
  justify-content: center;
  width: min(36rem, calc(100% - 2rem));
  margin: 0;
  pointer-events: none;
  transform: translateX(-50%);
}

.table-hand-status > div {
  display: inline-flex;
  gap: 0.4rem;
  align-items: baseline;
  min-width: 0;
  padding: 0;
}

.table-hand-status span {
  display: inline;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 0.2rem 0.45rem rgba(8, 12, 26, 0.7);
}

.table-hand-status strong {
  display: inline;
  color: var(--white);
  font-size: 1.2rem;
  line-height: 1.15;
  text-shadow: 0 0.2rem 0.45rem rgba(8, 12, 26, 0.7);
}

.trump-symbol {
  display: inline-block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  transform: translateY(0.06rem);
}

.trump-symbol.is-empty {
  color: var(--muted);
}

.table-surface {
  position: relative;
  min-height: 34rem;
  margin: 1.35rem 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(ellipse at center, rgba(111, 208, 199, 0.16), transparent 58%),
    rgba(10, 14, 26, 0.28);
}

.felt-oval {
  position: absolute;
  inset: 8.1rem 7.2rem 5.2rem;
  border: 0.8rem solid rgba(84, 60, 124, 0.72);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(46, 118, 108, 0.72), rgba(23, 76, 73, 0.94));
  box-shadow:
    inset 0 0 3rem rgba(255, 255, 255, 0.06),
    0 1.5rem 3rem rgba(8, 12, 26, 0.35);
}

.table-center {
  position: absolute;
  top: calc(50% + 1.2rem);
  left: 50%;
  z-index: 4;
  width: min(24rem, 46vw);
  min-height: 14.5rem;
  transform: translate(-50%, -50%);
}

.table-status {
  position: relative;
  display: none;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  margin: 1rem 0;
  min-height: 4rem;
  padding: 0.75rem;
}

.turn-summary {
  width: 12rem;
  max-width: 100%;
  border: 1px solid rgba(111, 208, 199, 0.38);
  border-radius: 999px;
  background: rgba(18, 22, 34, 0.76);
  padding: 0.45rem 0.9rem;
  text-align: center;
}

.turn-summary span,
.trick-card span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.turn-summary strong {
  display: block;
  line-height: 1.2;
}

.bid-trail > span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  margin: 0.2rem 0 0.45rem;
  text-transform: uppercase;
}

.bid-log {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bid-log li {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(18, 22, 34, 0.62);
  padding: 0.2rem 0.45rem;
}

.bid-log span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bid-log strong {
  font-size: 0.76rem;
  line-height: 1;
  white-space: nowrap;
}

.bid-log.is-empty li {
  opacity: 0.5;
}

.trick-row,
.seat-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.trick-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(4rem, 1fr));
  gap: 0.6rem;
  min-height: 6.25rem;
  margin: 1rem 0;
}

.trick-row li {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 0.6rem;
  text-align: center;
}

.trick-pile {
  position: relative;
  min-height: 14.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trick-card,
.trick-empty {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 5.6rem;
  min-height: 6.2rem;
  text-align: center;
}

.trick-card span,
.trick-empty span {
  line-height: 1;
}

.trick-empty {
  inset: 50% auto auto 50%;
  width: 11rem;
  transform: translate(-50%, -50%);
}

.trick-card.player-player1 {
  --slot-transform: translateX(-50%);
  --start-x: 0rem;
  --start-y: 7.25rem;
  bottom: 0.15rem;
  left: 50%;
  transform: translateX(-50%);
}

.trick-card.player-player2 {
  --slot-transform: translate(0, 0);
  --start-x: -9rem;
  --start-y: 4rem;
  bottom: 0.35rem;
  left: 2.2rem;
}

.trick-card.player-player3 {
  --slot-transform: translate(0, 0);
  --start-x: -9rem;
  --start-y: -3.9rem;
  top: 0.35rem;
  left: 2.2rem;
}

.trick-card.player-player4 {
  --slot-transform: translateX(-50%);
  --start-x: 0rem;
  --start-y: -7.25rem;
  top: 0.15rem;
  left: 50%;
  transform: translateX(-50%);
}

.trick-card.player-player5 {
  --slot-transform: translate(0, 0);
  --start-x: 9rem;
  --start-y: -3.9rem;
  top: 0.35rem;
  right: 2.2rem;
}

.trick-card.player-player6 {
  --slot-transform: translate(0, 0);
  --start-x: 9rem;
  --start-y: 4rem;
  right: 2.2rem;
  bottom: 0.35rem;
}

.trick-card.is-animating {
  z-index: 9;
  pointer-events: none;
  animation: deal-to-trick-slot 1050ms cubic-bezier(0.18, 0.82, 0.24, 1) both;
}

.player-seat {
  --seat-team-color: var(--line-strong);
  position: absolute;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.34rem;
  align-content: center;
  align-items: center;
  width: 11.8rem;
  min-height: 4.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 22, 34, 0.86);
  box-shadow: 0 0.85rem 1.8rem rgba(8, 12, 26, 0.28);
  overflow: hidden;
  padding: 0.7rem;
}

.player-seat::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 0.85rem solid var(--seat-team-color);
  border-left: 0.85rem solid transparent;
  opacity: 0.95;
}

.team-1 {
  --seat-team-color: var(--team-1);
}

.team-2 {
  --seat-team-color: var(--team-2);
}

.player-seat strong,
.player-seat small {
  display: block;
}

.player-seat strong {
  overflow: hidden;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-seat small {
  display: none;
}

.bid-chip {
  display: inline-flex;
  width: fit-content;
  margin-top: 0.35rem;
  border: 1px solid rgba(183, 78, 145, 0.52);
  border-radius: 999px;
  color: var(--white);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  padding: 0.25rem 0.45rem;
  text-transform: uppercase;
}

.player-seat.is-current {
  border-color: rgba(111, 208, 199, 0.9);
  box-shadow:
    0 0 0 3px rgba(111, 208, 199, 0.16),
    0 0.85rem 1.8rem rgba(8, 12, 26, 0.28);
}

.player-seat.is-you {
  background: rgba(34, 42, 71, 0.94);
}

.player-seat.is-sitting-out {
  opacity: 0.48;
}

.player-seat.is-empty {
  border-style: dashed;
  background: rgba(18, 22, 34, 0.5);
}

.player-seat.is-empty strong {
  color: var(--muted);
}

.mobile-seat-roster {
  display: none;
  gap: 0.5rem;
  margin: -0.2rem 0 1rem;
  padding: 0;
  list-style: none;
}

.mobile-seat-roster li {
  --seat-team-color: var(--line-strong);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 22, 34, 0.58);
  overflow: hidden;
  padding: 0.55rem 0.65rem;
}

.mobile-seat-roster li::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 0.72rem solid var(--seat-team-color);
  border-left: 0.72rem solid transparent;
  opacity: 0.95;
}

.mobile-seat-roster strong,
.mobile-seat-roster span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-seat-roster strong {
  line-height: 1.2;
}

.mobile-seat-roster span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mobile-seat-roster em {
  justify-self: end;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  padding: 0.25rem 0.45rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.mobile-seat-roster .is-current {
  border-color: rgba(111, 208, 199, 0.74);
  background: rgba(111, 208, 199, 0.1);
}

.mobile-seat-roster .is-you {
  background: rgba(34, 42, 71, 0.74);
}

.mobile-seat-roster .is-sitting-out {
  opacity: 0.56;
}

.turn-badge {
  position: static;
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: var(--accent-3);
  color: #101722;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  margin-top: 0.08rem;
  padding: 0.2rem 0.5rem;
  text-transform: uppercase;
}

.seat-hand-backs {
  position: relative;
  width: 3.2rem;
  height: 3.4rem;
}

.seat-hand-backs i,
.card-back {
  position: absolute;
  width: 2.1rem;
  height: 3rem;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%) 0 0 / 0.6rem 0.6rem,
    linear-gradient(135deg, transparent 75%, rgba(255, 255, 255, 0.15) 75%) 0 0 / 0.6rem 0.6rem,
    #5e42a6;
  box-shadow: 0 0.25rem 0.55rem rgba(8, 12, 26, 0.26);
}

.seat-hand-backs i {
  left: calc(var(--i) * 0.34rem);
  top: calc(var(--i) * 0.08rem);
  transform: rotate(calc((var(--i) - 2) * 4deg));
}

.seat-hand-backs {
  display: none;
}

.player-seat.player-player1 {
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
}

.player-seat.player-player2 {
  bottom: 4.6rem;
  left: 1.25rem;
}

.player-seat.player-player3 {
  top: 6.6rem;
  left: 1.25rem;
}

.player-seat.player-player4 {
  top: 4rem;
  left: 50%;
  transform: translateX(-50%);
}

.player-seat.player-player5 {
  top: 6.6rem;
  right: 1.25rem;
}

.player-seat.player-player6 {
  right: 1.25rem;
  bottom: 4.6rem;
}

.trick-winner-popup {
  position: absolute;
  top: 1.1rem;
  left: 50%;
  z-index: 10;
  min-width: 13rem;
  transform: translateX(-50%);
  border: 1px solid rgba(111, 208, 199, 0.62);
  border-radius: 8px;
  background: rgba(18, 22, 34, 0.94);
  box-shadow: 0 1rem 2rem rgba(8, 12, 26, 0.36);
  padding: 0.75rem 1rem;
  text-align: center;
  animation: trick-popup 3400ms ease both;
}

.bid-popup {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  z-index: 10;
  min-width: 11rem;
  border: 1px solid rgba(183, 78, 145, 0.68);
  border-radius: 8px;
  background: rgba(18, 22, 34, 0.94);
  box-shadow: 0 1rem 2rem rgba(8, 12, 26, 0.34);
  padding: 0.65rem 0.9rem;
  text-align: center;
  animation: bid-popup 1600ms ease both;
}

.bid-popup > span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bid-popup strong {
  display: block;
  font-size: 1.15rem;
  line-height: 1.25;
}

.trick-winner-popup > span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.trick-winner-popup strong {
  display: block;
  font-size: 1.2rem;
  line-height: 1.25;
}

.trick-winner-popup em {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-top: 0.45rem;
  text-transform: uppercase;
}

.trick-winner-popup .card-face {
  min-width: 2.2rem;
  min-height: 3rem;
  font-size: 1.05rem;
}

@keyframes deal-to-trick-slot {
  0% {
    transform: var(--slot-transform) translate(var(--start-x), var(--start-y)) scale(0.88) rotate(-8deg);
  }

  68% {
    transform: var(--slot-transform) translate(0, 0) scale(1.08) rotate(2deg);
  }

  100% {
    transform: var(--slot-transform) translate(0, 0) scale(1) rotate(0deg);
  }
}

@keyframes trick-popup {
  0% {
    opacity: 0;
    transform: translate(-50%, -0.4rem) scale(0.96);
  }

  12%,
  82% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -0.3rem) scale(0.98);
  }
}

@keyframes bid-popup {
  0% {
    opacity: 0;
    transform: translateY(-0.35rem) scale(0.96);
  }

  14%,
  82% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-0.25rem) scale(0.98);
  }
}

.card-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  min-height: 3.4rem;
  border: 1px solid rgba(17, 20, 32, 0.22);
  border-radius: 6px;
  background: #f8f5ed;
  box-shadow: 0 0.25rem 0.65rem rgba(8, 12, 26, 0.18);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.card-face.suit-heart,
.card-face.suit-diamond,
.card-button.suit-heart,
.card-button.suit-diamond,
.trump-button.suit-heart,
.trump-button.suit-diamond,
.trump-symbol.suit-heart,
.trump-symbol.suit-diamond {
  color: #c62f43;
}

.card-face.suit-spade,
.card-face.suit-club,
.card-button.suit-spade,
.card-button.suit-club,
.trump-button.suit-spade,
.trump-button.suit-club,
.trump-symbol.suit-spade,
.trump-symbol.suit-club {
  color: #141821;
}

.trump-symbol.suit-spade,
.trump-symbol.suit-club {
  -webkit-text-stroke: 0.045rem rgba(255, 255, 255, 0.72);
  paint-order: stroke fill;
  text-shadow:
    0 0 0.08rem rgba(255, 255, 255, 0.88),
    0 0 0.18rem rgba(255, 255, 255, 0.56),
    0 0.2rem 0.45rem rgba(8, 12, 26, 0.7);
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 0.7rem;
  align-items: center;
  min-height: 0;
  margin-bottom: 1rem;
}

.controls:empty {
  display: none;
}

.controls::before {
  content: "";
  display: block;
  grid-column: 1 / -1;
  order: 1;
  height: 1px;
  background: rgba(143, 164, 209, 0.22);
}

.play-controls-panel {
  display: contents;
}

.control-group,
.hand-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.hand-row.is-sorting .card-button {
  transition:
    transform 130ms ease,
    box-shadow 130ms ease,
    opacity 130ms ease;
}

.controls > .control-group:not(.auto-play-control):not(.room-visibility-control):not(.leave-room-control) {
  grid-column: 1 / -1;
  order: 0;
}

.trump-control-group {
  gap: 0.7rem;
}

.auto-play-control,
.room-visibility-control,
.leave-room-control {
  align-self: start;
  justify-content: flex-end;
  order: 2;
}

.auto-play-control {
  grid-column: 2;
}

.leave-room-control {
  grid-column: 4;
}

.room-visibility-control {
  grid-column: 3;
}

.table-top-actions,
.table-room-actions,
.table-fill-bots-button {
  display: none;
}

body.has-karbosh-game .controls {
  grid-template-columns: minmax(0, 1fr) auto;
}

body.has-karbosh-game .controls > .room-visibility-control,
body.has-karbosh-game .controls > .leave-room-control {
  display: none;
}

body.has-karbosh-game .auto-play-control {
  grid-column: 2;
}

body.has-karbosh-game .table-top-actions,
body.has-karbosh-game .table-room-actions {
  display: flex;
  align-items: center;
  min-width: 0;
}

body.has-karbosh-game .table-top-actions {
  grid-column: 2;
  grid-row: 1 / span 3;
  justify-content: flex-end;
  align-self: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

body.has-karbosh-game .table-room-actions {
  gap: 0.5rem;
}

body.has-karbosh-game .table-fill-bots-button,
body.has-karbosh-game .table-top-actions .visibility-button,
body.has-karbosh-game .table-top-actions .leave-room-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  white-space: nowrap;
}

.auto-play-button,
.visibility-button,
.leave-room-button {
  min-height: 2.35rem;
  padding: 0 0.9rem;
}

.auto-play-button {
  border-color: rgba(111, 208, 199, 0.56);
  background: rgba(111, 208, 199, 0.08);
}

.auto-play-button:hover,
.auto-play-button:focus-visible {
  border-color: rgba(111, 208, 199, 0.9);
  background: rgba(111, 208, 199, 0.16);
}

.visibility-button {
  border-color: rgba(111, 208, 199, 0.56);
  background: rgba(111, 208, 199, 0.08);
}

.visibility-button:hover,
.visibility-button:focus-visible {
  border-color: rgba(111, 208, 199, 0.9);
  background: rgba(111, 208, 199, 0.16);
}

.leave-room-button {
  border-color: rgba(255, 154, 168, 0.6);
  background: rgba(255, 154, 168, 0.07);
}

.leave-room-button:hover,
.leave-room-button:focus-visible {
  border-color: rgba(255, 154, 168, 0.95);
  background: rgba(255, 154, 168, 0.15);
}

.hand-panel {
  border-top: 1px solid var(--line);
  margin-bottom: 1rem;
  padding-top: 1rem;
}

.hand-heading {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.hand-heading h2 {
  margin-bottom: 0;
}

.hand-heading span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

button,
input {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--white);
}

button {
  min-height: 2.75rem;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 0 1.1rem;
  text-transform: uppercase;
}

button:hover,
button:focus-visible {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.07);
}

button.is-active {
  border-color: rgba(111, 208, 199, 0.85);
  background: rgba(111, 208, 199, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.trump-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.4rem;
  min-height: 3.4rem;
  border-color: rgba(17, 20, 32, 0.22);
  border-radius: 8px;
  background: #f8f5ed;
  box-shadow: 0 0.25rem 0.65rem rgba(8, 12, 26, 0.18);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  overflow: hidden;
  padding: 0;
  text-transform: none;
}

.trump-button:hover,
.trump-button:focus-visible {
  border-color: rgba(111, 208, 199, 0.9);
  background: #fffdf7;
  box-shadow:
    0 0 0 3px rgba(111, 208, 199, 0.18),
    0 0.35rem 0.8rem rgba(8, 12, 26, 0.22);
}

.card-button {
  min-width: 3.25rem;
  height: 4.25rem;
  border-radius: 6px;
  background: #f8f5ed;
  border-color: rgba(17, 20, 32, 0.22);
  box-shadow: 0 0.35rem 0.85rem rgba(8, 12, 26, 0.2);
  font-size: 1.3rem;
  letter-spacing: 0;
  padding: 0;
  text-transform: none;
  touch-action: none;
  user-select: none;
}

.card-button:hover,
.card-button:focus-visible {
  background: #fff;
  border-color: rgba(255, 255, 255, 0.8);
}

.card-button.is-disabled {
  cursor: grab;
  opacity: 0.72;
}

.card-button.is-disabled:hover,
.card-button.is-disabled:focus-visible {
  border-color: rgba(17, 20, 32, 0.22);
  background: #f8f5ed;
}

.card-button.is-dragging {
  cursor: grabbing;
  opacity: 0.98;
  transform: translateY(-0.22rem) scale(1.04);
  box-shadow:
    0 0 0 3px rgba(111, 208, 199, 0.22),
    0 0.55rem 1rem rgba(8, 12, 26, 0.3);
}

.debug-panel {
  display: grid;
  gap: 1rem;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 1rem;
}

.debug-heading {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.debug-heading h2,
.debug-heading .eyebrow {
  margin-bottom: 0;
}

.debug-panel h3 {
  color: var(--white);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  margin: 0.35rem 0 -0.35rem;
  text-transform: uppercase;
}

.debug-meta,
.debug-hands {
  display: grid;
  gap: 0.6rem;
}

.debug-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.debug-meta span {
  border-left: 3px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.55rem 0.65rem;
  text-transform: uppercase;
}

.debug-meta strong {
  display: block;
  letter-spacing: 0;
  text-transform: none;
}

.debug-hands {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.debug-hand,
.debug-deal,
.debug-hand-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 22, 34, 0.48);
  padding: 0.7rem;
}

.debug-hand strong {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.45rem;
}

.debug-hand div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.debug-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2.55rem;
  border: 1px solid rgba(17, 20, 32, 0.18);
  border-radius: 5px;
  background: #f8f5ed;
  color: #141821;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.debug-card.suit-heart,
.debug-card.suit-diamond {
  color: #c62f43;
}

.debug-trump.suit-heart,
.debug-trump.suit-diamond {
  color: #ff9aa8;
}

.debug-trump.suit-spade,
.debug-trump.suit-club {
  color: var(--white);
}

.debug-deal,
.debug-hand-detail {
  display: grid;
  gap: 0.7rem;
}

.debug-deal-heading {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: space-between;
}

.debug-deal-heading span {
  color: var(--muted);
  font-size: 0.7rem;
}

.debug-history-list {
  display: grid;
  gap: 0.45rem;
}

.debug-history-button {
  display: grid;
  grid-template-columns: 5.5rem minmax(4rem, 0.7fr) repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  align-items: center;
  width: 100%;
  min-height: 0;
  border-radius: 8px;
  background: rgba(18, 22, 34, 0.52);
  font-size: 0.72rem;
  letter-spacing: 0;
  padding: 0.55rem 0.65rem;
  text-align: left;
  text-transform: none;
}

.debug-history-button.is-selected {
  border-color: rgba(111, 208, 199, 0.7);
  background: rgba(111, 208, 199, 0.12);
}

.debug-history-button span,
.debug-history-button em {
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
}

.debug-history-button strong,
.debug-history-button em {
  display: flex;
  gap: 0.25rem;
  align-items: baseline;
  min-width: 0;
}

.debug-detail-heading {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
}

.debug-detail-heading span {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
  color: var(--muted);
}

.debug-events,
.debug-tricks {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.debug-tricks li {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 0.55rem 0.65rem;
}

.debug-tricks span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.debug-tricks span strong {
  display: block;
  font-size: 0.8rem;
}

.debug-tricks div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
}

.debug-tricks em {
  align-self: center;
  color: var(--muted);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 700;
  margin-left: 0.35rem;
}

.debug-empty {
  color: var(--muted);
}

.seat-list {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.seat {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

.seat span,
.seat strong,
.seat small {
  display: block;
}

.seat em {
  color: var(--muted);
  font-size: 0.75rem;
  font-style: normal;
}

.seat.is-connected {
  border-color: rgba(111, 208, 199, 0.45);
}

.seat.is-bot {
  border-color: rgba(183, 78, 145, 0.56);
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.25rem;
}

label {
  display: grid;
  gap: 0.45rem;
}

label span {
  color: var(--muted);
  font-size: 0.8rem;
}

input {
  width: 100%;
  min-height: 2.75rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0 0.8rem;
}

.checkbox-row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.85rem;
}

.checkbox-row input {
  width: 1.1rem;
  min-height: 1.1rem;
  accent-color: var(--accent-3);
}

.checkbox-row span {
  color: var(--white);
  font-size: 0.85rem;
}

.setup-actions {
  justify-content: flex-start;
  margin-top: 1rem;
}

.public-rooms-panel {
  min-height: 13rem;
}

.public-room-list {
  display: grid;
  gap: 0.55rem;
}

.public-room-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  padding: 0.6rem;
}

.public-room-row strong,
.public-room-row span,
.public-room-row em {
  display: block;
}

.public-room-row span,
.public-room-row em,
.public-rooms-empty {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.public-room-row button {
  min-height: 2.25rem;
  padding: 0 0.85rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: rgba(8, 12, 26, 0.76);
  padding: 1.25rem;
}

.join-modal {
  width: min(100%, 28rem);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-3);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}

.join-modal h2 {
  margin-bottom: 0.95rem;
}

.join-modal h3 {
  color: var(--white);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.join-modal-muted,
.join-modal-count,
.join-modal-error {
  color: var(--muted);
  margin-bottom: 0.95rem;
}

.join-modal-error {
  color: var(--danger);
}

.join-teams {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 0.65rem;
}

.join-team h3 {
  margin-bottom: 0.45rem;
}

.join-seat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.join-seat-option {
  display: grid;
  gap: 0.16rem;
  min-height: 4.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  letter-spacing: 0;
  padding: 0.55rem 0.6rem;
  text-align: left;
  text-transform: none;
}

.join-seat-option span,
.join-seat-option em {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.join-seat-option strong {
  overflow: hidden;
  color: var(--white);
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.join-seat-option.is-joinable {
  border-color: rgba(111, 208, 199, 0.34);
}

.join-seat-option.is-selected {
  border-color: rgba(111, 208, 199, 0.95);
  background: rgba(111, 208, 199, 0.18);
  box-shadow: 0 0 0 2px rgba(111, 208, 199, 0.18);
}

.join-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

@media screen and (max-width: 980px) {
  .sidebar {
    position: relative;
    width: auto;
    padding: 1.25rem;
  }

  .sidebar-inner {
    min-height: 0;
    text-align: left;
  }

  .page-shell {
    margin-left: 0;
  }

  .section-inner {
    padding: 2rem 1.25rem;
  }

  .table-grid,
  .setup-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .debug-meta,
  .debug-hands,
  .debug-history-button {
    grid-template-columns: 1fr;
  }

  .join-seat-grid {
    grid-template-columns: 1fr;
  }

  .public-room-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .public-room-row button {
    width: 100%;
  }

  .trick-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .table-surface {
    min-height: 34rem;
  }

  .felt-oval {
    inset: 9.2rem 1.5rem 7rem;
  }

  .table-center {
    top: calc(50% + 1.3rem);
    width: min(20rem, 78vw);
  }

  .table-status {
    grid-template-columns: 1fr;
  }

  .table-hand-status {
    top: 0.75rem;
    gap: 0.45rem 0.9rem;
    width: calc(100% - 1.5rem);
  }

  .table-hand-status span {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
  }

  .table-hand-status strong {
    font-size: 1rem;
  }

  .trump-symbol {
    font-size: 1.5rem;
  }

  .turn-summary {
    width: 100%;
  }

  .bid-popup {
    top: 0.65rem;
    right: 0.65rem;
  }

  .player-seat {
    width: 9.4rem;
    grid-template-columns: 1fr;
    padding: 0.55rem;
  }

  .seat-hand-backs {
    display: none;
  }

  .player-seat.player-player1 {
    bottom: 1.4rem;
  }

  .player-seat.player-player2 {
    bottom: 6rem;
    left: 0.65rem;
  }

  .player-seat.player-player3 {
    top: 7.2rem;
    left: 0.65rem;
  }

  .player-seat.player-player4 {
    top: 3.8rem;
  }

  .player-seat.player-player5 {
    top: 7.2rem;
    right: 0.65rem;
  }

  .player-seat.player-player6 {
    right: 0.65rem;
    bottom: 6rem;
  }

  .trick-card.player-player2,
  .trick-card.player-player3 {
    left: 0.75rem;
  }

  .trick-card.player-player5,
  .trick-card.player-player6 {
    right: 0.75rem;
  }

  .trick-card.player-player1 {
    --start-y: 7.75rem;
  }

  .trick-card.player-player2 {
    --start-x: -5.5rem;
    --start-y: 5rem;
  }

  .trick-card.player-player3 {
    --start-x: -5.5rem;
    --start-y: -4.9rem;
  }

  .trick-card.player-player4 {
    --start-y: -7.75rem;
  }

  .trick-card.player-player5 {
    --start-x: 5.5rem;
    --start-y: -4.9rem;
  }

  .trick-card.player-player6 {
    --start-x: 5.5rem;
    --start-y: 5rem;
  }
}

@media screen and (max-width: 680px), screen and (max-height: 560px) {
  body.has-karbosh-game {
    --karbosh-mobile-edge: 0.35rem;
    --karbosh-mobile-height: 100vh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  @supports (height: 100svh) {
    body.has-karbosh-game {
      --karbosh-mobile-height: 100svh;
    }
  }

  body.has-karbosh-game .sidebar,
  body.has-karbosh-game .top-strip,
  body.has-karbosh-game .section-secondary,
  body.has-karbosh-game .meta-grid,
  body.has-karbosh-game .connection-pill,
  body.has-karbosh-game .mobile-seat-roster {
    display: none;
  }

  body.has-karbosh-game .page-shell {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    min-height: var(--karbosh-mobile-height);
    height: var(--karbosh-mobile-height);
    max-height: var(--karbosh-mobile-height);
    overflow: hidden;
  }

  body.has-karbosh-game .section-primary,
  body.has-karbosh-game .section-inner,
  body.has-karbosh-game #game-root,
  body.has-karbosh-game .table-grid,
  body.has-karbosh-game .table-panel {
    min-height: 0;
    height: 100%;
  }

  body.has-karbosh-game .section-inner {
    width: 100%;
    padding:
      var(--karbosh-mobile-edge)
      var(--karbosh-mobile-edge)
      max(var(--karbosh-mobile-edge), env(safe-area-inset-bottom));
    overflow: hidden;
  }

  body.has-karbosh-game .table-grid {
    gap: 0;
  }

  body.has-karbosh-game .table-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: 0.3rem;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
  }

  body.has-karbosh-game .panel-heading {
    order: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.3rem;
    align-items: center;
    border-bottom: 0;
    margin: 0;
    padding: 0;
  }

  body.has-karbosh-game .panel-heading .eyebrow {
    display: none;
  }

  body.has-karbosh-game .panel-heading h1 {
    margin: 0;
    overflow: hidden;
    font-size: 0.95rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.has-karbosh-game .status-line {
    display: none;
  }

  body.has-karbosh-game .table-top-actions,
  body.has-karbosh-game .table-room-actions {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  body.has-karbosh-game .table-top-actions {
    gap: 0.26rem;
    justify-content: flex-end;
  }

  body.has-karbosh-game .table-room-actions {
    gap: 0.26rem;
  }

  body.has-karbosh-game .table-fill-bots-button,
  body.has-karbosh-game .table-top-actions .visibility-button,
  body.has-karbosh-game .table-top-actions .leave-room-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.65rem;
    min-width: 0;
    width: auto;
    max-width: 6rem;
    overflow: hidden;
    border-color: rgba(111, 208, 199, 0.56);
    background: rgba(111, 208, 199, 0.08);
    padding: 0 0.42rem;
    font-size: 0.48rem;
    letter-spacing: 0.05em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.has-karbosh-game .table-top-actions .leave-room-button {
    border-color: rgba(255, 154, 168, 0.6);
    background: rgba(255, 154, 168, 0.07);
  }

  body.has-karbosh-game .score-summary {
    order: 2;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.35rem;
    align-items: center;
    margin: 0;
  }

  body.has-karbosh-game .score-summary-label {
    font-size: 0.52rem;
    letter-spacing: 0.1em;
    white-space: nowrap;
  }

  body.has-karbosh-game .score-row {
    gap: 0.3rem;
  }

  body.has-karbosh-game .score-row span {
    padding: 0.25rem 0.35rem;
    font-size: 0.6rem;
    line-height: 1.1;
  }

  body.has-karbosh-game .score-row strong {
    font-size: 0.88rem;
  }

  .table-status {
    order: 7;
  }

  body.has-karbosh-game .table-status {
    display: none;
  }

  .table-surface {
    order: 3;
    min-height: 31rem;
  }

  body.has-karbosh-game .table-surface {
    order: 3;
    min-height: 0;
    height: 100%;
    margin: 0;
  }

  body.has-karbosh-game .felt-oval {
    inset: 4.6rem 0.65rem 2.9rem;
    border-width: 0.45rem;
  }

  body.has-karbosh-game .table-center {
    top: calc(50% + 0.35rem);
    width: min(14.25rem, 68vw);
    min-height: 9.7rem;
  }

  body.has-karbosh-game .trick-pile {
    min-height: 9.7rem;
  }

  body.has-karbosh-game .trick-card,
  body.has-karbosh-game .trick-empty {
    gap: 0.2rem;
    width: 3.7rem;
    min-height: 4.7rem;
  }

  body.has-karbosh-game .card-face {
    min-width: 2.05rem;
    min-height: 2.65rem;
    font-size: 0.92rem;
  }

  body.has-karbosh-game .trick-card span,
  body.has-karbosh-game .trick-empty span {
    font-size: 0.48rem;
    letter-spacing: 0.06em;
  }

  body.has-karbosh-game .table-hand-status {
    top: 0.35rem;
    display: grid;
    grid-template-columns: repeat(4, max-content);
    gap: 0.2rem 0.4rem;
    justify-content: center;
    width: calc(100% - 0.7rem);
    max-width: calc(100% - 0.7rem);
  }

  body.has-karbosh-game .table-hand-status > div {
    gap: 0.22rem;
    white-space: nowrap;
  }

  body.has-karbosh-game .table-hand-status span {
    font-size: 0.46rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }

  body.has-karbosh-game .table-hand-status strong {
    font-size: 0.78rem;
    white-space: nowrap;
  }

  body.has-karbosh-game .trump-symbol {
    font-size: 1.05rem;
  }

  .controls {
    order: 5;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.has-karbosh-game .controls {
    order: 6;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.28rem;
    align-items: stretch;
    margin: 0;
  }

  body.has-karbosh-game .controls::before {
    display: none;
  }

  body.has-karbosh-game .controls > .control-group:not(.auto-play-control):not(.room-visibility-control):not(.leave-room-control) {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.24rem;
  }

  body.has-karbosh-game .controls button {
    min-height: 1.75rem;
    min-width: 0;
    padding: 0 0.22rem;
    font-size: 0.52rem;
    letter-spacing: 0.04em;
  }

  body.has-karbosh-game .trump-control-group {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.has-karbosh-game .trump-button {
    min-height: 2.15rem;
    font-size: 4rem;
  }

  body.has-karbosh-game .auto-play-control {
    grid-column: 1 / -1;
  }

  .auto-play-control {
    grid-column: 1;
    order: 2;
  }

  .leave-room-control {
    grid-column: 2;
    order: 2;
  }

  .room-visibility-control {
    grid-column: 1 / -1;
    order: 3;
  }

  .auto-play-control,
  .room-visibility-control,
  .leave-room-control {
    justify-content: stretch;
  }

  body.has-karbosh-game .controls > .room-visibility-control,
  body.has-karbosh-game .controls > .leave-room-control {
    display: none;
  }

  .auto-play-button,
  .visibility-button,
  .leave-room-button {
    width: 100%;
  }

  .hand-panel {
    order: 4;
    margin-bottom: 1.35rem;
  }

  body.has-karbosh-game .hand-panel {
    order: 5;
    min-height: 0;
    border-top: 0;
    margin: 0;
    padding-top: 0;
  }

  body.has-karbosh-game .hand-heading {
    margin-bottom: 0.28rem;
  }

  body.has-karbosh-game .hand-heading h2 {
    font-size: 0.8rem;
  }

  body.has-karbosh-game .hand-heading span {
    font-size: 0.52rem;
    letter-spacing: 0.08em;
  }

  body.has-karbosh-game .hand-row {
    flex-wrap: nowrap;
    gap: 0.28rem;
    overflow-x: auto;
    padding-bottom: 0.08rem;
    scrollbar-width: none;
  }

  body.has-karbosh-game .hand-row::-webkit-scrollbar {
    display: none;
  }

  body.has-karbosh-game .card-button {
    flex: 0 0 2.28rem;
    width: 2.28rem;
    min-width: 2.28rem;
    height: 3rem;
    font-size: 0.88rem;
  }

  .mobile-seat-roster {
    order: 6;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .felt-oval {
    inset: 7.8rem 0.9rem 5.6rem;
  }

  .table-center {
    top: calc(50% + 0.8rem);
    width: min(17rem, 74vw);
  }

  .table-hand-status {
    top: 0.6rem;
  }

  .player-seat {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    justify-items: center;
    gap: 0.16rem;
    width: clamp(4.9rem, 22vw, 6rem);
    min-height: 2.35rem;
    padding: 0.38rem 0.45rem;
    text-align: center;
  }

  .player-seat strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.76rem;
    line-height: 1.15;
  }

  .player-seat small,
  .player-seat .seat-hand-backs,
  .player-seat .turn-badge {
    display: none;
  }

  .player-seat .bid-chip {
    display: inline-flex;
    margin-top: 0;
    max-width: 100%;
    overflow: hidden;
    padding: 0.13rem 0.3rem;
    font-size: 0.48rem;
    letter-spacing: 0.05em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .player-seat::before {
    border-top-width: 0.58rem;
    border-left-width: 0.58rem;
  }

  .player-seat.is-current {
    box-shadow:
      0 0 0 2px rgba(111, 208, 199, 0.2),
      0 0.55rem 1.25rem rgba(8, 12, 26, 0.26);
  }

  .player-seat.player-player1 {
    bottom: 0.95rem;
  }

  .player-seat.player-player2 {
    bottom: 5.4rem;
    left: 0.5rem;
  }

  .player-seat.player-player3 {
    top: 6.1rem;
    left: 0.5rem;
  }

  .player-seat.player-player4 {
    top: 3.15rem;
  }

  .player-seat.player-player5 {
    top: 6.1rem;
    right: 0.5rem;
  }

  .player-seat.player-player6 {
    right: 0.5rem;
    bottom: 5.4rem;
  }

  .trick-card,
  .trick-empty {
    width: 4.6rem;
  }

  .trick-card.player-player2,
  .trick-card.player-player3 {
    left: 0.4rem;
  }

  .trick-card.player-player5,
  .trick-card.player-player6 {
    right: 0.4rem;
  }
}

@media screen and (max-height: 560px) {
  body.has-karbosh-game {
    --karbosh-mobile-edge: 0.22rem;
  }

  body.has-karbosh-game .table-panel {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 0.18rem;
  }

  body.has-karbosh-game .panel-heading {
    gap: 0.24rem;
  }

  body.has-karbosh-game .panel-heading h1 {
    font-size: 0.76rem;
  }

  body.has-karbosh-game .table-top-actions {
    gap: 0.18rem;
  }

  body.has-karbosh-game .table-room-actions {
    gap: 0.18rem;
  }

  body.has-karbosh-game .table-fill-bots-button,
  body.has-karbosh-game .table-top-actions .visibility-button,
  body.has-karbosh-game .table-top-actions .leave-room-button {
    min-height: 1.35rem;
    padding: 0 0.32rem;
    font-size: 0.43rem;
  }

  body.has-karbosh-game .score-summary {
    display: none;
  }

  body.has-karbosh-game .felt-oval {
    inset: 2.6rem 0.6rem 1.6rem;
    border-width: 0.35rem;
  }

  body.has-karbosh-game .table-center {
    top: calc(50% + 0.35rem);
    width: min(12.5rem, 52vw);
    min-height: 5.9rem;
  }

  body.has-karbosh-game .trick-pile {
    min-height: 5.9rem;
  }

  body.has-karbosh-game .trick-card,
  body.has-karbosh-game .trick-empty {
    gap: 0.2rem;
    width: 3.2rem;
    min-height: 3.8rem;
  }

  body.has-karbosh-game .card-face {
    min-width: 1.75rem;
    min-height: 2.25rem;
    font-size: 0.78rem;
  }

  body.has-karbosh-game .table-hand-status {
    top: 0.18rem;
    gap: 0.12rem 0.32rem;
  }

  body.has-karbosh-game .table-hand-status span {
    font-size: 0.4rem;
  }

  body.has-karbosh-game .table-hand-status strong {
    font-size: 0.64rem;
  }

  body.has-karbosh-game .trump-symbol {
    font-size: 0.88rem;
  }

  body.has-karbosh-game .player-seat {
    width: clamp(4rem, 17vw, 5.1rem);
    min-height: 1.55rem;
    padding: 0.18rem 0.28rem;
  }

  body.has-karbosh-game .player-seat strong {
    font-size: 0.62rem;
  }

  body.has-karbosh-game .player-seat .bid-chip {
    padding: 0.08rem 0.22rem;
    font-size: 0.39rem;
    letter-spacing: 0.04em;
  }

  body.has-karbosh-game .player-seat.player-player1 {
    bottom: 0.45rem;
  }

  body.has-karbosh-game .player-seat.player-player2 {
    bottom: 2.7rem;
  }

  body.has-karbosh-game .player-seat.player-player3 {
    top: 3.2rem;
  }

  body.has-karbosh-game .player-seat.player-player4 {
    top: 1.8rem;
  }

  body.has-karbosh-game .player-seat.player-player5 {
    top: 3.2rem;
  }

  body.has-karbosh-game .player-seat.player-player6 {
    bottom: 2.7rem;
  }

  body.has-karbosh-game .hand-heading {
    display: none;
  }

  body.has-karbosh-game .hand-row {
    gap: 0.2rem;
    padding-bottom: 0;
  }

  body.has-karbosh-game .card-button {
    flex-basis: 1.72rem;
    width: 1.72rem;
    min-width: 1.72rem;
    height: 2.58rem;
    font-size: 0.72rem;
  }

  body.has-karbosh-game .controls {
    gap: 0.18rem;
  }

  body.has-karbosh-game .controls > .control-group:not(.auto-play-control):not(.room-visibility-control):not(.leave-room-control) {
    gap: 0.18rem;
  }

  body.has-karbosh-game .controls button {
    min-height: 1.42rem;
    font-size: 0.45rem;
  }

  body.has-karbosh-game .trump-button {
    min-height: 1.7rem;
    font-size: 3.3rem;
  }
}

@media screen and (orientation: landscape) and (max-height: 560px) {
  body.has-karbosh-game {
    --karbosh-mobile-edge: 0.24rem;
  }

  body.has-karbosh-game .section-inner {
    padding: var(--karbosh-mobile-edge);
  }

  body.has-karbosh-game .table-panel {
    grid-template-columns: minmax(0, 1fr) clamp(10.5rem, 29vw, 14rem);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "heading heading"
      "surface side";
    gap: 0.22rem 0.38rem;
  }

  body.has-karbosh-game .panel-heading {
    grid-area: heading;
  }

  body.has-karbosh-game .table-surface {
    grid-area: surface;
  }

  body.has-karbosh-game .play-controls-panel {
    display: grid;
    grid-area: side;
    grid-template-rows: auto auto;
    align-content: start;
    gap: 0.22rem;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  body.has-karbosh-game .hand-panel {
    display: grid;
    min-height: 0;
  }

  body.has-karbosh-game .hand-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: clamp(2.35rem, 19vh, 2.85rem);
    gap: 0.16rem;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0;
  }

  body.has-karbosh-game .card-button {
    width: 100%;
    min-width: 0;
    height: clamp(2.35rem, 19vh, 2.85rem);
    font-size: 0.72rem;
  }

  body.has-karbosh-game .controls {
    align-content: start;
    gap: 0.2rem;
    min-height: 0;
    overflow: hidden;
  }

  body.has-karbosh-game .controls > .control-group:not(.auto-play-control):not(.room-visibility-control):not(.leave-room-control) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.16rem;
  }

  body.has-karbosh-game .controls button {
    min-height: 1.38rem;
    font-size: 0.45rem;
  }

  body.has-karbosh-game .trump-control-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.has-karbosh-game .trump-button {
    min-height: 2rem;
    font-size: 3.5rem;
  }

  body.has-karbosh-game .table-center {
    width: min(13rem, 62%);
  }
}

@media screen and (max-width: 430px) {
  .controls {
    grid-template-columns: 1fr;
  }

  body.has-karbosh-game .controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .auto-play-control,
  .room-visibility-control,
  .leave-room-control {
    grid-column: 1;
  }

  body.has-karbosh-game .auto-play-control {
    grid-column: 1;
  }

  body.has-karbosh-game .leave-room-control {
    grid-column: 3;
  }

  body.has-karbosh-game .room-visibility-control {
    grid-column: 2;
  }

  .mobile-seat-roster {
    grid-template-columns: 1fr;
  }

  .table-center {
    width: min(15rem, 70vw);
  }

  body.has-karbosh-game .table-center {
    width: min(13.5rem, 68vw);
  }
}

.trump-picker-backdrop {
  left: 18rem;
  place-items: center;
  background: rgba(8, 12, 26, 0.58);
  padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
}

.trump-picker-modal {
  display: grid;
  gap: 0.8rem;
  width: min(30rem, calc(100vw - 1.5rem));
  border: 1px solid rgba(111, 208, 199, 0.54);
  border-radius: 8px;
  background: rgba(18, 22, 34, 0.96);
  box-shadow: 0 1.1rem 2.4rem rgba(8, 12, 26, 0.42);
  padding: 1rem;
}

.trump-picker-label {
  color: var(--white);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}

.trump-suit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.trump-suit-grid .trump-button {
  aspect-ratio: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  font-size: clamp(2.4rem, 5vw, 3.5rem);
  line-height: 1;
}

.trump-picker-modal .auto-play-button {
  justify-self: center;
  min-height: 2.2rem;
  width: min(12rem, 100%);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

@media screen and (max-width: 980px) {
  .trump-picker-backdrop {
    left: 0;
  }
}

@media screen and (max-width: 680px) {
  .trump-picker-modal {
    width: min(17rem, calc(100vw - 1.25rem));
    gap: 0.75rem;
    padding: 0.9rem;
  }

  .trump-suit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .trump-suit-grid .trump-button {
    font-size: clamp(2.75rem, 15vw, 3.8rem);
  }
}

@media screen and (orientation: landscape) and (max-height: 560px) {
  .trump-picker-modal {
    width: min(23rem, calc(100vw - 1rem));
    gap: 0.45rem;
    padding: 0.65rem;
  }

  .trump-picker-label {
    font-size: 0.68rem;
  }

  .trump-suit-grid {
    gap: 0.42rem;
  }

  .trump-suit-grid .trump-button {
    font-size: clamp(2rem, 8vh, 2.85rem);
  }

  .trump-picker-modal .auto-play-button {
    min-height: 1.85rem;
    font-size: 0.52rem;
  }
}
