:root {
  /* 桌面颜色：由主题设置（app.js THEMES）改写 */
  --felt-light: #1b8a57;
  --felt: #146c43;
  --felt-dark: #0b3f27;
  --pattern: none;
  --gold: #f6c453;
  --text: #f3f7f4;
  --muted: rgba(243, 247, 244, .7);
  --red: #d32f2f;
  --black: #1d1d1f;
  /* 牌宽同时看屏幕宽和高，矮屏不会挤掉牌桌 */
  --cw: clamp(56px, min(9.2vw, 15.5vh), 150px);
  --ch: calc(var(--cw) * 1.42);
  --pw: calc(var(--cw) * .74);
  --ph: calc(var(--pw) * 1.42);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--text);
  background-color: var(--felt-dark);
  background-image: var(--pattern), radial-gradient(ellipse at 50% 40%, var(--felt-light) 0%, var(--felt) 45%, var(--felt-dark) 100%);
  background-size: var(--pattern-size, auto), 100% 100%;
  background-attachment: fixed;
  transition: background-color .3s;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.hidden { display: none !important; }
button { font: inherit; }

/* ---------- 按钮 ---------- */
.btn {
  border: 0; border-radius: 999px; padding: .55em 1.3em; cursor: pointer;
  background: #f4f4f4; color: #1d2a22; font-weight: 600;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .25);
  transition: transform .08s, filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(#ffd667, #f0a91a); color: #4a2a00; }
.btn.warn { background: linear-gradient(#ff8a65, #e8562a); color: #fff; }
.btn.blue { background: linear-gradient(#7cc4ff, #3a8ee6); color: #fff; }
.btn.ghost { background: rgba(255, 255, 255, .14); color: var(--text); box-shadow: none; }
.btn.small { padding: .3em .9em; font-size: .85rem; }
.btn.big { padding: .8em 1.6em; font-size: 1.1rem; width: 100%; }
.chip { background: rgba(0, 0, 0, .25); padding: .25em .7em; border-radius: 999px; font-size: .85rem; white-space: nowrap; }

/* ---------- 大厅 ---------- */
/* 卡片用 margin:auto 居中：屏幕放得下时居中，放不下时能从顶部滚动（不会被裁掉） */
.lobby { display: flex; height: 100%; padding: 16px; overflow: auto; }
.lobby-card {
  margin: auto; flex: none;
  width: min(400px, 100%); background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px; padding: 28px 26px; backdrop-filter: blur(6px); box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
  user-select: text;
}
.logo { display: flex; justify-content: center; gap: 4px; margin-bottom: 6px; }
.logo-card {
  width: 40px; height: 56px; background: #fff; color: var(--black); border-radius: 6px; display: grid; place-items: center;
  font-size: 26px; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); transform: rotate(-8deg);
}
.logo-card.red { color: var(--red); transform: rotate(8deg); }
.lobby h1 { text-align: center; margin: 4px 0 2px; font-size: 2rem; letter-spacing: .2em; color: var(--gold); text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.sub { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: .9rem; }
.field { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.lobby input {
  display: block; width: 100%; margin-top: 6px; padding: .7em .9em; font-size: 1rem; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .92); color: #1d2a22; outline: none;
}
.lobby input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246, 196, 83, .35); }
.or { text-align: center; color: var(--muted); font-size: .8rem; margin: 18px 0 10px; display: flex; align-items: center; gap: 10px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .2); }
.join-row { display: flex; gap: 8px; }
.join-row input { margin: 0; flex: 1; letter-spacing: .3em; text-align: center; }
.msg { min-height: 1.3em; color: #ffd0c4; font-size: .9rem; margin: 10px 0 0; text-align: center; }
.rules { margin-top: 10px; font-size: .85rem; color: var(--muted); }
.rules summary { cursor: pointer; }
.rules ul { padding-left: 1.2em; line-height: 1.6; }

/* ---------- 玩法设置 ---------- */
.settings { display: grid; gap: 8px; margin: 4px 0 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .9rem; color: var(--muted); }
.seg { display: inline-flex; background: rgba(0, 0, 0, .3); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--text); padding: .35em .9em; border-radius: 999px; cursor: pointer; font-size: .85rem;
}
.seg button.on { background: var(--gold); color: #4a2a00; font-weight: 700; }
.settings.light .set-row { color: #33443a; }
.settings.light .seg { background: #ece6d4; }
.settings.light .seg button { color: #33443a; }
.chip-btn { border: 0; color: var(--text); cursor: pointer; font: inherit; font-size: .85rem; }
.chip-btn:hover { background: rgba(0, 0, 0, .4); }
.tag.dbl { background: #e8562a; color: #fff; }
.open-hand { display: flex; margin-top: 4px; max-width: 46vw; }
.seat.pos-left .open-hand { align-self: flex-start; }
.seat.pos-right .open-hand { align-self: flex-end; }
.tag.pts { background: #6a4bc4; color: #fff; }
.res-cards.inline { display: inline-flex; vertical-align: middle; margin-left: 8px; }
.res-cards.inline .card { --w: 24px; }
.res-cards.inline .card + .card { margin-left: -10px; }
.res-note { margin-left: 6px; color: #8a978f; font-size: .75rem; font-weight: 400; }
.help-text { line-height: 1.7; font-size: .92rem; color: #33443a; }
.help-text ul { padding-left: 1.2em; margin: 6px 0; }
.game-tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(0, 0, 0, .3); border-radius: 12px; padding: 4px; margin-bottom: 16px; gap: 4px; }
.game-tabs button {
  border: 0; background: transparent; color: var(--text); padding: .6em .4em; border-radius: 9px; cursor: pointer;
  font-size: .95rem; font-weight: 600;
}
.game-tabs button.on { background: var(--gold); color: #4a2a00; }
.open-hand .card { --w: calc(var(--pw) * .62); }
.open-hand .card + .card { margin-left: calc(var(--pw) * -.36); }
.res-dbl { margin-left: 6px; background: #e8562a; color: #fff; border-radius: 4px; padding: 0 4px; font-size: .7rem; font-weight: 600; }

/* ---------- 牌桌布局 ---------- */
.game { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 8px 12px; background: rgba(0, 0, 0, .22);
}
.room-info { display: flex; align-items: center; gap: 8px; font-size: .9rem; white-space: nowrap; }
.room-info b { color: var(--gold); letter-spacing: .1em; font-size: 1.05rem; }
.stats { display: flex; justify-content: flex-end; align-items: center; gap: 6px; flex-wrap: wrap; }
.bottom-cards { display: flex; gap: 4px; justify-content: center; min-height: calc(var(--cw) * .5 * 1.42); }
.bottom-cards .card { --w: calc(var(--cw) * .5); }

.table { position: relative; flex: 1; min-height: 0; --sw: clamp(92px, 16vw, 150px); }
.seat {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: var(--sw); text-align: center;
}
.seat .info { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.count-row { display: flex; align-items: center; gap: 8px; }
.seat.pos-left { left: 10px; top: 10px; }
.seat.pos-right { right: 10px; top: 10px; }
/* 顶部座位横排，省高度 */
.seat.pos-top, .seat.pos-topleft, .seat.pos-topright {
  top: 6px; flex-direction: row; flex-wrap: wrap; width: auto; max-width: 34%; gap: 4px 8px; transform: translateX(-50%); text-align: left;
}
.seat.pos-top { left: 50%; }
.seat.pos-topleft { left: 30%; }
.seat.pos-topright { left: 70%; }
.seat.pos-top .info, .seat.pos-topleft .info, .seat.pos-topright .info { align-items: flex-start; }
.seat.pos-top .meta, .seat.pos-topleft .meta, .seat.pos-topright .meta { justify-content: flex-start; }
.seat.pos-top .empty-seat, .seat.pos-topleft .empty-seat, .seat.pos-topright .empty-seat { flex-direction: row; padding: 8px 12px; }
/* 有顶部座位时，左右两边的座位往下放 */
.n4 .seat.pos-left, .n4 .seat.pos-right, .n5 .seat.pos-left, .n5 .seat.pos-right,
.n6 .seat.pos-left, .n6 .seat.pos-right { top: 28%; }
/* 6 人：顶部三个座位 */
.n6 .seat.pos-topleft, .n6 .played.pos-topleft { left: 20%; }
.n6 .seat.pos-topright, .n6 .played.pos-topright { left: 80%; }
.n6 .seat.pos-top, .n6 .seat.pos-topleft, .n6 .seat.pos-topright { max-width: 26%; }
.avatar {
  width: clamp(44px, 6vw, 60px); height: clamp(44px, 6vw, 60px); border-radius: 50%;
  display: grid; place-items: center; font-size: clamp(1.1rem, 2vw, 1.5rem); font-weight: 700;
  background: linear-gradient(#5d7b6c, #34493f); border: 3px solid rgba(255, 255, 255, .5); position: relative;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
}
.avatar.landlord { background: linear-gradient(#ffcf5a, #e0901b); color: #5a3000; border-color: #fff3c4; }
.avatar.farmer { background: linear-gradient(#78b7ff, #3c7fd1); }
.avatar.bot::after { content: "电脑"; position: absolute; bottom: -6px; font-size: .6rem; background: #333; color: #fff; padding: 0 4px; border-radius: 4px; }
html[lang="en"] .avatar.bot::after { content: "BOT"; }
.seat.active .avatar, .me-info.active .avatar { box-shadow: 0 0 0 4px var(--gold), 0 0 20px var(--gold); }
.seat .name { font-weight: 600; font-size: .9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .meta, .me-info .meta { font-size: .75rem; color: var(--muted); display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.tag { padding: 0 .45em; border-radius: 4px; font-size: .72rem; background: rgba(0, 0, 0, .3); }
.tag.ok { background: #2e9d5b; color: #fff; }
.tag.warn { background: #b23b2a; color: #fff; }
.tag.role-l { background: var(--gold); color: #4a2a00; }
.count { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1.1rem; }
.count .card { --w: calc(var(--pw) * .55); }
.count.low { color: #ffb4a8; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.timer {
  min-width: 2.2em; padding: .1em .5em; border-radius: 999px; background: var(--gold); color: #4a2a00; font-weight: 800; font-size: .9rem;
}
.timer.urgent { background: #ff6b5a; color: #fff; }
.empty-seat {
  border: 2px dashed rgba(255, 255, 255, .35); border-radius: 14px; padding: 14px 8px; color: var(--muted); font-size: .85rem;
  display: flex; flex-direction: column; gap: 8px; align-items: center; width: 100%;
}
.kick { font-size: .7rem; padding: .1em .6em; }

.played { position: absolute; display: flex; flex-wrap: wrap; align-items: center; gap: 0; max-width: 46%; }
.played .card { --w: var(--pw); }
.played .card + .card { margin-left: calc(var(--pw) * -.62); }
.played.pos-left { left: calc(var(--sw) + 20px); top: 16%; }
.played.pos-right { right: calc(var(--sw) + 20px); top: 16%; justify-content: flex-end; }
.n4 .played.pos-left, .n4 .played.pos-right, .n5 .played.pos-left, .n5 .played.pos-right,
.n6 .played.pos-left, .n6 .played.pos-right { top: 36%; max-width: 30%; }
.n6 .played.pos-top, .n6 .played.pos-topleft, .n6 .played.pos-topright { max-width: 24%; }
.played.pos-top, .played.pos-topleft, .played.pos-topright { top: 104px; transform: translateX(-50%); justify-content: center; max-width: 40%; }
.played.pos-top { left: 50%; }
.played.pos-topleft { left: 30%; max-width: 28%; }
.played.pos-topright { left: 70%; max-width: 28%; }
.played.pos-top .type-label, .played.pos-topleft .type-label, .played.pos-topright .type-label { text-align: center; }
.n2 ~ .center-msg, .n4 ~ .center-msg, .n5 ~ .center-msg, .n6 ~ .center-msg { top: 58%; }
.played-me { left: 50%; bottom: 8px; transform: translateX(-50%); justify-content: center; max-width: 80%; flex-wrap: nowrap; }
.say {
  font-size: clamp(1rem, 2.2vw, 1.4rem); font-weight: 800; color: var(--gold); text-shadow: 0 2px 4px rgba(0, 0, 0, .5);
  padding: .2em .6em; background: rgba(0, 0, 0, .25); border-radius: 10px;
}
.say.pass { color: #dfe8e3; }
.type-label { font-size: .75rem; color: var(--muted); width: 100%; margin-top: 4px; }
/* 打完时赢家最后一手牌：金色标签 */
.type-label.final { color: #ffd84d; font-weight: 800; font-size: .85rem; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); animation: finalPop .5s cubic-bezier(.2, 1.6, .5, 1) both; }
@keyframes finalPop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.played.pos-right .type-label { text-align: right; }
.played-me .type-label { text-align: center; }
.center-msg {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); text-align: center; color: var(--muted);
  font-size: clamp(.9rem, 1.8vw, 1.15rem); pointer-events: none; width: min(80%, 420px);
}
.center-msg b { color: var(--gold); }
.center-msg .big { font-size: 1.4em; color: var(--text); display: block; margin-bottom: .3em; }

.me-bar { display: flex; align-items: center; gap: 12px; padding: 4px 14px; min-height: 52px; }
.me-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.me-info .avatar { width: 40px; height: 40px; font-size: 1rem; }
.me-info .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9em; }
.me-info .meta { justify-content: flex-start; }
.actions { flex: 1; display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions .btn { min-width: 5em; }

.hand {
  position: relative; display: flex; justify-content: center; align-items: flex-end;
  padding: calc(var(--ch) * .24) 10px 12px; touch-action: none; min-height: calc(var(--ch) * 1.24 + 12px);
}
.hand .card { --w: var(--cw); margin-left: var(--ov, -40px); cursor: pointer; transition: transform .12s; }
.hand .card:first-child { margin-left: 0; }
.hand .card.sel { transform: translateY(-22%); }
.hand .card.sel .face { background: #fff7d6; }

/* ---------- 牌面 ---------- */
.card {
  --w: var(--cw);
  width: var(--w); height: calc(var(--w) * 1.42); flex: none; position: relative;
  border-radius: calc(var(--w) * .1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35), -1px 0 2px rgba(0, 0, 0, .12);
}
.card .face {
  position: absolute; inset: 0; border-radius: inherit; background: #fff; border: 1px solid #c9c9c9; overflow: hidden;
}
.card.red .face { color: var(--red); }
.card.black .face { color: var(--black); }
.card .r { position: absolute; left: 7%; top: 3%; font-weight: 800; font-size: calc(var(--w) * .36); line-height: 1; letter-spacing: -.06em; }
.card .s { position: absolute; left: 9%; top: calc(var(--w) * .4); font-size: calc(var(--w) * .28); line-height: 1; }
.card .big { position: absolute; right: 8%; bottom: 5%; font-size: calc(var(--w) * .55); line-height: 1; }
.card.joker .jk {
  position: absolute; left: 8%; top: 5%; writing-mode: vertical-rl; text-orientation: upright;
  font-size: calc(var(--w) * .17); font-weight: 800; line-height: 1; letter-spacing: -.1em;
}
/* J、Q、K 人像 Emoji：放在角标花色下面，手牌叠着时也露得出来；万能牌左边有「癞/配」标，挪到右下 */
.card .cemo {
  position: absolute; left: -2%; bottom: 5%; font-size: calc(var(--w) * .5); line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.card.wild .cemo { left: auto; right: 6%; }
.card.court-card .r { letter-spacing: 0; }
.card.joker .jemo {
  position: absolute; left: 14%; bottom: 6%; font-size: calc(var(--w) * .54); line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
/* 手机手牌分两排时，上排牌的下半截被挡住：鬼牌表情挪到上面 */
.hand.two-rows .hand-row:not(:last-child) .card.joker .jemo { top: 4%; bottom: auto; font-size: calc(var(--w) * .48); }
.card.joker.black .jemo { filter: grayscale(1) contrast(1.15); }
.card.joker.red .face { background: linear-gradient(160deg, #fff 60%, #fff3e0); }
.chip-btn.off { opacity: .55; }
/* 性别头像 */
.avatar.img { background-color: #fff; background-size: cover; background-position: center; color: transparent; }
.avatar.img.landlord { border-color: var(--gold); box-shadow: 0 0 0 2px #e0901b, 0 4px 10px rgba(0, 0, 0, .3); }
.avatar.img.farmer { border-color: #9fd0ff; }
.role-badge {
  position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: .72rem; font-weight: 800; border: 2px solid #fff; color: #fff;
}
.role-badge.landlord { background: linear-gradient(#ffcf5a, #e0901b); color: #5a3000; }
.role-badge.farmer { background: linear-gradient(#78b7ff, #3c7fd1); }
.gender-row { margin: -4px 0 14px; }

/* 表情 */
.emote-btn {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.35rem;
  background: rgba(0, 0, 0, .25); box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
.emote-btn:hover { background: rgba(0, 0, 0, .4); }
.emote-panel {
  position: fixed; right: 12px; bottom: calc(var(--ch) * 1.3 + 64px); z-index: 45; width: min(380px, 94vw);
  padding: 8px 10px 10px; border-radius: 14px;
  background: #fffdf6; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); animation: pop .15s ease-out;
}
.emote-panel button { border: 0; cursor: pointer; border-radius: 8px; }
.emote-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.emote-tabs button { flex: 1; padding: .45em; font-weight: 700; font-size: .9rem; background: #ece6d4; color: #5c6b63; }
.emote-tabs button.on { background: var(--gold); color: #4a2a00; }
.emote-grid { display: grid; gap: 6px; max-height: min(46vh, 320px); overflow-y: auto; }
.emote-grid.hidden { display: none; }
.em-grid { grid-template-columns: repeat(6, 1fr); }
.ph-grid { grid-template-columns: repeat(2, 1fr); }
.emote-panel .em { font-size: 1.55rem; background: transparent; padding: .15em 0; }
.emote-panel .em:hover { background: #f1ead6; }
.emote-panel .ph { font-size: .85rem; padding: .55em .3em; background: #f1ead6; color: #33443a; font-weight: 600; line-height: 1.3; }
.emote-panel .ph:hover { background: #e8dcbc; }
.bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 46; }
/* 人机难度 */
#levelBtn.lv-hard { background: rgba(192, 70, 58, .55); }
.level-menu {
  position: fixed; z-index: 48; width: min(300px, 92vw); padding: 8px; border-radius: 14px; display: flex; flex-direction: column; gap: 6px;
  background: #fffdf6; color: #1d2a22; box-shadow: 0 10px 26px rgba(0, 0, 0, .4); animation: pop .15s ease-out;
}
.level-menu .lm-title { font-weight: 800; font-size: .9rem; padding: 2px 4px; }
.level-menu .lm-title small { font-weight: 500; color: #7a7466; font-size: .75rem; margin-left: 4px; }
.level-menu button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 10px; border: 2px solid transparent;
  border-radius: 10px; background: #f3ede0; color: #1d2a22; font: inherit; text-align: left; cursor: pointer;
}
.level-menu button b { font-size: .95rem; }
.level-menu button span { font-size: .75rem; color: #6b6555; }
.level-menu button:hover { background: #ffe9b5; }
.level-menu button.on { border-color: #e0902a; background: #fff1cf; }
.level-row .seg button { padding-left: .55em; padding-right: .55em; }
/* 互动道具：番茄 / 鸡蛋 */
.others .seat .avatar { cursor: pointer; }
.others .seat .avatar:hover { box-shadow: 0 0 0 3px rgba(255, 214, 102, .7); }
.throw-menu {
  position: fixed; z-index: 47; display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 14px;
  background: #fffdf6; box-shadow: 0 10px 26px rgba(0, 0, 0, .4); animation: pop .15s ease-out;
}
.throw-menu .tm-items { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
@media (max-width: 500px) { .throw-menu .tm-items { grid-template-columns: repeat(5, 1fr); } }
.throw-menu button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 58px; padding: 5px 4px;
  border: 0; border-radius: 10px; background: #f3ede0; color: #1d2a22; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.throw-menu button:hover { background: #ffe9b5; }
.throw-menu b { font-size: 1.75rem; line-height: 1.1; }
.throw-menu .tm-tabs { display: flex; gap: 6px; }
.throw-menu .tm-tabs button { flex: 1; flex-direction: row; justify-content: center; padding: 7px 8px; font-size: .85rem; background: #ece4d2; color: #7a7260; }
.throw-menu .tm-tabs button.on { background: #e0902a; color: #fff; }
.throw-menu .tm-tabs button.hit.on { background: #c0463a; }
@media (max-width: 420px) { .throw-menu button { min-width: 54px; } .throw-menu b { font-size: 1.55rem; } }
.throw-fly { position: absolute; font-size: 2.4rem; line-height: 1; transform: translate(-50%, -50%); filter: drop-shadow(0 6px 5px rgba(0, 0, 0, .35)); will-change: transform; }
.splat {
  position: absolute; transform: translate(-50%, -50%); pointer-events: none;
  animation: splatIn .16s cubic-bezier(.2, 1.6, .5, 1) both, splatOut .7s ease-in 2.3s forwards;
}
.splat svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25)); }
.splat .drip { transform-origin: 50% 60%; animation: drip 2.4s ease-in .25s both; }
@keyframes splatIn { from { transform: translate(-50%, -50%) scale(.25); } to { transform: translate(-50%, -50%) scale(1); } }
@keyframes splatOut { to { opacity: 0; transform: translate(-50%, -42%) scale(1); } }
@keyframes drip { from { transform: scaleY(.2); } to { transform: scaleY(1.25); } }
.avatar.hit { animation: hitShake .5s ease; }
@keyframes hitShake {
  0%, 100% { transform: none; } 15% { transform: translate(-5px, 2px) rotate(-8deg); } 35% { transform: translate(5px, -2px) rotate(7deg); }
  55% { transform: translate(-3px, 1px) rotate(-4deg); } 75% { transform: translate(2px, 0) rotate(2deg); }
}
/* 炸弹 */
.bomb-sit {
  position: absolute; transform: translate(-50%, -50%); font-size: 2.6rem; line-height: 1; pointer-events: none;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .4)); animation: bombWobble .12s linear infinite alternate;
}
.bomb-sit::after {
  content: ''; position: absolute; right: 2px; top: -2px; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 25%, #ffd23f 40%, #ff7a1a 65%, transparent 70%); animation: spark .1s linear infinite alternate;
}
@keyframes bombWobble { from { transform: translate(-50%, -50%) rotate(-7deg) scale(1); } to { transform: translate(-50%, -50%) rotate(7deg) scale(1.08); } }
@keyframes spark { from { transform: scale(.6); opacity: .7; } to { transform: scale(1.3); opacity: 1; } }
.boom { position: absolute; transform: translate(-50%, -50%); pointer-events: none; animation: boomOut .7s cubic-bezier(.1, .9, .3, 1) both; }
.boom svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 12px rgba(255, 170, 40, .9)); }
@keyframes boomOut {
  0% { transform: translate(-50%, -50%) scale(.15) rotate(-20deg); opacity: 1; }
  45% { transform: translate(-50%, -50%) scale(1.05) rotate(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.25) rotate(8deg); opacity: 0; }
}
.smoke {
  position: absolute; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(140, 134, 126, .9) 0, rgba(120, 114, 106, .55) 40%, rgba(100, 95, 90, 0) 70%);
  animation: smokeOut 1.6s ease-out both;
}
@keyframes smokeOut {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: .95; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.6); opacity: 0; }
}
/* 被炸黑的脸：两只白眼睛眨巴 */
.soot {
  position: absolute; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 50% 55%, rgba(25, 20, 18, .96) 0 58%, rgba(40, 32, 28, .85) 66%, rgba(40, 32, 28, 0) 71%);
  animation: sootFade 2.9s ease-in both;
}
.soot i {
  position: absolute; top: 38%; width: 17%; height: 19%; border-radius: 50%; background: #fff;
  animation: blink 1s linear .6s 2;
}
.soot i::after { content: ''; position: absolute; left: 32%; top: 34%; width: 38%; height: 38%; border-radius: 50%; background: #111; }
.soot i:first-child { left: 27%; }
.soot i:last-child { right: 27%; }
@keyframes sootFade { 0% { opacity: 0; } 8%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes blink { 0%, 40%, 60%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.1); } }
.game.quake { animation: quake .4s linear; }
@keyframes quake {
  0%, 100% { transform: none; } 20% { transform: translate(-6px, 3px); } 40% { transform: translate(5px, -4px); }
  60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); }
}
/* 拖鞋 / 板砖 / 泼水 */
.bonk-item {
  position: absolute; transform: translate(-50%, -50%); line-height: 1; pointer-events: none;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35)); animation: bonkSlam .7s ease-in both;
}
.bonk-item.b10 { animation: bonkSlam .3s ease-in both; }
@keyframes bonkSlam {
  0% { transform: translate(-50%, -50%) scale(1.5) rotate(-25deg); }
  18% { transform: translate(-50%, -50%) scale(.95) rotate(-12deg); }
  45% { transform: translate(-50%, -50%) scale(1) rotate(-10deg); opacity: 1; }
  100% { transform: translate(-50%, 40%) scale(.9) rotate(30deg); opacity: 0; }
}
.pop-word {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  font-size: 1.5rem; font-weight: 900; color: #fff3b0; letter-spacing: .02em;
  text-shadow: 0 0 2px #7a2a00, 2px 2px 0 #c0391b, -1px -1px 0 #7a2a00, 0 4px 6px rgba(0, 0, 0, .4);
  animation: popWord .95s ease-out both;
}
@keyframes popWord {
  0% { transform: translate(-50%, -50%) scale(.3) rotate(-12deg); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.25) rotate(-8deg); opacity: 1; }
  45% { transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
  100% { transform: translate(-50%, -110%) scale(1) rotate(-8deg); opacity: 0; }
}
.crumb {
  position: absolute; border-radius: 2px; pointer-events: none; transform: translate(-50%, -50%);
  animation: crumbFall 1s cubic-bezier(.3, 0, .9, .6) both;
}
@keyframes crumbFall {
  from { transform: translate(-50%, -50%); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)); opacity: 0; }
}
/* 头顶转圈的金星 */
.dizzy { position: absolute; width: 0; height: 0; pointer-events: none; animation: cfFade .2s ease both, giftOut .4s ease-in 1.55s forwards; }
.dizzy span { position: absolute; left: 0; top: 0; font-size: 1rem; line-height: 1; animation: orbit .9s linear infinite; }
.dizzy span:nth-child(2) { animation-delay: -.3s; }
.dizzy span:nth-child(3) { animation-delay: -.6s; }
@keyframes orbit {
  0% { transform: translate(calc(-50% - var(--R)), -50%) scale(.85); }
  25% { transform: translate(-50%, calc(-50% + var(--R) * .3)) scale(1.1); }
  50% { transform: translate(calc(-50% + var(--R)), -50%) scale(.85); }
  75% { transform: translate(-50%, calc(-50% - var(--R) * .3)) scale(.65); }
  100% { transform: translate(calc(-50% - var(--R)), -50%) scale(.85); }
}
.splat.water { animation: splatIn .16s cubic-bezier(.2, 1.6, .5, 1) both, splatOut .6s ease-in 1.5s forwards; }
/* 被泼湿：蓝色水膜 + 往下滴的水珠 */
.wet {
  position: absolute; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .55) 0 8%, rgba(120, 195, 255, .45) 18%, rgba(60, 150, 230, .5) 60%, rgba(60, 150, 230, 0) 71%);
  animation: sootFade 2.9s ease-in both;
}
.wet i {
  position: absolute; top: 70%; width: 9%; height: 13%; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: rgba(80, 170, 240, .85); animation: wetDrip 1.1s ease-in infinite;
}
.wet i:nth-child(1) { left: 28%; animation-delay: .1s; }
.wet i:nth-child(2) { left: 50%; animation-delay: .55s; }
.wet i:nth-child(3) { left: 68%; animation-delay: .3s; }
@keyframes wetDrip { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(160%); opacity: 0; } }
/* 飞吻的唇印 */
.kiss {
  position: absolute; transform: translate(-50%, -50%) rotate(-14deg); line-height: 1; pointer-events: none;
  animation: kissStamp .3s cubic-bezier(.2, 1.4, .5, 1) both, giftOut .5s ease-in 2.25s forwards;
}
@keyframes kissStamp { from { transform: translate(-50%, -50%) rotate(-14deg) scale(2); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-14deg) scale(1); opacity: 1; } }
.gift-fx em {
  position: absolute; left: -50%; right: -50%; top: -.4em; text-align: center; white-space: nowrap; font-style: normal;
  font-weight: 900; font-size: 1.05rem; color: #ffe066; text-shadow: 0 0 2px #6b3a00, 1px 2px 0 #b5471b, 0 3px 6px rgba(0, 0, 0, .45);
  animation: plusUp 2s ease-out .1s both;
}
.gift-fx.g6 > span { animation: clink .25s ease-in-out .05s 4 alternate; }
.gift-fx.g8 > span { animation: likeBounce .5s cubic-bezier(.3, 1.8, .5, 1) both; }
/* 红包：到手后冒出金色的「+50元」 */
.gift-fx.g8 em { font-size: 1.6rem; color: #ffd84d; text-shadow: 0 0 2px #7a1d00, 2px 2px 0 #c0391b, 0 4px 8px rgba(0, 0, 0, .5); animation: plusUp 2.2s ease-out .25s both; }
@keyframes clink { from { transform: rotate(-10deg); } to { transform: rotate(10deg) scale(1.06); } }
/* 送礼物 */
.gift-fx {
  position: absolute; transform: translate(-50%, -50%); pointer-events: none; display: grid; place-items: center;
  animation: giftIn .35s cubic-bezier(.2, 1.5, .5, 1) both, giftOut .5s ease-in 2s forwards;
}
.gift-fx.g2 { animation: giftIn .35s cubic-bezier(.2, 1.5, .5, 1) both, giftOut .6s ease-in 3.5s forwards; }
.gift-fx svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3)); }
.gift-fx > span { font-size: calc(var(--gs, 1) * 2.8rem); line-height: 1; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); }
.gift-fx.g3 > span { animation: roseSway 1s ease-in-out .3s 2 alternate; }
.gift-fx.g4 > span { animation: likeBounce .6s cubic-bezier(.3, 1.8, .5, 1) both; }
.gift-fx i {
  position: absolute; right: -2px; top: -8px; font-style: normal; font-weight: 900; font-size: 1.2rem; color: #ffd84d;
  text-shadow: 0 2px 3px rgba(0, 0, 0, .5); animation: plusUp 1.6s ease-out .15s both;
}
.gift-fx .cf-pot { animation: cfPot 1.35s ease both; }
.gift-fx .cf-stream { transform-box: fill-box; transform-origin: top; animation: cfStream 1.25s ease both; }
.gift-fx .cf-coffee { animation: cfFade .5s ease .35s both; }
.gift-fx .cf-foam { animation: cfFade .4s ease 1s both; }
.gift-fx .cf-steam path { opacity: 0; animation: cfSteam 1.6s ease-out infinite; }
.gift-fx .cf-steam path:nth-child(1) { animation-delay: 1.2s; }
.gift-fx .cf-steam path:nth-child(2) { animation-delay: 1.5s; }
.gift-fx .cf-steam path:nth-child(3) { animation-delay: 1.8s; }
@keyframes giftIn { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes giftOut { to { transform: translate(-50%, -62%) scale(.9); opacity: 0; } }
@keyframes cfPot { 0% { opacity: 0; } 12%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes cfStream { 0%, 12% { transform: scaleY(0); opacity: 1; } 28%, 78% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
@keyframes cfFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cfSteam { 0% { opacity: 0; transform: translateY(4px); } 30% { opacity: .85; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes roseSway { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
@keyframes likeBounce { 0% { transform: scale(.3) rotate(-20deg); } 100% { transform: scale(1.15) rotate(0); } }
@keyframes plusUp { 0% { opacity: 0; transform: translateY(8px); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-26px); } }
.burst {
  position: absolute; font-size: 1.1rem; line-height: 1; transform: translate(-50%, -50%); pointer-events: none;
  animation: burstOut 1.4s ease-out both;
}
@keyframes burstOut {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(40deg); }
}
/* 第三批道具 */
.gift-fx.g12 > span, .gift-fx.g16 > span { animation: likeBounce .6s cubic-bezier(.3, 1.8, .5, 1) both; }
.gift-fx.g13 > span { animation: roseSway .7s ease-in-out .3s 3 alternate; }
.gift-fx.g15 > span { animation: ringShine .6s ease-in-out .2s 4 alternate; }
.gift-fx.g17 > span { animation: squish .3s ease-in-out .15s 5 alternate; }
@keyframes ringShine {
  from { transform: rotate(-8deg); filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)) brightness(1); }
  to { transform: rotate(8deg) scale(1.1); filter: drop-shadow(0 0 12px rgba(255, 255, 255, .95)) brightness(1.3); }
}
@keyframes squish { from { transform: scale(1, 1); } to { transform: scale(1.18, .84); } }
.fw-dot {
  position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; pointer-events: none;
  background: currentColor; box-shadow: 0 0 6px 1px currentColor; animation: fwOut 1.2s cubic-bezier(.15, .8, .3, 1) both;
}
@keyframes fwOut {
  0% { transform: translate(0, 0) scale(1.4); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 22px)) scale(.4); opacity: 0; }
}
.fw-core {
  position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff 0 20%, currentColor 45%, transparent 70%); animation: fwCore .45s ease-out both;
}
@keyframes fwCore { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.rocket-up {
  position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -50%) rotate(-45deg);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .4)); animation: rocketUp 1.8s linear both;
}
@keyframes rocketUp {
  0% { transform: translate(-50%, -50%) rotate(-45deg) scale(.3); opacity: 0; }
  10% { transform: translate(-50%, -50%) rotate(-45deg) scale(1); opacity: 1; }
  16% { transform: translate(-56%, -50%) rotate(-49deg); }
  22% { transform: translate(-44%, -50%) rotate(-41deg); }
  28% { transform: translate(-55%, -50%) rotate(-48deg); }
  34% { transform: translate(-50%, -50%) rotate(-45deg); animation-timing-function: cubic-bezier(.55, 0, .9, .4); }
  100% { transform: translate(-50%, calc(-50% - 110vh)) rotate(-45deg); }
}
.crown-on {
  position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -78%) rotate(-10deg);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)); animation: crownDrop .55s cubic-bezier(.3, 1.5, .5, 1) both, fxFade .5s ease-in 2.6s forwards;
}
@keyframes crownDrop { from { transform: translate(-50%, -320%) rotate(12deg); opacity: 0; } to { transform: translate(-50%, -78%) rotate(-10deg); opacity: 1; } }
@keyframes fxFade { to { opacity: 0; } }
.poop-on {
  position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -72%);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)); animation: poopDrop .5s ease-out both, fxFade .5s ease-in 2.4s forwards;
}
@keyframes poopDrop {
  0% { transform: translate(-50%, -260%); opacity: 0; }
  55% { transform: translate(-50%, -66%) scale(1.3, .7); opacity: 1; }
  78% { transform: translate(-50%, -78%) scale(.9, 1.12); }
  100% { transform: translate(-50%, -72%) scale(1); }
}
.dizzy.flies { animation: cfFade .2s ease both, giftOut .4s ease-in 1.95s forwards; }
.dizzy.flies span { font-size: .8rem; animation-duration: 1.4s; }
.dizzy.flies span:nth-child(2) { animation-delay: -.47s; animation-direction: reverse; }
.peel {
  position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -50%);
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .35)); animation: peelSlide 1.1s ease-out both, fxFade .4s ease-in 1.8s forwards;
}
@keyframes peelSlide {
  0%, 30% { transform: translate(-50%, -50%) rotate(0); }
  100% { transform: translate(60%, -20%) rotate(220deg); }
}
.avatar.slip { animation: slipFall 1.3s ease both; }
@keyframes slipFall {
  0% { transform: none; } 18% { transform: translateX(-6px) rotate(-14deg); }
  40% { transform: translate(6px, 8px) rotate(95deg); } 50% { transform: translate(6px, 4px) rotate(84deg); }
  60%, 80% { transform: translate(6px, 8px) rotate(90deg); } 100% { transform: none; }
}
.pop-flash {
  position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -50%);
  animation: popFlash .35s ease-out both;
}
@keyframes popFlash {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 1; }
  60% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.45); opacity: 0; }
}
.bolt {
  position: absolute; width: 70px; transform: translateX(-50%); pointer-events: none;
  filter: drop-shadow(0 0 6px #fff7a8) drop-shadow(0 0 14px #6fbfff); animation: boltFlick .6s linear both;
}
.bolt svg { width: 100%; height: 100%; overflow: visible; }
@keyframes boltFlick { 0% { opacity: 0; } 6%, 22% { opacity: 1; } 30% { opacity: .2; } 38%, 60% { opacity: 1; } 100% { opacity: 0; } }
.flash { position: absolute; width: 100vw; height: 100vh; background: #f4f8ff; pointer-events: none; animation: flashScreen .55s ease-out both; }
@keyframes flashScreen { 0% { opacity: 0; } 8% { opacity: .75; } 22% { opacity: .05; } 32% { opacity: .5; } 100% { opacity: 0; } }
.avatar.zap { animation: zap .65s steps(1) both; }
@keyframes zap {
  0%, 30%, 60% { filter: invert(1) brightness(1.4); transform: scale(1.06); }
  15%, 45%, 75% { filter: brightness(1.8) contrast(1.4); transform: translateX(-2px); }
  100% { filter: none; transform: none; }
}
/* 被雪球砸：头像结霜 */
.frost {
  position: absolute; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .85) 0 10%, rgba(225, 242, 255, .62) 25%, rgba(175, 215, 248, .58) 60%, rgba(175, 215, 248, 0) 71%);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, .9); animation: sootFade 2.9s ease-in both;
}
/* 第四批道具 */
.gift-fx.g28 > span, .gift-fx.g35 > span { animation: likeBounce .6s cubic-bezier(.3, 1.8, .5, 1) both; }
.gift-fx.g31 > span { animation: heartBeat .55s ease-in-out 3; }
@keyframes heartBeat { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.3); } 40% { transform: scale(1.02); } 60% { transform: scale(1.18); } }
.gift-fx.g32 > span { animation: roseSway .25s ease-in-out 6 alternate; }
.gift-fx.g33 > span { animation: champShake .6s ease-in both; }
@keyframes champShake {
  0% { transform: rotate(0); } 15% { transform: rotate(-12deg); } 30% { transform: rotate(12deg); } 45% { transform: rotate(-12deg); }
  60% { transform: rotate(10deg); } 80% { transform: rotate(-24deg) scale(1.12); } 100% { transform: rotate(-18deg) scale(1.05); }
}
.gift-fx.g34 > span { grid-area: 1 / 1; }
.gift-fx.g34 > span:first-child { animation: champShake .7s ease-in both, fxFade .1s linear .7s forwards; }
.gift-fx.g34 > .prize { opacity: 0; animation: prizePop .5s cubic-bezier(.2, 1.8, .5, 1) .72s forwards; }
@keyframes prizePop { from { opacity: 0; transform: scale(.2) rotate(-30deg); } to { opacity: 1; transform: scale(1.1) rotate(0); } }
.gift-fx.g34 em { animation-delay: .75s; }
.balloon {
  position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -50%);
  animation: balloonUp 3s ease-in both;
}
@keyframes balloonUp {
  0% { transform: translate(-50%, -30%) scale(.3); opacity: 0; }
  12% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  45% { transform: translate(calc(-50% + var(--dx) * .4), -160%) rotate(-7deg); }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% - 75vh)) rotate(7deg); opacity: .9; }
}
.rainbow { position: absolute; transform: translate(-50%, -100%); pointer-events: none; animation: fxFade .6s ease-in 2.35s forwards; }
.rainbow svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 4px rgba(255, 255, 255, .6)); }
.rainbow path { stroke-dasharray: 1; stroke-dashoffset: 1; opacity: .92; animation: drawArc .9s ease-out forwards; }
.rainbow path:nth-child(2) { animation-delay: .06s; } .rainbow path:nth-child(3) { animation-delay: .12s; }
.rainbow path:nth-child(4) { animation-delay: .18s; } .rainbow path:nth-child(5) { animation-delay: .24s; } .rainbow path:nth-child(6) { animation-delay: .3s; }
@keyframes drawArc { to { stroke-dashoffset: 0; } }
.avatar.spicy { animation: spicy 2.6s ease both; }
@keyframes spicy {
  0%, 100% { filter: none; transform: none; }
  8%, 82% { filter: sepia(1) saturate(6) hue-rotate(-45deg) brightness(.95); }
  12%, 28%, 44% { transform: translateX(-3px); } 20%, 36%, 52% { transform: translateX(3px); } 60% { transform: none; }
}
.fire-top {
  position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -85%); transform-origin: 50% 100%;
  animation: fireFlick .14s ease-in-out infinite alternate, fxFade .4s ease-in 2s forwards;
}
@keyframes fireFlick { from { transform: translate(-50%, -85%) scale(1, 1) rotate(-4deg); } to { transform: translate(-50%, -85%) scale(1.12, .9) rotate(4deg); } }
.smoke.steam { background: radial-gradient(circle, rgba(255, 255, 255, .9) 0, rgba(240, 240, 240, .5) 40%, rgba(240, 240, 240, 0) 70%); }
.stink {
  position: absolute; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(150, 200, 60, .8) 0, rgba(120, 170, 50, .5) 45%, rgba(120, 170, 50, 0) 70%);
  animation: stinkDrift 2.4s ease-out both;
}
@keyframes stinkDrift {
  0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
  20% { opacity: .95; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.6); opacity: 0; }
}
.avatar.stinky { animation: stinky 2.5s ease both; }
@keyframes stinky {
  0%, 100% { filter: none; transform: none; }
  10%, 80% { filter: sepia(.7) hue-rotate(45deg) saturate(2.4) brightness(.9); }
  20% { transform: rotate(-6deg) scale(.95); } 35% { transform: rotate(5deg) scale(.95); } 50% { transform: rotate(-4deg) scale(.96); } 65% { transform: none; }
}
.target-on {
  position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -50%);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4));
  animation: targetIn .3s cubic-bezier(.2, 1.6, .5, 1) both, targetWobble .07s linear .3s 8 alternate, fxFade .4s ease-in 2s forwards;
}
@keyframes targetIn { from { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes targetWobble { from { transform: translate(-50%, -50%) rotate(-5deg); } to { transform: translate(-50%, -50%) rotate(5deg); } }
.mummy {
  position: absolute; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; overflow: hidden;
  background: repeating-linear-gradient(-18deg, #fbfbf6 0 8px, #d9d6cc 8px 9px, rgba(255, 255, 255, 0) 9px 11px);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, .25);
  animation: wrapUp .7s ease-out both, fxFade .5s ease-in 2.45s forwards;
}
@keyframes wrapUp { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.mummy i {
  position: absolute; top: 36%; width: 17%; height: 17%; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #333;
  animation: blink 1s linear .8s 2;
}
.mummy i::after { content: ''; position: absolute; left: 32%; top: 32%; width: 38%; height: 38%; border-radius: 50%; background: #111; }
.mummy i:first-child { left: 28%; }
.mummy i:last-child { right: 28%; }
.dizzy.bees { animation: cfFade .2s ease both, giftOut .4s ease-in 1.85s forwards; }
.dizzy.bees span { font-size: 1rem; animation-duration: .75s; }
.dizzy.bees span:nth-child(2) { animation-delay: -.15s; } .dizzy.bees span:nth-child(3) { animation-delay: -.3s; animation-direction: reverse; }
.dizzy.bees span:nth-child(4) { animation-delay: -.45s; } .dizzy.bees span:nth-child(5) { animation-delay: -.6s; animation-direction: reverse; }
.frog-on {
  position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -78%);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4));
  animation: frogHop .55s ease-out both, croak .15s ease-in-out .55s 2 alternate, croak .15s ease-in-out 1.15s 2 alternate, fxFade .4s ease-in 2.25s forwards;
}
@keyframes frogHop {
  0% { transform: translate(-50%, 40%) scale(.6); opacity: 0; }
  45% { transform: translate(-50%, -190%) scale(1); opacity: 1; }
  75% { transform: translate(-50%, -72%) scale(1.15, .85); }
  100% { transform: translate(-50%, -78%) scale(1); }
}
@keyframes croak { from { transform: translate(-50%, -78%) scale(1); } to { transform: translate(-50%, -78%) scale(1.15, .9); } }
/* ---------- 第五批道具 ---------- */
.gift-fx.g44 > span, .gift-fx.g51 > span { animation: likeBounce .6s cubic-bezier(.3, 1.8, .5, 1) both; }
.gift-fx.g45 > span { animation: champShake .5s ease-in both; }
.gift-fx.g46 > span { animation: likeBounce .5s cubic-bezier(.3, 1.8, .5, 1) both, roseSway .3s ease-in-out .5s 4 alternate; }
.gift-fx.g47 > span { animation: carIn .7s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes carIn {
  0% { transform: translateX(-180px) skewX(-12deg); opacity: 0; }
  60% { transform: translateX(12px) skewX(8deg); opacity: 1; }
  80% { transform: translateX(-4px) skewX(-3deg); }
  100% { transform: none; }
}
.gift-fx.g48 > span { animation: boatBob 1s ease-in-out infinite alternate; }
@keyframes boatBob { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-6px) rotate(4deg); } }
.gift-fx .wv { position: absolute; bottom: 2%; left: 50%; transform: translateX(-50%); font-size: 1.3rem; white-space: nowrap; animation: boatBob 1.2s ease-in-out .3s infinite alternate-reverse; }
.gift-fx.g49 > span { transform-origin: 50% 100%; animation: castleRise .8s cubic-bezier(.2, 1.3, .5, 1) both; }
@keyframes castleRise { from { transform: scaleY(0) translateY(20%); opacity: 0; } to { transform: none; opacity: 1; } }
.gift-fx.g50 > span { animation: uniHop .45s ease-out 3 alternate both; }
@keyframes uniHop { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-18px) rotate(6deg); } }
.confetti {
  position: absolute; border-radius: 1px; pointer-events: none; transform: translate(-50%, -50%);
  animation: confettiFly 1.7s cubic-bezier(.2, .7, .4, 1) both;
}
@keyframes confettiFly {
  0% { transform: translate(-50%, -50%) rotate(0); opacity: 1; }
  35% { transform: translate(calc(-50% + var(--dx) * .6), calc(-50% + var(--dy))) rotate(calc(var(--rot) * .4)); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) * -.2 + 60px)) rotate(var(--rot)); opacity: 0; }
}
.coin-rain { position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -50%); animation: coinFall .9s cubic-bezier(.5, 0, 1, .6) both; }
@keyframes coinFall {
  0% { transform: translate(-50%, calc(-50% - 90px)) rotate(-30deg); opacity: 0; }
  20% { opacity: 1; }
  85% { transform: translate(-50%, -50%) rotate(20deg); opacity: 1; }
  100% { transform: translate(-50%, calc(-50% - 10px)) rotate(30deg); opacity: 0; }
}
/* 锤子：从上往下抡 */
.hammer-swing { position: absolute; line-height: 1; pointer-events: none; transform-origin: 85% 85%; filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .4)); animation: hammerSwing .9s ease-in both; }
@keyframes hammerSwing {
  0% { transform: translate(-50%, -60%) rotate(-75deg) scale(.8); opacity: 0; }
  15% { transform: translate(-50%, -60%) rotate(-85deg) scale(1); opacity: 1; }
  30% { transform: translate(-50%, -40%) rotate(15deg) scale(1.05); }
  40% { transform: translate(-50%, -42%) rotate(5deg); }
  80% { transform: translate(-50%, -42%) rotate(8deg); opacity: 1; }
  100% { transform: translate(-50%, -60%) rotate(-30deg); opacity: 0; }
}
.avatar.squash { animation: squash .9s cubic-bezier(.3, 1.6, .5, 1) both; transform-origin: 50% 100%; }
@keyframes squash {
  0% { transform: scale(1.15, .45); } 35% { transform: scale(1.12, .5); }
  60% { transform: scale(.92, 1.12); } 80% { transform: scale(1.04, .96); } 100% { transform: none; }
}
.avatar.jump { animation: jumpUp .8s ease both; }
@keyframes jumpUp {
  0% { transform: none; } 25% { transform: translateY(-26px) rotate(-8deg); } 45% { transform: translateY(-30px) rotate(6deg); }
  70% { transform: translateY(0) scale(1.1, .9); } 85% { transform: translateY(-6px); } 100% { transform: none; }
}
.avatar.spin { animation: spinAround 1.6s cubic-bezier(.4, 0, .4, 1) both; }
@keyframes spinAround { 0% { transform: none; } 20% { transform: translateY(-10px) scale(.95); } 80% { transform: translateY(-10px) rotate(1080deg) scale(.95); } 100% { transform: rotate(1080deg); } }
.ring-wave { position: absolute; border-radius: 50%; border: 3px solid rgba(255, 240, 180, .9); transform: translate(-50%, -50%); pointer-events: none; animation: ringWave .6s ease-out both; }
@keyframes ringWave { from { transform: translate(-50%, -50%) scale(.6); opacity: 1; } to { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } }
.tornado-on { position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -50%); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); animation: tornadoSpin 1.75s ease-in-out both; }
@keyframes tornadoSpin {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  15% { transform: translate(-60%, -55%) scale(1); opacity: .95; }
  35% { transform: translate(-40%, -50%) scale(1.05); } 55% { transform: translate(-58%, -52%) scale(1); } 75% { transform: translate(-44%, -50%) scale(1.05); opacity: .95; }
  100% { transform: translate(-50%, -80%) scale(.6); opacity: 0; }
}
.trash-on {
  position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -50%) rotate(180deg);
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .4)); animation: trashDrop .4s cubic-bezier(.5, 0, .8, .6) both, fxFade .5s ease-in 2.25s forwards;
}
@keyframes trashDrop {
  0% { transform: translate(-50%, -250%) rotate(140deg); opacity: 0; }
  70% { transform: translate(-50%, -45%) rotate(185deg); opacity: 1; }
  85% { transform: translate(-50%, -55%) rotate(176deg); }
  100% { transform: translate(-50%, -50%) rotate(180deg); }
}
.chicken-on { position: absolute; line-height: 1; pointer-events: none; transform: translate(-50%, -50%); transform-origin: 50% 90%; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35)); animation: chickenIn .25s ease-out both, peck .4s ease-in-out .1s 5, fxFade .4s ease-in 1.9s forwards; }
.chicken-on.flip { transform: translate(-50%, -50%) scaleX(-1); }
@keyframes chickenIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes peck { 0%, 100% { rotate: 0deg; } 45% { rotate: -35deg; } }
.chicken-on.flip { animation-name: chickenIn, peckFlip, fxFade; }
@keyframes peckFlip { 0%, 100% { rotate: 0deg; } 45% { rotate: 35deg; } }
/* ---------- 大牌型动画 ---------- */
.combo-banner {
  position: absolute; transform: translate(-50%, -100%); white-space: nowrap; pointer-events: none; z-index: 2;
  font-size: 1.5rem; font-weight: 900; letter-spacing: .06em; color: #fff3b0;
  text-shadow: 0 0 2px #7a2a00, 2px 2px 0 #c0391b, -1px -1px 0 #7a2a00, 0 4px 8px rgba(0, 0, 0, .45);
  animation: bannerPop 1.45s ease-out both;
}
.combo-banner.big { font-size: 2.2rem; }
@keyframes bannerPop {
  0% { transform: translate(-50%, -100%) scale(.3) rotate(-8deg); opacity: 0; }
  18% { transform: translate(-50%, -100%) scale(1.2) rotate(-4deg); opacity: 1; }
  32% { transform: translate(-50%, -100%) scale(1) rotate(-4deg); }
  78% { opacity: 1; }
  100% { transform: translate(-50%, -150%) scale(1) rotate(-4deg); opacity: 0; }
}
/* 飞机：从左往右飞过，后面拖一条白色尾迹 */
.fly-plane { position: absolute; left: 0; top: 0; line-height: 1; pointer-events: none; font-size: clamp(52px, 9vw, 96px); animation: planeFly 1.9s cubic-bezier(.3, .1, .7, .9) both; }
.fly-plane span { display: inline-block; transform: rotate(45deg); filter: drop-shadow(0 10px 6px rgba(0, 0, 0, .35)); }
.fly-plane::before {
  content: ''; position: absolute; right: 78%; top: 50%; width: 46vw; height: 7px; border-radius: 4px; transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .85));
}
@keyframes planeFly {
  0% { transform: translate(-30vw, var(--y0)); }
  55% { transform: translate(45vw, calc((var(--y0) + var(--y1)) / 2 - 20px)); }
  100% { transform: translate(115vw, var(--y1)); }
}
/* 王炸：火箭喷火冲上天 */
.fly-rocket { position: absolute; line-height: 1; pointer-events: none; font-size: clamp(56px, 10vw, 100px); transform: translate(-50%, -50%); animation: rocketFly 1.2s cubic-bezier(.55, 0, .85, .45) both; }
.fly-rocket span { display: inline-block; transform: rotate(-45deg); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .4)); }
.fly-rocket::after {
  content: ''; position: absolute; left: 50%; top: 78%; width: 22px; height: 34vh; transform: translateX(-50%); border-radius: 11px; filter: blur(2px);
  background: linear-gradient(180deg, rgba(255, 245, 180, .95), rgba(255, 160, 40, .85) 18%, rgba(255, 90, 30, .45) 45%, rgba(255, 255, 255, 0));
}
@keyframes rocketFly {
  0% { transform: translate(-50%, -50%) scale(.6); opacity: 0; }
  10% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  22% { transform: translate(-52%, -50%); } 30% { transform: translate(-48%, -52%); }
  100% { transform: translate(-50%, -130vh) scale(1.1); opacity: 1; }
}
/* 炸弹：从上面砸到牌上 */
.drop-bomb { position: absolute; line-height: 1; pointer-events: none; font-size: 3rem; transform: translate(-50%, -50%); animation: bombDrop .3s cubic-bezier(.5, 0, 1, .5) both; }
@keyframes bombDrop { from { transform: translate(-50%, calc(-50% - 45vh)) rotate(-60deg); } to { transform: translate(-50%, -50%) rotate(10deg); } }
/* 拖拉机：扬着土从右往左开过去 */
.drive-tractor { position: absolute; left: 0; top: 0; line-height: 1; pointer-events: none; font-size: clamp(50px, 8vw, 84px); animation: tractorDrive 2.3s linear both; }
.drive-tractor span { display: inline-block; filter: drop-shadow(0 8px 5px rgba(0, 0, 0, .35)); animation: tractorBump .18s ease-in-out infinite alternate; }
.drive-tractor::after {
  content: ''; position: absolute; left: 80%; bottom: 0; width: 1.6em; height: .8em; border-radius: 50%;
  background: radial-gradient(circle at 30% 60%, rgba(190, 150, 100, .8), rgba(160, 120, 80, .4) 45%, rgba(160, 120, 80, 0) 70%);
  animation: dust .3s ease-out infinite;
}
@keyframes tractorDrive { from { transform: translate(110vw, calc(var(--y) - 100%)); } to { transform: translate(-30vw, calc(var(--y) - 100%)); } }
@keyframes tractorBump { from { transform: translateY(0) rotate(0); } to { transform: translateY(-4px) rotate(-2deg); } }
@keyframes dust { from { transform: scale(.6); opacity: .9; } to { transform: translateX(30%) scale(1.3); opacity: .3; } }
/* 顺子：一道金光从牌上扫过 */
.sweep { position: absolute; transform: translate(-50%, -50%); pointer-events: none; overflow: hidden; border-radius: 10px; }
.sweep i {
  position: absolute; top: -20%; bottom: -20%; width: 34%; left: -40%; transform: skewX(-20deg);
  background: linear-gradient(90deg, rgba(255, 230, 140, 0), rgba(255, 245, 200, .85), rgba(255, 230, 140, 0));
  animation: sweepRun .75s ease-in-out .05s both; mix-blend-mode: screen;
}
.sweep.big i { width: 50%; background: linear-gradient(90deg, rgba(255, 200, 80, 0), rgba(255, 250, 220, .95), rgba(255, 200, 80, 0)); animation-duration: .9s; }
@keyframes sweepRun { from { left: -50%; } to { left: 120%; } }
.avatar.gifted { animation: giftedGlow 1.2s ease; }
@keyframes giftedGlow {
  0% { box-shadow: 0 0 0 0 rgba(255, 214, 102, .9); transform: scale(1); }
  30% { box-shadow: 0 0 0 8px rgba(255, 214, 102, .5); transform: scale(1.08); }
  100% { box-shadow: 0 0 0 16px rgba(255, 214, 102, 0); transform: scale(1); }
}
.emote-tip { margin-top: 8px; font-size: .78rem; color: #6b6555; text-align: center; }
.bubble { position: absolute; white-space: nowrap; animation: bubble 3.5s ease forwards; }
.bubble.emoji { font-size: 2.6rem; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); }
.bubble.phrase {
  background: #fffdf6; color: #1d2a22; padding: .45em .85em; border-radius: 14px; font-weight: 700; font-size: .95rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
}
.bubble.phrase::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #fffdf6; border-bottom: 0;
}
/* 语音包：气泡停留到语音放完（--out 由 app.js 按语音长度设置） */
.bubble.voice { animation: bubbleIn .35s ease forwards, bubbleOut .5s ease var(--out, 3s) forwards; background: #fff3cf; }
.bubble.voice::after { border-top-color: #fff3cf; }
.emote-panel .vo { background: #fde9b3; }
.emote-panel .vo:hover { background: #f8d98a; }
@keyframes bubbleIn {
  0% { opacity: 0; transform: translate(-50%, -80%) scale(.6); }
  60% { opacity: 1; transform: translate(-50%, -118%) scale(1.08); }
  100% { opacity: 1; transform: translate(-50%, -112%) scale(1); }
}
@keyframes bubbleOut {
  from { opacity: 1; transform: translate(-50%, -112%); }
  to { opacity: 0; transform: translate(-50%, -135%); }
}
@keyframes bubble {
  0% { opacity: 0; transform: translate(-50%, -80%) scale(.6); }
  10% { opacity: 1; transform: translate(-50%, -118%) scale(1.08); }
  18% { transform: translate(-50%, -112%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -112%); }
  100% { opacity: 0; transform: translate(-50%, -135%); }
}

/* 万能牌（癞子 / 逢人配） */
.card.wild .face { background: linear-gradient(160deg, #fffdf2 55%, #ffeec2); box-shadow: inset 0 0 0 2px #f2b01e; }
.card .wtag {
  position: absolute; left: 7%; top: calc(var(--w) * .74); font-size: calc(var(--w) * .2); line-height: 1.1; padding: 0 .18em;
  background: #f2b01e; color: #4a2a00; border-radius: 4px; font-weight: 800;
}
.chip.lz { background: var(--gold); color: #4a2a00; font-weight: 700; }
/* 两副牌：手牌分两排 */
.hand.two-rows { flex-direction: column; align-items: center; min-height: calc(var(--ch) * 1.72 + 12px); }
.hand-row { display: flex; justify-content: center; }
.hand-row + .hand-row { margin-top: calc(var(--ch) * -.5); }
/* 拖拉机 8 张底牌 */
.bottom-cards.eight { gap: 0; }
.bottom-cards.eight .card { --w: calc(var(--cw) * .44); }
.bottom-cards.eight .card + .card { margin-left: calc(var(--cw) * -.2); }
.lobby-audio { position: fixed; top: 12px; right: 12px; display: flex; gap: 6px; z-index: 5; }
.card.back .face {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .12) 0 4px, transparent 4px 8px),
    linear-gradient(135deg, var(--back1, #b4322b), var(--back2, #7d1611));
  border: 2px solid #fff;
}

/* ---------- 桌面主题 ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; max-height: 58vh; overflow-y: auto; padding: 4px; margin: -4px; }
.theme-sw {
  border: 3px solid transparent; border-radius: 14px; padding: 0; cursor: pointer; overflow: hidden; background: #ddd;
  display: flex; flex-direction: column; font: inherit; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); transition: transform .1s;
}
.theme-sw:hover { transform: translateY(-2px); }
.theme-sw.on { border-color: #f0a91a; box-shadow: 0 0 0 3px rgba(240, 169, 26, .35); }
.theme-sw .pv {
  height: 62px; position: relative; display: flex; align-items: center; justify-content: center; gap: 3px;
  background-color: var(--felt-dark);
  background-image: var(--pattern), radial-gradient(ellipse at 50% 40%, var(--felt-light) 0%, var(--felt) 50%, var(--felt-dark) 100%);
  background-size: var(--pattern-size, auto), 100% 100%;
}
.theme-sw .pv i {
  width: 16px; height: 23px; border-radius: 3px; border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .15) 0 2px, transparent 2px 4px), linear-gradient(135deg, var(--back1, #b4322b), var(--back2, #7d1611));
}
.theme-sw .pv i:first-child { transform: rotate(-10deg); }
.theme-sw .pv i:last-child { transform: rotate(10deg); background: #fff; }
.theme-sw .nm { background: #fffdf6; color: #33443a; font-size: .85rem; font-weight: 600; padding: 5px 0; }
.theme-custom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; color: #33443a; font-size: .9rem; }
.theme-custom input[type=color] { width: 56px; height: 36px; border: 0; padding: 0; background: none; cursor: pointer; }

/* ---------- 弹窗/提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 18%; transform: translate(-50%, -10px); background: rgba(0, 0, 0, .78); color: #fff;
  padding: .6em 1.2em; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.conn { position: fixed; top: 0; left: 0; right: 0; background: #b23b2a; color: #fff; text-align: center; padding: 4px; font-size: .85rem; z-index: 60; }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal-card {
  width: min(520px, 100%); max-height: 92vh; overflow: auto; background: #fffdf6; color: #1d2a22; border-radius: 18px; padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); animation: pop .25s ease-out;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.modal-card h2 { margin: 0 0 4px; text-align: center; font-size: 1.6rem; }
.modal-card h2.win { color: #d98a00; }
.modal-card h2.lose { color: #607068; }
.modal-card .desc { text-align: center; color: #5c6b63; margin: 0 0 14px; font-size: .9rem; }
.res-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 4px; border-top: 1px solid #ece6d4; }
.res-row.me { background: #fff3cf; border-radius: 8px; }
.res-row .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-row .delta { font-weight: 800; font-size: 1.1rem; }
.res-row .delta.plus { color: #d32f2f; }
.res-row .delta.minus { color: #2e7d32; }
.res-row .total { color: #5c6b63; font-size: .85rem; min-width: 5em; text-align: right; }
.res-cards { grid-column: 1 / -1; display: flex; flex-wrap: wrap; }
.res-cards .card { --w: 30px; }
.res-cards .card + .card { margin-left: -16px; }
.modal-card .btn.ghost { background: #ece6d4; color: #5c6b63; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

/* ---------- 小屏 ---------- */
@media (max-width: 640px) {
  :root { --cw: clamp(48px, min(19vw, 10vh), 82px); --pw: calc(var(--cw) * .6); }
  .topbar { display: flex; flex-wrap: wrap; justify-content: space-between; row-gap: 6px; padding: 6px 8px; }
  .stats { flex-wrap: wrap; flex: 1 1 auto; }
  .stats .chip { padding: .25em .5em; font-size: .78rem; }
  .btn, .chip { white-space: nowrap; }
  .topbar .chip-btn .lbl { display: none; }
  .bottom-cards { order: 3; width: 100%; }
  .room-info { font-size: .8rem; }
  .table { --sw: 84px; }
  .played.pos-left { left: calc(var(--sw) + 12px); top: 6%; max-width: 32%; }
  .played.pos-right { right: calc(var(--sw) + 12px); top: 6%; max-width: 32%; }
  .seat.pos-top, .seat.pos-topleft, .seat.pos-topright { max-width: 40%; font-size: .9em; }
  .seat.pos-topleft { left: 26%; }
  .seat.pos-topright { left: 74%; }
  .played.pos-top, .played.pos-topleft, .played.pos-topright { top: 112px; }
  /* 5~6 人时顶部座位占两行，左右座位再往下放，免得压到 */
  .n5 .seat.pos-left, .n5 .seat.pos-right, .n6 .seat.pos-left, .n6 .seat.pos-right { top: 38%; }
  .n5 .played.pos-left, .n5 .played.pos-right, .n6 .played.pos-left, .n6 .played.pos-right { top: 46%; }
  .me-bar { flex-wrap: wrap; justify-content: center; padding: 4px 8px; }
  .me-info { width: 100%; justify-content: center; }
  .actions .btn { min-width: 4em; padding: .5em .9em; }
}
@media (max-height: 480px) and (orientation: landscape) {
  :root { --cw: clamp(44px, min(7.6vw, 18vh), 80px); }
  .topbar { padding: 4px 10px; }
  .avatar { width: 38px; height: 38px; font-size: 1rem; }
  .me-bar { min-height: 40px; }
}
