/*
  path: public/game/texas/css/game.css
  description: 德州扑克牌桌样式：绿呢桌面、金色描边、程序化牌面与 21 点同款筹码底池、对手座位圈、
               加注滑杆面板与排行榜面板，响应式适配窄屏。
*/

:root {
  --felt-1: #14503c;
  --felt-2: #0a2b21;
  --felt-edge: #071f18;
  --gold: #d4af5f;
  --gold-dim: #9a7c3c;
  --ink: #f2ead8;
  --ink-dim: #b9c9b6;
  --red: #c0392b;
  --black: #1d2328;
  --card-w: clamp(46px, 10vmin, 84px);
  --card-h: calc(var(--card-w) * 1.4);
  --radius: 10px;
  font-size: clamp(14px, 1.9vmin, 17px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--felt-edge);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.arcade {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 12px 24px;
}

/* ---------- 顶栏与页脚（对齐站点小游戏壳子样式） ---------- */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 14px 4px 10px;
  border-bottom: 1px solid rgba(212, 175, 95, 0.25);
}
.masthead .brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.masthead .brand span { color: var(--gold-dim); font-weight: 400; }
.masthead .edition {
  color: var(--ink-dim);
  font-size: 0.8em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.masthead .edition i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  padding: 14px 4px 0;
  margin-top: 18px;
  border-top: 1px solid rgba(212, 175, 95, 0.25);
  color: var(--ink-dim);
  font-size: 0.78em;
}
footer a { color: var(--gold); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- 牌桌 ---------- */

.table {
  position: relative;
  margin-top: 14px;
  padding: 14px 14px 16px;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 50% 30%, var(--felt-1), var(--felt-2) 72%, var(--felt-edge));
  border: 2px solid rgba(212, 175, 95, 0.55);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), inset 0 0 60px rgba(0, 0, 0, 0.35);
}

.table-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-dim);
  font-size: 0.78em;
}
.table-top strong { color: var(--gold); font-variant-numeric: tabular-nums; }
.top-right { display: inline-flex; align-items: center; gap: 10px; }
.board-top-btn, #board-btn.board-top-btn {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--gold-dim);
  background: rgba(0, 0, 0, 0.28);
  color: var(--gold);
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
}
.board-top-btn:hover, #board-btn.board-top-btn:hover {
  border-color: var(--gold);
  filter: brightness(1.12);
}
.pad-badge {
  padding: 2px 8px;
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  color: var(--gold);
}

/* ---------- 对手座位 ---------- */

.opponents {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(6px, 2.2vmin, 22px);
  margin-top: 12px;
}
.seat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: calc(var(--card-w) * 1.85);
  /* 4 对手时略收，避免挤爆 */
  padding: 10px 8px 8px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  transition: border-color 0.2s, opacity 0.3s;
}
.seat.actor { border-color: rgba(212, 175, 95, 0.7); animation: seat-pulse 1.4s ease-in-out infinite; }
@keyframes seat-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 95, 0.25); }
  50% { box-shadow: 0 0 12px 2px rgba(212, 175, 95, 0.35); }
}
.seat.folded { opacity: 0.45; }
.seat.folded .avatar { filter: grayscale(1); }

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--card-w) * 0.92);
  height: calc(var(--card-w) * 0.92);
  border-radius: 50%;
  border: 2px solid var(--gold-dim);
  background: linear-gradient(180deg, #1b4a38, #123527);
  font-weight: 700;
  font-size: 0.95em;
  letter-spacing: 0.05em;
}
.seat-meta { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.78em; }
.seat-name { color: var(--ink-dim); }
.seat-name .style-tag { color: var(--gold-dim); font-size: 0.85em; }
.seat-chips { color: var(--gold); font-variant-numeric: tabular-nums; }
.seat-bet {
  min-height: 1.4em;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 0.78em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  border: 1px dashed var(--gold-dim);
}
.seat-bet:empty { border-color: transparent; }
.seat-cards { display: flex; perspective: 900px; }
.seat-cards .card { margin-left: calc(var(--card-w) * -0.45); width: calc(var(--card-w) * 0.62); height: calc(var(--card-w) * 0.62 * 1.4); }
.seat-cards .card:first-child { margin-left: 0; }
.seat-cards .card .corner { font-size: calc(var(--card-w) * 0.14); }
.seat-cards .card .pip { font-size: calc(var(--card-w) * 0.3); }

