:root {
  --ink: #18322e;
  --deep: #062d29;
  --felt: #0b4c43;
  --felt-light: #116458;
  --cream: #f6f0df;
  --paper: #fffdf6;
  --gold: #e8b54b;
  --gold-dark: #b87718;
  --blue: #58aee8;
  --red: #c93d37;
  --muted: rgba(255, 255, 255, .7);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--cream);
  background: var(--deep);
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; min-height: 100%; margin: 0; }
body { min-height: 100svh; overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.welcome {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 24px;
  padding: 36px 20px;
  background:
    linear-gradient(150deg, rgba(4, 39, 35, .94), rgba(5, 66, 57, .92)),
    radial-gradient(circle at 20% 20%, #168676, transparent 45%);
}

.welcome::before,
.table-view::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .13;
  background-image: url("data:image/svg+xml,%3Csvg width='88' height='88' viewBox='0 0 88 88' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='.7'%3E%3Ccircle cx='44' cy='44' r='30'/%3E%3Ccircle cx='44' cy='44' r='20'/%3E%3Cpath d='M14 44h60M44 14v60M23 23l42 42M65 23L23 65'/%3E%3C/g%3E%3C/svg%3E");
}

.welcome-glow { position: absolute; width: 420px; height: 420px; border-radius: 50%; filter: blur(60px); opacity: .2; }
.glow-one { background: #ffd16d; top: -240px; right: -120px; }
.glow-two { background: #18bca6; bottom: -280px; left: -100px; }

.brand { position: relative; display: flex; align-items: center; gap: 18px; width: min(430px, 100%); }
.brand-mark { display: grid; grid-template-columns: 1fr 1fr; width: 78px; height: 78px; padding: 8px; gap: 4px; border: 1px solid rgba(255,255,255,.5); border-radius: 22px; transform: rotate(-3deg); box-shadow: 0 14px 40px rgba(0,0,0,.2); }
.brand-mark span { display: grid; place-items: center; color: #173d36; background: var(--cream); border-radius: 9px; font-family: "STKaiti", serif; font-size: 25px; font-weight: 900; }
.eyebrow { margin: 0 0 3px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .2em; }
.brand h1 { margin: 0; font-family: "STKaiti", "KaiTi", serif; font-size: clamp(38px, 9vw, 54px); line-height: 1; letter-spacing: .08em; }
.subtitle { margin: 7px 0 0; color: rgba(255,255,255,.66); font-size: 14px; letter-spacing: .28em; }

.welcome-card { position: relative; width: min(430px, 100%); padding: 24px; color: var(--ink); background: rgba(255, 253, 246, .97); border: 1px solid rgba(255,255,255,.75); border-radius: 26px; box-shadow: 0 28px 70px rgba(0, 24, 21, .4); backdrop-filter: blur(16px); }
.field-label { display: block; margin: 0 0 8px; color: #58716c; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.text-input { width: 100%; height: 49px; padding: 0 16px; border: 1px solid #d8ded6; border-radius: 13px; outline: none; color: var(--ink); background: white; transition: .2s; }
.text-input:focus { border-color: #208977; box-shadow: 0 0 0 3px rgba(32,137,119,.12); }
.mode-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.mode-card { position: relative; min-height: 74px; display: flex; align-items: center; gap: 10px; padding: 11px; text-align: left; color: #34514b; border: 1px solid #d8ded6; border-radius: 14px; background: #fff; }
.mode-card.selected { color: #123d35; border: 2px solid #1d8775; background: #eff9f5; }
.mode-card .mode-icon { flex: 0 0 34px; height: 42px; display: grid; place-items: center; color: #1d473f; background: #f0eadc; border-radius: 8px; font-size: 23px; }
.mode-card .mode-icon.wild { color: #fff; background: linear-gradient(145deg, #d84e45, #8d211e); font-size: 15px; font-weight: 900; }
.mode-card strong, .mode-card small { display: block; white-space: nowrap; }
.mode-card strong { font-size: 14px; }
.mode-card small { margin-top: 4px; color: #7a8f8a; font-size: 10px; }
.mode-card i { position: absolute; top: 5px; right: 7px; display: none; color: #1d8775; font-size: 11px; font-style: normal; }
.mode-card.selected i { display: block; }

.primary-button, .secondary-button, .ghost-button, .game-button { border: 0; font-weight: 800; }
.primary-button { width: 100%; height: 52px; color: #17372f; border-radius: 14px; background: linear-gradient(180deg, #f2ca70, #dfa83d); box-shadow: 0 8px 18px rgba(177,117,16,.24), inset 0 1px rgba(255,255,255,.5); }
.primary-button:hover { filter: brightness(1.04); transform: translateY(-1px); }
.primary-button.compact { width: auto; min-width: 150px; padding: 0 24px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: #9aa9a5; font-size: 11px; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: #e2e6e0; }
.join-row { display: flex; gap: 9px; }
.room-input { text-align: center; letter-spacing: .18em; }
.secondary-button { flex: 0 0 82px; color: #fff; border-radius: 13px; background: #176f62; }
.welcome-note { position: relative; margin: 0; color: rgba(255,255,255,.48); font-size: 11px; }

.table-view { position: relative; width: 100vw; height: 100svh; min-height: 560px; overflow: hidden; background: radial-gradient(ellipse at center, var(--felt-light), var(--felt) 55%, #063a34 100%); }
.table-view::after { content: ""; position: absolute; inset: 58px 14px 14px; pointer-events: none; border: 1px solid rgba(236,199,116,.18); border-radius: 50%; box-shadow: inset 0 0 60px rgba(0,0,0,.16); }
.table-header { position: absolute; z-index: 20; top: 0; left: 0; right: 0; height: 60px; display: flex; align-items: center; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 14px 6px; background: linear-gradient(#052d29, rgba(5,45,41,.75), transparent); }
.icon-button { width: 38px; height: 38px; color: #f3e8cc; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; background: rgba(0,0,0,.12); font-size: 25px; }
.room-info { display: flex; align-items: center; gap: 9px; }
.room-info > span { padding: 5px 8px; color: var(--gold); border: 1px solid rgba(232,181,75,.4); border-radius: 7px; font-size: 10px; font-weight: 800; }
.room-info button { color: rgba(255,255,255,.7); border: 0; background: none; font-size: 12px; }
.room-info b { margin: 0 5px; color: #fff; letter-spacing: .12em; }
.room-info button span { color: var(--gold); }
.felt-pattern { position: absolute; z-index: 0; width: 420px; height: 420px; top: 50%; left: 50%; border: 1px solid rgba(255,255,255,.06); border-radius: 50%; transform: translate(-50%,-50%); }
.felt-pattern::before, .felt-pattern::after { content:""; position:absolute; inset:60px; border:1px solid rgba(255,255,255,.04); border-radius:50%; transform:rotate(45deg); }
.felt-pattern::after { inset: 130px; background: rgba(255,255,255,.018); }

.players-layer { position: absolute; z-index: 8; inset: 55px 10px 105px; pointer-events: none; }
.player { position: absolute; min-width: 76px; display: flex; align-items: center; gap: 7px; }
.player.pos-bottom { left: 14px; bottom: 70px; }
.player.pos-top { left: 50%; top: 5px; transform: translateX(-50%); }
.player.pos-left { left: 0; top: 43%; }
.player.pos-right { right: 0; top: 43%; flex-direction: row-reverse; text-align: right; }
.avatar { position: relative; width: 49px; height: 49px; display: grid; place-items: center; flex: 0 0 auto; color: #f8efd8; border: 2px solid rgba(255,255,255,.65); border-radius: 50%; background: linear-gradient(145deg, #367e71, #133f38); box-shadow: 0 5px 14px rgba(0,0,0,.25); font-family: "STKaiti", serif; font-size: 21px; }
.team-gold .avatar { background: linear-gradient(145deg, #b97a2f, #64401d); }
.current .avatar { border-color: #ffd977; box-shadow: 0 0 0 4px rgba(255,215,119,.18), 0 0 22px rgba(255,202,83,.38); }
.offline .avatar { filter: grayscale(1); opacity: .6; }
.bot-mark { position: absolute; right: -5px; bottom: -3px; padding: 2px 4px; color: #24433d; border-radius: 5px; background: #dfe9e4; font: 700 8px system-ui; }
.player-meta strong { display: block; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.player-meta span { display: inline-block; margin-top: 4px; padding: 2px 6px; color: #e8dec5; border-radius: 8px; background: rgba(0,0,0,.18); font-size: 10px; }
.finish-badge { color: #5b3c14 !important; background: var(--gold) !important; }

.lobby-panel, .result-panel { position: absolute; z-index: 12; top: 50%; left: 50%; width: min(370px, calc(100% - 44px)); padding: 25px; text-align: center; color: var(--ink); border: 1px solid rgba(255,255,255,.65); border-radius: 24px; background: rgba(255,253,246,.96); box-shadow: 0 25px 70px rgba(0,0,0,.3); transform: translate(-50%,-48%); backdrop-filter: blur(18px); }
.lobby-panel h2, .result-panel h2 { margin: 4px 0 12px; font-family: "STKaiti", serif; font-size: 28px; }
.lobby-panel > p:not(.eyebrow) { color: #6f827d; font-size: 12px; }
.seat-dots { display: flex; justify-content: center; gap: 8px; margin: 16px 0; }
.seat-dot { width: 34px; height: 44px; display: grid; place-items: center; color: #8da09b; border: 1px dashed #aab8b4; border-radius: 9px; background: #eef1ec; }
.seat-dot.filled { color: #fff; border-style: solid; border-color: #3a8f80; background: #2a7568; }
.lobby-actions { display: flex; gap: 9px; margin-top: 18px; }
.ghost-button { height: 52px; flex: 1; color: #42635d; border: 1px solid #ccd9d4; border-radius: 14px; background: #fff; }

.game-layer { position: absolute; z-index: 10; inset: 60px 0 0; }
.score-strip { position: absolute; top: 6px; left: 50%; display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.65); transform: translateX(-50%); white-space: nowrap; font-size: 9px; }
.score-strip > span:nth-child(2) { padding: 3px 7px; color: #f3e5bf; border-radius: 8px; background: rgba(0,0,0,.15); }
.score-strip b { color: #fff; font-weight: 600; }
.score-strip i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; }
.blue-dot { background: var(--blue); }.gold-dot { background: var(--gold); }
.turn-message { position: absolute; top: 20%; left: 50%; padding: 5px 12px; color: rgba(255,255,255,.74); border-radius: 12px; background: rgba(2,31,28,.25); transform: translateX(-50%); font-size: 11px; white-space: nowrap; }
.last-play { position: absolute; top: 31%; left: 50%; display: flex; justify-content: center; transform: translateX(-50%); }
.last-play .playing-card + .playing-card { margin-left: -31px; }
.last-play .playing-card { width: 48px; height: 68px; font-size: 12px; }
.action-bar { position: absolute; z-index: 15; left: 50%; bottom: 124px; display: flex; gap: 10px; transform: translateX(-50%); }
.game-button { min-width: 76px; height: 39px; border-radius: 20px; box-shadow: 0 5px 14px rgba(0,0,0,.18); }
.game-button:disabled { opacity: .36; cursor: not-allowed; filter: grayscale(.5); }
.game-button.muted { color: #e8ece8; border: 1px solid rgba(255,255,255,.22); background: rgba(5,41,37,.72); }
.game-button.light { color: #28564d; background: #f4f1e7; }
.game-button.gold { color: #493310; background: linear-gradient(#f4cf76, #dfa33a); }
.hand { position: absolute; z-index: 14; left: 50%; bottom: max(8px, env(safe-area-inset-bottom)); width: min(96vw, 900px); height: 112px; display: flex; justify-content: flex-start; align-items: flex-end; overflow-x: auto; overflow-y: hidden; transform: translateX(-50%); padding: 18px 8px 0; scrollbar-width: none; }
.hand::-webkit-scrollbar { display: none; }
.playing-card { position: relative; width: clamp(42px, 8vw, 64px); height: clamp(68px, 12vw, 92px); flex: 0 0 auto; padding: 5px; color: #17231f; border: 1px solid #d4d0c6; border-radius: 7px; background: linear-gradient(145deg, #fffef9, #eeeae0); box-shadow: 0 4px 9px rgba(0,0,0,.26); transition: transform .14s ease, filter .14s; user-select: none; }
.hand .playing-card { margin-left: var(--overlap, -26px); }
.hand .playing-card:first-child { margin-left: 0; }
.hand .playing-card:hover { filter: brightness(1.03); }
.hand .playing-card.selected { transform: translateY(-18px); box-shadow: 0 8px 18px rgba(0,0,0,.32), 0 0 0 2px #f3c862; }
.card-rank { display: block; font-family: Georgia, serif; font-size: clamp(15px, 3vw, 21px); font-weight: 800; line-height: .9; }
.card-suit { font-size: clamp(14px, 3vw, 20px); }
.playing-card.red { color: var(--red); }
.playing-card.joker { color: white; border-color: #9b322e; background: linear-gradient(145deg, #cf493f, #7f1d1b); }
.playing-card.joker.small { background: linear-gradient(145deg, #325e59, #163934); border-color: #406e67; }
.joker-word { position: absolute; left: 50%; bottom: 8px; font-family: "STKaiti", serif; font-size: 15px; letter-spacing: .15em; writing-mode: vertical-rl; transform: translateX(-50%); }
.wild-star { position: absolute; right: 4px; bottom: 4px; color: #ffe08c; font-size: 10px; }

.result-panel { z-index: 30; }
.result-crown { width: 58px; height: 58px; display: grid; place-items: center; margin: -56px auto 8px; color: #61400f; border: 4px solid rgba(255,255,255,.9); border-radius: 50%; background: linear-gradient(#f6d379,#dfa338); box-shadow: 0 7px 20px rgba(0,0,0,.25); font-size: 28px; }
.result-panel ol { margin: 18px 0; padding: 0; list-style: none; counter-reset: rank; text-align: left; }
.result-panel li { counter-increment: rank; display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid #e4e7df; font-size: 13px; }
.result-panel li::before { content: counter(rank); width: 20px; color: #a47425; font-weight: 900; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; max-width: calc(100% - 40px); padding: 10px 18px; opacity: 0; pointer-events: none; color: white; border-radius: 18px; background: rgba(15,25,23,.9); transform: translate(-50%, 15px); transition: .2s; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.rules-dialog { width: min(440px, calc(100% - 28px)); color: var(--ink); border: 0; border-radius: 22px; background: var(--paper); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.rules-dialog::backdrop { background: rgba(1,20,18,.68); backdrop-filter: blur(4px); }
.rules-dialog h2 { margin: 5px 0 17px; font-family: "STKaiti", serif; font-size: 28px; }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; color: #526e68; border: 0; border-radius: 50%; background: #edf0ea; font-size: 21px; }
.rules-copy p { color: #425c57; font-size: 13px; line-height: 1.7; }
.rules-copy .rules-note { padding: 10px; color: #7f673d; border-radius: 10px; background: #f7efd9; font-size: 11px; }

@media (min-width: 760px) {
  .players-layer { inset: 68px 50px 135px; }
  .player.pos-left { left: 8%; }.player.pos-right { right: 8%; }
  .player.pos-bottom { left: 10%; bottom: 70px; }
  .action-bar { bottom: 148px; }
  .hand { height: 132px; }
  .last-play .playing-card + .playing-card { margin-left: -24px; }
}

/* V3 真实纸牌、横牌/竖牌模式 */
.table-view {
  background:
    radial-gradient(ellipse at 50% 43%, rgba(107, 179, 87, .96), rgba(54, 139, 70, .97) 58%, #216641 100%),
    #3c8b50;
}
.table-view::before {
  opacity: .22;
  background-image: repeating-linear-gradient(128deg, rgba(255,255,255,.045) 0 1px, transparent 1px 6px);
}
.table-view::after {
  inset: 64px 2.2vw 14px;
  border: 5px solid rgba(18, 65, 51, .34);
  border-radius: 11% / 45%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.1), inset 0 0 80px rgba(16,70,42,.18);
}
.table-header { background: linear-gradient(rgba(20,91,59,.92), rgba(20,91,59,.45), transparent); }

.avatar { appearance: none; padding: 0; }
.avatar.interactive { pointer-events: auto; cursor: pointer; }
.avatar.interactive::after { content: "送道具"; position: absolute; left: 50%; bottom: -17px; opacity: 0; color: #fff7db; border-radius: 7px; background: rgba(15,67,48,.8); transform: translateX(-50%); white-space: nowrap; font: 700 8px/14px system-ui; transition: .15s; }
.avatar.interactive:hover::after { opacity: 1; }

.playing-card {
  width: clamp(62px, 7.4vw, 76px);
  height: clamp(89px, 10.6vw, 108px);
  overflow: hidden;
  padding: 0;
  color: #171717;
  border: 1px solid #c9c6bd;
  border-radius: 8px;
  background: linear-gradient(145deg, #ffffff 0%, #fbfaf7 72%, #e9e7df 100%);
  box-shadow: 0 4px 10px rgba(21,43,29,.32), inset 0 0 0 1px rgba(255,255,255,.9);
}
.playing-card.red { color: #d52825; }
.card-corner { position: absolute; z-index: 2; width: 27px; text-align: center; font-family: "Arial Narrow", "Helvetica Neue", sans-serif; font-style: normal; line-height: .86; }
.card-corner b { display: block; font-size: clamp(20px, 2.4vw, 27px); font-weight: 800; letter-spacing: -.08em; }
.card-corner i { display: block; margin-top: 3px; font-size: clamp(15px, 2vw, 20px); font-style: normal; }
.card-corner-top { top: 5px; left: 3px; }
.card-corner-bottom { right: 3px; bottom: 5px; transform: rotate(180deg); }
.card-center { position: absolute; inset: 22% 8% 8%; display: grid; place-items: center; font-style: normal; }
.card-center i { font-size: clamp(35px, 5vw, 54px); font-style: normal; opacity: .95; }
.card-center.court { grid-template-columns: 1fr; color: inherit; border: 2px solid currentColor; border-radius: 5px; background: repeating-linear-gradient(45deg, transparent 0 5px, currentColor 6px 7px); opacity: .82; }
.card-center.court b { padding: 2px 4px; color: white; border-radius: 3px; background: currentColor; filter: invert(1); font-family: Georgia, serif; font-size: 26px; }

.playing-card.joker,
.playing-card.joker.small {
  color: #1d1d1d;
  border-color: #c9c6bd;
  background: linear-gradient(145deg, #fff 0%, #fbfaf7 70%, #e8e6df 100%);
}
.playing-card.joker:not(.small) { color: #ce2f2a; }
.joker-corner { position: absolute; top: 5px; left: 4px; font: 800 7px/1 Arial, sans-serif; letter-spacing: -.04em; writing-mode: vertical-rl; }
.joker-art { position: absolute; right: 7px; top: 17px; font-size: clamp(31px, 4vw, 43px); transform: rotate(8deg); text-shadow: 1px 1px #d4aa3b; }
.joker-letters { position: absolute; left: 11px; bottom: 6px; font: 900 9px/.82 Arial, sans-serif; }
.joker-name { position: absolute; right: 7px; bottom: 7px; font-family: "STKaiti", serif; font-size: 12px; font-weight: 900; }
.wild-star { right: 5px; top: 5px; bottom: auto; padding: 2px 3px; color: #fff; border-radius: 4px; background: #d53b34; font-size: 7px; }

.play-zone { min-width: 100px; min-height: 108px; }
.play-zone .playing-card { width: 66px; height: 95px; }
.play-zone .playing-card + .playing-card { margin-left: -19px; }
.play-zone .card-corner b { font-size: 23px; }
.play-zone .card-corner i { font-size: 17px; }
.play-zone .card-center i { font-size: 40px; }
.play-zone .joker-art { font-size: 35px; }

.hand { width: min(97vw, 960px); height: 136px; padding: 25px 10px 0; }
.hand.layout-fan .playing-card { margin-left: var(--overlap, -38px); }
.hand.layout-fan .playing-card:first-child { margin-left: 0; }
.hand.layout-stacked { height: 160px; align-items: flex-start; gap: 0; padding: 7px 10px 0; }
.card-column { position: relative; width: 76px; height: 150px; flex: 0 0 43px; }
.card-column:last-child { flex-basis: 76px; }
.card-column .playing-card { position: absolute; left: 0; margin: 0; transform: none; }
.card-column .playing-card.selected { transform: translateY(-8px); box-shadow: 0 7px 14px rgba(0,0,0,.35), 0 0 0 3px #ffd458; }

.hand-layout-switch { position: absolute; z-index: 24; right: 70px; bottom: 140px; display: flex; padding: 3px; border-radius: 18px; background: rgba(12,70,46,.68); box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.hand-layout-switch button { min-width: 56px; height: 32px; color: rgba(255,255,255,.72); border: 0; border-radius: 15px; background: transparent; font-size: 12px; font-weight: 800; }
.hand-layout-switch button.active { color: white; background: linear-gradient(#4ba7ed,#2378c6); box-shadow: 0 2px 7px rgba(0,0,0,.22); }
.game-layer.hand-stacked .action-bar { bottom: 169px; }
.game-layer.hand-stacked .social-bar { bottom: 178px; }
.game-layer.hand-stacked .hand-layout-switch { bottom: 166px; }
.game-layer.hand-stacked .play-zone.pos-bottom { bottom: 246px; }

.card-counter { position: absolute; z-index: 35; top: 68px; left: 14px; width: min(390px, calc(100% - 28px)); padding: 10px; color: #edf9f3; border: 1px solid rgba(255,255,255,.2); border-radius: 13px; background: rgba(18,56,47,.92); box-shadow: 0 12px 30px rgba(0,0,0,.28); backdrop-filter: blur(12px); }
.card-counter header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-counter header strong { color: #ffe28a; font-size: 12px; }
.card-counter header button { width: 25px; height: 25px; color: white; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); }
.counter-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.counter-grid div { padding: 4px 1px; text-align: center; border-radius: 5px; background: rgba(255,255,255,.1); }
.counter-grid b, .counter-grid span { display: block; }
.counter-grid b { color: white; font-size: 9px; }
.counter-grid span { margin-top: 2px; color: #ffe16e; font-size: 12px; font-weight: 900; }
.card-counter small { display: block; margin-top: 7px; color: rgba(255,255,255,.55); font-size: 8px; }

@media (max-width: 620px) {
  .playing-card { width: 60px; height: 87px; border-radius: 7px; }
  .card-corner { width: 25px; }
  .card-corner b { font-size: 21px; }
  .card-corner i { margin-top: 2px; font-size: 16px; }
  .card-center i { font-size: 37px; }
  .play-zone { min-width: 78px; min-height: 76px; }
  .play-zone .playing-card { width: 52px; height: 75px; }
  .play-zone .playing-card + .playing-card { margin-left: -14px; }
  .play-zone .card-corner b { font-size: 18px; }
  .play-zone .card-corner i { font-size: 14px; }
  .play-zone .card-center i { font-size: 29px; }
  .play-zone.pos-left { left: 22%; }
  .play-zone.pos-right { right: 22%; }
  .hand { height: 135px; }
  .hand.layout-stacked { height: 155px; }
  .card-column { width: 60px; height: 148px; flex-basis: 29px; }
  .card-column:last-child { flex-basis: 60px; }
  .hand-layout-switch { right: 48px; bottom: 141px; }
  .hand-layout-switch button { min-width: 48px; height: 29px; }
  .game-layer.hand-stacked .action-bar { bottom: 164px; }
  .game-layer.hand-stacked .social-bar { bottom: 176px; }
  .game-layer.hand-stacked .hand-layout-switch { bottom: 163px; }
  .game-layer.hand-stacked .play-zone.pos-bottom { bottom: 235px; }
  .card-counter { width: calc(100% - 28px); }
  .counter-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (max-height: 650px) and (orientation: landscape) {
  .table-view { min-height: 100svh; }
  .players-layer { inset: 52px 30px 80px; }
  .player.pos-left, .player.pos-right { top: 35%; }
  .player.pos-bottom { bottom: 52px; }
  .avatar { width: 42px; height: 42px; }
  .turn-message { top: 13%; }
  .last-play { top: 26%; }
  .action-bar { bottom: 102px; }
  .hand { height: 92px; }
  .playing-card { height: 74px; width: 50px; }
}

/* V2 牌桌：更干净的背景、四向出牌区与社交互动 */
.table-view {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(36, 128, 113, .72) 0%, rgba(12, 82, 72, .9) 48%, #063d37 100%),
    linear-gradient(145deg, #0d6a5e, #073f39);
}
.table-view::before {
  opacity: .18;
  background-image:
    radial-gradient(circle at 18% 15%, rgba(255,255,255,.15), transparent 22%),
    radial-gradient(circle at 78% 82%, rgba(0,0,0,.16), transparent 26%);
}
.table-view::after {
  inset: 68px 3vw 18px;
  border-color: rgba(255, 231, 168, .13);
  border-radius: 44% / 48%;
  box-shadow: inset 0 0 90px rgba(0,0,0,.12);
}
.felt-pattern { display: none; }
.table-header { background: linear-gradient(#063832, rgba(6,56,50,.62), transparent); }

.turn-timer {
  position: absolute;
  z-index: 2;
  top: -8px;
  right: -9px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: #fff4c9;
  border: 2px solid rgba(255,255,255,.18);
  border-top-color: #f2c75f;
  border-radius: 50%;
  background: #0b4d44;
  box-shadow: 0 3px 8px rgba(0,0,0,.28);
  font: 900 11px/1 system-ui;
  animation: timer-spin 1s linear infinite;
}
.turn-timer span { animation: timer-spin 1s linear infinite reverse; }
@keyframes timer-spin { to { transform: rotate(360deg); } }

.play-zones { position: absolute; z-index: 9; inset: 0; pointer-events: none; }
.play-zone { position: absolute; min-width: 76px; min-height: 72px; display: flex; align-items: center; justify-content: center; }
.play-zone.pos-top { top: 76px; left: 50%; transform: translateX(-50%); }
.play-zone.pos-bottom { bottom: 190px; left: 50%; transform: translateX(-50%); }
.play-zone.pos-left { top: 45%; left: 18%; transform: translateY(-50%); }
.play-zone.pos-right { top: 45%; right: 18%; transform: translateY(-50%); }
.play-zone .playing-card { width: 46px; height: 66px; padding: 4px; }
.play-zone .playing-card + .playing-card { margin-left: -29px; }
.play-zone .card-rank { font-size: 15px; }
.play-zone .card-suit { font-size: 14px; }
.pass-mark { padding: 5px 11px; color: rgba(255,255,255,.76); border: 1px solid rgba(255,255,255,.13); border-radius: 13px; background: rgba(2,31,28,.25); font-size: 12px; }

.turn-message { top: 18%; background: rgba(2,31,28,.16); }
.last-play { display: none; }

.hand {
  height: 126px;
  padding: 24px 10px 0;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}
.playing-card {
  width: clamp(54px, 7vw, 70px);
  height: clamp(82px, 10vw, 102px);
  padding: 6px 5px;
  border: 1px solid rgba(119,113,98,.45);
  border-radius: 8px;
  background: linear-gradient(150deg, #fff 0%, #fffdf8 58%, #e9e5da 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,.27);
  transform: translateY(var(--curve, 0px)) rotate(var(--tilt, 0deg));
  transform-origin: 50% 110%;
}
.hand .playing-card { margin-left: var(--overlap, -30px); }
.hand .playing-card.selected { transform: translateY(calc(var(--curve, 0px) - 20px)) rotate(var(--tilt, 0deg)); }
.card-rank { font-size: clamp(19px, 3vw, 25px); line-height: .88; }
.card-suit { display: block; margin-top: 2px; font-size: clamp(17px, 2.8vw, 23px); line-height: 1; }
.joker-word { font-size: 16px; }

.social-bar { position: absolute; z-index: 22; right: 12px; bottom: 132px; display: flex; flex-direction: column; gap: 7px; }
.social-bar button { width: 38px; height: 38px; padding: 0; color: #f6ead0; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; background: rgba(2,38,34,.62); box-shadow: 0 4px 12px rgba(0,0,0,.2); font-size: 15px; font-weight: 800; backdrop-filter: blur(8px); }
.social-bar button.recording { color: white; background: #c5423d; animation: voice-pulse .8s ease-in-out infinite alternate; }
@keyframes voice-pulse { to { transform: scale(1.12); box-shadow: 0 0 0 8px rgba(197,66,61,.18); } }

.social-sheet { position: fixed; z-index: 90; right: 12px; bottom: 12px; width: min(390px, calc(100vw - 24px)); overflow: hidden; color: var(--ink); border: 1px solid rgba(255,255,255,.7); border-radius: 20px; background: rgba(255,253,247,.98); box-shadow: 0 22px 60px rgba(0,0,0,.35); backdrop-filter: blur(18px); }
.social-sheet header { height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid #e6e8e1; }
.social-tabs { display: flex; gap: 4px; }
.social-tabs button { padding: 7px 10px; color: #72817d; border: 0; border-radius: 10px; background: transparent; font-size: 12px; font-weight: 700; }
.social-tabs button.active { color: #176f62; background: #e7f3ef; }
.sheet-close { width: 30px; height: 30px; color: #61736f; border: 0; border-radius: 50%; background: #eef0eb; font-size: 20px; }
.social-panel { display: none; padding: 12px; }
.social-panel.active { display: block; }
.quick-list { display: grid; gap: 5px; max-height: 200px; overflow-y: auto; }
.quick-list button { padding: 9px 11px; text-align: left; color: #36534d; border: 0; border-radius: 9px; background: #f3f5f0; font-size: 12px; }
.chat-compose { display: flex; gap: 7px; margin-top: 10px; }
.chat-compose input { min-width: 0; height: 40px; flex: 1; padding: 0 11px; color: var(--ink); border: 1px solid #d8dfda; border-radius: 10px; outline: 0; }
.chat-compose button { width: 62px; color: #fff; border: 0; border-radius: 10px; background: #187465; font-weight: 800; }
.emoji-grid.active { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.emoji-grid button { height: 48px; border: 0; border-radius: 12px; background: #f1f3ee; font-size: 26px; }
.panel-tip { margin: 0 0 10px; color: #7a8a86; font-size: 11px; }
.prop-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.prop-grid button { padding: 8px 3px; color: #536a65; border: 1px solid transparent; border-radius: 12px; background: #f2f3ef; font-size: 11px; }
.prop-grid button.selected { color: #167264; border-color: #54a294; background: #e8f5f1; }
.prop-grid span { display: block; margin-bottom: 3px; font-size: 25px; }
.prop-targets { display: flex; gap: 7px; margin-top: 10px; }
.prop-targets button { flex: 1; padding: 8px 3px; overflow: hidden; color: white; text-overflow: ellipsis; white-space: nowrap; border: 0; border-radius: 10px; background: #176f62; font-size: 11px; }

.speech-bubble { position: absolute; z-index: 15; max-width: 160px; padding: 7px 10px; color: #314b46; border-radius: 13px 13px 13px 3px; background: rgba(255,253,246,.96); box-shadow: 0 5px 16px rgba(0,0,0,.18); font-size: 11px; animation: bubble-in .2s ease-out; }
.speech-bubble.emoji { padding: 5px 9px; font-size: 29px; }
.speech-bubble.pos-bottom { left: 86px; bottom: 125px; }
.speech-bubble.pos-top { top: 64px; left: 50%; transform: translateX(20px); }
.speech-bubble.pos-left { top: 43%; left: 74px; }
.speech-bubble.pos-right { top: 43%; right: 74px; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px) scale(.9); } }

.social-effects { position: absolute; z-index: 70; inset: 0; overflow: hidden; pointer-events: none; }
.flying-prop { position: absolute; left: 0; top: 0; font-size: 38px; filter: drop-shadow(0 7px 6px rgba(0,0,0,.3)); animation: prop-flight 850ms cubic-bezier(.2,.8,.3,1) forwards; }
@keyframes prop-flight {
  0% { transform: translate(var(--from-x), var(--from-y)) rotate(-20deg) scale(.5); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(var(--to-x), var(--to-y)) rotate(390deg) scale(1.15); opacity: 0; }
}

@media (max-width: 620px) {
  .play-zone.pos-top { top: 70px; }
  .play-zone.pos-bottom { bottom: 196px; }
  .play-zone.pos-left { left: 24%; top: 42%; }
  .play-zone.pos-right { right: 24%; top: 42%; }
  .play-zone .playing-card { width: 40px; height: 58px; }
  .play-zone .playing-card + .playing-card { margin-left: -27px; }
  .social-bar { right: 7px; bottom: 143px; }
  .social-bar button { width: 34px; height: 34px; font-size: 13px; }
  .playing-card { width: 54px; height: 84px; }
  .action-bar { bottom: 137px; }
  .player.pos-bottom { bottom: 82px; }
}

@media (min-width: 760px) {
  .play-zone.pos-left { left: 24%; }
  .play-zone.pos-right { right: 24%; }
  .play-zone.pos-bottom { bottom: 222px; }
  .social-bar { right: 24px; bottom: 160px; }
}

/* V3 最终层叠优先级 */
.table-view { background: radial-gradient(ellipse at 50% 43%, rgba(107,179,87,.96), rgba(54,139,70,.97) 58%, #216641 100%), #3c8b50; }
.table-view::before { opacity: .22; background-image: repeating-linear-gradient(128deg, rgba(255,255,255,.045) 0 1px, transparent 1px 6px); }
.table-view::after { inset: 64px 2.2vw 14px; border: 5px solid rgba(18,65,51,.34); border-radius: 11% / 45%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.1), inset 0 0 80px rgba(16,70,42,.18); }
.table-header { background: linear-gradient(rgba(20,91,59,.92), rgba(20,91,59,.45), transparent); }
.playing-card { width: clamp(62px,7.4vw,76px); height: clamp(89px,10.6vw,108px); overflow: hidden; padding: 0; border: 1px solid #c9c6bd; background: linear-gradient(145deg,#fff 0%,#fbfaf7 72%,#e9e7df 100%); box-shadow: 0 4px 10px rgba(21,43,29,.32), inset 0 0 0 1px rgba(255,255,255,.9); }
.play-zone { min-width: 100px; min-height: 108px; }
.play-zone .playing-card { width: 66px; height: 95px; padding: 0; }
.play-zone .playing-card + .playing-card { margin-left: -19px; }
.hand { width: min(97vw,960px); height: 136px; padding: 25px 10px 0; }
.hand.layout-stacked { height: 160px; padding: 7px 10px 0; }
.hand-layout-switch,
.game-layer.hand-stacked .hand-layout-switch { top: 10px; right: 12px; bottom: auto; }

@media (max-width:620px) {
  .playing-card { width: 60px; height: 87px; padding: 0; }
  .play-zone { min-width: 78px; min-height: 76px; }
  .play-zone .playing-card { width: 52px; height: 75px; padding: 0; }
  .play-zone .playing-card + .playing-card { margin-left: -14px; }
  .play-zone.pos-left { left: 22%; }
  .play-zone.pos-right { right: 22%; }
  .hand { height: 135px; }
  .hand.layout-stacked { height: 155px; }
}

@media (max-height:520px) and (orientation:landscape) {
  .table-view { height: 100svh; min-height: 100svh; }
  .table-view::after { inset: 43px 14px 5px; border-width: 3px; border-radius: 10% / 42%; }
  .table-header { height: 44px; padding: 4px 12px; }
  .icon-button { width: 32px; height: 32px; font-size: 20px; }
  .room-info > span { padding: 3px 6px; }
  .players-layer { inset: 42px 24px 88px; }
  .player { transform: scale(.88); transform-origin: center; }
  .player.pos-top { top: -2px; transform: translateX(-50%) scale(.88); }
  .player.pos-left { left: 2%; top: 40%; }
  .player.pos-right { right: 2%; top: 40%; }
  .player.pos-bottom { left: 1%; bottom: -60px; }
  .avatar { width: 42px; height: 42px; font-size: 18px; }
  .game-layer { inset: 44px 0 0; }
  .score-strip { top: 0; }
  .turn-message { top: 14%; padding: 3px 9px; }
  .play-zone.pos-top { top: 48px; }
  .play-zone.pos-bottom { bottom: 118px; }
  .play-zone.pos-left { left: 24%; top: 43%; }
  .play-zone.pos-right { right: 24%; top: 43%; }
  .play-zone { min-width: 72px; min-height: 68px; }
  .play-zone .playing-card { width: 47px; height: 68px; }
  .play-zone .playing-card + .playing-card { margin-left: -12px; }
  .play-zone .card-corner b { font-size: 17px; }
  .play-zone .card-corner i { font-size: 13px; }
  .play-zone .card-center i { font-size: 27px; }
  .hand { left: 53%; width: min(72vw,640px); height: 101px; padding: 12px 7px 0; }
  .playing-card { width: 58px; height: 82px; }
  .card-corner b { font-size: 19px; }
  .card-corner i { font-size: 15px; }
  .card-center i { font-size: 34px; }
  .hand.layout-stacked { width: min(72vw,640px); height: 111px; padding: 3px 7px 0; }
  .card-column { width: 54px; height: 106px; flex-basis: 35px; }
  .card-column:last-child { flex-basis: 54px; }
  .card-column .playing-card { width: 54px; height: 75px; }
  .action-bar { bottom: 101px; }
  .game-layer.hand-stacked .action-bar { bottom: 112px; }
  .social-bar,
  .game-layer.hand-stacked .social-bar { top: auto; right: 8px; bottom: 98px; flex-direction: column; }
  .social-bar button { width: 31px; height: 31px; font-size: 11px; }
  .hand-layout-switch,
  .game-layer.hand-stacked .hand-layout-switch { top: 3px; right: 48px; }
  .hand-layout-switch button { min-width: 44px; height: 25px; font-size: 10px; }
  .game-layer.hand-stacked .play-zone.pos-bottom { bottom: 128px; }
  .social-sheet { right: 8px; bottom: 7px; max-height: calc(100svh - 14px); overflow-y: auto; }
  .social-sheet header { height: 42px; }
  .quick-list { max-height: 150px; }
  .card-counter { top: 45px; width: 360px; }
  .counter-grid { grid-template-columns: repeat(8,1fr); }
}

/* V4 简约纸牌、完整边界与手机横屏 */
.players-layer { z-index: 19; }
.orientation-prompt { display: none; }
.orientation-prompt.visible {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  color: #fff;
  background: rgba(5, 30, 27, .96);
  backdrop-filter: blur(12px);
}
.orientation-card {
  width: min(320px, 92vw);
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 26px 22px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 22px;
  background: rgba(255,255,255,.08);
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
.orientation-card > span { font-size: 48px; line-height: 1; transform: rotate(90deg); }
.orientation-card strong { font-size: 20px; }
.orientation-card small { color: rgba(255,255,255,.65); }
.orientation-card button { height: 42px; margin-top: 5px; padding: 0 24px; color: #24402f; border: 0; border-radius: 21px; background: #f0c763; font-weight: 900; }

.playing-card {
  color: #151515;
  border-color: #c8c5bd;
  border-radius: 7px;
  background: linear-gradient(145deg, #fff 0%, #fdfcf9 75%, #ece9e1 100%);
}
.playing-card.red { color: #d12421; }
.card-corner { width: 28px; font-family: Georgia, "Times New Roman", serif; line-height: .83; }
.card-corner b { font-weight: 800; letter-spacing: -.06em; }
.card-corner i { margin-top: 4px; }
.card-corner-bottom { display: none; }
.card-center { inset: 26% 7% 7% 24%; display: flex; align-items: center; justify-content: center; }
.card-center i { font-family: Georgia, serif; opacity: 1; }
.card-center.court { display: flex; flex-direction: column; gap: 1px; color: inherit; border: 0; border-radius: 0; background: none; opacity: 1; }
.card-center.court b { padding: 0; color: inherit; border: 0; background: none; filter: none; font: 800 clamp(29px,4vw,42px)/.72 Georgia, serif; }
.card-center.court i { font-size: clamp(20px,2.6vw,28px); }
.playing-card.joker,
.playing-card.joker.small { color: #171717; border-color: #c8c5bd; background: linear-gradient(145deg,#fff,#fdfcf8 75%,#eae7df); }
.playing-card.joker:not(.small) { color: #cf2925; }
.joker-corner { top: 6px; left: 5px; font: 800 7px/.85 Arial, sans-serif; letter-spacing: 0; }
.joker-art { top: 18px; right: 9px; transform: none; text-shadow: none; }
.joker-letters { left: 9px; bottom: 7px; font: 800 9px/.83 Arial, sans-serif; }
.joker-name { right: 8px; bottom: 7px; font-family: "PingFang SC", sans-serif; font-size: 10px; }

.hand { scroll-padding-inline: 10px; }
.hand.layout-stacked .card-column .playing-card { margin: 0; }
.hand-preview { display: none; }
.hand-preview .playing-card { margin: 0; transform: none; }

@media (max-height:520px) and (orientation:landscape) {
  .hand.layout-fan {
    left: 58%;
    width: min(72vw,640px);
    padding-inline: 8px;
    overflow-x: hidden;
  }
  .hand-preview.has-card {
    position: absolute;
    z-index: 16;
    left: max(108px, env(safe-area-inset-left));
    bottom: max(7px, env(safe-area-inset-bottom));
    display: block;
  }
  .hand-preview .playing-card { width: 70px; height: 100px; box-shadow: 0 7px 18px rgba(0,0,0,.36); }
  .hand-preview .card-corner b { font-size: 24px; }
  .hand-preview .card-corner i { font-size: 19px; }
  .hand-preview .card-center i { font-size: 43px; }
  .hand.layout-stacked {
    left: 54%;
    width: min(78vw,690px);
    height: 132px;
    padding: 3px 8px 0;
    overflow-x: hidden;
  }
  .card-column { width: 54px; height: 126px; flex-basis: 45px; }
  .card-column:last-child { flex-basis: 54px; }
  .card-column .playing-card { width: 54px; height: 75px; }
  .game-layer.hand-stacked .action-bar { bottom: 133px; }
  .game-layer.hand-stacked .play-zone.pos-bottom { bottom: 149px; }
}

/* V5：所有手牌一次显示、竖牌底边对齐、极简大小王 */
.hand.layout-fan { overflow-x: hidden; }
.hand.layout-stacked { justify-content: center; overflow-x: hidden; }
.hand.layout-stacked .card-column { align-self: flex-start; }
.joker-monogram {
  position: absolute;
  top: 50%;
  left: 54%;
  font: italic 700 clamp(38px,5vw,54px)/1 Georgia, serif;
  transform: translate(-50%,-52%);
}
.joker-corner {
  top: 7px;
  left: 6px;
  font: 800 7px/.9 Arial, sans-serif;
  letter-spacing: .08em;
  writing-mode: vertical-rl;
}
.joker-name {
  right: 8px;
  bottom: 8px;
  font: 800 10px/1 "PingFang SC", sans-serif;
}
.joker-art, .joker-letters { display: none; }

/* 浏览器拒绝方向锁定时，把整个网页按横屏画布旋转，系统锁定竖屏也能使用 */
@media (max-width:700px) {
  html.virtual-landscape,
  html.virtual-landscape body { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
  html.virtual-landscape #app {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vh;
    height: 100vw;
    min-height: 0;
    overflow: hidden;
    transform: rotate(90deg) translateY(-100%);
    transform-origin: top left;
  }
  html.virtual-landscape .orientation-prompt { display: none !important; }
  html.virtual-landscape .welcome,
  html.virtual-landscape .table-view { width: 100%; height: 100%; min-height: 0; }
  html.virtual-landscape .welcome {
    grid-template-columns: 1fr 1fr;
    align-content: center;
    gap: 18px;
    padding: 14px 6vw;
  }
  html.virtual-landscape .brand { grid-column: 1; grid-row: 1; align-self: center; }
  html.virtual-landscape .welcome-card { grid-column: 2; grid-row: 1; max-height: calc(100vw - 24px); overflow-y: auto; padding: 16px; }
  html.virtual-landscape .welcome-note { grid-column: 1; grid-row: 1; align-self: end; margin-bottom: 10px; }
  html.virtual-landscape .table-view::after { inset: 43px 14px 5px; border-width: 3px; border-radius: 10% / 42%; }
  html.virtual-landscape .table-header { height: 44px; padding: 4px 12px; }
  html.virtual-landscape .icon-button { width: 32px; height: 32px; font-size: 20px; }
  html.virtual-landscape .room-info > span { padding: 3px 6px; }
  html.virtual-landscape .players-layer { inset: 42px 24px 88px; }
  html.virtual-landscape .player { transform: scale(.88); transform-origin: center; }
  html.virtual-landscape .player.pos-top { top: -2px; transform: translateX(-50%) scale(.88); }
  html.virtual-landscape .player.pos-left { left: 2%; top: 40%; }
  html.virtual-landscape .player.pos-right { right: 2%; top: 40%; }
  html.virtual-landscape .player.pos-bottom { left: 1%; bottom: -60px; }
  html.virtual-landscape .avatar { width: 42px; height: 42px; font-size: 18px; }
  html.virtual-landscape .game-layer { inset: 44px 0 0; }
  html.virtual-landscape .score-strip { top: 0; }
  html.virtual-landscape .turn-message { top: 14%; padding: 3px 9px; }
  html.virtual-landscape .play-zone.pos-top { top: 48px; }
  html.virtual-landscape .play-zone.pos-bottom { bottom: 118px; }
  html.virtual-landscape .play-zone.pos-left { left: 24%; top: 43%; }
  html.virtual-landscape .play-zone.pos-right { right: 24%; top: 43%; }
  html.virtual-landscape .play-zone { min-width: 72px; min-height: 68px; }
  html.virtual-landscape .play-zone .playing-card { width: 47px; height: 68px; }
  html.virtual-landscape .play-zone .playing-card + .playing-card { margin-left: -12px; }
  html.virtual-landscape .hand.layout-fan { left: 58%; width: min(72vh,640px); height: 101px; padding: 12px 8px 0; }
  html.virtual-landscape .playing-card { width: 58px; height: 82px; }
  html.virtual-landscape .card-corner b { font-size: 19px; }
  html.virtual-landscape .card-corner i { font-size: 15px; }
  html.virtual-landscape .card-center i { font-size: 34px; }
  html.virtual-landscape .hand-preview.has-card { position: absolute; z-index: 16; left: 108px; bottom: 7px; display: block; }
  html.virtual-landscape .hand-preview .playing-card { width: 70px; height: 100px; }
  html.virtual-landscape .hand.layout-stacked { left: 54%; width: min(78vh,690px); height: 132px; padding: 3px 8px 0; }
  html.virtual-landscape .card-column { width: 54px; height: 126px; flex-basis: 45px; }
  html.virtual-landscape .card-column:last-child { flex-basis: 54px; }
  html.virtual-landscape .card-column .playing-card { width: 54px; height: 75px; }
  html.virtual-landscape .action-bar { bottom: 101px; }
  html.virtual-landscape .game-layer.hand-stacked .action-bar { bottom: 133px; }
  html.virtual-landscape .game-layer.hand-stacked .play-zone.pos-bottom { bottom: 149px; }
  html.virtual-landscape .social-bar,
  html.virtual-landscape .game-layer.hand-stacked .social-bar { top: auto; right: 8px; bottom: 98px; flex-direction: column; }
  html.virtual-landscape .social-bar button { width: 31px; height: 31px; font-size: 11px; }
  html.virtual-landscape .hand-layout-switch,
  html.virtual-landscape .game-layer.hand-stacked .hand-layout-switch { top: 3px; right: 48px; bottom: auto; }
  html.virtual-landscape .hand-layout-switch button { min-width: 44px; height: 25px; font-size: 10px; }
  html.virtual-landscape .social-sheet { right: 8px; bottom: 7px; max-height: calc(100vw - 14px); overflow-y: auto; }
}

/* V6：头像气泡与道具命中特效 */
.player .speech-bubble {
  position: absolute;
  z-index: 52;
  left: 22px;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 168px;
  transform: translateX(-50%);
  white-space: normal;
  pointer-events: none;
}
.player.pos-top .speech-bubble { top: calc(100% + 8px); bottom: auto; }
.player.pos-right .speech-bubble { right: 22px; left: auto; transform: translateX(50%); }
.player .speech-bubble.emoji { width: auto; white-space: nowrap; }

.prop-impact {
  position: absolute;
  z-index: 72;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.prop-impact b {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  transform: translate(-50%,-50%);
  font: 900 42px/1 system-ui;
  animation: impact-center 780ms ease-out forwards;
}
.prop-impact i {
  position: absolute;
  left: 0;
  top: 0;
  color: currentColor;
  font: 900 18px/1 system-ui;
  font-style: normal;
  text-shadow: 0 2px 3px rgba(0,0,0,.2);
  animation: impact-particle 720ms var(--impact-delay) cubic-bezier(.16,.75,.24,1) forwards;
}
.prop-impact.prop-tomato { color: #d52d26; }
.prop-impact.prop-tomato b { color: #fff0dc; background: radial-gradient(circle, #ff8a45 0 25%, #d83229 26% 57%, transparent 59%); }
.prop-impact.prop-egg { color: #fff3ca; }
.prop-impact.prop-egg b { color: #f3b62f; background: radial-gradient(circle, #ffcf48 0 20%, #fff8dd 22% 56%, transparent 58%); }
.prop-impact.prop-flower { color: #ef5a83; }
.prop-impact.prop-flower b { background: radial-gradient(circle, rgba(255,213,224,.92), rgba(238,79,122,.34) 48%, transparent 70%); }
.prop-impact.prop-slipper { color: #ffd55e; }
.prop-impact.prop-slipper b { background: radial-gradient(circle, rgba(255,221,94,.92), rgba(255,130,41,.45) 42%, transparent 68%); }
@keyframes impact-center {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.2) rotate(-18deg); }
  28% { opacity: 1; transform: translate(-50%,-50%) scale(1.35) rotate(7deg); }
  70% { opacity: .9; transform: translate(-50%,-50%) scale(.95) rotate(0); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.15); }
}
@keyframes impact-particle {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.2); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--impact-x)), calc(-50% + var(--impact-y))) rotate(260deg) scale(.75); }
}
.avatar.prop-hit-tomato,
.avatar.prop-hit-egg,
.avatar.prop-hit-slipper { animation: avatar-hit 520ms ease-out; }
.avatar.prop-hit-flower { animation: avatar-flower 700ms ease-out; }
@keyframes avatar-hit {
  0%,100% { transform: translateX(0) rotate(0); }
  18% { transform: translateX(-7px) rotate(-8deg); }
  36% { transform: translateX(7px) rotate(8deg); }
  54% { transform: translateX(-5px) rotate(-5deg); }
  72% { transform: translateX(4px) rotate(4deg); }
}
@keyframes avatar-flower {
  0%,100% { transform: scale(1); filter: none; }
  35% { transform: scale(1.18); filter: drop-shadow(0 0 12px #ff9ab6); }
  65% { transform: scale(.96); filter: drop-shadow(0 0 6px #ffcfdd); }
}

/* V7：参考手游的极简普通牌与单一聊天入口 */
.playing-card:not(.joker) .card-center {
  inset: 31% 7% 7% 32%;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}
.playing-card:not(.joker) .card-center i {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px,5.2vw,56px);
  line-height: .9;
  font-style: normal;
}
.play-zone .playing-card:not(.joker) .card-center i { font-size: 41px; }
.game-layer .social-bar,
.game-layer.hand-stacked .social-bar,
html.virtual-landscape .game-layer .social-bar,
html.virtual-landscape .game-layer.hand-stacked .social-bar {
  top: auto;
  right: max(9px, env(safe-area-inset-right));
  bottom: max(9px, env(safe-area-inset-bottom));
  display: block;
}
.game-layer .social-bar button {
  width: 42px;
  height: 42px;
  color: #fff;
  border-color: rgba(255,255,255,.32);
  background: linear-gradient(180deg,#4ba7ed,#2378c6);
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
  font-size: 14px;
}

@media (max-height:520px) and (orientation:landscape), (max-width:700px) {
  .playing-card:not(.joker) .card-center i { font-size: 36px; }
  .play-zone .playing-card:not(.joker) .card-center i { font-size: 29px; }
  .game-layer .social-bar button { width: 36px; height: 36px; font-size: 12px; }
}

/* V8：精简牌局顶部、积分与更小的出牌区 */
.player-score {
  position: absolute;
  z-index: 3;
  top: 52px;
  left: 0;
  width: 49px;
  color: #ffe39a;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,.55);
  font: 800 9px/1.2 system-ui;
}
.player.pos-right .player-score { right: 0; left: auto; }
.avatar.interactive::after { display: none; }

.table-view.is-playing .table-header {
  height: 30px;
  justify-content: flex-start;
  padding: max(4px, env(safe-area-inset-top)) 10px 2px;
  background: linear-gradient(rgba(11,74,49,.82), rgba(11,74,49,.28), transparent);
}
.table-view.is-playing .table-header .icon-button { display: none; }
.table-view.is-playing .room-info { gap: 4px; }
.table-view.is-playing .room-info > span {
  order: 1;
  padding: 2px 5px;
  border-color: rgba(255,218,119,.25);
  border-radius: 5px;
  font-size: 8px;
}
.table-view.is-playing .room-info button {
  order: 2;
  padding: 0;
  font-size: 9px;
}
.table-view.is-playing .room-info b { margin: 0 2px; font-size: 9px; letter-spacing: .08em; }
.table-view.is-playing .room-info button span { display: none; }
.table-view.is-playing .game-layer { top: 30px; }
.table-view.is-playing .players-layer { top: 28px; }
.table-view.is-playing .player.pos-top { top: -3px; }
.table-view.is-playing::after { top: 31px; }

.play-zone .playing-card { width: 56px; height: 80px; }
.play-zone .playing-card + .playing-card { margin-left: -18px; }
.play-zone .card-corner b { font-size: 19px; }
.play-zone .card-corner i { font-size: 15px; }
.play-zone .playing-card:not(.joker) .card-center i { font-size: 34px; }
.play-zone .joker-monogram { font-size: 36px; }

@media (max-height:520px) and (orientation:landscape), (max-width:700px) {
  .player-score { top: 45px; width: 42px; font-size: 8px; }
  .player.pos-right .player-score { right: 0; }
  .table-view.is-playing .table-header { height: 27px; padding-top: 3px; }
  .table-view.is-playing .game-layer { top: 27px; }
  .table-view.is-playing .players-layer { top: 24px; }
  .table-view.is-playing .player.pos-top { top: -4px; }
  .table-view.is-playing::after { top: 28px; }
  .play-zone .playing-card { width: 42px; height: 60px; }
  .play-zone .playing-card + .playing-card { margin-left: -12px; }
  .play-zone .card-corner b { font-size: 16px; }
  .play-zone .card-corner i { font-size: 12px; }
  .play-zone .playing-card:not(.joker) .card-center i { font-size: 25px; }
  .play-zone .joker-monogram { font-size: 28px; }
}

/* V9：手指划过连续选牌 */
.hand {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.hand .playing-card { touch-action: none; -webkit-tap-highlight-color: transparent; }
.hand.swipe-selecting { cursor: grabbing; }
.hand.swipe-selecting .playing-card { transition-duration: 70ms; }

/* V10：声音设置与炸弹全屏反馈 */
.sound-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 10px;
  color: #61756f;
  border-radius: 10px;
  background: #eef2ed;
  font-size: 10px;
}
.sound-setting button {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: #fff;
  border: 0;
  border-radius: 12px;
  background: #237f70;
  font-size: 10px;
  font-weight: 800;
}
.voice-chat-button {
  width: 100%;
  height: 38px;
  margin-top: 9px;
  color: #25685d;
  border: 1px solid #c9ded7;
  border-radius: 18px;
  background: #f6faf7;
  font-size: 11px;
  font-weight: 800;
}
.voice-chat-button.recording {
  color: #fff;
  border-color: #c9443f;
  background: #c9443f;
  animation: voice-pulse .8s ease-in-out infinite alternate;
}
.bomb-screen-effect {
  position: absolute;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle, rgba(255,244,187,.58), rgba(255,125,41,.18) 25%, transparent 58%);
  animation: bomb-flash 1.15s ease-out forwards;
}
.bomb-core {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  min-width: 190px;
  padding: 8px 18px 12px;
  color: #fff8db;
  border: 2px solid rgba(255,235,151,.7);
  border-radius: 22px;
  background: radial-gradient(circle at 50% 20%, #e85b2b, #7f2018 72%);
  box-shadow: 0 0 0 8px rgba(255,171,61,.16), 0 18px 45px rgba(72,13,8,.55);
  animation: bomb-core-pop 1.25s cubic-bezier(.18,.8,.24,1) forwards;
}
.bomb-core span { margin-top: -35px; filter: drop-shadow(0 8px 8px rgba(0,0,0,.35)); font-size: 72px; }
.bomb-core strong { margin-top: -5px; text-shadow: 0 3px 3px #64130d; font: 900 25px/1.1 "STKaiti",serif; }
.bomb-core b { margin-top: 5px; color: #ffe187; font-size: 12px; }
.bomb-screen-effect > i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffd45e;
  box-shadow: 0 0 10px #ff7a2c;
  animation: bomb-spark 820ms var(--bomb-delay) ease-out forwards;
}
.table-view.bomb-shake { animation: table-bomb-shake 560ms ease-out; }
@keyframes bomb-flash {
  0% { opacity: 0; background-color: rgba(255,255,255,.9); }
  12% { opacity: 1; }
  72% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes bomb-core-pop {
  0% { opacity: 0; transform: scale(.12) rotate(-16deg); }
  22% { opacity: 1; transform: scale(1.18) rotate(4deg); }
  55% { transform: scale(.96) rotate(0); }
  82% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.12); }
}
@keyframes bomb-spark {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.2); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--bomb-x)), calc(-50% + var(--bomb-y))) scale(.55); }
}
@keyframes table-bomb-shake {
  0%,100% { transform: translate(0,0); }
  12% { transform: translate(-5px,3px); }
  24% { transform: translate(6px,-4px); }
  38% { transform: translate(-5px,-2px); }
  52% { transform: translate(4px,3px); }
  68% { transform: translate(-2px,1px); }
}
@media (prefers-reduced-motion: reduce) {
  .table-view.bomb-shake { animation: none; }
}
