:root {
  --ink: #f3f6f4;
  --muted: #9bacab;
  --page: #11191a;
  --panel: #1b2627;
  --panel-edge: #314241;
  --felt: #157b57;
  --felt-dark: #0e5a40;
  --gold: #e0b65f;
  --coral: #e46b58;
  --mint: #79d5ad;
  --red: #d9504c;
  --black-card: #1b252c;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Noto Sans SC", system-ui, sans-serif;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid #f3d67f;
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  filter: saturate(0.3);
  opacity: 0.45;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px max(24px, calc((100vw - 1460px) / 2));
  border-bottom: 1px solid #263536;
  background: #162021;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 6px;
  background: #22312e;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
}

h3 {
  margin: 0;
  font-size: 14px;
}

.table-meta {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 13px;
}

.player-count-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #b8c8c3;
  font-size: 12px;
  font-weight: 700;
}

.player-count-control select {
  min-width: 58px;
  min-height: 30px;
  padding: 4px 23px 4px 8px;
  border: 1px solid #516966;
  border-radius: 4px;
  background: #1d2b2a;
  color: var(--ink);
  font: inherit;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.chip-virtual {
  background: #28413c;
  color: var(--mint);
}

.game-layout {
  display: grid;
  width: min(1460px, 100%);
  min-height: calc(100vh - 78px);
  grid-template-columns: 236px minmax(550px, 1fr) 236px;
  gap: 18px;
  margin: 0 auto;
  padding: 18px 24px 24px;
}

.side-panel {
  min-width: 0;
  border: 1px solid var(--panel-edge);
  border-radius: 7px;
  background: var(--panel);
}

.panel-heading {
  padding: 18px 17px 13px;
  border-bottom: 1px solid #31403f;
}

.player-list {
  display: grid;
  gap: 2px;
  padding: 8px;
}

.table-settings {
  display: grid;
  gap: 8px;
  padding: 14px 16px 12px;
  border-top: 1px solid #31403f;
}

.settings-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
}

.settings-heading .eyebrow {
  margin-bottom: 0;
}

.setting-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  align-items: center;
  gap: 8px;
  color: #c9d6d1;
  font-size: 12px;
  font-weight: 700;
}

.setting-field input {
  width: 100%;
  min-height: 31px;
  padding: 4px 6px;
  border: 1px solid #516966;
  border-radius: 4px;
  background: #14201f;
  color: #f5d68e;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.settings-button {
  min-height: 34px;
  border: 1px solid #4f8c70;
  border-radius: 4px;
  background: #245d46;
  color: #e4f6ed;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.online-lobby {
  display: grid;
  gap: 8px;
  padding: 14px 16px 12px;
  border-top: 1px solid #31403f;
}

.online-entry,
.online-room {
  display: grid;
  gap: 8px;
}

.online-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.secondary-action-button {
  min-height: 34px;
  border: 1px solid #536d68;
  border-radius: 4px;
  background: #1c2b29;
  color: #d1e0da;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.online-room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 8px;
  border: 1px solid #506862;
  border-radius: 5px;
  background: #14211f;
}

.online-room-code {
  color: #ffe19a;
  font-family: ui-monospace, monospace;
  font-size: 15px;
  font-weight: 800;
}

.online-room-status {
  color: #88dcb0;
  font-size: 11px;
  font-weight: 800;
}

.online-member-list {
  display: grid;
  gap: 4px;
}

.online-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #344945;
  border-radius: 4px;
  color: #cbd8d2;
  font-size: 11px;
}

.online-member.is-ready {
  border-color: #438a66;
  color: #a7ebc5;
}

.online-member-state {
  color: #88dcb0;
  font-size: 10px;
  font-weight: 800;
}

.online-member.is-bot {
  border-color: #4d566c;
  color: #b8c3d8;
}

.chip-ledger {
  display: grid;
  gap: 7px;
  padding: 8px;
  border-top: 1px solid #354741;
  border-bottom: 1px solid #354741;
}

.chip-ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #e1ebe5;
  font-size: 12px;
  font-weight: 800;
}

.chip-balance-summary {
  color: #f2cc75;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.loan-request-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 6px;
}

