:root {
  --bg: #0e1422;
  --felt: #1e6b45;
  --felt-dark: #155036;
  --card-bg: #f7f5ef;
  --card-red: #c0392b;
  --card-black: #1c1c1c;
  --panel: rgba(23, 32, 51, .9);
  --border: rgba(255, 255, 255, .14);
  --text: #e8ecf4;
  --dim: #97a2b8;
  --accent: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg) url("https://images.unsplash.com/photo-1606167668584-78701c57f13d?w=1600&q=60") center/cover fixed no-repeat;
  color: var(--text);
  font-size: 15px;
}
button {
  font: inherit; color: var(--text); cursor: pointer;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 18px;
}
button:disabled { opacity: .4; cursor: default; }
button.primary { background: #2563eb; border-color: #3b82f6; }
button.danger { background: #b91c1c; border-color: #ef4444; }
button.warn { background: #b45309; border-color: #f59e0b; }
button.ghost { background: transparent; padding: 6px 12px; }
input {
  font: inherit; color: var(--text);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; outline: none;
}
input:focus { border-color: var(--accent); }

/* ---------- 大厅 ---------- */
#lobby { max-width: 460px; margin: 8vh auto 0; padding: 0 20px; text-align: center; }
#lobby h1 { font-size: 40px; margin: 0 0 6px; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
#lobby h1 .sub { font-size: 18px; color: var(--dim); font-weight: normal; }
.tagline { color: var(--dim); margin: 0 0 24px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 22px; text-align: left; }
.panel label { display: block; margin-bottom: 14px; color: var(--dim); }
.panel label input, .row input { width: 100%; margin-top: 6px; }
.row { display: flex; gap: 10px; margin-bottom: 14px; }
.row button { flex: 1; }
.row input { flex: 1; margin-top: 0; }
.msg { color: var(--amber); min-height: 20px; margin: 4px 0 0; }
.help { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px 22px; margin-top: 18px; text-align: left; }
.help h3 { margin: 0 0 8px; }
.help p { color: var(--dim); margin: 6px 0; line-height: 1.7; }

/* ---------- 牌桌 ---------- */
#game { max-width: 1080px; margin: 0 auto; padding: 10px 14px 30px; }
header { display: flex; align-items: center; gap: 10px; }
#roomInfo { flex: 1; text-align: center; font-weight: bold; letter-spacing: 2px; }
#note { text-align: center; color: var(--amber); min-height: 22px; margin: 6px 0; }

#tableWrap { display: flex; flex-direction: column; gap: 10px; }
#table {
  position: relative;
  background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 78%);
  border: 10px solid #3d2b1f;
  border-radius: 200px;
  min-height: 420px;
  box-shadow: inset 0 0 60px rgba(0,0,0,.45), 0 8px 30px rgba(0,0,0,.5);
}
#board { position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 90%; }
#community { display: flex; gap: 6px; justify-content: center; min-height: 62px; margin-bottom: 8px; flex-wrap: wrap; }
#pot { font-weight: bold; text-shadow: 0 1px 6px rgba(0,0,0,.5); }

/* 座位 */
#seats { position: absolute; inset: 0; }
.seat { position: absolute; transform: translate(-50%, -50%); text-align: center; min-width: 108px; }
.seat .chip-count {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 4px 10px; display: inline-block;
}
.seat.me .chip-count { border-color: var(--accent); }
.seat .name { font-size: 13px; color: var(--dim); display: block; }
.seat .betc { color: var(--amber); font-size: 13px; min-height: 18px; display: block; }
.seat .cards { display: flex; gap: 3px; justify-content: center; min-height: 44px; margin-top: 3px; }
.seat .cards .card { width: 30px; height: 42px; font-size: 13px; }
.seat.folded { opacity: .45; }
.seat.turn .chip-count { box-shadow: 0 0 0 2px var(--green); }
.seat .badge {
  position: absolute; top: -10px; right: -12px;
  background: #fff; color: #1c1c1c; border-radius: 50%;
  width: 20px; height: 20px; line-height: 20px; font-size: 12px; font-weight: bold;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.seat .offline { color: var(--red); font-size: 11px; display: block; }
.seat .result { color: var(--green); font-size: 12px; display: block; min-height: 16px; }

/* 扑克牌 */
.card {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 44px; height: 62px;
  background: var(--card-bg); color: var(--card-black);
  border-radius: 7px; font-weight: bold; font-size: 17px; line-height: 1.05;
  box-shadow: 0 2px 5px rgba(0,0,0,.45);
  border: 1px solid rgba(0,0,0,.15);
}
.card.red { color: var(--card-red); }
.card .suit { font-size: 15px; }
.card.back {
  background: repeating-linear-gradient(45deg, #1e3a8a 0 6px, #1d4ed8 6px 12px);
  border-color: #16307a;
}
.card.small { width: 36px; height: 52px; font-size: 14px; }

/* 我的区域 */
#myArea { display: flex; flex-direction: column; gap: 8px; }
#myHand { display: flex; gap: 8px; justify-content: center; min-height: 66px; }
#myHand .card { width: 56px; height: 80px; font-size: 22px; }
#myHand .card .suit { font-size: 20px; }
#myInfo { text-align: center; color: var(--dim); }
#myInfo b { color: var(--text); }
#actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
#actions button { min-width: 88px; }
#raiseBox {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px;
}
#raiseBox .presets { display: flex; gap: 6px; }
#raiseBox .presets button { padding: 5px 10px; min-width: 0; font-size: 13px; }
#raiseRange { width: 200px; }
#raiseInput { width: 76px; padding: 5px 8px; text-align: center; }
#actions.off { opacity: .4; pointer-events: none; }

/* 侧栏 */
#side { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; margin-top: 12px; }
#side h3 { margin: 4px 0 8px; font-size: 15px; }
#handEnd { color: var(--green); }
#hands { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 10px; }
#hands .h { font-size: 13px; }
#hands .h .cards { display: flex; gap: 2px; margin: 3px 0; }
#hands .h .card { width: 22px; height: 31px; font-size: 10px; border-radius: 4px; }
#hands .h .card .suit { font-size: 9px; }
#hands .h .cname { color: var(--green); }
#log { list-style: none; margin: 0; padding: 0; max-height: 150px; overflow-y: auto; }
#log li { color: var(--dim); font-size: 13px; padding: 2px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }
#log li:last-child { color: var(--text); }

#toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: rgba(0, 0, 0, .85); color: #fff;
  border-radius: 10px; padding: 10px 18px; z-index: 9;
  max-width: 86vw;
}

@media (max-width: 640px) {
  #table { min-height: 340px; border-width: 6px; border-radius: 120px; }
  .seat { min-width: 84px; }
  .seat .cards { min-height: 34px; }
  .seat .cards .card { width: 22px; height: 31px; font-size: 10px; }
  #raiseRange { width: 100%; }
}
