:root {
  color-scheme: dark;
  --bg: #050d0b;
  --surface: #0c1a16;
  --surface-2: #11231d;
  --line: rgba(222, 237, 229, 0.13);
  --text: #f2f7f4;
  --muted: #8ea49a;
  --green: #3bdd9d;
  --green-dark: #0a7b55;
  --gold: #d5b878;
  --red: #f07d79;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -18%, rgba(36, 120, 86, .34), transparent 38%),
    linear-gradient(180deg, #081612 0%, var(--bg) 58%, #030806 100%);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
button:disabled { cursor: not-allowed !important; opacity: .48; transform: none !important; }
[hidden] { display: none !important; }

#header {
  position: relative;
  z-index: 30;
  width: min(1380px, calc(100% - 48px));
  min-height: 76px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand > div { display: flex; align-items: baseline; gap: 10px; }
.brand strong { font-size: 18px; letter-spacing: .025em; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: .06em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(213, 184, 120, .46);
  border-radius: 11px;
  color: var(--gold);
  background: rgba(213, 184, 120, .04);
  font: 700 13px/1 Georgia, serif;
}
.brand-mark.large { width: 43px; height: 43px; border-radius: 13px; font-size: 14px; }
.header-actions, .room-controls { display: flex; align-items: center; gap: 9px; }
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #91a79e;
  font-size: 10px;
  white-space: nowrap;
}
.connection-status i, .lobby-meta i {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: #80948b;
  box-shadow: 0 0 0 3px rgba(128, 148, 139, .1);
}
.connection-status.online { color: #bce7d4; }
.connection-status.online i, .lobby-meta i { background: var(--green); box-shadow: 0 0 10px rgba(59, 221, 157, .65); }
.connection-status.reconnecting i { background: var(--gold); animation: pulse 1s infinite; }
.connection-status.offline i { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

.ghost-button, .room-code {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .035);
  padding: 7px 11px;
  font-size: 10px;
  cursor: pointer;
  transition: .17s ease;
}
.ghost-button:hover, .room-code:hover { border-color: rgba(213, 184, 120, .48); background: rgba(255, 255, 255, .07); transform: translateY(-1px); }
.ghost-button.danger { color: #dba3a0; }
.sound-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.sound-button[aria-pressed="false"] { color: #708179; }
.sound-icon { color: var(--gold); font-size: 13px; font-weight: 900; line-height: 1; }
.sound-button[aria-pressed="false"] .sound-icon { color: #708179; }
.room-code { display: flex; align-items: center; gap: 7px; padding: 5px 10px; }
.room-code small { color: var(--muted); font-size: 8px; }
.room-code b { color: var(--gold); font: 750 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }

#table {
  position: relative;
  width: min(930px, calc(100vw - 380px));
  min-width: 650px;
  aspect-ratio: 1.72 / 1;
  margin: 66px max(310px, calc((100vw - 1220px) / 2 + 300px)) 156px max(78px, calc((100vw - 1380px) / 2 + 64px));
  border: 13px solid #2d261f;
  border-radius: 48%;
  background:
    radial-gradient(ellipse at 50% 39%, rgba(31, 143, 99, .95), rgba(8, 73, 50, .98) 62%, #043422 100%);
  box-shadow:
    inset 0 0 0 2px rgba(213, 184, 120, .34),
    inset 0 0 0 10px rgba(0, 0, 0, .13),
    inset 0 -46px 88px rgba(0, 0, 0, .25),
    0 38px 82px rgba(0, 0, 0, .56);
}
#table::before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(232, 242, 236, .13);
  border-radius: 48%;
  pointer-events: none;
}
.table-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(234, 244, 239, .08);
  font: 700 clamp(18px, 2.4vw, 30px)/1 Georgia, serif;
  letter-spacing: .23em;
  pointer-events: none;
}
.pot-display {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 28%;
  transform: translateX(-50%);
  min-height: 26px;
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(3, 27, 19, .72);
  color: #e3eee9;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
}
.pot-display:empty { visibility: hidden; }
#winningHandLabel {
  position: absolute;
  z-index: 9;
  left: 50%;
  top: 35.5%;
  transform: translateX(-50%);
  min-height: 23px;
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: transparent;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  white-space: nowrap;
  transition: .25s ease;
}
#winningHandLabel:not(:empty) {
  border-color: rgba(239, 201, 113, .7);
  background: rgba(45, 33, 12, .9);
  color: #ffe4a1;
  box-shadow: 0 0 24px rgba(239, 201, 113, .28);
  animation: winner-label-in .48s cubic-bezier(.2, .85, .28, 1.22) both;
}
#communityCards {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  display: flex;
  gap: clamp(5px, .75vw, 9px);
  transform: translate(-50%, -50%);
}
#resultMsg {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 63%;
  transform: translateX(-50%);
  width: min(72%, 560px);
  min-height: 20px;
  color: #f7e6bd;
  font-size: 13px;
  font-weight: 760;
  text-align: center;
  line-height: 1.45;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .65);
}

