:root {
  --bg: #0a0f1c;
  --bg-2: #0f1628;
  --panel: #141c30;
  --panel-2: #1a2439;
  --line: #24304a;
  --text: #e8edf7;
  --dim: #8b98b3;
  --gold: #e3b95f;
  --gold-2: #c99b3f;
  --green: #2fbf71;
  --red: #e05555;
  --blue: #4f8ef7;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 700px at 50% -10%, #16203a 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

button { font-family: inherit; }
input { font-family: inherit; }

.app { height: 100%; }
.view {
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: fade 0.18s ease;
}
.hidden { display: none !important; }

@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 通用控件 ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.12s;
  white-space: nowrap;
}
.btn:hover { background: #23304b; border-color: #33415f; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #1a1206; border-color: #a97f2c; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.06); }
.btn.danger { background: #3a1c1c; border-color: #5c2b2b; color: #ff9b9b; }
.btn.danger:hover { background: #4a2323; }
.btn.call { background: #16324f; border-color: #27507c; color: #9ec8ff; }
.btn.call:hover { background: #1c3d60; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(47, 191, 113, 0.12);
  border: 1px solid rgba(47, 191, 113, 0.3);
  color: #6ee7a8;
  font-size: 12px;
}
.pill.dim { background: rgba(255, 255, 255, 0.05); border-color: var(--line); color: var(--dim); }

.err { color: #ff8b8b; font-size: 13px; min-height: 18px; margin: 8px 0 0; }

input[type="text"], input[type="password"], input:not([type]), input[type="number"], select {
  width: 100%;
  background: #0c1322;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 13px;
  border-radius: 10px;
  outline: none;
  font-size: 14px;
  transition: 0.12s;
}
input:focus, select:focus { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(227, 185, 95, 0.12); }
select { appearance: none; cursor: pointer; }

/* ---------- 登录 ---------- */
#view-auth {
  align-items: center;
  justify-content: center;
}
.auth-wrap { width: 360px; text-align: center; }
.brand-mark {
  font-size: 42px;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 6px 30px rgba(227, 185, 95, 0.45);
}
.brand h1 { font-size: 26px; margin: 12px 0 6px; letter-spacing: 1px; }
.brand p { color: var(--dim); margin: 0 0 26px; font-size: 13px; }
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.seg {
  display: flex;
  gap: 4px;
  background: #0b1220;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.seg button {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--dim);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.seg button.active { background: var(--panel-2); color: var(--gold); font-weight: 600; }
#auth-form label {
  display: block;
  text-align: left;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 14px;
}
#auth-form label input { margin-top: 6px; }
.foot { color: #5b6884; font-size: 12px; margin-top: 18px; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: rgba(15, 22, 40, 0.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.logo { font-weight: 700; color: var(--gold); letter-spacing: 0.5px; font-size: 15px; }
.balance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #1c2438, #121a2b);
  border: 1px solid rgba(227, 185, 95, 0.45);
  padding: 5px 14px 5px 10px;
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.balance .coin {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe6a8, #e3b95f 55%, #a97f2c);
  border: 1px solid #8a6720;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.balance .bal-label { font-size: 11px; color: var(--dim); letter-spacing: 0.5px; }
.balance b {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}
.who { color: var(--dim); font-size: 13px; }
.room-title { font-weight: 600; font-size: 15px; }

/* ---------- 大厅 ---------- */
.lobby-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 18px;
  padding: 18px;
  min-height: 0;
}
.rooms-col { display: flex; flex-direction: column; min-height: 0; }
.col-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.col-head h2 { font-size: 16px; margin: 0; font-weight: 600; }
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  overflow-y: auto;
  align-content: start;
  padding-bottom: 12px;
}
.room-card {
  background: linear-gradient(180deg, var(--panel), #111827);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: 0.15s;
  position: relative;
  overflow: hidden;
}
.room-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(300px 100px at 100% 0%, rgba(227, 185, 95, 0.1), transparent 70%);
  pointer-events: none;
}
.room-card:hover { border-color: var(--gold-2); transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4); }
.room-card h3 { margin: 0 0 6px; font-size: 16px; }
.room-meta { color: var(--dim); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 12px; }
.room-meta span { white-space: nowrap; }
.room-players { display: flex; gap: 6px; flex-wrap: wrap; min-height: 26px; }
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(140deg, #2a3a5c, #1a2439);
  border: 1px solid #35486e;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #b9c8e6;
}
.room-status {
  position: absolute; top: 14px; right: 14px;
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); color: var(--dim);
}
.room-status.live { background: rgba(47, 191, 113, 0.14); color: #6ee7a8; }
.create-btn { margin-top: 14px; align-self: flex-start; }

/* ---------- 聊天 ---------- */
.chat-col {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 0;
  overflow: hidden;
}
.chat-tabs {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #101728;
}
.chat-tabs button {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--dim);
  padding: 7px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.chat-tabs button.active { background: var(--panel-2); color: var(--gold); font-weight: 600; }
.chat-tabs.single { justify-content: center; color: var(--dim); font-size: 13px; }
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.msg { font-size: 13px; line-height: 1.45; word-break: break-word; }
.msg-name { color: var(--gold); font-weight: 600; margin-right: 6px; }
.msg.mine .msg-name { color: #7fb2ff; }
.msg-text { color: #d5ddec; }
.msg-time { color: #4d5a75; font-size: 11px; margin-left: 6px; }
.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #101728;
}
.chat-form input { flex: 1; padding: 9px 11px; font-size: 13px; }
.chat-form .btn { padding: 8px 14px; }
.chat-hint { font-size: 11px; color: #4d5a75; padding: 0 12px 10px; text-align: center; }

/* ---------- 房间 / 牌桌 ---------- */
.room-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  padding: 16px;
  min-height: 0;
}
.table-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; gap: 12px; }
.table-stage {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 6px 14px;
  overflow: hidden;
}
.felt {
  position: relative;
  /* 回退方案：按可用高度估算宽度 */
  width: min(880px, 100%, calc((100vh - 300px) * 1.65));
  aspect-ratio: 1.65 / 1;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #1e7a54 0%, #14603f 46%, #0a3a26 100%);
  border: 13px solid #2a1a12;
  box-shadow:
    0 0 0 3px #452b1b,
    0 28px 60px rgba(0, 0, 0, 0.6),
    inset 0 0 80px rgba(0, 0, 0, 0.55);
}

.table-center {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.pot-pill {
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(227, 185, 95, 0.35);
  color: var(--gold);
  padding: 5px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4px;
}
.community { display: flex; gap: 8px; min-height: 76px; align-items: center; }
.phase-label { color: rgba(255, 255, 255, 0.45); font-size: 12px; letter-spacing: 2px; }

.countdown {
  color: #93a4c4;
  font-size: 12px;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 12px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* 本街下注的筹码：单独一层，位于座位与底池之间 */
.bet-layer { position: absolute; inset: 0; pointer-events: none; }
.bet-chip {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(8, 14, 24, 0.72);
  border: 1px solid rgba(227, 185, 95, 0.45);
  color: var(--gold);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  animation: chipIn 0.22s ease;
}
.bet-chip::before {
  content: "●";
  color: #e3b95f;
  font-size: 9px;
  margin-right: 5px;
  opacity: 0.9;
  vertical-align: 1px;
}
@keyframes chipIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.55); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 扑克牌 */
.card {
  width: 52px;
  height: 74px;
  border-radius: 7px;
  background: #f6f4ee;
  color: #10131a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  font-weight: 700;
  user-select: none;
}
.card .r { font-size: 20px; line-height: 1; }
.card .s { font-size: 18px; line-height: 1; }
.card.red { color: #c62f2f; }
.card.empty {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  box-shadow: none;
}
.card.back {
  background:
    repeating-linear-gradient(45deg, #1d3357 0 6px, #16264a 6px 12px);
  border: 2px solid #2c4470;
}
.card.deal-in {
  animation: dealIn 0.46s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes dealIn {
  from {
    opacity: 0;
    transform: translateY(-20px) rotateY(75deg) scale(0.88);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 座位 */
.seats { position: absolute; inset: 0; }
.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 128px;
}
.seat.empty { width: 92px; }
.sit-btn {
  width: 100%;
  padding: 10px 0;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 12.5px;
}
.sit-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(227, 185, 95, 0.1); }

.seat-inner {
  background: rgba(9, 15, 27, 0.92);
  border: 1px solid #2b3a58;
  border-radius: 11px;
  padding: 7px 9px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  position: relative;
  transition: 0.15s;
}
.seat.active-turn .seat-inner {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(227, 185, 95, 0.35), 0 0 26px rgba(227, 185, 95, 0.35);
}
.seat.folded { opacity: 0.42; }
.seat.me .seat-inner { border-color: #3a6ea8; }
.seat.offline .seat-inner { filter: grayscale(0.8); }

.seat-name {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  row-gap: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat-stack {
  font-size: 13px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.seat.me .seat-stack {
  font-size: 15px;
  color: #ffd980;
  text-shadow: 0 0 12px rgba(227, 185, 95, 0.45);
}
.bet-inline {
  color: #f4d791;
  background: rgba(227, 185, 95, 0.16);
  border: 1px solid rgba(227, 185, 95, 0.32);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
  line-height: 16px;
  flex: 0 0 auto;
}
.seat-cards { display: flex; gap: 3px; margin-top: 5px; min-height: 40px; }
.mini {
  width: 28px;
  height: 40px;
  border-radius: 4px;
  background: #f6f4ee;
  color: #10131a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.mini.red { color: #c62f2f; }
.mini.back {
  background: repeating-linear-gradient(45deg, #1d3357 0 5px, #16264a 5px 10px);
  border: 1px solid #2c4470;
}
.mini.deal-in { animation: dealIn 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both; }

.seat-act {
  margin-top: 4px;
  font-size: 11px;
  color: #9fb0cc;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(224, 85, 85, 0.18);
  color: #ff9b9b;
  border: 1px solid rgba(224, 85, 85, 0.3);
  font-weight: 500;
}
.badge.win { background: rgba(227, 185, 95, 0.18); color: var(--gold); border-color: rgba(227, 185, 95, 0.4); }
.badge.dim {
  background: rgba(255, 255, 255, 0.07);
  color: #93a1bd;
  border-color: rgba(255, 255, 255, 0.14);
}
.badge.host {
  background: rgba(227, 185, 95, 0.15);
  color: var(--gold);
  border-color: rgba(227, 185, 95, 0.35);
}
.seat.not-ready .seat-inner { border-style: dashed; opacity: 0.8; }
.dealer-dot {
  position: absolute;
  right: -7px;
  top: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f6f4ee;
  color: #10131a;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.seat-action {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -22px;
  font-size: 11px;
  color: #9fb0cc;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.timer-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
}
.timer-fill { height: 100%; background: var(--gold); width: 100%; transition: width 0.25s linear; }

/* ---------- 干瞪眼 ---------- */
.kind-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 4px;
}
.kind-tag.holdem {
  background: rgba(79, 142, 247, 0.15);
  color: #8ab4ff;
  border: 1px solid rgba(79, 142, 247, 0.3);
}
.kind-tag.gn {
  background: rgba(47, 191, 113, 0.15);
  color: #6ee7a8;
  border: 1px solid rgba(47, 191, 113, 0.3);
}
.gn-hand { font-size: 11px; color: var(--dim); margin-top: 2px; }
.gn-hand b { color: var(--text); font-size: 13px; }
.gn-empty { color: #4d5a75; font-size: 12px; padding: 14px; }
.gn-declare {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #0c1322;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 10px;
}
.gn-declare span { font-size: 12px; color: var(--dim); white-space: nowrap; }
.gn-declare .btn { padding: 4px 11px; font-size: 13px; }
.gn-need {
  background: rgba(227, 185, 95, 0.12);
  border: 1px solid rgba(227, 185, 95, 0.35);
  color: var(--gold);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 12.5px;
  white-space: nowrap;
  font-weight: 600;
}
.badge.warn {
  background: rgba(224, 85, 85, 0.18);
  color: #ff9b9b;
  border-color: rgba(224, 85, 85, 0.35);
}

.hand-tray {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  overflow-x: auto;
  background: rgba(10, 16, 28, 0.6);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 74px;
  align-items: center;
}
.hand-tray.hidden { display: none; }

.hand-card {
  flex: 0 0 auto;
  width: 46px;
  height: 66px;
  padding: 0;
  border-radius: 7px;
  background: #f6f4ee;
  color: #10131a;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.hand-card .hr { font-size: 16px; line-height: 1; }
.hand-card .hs { font-size: 15px; line-height: 1; }
.hand-card.red { color: #c62f2f; }
.hand-card:hover { transform: translateY(-4px); }
.hand-card.selected {
  transform: translateY(-10px);
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(227, 185, 95, 0.35), 0 8px 18px rgba(0, 0, 0, 0.5);
}

/* 操作栏 */
.action-bar {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 64px;
}
.action-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.action-note { color: var(--dim); font-size: 13px; flex: 1; min-width: 170px; }
.action-note b { color: var(--text); }

/* 底池 / 本街投入 / 剩余筹码，三个独立数字块 */
.stats { display: flex; gap: 8px; margin-left: auto; }
.stat {
  background: #0c1322;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 12px;
  min-width: 86px;
  text-align: right;
}
.stat span {
  display: block;
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.stat b {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.stat.accent {
  background: rgba(227, 185, 95, 0.1);
  border-color: rgba(227, 185, 95, 0.38);
}
.stat.accent b { color: var(--gold); }

.raise-box {
  background: #0c1322;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.raise-top { display: flex; align-items: baseline; gap: 10px; }
.raise-label { color: var(--dim); font-size: 12px; }
.raise-amount {
  color: var(--gold);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.raise-flow { margin-left: auto; color: #6b7a99; font-size: 13px; }
.raise-flow b { color: #dfe7f5; font-size: 15px; font-variant-numeric: tabular-nums; }
.raise-flow b#raise-cost { color: #ff9b9b; }
.raise-flow b#raise-left { color: var(--gold); }
.raise-box input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
}
.raise-bottom { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.raise-bound { font-size: 11.5px; color: #5f6d89; font-variant-numeric: tabular-nums; }
.raise-quick { display: flex; gap: 6px; margin-left: auto; }
.raise-quick button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: 7px;
  font-size: 11.5px;
  padding: 4px 9px;
  cursor: pointer;
}
.raise-quick button:hover { color: var(--gold); border-color: var(--gold-2); }

.side-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  min-width: 0;
}
.log-panel {
  flex: 0 0 150px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}
.panel-title {
  flex: 0 0 auto;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--dim);
  background: #101728;
  border-bottom: 1px solid var(--line);
}
.hand-log {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--dim);
  line-height: 1.7;
  min-height: 0;
}
.side-col .chat-col { flex: 1; min-height: 0; }
.hand-log .hi { color: var(--gold); }

/* ---------- 弹窗 / 提示 ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: #232f47;
  border: 1px solid #3a4a6b;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.2s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.72);
  display: grid;
  place-items: center;
  z-index: 90;
}
.modal {
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.modal label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 12px; }
.modal label input { margin-top: 6px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #26314a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #33415f; }

/* ---------- 窄屏 ---------- */
/* ---------- 移动端聊天抽屉 ---------- */
.sheet-toggle {
  display: none;
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  color: #1a1206;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  z-index: 80;
  place-items: center;
  cursor: pointer;
}
.sheet-toggle.show { display: grid; }
.sheet-toggle.hide { display: none !important; }
.sheet-toggle .fab-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5252;
  border: 2px solid #101728;
  display: none;
}
.sheet-toggle.has-unread .fab-dot { display: block; }

.sheet-head { display: none; }
.sheet-grip { flex: 0 0 44px; height: 4px; border-radius: 2px; background: #33405e; margin: 0 auto; }
.sheet-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
}

@media (max-width: 1150px) {
  .room-body { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (max-width: 980px) {
  .lobby-body { grid-template-columns: 1fr; }
  .room-body { grid-template-columns: minmax(0, 1fr) 270px; }
}

/* 支持容器查询时，牌桌尺寸直接由「可用空间的宽和高」决定，不再猜 vh */
@supports (container-type: size) {
  .table-stage { container-type: size; }
  .felt {
    width: auto;
    height: min(100cqh, calc(100cqw / 1.65));
    max-width: 100%;
  }
}

/* 竖屏手机：改成更方的比例，把竖向空间用起来，座位也更舒展 */
@media (max-width: 760px) {
  .felt { aspect-ratio: 1.25 / 1; }
}
@supports (container-type: size) {
  @media (max-width: 760px) {
    .felt { height: min(100cqh, calc(100cqw / 1.25)); }
  }
}

/* 再窄才降级成上下布局；此时给牌桌留出固定高度 */
@media (max-width: 760px) {
  .room-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 170px;
  }
  .side-col { flex-direction: row; }
  .log-panel { flex: 1 1 45%; }
  .side-col .chat-col { flex: 1 1 55%; }
}

/* 桌面窗口偏矮时，座位和牌一起缩小（手机端由下面的规则接管） */
@media (max-height: 830px) and (min-width: 761px) {
  .seat { width: 112px; }
  .card { width: 46px; height: 66px; }
  .mini { width: 25px; height: 36px; }
  .seat-name { font-size: 11.5px; }
  .seat-stack { font-size: 12px; }
}

@media (max-height: 720px) and (min-width: 761px) {
  .seat { width: 100px; }
  .card { width: 40px; height: 57px; }
  .card .r { font-size: 16px; }
  .card .s { font-size: 15px; }
  .mini { width: 22px; height: 32px; }
  .seat-cards { min-height: 32px; }
  .seat-act { font-size: 10px; }
  .log-panel { flex: 0 0 118px; }
  .raise-amount { font-size: 20px; }
}

@media (max-height: 680px) and (min-width: 761px) {
  .phase-label { display: none; }
  .table-center { gap: 6px; top: 44%; }
  .seat { width: 86px; }
  .seat.empty { width: 74px; }
  .sit-btn { padding: 7px 0; font-size: 11.5px; }
  .mini { width: 19px; height: 28px; font-size: 9px; }
  .seat-cards { min-height: 28px; gap: 2px; }
  .seat-name { font-size: 10.5px; }
  .seat-stack { font-size: 11px; }
  .seat-act { display: none; }
  .card { width: 34px; height: 48px; border-radius: 5px; }
  .card .r { font-size: 14px; }
  .card .s { font-size: 13px; }
  .community { gap: 5px; min-height: 50px; }
  .pot-pill { font-size: 12px; padding: 3px 12px; }
  .bet-chip { font-size: 10.5px; padding: 2px 8px 2px 6px; }
}

/* ---------- 手机：聊天改成底部抽屉，牌桌按宽度铺满 ---------- */
@media (max-width: 760px), (max-height: 520px) {
  html, body { font-size: 13px; }

  .topbar {
    height: 46px;
    flex-basis: 46px;
    padding: 0 10px;
  }
  .topbar-left, .topbar-right { gap: 8px; }
  .logo { display: none; }
  .room-title { font-size: 14px; }
  .balance { font-size: 12px; padding: 4px 10px; }
  .who { display: none; }

  .room-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }
  .table-col { gap: 8px; }
  .table-stage { padding: 0; }

  /* 牌桌上的元素整体缩小 */
  .seat { width: 62px; }
  .seat.empty { width: 56px; }
  .sit-btn { padding: 6px 0; font-size: 10px; border-radius: 7px; }
  .seat-inner { padding: 4px 5px; border-radius: 8px; }
  .seat-name { font-size: 9px; gap: 3px; }
  .seat-stack { font-size: 10px; }
  .seat-cards { min-height: 22px; gap: 2px; margin-top: 3px; }
  .mini { width: 16px; height: 22px; font-size: 8px; border-radius: 3px; }
  .seat-act { display: none; }
  .dealer-dot { width: 14px; height: 14px; font-size: 8px; right: -4px; top: -4px; }
  .badge { font-size: 8px; padding: 0 4px; }
  .badge.host { display: none; }
  .timer-track { margin-top: 3px; }

  .pot-pill { font-size: 11px; padding: 2px 10px; }
  .community { gap: 4px; min-height: 38px; }
  .card { width: 26px; height: 37px; border-radius: 4px; }
  .card .r { font-size: 12px; }
  .card .s { font-size: 11px; }
  .phase-label { display: none; }
  .table-center { top: 50%; gap: 7px; }
  .countdown { font-size: 10px; padding: 2px 8px; }
  .bet-chip { font-size: 9.5px; padding: 1px 7px 1px 5px; }
  .bet-chip::before { font-size: 7px; margin-right: 3px; }

  /* 操作栏：按钮加大到适合手指 */
  .action-bar { padding: 8px 10px; gap: 8px; border-radius: 12px; }
  .action-main { gap: 6px; }
  .action-note { font-size: 11px; min-width: 0; flex: 1 1 100%; order: 9; }
  .balance { padding: 4px 10px 4px 8px; gap: 6px; }
  .balance b { font-size: 14px; }
  .balance .bal-label { display: none; }
  .stats { margin-left: 0; width: 100%; gap: 6px; }
  .stat { flex: 1; min-width: 0; padding: 4px 8px; text-align: center; }
  .stat b { font-size: 15px; }
  .stat span { font-size: 9.5px; }
  .btn { padding: 11px 14px; font-size: 13px; border-radius: 9px; }
  .btn.small { padding: 8px 11px; font-size: 12px; }
  .raise-box { padding: 8px 10px; gap: 6px; }
  .raise-top { flex-wrap: wrap; }
  .raise-amount { font-size: 19px; }
  .raise-flow { flex: 1 1 100%; margin-left: 0; font-size: 11px; }
  .raise-bottom { gap: 8px; }
  .raise-quick { margin-left: 0; }
  .raise-quick button { padding: 5px 8px; font-size: 11px; }
  .raise-bound { font-size: 10.5px; }

  /* 聊天抽屉 */
  .side-col,
  #lobby-chat-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: min(62dvh, 460px);
    z-index: 75;
    background: #0d1424;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.6);
    transform: translateY(103%);
    transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.3, 1);
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
    flex-direction: column;
    min-height: 0;
  }
  .side-col.open,
  #lobby-chat-panel.open { transform: none; }

  .side-col .log-panel { flex: 0 0 84px; }
  .side-col .chat-col {
    flex: 1;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .sheet-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 2px 4px 6px;
  }
  .chat-msgs { padding: 8px; }
  .chat-form { padding: 8px 0 0; background: transparent; }
  .chat-hint { display: none; }

  .lobby-body { grid-template-columns: 1fr; gap: 10px; padding: 10px; }
  .room-grid { grid-template-columns: 1fr; gap: 10px; }
  .room-card { padding: 12px; }
  .room-card h3 { font-size: 15px; }
  .room-meta { font-size: 11.5px; gap: 8px; }
}

/* ---------- 横屏手机：垂直空间极窄，进一步压缩 ---------- */
@media (max-height: 520px) and (min-width: 600px) {
  .felt { aspect-ratio: 2 / 1; }
  .seat { width: 46px; }
  .seat.empty { width: 42px; }
  .seat-inner { padding: 2px 3px; border-radius: 6px; }
  .sit-btn { padding: 4px 0; font-size: 9px; }
  .seat-name { font-size: 7.5px; gap: 2px; }
  .seat-stack { font-size: 8.5px; }
  .mini { width: 11px; height: 15px; font-size: 7px; }
  .seat-cards { min-height: 15px; gap: 1px; }
  .dealer-dot { width: 10px; height: 10px; font-size: 6px; }
  .badge { font-size: 7px; padding: 0 3px; }
  .card { width: 18px; height: 26px; }
  .card .r { font-size: 9px; }
  .card .s { font-size: 8px; }
  .community { min-height: 26px; gap: 2px; }
  .pot-pill { font-size: 9px; padding: 1px 7px; }
  .bet-chip { font-size: 8.5px; padding: 1px 5px 1px 4px; }
  .phase-label { display: none; }

  /* 加注面板改成一行；右侧留出聊天按钮的位置，避免挡住「加注」 */
  .action-bar { padding: 6px 10px; padding-right: 74px; gap: 6px; }
  .btn { padding: 8px 12px; font-size: 12px; }
  .raise-box { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 10px; }
  .raise-top { flex: 0 0 auto; }
  .raise-flow { display: none; }
  .raise-amount { font-size: 17px; }
  .raise-box input[type="range"] { flex: 1 1 160px; }
  .raise-bottom { flex: 0 0 auto; gap: 8px; }
  .raise-bound { display: none; }
  .action-note { display: none; }
}

/* 横屏下用更扁的牌桌比例，把宽度用起来 */
@supports (container-type: size) {
  @media (max-height: 520px) and (min-width: 600px) {
    .felt { height: min(100cqh, calc(100cqw / 2)); }
  }
}
