:root {
  --felt: #0b6b3a;
  --felt-dark: #073d22;
  --gold: #f5c451;
  --red: #d8413a;
  --ink: #1a1a1a;
  --paper: #fdfdfb;
  --muted: #9bb3a5;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--paper);
  background: radial-gradient(circle at 50% 0%, #128a4c 0%, var(--felt) 40%, var(--felt-dark) 100%);
  overflow: hidden;
}
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }

.btn {
  appearance: none; border: none; border-radius: 10px; padding: 12px 18px;
  font-size: 16px; font-weight: 600; color: var(--ink); background: #e9e9e3;
  cursor: pointer; transition: transform 0.06s ease, filter 0.15s ease; user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--gold); color: #5a3d00; }
.btn.ghost { background: rgba(255,255,255,0.14); color: #fff; }
.btn.small { padding: 8px 12px; font-size: 14px; }

/* ---------- 大厅 ---------- */
#lobby { align-items: center; justify-content: center; padding: 20px; }
.lobby-card {
  width: 100%; max-width: 400px; background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 18px; padding: 26px 22px;
  box-shadow: var(--shadow); backdrop-filter: blur(4px);
}
.lobby-card h1 { margin: 0 0 4px; font-size: 30px; letter-spacing: 1px; }
.lobby-card h1 .sub { font-size: 16px; color: var(--gold); }
.tagline { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.warn { margin: 0 0 18px; font-size: 12px; line-height: 1.5; color: #ffd27a; background: rgba(0,0,0,0.25); border: 1px solid rgba(245,196,81,0.3); border-radius: 8px; padding: 8px 10px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 14px; }
.field.row { flex-direction: row; align-items: center; justify-content: space-between; }
.field.row span { color: var(--muted); }
.field.row input { width: 120px; }
.field span { color: var(--muted); }
input {
  appearance: none; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.95);
  color: var(--ink); border-radius: 10px; padding: 12px 14px; font-size: 16px; outline: none;
}
input:focus { border-color: var(--gold); }
.lobby-actions { display: flex; flex-direction: column; gap: 12px; }
.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; }
.advanced { margin-top: 18px; font-size: 13px; }
.advanced summary { color: var(--muted); cursor: pointer; margin-bottom: 10px; }
.error { color: #ffb4b0; font-size: 13px; min-height: 18px; margin: 12px 0 0; }

/* ---------- 牌桌 ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; font-size: 14px; background: rgba(0,0,0,0.2); }
.topbar b { color: var(--gold); }
.blinds { color: var(--muted); font-size: 13px; }
.nogamble { text-align: center; font-size: 11px; color: rgba(255,255,255,0.5); padding: 3px 8px; background: rgba(0,0,0,0.18); letter-spacing: 0.3px; }

/* 关键固定区不压缩；座位区吸收剩余高度并滚动，保证手机端公共牌/手牌/操作区始终可见 */
.topbar, .nogamble, .board-area, .my-hand, .action-bar, .log-wrap { flex-shrink: 0; }
.seats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 8px; align-content: start; overflow-y: auto; flex: 1 1 0; min-height: 60px; }
.seat {
  background: rgba(0,0,0,0.22); border: 2px solid transparent; border-radius: 12px;
  padding: 7px 8px; display: flex; flex-direction: column; gap: 3px; min-height: 74px;
  transition: border-color 0.2s, opacity 0.2s;
}
.seat.empty { opacity: 0.4; align-items: center; justify-content: center; color: var(--muted); }
.seat.turn { border-color: var(--gold); box-shadow: 0 0 12px rgba(245,196,81,0.5); }
.seat.folded { opacity: 0.4; }
.seat.offline { filter: grayscale(0.7); }
.seat .row1 { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.seat .pname { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .pchips { font-size: 13px; color: var(--gold); }
.badges { display: flex; gap: 3px; flex-wrap: wrap; }
.badge { font-size: 10px; padding: 2px 5px; border-radius: 5px; background: rgba(255,255,255,0.16); }
.badge.btn-d { background: #fff; color: #1a1a1a; }
.badge.sb { background: #3b7bd8; }
.badge.bb { background: #6b4ea0; }
.badge.you { background: var(--red); }
.badge.host { background: #d98a2b; color: #3a2400; }
.badge.ready { background: #2fae66; }
.badge.allin { background: var(--red); }
.seat .pbet { font-size: 12px; color: var(--gold); min-height: 14px; }
.seat .mini-cards { display: flex; gap: 3px; }
.mini-card { width: 24px; height: 33px; border-radius: 4px; background: #fff; color: var(--ink); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.mini-card.back { background: linear-gradient(135deg, #2b5fb3, #173a7a); }
.mini-card.red { color: var(--red); }
.timer-bar { height: 3px; border-radius: 3px; background: rgba(255,255,255,0.15); overflow: hidden; }
.timer-bar > i { display: block; height: 100%; background: var(--gold); width: 100%; }
.seat-foot { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-top: auto; }
.pstats { font-size: 10px; color: var(--muted); white-space: nowrap; }
.seat-ctrls { display: flex; gap: 5px; flex: none; }
.kick-btn { appearance: none; border: none; cursor: pointer; width: 20px; height: 20px; border-radius: 5px; background: rgba(216,65,58,0.85); color: #fff; font-size: 11px; line-height: 1; }
.rebuy-btn { appearance: none; border: none; cursor: pointer; height: 20px; padding: 0 7px; border-radius: 5px; background: var(--gold); color: #5a3d00; font-size: 10px; font-weight: 700; }

/* 公共牌 + 底池 */
.board-area { text-align: center; padding: 4px 12px; }
.board { display: flex; justify-content: center; gap: 6px; min-height: 52px; align-items: center; }
.community-card { width: 40px; height: 56px; border-radius: 6px; background: #fff; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; box-shadow: var(--shadow); }
.community-card.red { color: var(--red); }
.community-card .rank { font-size: 18px; line-height: 1; }
.community-card .suit { font-size: 15px; line-height: 1; }
.community-card.placeholder { background: rgba(255,255,255,0.08); box-shadow: none; }
.pot-line { font-size: 15px; margin-top: 6px; }
.pot-line b { color: var(--gold); font-size: 20px; }
.phase-info { font-size: 13px; color: var(--muted); margin-top: 2px; min-height: 18px; }
.result-banner { margin: 6px auto; max-width: 92%; background: var(--gold); color: #5a3d00; font-weight: 700; padding: 7px 12px; border-radius: 9px; font-size: 14px; }

/* 自己底牌 */
.my-hand { display: flex; justify-content: center; gap: 10px; padding: 3px 0; min-height: 70px; align-items: center; }
.card { width: 56px; height: 78px; border-radius: 8px; background: #fff; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; box-shadow: var(--shadow); }
.card.back { background: linear-gradient(135deg, #2b5fb3, #173a7a); border: 3px solid #cdd9f0; }
.card.red { color: var(--red); }
.card .rank { font-size: 24px; line-height: 1; }
.card .suit { font-size: 20px; line-height: 1; }
.my-best { align-self: center; background: rgba(0,0,0,0.4); padding: 4px 10px; border-radius: 8px; font-size: 13px; color: var(--gold); }

/* 操作区 */
.action-bar { padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.play-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.act-fold { background: #555; color: #fff; }
.act-check { background: #2fae66; color: #fff; }
.act-call { background: #3b7bd8; color: #fff; }
.act-raise { background: var(--gold); color: #5a3d00; }
.act-allin { background: var(--red); color: #fff; }
.wait-hint { font-size: 13px; color: var(--muted); min-height: 16px; }

.raise-panel { width: 100%; max-width: 420px; background: rgba(0,0,0,0.35); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.raise-head { text-align: center; font-size: 15px; }
.raise-head b { color: var(--gold); font-size: 20px; }
#raiseSlider { width: 100%; }
.raise-quick { display: flex; gap: 6px; justify-content: center; }
.raise-quick .btn { flex: 1; }
.raise-confirm { display: flex; gap: 10px; }
.raise-confirm .btn { flex: 1; }

/* 日志/聊天 */
.log-wrap { background: rgba(0,0,0,0.25); padding: 8px 12px 10px; }
.panels { display: flex; gap: 10px; margin-bottom: 8px; }
.panel { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.panel-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; padding-left: 2px; }
.log-list { list-style: none; margin: 0; padding: 6px 8px; height: 68px; overflow-y: auto; font-size: 12px; color: var(--muted); background: rgba(0,0,0,0.2); border-radius: 8px; }
.log-list li { padding: 1px 0; line-height: 1.4; }
/* 聊天气泡：自己靠右、对方靠左，各带底色 */
.chat-list { display: flex; flex-direction: column; gap: 4px; }
.chat-list li {
  max-width: 78%; align-self: flex-start;
  padding: 5px 10px; border-radius: 12px;
  background: rgba(255,255,255,0.13); color: #f1f1ec;
  font-size: 13px; line-height: 1.35; word-break: break-word;
}
.chat-list li.me { align-self: flex-end; background: #2f7d52; }
.chat-list li .who { color: var(--gold); margin-right: 4px; font-weight: 600; }
.chat-list li.me .who { color: #cfeede; }
.chat-row { display: flex; gap: 8px; }
.chat-row input { flex: 1; padding: 8px 12px; font-size: 14px; }

.toast { position: absolute; bottom: 22%; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.85); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 30; max-width: 80%; text-align: center; }

@media (min-width: 620px) {
  .seats { grid-template-columns: repeat(3, 1fr); max-width: 820px; margin: 0 auto; width: 100%; }
  .lobby-card { max-width: 440px; }
  .community-card { width: 52px; height: 72px; }
  .community-card .rank { font-size: 22px; }
  /* 宽屏：内容居中收窄，避免聊天/操作区甩到整行 */
  .log-wrap, .action-bar { max-width: 820px; margin: 0 auto; width: 100%; }
}
