/* ================= 字体 ================= */
@font-face {
  font-family: 'Cinzel';
  font-weight: 700;
  src: url('/fonts/cinzel/cinzel-latin-700-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Cinzel';
  font-weight: 900;
  src: url('/fonts/cinzel/cinzel-latin-900-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Oswald';
  font-weight: 500;
  src: url('/fonts/oswald/oswald-latin-500-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Oswald';
  font-weight: 600;
  src: url('/fonts/oswald/oswald-latin-600-normal.woff2') format('woff2');
  font-display: swap;
}

:root {
  --bg: #090d13;
  --panel: rgba(17, 23, 32, 0.82);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #e9eef5;
  --muted: #8d9aab;
  --gold: #f0c96a;
  --gold-2: #b98a2e;
  --red: #e5484d;
  --green: #2fb36b;
  --blue: #3b82f6;
  --num: 'Oswald', 'DIN Alternate', 'Helvetica Neue', sans-serif;
  --title: 'Cinzel', 'Times New Roman', serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  font-size: 14px;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

input,
select,
textarea {
  user-select: text;
  -webkit-user-select: text;
  font: inherit;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.screen {
  position: fixed;
  inset: 0;
}

/* ================= 按钮 ================= */
.btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, #2a3442, #1b222c);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: transform 0.08s, filter 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.btn:hover {
  filter: brightness(1.15);
}
.btn:active {
  transform: translateY(1px) scale(0.98);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}
.btn.gold {
  background: linear-gradient(180deg, #ffe08a, #e0a93a 55%, #b8801f);
  color: #2b1a00;
  border-color: #ffe6a3;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  box-shadow: 0 3px 0 #7a5410, 0 6px 18px rgba(240, 180, 60, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}
.btn.danger {
  background: linear-gradient(180deg, #e5484d, #a82227);
  border-color: #ff7b7f;
}
.btn.small {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}
.btn.big {
  padding: 14px 30px;
  font-size: 20px;
  border-radius: 14px;
}

.icon-btn {
  white-space: nowrap;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.chip-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  vertical-align: -3px;
  margin-right: 6px;
  background: radial-gradient(circle, #e3b62b 0 40%, #fff 41% 46%, transparent 47%), repeating-conic-gradient(#e3b62b 0 22.5deg, #fff 22.5deg 45deg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

/* ================= 大厅 ================= */
#lobby {
  overflow-y: auto;
  padding: 0 20px 40px;
}
.lobby-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at 50% -10%, rgba(240, 201, 106, 0.18), transparent 55%), radial-gradient(ellipse at 10% 110%, rgba(30, 140, 85, 0.25), transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(150, 30, 50, 0.22), transparent 50%), #0a0f15;
}
.lobby-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Ctext x='10' y='40' font-size='28' fill='white'%3E%E2%99%A0%3C/text%3E%3Ctext x='70' y='40' font-size='28' fill='white'%3E%E2%99%A5%3C/text%3E%3Ctext x='10' y='100' font-size='28' fill='white'%3E%E2%99%A6%3C/text%3E%3Ctext x='70' y='100' font-size='28' fill='white'%3E%E2%99%A3%3C/text%3E%3C/svg%3E");
}
.lobby-header {
  text-align: center;
  padding: 36px 0 22px;
}
.logo h1 {
  margin: 4px 0;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(36px, 6vw, 68px);
  letter-spacing: 6px;
  background: linear-gradient(180deg, #fff6d5 0%, #f0c96a 45%, #a8741c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(240, 190, 80, 0.35));
}
.logo p {
  margin: 0;
  color: var(--muted);
  letter-spacing: 4px;
}
.logo-suits {
  font-size: 22px;
  letter-spacing: 10px;
  color: #ddd;
}
.logo-suits i {
  font-style: normal;
  color: #e5484d;
}

.lobby-main {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 18px;
  max-width: 1320px;
  margin: 0 auto;
}
@media (max-width: 1100px) {
  .lobby-main {
    grid-template-columns: 1fr;
  }
}
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--gold);
}
.panel h2.mt {
  margin-top: 24px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.panel-head h2 {
  margin: 0;
}
.head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.small-input {
  width: 80px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
}
.hint {
  color: var(--muted);
  font-size: 12px;
}

.profile-row {
  display: flex;
  gap: 14px;
  align-items: center;
}
.avatar-btn {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  padding: 0;
  overflow: hidden;
  background: #233;
  flex-shrink: 0;
}
.avatar-btn img {
  width: 100%;
  height: 100%;
}
.avatar-btn span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.6);
  padding: 2px;
}
.profile-fields {
  flex: 1;
}
.profile-fields label {
  font-size: 12px;
  color: var(--muted);
}
.profile-fields input,
.field input:not([type='checkbox']):not([type='range']),
.field select {
  width: 100%;
  padding: 9px 12px;
  margin-top: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  outline: none;
}
.profile-fields input:focus,
.field input:focus,
.field select:focus {
  border-color: var(--gold);
}

.wallet-card {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(240, 201, 106, 0.16), rgba(240, 201, 106, 0.03));
  border: 1px solid rgba(240, 201, 106, 0.3);
}
.wallet-label {
  font-size: 12px;
  color: var(--muted);
}
.wallet-balance {
  font-family: var(--num);
  font-size: 32px;
  color: var(--gold);
  margin: 4px 0 10px;
}
.wallet-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.wallet-stats div {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 6px 10px;
}
.wallet-stats span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.wallet-stats b {
  font-family: var(--num);
  font-size: 16px;
}
.pos {
  color: #4ade80;
}
.neg {
  color: #f87171;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}
.room-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(23, 102, 63, 0.35), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: transform 0.15s, border-color 0.15s;
}
.room-card:hover {
  transform: translateY(-2px);
  border-color: rgba(240, 201, 106, 0.4);
}
.rc-main {
  flex: 1;
  min-width: 0;
}
.rc-name {
  font-size: 16px;
  font-weight: 700;
}
.rc-id {
  margin-left: 8px;
  font-family: var(--num);
  color: var(--gold);
  font-weight: 500;
}
.rc-meta {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 8px;
}
.rc-seats {
  display: flex;
  gap: 4px;
}
.rc-seats i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}
.rc-seats i.p {
  background: var(--gold);
}
.rc-seats i.b {
  background: #58a6ff;
}
.empty-rooms {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}
.big-suit {
  font-size: 64px;
  opacity: 0.3;
}

.lan-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.qr {
  width: 150px;
  height: 150px;
  background: #fff;
  border-radius: 12px;
  padding: 6px;
}
.qr.big {
  width: 220px;
  height: 220px;
}
.lan-url {
  font-family: var(--num);
  font-size: 15px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  word-break: break-all;
  user-select: text;
}
.leaderboard {
  list-style: none;
  padding: 0;
  margin: 0;
}
.leaderboard li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.leaderboard .rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-family: var(--num);
  background: rgba(255, 255, 255, 0.08);
}
.leaderboard .r1 {
  background: linear-gradient(#ffe08a, #c99325);
  color: #3a2600;
}
.leaderboard .r2 {
  background: linear-gradient(#f1f5f9, #94a3b8);
  color: #1e293b;
}
.leaderboard .r3 {
  background: linear-gradient(#f6b98a, #a0582a);
  color: #2a1200;
}
.lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leaderboard b {
  font-family: var(--num);
  color: var(--gold);
}

/* ================= 牌桌场景 ================= */
#game {
  background: radial-gradient(ellipse 70% 55% at 50% 42%, #1d2a38 0%, #0d131b 60%, #06080c 100%);
}
#game::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 6px 6px;
  pointer-events: none;
}
#viewport {
  position: absolute;
  top: 46px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}
#stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}
.room-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 45% 40% at 50% 44%, rgba(255, 236, 190, 0.12), transparent 70%);
  pointer-events: none;
}

