:root {
  --felt-deep: #0b3d2e;
  --felt: #0f4d3a;
  --felt-light: #146349;
  --gold: #c9a24b;
  --ivory: #f4ead9;
  --ivory-dim: #cfc3ad;
  --team1: #c8495a;
  --team2: #3f6fa8;
  --danger: #e2685a;
  --radius: 14px;
  font-size: 16px;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(circle at 50% 0%, var(--felt-light), var(--felt-deep) 70%);
  color: var(--ivory);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
}

.mono { font-family: "SF Mono", Menlo, monospace; letter-spacing: 2px; }

.screen {
  display: none;
  flex-direction: column;
  height: 100dvh;
  padding: env(safe-area-inset-top) 18px env(safe-area-inset-bottom);
  padding-top: calc(env(safe-area-inset-top) + 24px);
}
.screen.active { display: flex; }

/* ---------- 首页 ---------- */
.brand { text-align: center; margin-bottom: 28px; }
.brand-suit { font-size: 28px; letter-spacing: 8px; color: var(--gold); opacity: .8; }
.brand h1 {
  font-size: 46px;
  margin: 4px 0 2px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--ivory);
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.brand-sub { color: var(--ivory-dim); margin: 0; font-size: 14px; letter-spacing: 2px; }

.card-panel {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(201,162,75,.35);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.card-panel label {
  display: block;
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 8px;
  letter-spacing: 1px;
}
input {
  width: 100%;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(244,234,217,.25);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ivory);
  font-size: 17px;
  margin-bottom: 10px;
}
input::placeholder { color: rgba(244,234,217,.4); }

.btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  min-height: 48px;
  cursor: pointer;
}
.btn-primary { background: linear-gradient(180deg, var(--gold), #a67f34); color: #241a06; }
.btn-primary:disabled { opacity: .4; }
.btn-secondary { background: rgba(244,234,217,.12); color: var(--ivory); border: 1px solid rgba(244,234,217,.3); }
.btn-ghost { background: rgba(0,0,0,.25); color: var(--ivory); border: 1px solid rgba(244,234,217,.25); flex: 1; margin: 0 4px; }
.btn-link { background: none; border: none; color: var(--gold); font-size: 13px; }

.error-text { color: var(--danger); font-size: 13px; text-align: center; min-height: 18px; }

/* ---------- 大厅：面对面组队 ---------- */
.lobby-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; font-size: 14px; color: var(--ivory-dim);
}
#lobby-code { color: var(--gold); font-size: 18px; }

.seat-cross { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.seat-row { display: flex; align-items: center; justify-content: space-between; }
.seat-slot {
  width: 78px; height: 92px;
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  border: 1.5px dashed rgba(244,234,217,.3);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 0 auto;
  font-size: 13px;
  position: relative;
}
.seat-slot.filled { border-style: solid; }
.seat-slot.team1.filled { border-color: var(--team1); background: rgba(200,73,90,.18); }
.seat-slot.team2.filled { border-color: var(--team2); background: rgba(63,111,168,.18); }
.seat-slot .avatar { font-size: 22px; }
.seat-slot .pname { margin-top: 4px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-slot .host-tag { position: absolute; top: -8px; font-size: 10px; background: var(--gold); color: #241a06; padding: 1px 6px; border-radius: 8px; }

.table-center { text-align: center; }
.team-tag { font-size: 12px; padding: 3px 10px; border-radius: 10px; margin: 2px 0; }
.team-tag.team1 { background: rgba(200,73,90,.25); color: #ffb3bd; }
.team-tag.team2 { background: rgba(63,111,168,.25); color: #b7d3ff; }
.vs { font-size: 11px; color: var(--ivory-dim); margin: 4px 0; }

.lobby-hint { text-align: center; color: var(--ivory-dim); font-size: 12px; margin: 14px 0; }

/* ---------- 游戏桌 ---------- */
#screen-game { padding-left: 8px; padding-right: 8px; }

.game-top { display: flex; align-items: center; justify-content: center; position: relative; padding: 6px 0; }
.level-badge {
  position: absolute; left: 0; top: 4px;
  background: rgba(0,0,0,.3); border: 1px solid var(--gold); color: var(--gold);
  border-radius: 10px; padding: 4px 10px; font-size: 13px;
}
.banker-badge {
  position: absolute; right: 0; top: 4px; font-size: 11px; color: var(--ivory-dim);
}
.opponent { text-align: center; font-size: 13px; color: var(--ivory-dim); }
.opponent .name { color: var(--ivory); }
.opponent .cardback-row { display: flex; gap: -6px; justify-content: center; margin-top: 4px; }
.mini-back { width: 14px; height: 20px; background: linear-gradient(160deg,#8a1c2c,#4a0f18); border-radius: 3px; margin-left: -6px; border: 1px solid rgba(0,0,0,.4); }
.opponent.turn-active .name { color: var(--gold); font-weight: 700; }

.game-mid { display: flex; align-items: center; justify-content: space-between; flex: 1; padding: 4px 0; }
.opponent-left, .opponent-right { width: 64px; }
.last-play {
  flex: 1; min-height: 96px; display: flex; align-items: center; justify-content: center;
  gap: 3px; flex-wrap: wrap; background: rgba(0,0,0,.15); border-radius: 12px; margin: 0 6px;
  padding: 8px;
}
.last-play .empty-hint { color: var(--ivory-dim); font-size: 12px; }

.turn-hint { text-align: center; font-size: 12px; color: var(--gold); min-height: 16px; margin-bottom: 4px; }
.tribute-toast {
  text-align: center; font-size: 12px; color: #ffe9b0; background: rgba(0,0,0,.35);
  border: 1px solid var(--gold); border-radius: 10px; padding: 6px 10px; margin: 0 8px 6px;
}
.tribute-toast.hidden { display: none; }
.tribute-banner {
  text-align: center; font-size: 13px; color: #fff; background: rgba(200,73,90,.3);
  border: 1px solid var(--team1); border-radius: 10px; padding: 8px 10px; margin: 0 8px 8px;
}
.tribute-banner.hidden { display: none; }
.pool-pick-area {
  display: flex; gap: 10px; justify-content: center; align-items: center;
  padding: 10px; margin: 0 8px 8px;
}
.pool-pick-area.hidden { display: none; }
.pool-pick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: none; padding: 0;
}
.pool-pick-btn[disabled] { opacity: .4; }
.pool-pick-label { font-size: 11px; color: var(--ivory-dim); }
.claim-lead-btn {
  width: auto; padding: 10px 20px; margin: 0 auto; display: block;
}
.poker.ineligible { opacity: .35; }

.my-area { padding-bottom: 6px; }
.hand-scroll {
  display: flex; overflow-x: auto; padding: 10px 4px 4px;
  gap: 2px; min-height: 84px;
}
.hidden { display: none !important; }
.hand-actions { display: flex; margin-top: 6px; }

/* 扑克牌 */
.poker {
  width: 40px; height: 58px;
  background: #fdf8ec;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-weight: 700; font-size: 14px;
  color: #1a1a1a;
  box-shadow: 0 2px 4px rgba(0,0,0,.35);
  transition: transform .12s ease;
  user-select: none;
}
.poker.small { width: 30px; height: 44px; font-size: 11px; }
.poker.red { color: #b3222f; }
.poker.selected { transform: translateY(-14px); box-shadow: 0 0 0 2px var(--gold), 0 4px 8px rgba(0,0,0,.4); }
.poker .suit { font-size: 12px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 20;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--felt); border: 1px solid var(--gold); border-radius: var(--radius);
  padding: 22px; width: 82%; text-align: center;
}
.modal h2 { color: var(--gold); margin-top: 0; }
.modal p { color: var(--ivory-dim); white-space: pre-line; }