.loan-request-form select,
.loan-request-form input {
  min-width: 0;
  min-height: 32px;
  padding: 4px 6px;
  border: 1px solid #516966;
  border-radius: 4px;
  outline: none;
  background: #14201f;
  color: #f5d68e;
  font: inherit;
  font-size: 11px;
}

.loan-request-form button {
  grid-column: 1 / -1;
}

.loan-ledger-items {
  display: grid;
  gap: 5px;
}

.loan-ledger-item {
  display: grid;
  gap: 5px;
  padding: 7px;
  border: 1px solid #354a46;
  border-radius: 4px;
  color: #bac9c2;
  font-size: 10px;
  line-height: 1.35;
}

.loan-ledger-item.is-pending {
  border-color: #967847;
}

.loan-ledger-item strong {
  color: #eef4ef;
  font-size: 11px;
}

.loan-ledger-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.loan-ledger-actions button {
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid #506862;
  border-radius: 4px;
  background: #1d302c;
  color: #d6e6dd;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
}

.loan-ledger-actions .loan-approve {
  border-color: #4f8c70;
  background: #245d46;
}

.loan-ledger-actions input {
  width: 76px;
  min-height: 28px;
  padding: 4px 6px;
  border: 1px solid #516966;
  border-radius: 4px;
  outline: none;
  background: #14201f;
  color: #f5d68e;
  font: inherit;
  font-size: 10px;
}

.online-message {
  min-height: 16px;
  margin: 0;
  color: #9facaa;
  font-size: 11px;
  line-height: 1.4;
}

.online-message.is-error {
  color: #ef8b7d;
}

.player-list-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 5px;
}

.player-list-item.is-turn {
  border-color: #d8b45f;
  background: #263530;
}

.player-list-item.is-out {
  opacity: 0.43;
}

.mini-avatar,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  color: #13211e;
  font-weight: 800;
}

.mini-avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.player-list-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-list-status {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.player-list-chips {
  color: var(--gold);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.secondary-button,
.utility-button,
.danger-button,
.primary-button,
.gold-button,
.target-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 800;
}

.secondary-button {
  width: calc(100% - 16px);
  margin: 6px 8px 12px;
  border-color: #526968;
  background: transparent;
  color: var(--ink);
}

.table-zone {
  display: grid;
  min-width: 0;
  grid-template-rows: auto minmax(510px, 1fr) auto;
  gap: 12px;
}

.round-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 8px 15px;
  border: 1px solid var(--panel-edge);
  border-radius: 7px;
  background: var(--panel);
}

.round-label {
  margin-right: 10px;
  font-size: 14px;
}

.turn-copy {
  color: var(--mint);
  font-size: 13px;
}

.dealer-copy {
  margin-right: 10px;
  color: #f2cd7d;
  font-size: 12px;
  font-weight: 800;
}

.pot-readout {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.pot-readout strong {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 25px;
  line-height: 1;
}

.table-stage {
  display: grid;
  min-height: 510px;
  overflow: visible;
  place-items: center;
}

.table-felt {
  position: relative;
  width: min(100%, 840px);
  min-height: 500px;
  overflow: visible;
  border: 11px solid #70573a;
  border-radius: 48%;
  outline: 2px solid #ac8b57;
  background-color: var(--felt);
  background-image: url("./assets/table-felt.svg");
  box-shadow: 0 18px 34px var(--shadow), inset 0 0 0 2px rgba(0, 0, 0, 0.24);
}

.table-felt::before {
  position: absolute;
  inset: 27px;
  border: 1px solid rgba(232, 219, 173, 0.32);
  border-radius: 48%;
  content: "";
  pointer-events: none;
}

.table-felt::after {
  position: absolute;
  inset: 44px;
  border: 1px dashed rgba(236, 221, 166, 0.2);
  border-radius: 48%;
  content: "";
  pointer-events: none;
}

.felt-center {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 120px;
  height: 120px;
  place-items: center;
  align-content: center;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(243, 246, 244, 0.38);
  border-radius: 50%;
  background: rgba(7, 61, 40, 0.68);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.04);
  z-index: 2;
}

