/* ============================================================
   POKERFUN 德州扑克 · 第一人称沉浸牌桌（holdem.js 配套样式）
   场景图 art/table_scene.webp / 荷官 art/dealer.webp 缺失时
   自动回退为纯 CSS 绿毡场景，游戏不受影响
   ============================================================ */

.hd-stage {
  position: relative;
  width: 100%;
  min-height: clamp(620px, 88vh, 860px);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.28);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65), inset 0 0 120px rgba(0, 0, 0, 0.4);
  background-color: #0a1a10;
  background-image:
    url('art/table_scene.webp'),
    radial-gradient(90% 70% at 50% 38%, #1c5433 0%, #123c22 45%, #071510 100%);
  background-size: cover, cover;
  background-position: center 30%, center;
  user-select: none;
}

/* 灯光：顶部聚光锥 + 四周暗角 + 底部收暗（保证 UI 可读） */
.hd-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(60% 46% at 50% 40%, rgba(255, 214, 130, 0.10), transparent 70%),
    radial-gradient(120% 100% at 50% 50%, transparent 52%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 22%, transparent 62%, rgba(2, 6, 4, 0.72) 100%);
}

/* 空气中的浮尘光斑 */
.hd-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 24% 22%, rgba(255, 226, 160, 0.35), transparent 60%),
    radial-gradient(1.5px 1.5px at 62% 14%, rgba(255, 226, 160, 0.25), transparent 60%),
    radial-gradient(2px 2px at 78% 30%, rgba(255, 226, 160, 0.2), transparent 60%);
  animation: hd-dust 14s ease-in-out infinite alternate;
}

@keyframes hd-dust {
  from { transform: translateY(0); opacity: 0.7; }
  to   { transform: translateY(14px); opacity: 1; }
}

/* ---------- 荷官 ---------- */
.hd-dealer {
  position: absolute;
  top: 1.5%;
  left: 50%;
  height: 46%;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 98%);
  mask-image: linear-gradient(180deg, #000 72%, transparent 98%);
  filter: drop-shadow(0 8px 30px rgba(0, 0, 0, 0.6));
  animation: hd-breathe 5s ease-in-out infinite;
}

@keyframes hd-breathe {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(4px); }
}

.hd-dealer-tag {
  position: absolute;
  top: 3%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: rgba(232, 207, 122, 0.75);
  background: rgba(6, 12, 8, 0.55);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  pointer-events: none;
}

/* ---------- 对手席位 ---------- */
.hd-seat {
  position: absolute;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 148px;
  transition: filter 0.4s;
}

.hd-seat.folded, .hd-me.folded { filter: grayscale(0.9) brightness(0.55); }

.seat-ai0 { left: 4%; top: 30%; }
.seat-ai1 { left: 66%; top: 15%; }
.seat-ai2 { right: 4%; top: 30%; }

.hd-av {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(212, 175, 55, 0.5);
  background: radial-gradient(circle at 35% 30%, #2c8a4f, #123c22);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.hd-av img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hd-av i {
  font-style: normal;
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--gold-soft, #e8cf7a);
}

/* 行动中：金圈呼吸 */
.hd-seat.acting .hd-av,
.hd-me.acting .hd-me-av {
  border-color: #ffd76e;
  box-shadow: 0 0 0 3px rgba(255, 215, 110, 0.35), 0 0 30px rgba(255, 215, 110, 0.5);
  animation: hd-acting 1.1s ease-in-out infinite;
}

@keyframes hd-acting {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 215, 110, 0.35), 0 0 26px rgba(255, 215, 110, 0.45); }
  50%      { box-shadow: 0 0 0 5px rgba(255, 215, 110, 0.5), 0 0 40px rgba(255, 215, 110, 0.7); }
}

.hd-seat.winner .hd-av {
  border-color: #ffd76e;
  box-shadow: 0 0 0 4px rgba(255, 215, 110, 0.5), 0 0 46px rgba(255, 215, 110, 0.8);
}