#table {
  position: absolute;
}
[data-layout='landscape'] #table {
  left: 210px;
  top: 125px;
  width: 1180px;
  height: 560px;
  --r: 280px;
}
.rail {
  position: absolute;
  inset: 0;
  border-radius: var(--r);
  background: radial-gradient(ellipse at 50% 18%, #6a4026 0%, #3b2213 40%, #1d0f07 100%);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.75), 0 0 0 2px #0a0503, inset 0 3px 2px rgba(255, 220, 180, 0.25), inset 0 -10px 24px rgba(0, 0, 0, 0.65);
}
.rail::before {
  /* 皮革缝线 */
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: calc(var(--r) - 12px);
  border: 2px dashed rgba(255, 220, 170, 0.18);
}
.rail::after {
  /* 金色饰边 */
  content: '';
  position: absolute;
  inset: 26px;
  border-radius: calc(var(--r) - 26px);
  box-shadow: 0 0 0 3px #c9a04a, 0 0 0 4px #5b3f12, 0 0 12px 4px rgba(0, 0, 0, 0.6);
}
.felt {
  position: absolute;
  inset: 29px;
  border-radius: calc(var(--r) - 29px);
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 42%, #22955c 0%, #177245 40%, #0e5232 75%, #093a23 100%);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.6), inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}
.felt::before {
  /* 绒布纹理 */
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.felt::after {
  /* 顶灯高光 */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 45% at 50% 35%, rgba(255, 255, 230, 0.12), transparent 70%);
}
.felt-line {
  position: absolute;
  inset: 70px;
  border-radius: calc(var(--r) - 99px);
  border: 2px solid rgba(255, 255, 255, 0.09);
}
.felt-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgba(255, 255, 255, 0.075);
  font-family: var(--title);
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
}
[data-layout='landscape'] .felt-logo {
  top: 64%;
}
.felt-logo span {
  display: block;
  font-size: 58px;
  letter-spacing: 10px;
}
.felt-logo small {
  font-size: 16px;
  letter-spacing: 6px;
}
/* ================= 扑克牌 ================= */
.card {
  --cw: 54px;
  --ch: 76px;
  position: relative;
  width: var(--cw);
  height: var(--ch);
  perspective: 700px;
  flex-shrink: 0;
}
.card.empty {
  visibility: hidden;
}
.card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.3, 0.7, 0.3, 1.1);
}
.card.back .card-inner {
  transform: rotateY(180deg);
}
.card-face {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--cw) * 0.09);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.card-front {
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.card-front.classic {
  background: #fff center / 100% 100% no-repeat;
}
.card-front.modern {
  background: linear-gradient(160deg, #ffffff, #eef0f3);
  color: #111;
}
.card-front.modern .m-rank {
  position: absolute;
  left: 7%;
  top: 2%;
  font-family: var(--num);
  font-weight: 600;
  font-size: calc(var(--cw) * 0.46);
  line-height: 1;
  letter-spacing: -1px;
}
.card-front.modern .m-suit {
  position: absolute;
  left: 9%;
  top: 44%;
  font-size: calc(var(--cw) * 0.3);
  line-height: 1;
}
.card-front.modern .m-pip {
  position: absolute;
  right: 5%;
  bottom: 0;
  font-size: calc(var(--cw) * 0.62);
  line-height: 1;
  opacity: 0.9;
}
.card-front.suit-1,
.card-front.suit-2 {
  color: #d3122f;
}
.card-front.modern.four.suit-2 {
  color: #1463c8;
}
.card-front.modern.four.suit-3 {
  color: #13843a;
}
.card-back {
  transform: rotateY(180deg);
  background: radial-gradient(circle at 50% 50%, rgba(255, 215, 130, 0.35) 0 14%, transparent 15%), repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.1) 0 2px, transparent 2px 7px), linear-gradient(135deg, #a4142b, #5c0716);
  box-shadow: inset 0 0 0 calc(var(--cw) * 0.06) #fdf8ee, inset 0 0 0 calc(var(--cw) * 0.085) #c9a04a, 0 3px 8px rgba(0, 0, 0, 0.5);
}
.card-back::after {
  content: '♠';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  color: rgba(255, 230, 170, 0.85);
  font-size: calc(var(--cw) * 0.32);
}
.card.best {
  z-index: 3;
}
.card.best .card-inner {
  transform: translateY(-10%);
}
.card.best .card-front {
  box-shadow: 0 0 0 3px #ffd54a, 0 0 22px rgba(255, 213, 74, 0.85);
}
.card.dim .card-front {
  filter: brightness(0.45) saturate(0.6);
}
.card.flying {
  --cw: 70px;
  --ch: 100px;
  position: absolute;
  pointer-events: none;
}

/* 公共牌 */
#board {
  position: absolute;
  display: flex;
  gap: 10px;
  z-index: 2;
}
[data-layout='landscape'] #board {
  left: 570px;
  top: 345px;
}
#board .card {
  --cw: 84px;
  --ch: 120px;
}
#board .card.dealt {
  animation: boardIn 0.32s cubic-bezier(0.2, 0.8, 0.3, 1.1) var(--d, 0ms) backwards;
}
@keyframes boardIn {
  from {
    transform: translateY(-80px) scale(0.7) rotate(-8deg);
    opacity: 0;
  }
}