.center-label,
.center-suffix {
  color: #c9dfd5;
  font-size: 11px;
}

.felt-center strong {
  margin: 2px 0;
  color: #fff1bc;
  font-family: Georgia, serif;
  font-size: 34px;
  line-height: 1;
}

.table-emblem {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 196px;
  grid-template-columns: repeat(4, 1fr);
  transform: translate(-50%, 75px);
  color: rgba(241, 233, 196, 0.34);
  font-family: Georgia, serif;
  font-size: 18px;
  text-align: center;
}

.table-emblem span:nth-child(2),
.table-emblem span:nth-child(3) {
  color: rgba(232, 133, 119, 0.48);
}

.seats-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.seat {
  position: absolute;
  display: grid;
  width: 232px;
  justify-items: center;
  top: var(--seat-y);
  left: var(--seat-x);
  transform: translateX(-50%);
  transition: opacity 180ms ease, filter 180ms ease, z-index 180ms ease;
  z-index: 3;
}

.seat.is-turn {
  z-index: 6;
}

.seats-layer[data-player-count="7"] .seat,
.seats-layer[data-player-count="8"] .seat {
  width: 196px;
}

.seat.is-out {
  filter: grayscale(0.84);
  opacity: 0.55;
}

.seat-head {
  display: flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid rgba(241, 246, 241, 0.35);
  border-radius: 5px;
  background: rgba(20, 35, 31, 0.86);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.19);
}

.seat-chat {
  position: absolute;
  z-index: 4;
  top: -30px;
  max-width: 178px;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid #cfab5b;
  border-radius: 5px;
  background: #f6eed8;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.24);
  color: #26352f;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.turn-pointer {
  position: absolute;
  z-index: 5;
  top: -40px;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 11px;
  border: 2px solid #fff0a6;
  border-radius: 5px;
  background: #d08b2f;
  box-shadow: 0 0 0 3px rgba(224, 182, 95, 0.32), 0 7px 16px rgba(0, 0, 0, 0.34);
  color: #1b241f;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  animation: turn-pointer-pulse 1s ease-in-out infinite alternate;
}

.turn-pointer::after {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-top: 9px solid #fff0a6;
  border-right: 7px solid transparent;
  border-left: 7px solid transparent;
  content: "";
}

@keyframes turn-pointer-pulse {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-4px);
  }
}

.seat-action {
  position: absolute;
  z-index: 4;
  top: 37px;
  max-width: 190px;
  padding: 3px 7px;
  overflow: hidden;
  border: 1px solid rgba(216, 234, 223, 0.42);
  border-radius: 4px;
  background: rgba(11, 47, 35, 0.9);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  color: #dcebe3;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat.has-action .card-row {
  margin-top: 25px;
}

.seat.is-turn .seat-chat {
  top: -58px;
}

.seat.is-turn .seat-head {
  border-color: #ffe39a;
  box-shadow: 0 0 0 3px rgba(224, 182, 95, 0.42), 0 7px 16px rgba(0, 0, 0, 0.3);
}

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

.seat-name-block {
  display: grid;
  min-width: 52px;
}

.seat-name {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-status {
  color: #b2c5bd;
  font-size: 10px;
}

.seat-chips {
  padding-left: 3px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  color: #f5ca76;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.card-row {
  display: flex;
  min-height: 75px;
  justify-content: center;
  margin-top: 7px;
}

.seat.is-revealing .playing-card {
  animation: card-turn-in 340ms ease both;
}

.playing-card {
  position: relative;
  display: grid;
  width: 52px;
  height: 73px;
  flex: 0 0 auto;
  align-content: space-between;
  padding: 6px 6px 5px;
  border: 1px solid #dad6c9;
  border-radius: 4px;
  background: #f8f4e9;
  box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.33);
  color: var(--black-card);
  font-family: Georgia, serif;
}

.playing-card + .playing-card {
  margin-left: -26px;
}

.playing-card.card-0 {
  transform: rotate(-4deg);
}

.playing-card.card-1 {
  transform: translateY(-3px);
}

.playing-card.card-2 {
  transform: rotate(4deg);
}

.playing-card.is-red {
  color: #c83f3f;
}

