/* ============================================================
   斗地主前端白模样式（1280×720 逻辑舞台，JS 等比缩放）
   全部 CSS 绘制，不依赖图片；素材就绪后按注释替换即可。
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-user-select: none; }
html, body { width: 100%; height: 100%; background: #000; overflow: hidden; }
body { font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; }

.hidden { display: none !important; }

/* ---------- 舞台：QQ 风深绿呢面 + 金边（背景图占位，后续可换 assets/img/table-bg.jpg） ---------- */
#stage {
  position: absolute; left: 50%; top: 50%;
  width: 1280px; height: 720px;
  transform: translate(-50%, -50%);
  transform-origin: center;
  overflow: hidden;
  border: 6px solid #8a6a2f;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, .55), 0 0 40px rgba(0, 0, 0, .8);
  /* 背景层 1 为素材预留：图片缺失时自动落到层 2 的 CSS 渐变 */
  background-image:
    url("../assets/img/table-bg.jpg"),
    radial-gradient(120% 95% at 50% 28%, #35895a 0%, #1f6340 55%, #14452b 100%);
  background-size: cover, cover;
}
#stage::before { /* 金色内框装饰 */
  content: ""; position: absolute; inset: 10px; pointer-events: z-index;
  border: 2px solid rgba(214, 181, 106, .32); border-radius: 18px;
}

/* ---------- 顶部条：房间号 / 底牌 / 倍数 / 底分 ---------- */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 62px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px;
}
.chip {
  background: rgba(0, 0, 0, .45); border: 1px solid rgba(214, 181, 106, .45);
  color: #ffe9b3; border-radius: 14px; padding: 4px 14px; font-size: 15px;
  white-space: nowrap;
}
#topCenter { display: flex; align-items: center; gap: 18px; }
#bottomCards { display: flex; gap: 6px; }

/* ---------- 阶段提示 ---------- */
#phaseTip {
  position: absolute; top: 148px; left: 0; right: 0; z-index: 15;
  text-align: center; color: #ffe9b3; font-size: 19px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .8); pointer-events: none;
}

/* ---------- 座位（对手左右 + 自己左下） ---------- */
.seat { position: absolute; width: 170px; text-align: center; z-index: 18; }
#seat2 { left: 24px; top: 116px; }               /* 上家（左） */
#seat1 { right: 24px; top: 116px; }              /* 下家（右） */
#seat0 { left: 24px; bottom: 16px; width: 220px; text-align: left; z-index: 25; }

.avatar {
  position: relative; width: 88px; height: 88px; margin: 0 auto;
  border-radius: 14px; border: 3px solid #d6b56a;
  background: linear-gradient(160deg, #3b6ea5, #274b73);
  display: flex; align-items: center; justify-content: center;
  font-size: 50px; box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}
#seat0 .avatar { width: 72px; height: 72px; margin: 0; font-size: 40px; }
.seat.active .avatar {
  border-color: #ffd75e;
  box-shadow: 0 0 18px rgba(255, 215, 94, .85);
  animation: glow 1s ease-in-out infinite alternate;
}
@keyframes glow { from { box-shadow: 0 0 8px rgba(255, 215, 94, .5); } to { box-shadow: 0 0 22px rgba(255, 215, 94, .95); } }
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 11px; }

.mark { /* 地主帽/农民标记位：素材 img 缺失时显示 emoji */
  position: absolute; left: -16px; top: -16px; width: 36px; height: 36px;
  border-radius: 50%; background: #fffdf5; border: 2px solid #d6b56a;
  display: flex; align-items: center; justify-content: center; font-size: 20px; z-index: 2;
}
.mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }

.timer { /* 倒计时圆牌 */
  position: absolute; right: -12px; top: -10px; width: 32px; height: 32px;
  border-radius: 50%; background: #ffd75e; color: #5b3a00;
  border: 2px solid #fff; font-size: 15px; font-weight: 800; line-height: 29px;
  display: none; z-index: 2;
}
.seat.timer-on .timer { display: block; }