/* ================= 底池 ================= */
#potArea {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 3;
  pointer-events: none;
}
.pot-label {
  font-family: var(--num);
  font-size: 22px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 3px 16px;
  border-radius: 20px;
  border: 1px solid rgba(240, 201, 106, 0.35);
  text-shadow: 0 1px 2px #000;
}
.pot-label small {
  font-family: inherit;
  font-size: 14px;
  color: var(--gold);
  margin-right: 4px;
}
.side-pots {
  display: flex;
  gap: 6px;
}
.side-pots span {
  font-family: var(--num);
  font-size: 13px;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px 8px;
  border-radius: 10px;
  color: #ddd;
}
.pot-chips .chip-stack {
  justify-content: center;
}

/* ================= 筹码 ================= */
.chip-stack {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.chip-col {
  position: relative;
  width: 26px;
  height: 30px;
}
.chip {
  --c: #ddd;
  --s: #fff;
  position: absolute;
  left: 0;
  bottom: calc(var(--i, 0) * 4px);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--c) 0 38%, var(--s) 39% 44%, var(--c) 45% 62%, transparent 63%), repeating-conic-gradient(var(--c) 0 22.5deg, var(--s) 22.5deg 45deg);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.chip.c-1 {
  --c: #e9ecef;
  --s: #3b82f6;
}
.chip.c-5 {
  --c: #d63a3a;
}
.chip.c-25 {
  --c: #23934a;
}
.chip.c-100 {
  --c: #1f2329;
  --s: #e9ecef;
}
.chip.c-500 {
  --c: #7b3fbf;
}
.chip.c-1k {
  --c: #e3b62b;
  --s: #1f2329;
}
.chip.c-5k {
  --c: #ff7a1a;
}
.chip.c-25k {
  --c: #10a5b5;
}
.chip.c-100k {
  --c: #e8458b;
}
.chip.c-1m {
  --c: #f2d27a;
  --s: #7a4b00;
}
.chip.flying-chip {
  position: absolute;
  bottom: auto;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 50;
}

.bet {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 4;
  pointer-events: none;
}
.bet.pop {
  animation: betPop 0.35s 0.2s cubic-bezier(0.3, 1.6, 0.5, 1) backwards;
}
@keyframes betPop {
  from {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
  }
}
.bet-amount {
  font-family: var(--num);
  font-size: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1px 9px;
  border-radius: 12px;
  color: #fff;
}

/* ================= 庄家按钮 ================= */
.dealer-btn {
  position: absolute;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--title);
  font-weight: 900;
  font-size: 20px;
  color: #1a1a1a;
  background: radial-gradient(circle at 35% 30%, #ffffff, #e3e3e3 55%, #b9b9b9);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.15), 0 0 0 2px #1a1a1a, 0 0 0 4px #f0c96a;
  z-index: 5;
}