.playing-card .rank {
  font-size: 18px;
  font-weight: 700;
  line-height: 0.85;
}

.playing-card .suit {
  font-size: 16px;
  line-height: 0.85;
}

.playing-card .suit-large {
  position: absolute;
  right: 8px;
  bottom: 5px;
  font-size: 28px;
  line-height: 0.8;
}

.playing-card.card-back {
  border-color: #ead5b4;
  background: #b74642 url("./assets/card-back.svg") center / cover;
}

@keyframes card-turn-in {
  from {
    opacity: 0;
    transform: rotateY(88deg) translateY(8px);
  }

  to {
    opacity: 1;
  }
}

.controls-area {
  display: grid;
  gap: 10px;
  min-height: 91px;
}

.chat-control {
  position: relative;
  display: grid;
  width: min(460px, 100%);
  justify-self: center;
}

.chat-button {
  min-height: 30px;
  justify-self: center;
  padding: 4px 10px;
  border: 1px solid #53726a;
  border-radius: 5px;
  background: #18312d;
  color: #d4e4dd;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.chat-button[aria-expanded="true"] {
  border-color: #d8b45f;
  color: #fff0bb;
}

.quick-chat-panel {
  position: absolute;
  z-index: 8;
  bottom: calc(100% + 7px);
  left: 50%;
  display: grid;
  width: min(100%, 360px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 7px;
  transform: translateX(-50%);
  border: 1px solid #56716b;
  border-radius: 6px;
  background: #172624;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.32);
}

.quick-chat-option {
  min-height: 31px;
  padding: 4px 5px;
  border: 1px solid #3e5752;
  border-radius: 4px;
  background: #203430;
  color: #dce9e3;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.quick-chat-option:active {
  background: #2c5145;
}

.target-picker {
  display: flex;
  min-height: 28px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.target-picker:empty {
  display: none;
}

.target-button {
  min-height: 28px;
  padding: 3px 9px;
  border-color: #546967;
  background: #1b2727;
  color: #d7e1dd;
  font-size: 12px;
}

.target-button.is-selected {
  border-color: var(--gold);
  background: #384034;
  color: #fff0bb;
}

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

.utility-button {
  border-color: #5d7770;
  background: #203030;
  color: var(--ink);
}

.danger-button {
  grid-column: 1 / -1;
  min-height: 36px;
  border-color: #53615e;
  background: #27302f;
  color: #c7d3cf;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.danger-button.is-confirming {
  border-color: #e06152;
  background: #7c302c;
  color: #fff2eb;
  box-shadow: inset 0 0 0 1px rgba(255, 222, 214, 0.22);
}

.primary-button {
  border-color: #3d8e68;
  background: #26734f;
  color: #effff6;
}

.raise-button {
  background: #2b6555;
}

.gold-button {
  border-color: #dfb456;
  background: #a06f2d;
  color: #fff5d0;
}

.men-kai-button {
  background: #86512d;
}

.compare-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 12, 11, 0.72);
}

.raise-overlay {
  position: fixed;
  z-index: 22;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 12, 11, 0.76);
}

.raise-overlay[hidden] {
  display: none;
}

.raise-dialog {
  width: min(440px, 100%);
  padding: 20px;
  border: 1px solid #b7934f;
  border-radius: 7px;
  background: #1c2927;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.54);
}

.raise-dialog h2 {
  margin: 4px 0 6px;
  color: #fff0bb;
  font-family: Georgia, "Microsoft YaHei UI", serif;
  font-size: 25px;
}

.raise-current-copy {
  margin: 0 0 14px;
  color: #c5d2cc;
  font-size: 13px;
}

.raise-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.raise-option {
  min-height: 39px;
  padding: 5px 3px;
  border: 1px solid #516966;
  border-radius: 4px;
  background: #14211f;
  color: #e5eee9;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.raise-option.is-selected {
  border-color: #f0cc76;
  background: #5f4826;
  box-shadow: 0 0 0 1px rgba(240, 204, 118, 0.3);
  color: #fff2bd;
}

.raise-custom-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid #516966;
  border-radius: 5px;
  background: #14211f;
  color: #c9dfd5;
  font-size: 12px;
  font-weight: 800;
}