.dealer-btn {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  background: #f4efe2;
  color: var(--black);
  font-size: 0.72em;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}
.seat-state {
  min-height: 1.2em;
  font-size: 0.72em;
  color: var(--ink-dim);
  letter-spacing: 0.1em;
}
.seat-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 4px);
  transform: translateX(-50%);
  z-index: 6;
  max-width: 11em;
  padding: 5px 10px;
  border-radius: 12px 12px 12px 4px;
  border: 1px solid rgba(212, 175, 95, 0.55);
  background: rgba(10, 22, 16, 0.94);
  color: #f3e6c4;
  font-size: 0.72em;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  animation: bubble-pop 0.22s ease-out;
}
@keyframes bubble-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(4px) scale(0.92); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.result-badge {
  position: absolute;
  top: -10px;
  right: -6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72em;
  white-space: nowrap;
  background: var(--black);
  border: 1px solid var(--gold-dim);
  color: var(--ink);
  z-index: 2;
}
.result-badge.win { background: #1d4d2b; border-color: #7fd08a; color: #d6f5db; }
.result-badge.lose { background: #4d1d1d; border-color: #d07f7f; color: #f5d6d6; }

/* 摊牌牌型：挂在亮牌下方的游戏风牌匾 */
.hand-name-badge {
  display: inline-block;
  margin: 6px auto 0;
  padding: 3px 14px 4px;
  border-radius: 6px;
  border: 1.5px solid var(--gold);
  background:
    linear-gradient(180deg, rgba(212, 175, 95, 0.28), rgba(20, 14, 8, 0.92)),
    #1a120a;
  color: #ffe9b0;
  font-weight: 800;
  font-size: 0.78em;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-shadow: 0 0 10px rgba(212, 175, 95, 0.55), 0 1px 0 #000;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 230, 170, 0.25);
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}
.seat > .hand-name-badge {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.68em;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  padding: 2px 10px 3px;
}
.player-area > .hand-name-badge {
  display: block;
  width: fit-content;
  margin: 8px auto 0;
  font-size: 0.95em;
  letter-spacing: 0.36em;
  text-indent: 0.36em;
  padding: 5px 18px 6px;
}

/* ---------- 公共牌与底池 ---------- */

.board-area { margin-top: 14px; text-align: center; }
.board-cards {
  display: flex;
  justify-content: center;
  min-height: var(--card-h);
  perspective: 900px;
}
.board-cards .card { margin-left: 6px; }
.board-cards .card:empty-slot { border: 1.5px dashed rgba(212, 175, 95, 0.25); border-radius: var(--radius); }

.pot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.pot-chips {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: calc(var(--card-w) * 0.55);
  padding: 0 8px;
}
/* 与 21 点同款赌场筹码：虚线边 + 等距条纹 */
.chip {
  width: calc(var(--card-w) * 0.55);
  height: calc(var(--card-w) * 0.55);
  margin-left: calc(var(--card-w) * -0.18);
  border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, 0.75);
  color: #fff;
  font-weight: 700;
  font-size: 0.68em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-image:
    repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.16) 0deg 12deg, transparent 12deg 30deg),
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.14), transparent 60%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 0 0 3px rgba(0, 0, 0, 0.18);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  transform: translateY(calc(var(--i, 0) * -1px));
  pointer-events: none;
  user-select: none;
}
.pot-chips .chip:first-child { margin-left: 0; }
.chip.c10 { background-color: #2e6f4e; }
.chip.c50 { background-color: #1f3f77; }
.chip.c200 { background-color: #7a1f2e; }
.chip-fly-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  overflow: visible;
}
.chip.chip-fly {
  position: absolute;
  margin: 0;
  width: calc(var(--card-w) * 0.48);
  height: calc(var(--card-w) * 0.48);
  transform: translate(-50%, -50%);
  animation-name: chip-toss;
  animation-timing-function: cubic-bezier(0.2, 0.75, 0.25, 1);
  animation-fill-mode: forwards;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
  z-index: 31;
}
@keyframes chip-toss {
  0% { transform: translate(-50%, -50%) scale(0.85) rotate(-12deg); opacity: 0.95; }
  55% { transform: translate(calc(-50% + var(--dx) * 0.62), calc(-50% + var(--dy) * 0.55 - 28px)) scale(1.08) rotate(8deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.92) rotate(18deg); opacity: 0.2; }
}
.pot-label {
  display: inline-block;
  padding: 4px 16px;
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  color: var(--ink-dim);
  font-size: 0.85em;
}
.pot-label strong { color: var(--gold); font-variant-numeric: tabular-nums; }

.message {
  min-height: 1.6em;
  margin: 10px 0 0;
  text-align: center;
  color: var(--ink);
  font-size: 0.95em;
}

/* ---------- 玩家区 ---------- */

.player-area { position: relative; margin-top: 10px; text-align: center; }
.player-area > .result-badge { top: calc(var(--card-h) * -0.2); right: calc(50% - var(--card-w) * 1.6); }
.cards {
  display: flex;
  justify-content: center;
  min-height: var(--card-h);
  perspective: 900px;
}
.cards.big .card { margin-left: 8px; }
.hand-strength {
  min-height: 1.4em;
  margin-top: 6px;
  color: var(--gold);
  font-size: 0.85em;
  letter-spacing: 0.2em;
}

/* ---------- HUD ---------- */

.hud {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 4vmin, 40px);
  margin-top: 12px;
  text-align: center;
}
.hud div { min-width: 72px; }
.hud span {
  display: block;
  color: var(--ink-dim);
  font-size: 0.68em;
  letter-spacing: 0.12em;
}
.hud strong {
  font-size: 1.25em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* ---------- 牌面（程序化：角标 + 中央花色） ---------- */

.card {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--radius);
  transform-style: preserve-3d;
  transition: transform 0.35s ease;
}
.card.deal-in { animation: deal-in 0.32s ease backwards; animation-delay: calc(var(--i, 0) * 0.1s); }
@keyframes deal-in {
  from { opacity: 0; transform: translateY(calc(var(--card-h) * -0.6)) rotate(-4deg); }
  to { opacity: 1; transform: none; }
}

.card .face, .card .back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  backface-visibility: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}
.card .face {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fdfbf4, #ece5d4);
  color: var(--black);
  font-weight: 700;
}
.card.red .face { color: var(--red); }
.card .face .pip { font-size: calc(var(--card-w) * 0.5); line-height: 1; }
.card .corner {
  position: absolute;
  top: 4px; left: 6px;
  font-size: calc(var(--card-w) * 0.22);
  line-height: 1.1;
  text-align: center;
}
.card .corner.br { top: auto; left: auto; right: 6px; bottom: 4px; transform: rotate(180deg); }
.card .back {
  transform: rotateY(180deg);
  border: 3px solid #f4efe2;
  background:
    repeating-linear-gradient(45deg, #7a1f24 0 6px, #641a1e 6px 12px);
}
.card.hidden { transform: rotateY(180deg); }
.card.hidden.flip { transform: rotateY(0); }
.card.deal-in.hidden { animation-name: deal-hidden; }
@keyframes deal-hidden {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- 行动按钮与加注面板 ---------- */

.deal-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  min-height: 44px;
}
.deal-bar > #next-hand[hidden],
.deal-bar > #claim[hidden] {
  display: inline-flex !important;
  visibility: hidden;
  pointer-events: none;
}

.actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  /* 固定行动条高度：显隐时不要把牌桌挤变形 */
  min-height: 52px;
  align-items: center;
}
/* hidden 默认 display:none 会塌布局；行动条始终占位 */
.actions[hidden] {
  display: flex !important;
  visibility: hidden;
  pointer-events: none;
}
/* ALL IN 可单独隐，同样保宽，避免按钮数变化时换行跳动 */
.actions > #allin-btn[hidden] {
  display: inline-flex !important;
  visibility: hidden;
  pointer-events: none;
}

.actions button, button.primary {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--gold-dim);
  background: linear-gradient(180deg, #1b4a38, #123527);
  color: var(--ink);
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}
button.primary { border-color: var(--gold); color: #fff; }
button.primary:hover, .actions button:hover:not(:disabled) { filter: brightness(1.25); }
.actions .danger { border-color: #a0453c; background: linear-gradient(180deg, #4d1d1d, #351414); color: #f5d6d6; }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
kbd {
  font-family: inherit;
  font-size: 0.8em;
  opacity: 0.75;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  padding: 0 4px;
}

.raise-modal {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 14, 10, 0.78);
  border-radius: 22px;
}
.raise-card {
  width: min(440px, 100%);
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--gold-dim);
  background: linear-gradient(180deg, #0f3527, #0a2419);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.raise-card h2 { margin: 0; font-size: 1.1em; color: var(--gold); }
.raise-hint { margin: 0; color: var(--ink-dim); font-size: 0.85em; text-align: center; }
.raise-chips { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.raise-chips .chip {
  width: calc(var(--card-w) * 0.72);
  height: calc(var(--card-w) * 0.72);
  margin-left: 0;
  font-size: 0.9em;
  cursor: pointer;
  pointer-events: auto;
  transform: none;
}
.raise-chips .chip:hover { transform: translateY(-2px); }
.raise-chips .plain, #raise-clear {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 95, 0.5);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  font-size: 0.85em;
  cursor: pointer;
}
.raise-preview {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
  min-height: calc(var(--card-w) * 0.55);
  max-width: 100%;
  padding: 4px 8px;
}
.raise-preview .chip { pointer-events: none; }
.raise-presets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.raise-presets button {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 95, 0.5);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  font-size: 0.85em;
  cursor: pointer;
}
.raise-presets button:hover { border-color: var(--gold); }
.raise-presets .allin, .raise-presets #raise-allin {
  border-color: #e0a020;
  background: linear-gradient(180deg, #8a3a12, #5c240a);
  color: #ffe7b0;
  font-weight: 700;
}
.raise-presets .allin:hover, .raise-presets #raise-allin:hover { filter: brightness(1.12); }
.raise-modal input[type="range"] { width: 100%; accent-color: var(--gold); }
.raise-amount { font-size: 0.9em; color: var(--ink-dim); text-align: center; }
.raise-amount strong { color: var(--gold); font-variant-numeric: tabular-nums; font-size: 1.15em; }
.raise-buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.raise-buttons button, .actions .allin, #allin-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--gold-dim);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}
.actions .allin, #allin-btn, .raise-buttons .allin, #raise-allin {
  border-color: #e0a020;
  background: linear-gradient(180deg, #8a3a12, #5c240a);
  color: #ffe7b0;
}
.actions .allin:hover, #allin-btn:hover, #raise-allin:hover { filter: brightness(1.15); }

.table-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--ink-dim);
  font-size: 0.82em;
  min-height: 1.4em;
}
#claim, #next-hand {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--gold);
  cursor: pointer;
  font-weight: 600;
  transition: filter 0.15s, border-color 0.15s, color 0.15s;
}
#claim {
  background: #4d1d1d;
  color: #f5d6d6;
}
#next-hand {
  background: linear-gradient(180deg, #1b4a38, #123527);
  color: #fff;
}