/* ================= 座位 ================= */
.seat {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 6;
}
.pod {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  width: 196px;
  height: 66px;
  display: flex;
  align-items: center;
  border-radius: 36px;
  background: linear-gradient(180deg, rgba(36, 45, 58, 0.97), rgba(14, 19, 26, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  z-index: 2;
  cursor: pointer;
  transition: box-shadow 0.25s, border-color 0.25s, opacity 0.3s, filter 0.3s;
}
.avatar-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  margin-left: -8px;
  flex-shrink: 0;
}
.avatar {
  position: absolute;
  inset: 5px;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #2b3644;
  border: 2px solid rgba(255, 255, 255, 0.25);
}
.timer {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
  pointer-events: none;
  z-index: 2;
}
.timer circle {
  fill: none;
  stroke-width: 7;
}
.timer-bg {
  stroke: transparent;
}
.timer-fg {
  stroke: transparent;
  stroke-linecap: round;
}
.seat.to-act .timer-bg {
  stroke: rgba(0, 0, 0, 0.5);
}
.pod-info {
  flex: 1;
  min-width: 0;
  padding: 0 14px 0 8px;
  text-align: center;
}
.pod-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dfe6ee;
}
.pod-stack {
  font-family: var(--num);
  font-size: 20px;
  color: var(--gold);
  line-height: 1.2;
}
.seat.all-in .pod-stack {
  color: #ff6b6b;
  letter-spacing: 1px;
}

.seat.to-act .pod {
  border-color: rgba(255, 213, 74, 0.9);
  box-shadow: 0 0 0 2px rgba(255, 213, 74, 0.45), 0 0 28px rgba(255, 213, 74, 0.45), 0 10px 24px rgba(0, 0, 0, 0.55);
}
.seat.urgent .pod {
  animation: urgent 0.5s ease-in-out infinite alternate;
}
@keyframes urgent {
  to {
    box-shadow: 0 0 0 3px rgba(255, 80, 80, 0.7), 0 0 30px rgba(255, 60, 60, 0.6);
  }
}
.seat.folded .pod {
  opacity: 0.5;
  filter: grayscale(0.7);
}
.seat.folded.me .seat-cards {
  opacity: 0.4;
  filter: grayscale(0.6);
}
.seat.sitting-out .pod {
  opacity: 0.45;
}
.seat.winner .pod {
  border-color: #ffd54a;
  animation: winnerGlow 0.9s ease-in-out infinite alternate;
}
@keyframes winnerGlow {
  from {
    box-shadow: 0 0 0 2px rgba(255, 213, 74, 0.6), 0 0 18px rgba(255, 213, 74, 0.4);
  }
  to {
    box-shadow: 0 0 0 4px rgba(255, 213, 74, 0.9), 0 0 46px rgba(255, 213, 74, 0.8);
  }
}

/* 思考中 */
.think {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  display: none;
  gap: 3px;
  background: rgba(0, 0, 0, 0.75);
  padding: 3px 6px;
  border-radius: 8px;
  z-index: 3;
}
.seat.bot-thinking .think {
  display: flex;
}
.think i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  animation: think 1s infinite;
}
.think i:nth-child(2) {
  animation-delay: 0.15s;
}
.think i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes think {
  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* 手牌 */
.seat-cards {
  position: absolute;
  left: 0;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  z-index: 1;
}
.seat-cards .card:first-child {
  transform: rotate(-7deg) translateX(8px);
}
.seat-cards .card:last-child {
  transform: rotate(7deg) translateX(-8px);
}
.seat.cards-below .seat-cards {
  bottom: auto;
  top: 18px;
}
.seat.me .seat-cards {
  bottom: 22px;
}
.seat.me .seat-cards .card {
  --cw: 92px;
  --ch: 130px;
}
.seat.me .seat-cards .card:first-child {
  transform: rotate(-5deg) translateX(6px);
}
.seat.me .seat-cards .card:last-child {
  transform: rotate(5deg) translateX(-6px);
}
/* 亮牌：牌移出座位卡并置于最上层，不被名字和筹码遮挡 */
.seat.revealed .seat-cards {
  z-index: 4;
  bottom: 33px;
}
.seat.revealed.cards-below .seat-cards {
  top: 33px;
  bottom: auto;
}

/* 徽标 */
.action-badge,
.hand-badge {
  position: absolute;
  left: 0;
  top: 40px;
  transform: translateX(-50%);
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  z-index: 3;
  pointer-events: none;
  background: #334155;
  color: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}
.seat.cards-below .action-badge,
.seat.cards-below .hand-badge {
  top: auto;
  bottom: 40px;
}
.action-badge.show,
.hand-badge.show {
  opacity: 1;
}
.action-badge.pop {
  animation: badgePop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}
@keyframes badgePop {
  from {
    transform: translateX(-50%) scale(0.5);
  }
}
.a-fold {
  background: #4b5563;
  color: #cbd5e1;
}
.a-check {
  background: #2563eb;
}
.a-call {
  background: #16a34a;
}
.a-bet,
.a-raise {
  background: linear-gradient(#f59e0b, #d97706);
  color: #231400;
}
.a-allin {
  background: linear-gradient(#ef4444, #b91c1c);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.7);
}
.a-sb,
.a-bb {
  background: #475569;
}
.hand-badge {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.hand-badge.win {
  background: linear-gradient(#ffe08a, #d39b2a);
  color: #2b1a00;
  border-color: #fff1c1;
}

.win-amount {
  position: absolute;
  left: 0;
  top: -132px;
  transform: translateX(-50%);
  font-family: var(--num);
  font-size: 30px;
  font-weight: 600;
  color: #ffe08a;
  text-shadow: 0 2px 6px #000, 0 0 18px rgba(255, 200, 60, 0.8);
  opacity: 0;
  pointer-events: none;
  z-index: 8;
  white-space: nowrap;
}
.seat.me .win-amount {
  top: -196px;
}
.seat.cards-below .win-amount {
  top: -80px;
}
.win-amount.show {
  animation: winUp 2.6s ease-out forwards;
}
@keyframes winUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.6);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.15);
  }
  25% {
    transform: translate(-50%, 0) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -30px);
  }
}