.raise-custom-field input {
  min-width: 0;
  min-height: 39px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff0bb;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.raise-error {
  min-height: 18px;
  margin: 7px 0 0;
  color: #f1aaa0;
  font-size: 12px;
  line-height: 1.4;
}

.dealer-draw-overlay {
  position: fixed;
  z-index: 19;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 12, 11, 0.74);
}

.dealer-draw-dialog {
  width: min(680px, 100%);
  padding: 22px;
  border: 1px solid #b7934f;
  border-radius: 7px;
  background: #1c2927;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.54);
  text-align: center;
}

.dealer-draw-dialog h2 {
  margin: 4px 0 7px;
  color: #fff0bb;
  font-family: Georgia, "Microsoft YaHei UI", serif;
  font-size: 25px;
}

.dealer-draw-copy {
  margin: 0 0 17px;
  color: #c5d2cc;
  font-size: 13px;
  line-height: 1.45;
}

.dealer-draw-cards {
  display: flex;
  min-height: 142px;
  flex-wrap: wrap;
  align-items: end;
  justify-content: center;
  gap: 10px;
}

.dealer-draw-player {
  display: grid;
  width: 82px;
  justify-items: center;
  gap: 7px;
  color: #afc1bb;
  font-size: 11px;
}

.dealer-draw-player strong {
  width: 100%;
  overflow: hidden;
  color: #e4eee8;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dealer-draw-card {
  display: grid;
  width: 62px;
  min-height: 89px;
  place-items: end center;
}

.dealer-draw-card .playing-card {
  width: 62px;
  height: 87px;
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.dealer-draw-player.is-revealed .dealer-draw-card .playing-card {
  animation: card-turn-in 280ms ease both;
}

.dealer-draw-player.is-dealer .dealer-draw-card .playing-card {
  box-shadow: 0 0 0 2px #e0b65f, 0 7px 18px rgba(0, 0, 0, 0.36);
  transform: translateY(-5px);
}

.update-notice {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 12, 11, 0.76);
}

.update-dialog {
  width: min(100%, 360px);
  padding: 18px;
  border: 1px solid #857248;
  border-radius: 7px;
  background: #192623;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.update-dialog h2 {
  margin: 5px 0 8px;
  color: #f5e6ba;
  font-size: 20px;
}

.compare-overlay[hidden] {
  display: none;
}

.compare-dialog {
  width: min(460px, 100%);
  padding: 24px;
  border: 1px solid #b7934f;
  border-radius: 7px;
  background: #1c2927;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.54);
  text-align: center;
}

.compare-dialog h2 {
  margin-bottom: 5px;
  color: #fff0bb;
  font-family: Georgia, "Microsoft YaHei UI", serif;
  font-size: 25px;
}

.compare-copy {
  margin: 0 0 20px;
  color: #c5d2cc;
  font-size: 13px;
}

.compare-hands {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.compare-hand {
  min-width: 0;
  padding: 12px 8px 8px;
  border: 1px solid #425753;
  border-radius: 5px;
  background: #14201f;
}

.compare-hand.is-winner {
  border-color: #d4ae5a;
  background: #29352d;
}

.compare-hand-name {
  display: block;
  margin-bottom: 7px;
  color: #d9e4df;
  font-size: 12px;
  font-weight: 800;
}

.compare-hand-type {
  display: block;
  min-height: 18px;
  margin-top: 7px;
  color: #f3ce7d;
  font-size: 12px;
  font-weight: 700;
}

.compare-hand .card-row {
  position: relative;
  display: block;
  width: 156px;
  height: 92px;
  min-height: 92px;
  margin-top: 0;
  margin-right: auto;
  margin-left: auto;
}

.compare-hand .playing-card {
  position: absolute;
  bottom: 0;
  width: 60px;
  height: 88px;
  padding: 5px;
  transform-origin: 18% 100%;
}

.compare-hand .playing-card + .playing-card {
  margin-left: 0;
}

.compare-hand .playing-card.card-0 {
  left: 0;
  transform: rotate(-6deg);
  z-index: 1;
}

.compare-hand .playing-card.card-1 {
  left: 45px;
  transform: translateY(-3px) rotate(0deg);
  z-index: 2;
}

.compare-hand .playing-card.card-2 {
  left: 90px;
  transform: rotate(6deg);
  z-index: 3;
}

.compare-hand .playing-card .rank {
  font-size: 18px;
}

.compare-hand .playing-card .suit {
  font-size: 16px;
}

.compare-hand .playing-card .suit-large {
  right: 5px;
  bottom: 4px;
  font-size: 28px;
}

.compare-close-button {
  width: 100%;
}

.event-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-height: calc(100vh - 120px);
}

