:root {
  --felt: #0b6b3a;
  --felt-dark: #094d2a;
  --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: 380px;
  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: 32px; letter-spacing: 2px; }
.lobby-card h1 .sub { font-size: 16px; color: var(--gold); letter-spacing: 1px; }
.tagline { margin: 0 0 22px; font-size: 13px; color: var(--muted); }

.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[type=number] { width: 110px; }
.field.checkbox input { width: auto; }
.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; margin-top: 6px; }
.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: 12px 16px; font-size: 14px;
  background: rgba(0,0,0,0.2);
}
.topbar b { color: var(--gold); font-size: 17px; }
.pot b { font-size: 20px; }

.seats {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 14px;
  align-content: start;
  overflow-y: auto;
}

.seat {
  background: rgba(0,0,0,0.22);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 92px;
  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 14px rgba(245,196,81,0.5); }
.seat.folded { opacity: 0.45; }
.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: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .pchips { font-size: 13px; color: var(--gold); }
.seat .badges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge {
  font-size: 10px; padding: 2px 6px; border-radius: 6px;
  background: rgba(255,255,255,0.16);
}
.badge.dealer { background: var(--gold); color: #5a3d00; }
.badge.look { background: #3b7bd8; }
.badge.blind { background: #6b4ea0; }
.badge.you { background: var(--red); }
.badge.host { background: #d98a2b; color: #3a2400; }
.badge.ready { background: #2fae66; }
.seat .pbet { font-size: 12px; color: var(--muted); }

/* 座位底部：战绩 + 踢人 */
.seat-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.pstats { font-size: 11px; color: var(--muted); white-space: nowrap; }
.kick-btn {
  appearance: none; border: none; cursor: pointer;
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: rgba(216,65,58,0.85); color: #fff; font-size: 12px; line-height: 1;
}
.kick-btn:active { transform: scale(0.92); }
.seat-ctrls { display: flex; gap: 5px; align-items: center; flex: none; }
.rebuy-btn {
  appearance: none; border: none; cursor: pointer;
  height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--gold); color: #5a3d00; font-size: 11px; font-weight: 700; line-height: 22px;
}
.rebuy-btn:active { transform: scale(0.92); }
.btn.ready-on { background: #2fae66; color: #fff; }
.timer-bar { height: 4px; border-radius: 3px; background: rgba(255,255,255,0.15); overflow: hidden; }
.timer-bar > i { display: block; height: 100%; background: var(--gold); width: 100%; transition: width 1s linear; }

/* 小牌（座位里展示对手——只在摊牌时露出） */
.mini-cards { display: flex; gap: 4px; }
.mini-card {
  width: 26px; height: 36px; border-radius: 5px;
  background: #fff; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.mini-card.back { background: linear-gradient(135deg, #b32c2c, #7a1d1d); }
.mini-card.red { color: var(--red); }

.center-info { text-align: center; padding: 4px 16px; min-height: 28px; }
.phase-info { font-size: 14px; color: var(--muted); }
.result-banner {
  margin: 6px auto; max-width: 90%;
  background: var(--gold); color: #5a3d00;
  font-weight: 700; padding: 8px 14px; border-radius: 10px;
}

/* 自己的手牌 */
.my-hand { display: flex; justify-content: center; gap: 10px; padding: 8px 0 4px; min-height: 100px; }
.card {
  width: 64px; height: 92px; border-radius: 9px;
  background: #fff; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; box-shadow: var(--shadow);
  position: relative;
}
.card.back { background: linear-gradient(135deg, #b32c2c, #7a1d1d); border: 3px solid #f0d9a0; }
.card.back::after { content: "金"; color: #f0d9a0; font-size: 30px; }
.card.red { color: var(--red); }
.card .rank { font-size: 26px; line-height: 1; }
.card .suit { font-size: 22px; line-height: 1; }
.hand-label {
  align-self: center; background: rgba(0,0,0,0.4); padding: 4px 10px;
  border-radius: 8px; font-size: 13px; color: var(--gold); margin-left: 8px;
}

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

/* 牌局日志 / 聊天 */
.log-wrap { background: rgba(0,0,0,0.25); padding: 8px 14px 12px; }
.log-tabs { display: flex; gap: 6px; margin-bottom: 6px; }
.log-tab {
  appearance: none; border: none; cursor: pointer;
  background: rgba(255,255,255,0.08); color: var(--muted);
  font-size: 13px; padding: 5px 14px; border-radius: 8px 8px 0 0; position: relative;
}
.log-tab.active { background: rgba(255,255,255,0.18); color: #fff; font-weight: 600; }
.chat-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); margin-left: 5px; vertical-align: middle;
}
.log-list { list-style: none; margin: 0 0 8px; padding: 0; height: 84px; overflow-y: auto; font-size: 12px; color: var(--muted); }
.log-list li { padding: 1px 0; line-height: 1.5; }
/* 聊天条：系统日志走 muted；聊天区里区分自己/他人 */
.chat-list li { color: #e9e9e3; font-size: 13px; }
.chat-list li .who { color: var(--gold); margin-right: 4px; }
.chat-list li.me .who { color: #6fd0a0; }
.chat-list li.me { text-align: right; }
.chat-empty { color: var(--muted); font-style: italic; }
.chat-row { display: flex; gap: 8px; }
.chat-row input { flex: 1; padding: 8px 12px; font-size: 14px; }

/* 弹层 */
.modal { position: absolute; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal-card { background: #1d3d2c; border: 1px solid rgba(255,255,255,0.15); border-radius: 16px; padding: 22px; width: 88%; max-width: 340px; box-shadow: var(--shadow); }
.modal-card h3 { margin: 0 0 10px; }
.modal-card .hint { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.modal-card input { width: 100%; margin-bottom: 14px; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; }
.compare-targets { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.compare-targets button { width: 100%; text-align: left; }

.toast {
  position: absolute; bottom: 20%; 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;
}

/* 宽屏：座位 3 列 */
@media (min-width: 560px) {
  .seats { grid-template-columns: repeat(3, 1fr); max-width: 760px; margin: 0 auto; width: 100%; }
  .lobby-card { max-width: 420px; }
}