.seat-tags {
  position: absolute;
  left: 0;
  top: -46px;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  z-index: 3;
  pointer-events: none;
  white-space: nowrap;
}
.seat.has-cards .seat-tags {
  top: 28px;
  left: 70px;
  transform: none;
}
.seat.cards-below .seat-tags {
  top: -48px;
}
.seat.cards-below.has-cards .seat-tags {
  top: -44px;
  left: 60px;
}
.tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.tag.host {
  color: var(--gold);
  border-color: rgba(240, 201, 106, 0.5);
}
.tag.bot {
  color: #93c5fd;
}
.tag.warn {
  color: #fca5a5;
}
.tag.add {
  color: #86efac;
}

.chat-bubble {
  position: absolute;
  left: 0;
  bottom: 120px;
  transform: translateX(-50%) scale(0.6);
  max-width: 220px;
  padding: 7px 12px;
  border-radius: 14px;
  background: #fff;
  color: #111;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  z-index: 9;
  transition: opacity 0.2s, transform 0.2s;
  width: max-content;
}
.chat-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  margin-left: -6px;
  border: 6px solid transparent;
  border-bottom: 0;
  border-top-color: #fff;
}
.seat.cards-below .chat-bubble {
  bottom: auto;
  top: 120px;
}
.seat.cards-below .chat-bubble::after {
  bottom: auto;
  top: -6px;
  border-top: 0;
  border-bottom: 6px solid #fff;
}
.chat-bubble.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* 空座位 */
.empty-actions {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.seat.empty .empty-actions {
  display: flex;
}
.seat.empty .pod,
.seat.empty .seat-cards,
.seat.empty .seat-tags,
.seat.empty .action-badge,
.seat.empty .hand-badge {
  display: none;
}
.sit-btn {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.45);
  color: #e5e7eb;
  font-size: 15px;
  font-weight: 700;
  transition: all 0.2s;
}
.sit-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(240, 201, 106, 0.12);
}
.bot-btn {
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid rgba(147, 197, 253, 0.4);
  background: rgba(30, 58, 138, 0.5);
  color: #bfdbfe;
  font-size: 12px;
}

/* 特效层 */
#fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}
#fx > * {
  position: absolute;
}
.confetti {
  width: 9px;
  height: 15px;
  border-radius: 2px;
}
.table-message {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 22px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.55);
  color: #e2e8f0;
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 3;
  white-space: nowrap;
}
[data-layout='landscape'] .table-message {
  top: 380px;
}
.table-message.show {
  opacity: 1;
}
.table-flash {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  font-family: var(--title);
  font-weight: 900;
  font-size: 64px;
  letter-spacing: 4px;
  white-space: nowrap;
  color: #fff;
  pointer-events: none;
  z-index: 60;
  animation: flash 2.4s ease-out forwards;
}
.table-flash.allin {
  color: #ff4d4d;
  text-shadow: 0 0 30px rgba(255, 60, 60, 0.9), 0 4px 0 #5a0000;
}
.table-flash.level {
  color: var(--gold);
  font-size: 48px;
  text-shadow: 0 0 30px rgba(255, 200, 60, 0.8), 0 3px 0 #4a3000;
}
@keyframes flash {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.2);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.95);
  }
}