/* ---------- 排行榜面板（与站点壳子菜单契约一致） ---------- */

.board-panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 14, 10, 0.86);
  border-radius: 22px;
}
.board-card {
  width: min(420px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--gold-dim);
  background: linear-gradient(180deg, #0f3527, #0a2419);
}
.board-card h2 { margin: 0 0 10px; font-size: 1.1em; color: var(--gold); }
.board-sub { color: var(--ink-dim); font-weight: 400; font-size: 0.75em; }
.board-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85em;
}
.board-list li {
  display: grid;
  grid-template-columns: 2em 1fr auto;
  gap: 4px 8px;
  padding: 6px 4px;
  border-bottom: 1px dashed rgba(212, 175, 95, 0.2);
}
.board-rank { color: var(--gold); }
.board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-score { font-variant-numeric: tabular-nums; }
.board-extra {
  grid-column: 1 / -1;
  color: var(--ink-dim);
  font-size: 0.9em;
}
.board-msg { min-height: 1.4em; margin: 8px 0 0; color: var(--ink-dim); font-size: 0.82em; }
.board-form { display: flex; gap: 8px; margin-top: 8px; }
.board-label { align-self: center; font-size: 0.85em; }
.board-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 95, 0.4);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ink);
}
.board-form button, .board-close {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--gold-dim);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  cursor: pointer;
}
.board-close { margin-top: 10px; width: 100%; }

/* ---------- 窄屏适配 ---------- */

@media (max-width: 560px) {
  .masthead .edition { display: none; }
  .hud { gap: 14px; }
  .actions button, button.primary { padding: 10px 13px; }
  .seat { min-width: 0; padding: 8px 5px 6px; }
}