.record-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 7px 9px 0;
  border-bottom: 1px solid #31403f;
  background: #182322;
}

.record-tab {
  min-height: 31px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #9bacab;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.record-tab.is-active {
  border-bottom-color: var(--gold);
  color: #fff0bb;
}

.event-log {
  display: grid;
  align-content: start;
  gap: 0;
  overflow: auto;
  margin: 0;
  padding: 6px 15px;
  list-style: none;
}

.event-log li {
  padding: 10px 0;
  border-bottom: 1px solid #2d3b3a;
  color: #cbd7d1;
  font-size: 13px;
  line-height: 1.45;
}

.event-log li:first-child {
  color: #fff0bd;
}

.event-time {
  display: inline-block;
  width: 40px;
  color: #7d918a;
  font-family: ui-monospace, monospace;
  font-size: 10px;
}

.history-view {
  min-height: 0;
  overflow: auto;
  padding: 9px 11px 12px;
}

.history-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  color: #b7c8c1;
  font-size: 11px;
  font-weight: 800;
}

.history-search input {
  min-width: 0;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid #516966;
  border-radius: 4px;
  outline: none;
  background: #14201f;
  color: #f5d68e;
  font: inherit;
}

.history-search input:focus {
  border-color: var(--gold);
}

.hand-history {
  display: grid;
  gap: 7px;
}

.history-empty {
  margin: 14px 4px;
  color: #9bacab;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.history-card {
  overflow: hidden;
  border: 1px solid #334744;
  border-radius: 5px;
  background: #162221;
}

.history-card.is-expanded {
  border-color: #9e8550;
}

.history-summary {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  padding: 9px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.history-round {
  color: #d5e0db;
  font-size: 12px;
  font-weight: 800;
}

.history-winner {
  color: #f6cf77;
  font-size: 12px;
}

.history-meta {
  grid-column: 1 / -1;
  color: #91a49c;
  font-size: 10px;
}

.history-detail-heading {
  margin: 0;
  padding: 8px 9px;
  border-top: 1px solid #31403f;
  color: #adc1b9;
  font-size: 10px;
}

.history-detail-table {
  display: grid;
  border-top: 1px solid #2b3c39;
}

.history-player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 7px;
  padding: 8px 9px;
  border-bottom: 1px solid #2b3c39;
  color: #b5c5bf;
  font-size: 10px;
  line-height: 1.35;
}

.history-player-row:last-child {
  border-bottom: 0;
}

.history-player-row strong {
  color: #e8f0ec;
  font-size: 11px;
}

.history-player-row > span:nth-child(2),
.history-player-row > span:nth-child(3),
.history-player-row > span:nth-child(5) {
  grid-column: 1 / -1;
}

.history-player-row .is-profit {
  color: #8ce2b1;
  font-weight: 800;
}

