/* ===== 牌桌 / 纸牌 / 座位 / 动画 ===== */

/* ---- 顶栏 ---- */
.g-top {
  height: 52px; flex: none; z-index: 6;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 12px;
  background: linear-gradient(180deg, rgba(8, 12, 24, .92), rgba(8, 12, 24, .4));
  border-bottom: 1px solid var(--line);
}
.g-info {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  font-size: 13px; color: var(--txt2);
  background: rgba(0, 0, 0, .3); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 20px;
}
.g-info b { color: var(--gold2); font-variant-numeric: tabular-nums; }
.g-wild-badge {
  font-size: 11px; font-weight: 800; color: #4a3200;
  background: linear-gradient(180deg, #f7dc8a, #d9ac3d);
  padding: 2px 9px; border-radius: 10px;
}
.g-top-right { display: flex; gap: 8px; }

/* ---- 牌桌主体 ---- */
.g-table {
  position: relative; flex: 1; overflow: hidden;
  background:
    radial-gradient(130% 100% at 50% -10%, rgba(63, 141, 106, .28), transparent 55%),
    radial-gradient(120% 120% at 50% 115%, rgba(0, 0, 0, .55), transparent 60%),
    linear-gradient(180deg, #17452f 0%, #123726 45%, #0c281b 100%);
}
.g-table::before {
  content: ""; position: absolute; inset: 10px;
  border: 1px solid rgba(232, 193, 90, .14);
  border-radius: 26px;
  pointer-events: none;
}
.g-table::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 6px);
}

/* 底牌区 */
.g-bottom-cards {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 5px; z-index: 3;
}
.bc-label { font-size: 11px; color: rgba(233, 238, 247, .55); letter-spacing: .3em; text-indent: .3em; }
.bc-cards { display: flex; gap: 6px; perspective: 500px; }
.bc-cards .pcard { --cw: clamp(38px, 4.6vmin, 54px); }
.bc-cards .pcard.flip { animation: cardFlip .5s ease; }
@keyframes cardFlip { from { transform: rotateY(90deg); } to { transform: none; } }

/* ---- 座位 ---- */
.seat { position: absolute; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.seat-left { top: 86px; left: 16px; }
.seat-right { top: 86px; right: 16px; }
.seat .ava-frame { width: 58px; height: 58px; position: relative; }
.seat-turn .ava-frame { box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(232, 193, 90, .55); }
.seat-name {
  display: flex; align-items: center; gap: 6px; max-width: 108px;
  font-size: 12px; font-weight: 700; color: rgba(233, 238, 247, .92);
  background: rgba(0, 0, 0, .34); padding: 3px 9px; border-radius: 10px;
}
.seat-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 64px; }
.seat-cnt {
  min-width: 22px; text-align: center;
  background: rgba(232, 193, 90, .18); color: var(--gold2);
  border-radius: 8px; padding: 0 5px; font-variant-numeric: tabular-nums;
  font-size: 12px; line-height: 18px;
}
.crown-badge {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%) rotate(-8deg);
  width: 30px; height: 22px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5));
  animation: crownIn .45s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes crownIn { from { transform: translateX(-50%) translateY(-16px) scale(.4); opacity: 0; } }