/* ================= 操作面板 ================= */
.action-panel {
  position: absolute;
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 30;
}
[data-layout='landscape'] .action-panel {
  right: 16px;
  bottom: 14px;
  width: 560px;
}
.action-panel.show {
  display: flex;
}
.action-panel.compact {
  align-items: flex-end;
}
.action-panel.center {
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  width: auto !important;
  transform: translateX(-50%);
}
[data-layout='landscape'] .action-panel.center {
  top: 440px;
}
.host-start {
  display: flex;
  gap: 14px;
}
.ap-buttons {
  display: flex;
  gap: 10px;
}
.btn.act {
  flex: 1;
  height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 16px;
  font-size: 22px;
  border-width: 1px;
}
.btn.act b {
  font-weight: 800;
  letter-spacing: 2px;
}
.btn.act small {
  font-family: var(--num);
  font-size: 16px;
  opacity: 0.85;
}
.btn.act.fold {
  background: linear-gradient(180deg, #5b2b31, #3b1519);
  border-color: #8a3a44;
  box-shadow: 0 4px 0 #210a0d;
}
.btn.act.check {
  background: linear-gradient(180deg, #3170e0, #1d4aa8);
  border-color: #6fa1ff;
  box-shadow: 0 4px 0 #0f285c;
}
.btn.act.call {
  background: linear-gradient(180deg, #2fb36b, #1a7a45);
  border-color: #6ee7a8;
  box-shadow: 0 4px 0 #0b3b20;
}
.btn.act.raise {
  background: linear-gradient(180deg, #ffd36b, #e09a24 60%, #b8730f);
  color: #2b1600;
  border-color: #ffe6a3;
  box-shadow: 0 4px 0 #6b4207;
}
.btn.act.raise.allin {
  background: linear-gradient(180deg, #ff6262, #c81e1e);
  color: #fff;
  border-color: #ffa3a3;
  box-shadow: 0 4px 0 #5a0b0b, 0 0 24px rgba(255, 60, 60, 0.6);
}
.ap-raise {
  background: rgba(8, 12, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(6px);
}
.ap-presets {
  display: flex;
  gap: 8px;
}
.btn.preset {
  flex: 1;
  padding: 8px 4px;
  font-size: 15px;
}
.btn.preset.allin {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.4);
}
.ap-slider {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn.step {
  width: 40px;
  height: 36px;
  padding: 0;
  font-size: 20px;
}
.raise-input {
  width: 110px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(240, 201, 106, 0.5);
  background: rgba(0, 0, 0, 0.5);
  color: var(--gold);
  font-family: var(--num);
  font-size: 18px;
  text-align: center;
  outline: none;
}
.raise-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #3b4656, #f0c96a 70%, #ef4444);
  outline: none;
}
.raise-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6d5, #f0c96a 50%, #b98a2e);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  cursor: grab;
}
.raise-slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f0c96a;
  border: 2px solid #fff;
}
.timebank {
  align-self: flex-start;
}
.pre-actions {
  display: flex;
  gap: 8px;
  background: rgba(8, 12, 18, 0.75);
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn.pre {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
}
.btn.pre .box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: inline-block;
}
.btn.pre.on {
  border-color: var(--gold);
  background: rgba(240, 201, 106, 0.15);
}
.btn.pre.on .box {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: inset 0 0 0 3px #1b222c;
}

.helper {
  position: absolute;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 10px;
  padding: 5px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(240, 201, 106, 0.3);
  font-size: 15px;
  z-index: 7;
  white-space: nowrap;
  pointer-events: none;
}
[data-layout='landscape'] .helper {
  left: 800px;
  top: 848px;
}
.helper.show {
  display: flex;
}
.helper b {
  color: var(--gold);
}
.helper .eq {
  font-family: var(--num);
  color: #a7f3d0;
}
.helper .eq small {
  color: var(--muted);
  margin-left: 4px;
  font-family: inherit;
  font-size: 12px;
}

/* ================= 顶部栏 / 控件 ================= */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
  background: linear-gradient(180deg, rgba(6, 9, 13, 0.95), rgba(6, 9, 13, 0.7));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
  gap: 8px;
}
.tb-left,
.tb-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.room-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.room-title b {
  font-size: 14px;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-title span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.level-info {
  font-family: var(--num);
  font-size: 13px;
  color: #fcd34d;
  background: rgba(252, 211, 77, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
}
@media (max-width: 600px) {
  .level-info {
    display: none;
  }
  .icon-btn {
    padding: 5px 7px;
    font-size: 12px;
  }
}

.seat-controls {
  position: fixed;
  top: 54px;
  left: max(10px, env(safe-area-inset-left));
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 90;
  flex-wrap: wrap;
}
.sc-balance {
  font-family: var(--num);
  color: var(--gold);
  background: rgba(0, 0, 0, 0.5);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 14px;
}
.sc-hint {
  color: var(--muted);
  font-size: 12px;
}

/* 侧栏：牌局记录 / 聊天 */
.sidebar {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(340px, calc(100vw - 20px));
  background: rgba(8, 12, 18, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  z-index: 90;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.sb-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sb-tabs button {
  position: relative;
  flex: 1;
  background: none;
  border: 0;
  padding: 8px;
  color: var(--muted);
  font-size: 13px;
}
.sb-tabs button.active {
  color: var(--gold);
}
.sb-tabs .sb-toggle {
  flex: 0 0 40px;
}
.sidebar.collapsed .sb-toggle {
  transform: rotate(180deg);
}
.sidebar.collapsed .sb-tabs button.active {
  color: var(--muted);
}
.sidebar.collapsed .sb-body {
  display: none;
}
.dot {
  position: absolute;
  top: 6px;
  right: 18%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}
.sb-body {
  height: min(240px, 40vh);
}
.rotate-hint {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 95;
  padding: 6px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.75);
  color: #fde68a;
  font-size: 12px;
  pointer-events: none;
  display: none;
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate-hint {
    display: block;
  }
}
.tab-pane {
  display: none;
  height: 100%;
}
.tab-pane.active {
  display: flex;
  flex-direction: column;
}
.log-list,
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.6;
}
.log-line {
  color: #b6c2d1;
}
.log-line.k-hand {
  color: var(--gold);
  margin-top: 6px;
}
.log-line.k-street {
  color: #93c5fd;
}
.log-line.k-win {
  color: #86efac;
  font-weight: 600;
}
.log-line.k-show {
  color: #fde68a;
}
.log-line.k-system {
  color: #7c8796;
  font-style: italic;
}
.chat-line b {
  color: var(--gold);
  margin-right: 6px;
}
.chat-line.mine b {
  color: #93c5fd;
}
.quick-phrases {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 8px;
}
.quick-phrases button {
  flex-shrink: 0;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}
.chat-form {
  display: flex;
  gap: 6px;
  padding: 6px 8px 8px;
}
.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  outline: none;
}

/* ================= 弹窗 / 提示 ================= */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 16px;
  backdrop-filter: blur(3px);
}
.overlay.show {
  opacity: 1;
}
.modal {
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1a222d, #10161e);
  border: 1px solid rgba(240, 201, 106, 0.25);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.2s;
}
.modal.wide {
  width: min(720px, 100%);
}
.overlay.show .modal {
  transform: none;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.modal-head h3 {
  margin: 0;
  font-size: 17px;
  color: var(--gold);
}
.modal-x {
  background: none;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
}
.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}
.modal-body h4 {
  margin: 4px 0 10px;
  color: #cbd5e1;
  font-size: 14px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px 16px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 16px;
  margin-bottom: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
}
.field small {
  margin-top: 3px;
  font-size: 11px;
  opacity: 0.7;
}
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  margin-top: 6px;
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch i {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: #374151;
  transition: background 0.2s;
}
.switch i::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.switch input:checked + i {
  background: var(--green);
}
.switch input:checked + i::after {
  transform: translateX(20px);
}
.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
}
.avatar-opt {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
}
.avatar-opt:hover {
  border-color: var(--gold);
}
.avatar-opt img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.bot-levels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bot-level {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
}
.bot-level:hover {
  border-color: var(--gold);
}
.bot-level b {
  font-size: 16px;
}
.bot-level small {
  color: var(--muted);
}
.lv-easy b {
  color: #86efac;
}
.lv-normal b {
  color: #93c5fd;
}
.lv-hard b {
  color: #fca5a5;
}
.buyin {
  text-align: center;
}
.buyin-value {
  font-family: var(--num);
  font-size: 42px;
  color: var(--gold);
  margin: 10px 0 14px;
}
.buyin .raise-slider {
  width: 100%;
  margin-bottom: 14px;
}
.pi-head {
  display: flex;
  gap: 14px;
  align-items: center;
}
.pi-head img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #233;
}
.history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hist-head {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}
.hist-head b {
  color: var(--gold);
  flex-shrink: 0;
}
.hist-head span {
  color: #86efac;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hist-lines {
  display: none;
  padding: 8px 14px;
  font-size: 12px;
  line-height: 1.7;
}
.hist-lines.open {
  display: block;
}
.invite {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  top: 64px;
  transform: translate(-50%, -20px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 18px;
  border-radius: 12px;
  z-index: 2000;
  opacity: 0;
  transition: all 0.25s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.error {
  border-color: rgba(239, 68, 68, 0.6);
  color: #fecaca;
}
.toast.success {
  border-color: rgba(34, 197, 94, 0.6);
  color: #bbf7d0;
}
.net-banner {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  padding: 8px;
  text-align: center;
  background: #b91c1c;
  color: #fff;
  z-index: 3000;
  transform: translateY(-100%);
  transition: transform 0.3s;
}
.net-banner.show {
  transform: none;
}

/* ================= 竖屏（手机）布局：舞台 540×960 ================= */
[data-layout='portrait'] #table {
  left: 70px;
  top: 75px;
  width: 400px;
  height: 620px;
  --r: 200px;
}
[data-layout='portrait'] .rail::before {
  inset: 7px;
  border-radius: calc(var(--r) - 7px);
}
[data-layout='portrait'] .rail::after {
  inset: 16px;
  border-radius: calc(var(--r) - 16px);
}
[data-layout='portrait'] .felt {
  inset: 18px;
  border-radius: calc(var(--r) - 18px);
}
[data-layout='portrait'] .felt-line {
  inset: 34px;
  border-radius: calc(var(--r) - 52px);
}
[data-layout='portrait'] .felt-logo {
  top: 64%;
}
[data-layout='portrait'] .felt-logo span {
  font-size: 30px;
  letter-spacing: 5px;
}
[data-layout='portrait'] .felt-logo small {
  font-size: 9px;
  letter-spacing: 3px;
}
[data-layout='portrait'] #board {
  left: 103px;
  top: 341px;
  gap: 6px;
}
[data-layout='portrait'] #board .card {
  --cw: 62px;
  --ch: 88px;
}
[data-layout='portrait'] .pot-label {
  font-size: 17px;
  padding: 2px 12px;
}
[data-layout='portrait'] .side-pots span {
  font-size: 11px;
}
[data-layout='portrait'] .chip-col {
  width: 20px;
  height: 24px;
}
[data-layout='portrait'] .chip {
  width: 20px;
  height: 20px;
  bottom: calc(var(--i, 0) * 3px);
}
[data-layout='portrait'] .chip.flying-chip {
  width: 18px;
  height: 18px;
}
[data-layout='portrait'] .bet-amount {
  font-size: 13px;
  padding: 0 7px;
}
[data-layout='portrait'] .dealer-btn {
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  font-size: 15px;
}