.history-player-row .is-loss {
  color: #ee8a7d;
  font-weight: 800;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 13px 16px;
  border-top: 1px solid #31403f;
  color: #a6b7b0;
  font-size: 11px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.active-dot {
  background: var(--gold);
}

.seen-dot {
  background: var(--mint);
}

.out-dot {
  background: #717d7a;
}

@media (max-width: 1120px) {
  .game-layout {
    grid-template-columns: 210px minmax(510px, 1fr);
  }

  .event-panel {
    display: none;
  }
}

@media (max-width: 790px) {
  .topbar {
    min-height: 66px;
    padding: 10px 14px;
  }

  .table-id {
    display: none;
  }

  .game-layout {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .players-panel {
    order: 2;
  }

  .table-zone {
    order: 1;
    grid-template-rows: auto minmax(440px, 1fr) auto;
  }

  .event-panel {
    display: grid;
    order: 3;
    max-height: 275px;
  }

  .player-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-felt {
    min-height: 440px;
    border-width: 8px;
  }

  .seat {
    width: 158px;
  }

  .turn-pointer {
    top: -25px;
  }

  .seat-action {
    top: 35px;
    max-width: 138px;
    font-size: 9px;
  }

  .seat.has-action .card-row {
    margin-top: 22px;
  }

  .seats-layer[data-player-count="7"] .seat,
  .seats-layer[data-player-count="8"] .seat {
    width: 142px;
  }

  .seat-name-block {
    min-width: 40px;
  }

  .seat-chips {
    display: none;
  }

  .playing-card {
    width: 42px;
    height: 61px;
    padding: 5px;
  }

  .playing-card + .playing-card {
    margin-left: -24px;
  }

  .playing-card .rank {
    font-size: 15px;
  }

  .playing-card .suit {
    font-size: 13px;
  }

  .playing-card .suit-large {
    right: 5px;
    bottom: 4px;
    font-size: 22px;
  }

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

@media (max-width: 430px) {
  .brand h1 {
    font-size: 18px;
  }

  .table-felt {
    min-height: 410px;
  }

  .seat-head {
    gap: 4px;
    padding: 4px;
  }

  .seat {
    width: 142px;
  }

  .seats-layer[data-player-count="7"] .seat,
  .seats-layer[data-player-count="8"] .seat {
    width: 126px;
  }

  .avatar {
    width: 25px;
    height: 25px;
  }

  .seat-status {
    font-size: 9px;
  }

  .felt-center {
    width: 96px;
    height: 96px;
  }

  .felt-center strong {
    font-size: 28px;
  }
}

/* Screen navigation and the room-first online flow. */
.brand {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.brand .eyebrow,
.brand-title {
  display: block;
}

.brand-title {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.1;
}

.header-action,
.back-button,
.table-command,
.icon-button {
  border: 1px solid #526968;
  border-radius: 4px;
  background: #1c2b29;
  color: #dceae3;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.header-action {
  min-height: 32px;
  padding: 5px 10px;
}

.screen {
  min-height: calc(100vh - 78px);
}

.mode-select-screen {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(10, 28, 25, 0.86), rgba(10, 28, 25, 0.96)),
    url("./assets/table-felt.svg") center / 260px;
}

.mode-select-content {
  width: min(640px, 100%);
  text-align: center;
}

.mode-select-content h1,
.entry-title h1 {
  margin: 0;
  color: #fff0bb;
  font-family: Georgia, "Microsoft YaHei UI", serif;
  font-size: 34px;
}

.mode-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.mode-button {
  min-height: 128px;
  border: 1px solid #536c65;
  border-radius: 7px;
  color: #eff8f1;
  cursor: pointer;
  font: inherit;
  font-size: 22px;
  font-weight: 800;
}

.solo-mode-button {
  background: #1e5744;
}

.online-mode-button {
  border-color: #a4864c;
  background: #6c4d2a;
  color: #fff1c2;
}

.online-entry-screen {
  display: grid;
  place-items: center;
  padding: 28px 24px;
  background: #11191a;
}

.online-entry-layout {
  width: min(760px, 100%);
}

.entry-title {
  margin-bottom: 18px;
}

.online-entry {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.entry-name-field {
  grid-column: 1 / -1;
}

.entry-section {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  border: 1px solid #354944;
  border-radius: 7px;
  background: #182322;
}

.entry-section h2 {
  color: #f5e6ba;
}

.entry-settings {
  display: grid;
  gap: 8px;
}

.entry-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 1.4fr);
  align-items: center;
  gap: 10px;
  color: #cbd8d2;
  font-size: 13px;
  font-weight: 800;
}

.entry-field input,
.entry-field select,
.setting-field select {
  width: 100%;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid #516966;
  border-radius: 4px;
  background: #14201f;
  color: #f5d68e;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.entry-command {
  width: 100%;
}

.online-entry-layout > .online-message {
  margin-top: 10px;
}

.back-button {
  min-height: 34px;
  margin-top: 14px;
  padding: 5px 14px;
}

.game-layout {
  grid-template-columns: 236px minmax(550px, 1fr);
  max-width: 1120px;
}

.online-room {
  display: grid;
  gap: 8px;
  padding: 14px 16px 12px;
  border-top: 1px solid #31403f;
}

.online-room-settings {
  margin: 0;
  padding: 7px 8px;
  border: 1px solid #3f554f;
  border-radius: 4px;
  background: #14211f;
  color: #e7d291;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
}

.online-member {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
}

.online-member-avatar {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: #79d5ad;
  color: #13211e;
  font-size: 10px;
  font-weight: 800;
}

.online-member.is-offline,
.seat.is-offline,
.player-list-item.is-offline {
  filter: grayscale(1);
  opacity: 0.48;
}

.online-member.is-offline .online-member-state {
  color: #aab5b2;
}

.table-command {
  display: none;
  width: min(220px, 100%);
  min-height: 38px;
  justify-self: center;
  border-color: #b28a48;
  background: #6b4b27;
  color: #fff0ba;
}

.table-command:not([hidden]) {
  display: block;
}

.records-overlay {
  position: fixed;
  z-index: 18;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 12, 11, 0.78);
}

.records-overlay[hidden] {
  display: none;
}

.records-dialog {
  display: grid;
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #536a64;
  border-radius: 7px;
  background: #1b2627;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.54);
}

.records-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #31403f;
}