/* 计时环 */
.timer-ring {
  position: absolute; inset: -4px; border-radius: 50%; z-index: 2;
  background: conic-gradient(var(--gold) calc(var(--p, 0) * 1%), transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%);
  mask: radial-gradient(circle, transparent 62%, #000 64%);
  opacity: 0; transition: opacity .2s;
}
.timer-ring.on { opacity: 1; }

/* 说话气泡 */
.seat-bubble {
  position: absolute; z-index: 7;
  background: linear-gradient(180deg, #fffdf4, #f3e9c8);
  color: #4a3a10; font-size: 13px; font-weight: 700;
  padding: 7px 13px; border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  white-space: nowrap; pointer-events: none;
  opacity: 0; transform: scale(.6);
}
.seat-bubble.show { animation: bubblePop 2.6s ease forwards; }
@keyframes bubblePop {
  0% { opacity: 0; transform: scale(.6); }
  10% { opacity: 1; transform: scale(1.05); }
  16% { transform: scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-8px); }
}
.bubble-left { left: calc(100% + 10px); top: 12px; }
.bubble-right { right: calc(100% + 10px); top: 12px; }
.bubble-me { left: 50%; bottom: calc(100% + 12px); transform-origin: bottom center; }

/* ---- 出牌展示区 ---- */
.pz {
  position: absolute; z-index: 3;
  display: flex; align-items: center; min-height: calc(var(--cw) * 1.42);
  --cw: clamp(38px, 4.8vmin, 58px);
}
.pz-left { left: 130px; top: 44%; transform: translateY(-50%); }
.pz-right { right: 130px; top: 44%; transform: translateY(-50%); flex-direction: row-reverse; }
.pz-me { left: 50%; bottom: 208px; transform: translateX(-50%); }
.pz .pcard { margin-left: calc(var(--cw) * -0.55); animation: playIn .3s cubic-bezier(.2, 1.3, .4, 1); }
.pz .pcard:first-child { margin-left: 0; }
.pz-right .pcard { margin-left: 0; margin-right: calc(var(--cw) * -0.55); }
.pz-right .pcard:last-child { margin-right: 0; }
@keyframes playIn {
  from { transform: translateY(26px) scale(.85); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.pz-clear { animation: pzFade .3s ease forwards; }
@keyframes pzFade { to { opacity: 0; transform: translateY(-14px); } }

/* ---- 我的信息 ---- */
.g-me-info {
  position: absolute; left: 16px; bottom: 16px; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.g-me-info .ava-frame { width: 58px; height: 58px; position: relative; }
.g-me-info.turn .ava-frame { box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(232, 193, 90, .55); }

/* 高倍场标识（牌桌信息栏） */
.g-high-badge {
  display: inline-block; padding: 2px 10px; border-radius: 9px;
  background: linear-gradient(180deg, #e0524d, #b23a36); color: #fff;
  font-size: 12px; font-weight: 900; letter-spacing: .1em;
  box-shadow: 0 0 12px rgba(224, 82, 77, .5);
}

/* ---- 手牌 ---- */
/* 手牌加大（需求：增大手牌显示尺寸，提升辨识度）：桌面区 --cw 提升约 17% */
.g-table { --cw: clamp(56px, 7.8vmin, 92px); }
.g-hand {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%);
  z-index: 5; display: flex; justify-content: center;
  max-width: 96vw;
  touch-action: none; /* 拖选多牌时禁止页面滚动 */
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
/* 拖选操作引导 */
.hand-hint {
  position: absolute; left: 50%; bottom: calc(84px + var(--cw) * 1.42 + 6px); transform: translateX(-50%);
  z-index: 6; pointer-events: none; white-space: nowrap;
  padding: 6px 16px; border-radius: 999px; font-size: 12.5px; color: var(--gold2);
  background: rgba(10, 15, 28, .72); border: 1px solid rgba(232, 193, 90, .35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
  animation: hintFloat 2.2s ease-in-out infinite;
  transition: opacity .4s;
}
.hand-hint.hide { opacity: 0; }
@keyframes hintFloat { 50% { transform: translateX(-50%) translateY(-5px); } }
.hwrap { display: flex; padding-top: 30px; }
.hcard {
  width: var(--cw); height: calc(var(--cw) * 1.42); flex: none;
  margin-left: calc(var(--cw) * -0.60);
  transform: translateY(var(--ty, 0px)) rotate(var(--rot, 0deg));
  transition: transform .16s ease, filter .16s ease;
  cursor: pointer;
  transform-origin: 50% 100%;
}
.hcard:first-child { margin-left: 0; }
.hcard:hover { filter: brightness(1.08); }
.hcard.sel {
  transform: translateY(calc(var(--ty, 0px) - 26px)) rotate(var(--rot, 0deg));
  outline: 2.5px solid var(--gold); outline-offset: -2.5px; border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(232, 193, 90, .55), 0 10px 22px rgba(0, 0, 0, .45), 0 0 18px rgba(232, 193, 90, .35);
  filter: brightness(1.07) saturate(1.08);
}
.hcard.dealt { animation: handDeal .38s cubic-bezier(.2, 1.2, .4, 1) backwards; }
@keyframes handDeal {
  from { transform: translateY(-40vh) rotate(20deg) scale(.6); opacity: 0; }
}
.hcard.new-bottom { animation: bottomIn .5s cubic-bezier(.2, 1.4, .4, 1); outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 8px; }
@keyframes bottomIn { from { transform: translateY(-80px) scale(1.2); opacity: .3; } }

/* ---- 操作区 ---- */
.g-actions {
  position: absolute; left: 50%; bottom: calc(84px + var(--cw) * 1.42 + 26px);
  transform: translateX(-50%); z-index: 6;
  display: flex; gap: 14px; align-items: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, bottom .2s;
}
.g-actions.on { opacity: 1; pointer-events: auto; }
.act-bid { display: flex; gap: 12px; }

/* 出牌/叫分按钮旁的倒计时徽标 */
.act-count {
  min-width: 34px; height: 34px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  border: 2px solid var(--gold-dk);
  color: var(--gold2); font-size: 16px; font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
.act-count.low {
  border-color: var(--red); color: #ff9c9c;
  animation: actLow 1s infinite;
}
@keyframes actLow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 82, 77, .45); }
  50% { box-shadow: 0 0 0 7px rgba(224, 82, 77, 0); }
}

/* 快捷短语 */
.g-chatbar {
  position: absolute; right: 12px; bottom: 16px; z-index: 5;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.g-chatbar .chat-pop {
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(10, 16, 30, .94); border: 1px solid var(--line2);
  border-radius: 12px; padding: 8px;
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: all .18s;
}
.g-chatbar.open .chat-pop { opacity: 1; pointer-events: auto; transform: none; }
.chat-pop button {
  font-size: 12px; color: var(--txt2); text-align: left;
  padding: 7px 12px; border-radius: 8px; white-space: nowrap;
}
.chat-pop button:hover { background: rgba(232, 193, 90, .12); color: var(--gold2); }
.chat-toggle {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(0, 0, 0, .4); border: 1px solid var(--line2);
  display: flex; align-items: center; justify-content: center; color: var(--txt2);
}
.chat-toggle:hover { color: var(--gold2); }

/* ---- 纸牌 ---- */
.pcard {
  width: var(--cw, 60px); height: calc(var(--cw, 60px) * 1.42);
  border-radius: calc(var(--cw, 60px) * .09);
  background: linear-gradient(160deg, #ffffff 0%, #f2f5fa 55%, #dfe6f0 100%);
  box-shadow: 0 2px 7px rgba(0, 0, 0, .38), inset 0 0 0 1px rgba(30, 40, 60, .08);
  position: relative; flex: none;
  color: #232c3d;
}
.pcard.red { color: #d0403a; }
.pcard .c-idx { position: absolute; top: 4.5%; left: 7%; line-height: 1; text-align: center; }
.pcard .c-idx b { display: block; font-size: calc(var(--cw) * .30); font-weight: 800; letter-spacing: -.03em; font-family: Georgia, "Times New Roman", serif; }
.pcard .c-idx i { display: block; font-style: normal; font-size: calc(var(--cw) * .22); margin-top: calc(var(--cw) * .02); }
.pcard .c-mid {
  position: absolute; right: 6%; bottom: 5%;
  font-size: calc(var(--cw) * .58); line-height: 1;
  opacity: .92;
}
.pcard .c-idx2 { position: absolute; bottom: 4.5%; right: 7%; transform: rotate(180deg); line-height: 1; text-align: center; }
.pcard .c-idx2 b { display: block; font-size: calc(var(--cw) * .30); font-weight: 800; font-family: Georgia, serif; }
.pcard .c-idx2 i { display: block; font-style: normal; font-size: calc(var(--cw) * .22); }

/* 王 */
.pcard.joker .c-jk {
  position: absolute; top: 5%; left: 8%;
  writing-mode: vertical-lr; letter-spacing: .1em;
  font-size: calc(var(--cw) * .17); font-weight: 900; line-height: 1.05;
}
.pcard.joker .c-mid { font-size: calc(var(--cw) * .5); right: 8%; bottom: 12%; }
.pcard.joker.big { color: #d0403a; }
.pcard.joker.small { color: #232c3d; }

/* 牌背 */
.pcard.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(232, 193, 90, .28) 0 18%, transparent 40%),
    repeating-linear-gradient(45deg, #1d3a63 0 6px, #22447a 6px 12px),
    linear-gradient(160deg, #24477c, #16294a);
  box-shadow: 0 2px 7px rgba(0, 0, 0, .45), inset 0 0 0 2px rgba(232, 193, 90, .25);
}
.pcard.back::after {
  content: "斗";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--cw) * .42); font-weight: 900;
  color: rgba(232, 193, 90, .85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

/*癞子牌 */
.pcard.wild {
  box-shadow: 0 2px 7px rgba(0, 0, 0, .38), 0 0 0 2px var(--gold), 0 0 14px rgba(232, 193, 90, .55);
}
.pcard.wild::before {
  content: "癞"; position: absolute; top: -5px; right: -5px; z-index: 2;
  width: calc(var(--cw) * .30); height: calc(var(--cw) * .30);
  border-radius: 50%;
  background: linear-gradient(180deg, #f7dc8a, #d9ac3d);
  color: #4a3200; font-size: calc(var(--cw) * .19); font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}

/* ---- 特效 ---- */
.fx-layer { position: absolute; inset: 0; z-index: 20; pointer-events: none; overflow: hidden; }
.g-table.shake { animation: tblShake .5s ease; }
@keyframes tblShake {
  10% { transform: translate(-7px, 4px); } 25% { transform: translate(6px, -5px); }
  40% { transform: translate(-5px, 3px); } 55% { transform: translate(4px, -2px); }
  70% { transform: translate(-3px, 2px); } 85% { transform: translate(2px, -1px); }
}
.fx-boom {
  position: absolute; left: 50%; top: 42%; width: 0; height: 0;
}
.fx-boom::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #fff7d0 0%, #f7b733 35%, #e0524d 65%, transparent 75%);
  animation: boomGrow .55s cubic-bezier(.1, .8, .3, 1) forwards;
}
.fx-boom::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px;
  transform: translate(-50%, -50%); border-radius: 50%;
  border: 3px solid rgba(255, 220, 130, .9);
  animation: boomRing .6s ease-out forwards;
}
@keyframes boomGrow { to { width: 240px; height: 240px; opacity: 0; } }
@keyframes boomRing { to { width: 320px; height: 320px; opacity: 0; } }
.fx-flash { position: absolute; inset: 0; background: rgba(255, 240, 200, .5); animation: flashOut .4s ease forwards; }
@keyframes flashOut { to { opacity: 0; } }

.fx-rocket-card {
  position: absolute; width: 54px; height: 76px; border-radius: 6px;
  animation: rocketFly .8s cubic-bezier(.5, 0, .8, .4) forwards;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
}
@keyframes rocketFly {
  from { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  to { transform: translate(70vw, -60vh) rotate(720deg) scale(.4); opacity: 0; }
}

.fx-banner {
  position: absolute; left: 0; right: 0; top: 34%; z-index: 22;
  text-align: center; font-size: clamp(30px, 6vmin, 52px); font-weight: 900;
  letter-spacing: .25em; text-indent: .25em;
  color: #fff; text-shadow: 0 0 24px rgba(232, 193, 90, .8), 0 4px 10px rgba(0, 0, 0, .6);
  animation: bannerIn 1.8s ease forwards;
}
.fx-banner.gold { background: linear-gradient(180deg, #fdf3d0, #f0c96a 60%, #cf9c2e); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(232, 193, 90, .7)); }
@keyframes bannerIn {
  0% { opacity: 0; transform: scale(2.2); }
  18% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.05) translateY(-10px); }
}

/* ---- 结算 ---- */
.g-settle {
  position: absolute; inset: 0; z-index: 30;
  background: rgba(4, 7, 14, .72); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.g-settle.show { opacity: 1; pointer-events: auto; }
.settle-panel {
  width: min(420px, 92vw);
  background: linear-gradient(175deg, var(--panel2), var(--panel) 70%);
  border: 1px solid var(--line2); border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 26px 24px; text-align: center;
  transform: translateY(20px) scale(.95); transition: transform .35s cubic-bezier(.2, 1.2, .4, 1);
}
.g-settle.show .settle-panel { transform: none; }
.settle-title { font-size: 34px; font-weight: 900; letter-spacing: .2em; text-indent: .2em; margin-bottom: 4px; }
.settle-title.win { color: var(--gold2); text-shadow: 0 0 24px rgba(232, 193, 90, .5); }
.settle-title.lose { color: #8fa2c4; }
.settle-sub { color: var(--txt3); font-size: 13px; margin-bottom: 18px; }
.settle-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.settle-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--txt2);
  background: rgba(0, 0, 0, .22); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: 10px;
}
.settle-row b { color: var(--txt); font-variant-numeric: tabular-nums; }
.settle-row.hl b { color: var(--gold2); font-size: 18px; }
.settle-delta { font-size: 26px; font-weight: 900; margin: 8px 0 18px; font-variant-numeric: tabular-nums; }
.settle-actions { display: flex; gap: 12px; justify-content: center; }
.settle-players { display: flex; justify-content: center; gap: 18px; margin-bottom: 14px; }
.sp-item { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--txt2); }
.sp-item .ava-frame { width: 46px; height: 46px; }
.sp-item .sp-delta { font-weight: 800; }
.sp-item.winner .nm { color: var(--gold2); }

/* ---- 响应式 ---- */
@media (max-width: 760px), (max-height: 560px) {
  .seat-left { top: 64px; left: 8px; }
  .seat-right { top: 64px; right: 8px; }
  .seat .ava-frame { width: 46px; height: 46px; }
  .pz-left { left: 66px; top: 40%; }
  .pz-right { right: 66px; top: 40%; }
  .pz-me { bottom: 168px; }
  .g-hand { bottom: 66px; }
  .hand-hint { bottom: calc(66px + var(--cw) * 1.42 + 8px); }
  .hcard { margin-left: calc(var(--cw) * -0.66); }
  .g-actions { bottom: calc(66px + var(--cw) * 1.42 + 18px); }
  .g-actions .btn { padding: 9px 16px; font-size: 14px; }
  .btn-play { min-width: 92px; font-size: 16px; }
  .g-me-info { left: 8px; bottom: 10px; }
  .g-me-info .ava-frame { width: 46px; height: 46px; }
  .g-chatbar { right: 8px; bottom: 10px; }
  .g-info { font-size: 11px; padding: 4px 10px; }
}
@media (max-width: 420px) {
  .hcard { margin-left: calc(var(--cw) * -0.72); }
  .pz-me { bottom: 156px; }
}