/* 竖向座位卡：头像在上，名字和筹码在下 */
[data-layout='portrait'] .pod {
  width: 112px;
  height: 62px;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 14px;
  padding-bottom: 3px;
}
[data-layout='portrait'] .avatar-wrap {
  position: absolute;
  left: 50%;
  top: -48px;
  width: 58px;
  height: 58px;
  margin-left: -29px;
}
[data-layout='portrait'] .avatar {
  inset: 4px;
  width: 50px;
  height: 50px;
}
[data-layout='portrait'] .pod-info {
  width: 100%;
  padding: 0 6px;
}
[data-layout='portrait'] .pod-name {
  font-size: 12px;
}
[data-layout='portrait'] .pod-stack {
  font-size: 16px;
}
[data-layout='portrait'] .seat-cards,
[data-layout='portrait'] .seat.cards-below .seat-cards {
  left: 22px;
  right: auto;
  top: auto;
  bottom: 6px;
  transform: none;
}
[data-layout='portrait'] .seat.side-right .seat-cards {
  left: auto;
  right: 22px;
}
[data-layout='portrait'] .seat-cards .card {
  --cw: 34px;
  --ch: 48px;
}
[data-layout='portrait'] .seat.me .seat-cards {
  left: 62px;
  right: auto;
  bottom: -36px;
}
[data-layout='portrait'] .seat.me .seat-cards .card {
  --cw: 78px;
  --ch: 110px;
}
/* 竖屏亮牌：放大并居中放在座位卡上沿之上（压住头像），名字和筹码保持可见 */
[data-layout='portrait'] .seat.revealed .seat-cards,
[data-layout='portrait'] .seat.revealed.cards-below .seat-cards {
  left: 0;
  right: auto;
  top: auto;
  bottom: 31px;
  transform: translateX(-50%);
}
[data-layout='portrait'] .seat.revealed .seat-cards .card {
  --cw: 42px;
  --ch: 59px;
}
[data-layout='portrait'] .action-badge,
[data-layout='portrait'] .hand-badge,
[data-layout='portrait'] .seat.cards-below .action-badge,
[data-layout='portrait'] .seat.cards-below .hand-badge {
  top: 30px;
  bottom: auto;
  font-size: 12px;
  padding: 2px 8px;
}
[data-layout='portrait'] .seat-tags,
[data-layout='portrait'] .seat.has-cards .seat-tags {
  top: -64px;
  left: 0;
  transform: translateX(-50%);
}
[data-layout='portrait'] .seat.cards-below .seat-tags,
[data-layout='portrait'] .seat.cards-below.has-cards .seat-tags {
  top: 54px;
  left: 0;
}
[data-layout='portrait'] .tag {
  font-size: 9px;
  padding: 0 4px;
}
[data-layout='portrait'] .win-amount,
[data-layout='portrait'] .seat.me .win-amount {
  top: -96px;
  font-size: 22px;
}
[data-layout='portrait'] .seat.cards-below .win-amount {
  top: 56px;
}
[data-layout='portrait'] .chat-bubble {
  bottom: 74px;
  font-size: 12px;
  max-width: 160px;
}
[data-layout='portrait'] .seat.cards-below .chat-bubble {
  top: 60px;
}
[data-layout='portrait'] .sit-btn {
  width: 54px;
  height: 54px;
  font-size: 13px;
}
[data-layout='portrait'] .bot-btn {
  font-size: 10px;
  padding: 2px 6px;
}
[data-layout='portrait'] .table-message {
  top: 455px;
  font-size: 14px;
  padding: 6px 14px;
}
[data-layout='portrait'] .table-flash {
  font-size: 38px;
}
[data-layout='portrait'] .table-flash.level {
  font-size: 28px;
}