.card {
  --card-rotate: 0deg;
  position: relative;
  display: inline-flex;
  width: 38px;
  height: 54px;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 6px;
  background: linear-gradient(145deg, #fff, #eceee9);
  color: #171a18;
  box-shadow: 0 5px 12px rgba(0, 0, 0, .42);
  font-family: Georgia, serif;
}
.card.deal-card {
  animation: deal-card .56s cubic-bezier(.18, .76, .22, 1.08) both;
  animation-delay: var(--deal-delay, 0ms);
}
.card.winning-card {
  z-index: 5;
  border: 3px solid #efc971;
  outline: 2px solid rgba(255, 230, 160, .38);
  outline-offset: 2px;
  box-shadow: 0 0 0 1px rgba(55, 37, 7, .65), 0 0 25px rgba(239, 201, 113, .78), 0 8px 18px rgba(0, 0, 0, .48);
}
.card-lg { width: clamp(46px, 4.4vw, 62px); height: clamp(66px, 6.3vw, 88px); padding: 7px; border-radius: 8px; }
.card .rank { font-size: 14px; font-weight: 800; line-height: 1; }
.card .suit { align-self: flex-end; font-size: 18px; line-height: 1; }
.card-lg .rank { font-size: clamp(17px, 1.6vw, 22px); }
.card-lg .suit { font-size: clamp(23px, 2.1vw, 30px); }
.card.red { color: #c83239; }
.card.black { color: #151918; }
.card-empty { border: 1px dashed rgba(255, 255, 255, .16); background: rgba(2, 34, 23, .2); box-shadow: none; }
.card-back {
  overflow: hidden;
  align-items: center;
  justify-content: center;
  border: 2px solid #d9cda9;
  background: repeating-linear-gradient(45deg, #0c2822 0 5px, #1e5143 5px 10px);
  color: rgba(255, 255, 255, .72);
  font: 750 8px/1 Georgia, serif;
}

.seat {
  position: absolute;
  z-index: 6;
  width: 138px;
  transform: translate(-50%, -50%);
  text-align: center;
  transition: opacity .2s, filter .2s;
}
.seat-inner {
  position: relative;
  min-height: 67px;
  padding: 10px 12px 8px;
  border: 1px solid rgba(236, 245, 240, .16);
  border-radius: 13px;
  background: rgba(5, 18, 15, .95);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .38);
}
.name-row {
  display: flex;
  min-height: 18px;
  justify-content: center;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}
.chips { margin-top: 3px; color: var(--gold); font-size: 12px; font-weight: 720; }
.chip-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border: 2px solid var(--gold); border-radius: 50%; }
.status {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hole-cards {
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: calc(100% - 4px);
  display: flex;
  transform: translateX(-50%);
}
.hole-cards .card { --card-rotate: -2deg; margin: 0 -2px; transform: rotate(var(--card-rotate)); }
.hole-cards .card + .card { --card-rotate: 2deg; transform: rotate(var(--card-rotate)); }
.current-hand-type {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: calc(100% - 17px);
  display: flex;
  align-items: center;
  gap: 4px;
  transform: translateX(-50%);
  max-width: 132px;
  padding: 3px 7px;
  border: 1px solid rgba(213, 184, 120, .35);
  border-radius: 999px;
  background: #0b211a;
  box-shadow: 0 5px 14px rgba(0, 0, 0, .34);
  white-space: nowrap;
}
.current-hand-type span { color: #789087; font-size: 6px; font-weight: 750; letter-spacing: .04em; }
.current-hand-type b { overflow: hidden; color: #f0d99f; font-size: 8px; text-overflow: ellipsis; }
.seat.viewer .seat-inner { padding-top: 17px; }
.role-tag, .bot-tag {
  display: inline-grid;
  min-width: 19px;
  height: 17px;
  place-items: center;
  padding: 0 4px;
  border-radius: 5px;
  color: #15140f;
  background: #d9e1dd;
  font-size: 8px;
  font-weight: 900;
}
.role-tag.dealer { background: var(--gold); }
.bot-tag { color: #c5eee0; background: rgba(59, 221, 157, .14); }
.bet-chip {
  position: absolute;
  left: 50%;
  top: calc(100% + 7px);
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 999px;
  background: #e9e0c8;
  color: #132019;
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
  box-shadow: 0 3px 9px rgba(0, 0, 0, .26);
}
.seat.active .seat-inner { border-color: var(--green); box-shadow: 0 0 0 4px rgba(59, 221, 157, .15), 0 10px 24px rgba(0, 0, 0, .4); }
.seat.active .name-row::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.seat.viewer .seat-inner { background: rgba(7, 28, 22, .98); }
.seat.folded { opacity: .4; filter: saturate(.35); }
.seat.winner .seat-inner { border-color: var(--gold); box-shadow: 0 0 32px rgba(213, 184, 120, .38); }
.seat.winner .status { color: #f1d99f; font-weight: 750; }
@keyframes deal-card {
  0% { opacity: 0; transform: translate(var(--deal-x), var(--deal-y)) rotate(calc(var(--card-rotate) - 12deg)) scale(.58); filter: brightness(.7); }
  72% { opacity: 1; transform: translate(-3px, 3px) rotate(calc(var(--card-rotate) + 1deg)) scale(1.04); filter: brightness(1.12); }
  100% { opacity: 1; transform: translate(0, 0) rotate(var(--card-rotate)) scale(1); filter: none; }
}
@keyframes winner-label-in {
  from { opacity: 0; transform: translate(-50%, 8px) scale(.88); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.seat.empty { width: 104px; }
.empty-seat-button {
  width: 92px;
  height: 58px;
  border: 1px dashed rgba(232, 242, 236, .27);
  border-radius: 13px;
  background: rgba(4, 28, 20, .58);
  color: #a9bdb4;
  cursor: pointer;
  transition: .18s ease;
}
.empty-seat-button span { display: block; color: var(--green); font-size: 18px; line-height: 16px; }
.empty-seat-button b { font-size: 9px; font-weight: 680; }
.empty-seat-button:not(:disabled):hover { border-color: var(--green); background: rgba(8, 57, 41, .88); color: white; transform: translateY(-2px); }

#fairness, #roomStats {
  position: fixed;
  z-index: 10;
  right: max(24px, calc((100vw - 1380px) / 2 + 24px));
  width: 278px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(12, 26, 22, .87);
  color: var(--muted);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .2);
  backdrop-filter: blur(14px);
  font-size: 11px;
  line-height: 1.7;
}
#fairness { top: 112px; }
#roomStats { top: 368px; }
.eyebrow { display: block; color: var(--green); font-size: 8px; font-weight: 900; letter-spacing: .18em; }
#fairness strong, #roomStats strong { display: block; margin: 1px 0 8px; color: var(--text); font-size: 15px; }
#fairness p { margin: 0; }
#fairness small, #roomStats small { display: block; margin-top: 11px; color: #71867d; line-height: 1.5; }
.hash-row { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.hash-row span { display: block; color: #71867d; font-size: 8px; }
.hash-row code { display: block; overflow: hidden; margin-top: 2px; color: #b8dfce; font: 9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 12px; }
.stats-grid div { min-width: 0; padding: 9px 7px; border: 1px solid var(--line); border-radius: 10px; background: rgba(5, 18, 14, .62); text-align: center; }
.stats-grid span { display: block; color: #71867d; font-size: 7px; white-space: nowrap; }
.stats-grid b { display: block; overflow: hidden; margin-top: 2px; color: var(--gold); font-size: 14px; line-height: 1.2; text-overflow: ellipsis; }
.rebuy-ledger { margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line); }
.rebuy-ledger > span { display: block; margin-bottom: 5px; color: #71867d; font-size: 8px; font-weight: 800; letter-spacing: .04em; }
#playerRebuyList { max-height: 118px; overflow: auto; padding-right: 2px; scrollbar-width: thin; scrollbar-color: rgba(213, 184, 120, .3) transparent; }
.rebuy-row { display: flex; min-height: 24px; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid rgba(255, 255, 255, .05); font-size: 9px; }
.rebuy-row:last-child { border-bottom: 0; }
.rebuy-row span { overflow: hidden; color: #b9c9c2; text-overflow: ellipsis; white-space: nowrap; }
.rebuy-row b { flex: 0 0 auto; color: var(--gold); font-size: 9px; }
.rebuy-row i { color: var(--green); font-size: 7px; font-style: normal; }
.rebuy-row em { color: #65776f; font-size: 7px; font-style: normal; }
.rebuy-empty { padding: 5px 0 1px; color: #65776f; font-size: 8px; }

#actionBar {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(940px, calc(100% - 32px));
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 17px;
  background: rgba(8, 22, 18, .94);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .52);
  backdrop-filter: blur(18px);
}
#actionBar button {
  min-width: 108px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 10px;
  background: #172b25;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 760;
  cursor: pointer;
  transition: .16s;
}
#actionBar button:hover { transform: translateY(-1px); filter: brightness(1.12); }
#actionBar .action-primary, #startBtn { border-color: var(--green); background: var(--green); color: #04150e; }
#foldBtn { color: #f0aaa7; }
#actionBar .all-in { border-color: rgba(213, 184, 120, .42); color: #ead29f; }
#actionInfo { order: -1; min-width: 125px; padding-right: 8px; color: var(--muted); font-size: 10px; text-align: center; }
#actionInfo:only-child { order: initial; padding: 0; color: #c5d2cc; font-size: 12px; }
.loading-info { display: inline-flex; align-items: center; gap: 9px; }
.loading-info i { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.16); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.raise-group { display: grid; grid-template-columns: 76px minmax(110px, 1fr) 55px; align-items: center; gap: 8px; min-width: 260px; }
.raise-group button { min-width: 76px !important; }
#betSlider { width: 100%; accent-color: var(--green); }
#betAmount { color: var(--gold); font-size: 11px; font-weight: 800; text-align: center; }
.ready-summary { min-width: 310px; display: flex; flex-direction: column; gap: 4px; padding-right: 15px; }
.ready-summary span { color: #dce7e2; font-size: 11px; }
.ready-summary small { color: var(--muted); font-size: 9px; }
.ready-summary.centered { min-width: 0; padding: 0; text-align: center; }
.quiet-actions { display: flex; align-items: center; justify-content: center; gap: 8px; }

.lobby-screen {
  position: fixed;
  z-index: 50;
  inset: 76px 0 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 36%, rgba(14, 96, 67, .32), transparent 34%),
    rgba(3, 10, 8, .86);
  backdrop-filter: blur(12px);
  transition: opacity .2s, visibility .2s;
}
.lobby-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.lobby-card {
  width: min(540px, 100%);
  padding: 31px;
  border: 1px solid rgba(230, 240, 234, .16);
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(17, 37, 30, .98), rgba(8, 22, 18, .98));
  box-shadow: 0 40px 100px rgba(0, 0, 0, .58);
}
.lobby-brand { display: flex; align-items: center; gap: 12px; color: var(--gold); font: 700 11px/1 Georgia, serif; letter-spacing: .16em; }
.lobby-kicker { margin: 20px 0 7px; color: var(--green); font-size: 8px; font-weight: 900; letter-spacing: .2em; }
.lobby-card h1 { margin: 0; font-size: 28px; letter-spacing: -.025em; }
.lobby-copy { max-width: 460px; margin: 8px 0 17px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.field-label { display: block; margin-bottom: 7px; color: #c7d5ce; font-size: 10px; font-weight: 680; }
.lobby-input, .form-row input, .form-grid input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #071410;
  color: var(--text);
  padding: 12px 13px;
  transition: .16s;
}
.lobby-input:focus, .form-row input:focus, .form-grid input:focus { border-color: rgba(59, 221, 157, .6); }
.create-options {
  margin-top: 13px;
  padding: 14px;
  border: 1px solid rgba(213, 184, 120, .2);
  border-radius: 13px;
  background: rgba(3, 15, 12, .42);
}
.create-options-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.create-options-heading > div { display: flex; align-items: baseline; gap: 7px; }
.create-options-heading b { color: #e8eee9; font-size: 11px; }
.create-options-heading small, .create-options-heading > span { color: #71877e; font-size: 8px; }
.create-options-heading > span { color: var(--gold); font-weight: 760; }
.create-options-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.create-options-grid label > span { display: block; margin-bottom: 5px; color: #9aafa6; font-size: 8px; }
.create-options-grid input {
  width: 100%;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #071410;
  color: var(--text);
  font-size: 11px;
}
.create-options-grid input:focus { border-color: rgba(59, 221, 157, .6); }
.create-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.compact-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.compact-toggle > span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.compact-toggle b { font-size: 9px; }
.compact-toggle small { color: var(--muted); font-size: 7px; }
.compact-toggle input { position: absolute; opacity: 0; }
.compact-toggle i { position: relative; width: 31px; height: 18px; flex: 0 0 auto; border-radius: 999px; background: #2a3a34; transition: .2s; }
.compact-toggle i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #b4c0bb; transition: .2s; }
.compact-toggle input:checked + i { background: var(--green-dark); }
.compact-toggle input:checked + i::after { left: 16px; background: white; }
.create-options-hint { display: block; margin-top: 8px; color: #647970; font-size: 7px; }
.primary-button, .secondary-button {
  width: 100%;
  min-height: 45px;
  margin-top: 10px;
  border: 1px solid var(--green);
  border-radius: 10px;
  background: var(--green);
  color: #04150e;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.secondary-button { width: auto; min-width: 112px; margin: 0; border-color: rgba(213, 184, 120, .5); background: #182c25; color: #edd9ac; }
.or { display: flex; align-items: center; gap: 12px; margin: 20px 0 13px; color: #6f837a; font-size: 8px; }
.or::before, .or::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.room-input { text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 750; letter-spacing: .16em; }
.lobby-screen.invite-mode .lobby-card { width: min(450px, 100%); }
.lobby-screen.invite-mode .create-options,
.lobby-screen.invite-mode #createRoomBtn,
.lobby-screen.invite-mode .or { display: none; }
.lobby-screen.invite-mode .join-row { display: block; margin-top: 14px; }
.lobby-screen.invite-mode #joinRoomCode { display: none; }
.lobby-screen.invite-mode #joinRoomBtn {
  width: 100%;
  min-height: 45px;
  border-color: var(--green);
  background: var(--green);
  color: #04150e;
}
.form-error { min-height: 18px; margin-top: 9px; color: var(--red); font-size: 10px; }
.lobby-meta { display: flex; justify-content: space-between; gap: 15px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: #6f837a; font-size: 8px; }
.lobby-meta span { display: inline-flex; align-items: center; gap: 6px; }

#settingsModal {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(1, 8, 6, .78);
  backdrop-filter: blur(8px);
}
#settingsModal.show { display: grid; }
#settingsContent {
  width: min(460px, 100%);
  padding: 25px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 19px;
  background: #10221d;
  box-shadow: 0 34px 85px rgba(0, 0, 0, .65);
}
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.modal-heading p { margin: 0 0 2px; color: var(--green); font-size: 8px; font-weight: 900; letter-spacing: .18em; }
.modal-heading h2 { margin: 0; font-size: 21px; }
#settingsClose { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.reference { margin: 7px 0 20px; color: var(--muted); font-size: 10px; }
.form-row { display: grid; grid-template-columns: 108px 1fr; gap: 14px; align-items: start; margin-top: 13px; }
.form-row > label { padding-top: 11px; color: #c6d3cd; font-size: 11px; font-weight: 650; }
.form-row input, .form-grid input { padding: 10px 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 13px; }
.form-grid label { display: block; margin-bottom: 6px; color: #c6d3cd; font-size: 10px; }
.hint { margin-top: 5px; color: #6f847b; font-size: 8px; }
.toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 17px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(3, 15, 12, .32);
  cursor: pointer;
}
.toggle-row span { display: flex; flex-direction: column; gap: 3px; }
.toggle-row b { font-size: 11px; }
.toggle-row small { color: var(--muted); font-size: 8px; }
.toggle-row input { position: absolute; opacity: 0; }
.toggle-row i { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #2a3a34; transition: .2s; }
.toggle-row i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #b4c0bb; transition: .2s; }
.toggle-row input:checked + i { background: var(--green-dark); }
.toggle-row input:checked + i::after { left: 19px; background: white; }
.modal-buttons { display: grid; grid-template-columns: 1fr 1.35fr; gap: 9px; margin-top: 8px; }
.modal-buttons button { border: 1px solid var(--line); border-radius: 10px; background: #192b26; padding: 11px; cursor: pointer; font-size: 10px; font-weight: 700; }
#settingsSave { border-color: var(--green); background: var(--green); color: #04150e; }

#toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  top: 94px;
  transform: translate(-50%, -12px);
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 15px;
  border: 1px solid rgba(59, 221, 157, .3);
  border-radius: 10px;
  background: #10251d;
  color: #d9eee4;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
  font-size: 10px;
  opacity: 0;
  visibility: hidden;
  transition: .2s;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
#toast.error { border-color: rgba(240, 125, 121, .4); color: #f2b5b2; }

@media (max-width: 1120px) {
  #table { width: min(900px, calc(100vw - 80px)); min-width: 0; margin: 58px auto 156px; }
  #fairness, #roomStats { position: relative; inset: auto; width: min(760px, calc(100% - 40px)); }
  #fairness { margin: -105px auto 14px; }
  #roomStats { margin: 0 auto 132px; }
}

@media (max-width: 760px) {
  #header { width: calc(100% - 22px); min-height: 64px; gap: 8px; }
  .brand { gap: 7px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand > div { display: block; }
  .brand strong { display: block; font-size: 14px; }
  .brand small, .connection-status { display: none; }
  .room-controls { gap: 5px; }
  .ghost-button { padding: 6px 8px; font-size: 9px; }
  .sound-label { display: none; }
  .sound-button { width: 30px; padding: 6px; }
  .room-code { padding: 5px 7px; }
  .room-code small { display: none; }
  .room-code b { font-size: 10px; }
  #table { width: calc(100vw - 18px); height: 475px; aspect-ratio: auto; margin: 54px auto 150px; border-width: 9px; border-radius: 39%; }
  #table::before { inset: 6%; border-radius: 39%; }
  .table-label { font-size: 15px; }
  .seat { width: 102px; }
  .seat-inner { min-height: 52px; padding: 7px; border-radius: 10px; }
  .name-row { font-size: 9px; }
  .chips { font-size: 9px; }
  .status { font-size: 7px; }
  .role-tag, .bot-tag { min-width: 15px; height: 14px; padding: 0 3px; font-size: 6px; }
  .seat.empty { width: 77px; }
  .empty-seat-button { width: 72px; height: 48px; border-radius: 10px; }
  .empty-seat-button span { font-size: 14px; }
  .empty-seat-button b { font-size: 7px; }
  .hole-cards .card { width: 28px; height: 40px; }
  .current-hand-type { bottom: calc(100% - 14px); max-width: 92px; padding: 2px 6px; }
  .current-hand-type span { display: none; }
  .current-hand-type b { font-size: 7px; }
  .seat.viewer .seat-inner { padding-top: 13px; }
  .card-lg { width: 40px; height: 58px; padding: 5px; }
  .card-lg .rank { font-size: 15px; }
  .card-lg .suit { font-size: 20px; }
  #communityCards { gap: 4px; }
  .pot-display { top: 31%; }
  #winningHandLabel { top: 37%; font-size: 8px; }
  #resultMsg { top: 63%; width: 80%; font-size: 10px; }
  #fairness, #roomStats { width: calc(100% - 24px); }
  #fairness { margin: -108px auto 12px; }
  #roomStats { margin: 0 auto 168px; }
  #actionBar { bottom: 8px; width: calc(100% - 16px); min-height: 134px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px; }
  #actionBar button { min-width: 0; min-height: 41px; padding: 6px 3px; font-size: 9px; }
  #actionInfo { grid-column: 1 / -1; order: -1; min-width: 0; padding: 0; }
  .raise-group { grid-column: 1 / -1; grid-template-columns: 68px 1fr 46px; min-width: 0; }
  .raise-group button { min-width: 0 !important; }
  .ready-summary { grid-column: 1 / -1; min-width: 0; padding: 0; text-align: center; }
  .quiet-actions { grid-column: 1 / -1; width: 100%; }
  .quiet-actions button { width: min(180px, 100%); }
  .lobby-screen { inset: 64px 0 0; padding: 12px; overflow-y: auto; }
  .lobby-card { padding: 24px 20px; border-radius: 18px; }
  .lobby-kicker { margin-top: 22px; }
  .lobby-card h1 { font-size: 24px; }
  .lobby-meta { flex-direction: column; gap: 7px; }
  .create-options-heading { align-items: flex-start; }
  .create-options-heading > div { flex-direction: column; gap: 2px; }
  .create-options-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 94px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .card.deal-card, #winningHandLabel:not(:empty) { animation: none; }
}

@media (max-width: 430px) {
  .ghost-button#standBtn, .ghost-button#settingsBtn { padding: 6px; }
  .ghost-button.danger { display: none; }
  #table { height: 450px; }
  .seat { width: 92px; }
  .seat.empty { width: 70px; }
  .empty-seat-button { width: 65px; }
  .card-lg { width: 37px; height: 54px; }
  .join-row { grid-template-columns: 1fr 96px; }
  .secondary-button { min-width: 0; }
}
