:root {
  --bg: #0b1220;
  --panel: #121a2b;
  --card: #1a2438;
  --gold: #f5c542;
  --accent: #e74c3c;
  --green: #2ecc71;
  --text: #f0f3fa;
  --muted: #8b97b0;
  --line: #2a354d;
  --danger: #ff6b6b;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0,0,0,.35);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); min-height: 100%; }
body {
  background:
    radial-gradient(ellipse at top, #1a2744 0%, transparent 55%),
    radial-gradient(ellipse at bottom, #0d1f18 0%, transparent 50%),
    var(--bg);
  min-height: 100dvh;
}
#app { max-width: 520px; margin: 0 auto; padding: 16px 14px 28px; }
.hidden { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 20px;
  box-shadow: var(--shadow);
  margin-top: 40px;
}
.logo { font-size: 42px; font-weight: 800; text-align: center; letter-spacing: 2px; }
.sub { text-align: center; color: var(--muted); margin: 6px 0 24px; }
.field { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.field input, .chatbar input, #inviteLink {
  width: 100%; margin-top: 6px; padding: 12px 14px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 16px; outline: none;
}
.field input:focus, .chatbar input:focus { border-color: var(--gold); }
.row { display: flex; gap: 10px; margin-top: 8px; }
.or { text-align: center; color: var(--muted); margin: 18px 0 10px; font-size: 13px; }
.err { color: var(--danger); min-height: 1.2em; font-size: 14px; }

.btn {
  appearance: none; border: none; cursor: pointer;
  background: #2a3650; color: var(--text);
  padding: 12px 16px; border-radius: 12px; font-size: 15px; font-weight: 600;
  transition: transform .08s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, #f5c542, #e67e22); color: #1a1200; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.bet { flex: 1; background: #243352; }
.btn.bet.hot { background: linear-gradient(135deg, #e74c3c, #c0392b); }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 10px;
}
.room-label { font-size: 13px; color: var(--muted); }
.room-label b { color: var(--gold); letter-spacing: 2px; font-size: 16px; }
.phase-label { font-size: 14px; font-weight: 700; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.chips-badge {
  background: #1e2a18; border: 1px solid #3a5a2a; color: #b6f5a0;
  padding: 8px 12px; border-radius: 999px; font-weight: 700; font-size: 14px;
}

.table {
  background: linear-gradient(160deg, #0f3d2e, #0a2a20 60%, #071c15);
  border: 2px solid #1f6b4f;
  border-radius: 24px;
  min-height: 340px;
  padding: 14px 12px 18px;
  box-shadow: inset 0 0 40px rgba(0,0,0,.35), var(--shadow);
  position: relative;
}
.banker-tag {
  display: inline-block; background: rgba(245,197,66,.15); color: var(--gold);
  border: 1px solid rgba(245,197,66,.35); padding: 4px 10px; border-radius: 999px;
  font-size: 12px; margin-bottom: 10px;
}
.players { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 70px; }
.seat {
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; padding: 8px 10px; min-width: 96px; text-align: center;
  position: relative;
}
.seat.me { border-color: var(--gold); }
.seat.banker::after {
  content: "庄"; position: absolute; top: -8px; right: -6px;
  background: var(--gold); color: #1a1200; font-size: 11px; font-weight: 800;
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
}
.seat .name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.seat .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.seat .status { font-size: 11px; margin-top: 4px; }
.seat .status.ready { color: var(--green); }
.seat .status.off { color: #888; }
.seat .mini-cards { display: flex; gap: 2px; justify-content: center; margin-top: 6px; }
.seat .handtag {
  margin-top: 4px; font-size: 12px; font-weight: 800; color: var(--gold);
}

.my-hand {
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin-top: 18px; min-height: 96px;
}
.poker {
  width: 58px; height: 84px; border-radius: 8px;
  background: #fff; color: #111; display: flex; flex-direction: column;
  justify-content: space-between; padding: 6px 7px;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
  font-weight: 800; font-size: 15px; line-height: 1;
  animation: deal .28s ease;
}
.poker .suit { font-size: 20px; text-align: center; }

.poker.red { color: #c0392b; }
.poker.back {
  background: repeating-linear-gradient(45deg, #1a3a6a, #1a3a6a 6px, #244a80 6px, #244a80 12px);
  color: transparent; 
  border: 2px solid #8ab4ff;
}
@keyframes deal {
  from { transform: translateY(-20px) scale(.8); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.mini {
  width: 22px; height: 30px; border-radius: 3px; background: #fff; color: #111;
  font-size: 9px; font-weight: 800; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1;
}
.mini.red { color: #c0392b; }
.mini.back { background: #1a3a6a; color: transparent; border: 1px solid #8ab4ff; }

.hand-name {
  text-align: center; font-size: 28px; font-weight: 900; color: var(--gold);
  text-shadow: 0 2px 12px rgba(245,197,66,.35); min-height: 36px; margin-top: 8px;
  letter-spacing: 2px;
}

.settle {
  margin-top: 10px; background: rgba(0,0,0,.4); border-radius: 12px;
  padding: 10px 12px; font-size: 13px;
}
.settle .title { font-weight: 800; color: var(--gold); margin-bottom: 6px; }
.settle .line { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,.08); }
.settle .win { color: var(--green); }
.settle .lose { color: var(--danger); }

.controls {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; justify-content: center;
}
.hint { width: 100%; text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 4px; }

.chatbar { display: flex; gap: 8px; margin-top: 14px; }
.chatbar input { margin-top: 0; }
.chatlog {
  max-height: 90px; overflow-y: auto; margin-top: 8px; font-size: 12px; color: var(--muted);
}
.chatlog div { padding: 2px 0; }
.chatlog b { color: #cde; }

.toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  background: rgba(20,28,45,.95); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: 90%;
  box-shadow: var(--shadow); font-size: 14px;
}

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: grid; place-items: center; z-index: 60; padding: 20px;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; width: min(400px, 100%); box-shadow: var(--shadow);
}
.modal-card h3 { margin: 0 0 12px; }
.code-big {
  font-size: 32px; font-weight: 900; letter-spacing: 6px; color: var(--gold);
  text-align: center; padding: 10px; background: var(--card); border-radius: 12px; margin-bottom: 12px;
}
#inviteLink { margin-bottom: 12px; font-size: 13px; }