.hd-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.3rem 0.9rem;
  border-radius: 10px;
  background: rgba(6, 12, 8, 0.72);
  border: 1px solid rgba(212, 175, 55, 0.22);
  backdrop-filter: blur(4px);
}

.hd-meta b {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #ece7db;
  white-space: nowrap;
}

.hd-stack {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  color: var(--gold-soft, #e8cf7a);
}

.hd-stack::before { content: '⛁ '; font-size: 0.7em; }

/* 庄家钮 */
.hd-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 5;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: none;
  place-items: center;
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  font-weight: 700;
  color: #143020;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #d4af37);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.hd-badge.on { display: grid; }

/* 对手底牌 */
.hd-cards {
  display: flex;
  gap: 4px;
  min-height: 58px;
}

/* 行动气泡 */
.hd-bubble {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  z-index: 6;
  padding: 0.26rem 0.85rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: #1a0f04;
  background: linear-gradient(120deg, #f4e2a5, #d4af37);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.hd-bubble.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hd-bubble.fold { background: linear-gradient(120deg, #8b8b8b, #5a5a5a); color: #eee; }
.hd-bubble.allin { background: linear-gradient(120deg, #ff9a6e, #c23838); color: #fff; }
.hd-bubble.think { background: rgba(6, 12, 8, 0.85); color: #b6b0a4; border: 1px solid rgba(212, 175, 55, 0.25); }

/* ---------- 席前注码 ---------- */
.hd-bet {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 24px;
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  color: #ffe9a8;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.3s;
}

.hd-bet.show { opacity: 1; }

.hd-chipstack {
  display: flex;
  flex-direction: column-reverse;
  gap: 0;
}

.hd-chip {
  width: 20px;
  height: 7px;
  border-radius: 999px;
  margin-top: -3px;
  border: 1px solid rgba(0, 0, 0, 0.5);
  background: repeating-linear-gradient(90deg, var(--c, #c23838) 0 4px, #f5efe0 4px 6px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ---------- 公共区（公共牌 + 彩池 + 街名） ---------- */
.hd-center {
  position: absolute;
  left: 50%;
  top: 42.5%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.hd-center-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hd-street {
  font-size: 0.66rem;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: rgba(232, 207, 122, 0.85);
  background: rgba(6, 12, 8, 0.55);
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 999px;
  padding: 0.22rem 1rem;
}

.hd-board {
  display: flex;
  gap: 8px;
  min-height: 92px;
}

.hd-board .hd-slot {
  width: 62px;
  height: 88px;
  border-radius: 8px;
  border: 1px dashed rgba(232, 207, 122, 0.28);
  background: rgba(0, 0, 0, 0.18);
}

.hd-pot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: #ffe9a8;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  padding: 0.3rem 1.1rem;
  border-radius: 999px;
  background: rgba(6, 12, 8, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.hd-pot.bump { animation: hd-pot-bump 0.45s var(--ease-out, ease); }

@keyframes hd-pot-bump {
  30% { transform: scale(1.12); }
}

/* ---------- 扑克牌 ---------- */
.hd-card {
  position: relative;
  width: 62px;
  height: 88px;
  perspective: 500px;
  opacity: 0;
  transform: translate(var(--fx, 0), var(--fy, -220px)) rotate(var(--fr, -8deg)) scale(0.7);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.35s;
}

.hd-card.in { opacity: 1; transform: none; }

.hd-card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(180deg);
  transition: transform 0.45s cubic-bezier(0.3, 0.7, 0.4, 1);
}

.hd-card.up .hd-card-inner { transform: rotateY(0); }

.hd-face, .hd-back {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  backface-visibility: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.hd-face {
  background: linear-gradient(160deg, #fdfaf2, #efe9da);
  border: 1px solid #cfc8b8;
  color: #14100a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: 'Cinzel', 'Noto Serif SC', serif;
  font-weight: 700;
}

.hd-face .r { font-size: 1.25rem; line-height: 1; }
.hd-face .s { font-size: 1.05rem; line-height: 1; }
.hd-face.red { color: #b52a34; }

.hd-face::before, .hd-face::after {
  content: attr(data-c);
  position: absolute;
  font-size: 0.58rem;
  line-height: 1.1;
  white-space: pre;
  text-align: center;
}

.hd-face::before { top: 4px; left: 5px; }
.hd-face::after { bottom: 4px; right: 5px; transform: rotate(180deg); }

.hd-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 50% 50%, rgba(232, 207, 122, 0.25) 0 2px, transparent 2.5px) 0 0 / 10px 10px,
    linear-gradient(140deg, #1d6338, #123c22);
  border: 2px solid rgba(232, 207, 122, 0.45);
}

/* 对手小牌 */
.hd-cards .hd-card { width: 40px; height: 56px; --fy: -120px; }
.hd-cards .hd-face .r { font-size: 0.85rem; }
.hd-cards .hd-face .s { font-size: 0.72rem; }
.hd-cards .hd-face::before, .hd-cards .hd-face::after { display: none; }

/* 摊牌高亮成牌 */
.hd-card.hot .hd-face {
  box-shadow: 0 0 0 2px #ffd76e, 0 0 22px rgba(255, 215, 110, 0.8);
}

.hd-card.dim { opacity: 0.45; }

/* ---------- 我的席位（第一人称） ---------- */
.hd-me {
  position: absolute;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.hd-mycards {
  display: flex;
  min-height: 122px;
}

.hd-mycards .hd-card {
  width: 86px;
  height: 120px;
  --fy: -320px;
}

.hd-mycards .hd-card:first-child { transform-origin: bottom right; }
.hd-mycards .hd-card:last-child { transform-origin: bottom left; margin-left: -18px; }
.hd-mycards .hd-card.in:first-child { transform: rotate(-6deg); }
.hd-mycards .hd-card.in:last-child { transform: rotate(6deg) translateY(2px); }
.hd-mycards .hd-face .r { font-size: 1.7rem; }
.hd-mycards .hd-face .s { font-size: 1.4rem; }

.hd-me-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.hd-me-av {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid rgba(212, 175, 55, 0.5);
  background: radial-gradient(circle at 35% 30%, #57c584, #164a2c);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}

.hd-me .hd-bubble { top: auto; bottom: calc(100% + 6px); }
.hd-me .hd-bet { position: absolute; top: -34px; left: 50%; transform: translateX(-50%); }

.hd-me .hd-badge { position: static; display: none; }
.hd-me .hd-badge.on { display: grid; }

.hd-hint {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: #cfc9bd;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  min-height: 1em;
}

/* ---------- 行动条 ---------- */
.hd-actions {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
  background: rgba(6, 12, 8, 0.82);
  border: 1px solid rgba(212, 175, 55, 0.35);
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6);
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.3s;
}

.hd-actions.on { opacity: 1; pointer-events: auto; }

.hd-act {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.72rem 1.6rem;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.hd-act:hover { transform: translateY(-2px); filter: brightness(1.1); }
.hd-act:active { transform: translateY(0); }

.hd-act-fold { background: #2a2724; color: #b6b0a4; border: 1px solid #4a453e; }
.hd-act-check { background: linear-gradient(120deg, #46b171, #1d6338); color: #eafff2; box-shadow: 0 8px 24px rgba(44, 138, 79, 0.4); }
.hd-act-raise { background: linear-gradient(120deg, #f4e2a5, #d4af37); color: #1a0f04; box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4); }

/* 加注面额浮层 */
.hd-raise-pop {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: 14px;
  background: rgba(6, 12, 8, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

.hd-raise-pop.on { display: flex; }

.hd-raise-opt {
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.08);
  color: #ffe9a8;
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.hd-raise-opt:hover { background: rgba(212, 175, 55, 0.25); transform: translateY(-2px); }
.hd-raise-opt b { display: block; font-family: 'Cinzel', serif; font-size: 0.86rem; }
.hd-raise-opt.ai { border-color: rgba(194, 56, 56, 0.6); color: #ffb3a8; }

/* ---------- 结果横幅 / 开局遮罩 ---------- */
.hd-banner {
  position: absolute;
  left: 50%;
  top: 37%;
  transform: translateX(-50%) scale(0.8);
  z-index: 8;
  padding: 0.8rem 2.2rem;
  border-radius: 14px;
  font-family: 'Noto Serif SC', serif;
  font-size: clamp(1.1rem, 2.6vw, 1.6rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  white-space: nowrap;
  color: #ffe9a8;
  background: rgba(6, 12, 8, 0.88);
  border: 1px solid rgba(212, 175, 55, 0.5);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 60px rgba(212, 175, 55, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.hd-banner.show { opacity: 1; transform: translateX(-50%) scale(1); }
.hd-banner.lose { color: #cfc9bd; }

.hd-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  background: rgba(4, 9, 6, 0.72);
  backdrop-filter: blur(6px);
  transition: opacity 0.5s;
}

.hd-overlay.off { opacity: 0; pointer-events: none; }

.hd-overlay h2 {
  font-family: 'Noto Serif SC', serif;
  font-weight: 900;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  letter-spacing: 0.16em;
  color: #ece7db;
}

.hd-overlay h2 em { font-style: normal; color: var(--gold-soft, #e8cf7a); }

.hd-overlay p {
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: #b6b0a4;
  text-align: center;
  line-height: 2;
}

.hd-sit {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 1rem 3rem;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #1a0f04;
  background: linear-gradient(120deg, #f4e2a5, #d4af37 55%, #a8842a);
  box-shadow: 0 14px 44px rgba(212, 175, 55, 0.45);
  transition: transform 0.25s, box-shadow 0.25s;
}

.hd-sit:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 20px 60px rgba(212, 175, 55, 0.6); }
.hd-sit:disabled { filter: grayscale(0.7); cursor: not-allowed; }

/* 下一局按钮 */
.hd-next {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translateX(-50%);
  z-index: 8;
  display: none;
  border: 1px solid rgba(212, 175, 55, 0.5);
  background: rgba(6, 12, 8, 0.88);
  color: #ffe9a8;
  border-radius: 999px;
  padding: 0.7rem 2rem;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s;
}

.hd-next.on { display: block; }
.hd-next:hover { background: rgba(212, 175, 55, 0.2); transform: translateX(-50%) translateY(-2px); }

/* 飞行筹码 */
.hd-fly {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  transition: transform 0.55s cubic-bezier(0.3, 0.7, 0.3, 1), opacity 0.55s;
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .hd-stage { min-height: 640px; border-radius: 14px; }
  .hd-seat { width: 108px; }
  .seat-ai0 { left: 1%; top: 27%; }
  .seat-ai2 { right: 1%; top: 27%; }
  .seat-ai1 { left: 60%; top: 13%; }
  .hd-av { width: 50px; height: 50px; }
  .hd-meta b { font-size: 0.62rem; }
  .hd-center { top: 42%; }
  .hd-board { gap: 5px; }
  .hd-board .hd-slot, .hd-board .hd-card { width: 46px; height: 66px; }
  .hd-board .hd-face .r { font-size: 0.95rem; }
  .hd-board .hd-face .s { font-size: 0.8rem; }
  .hd-mycards .hd-card { width: 68px; height: 96px; }
  .hd-me { bottom: 88px; }
  .hd-act { padding: 0.62rem 1.1rem; font-size: 0.82rem; }
  .hd-dealer { height: 38%; }
}

@media (prefers-reduced-motion: reduce) {
  .hd-stage::after, .hd-dealer, .hd-bubble, .hd-card, .hd-card-inner { animation: none; transition: none; }
  .hd-card { opacity: 1; transform: none; }
}
