/* 德州扑克专用样式
   变量与按钮基样来自 ../base.css，此处不重复定义
   注意：body 需覆盖 base.css 的灰黑 gradient；.card 需独立定义（不叠牌） */

body.poker {
  background: radial-gradient(1200px 900px at 50% 0%, #10331f 0%, #071a10 62%, #04100a 100%);
  background-attachment: fixed;
  /* 牌桌整体在视口内垂直居中 */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* 顶栏固定在最上（不参与 #table 的 flex 居中，否则会被压缩居中） */
#topbar {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  z-index: 5;
}
/* 牌桌主体吃掉顶栏以下的高度并居中 */
#table {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px 0 12px;      /* 顶部留出顶栏高度，底部留出按钮空间 */
}

.home-link {
  display: block;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 16px;
  transition: color .15s;
}
.home-link:hover { color: var(--gold-bright); }

#lobby {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#lobby .panel { width: 320px; }
.lobby-tip { margin-top: 14px; font-size: 12px; color: var(--text-dim); text-align: center; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 30px 34px;
  text-align: center;
}
.panel h1 { color: var(--gold); margin-bottom: 20px; font-weight: 600; letter-spacing: .18em; }
.panel h2 { color: var(--gold); margin-bottom: 14px; font-weight: 600; }
.field { text-align: left; margin: 10px 0; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 4px; }
.field input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 10px;
  font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--gold); }
.row { margin: 12px 0 4px; }
.row button { width: 100%; margin: 4px 0; }
.divider { color: var(--text-dim); margin: 14px 0; font-size: 13px; }

/* ---------- 顶栏 ---------- */
#topbar {
  display: flex;
  justify-content: space-between;   /* 房间号在左、第N手居中、筹码在右 */
  align-items: center;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 18px;
  font-size: 14px;
  color: var(--text-dim);
}
#roomBox { display: flex; align-items: center; }
#topbar #roomCode { color: var(--gold); font-weight: 600; }
button.mini {
  padding: 3px 12px;
  font-size: 12px;
  margin: 0 0 0 6px;
  border-radius: 4px;
}
button.mini-btn {
  padding: 8px 16px;
  font-size: 13px;
  margin: 0 4px;
  border-radius: 6px;
}