.records-dialog-head h2 {
  color: #fff0bb;
  font-size: 18px;
}

.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  color: #e6eee9;
  font-size: 22px;
  line-height: 1;
}

.records-dialog .event-log,
.records-dialog .history-view {
  min-height: 0;
}

.records-dialog .legend {
  min-height: 43px;
}

@media (max-width: 1120px) {
  .game-layout {
    grid-template-columns: 210px minmax(510px, 1fr);
    max-width: 100%;
  }
}

@media (max-width: 790px) {
  .screen {
    min-height: calc(100vh - 66px);
  }

  .mode-select-content h1,
  .entry-title h1 {
    font-size: 28px;
  }

  .mode-actions,
  .online-entry {
    grid-template-columns: 1fr;
  }

  .mode-button {
    min-height: 96px;
  }

  .entry-name-field {
    grid-column: auto;
  }

  .game-layout {
    display: flex;
  }

  .online-entry-screen {
    padding: 20px 14px;
  }

  .entry-section {
    padding: 14px;
  }

  .records-dialog {
    max-height: calc(100vh - 24px);
  }
}

@media (max-width: 430px) {
  .mode-select-screen {
    padding: 16px;
  }

  .entry-field {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .table-meta {
    gap: 6px;
  }

  .header-action {
    min-height: 30px;
    padding: 4px 7px;
  }

  .round-bar {
    align-items: flex-start;
    gap: 8px;
  }

  .dealer-copy,
  .turn-copy {
    display: inline-block;
    margin-top: 3px;
  }

  .quick-chat-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 300px);
  }

  .compare-dialog {
    padding: 20px 12px;
  }

  .dealer-draw-dialog {
    padding: 18px 10px;
  }

  .dealer-draw-cards {
    gap: 7px;
  }

  .dealer-draw-player {
    width: 66px;
  }

  .dealer-draw-card {
    width: 54px;
    min-height: 79px;
  }

  .dealer-draw-card .playing-card {
    width: 54px;
    height: 76px;
  }

  .compare-hands {
    gap: 7px;
  }

  .compare-hand {
    padding: 10px 4px 8px;
  }

  .compare-hand .card-row {
    width: 116px;
    height: 72px;
    min-height: 72px;
  }

  .compare-hand .playing-card {
    width: 46px;
    height: 68px;
  }

  .compare-hand .playing-card.card-1 {
    left: 33px;
  }

  .compare-hand .playing-card.card-2 {
    left: 66px;
  }

  .compare-hand .playing-card .rank {
    font-size: 15px;
  }

  .compare-hand .playing-card .suit {
    font-size: 13px;
  }

  .compare-hand .playing-card .suit-large {
    font-size: 22px;
  }
}