.pname { margin-top: 6px; color: #ffe9b3; font-size: 15px; text-shadow: 0 1px 2px #000; }
.pcount {
  display: inline-block; margin-top: 4px; background: rgba(0, 0, 0, .5);
  color: #fff; border-radius: 10px; padding: 1px 10px; font-size: 13px;
}
.trust {
  display: inline-block; margin-top: 4px; background: #a03428; color: #fff;
  font-size: 12px; border-radius: 8px; padding: 1px 8px;
  border: 1px solid #ff8a75;
}
.minibacks { position: relative; height: 52px; width: 110px; margin: 8px auto 0; }

/* ---------- 中央出牌区 ---------- */
.playzone { position: absolute; height: 118px; display: flex; align-items: center; z-index: 12; }
#play2 { left: 255px; top: 218px; }                              /* 上家出牌 */
#play1 { right: 255px; top: 218px; justify-content: flex-end; }  /* 下家出牌 */
#play0 { left: 0; right: 0; top: 348px; justify-content: center; } /* 自己出牌 */
.playzone .card + .card { margin-left: -36px; }
.pass-chip {
  background: #fffdf5; color: #7a6a45; border: 1px solid #e8d9a8;
  border-radius: 16px; padding: 6px 18px; font-size: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .35);
}

/* ---------- 扑克牌（纯 DOM+CSS） ---------- */
.card {
  width: 104px; height: 146px; border-radius: 9px; position: relative;
  background: linear-gradient(180deg, #fff, #f1f1f1);
  border: 1px solid #b9b9b9; box-shadow: 0 3px 6px rgba(0, 0, 0, .35);
  color: #222; flex: none;
}
.card.red { color: #d5302a; }
.corner { position: absolute; top: 5px; left: 7px; text-align: center; line-height: 1; }
.corner b { display: block; font-size: 24px; font-weight: 800; }
.corner span { display: block; font-size: 17px; margin-top: 1px; }
.corner.br { top: auto; left: auto; bottom: 5px; right: 7px; transform: rotate(180deg); }
.pip {
  position: absolute; left: 50%; top: 57%; transform: translate(-50%, -50%);
  font-size: 50px; opacity: .92; line-height: 1;
}
.card.joker .pip { font-size: 42px; top: 54%; }
.card.joker .corner b { font-size: 19px; }

/* 尺寸变体：出牌小卡 / 底牌tiny / 对手牌背mini */
.card.sm { width: 74px; height: 104px; border-radius: 7px; }
.card.sm .corner b { font-size: 17px; } .card.sm .corner span { font-size: 12px; }
.card.sm .pip { font-size: 34px; } .card.sm.joker .pip { font-size: 30px; }
.card.tiny { width: 48px; height: 67px; border-radius: 5px; }
.card.tiny .corner b { font-size: 12px; } .card.tiny .corner span { font-size: 9px; }
.card.tiny .pip { font-size: 20px; } .card.tiny.joker .pip { font-size: 17px; }
.card.tiny .corner { top: 2px; left: 3px; } .card.tiny .corner.br { bottom: 2px; right: 3px; }
.card.mini { width: 34px; height: 48px; border-radius: 4px; }

/* 牌背：层 1 预留 assets/img/card-back.png，缺失时显示层 2 CSS 渐变 */
.card.back {
  background-image:
    url("../assets/img/card-back.png"),
    repeating-linear-gradient(45deg, #1c4f8f 0 7px, #2a63b5 7px 14px);
  background-size: cover, cover;
  border-color: #153a6b;
}
.card.back .corner, .card.back .pip { display: none; }
.card.back::after { /* 牌背中央装饰 */
  content: "★"; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .5); font-size: 22px;
}
.card.tiny.back::after, .card.mini.back::after { font-size: 12px; }

/* ---------- 自己手牌 ---------- */
#hand { position: absolute; left: 0; right: 0; bottom: 8px; height: 162px; z-index: 22; }
#hand .card { position: absolute; bottom: 0; cursor: pointer; transition: transform .12s ease, left .18s ease; }
#hand .card:hover { transform: translateY(-8px); }
#hand .card.sel { transform: translateY(-28px); box-shadow: 0 0 0 2px #ffd75e, 0 10px 18px rgba(0, 0, 0, .5); }

/* ---------- 按钮区 ---------- */
#btnBar {
  position: absolute; left: 0; right: 0; bottom: 180px; height: 52px; z-index: 24;
  display: flex; align-items: center; justify-content: center; gap: 24px;
}
.btn {
  min-width: 98px; height: 44px; border: none; border-radius: 22px; cursor: pointer;
  font-size: 19px; font-weight: 700; color: #5a3b0a; padding: 0 22px;
  background: linear-gradient(180deg, #ffe08a, #f0b93c);
  box-shadow: 0 4px 0 #a97d1d, 0 6px 10px rgba(0, 0, 0, .4);
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #a97d1d; }
.btn.primary {
  color: #0c3a10; background: linear-gradient(180deg, #9be396, #4caf50);
  box-shadow: 0 4px 0 #2e7d32, 0 6px 10px rgba(0, 0, 0, .4);
}
.btn.primary:active { box-shadow: 0 2px 0 #2e7d32; }
.btn:disabled { filter: grayscale(1) brightness(.72); cursor: not-allowed; box-shadow: 0 4px 0 #555; }
.btn.mini { min-width: 78px; height: 32px; font-size: 14px; }
.btn.mini.on { background: linear-gradient(180deg, #ffb199, #e2573e); color: #fff; box-shadow: 0 4px 0 #9c2f1a; }
#phaseBtns, #playBtns { display: flex; gap: 24px; align-items: center; }

/* ---------- 右侧表情/快捷语入口与面板 ---------- */
#sideBtns { position: absolute; right: 18px; bottom: 250px; display: flex; flex-direction: column; gap: 12px; z-index: 26; }
.round-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 2px solid #d6b56a;
  background: linear-gradient(180deg, #fff8e0, #f0dfae); font-size: 23px; cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .4);
}
.round-btn:active { transform: scale(.94); }
.panel {
  position: absolute; right: 76px; bottom: 240px; z-index: 45; min-width: 260px;
  background: #fffdf5; border: 1px solid #e8d9a8; border-radius: 14px;
  padding: 10px 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
}
.p-head { font-size: 14px; color: #8a6a2f; padding: 2px 4px 8px; border-bottom: 1px dashed #e0d3ac; cursor: pointer; }
.p-item {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 9px 10px; font-size: 15px; color: #4a3312; cursor: pointer; border-radius: 8px;
  border-bottom: 1px dashed #f0e6c8;
}
.p-item:hover { background: #f4e9c8; }
.emote-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding-top: 10px; }
.emote-item { position: relative; font-size: 34px; background: #f4e9c8; border: none; border-radius: 10px; padding: 8px 0; cursor: pointer; overflow: hidden; }
.emote-item:hover { background: #ecd9a0; }
.emote-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #f4e9c8; }

/* ---------- 气泡（快捷语/表情/不出提示动画，2s 消失） ---------- */
.bubble {
  position: absolute; z-index: 40; max-width: 340px;
  background: #fffdf5; color: #333; border: 1px solid #e8d9a8; border-radius: 18px;
  padding: 7px 14px; font-size: 16px; white-space: nowrap;
  box-shadow: 0 5px 14px rgba(0, 0, 0, .4);
  animation: bubblePop .18s ease-out, bubbleOut .3s ease-in 1.7s forwards;
}
.bubble.b0 { left: 120px; bottom: 200px; }
.bubble.b1 { right: 170px; top: 168px; }
.bubble.b2 { left: 170px; top: 168px; }
@keyframes bubblePop { from { transform: translate(var(--sx, 0px), var(--sy, 0px)) scale(.3); opacity: 0; } to { transform: translate(0, 0) scale(1); opacity: 1; } }
@keyframes bubbleOut { to { opacity: 0; transform: translateY(-10px); } }
.emote { position: relative; width: 64px; height: 64px; display: inline-flex; align-items: center; justify-content: center; font-size: 46px; font-style: normal; }
.emote img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

/* ---------- 特效层样式见文件末尾（fx.js 序列帧 + 春天横幅） ---------- */

/* ---------- 提示 toast ---------- */
#toast {
  position: absolute; top: 92px; left: 50%; transform: translateX(-50%); z-index: 70;
  background: rgba(0, 0, 0, .8); color: #fff; padding: 8px 20px; border-radius: 18px;
  font-size: 15px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
#toast.show { opacity: 1; }

/* ---------- 结算面板 ---------- */
.mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); display: flex; align-items: center; justify-content: center; z-index: 60; }
#settlePanel {
  width: 540px; text-align: center; color: #4a3312;
  background: linear-gradient(180deg, #fff8e0, #ffedb8);
  border: 3px solid #d6b56a; border-radius: 18px; padding: 26px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  animation: settleIn .25s ease-out;
}
@keyframes settleIn { 0% { transform: scale(.8); opacity: 0; } 62% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
#settleTitle { font-size: 36px; font-weight: 800; }
#settleSub { font-size: 16px; color: #8a6a2f; margin-top: 4px; }
.settle-row { display: flex; justify-content: space-between; font-size: 17px; padding: 8px 6px; border-bottom: 1px dashed rgba(214, 181, 106, .5); }
.delta-pos { color: #2e7d32; font-weight: 700; }
.delta-neg { color: #c62828; font-weight: 700; }
#multDetail { font-size: 14px; margin: 12px 0 16px; color: #6b5326; }

/* ---------- 顶栏连接状态 ---------- */
#connChip { display: inline-flex; align-items: center; gap: 7px; }
#connDot { width: 10px; height: 10px; border-radius: 50%; background: #ffb300; flex: none; }
#connChip.ok #connDot { background: #4caf50; box-shadow: 0 0 8px #4caf50; }
#connChip.wait #connDot { background: #ffb300; box-shadow: 0 0 8px #ffb300; animation: blink 1s ease-in-out infinite; }
#connChip.bad #connDot { background: #e2573e; box-shadow: 0 0 8px #e2573e; animation: blink .7s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.chipbtn { cursor: pointer; font: inherit; font-size: 15px; }
.chipbtn:active { transform: translateY(1px); }

/* ---------- 大厅 / 房间面板（同舞台内切页） ---------- */
.lobby-panel {
  width: 560px; max-width: 94%; max-height: 96%; overflow: auto;
  text-align: center; color: #4a3312;
  background: linear-gradient(180deg, #fff8e0, #ffedb8);
  border: 3px solid #d6b56a; border-radius: 18px; padding: 26px 34px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  animation: settleIn .25s ease-out;
}
.lobby-title { font-size: 34px; font-weight: 800; letter-spacing: 6px; color: #5a3b0a; margin-bottom: 8px; }
#lobbyConn { font-size: 13px; color: #8a6a2f; margin-bottom: 10px; }
.lobby-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.lobby-row label { font-size: 16px; font-weight: 700; color: #6b5326; white-space: nowrap; }
.lobby-foot { font-size: 12px; color: #a08a58; margin-top: 12px; }
.text-input {
  height: 42px; border: 2px solid #d6b56a; border-radius: 10px; padding: 0 12px;
  font-size: 17px; background: #fffdf5; color: #4a3312; outline: none; min-width: 0;
}
.text-input:focus { border-color: #f0b93c; box-shadow: 0 0 6px rgba(240, 185, 60, .6); }
#nickInput { width: 240px; }
#joinInput { width: 200px; letter-spacing: 3px; }
select.text-input { cursor: pointer; }

/* 房间座位列表 */
#seatList { margin: 8px 0 4px; }
.seat-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-bottom: 1px dashed rgba(214, 181, 106, .5); font-size: 16px; text-align: left;
}
.seat-row img {
  width: 42px; height: 42px; border-radius: 9px; border: 2px solid #d6b56a;
  object-fit: cover; background: linear-gradient(160deg, #3b6ea5, #274b73); flex: none;
}
.seat-nick { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-row .tag {
  font-size: 12px; background: #4a6fa5; color: #fff; border-radius: 6px;
  padding: 1px 7px; white-space: nowrap;
}
.seat-row .tag.host { background: #2e7d32; }
.seat-row .beans { margin-left: auto; color: #6b5326; font-size: 14px; white-space: nowrap; }
#roomHint { min-height: 20px; font-size: 13px; color: #a03428; margin: 6px 0 4px; }

/* ---------- fx 序列帧特效（bomb/rocket/plane）与春天横幅 ---------- */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 50; display: flex; align-items: center; justify-content: center; }
.fx-big { font-size: 150px; animation: fxPop 1s ease-out forwards; text-shadow: 0 8px 24px rgba(0, 0, 0, .6); }
.fx-seq {
  width: 460px; height: 460px; flex: none;
  background-size: contain; background-position: center; background-repeat: no-repeat;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .55));
}
/* 运镜包装层：全屏绝对定位，动画作用在包装层上（序列帧只负责换帧） */
.fx-fly { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.fx-fly.fx-center .fx-seq { animation: fxSeqIn .18s ease-out; }
.fx-fly.fx-rocket { animation: sweepRocket .78s cubic-bezier(.5,.05,.45,.95) forwards; }
.fx-fly.fx-plane  { animation: sweepPlane  .78s cubic-bezier(.5,.05,.45,.95) forwards; }
@keyframes fxSeqIn { from { transform: scale(.7); opacity: .3; } to { transform: scale(1); opacity: 1; } }
@keyframes sweepRocket {
  0%   { transform: translate(-420px, 290px) rotate(-16deg) scale(.7); opacity: .85; }
  14%  { opacity: 1; }
  100% { transform: translate(430px, -295px) rotate(12deg) scale(1.08); opacity: 1; }
}
@keyframes sweepPlane {
  0%   { transform: translate(-830px, 46px) rotate(-4deg) scale(.85); opacity: .85; }
  16%  { opacity: 1; }
  100% { transform: translate(830px, -26px) rotate(3deg) scale(1); opacity: 1; }
}
.fx-spring { position: relative; display: flex; align-items: center; justify-content: center; }
.fx-spring-text {
  font-size: 76px; color: #ffd75e; font-weight: 900; letter-spacing: 14px;
  text-shadow: 0 0 24px #ff6a00, 0 4px 8px #000;
  animation: fxBanner 1.8s ease forwards;
}
.fx-spring img {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 1180px; max-width: 96%;
  animation: springPop 1.9s ease forwards;
}
@keyframes springPop {
  0%   { transform: translate(-50%, -50%) scale(.22); opacity: 0; }
  14%  { transform: translate(-50%, -50%) scale(1.07); opacity: 1; }
  24%  { transform: translate(-50%, -50%) scale(1); }
  82%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.03); opacity: 0; }
}
.fx-banner {
  font-size: 76px; color: #ffd75e; font-weight: 900; letter-spacing: 14px;
  text-shadow: 0 0 24px #ff6a00, 0 4px 8px #000;
  animation: fxBanner 1.6s ease forwards;
}
@keyframes fxPop { 0% { transform: scale(.2); opacity: 0; } 25% { transform: scale(1.25); opacity: 1; } 70% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes fxBanner { 0% { transform: scale(.4); opacity: 0; } 18% { transform: scale(1.1); opacity: 1; } 30% { transform: scale(1); } 82% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- 舞台震动（炸弹/王炸，fx.js shakeStage 挂类；--stage-scale 由 JS 注入保持等比缩放） ---------- */
#stage.fx-shake { animation: stageShake .32s ease-in-out; }
@keyframes stageShake {
  0%, 100% { transform: translate(-50%, -50%) scale(var(--stage-scale, 1)); }
  20% { transform: translate(calc(-50% - 10px), calc(-50% + 6px)) scale(var(--stage-scale, 1)); }
  40% { transform: translate(calc(-50% + 9px), calc(-50% - 7px)) scale(var(--stage-scale, 1)); }
  60% { transform: translate(calc(-50% - 7px), calc(-50% - 3px)) scale(var(--stage-scale, 1)); }
  80% { transform: translate(calc(-50% + 5px), calc(-50% + 4px)) scale(var(--stage-scale, 1)); }
}

/* ---------- 飞行层：发牌/出牌/底牌/表情的独立绝对定位层（播完即移除，不污染布局） ---------- */
#flyLayer { position: absolute; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.flying { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.fly-card { width: 52px; height: 73px; box-shadow: 0 4px 12px rgba(0, 0, 0, .45); }
.fly-card .corner, .fly-card .pip { display: none; }
.fly-emote { will-change: transform, opacity; }
.fly-emote .emote { background: #fffdf5; border: 2px solid #e8d9a8; border-radius: 50%; }

/* ---------- 出牌区：飞行落定前短暂隐藏，避免与飞行牌重影 ---------- */
.playzone[data-flying] { visibility: hidden; }

/* ---------- 「不出」气泡：从该家头像方向滑入 ---------- */
#play0 .pass-chip { animation: chipFromSelf .28s ease-out; }
#play1 .pass-chip { animation: chipFromRight .28s ease-out; }
#play2 .pass-chip { animation: chipFromLeft  .28s ease-out; }
@keyframes chipFromSelf  { from { transform: translateY(48px) scale(.8); opacity: 0; } }
@keyframes chipFromRight { from { transform: translateX(58px) scale(.85); opacity: 0; } }
@keyframes chipFromLeft  { from { transform: translateX(-58px) scale(.85); opacity: 0; } }

/* ---------- 手牌逐张亮出（发牌动画期间由 JS 挂 deal-in + 逐张 delay） ---------- */
.card.deal-in { animation: dealIn .18s ease-out both; }
@keyframes dealIn { from { transform: translateY(48px) scale(.6); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

/* ---------- 底牌 3D 翻面（定地主时由 JS 组装 正/背 两面） ---------- */
#bottomCards { perspective: 700px; }
.flip-wrap { position: relative; width: 48px; height: 67px; flex: none; }
.flip-wrap .face {
  position: absolute; inset: 0; margin: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.flip-wrap .face.front { transform: rotateY(180deg); animation: flipFront .55s cubic-bezier(.4,.1,.25,1) forwards; }
.flip-wrap .face.back  { animation: flipBack  .55s cubic-bezier(.4,.1,.25,1) forwards; }
@keyframes flipFront { to { transform: rotateY(0deg); } }
@keyframes flipBack  { from { transform: rotateY(0deg); } to { transform: rotateY(180deg); } }

/* ---------- 地主帽从上方落到头像（弹跳 1 次，JS 挂 drop-in） ---------- */
.mark.drop-in { animation: hatDrop .68s cubic-bezier(.3,.5,.4,1.2); }
@keyframes hatDrop {
  0%   { transform: translateY(-110px) scale(1.7); opacity: 0; }
  55%  { transform: translateY(0) scale(.9); opacity: 1; }
  72%  { transform: translateY(-15px) scale(1.05); }
  88%  { transform: translateY(0) scale(1); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- 头像被扔表情后抖动两下（JS 挂 shake） ---------- */
.avatar.shake { animation: avatarShake .45s ease-in-out; }
@keyframes avatarShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-10deg) scale(1.06); }
  40% { transform: rotate(9deg) scale(1.06); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(6deg); }
}

/* ---------- 顶栏倍数数字放大弹回（render 检测到倍数变大时挂 bump） ---------- */
#multChip.bump { animation: multBump .4s cubic-bezier(.3,1.6,.5,1); }
@keyframes multBump { 0% { transform: scale(1); } 40% { transform: scale(1.55); color: #ff6a3c; } 100% { transform: scale(1); } }

/* ---------- 气泡：从头像方向滑入（b0 本家/ b1 右 / b2 左） ---------- */
.bubble { --sx: 0px; --sy: 0px; }
.bubble.b0 { --sx: 26px; --sy: 42px; }
.bubble.b1 { --sx: 60px; }
.bubble.b2 { --sx: -60px; }

/* ---------- 结算面板：scale .8→1 弹入 + 豆子数字滚动样式 ---------- */
#settlePanel.pop { animation: settleIn .38s cubic-bezier(.3,1.3,.5,1); }
.beans-count { font-size: 18px; font-weight: 800; color: #5a3b0a; }
.settle-row .delta-pos, .settle-row .delta-neg { animation: deltaPop .4s ease-out .15s both; }
@keyframes deltaPop { from { transform: scale(.4); opacity: 0; } }

/* ---------- prefers-reduced-motion：跳过所有动画（低功耗/无障碍） ---------- */
@media (prefers-reduced-motion: reduce) {
  #flyLayer, .fx-fly { display: none !important; }
  #stage.fx-shake { animation: none !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0ms !important;
  }
}