/* ---------- 牌桌（椭圆台布） ---------- */
.felt {
  position: relative;
  width: min(90vw, 1080px);
  height: min(50vh, 420px);
  margin: 0 auto;
  border-radius: 46% / 52%;
  background: radial-gradient(ellipse at 50% 40%, #1d7a52 0%, #0f5a3a 58%, #0a3f2a 100%);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, .6), 0 12px 40px rgba(0, 0, 0, .55);
  border: 8px solid #3b2a1c;
}

/* 底池：公共牌上方（公共牌 top:50%，牌高约 80px），与对面座位留出间距 */
.pot-chip {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translateX(-50%);
  z-index: 4;
  background: rgba(0, 0, 0, .72);
  border: 1px solid rgba(255, 255, 255, .18);
  color: var(--gold-bright);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 15px;
  border-radius: 999px;
  white-space: nowrap;
}

/* 公共牌 */
.board {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  z-index: 1;
  display: flex;
  gap: 8px;
  min-height: 80px;
  align-items: center;
}

/* ---------- 座位 ---------- */
.seat {
  position: absolute;
  width: 116px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(8, 20, 14, .82);
  border: 1px solid rgba(255, 255, 255, .10);
  text-align: center;
  transition: border-color .2s, box-shadow .2s, opacity .2s;
}
.seat.is-turn {
  border-color: var(--gold-bright);
  box-shadow: 0 0 16px rgba(212, 175, 55, .5);
}
.seat.is-folded { opacity: .45; }
.seat.is-winner {
  border-color: #4ade80;
  box-shadow: 0 0 18px rgba(74, 222, 128, .5);
}

.seat .pk-name {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat .pk-pos {
  color: var(--gold);
  font-size: 10px;
  letter-spacing: .06em;
}
.seat .pk-stack { color: var(--text-dim); font-size: 12px; margin-top: 1px; }
.seat .pk-commit {
  color: var(--gold-bright);
  font-size: 11px;
  margin-top: 1px;
  min-height: 13px;
}
.seat .pk-cards {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 3px;
  min-height: 0;
}
/* 座位内的牌用更小的尺寸，减少占位 */
.seat .card.mini { width: 30px; height: 44px; }
.seat .card.mini .center-suit { font-size: 15px; }
.seat .card.mini .corner { font-size: 8px; min-width: 12px; }
.seat .card.mini[data-rank="10"] .corner { font-size: 7px; min-width: 13px; }
.seat .card.mini .corner .suit { font-size: 7px; margin-top: 0; }
.seat .pk-folded-tip {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 4px;
}
.seat .pk-win {
  color: #4ade80;
  font-size: 12px;
  font-weight: 700;
  margin-top: 3px;
}

/* 6 座坐标：slot-0 自己(下) slot-1 右下 slot-2 左下 slot-3 上(对面) slot-4 左上 slot-5 右上
   左右两侧的座位纵向错开，避免相互压叠 */
#seat-0 { left: 50%; bottom: -20px; transform: translateX(-50%); }
#seat-1 { right: 1%; bottom: 2%; }
#seat-2 { left: 1%;   bottom: 2%; }
#seat-3 { left: 50%; top: 2%; transform: translateX(-50%); }
#seat-4 { left: 1%;   top: 2%; }
#seat-5 { right: 1%;  top: 2%; }

/* ---------- 我的底牌 ---------- */
.my-info {
  max-width: 1100px;
  margin: 40px auto 0;
  text-align: center;
}
.my-hole {
  display: flex;
  gap: 10px;
  justify-content: center;
  min-height: 80px;
  align-items: flex-end;
}
.my-hand-label {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

/* ---------- 牌面（独立定义，不叠牌） ---------- */
.card {
  position: relative;
  flex-shrink: 0;
  width: 54px;
  height: 80px;
  margin-left: 0;               /* ★ 德州不叠牌 */
  border-radius: 7px;
  border: 1px solid #b9b0a0;
  background: var(--card-bg);
  color: var(--black);
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .45);
  display: flex;                 /* ★ 缺这行大花色无法居中 */
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card.red { color: var(--red); }

.card .corner {
  position: absolute;
  font-size: 14px;
  line-height: 1.05;
  text-align: center;
  font-weight: 700;
  min-width: 22px;               /* ★ 两位数(10)也要放得下 */
}
/* 两位数时字号收一点，避免撑破卡牌 */
.card[data-rank="10"] .corner { font-size: 12px; min-width: 24px; }
.card .corner .suit { display: block; font-size: 12px; margin-top: 1px; }
.card .corner.tl { top: 4px; left: 4px; }
.card .corner.br { bottom: 4px; right: 4px; transform: rotate(180deg); }
.card .center-suit { font-size: 30px; line-height: 1; }

.card.mini { width: 42px; height: 62px; }
.card.mini .center-suit { font-size: 22px; }
.card.mini .corner { font-size: 11px; min-width: 17px; }
.card.mini[data-rank="10"] .corner { font-size: 10px; min-width: 19px; }
.card.mini .corner .suit { font-size: 10px; }

.card.back {
  background: repeating-linear-gradient(45deg, #2a3a30 0 5px, #1f2c25 5px 10px);
  border: 1px solid var(--gold-dim);
}

.card.dim { opacity: .4; filter: grayscale(.75); }

/* 最佳 5 张高亮 */
.card.hi {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0, 0, 0, .5);
}
.card.hi::after {
  content: "";
  position: absolute;
  left: 5px; right: 5px; bottom: -1px; height: 3px;
  background: var(--gold-bright);
  border-radius: 2px;
}

/* 位置角标 */
.pk-badge {
  position: absolute;
  top: -9px; left: 50%;
  transform: translateX(-50%);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: #20242b;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  white-space: nowrap;
}

/* ---------- 动作按钮 ---------- */
#actions {
  max-width: 1100px;
  margin: 16px auto 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}
#actions button {
  min-width: 112px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}
#actions button:disabled { opacity: .3; cursor: not-allowed; }
#actions button[data-act="fold"]  { background: #7d2b28; border-color: #a54440; }
#actions button[data-act="fold"]:hover  { background: #96332f; }
#actions button[data-act="check"] { background: #33475e; border-color: #46617f; }
#actions button[data-act="check"]:hover{ background: #3d5672; }
#actions button[data-act="call"]  { background: #1f6f8c; border-color: #2b8aa8; }
#actions button[data-act="call"]:hover { background: #2685a4; }
#actions button[data-act="raise"] { background: #2c7a4b; border-color: #3d9c60; }
#actions button[data-act="raise"]:hover{ background: #34915a; }

/* ---------- 加注面板 ---------- */
#raisePanel {
  max-width: 560px;
  margin: 12px auto 0;
  background: var(--panel);
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  padding: 14px 18px;
}
.raise-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.raise-row .preset {
  padding: 6px 12px;
  font-size: 13px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  cursor: pointer;
}
.raise-row .preset:hover { border-color: var(--gold); color: var(--gold-bright); }
.raise-slider { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.raise-slider input[type="range"] { flex: 1; accent-color: var(--gold); }
#raiseValue {
  min-width: 76px;
  text-align: right;
  color: var(--gold-bright);
  font-weight: 700;
  font-size: 15px;
}
.raise-actions { display: flex; gap: 8px; justify-content: center; }