/* 竖屏操作区 */
[data-layout='portrait'] .action-panel {
  left: 8px;
  right: 8px;
  bottom: 6px;
  gap: 7px;
}
[data-layout='portrait'] .action-panel.center {
  top: 470px;
}
[data-layout='portrait'] .ap-buttons {
  gap: 7px;
}
[data-layout='portrait'] .btn.act {
  height: 54px;
  font-size: 17px;
  border-radius: 12px;
}
[data-layout='portrait'] .btn.act small {
  font-size: 13px;
}
[data-layout='portrait'] .ap-raise {
  padding: 7px 8px;
  gap: 7px;
  border-radius: 12px;
}
[data-layout='portrait'] .ap-presets {
  gap: 5px;
}
[data-layout='portrait'] .btn.preset {
  padding: 6px 2px;
  font-size: 13px;
}
[data-layout='portrait'] .btn.step {
  width: 32px;
  height: 32px;
  font-size: 18px;
}
[data-layout='portrait'] .raise-input {
  width: 80px;
  height: 32px;
  font-size: 15px;
}
[data-layout='portrait'] .raise-slider::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
}
[data-layout='portrait'] .btn.pre {
  font-size: 13px;
  padding: 8px 10px;
}
[data-layout='portrait'] .btn.big {
  padding: 10px 18px;
  font-size: 16px;
}
[data-layout='portrait'] .helper {
  left: 404px;
  top: 636px;
  font-size: 12px;
  padding: 3px 10px;
}
[data-layout='portrait'] .timebank {
  font-size: 11px;
  padding: 4px 8px;
}