/* ---------- 顶栏动作 ---------- */
#top-actions {
  max-width: 1100px;
  margin: 16px auto 0;
  text-align: center;
}
#quickChatMenu {
  max-width: 320px;
  margin: 10px auto 0;
  background: var(--panel);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 8px;
}
#quickChatMenu .quick-item {
  text-align: center;
  padding: 8px;
  cursor: pointer;
  border-radius: 5px;
  font-size: 13px;
}
#quickChatMenu .quick-item:hover { background: var(--bg2); color: var(--gold-bright); }

#statusText {
  max-width: 1100px;
  margin: 12px auto 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  min-height: 18px;
}

/* ---------- 结算 ---------- */
#result {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .68);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
}
.result-panel { width: 340px; max-width: 92vw; }
#resultBody { color: var(--text-dim); font-size: 14px; line-height: 1.9; margin-bottom: 10px; text-align: left; }
#resultBody .r-line { display: flex; justify-content: space-between; gap: 10px; }
#resultBody .r-win { color: #4ade80; }
#resultBody .r-lose { color: var(--red); }
#resultBody .r-pot { color: var(--gold-bright); margin-top: 8px; }

/* ---------- 提示 ---------- */
#toast {
  position: fixed;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--gold);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 99;
}
#toast.show { opacity: 1; }
#toast.error { border-color: var(--red); color: #e57373; }

.hidden { display: none !important; }

/* ---------- 移动端 ---------- */
@media (max-width: 760px) {
  .felt { height: min(52vh, 400px); border-width: 5px; }
  .seat { width: 96px; padding: 4px; }
  .seat .pk-name { font-size: 11px; }
  .card { width: 42px; height: 62px; }
  .card .center-suit { font-size: 22px; }
  .card .corner { font-size: 11px; min-width: 17px; }
  .card[data-rank="10"] .corner { font-size: 10px; min-width: 19px; }
  .card .corner .suit { font-size: 10px; }
  .board { gap: 4px; min-height: 64px; }
  #actions button { min-width: 84px; padding: 10px 12px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}