/* 3D 版：沿用 mahjong.css 的麻將館外觀，只補 3D 牌桌的位置框與疊層 */

/* 每個模式一個固定比例的位置框；共用的 3D 牌桌在切分頁時搬進來 */
.stage-slot {
  --hot: #f1c04d; --open: #ff5a4a;
  position: relative; width: 100%; aspect-ratio: 1 / 1.05; border-radius: 18px;
  overflow: hidden; overflow: clip; background: #140b07;
  box-shadow: inset 0 0 0 1px #5a3a1f, 0 14px 30px rgb(0 0 0 / 0.5);
  user-select: none; -webkit-user-select: none;
}
.stage { position: absolute; inset: 0; touch-action: manipulation; }
/* 選牌牆、選墩時，手指在牌桌上滑不要捲動整頁 */
.stage-slot[data-phase="stack"] .stage, .stage-slot[data-phase="wall"] .stage { touch-action: none; }
.stage canvas { display: block; width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.stage-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; color: var(--gold); font-family: var(--font-display); font-size: 1.2rem; background: #140b07; z-index: 8; }
.stage-msg a { color: var(--gold); }
.stage-slot .my-hand { z-index: 4; }
.stage-slot .over { z-index: 9; }

/* 三家頭像與你的名牌：位置由 3D 座標投影過來 */
.seat3d { position: absolute; left: 0; top: 0; display: grid; justify-items: center; gap: 2px; font-size: 0.78rem; font-weight: 700; }
.seat3d .avatar, .me3d .avatar {
  position: relative; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  box-shadow: 0 0 0 3px var(--gold), 0 4px 10px rgb(0 0 0 / 0.5); transition: box-shadow 200ms var(--ease);
}
.seat3d .avatar { width: clamp(36px, 10vw, 50px); font-size: clamp(20px, 6vw, 28px); }
.seat3d .meta, .me3d .meta { display: grid; text-align: center; padding: 1px 8px; border-radius: 8px; background: linear-gradient(#5b1712, #3a0d0b); box-shadow: inset 0 0 0 1px var(--gold-deep); color: #f6ead2; line-height: 1.15; }
.seat3d .wind, .me3d .wind { font-size: 0.68rem; color: var(--gold); font-weight: 500; }
.seat3d .wind:empty, .me3d .wind:empty { display: none; }
.seat3d.dealer .avatar::after, .me3d.dealer .avatar::after {
  content: "莊"; position: absolute; right: -6px; bottom: -4px; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; background: #d9362b; color: #fff; font-family: var(--font-display); font-size: 0.7rem; box-shadow: 0 0 0 2px #fff;
}
.seat3d.taking .avatar, .me3d.taking .avatar, .me3d.winner .avatar { box-shadow: 0 0 0 3px var(--tail), 0 0 16px var(--tail); }
.seat3d.shooter .avatar { box-shadow: 0 0 0 3px #ff4a36, 0 0 18px #ff4a36; }
.seat3d .bubble { left: 100%; top: 6%; margin-left: 4px; }
/* 左右兩家的對話框放頭像正上方，不要擋到他們打出的牌 */
.seat3d[data-s="1"] .bubble, .seat3d[data-s="3"] .bubble { left: 50%; right: auto; top: auto; bottom: 100%; margin: 0 0 4px; transform: translateX(-50%); animation: none; }
.seat3d[data-s="2"] .bubble { left: 100%; }
.me3d { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 700; }
.me3d .avatar { width: 32px; font-size: 18px; background: #f3c969; }
.me3d .meta { display: flex; gap: 4px; align-items: baseline; }
.me3d .bubble { left: 100%; top: 0; margin-left: 6px; }

/* 點數、牌尾牌頭、吃碰標籤、放槍那張的說明 */
.total3d {
  position: absolute; left: 0; top: 0; padding: 2px 10px; border-radius: 8px; white-space: nowrap;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; font-size: 1.1rem; color: var(--led);
  background: rgb(8 4 3 / 0.85); box-shadow: inset 0 0 0 1px #3a1a12; text-shadow: 0 0 8px rgb(255 74 54 / 0.7);
}
.pin3d { position: absolute; left: 0; top: 0; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; color: #111; box-shadow: 0 2px 6px rgb(0 0 0 / 0.45); }
.pin3d.tail { background: var(--tail); }
.pin3d.head { background: #fff; }
.pin3d.discard-cap { background: #ff4a36; color: #fff; }
.pin3d.meld-label { background: rgb(10 18 28 / 0.75); color: #fff; padding: 1px 7px; }
.meld-labels { position: absolute; inset: 0; }
.stage-slot .stamp { top: 42%; z-index: 6; }
.stage-slot .pop { z-index: 6; }

@media (max-width: 600px) {
  .stage-slot { aspect-ratio: 1 / 1.1; border-radius: 14px; }
}

/* ================= 乾淨風格（參考《市長大人》）：只套用在 3D 版 =================
   淡米灰底、白卡片、黑色膠囊按鈕、Geist；顏色只留給語意（牌尾黃、開門紅、對錯綠紅） */
body.clean3d {
  color-scheme: light;
  --bg: #ecece8; --surface: #ffffff; --surface-2: #f4f3ef; --line: #dedbd3;
  --ink: #121212; --muted: #6b6b66; --jade: #2f9e6a; --jade-soft: #e6f4ec;
  --vermilion: #d9473a; --vermilion-soft: #fdecec;
  --gold: #121212; --gold-deep: #d6d2c8; --tail: #f2b134; --led: #121212; --hot: #f2b134; --open: #e5483a;
  --tile-back: #2f2f2f; --tile-back-dark: #1a1a1a;
  --font-display: "Geist", "PingFang TC", "Noto Sans TC", sans-serif;
  --font-body: "Geist", "PingFang TC", "Noto Sans TC", sans-serif;
  --shadow-soft: 0 1px 2px rgb(0 0 0 / 0.04), 0 10px 30px rgb(0 0 0 / 0.06);
  background: var(--bg); color: var(--ink);
}
body.clean3d ::selection { background: rgb(18 18 18 / 0.12); color: var(--ink); }
body.clean3d .top { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-soft); padding: 14px 18px; }
body.clean3d .brand h1 { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--ink); -webkit-text-fill-color: currentColor; filter: none; font-weight: 800; letter-spacing: 0.01em; }
body.clean3d .brand p { color: var(--muted); }
body.clean3d .score span { background: var(--surface-2); border: 0; color: var(--muted); }
body.clean3d .score b { color: var(--ink); }
body.clean3d .score-link { background: var(--ink); color: #fff; box-shadow: none; }

/* 分頁：白底膠囊，選中的變黑 */
body.clean3d .tabs { background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow-soft); gap: 4px; }
body.clean3d .tab, body.clean3d .tab[aria-selected="true"] { border-radius: 999px; font-family: var(--font-body); font-weight: 600; box-shadow: none; background: transparent; color: var(--muted); padding: 9px 6px; }
body.clean3d .tab[aria-selected="true"] { background: var(--ink); color: #fff; }

body.clean3d .card { background: var(--surface); border: 0; border-radius: 18px; box-shadow: var(--shadow-soft); }
body.clean3d .game > .card { background: transparent; box-shadow: none; }
body.clean3d .q-title, body.clean3d .sheet h3, body.clean3d .board-head h3 { color: var(--ink); font-family: var(--font-body); }
body.clean3d .banner .say { font-family: var(--font-body); font-weight: 700; }
body.clean3d .banner .say em, body.clean3d .mnemonic em { color: var(--vermilion); }
body.clean3d .match-hud { color: var(--muted); }
body.clean3d .match-hud b { color: var(--ink); }
body.clean3d .match-hud .clock { background: var(--surface); color: var(--ink); text-shadow: none; box-shadow: inset 0 0 0 1px var(--line); font-family: "Geist Mono", ui-monospace, monospace; }

/* 按鈕：黑色膠囊；次要按鈕白底細框 */
body.clean3d .btn { background: var(--ink); color: #fff; border-radius: 999px; box-shadow: none; font-family: var(--font-body); font-weight: 600; letter-spacing: 0; }
body.clean3d .btn:active { transform: scale(0.97); box-shadow: none; }
body.clean3d .btn.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
body.clean3d .opt {
  background: var(--surface); color: var(--ink); border-radius: 14px; font-family: var(--font-body); font-weight: 700; font-size: 1.05rem;
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgb(0 0 0 / 0.04); padding: 12px 6px;
}
body.clean3d .opt.is-right { background: var(--jade-soft); box-shadow: inset 0 0 0 2px var(--jade); }
body.clean3d .opt.is-wrong { background: var(--vermilion-soft); box-shadow: inset 0 0 0 2px var(--vermilion); }
body.clean3d .opt:disabled { opacity: 0.5; }
body.clean3d .feedback { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
body.clean3d .feedback.good { background: var(--jade-soft); box-shadow: none; }
body.clean3d .feedback.bad { background: var(--vermilion-soft); box-shadow: none; }
body.clean3d .facts li { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
body.clean3d .board-tabs button { background: var(--surface-2); box-shadow: none; color: var(--muted); border-radius: 999px; }
body.clean3d .board-tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }
body.clean3d .board-row { background: var(--surface-2); }
body.clean3d .board-row .stat { color: var(--muted); }
body.clean3d .board-row.podium .place { background: var(--ink); color: #fff; }
body.clean3d .board-row.me { box-shadow: inset 0 0 0 2px var(--jade); }
body.clean3d .board-foot, body.clean3d .board-mine, body.clean3d .linkish { color: var(--ink); }
body.clean3d .seat-cell { background: var(--surface-2); }
body.clean3d .seat-cell.hot { background: var(--jade-soft); box-shadow: inset 0 0 0 2px var(--jade); }
body.clean3d .pay input, body.clean3d .name-row input { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
body.clean3d .legend { display: none; }

/* 3D 舞台融進背景：沒有框，牌桌像浮在半空 */
body.clean3d .stage-slot { background: var(--bg); box-shadow: none; border-radius: 0; overflow: visible; }
body.clean3d .stage-msg { background: var(--bg); color: var(--ink); font-family: var(--font-body); }
body.clean3d .stage-msg a { color: var(--ink); }

/* 開始／暫停／結算：毛玻璃遮罩 */
body.clean3d .over { background: rgb(236 236 232 / 0.72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--ink); border-radius: 18px; }
body.clean3d .over h3 { color: var(--ink); font-family: var(--font-body); font-weight: 800; letter-spacing: 0; }
body.clean3d .over p { color: var(--muted); }
body.clean3d .over .record, body.clean3d .board-rank, body.clean3d .board-msg, body.clean3d .name-label { color: var(--ink); }
body.clean3d .over .btn { background: var(--ink); color: #fff; }
body.clean3d .result span { color: var(--muted); }
body.clean3d .result span b { color: var(--ink); }

/* 名牌與標示：白色膠囊；莊家用黑色小圓章（3D 裡另有金色皇冠） */
body.clean3d .seat3d .avatar, body.clean3d .me3d .avatar { display: none; }
body.clean3d .seat3d .meta, body.clean3d .me3d .meta { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-soft); border-radius: 999px; padding: 3px 10px; display: flex; gap: 4px; align-items: baseline; }
body.clean3d .seat3d .wind, body.clean3d .me3d .wind { color: var(--muted); }
body.clean3d .seat3d.dealer .meta::after, body.clean3d .me3d.dealer .meta::after { content: "莊"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 0.66rem; margin-left: 2px; align-self: center; }
body.clean3d .seat3d.shooter .meta { box-shadow: inset 0 0 0 2px var(--open), var(--shadow-soft); }
body.clean3d .seat3d.taking .meta, body.clean3d .me3d.winner .meta { box-shadow: inset 0 0 0 2px var(--tail), var(--shadow-soft); }
body.clean3d .bubble { font-family: var(--font-body); font-weight: 800; box-shadow: var(--shadow-soft); }
body.clean3d .total3d { background: var(--surface); color: var(--ink); text-shadow: none; box-shadow: var(--shadow-soft); font-family: "Geist Mono", ui-monospace, monospace; }
body.clean3d .pin3d { box-shadow: var(--shadow-soft); }
body.clean3d .pin3d.meld-label { background: var(--ink); }
body.clean3d .pop { color: var(--ink); text-shadow: none; font-family: var(--font-body); }
body.clean3d .pop.bad { color: var(--vermilion); }
body.clean3d .pop.time { color: var(--muted); }
body.clean3d .stamp { font-family: var(--font-body); font-weight: 800; color: var(--jade); border: 0; border-radius: 18px; background: rgb(255 255 255 / 0.95); box-shadow: 0 12px 40px rgb(0 0 0 / 0.14); transform: translate(-50%, -50%) rotate(-6deg); }
body.clean3d .stamp.bad { color: var(--vermilion); }

/* 手牌：白牌身＋炭黑牌背 */
body.clean3d .htile { background: #fffefa; box-shadow: 0 3px 0 var(--tile-back), 0 5px 0 var(--tile-back-dark), 0 8px 12px rgb(0 0 0 / 0.12); }
body.clean3d .htile.win { box-shadow: 0 3px 0 var(--tile-back), 0 0 0 2px var(--tail), 0 8px 16px rgb(242 177 52 / 0.45); }
body.clean3d .htile[data-label]::before { color: var(--ink); }
body.clean3d .tile { background: #fffefa; box-shadow: 0 4px 0 var(--tile-back), 0 6px 12px rgb(0 0 0 / 0.12); }
body.clean3d .brand h1 { font-family: var(--font-body); }
/* 擲骰沒有手牌，牌桌下方不用留空 */
body.clean3d .stage-slot[data-mode="dice"], body.clean3d .stage-slot[data-mode="flower"] { aspect-ratio: 1 / 0.92; }

/* 2026-10-14 回饋：白色太白、邊界不明顯 → 底色加深一點，卡片、按鈕、牌都加上看得到的邊框 */
body.clean3d { --bg: #e2e1db; --line: #cbc6bb; --edge: #b9b3a6; }
body.clean3d .top, body.clean3d .tabs, body.clean3d .card { box-shadow: 0 0 0 1px var(--line), 0 8px 24px rgb(0 0 0 / 0.06); }
body.clean3d .game > .card { box-shadow: none; }
body.clean3d .opt { background: #fbfaf7; box-shadow: inset 0 0 0 1.5px var(--edge), 0 2px 0 var(--line); }
body.clean3d .btn.ghost, body.clean3d .match-hud .clock, body.clean3d .facts li { box-shadow: inset 0 0 0 1.5px var(--edge); }
body.clean3d .board-row { background: #f1efe9; box-shadow: inset 0 0 0 1px var(--line); }
body.clean3d .htile { background: #f8f4e8; box-shadow: inset 0 0 0 1px var(--edge), 0 3px 0 var(--tile-back), 0 5px 0 var(--tile-back-dark), 0 7px 10px rgb(0 0 0 / 0.14); }
body.clean3d .htile.win { box-shadow: inset 0 0 0 1px var(--edge), 0 3px 0 var(--tile-back), 0 0 0 2.5px var(--tail), 0 8px 16px rgb(242 177 52 / 0.45); }
body.clean3d .tile { background: #f8f4e8; box-shadow: inset 0 0 0 1px var(--edge), 0 4px 0 var(--tile-back), 0 6px 12px rgb(0 0 0 / 0.12); }
body.clean3d .seat3d .meta, body.clean3d .me3d .meta, body.clean3d .total3d { box-shadow: 0 0 0 1px var(--line), 0 6px 16px rgb(0 0 0 / 0.08); }

/* 2026-10-14 回饋：資訊要直覺、符合玩家視角 */
.info-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.info-head { display: flex; align-items: baseline; gap: 8px; }
.info-head b { font-size: 1.6rem; font-weight: 800; line-height: 1; color: var(--vermilion); }
.info-head span { font-size: 0.95rem; font-weight: 700; color: var(--ink); }
.info-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.info-chip { padding: 4px 11px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; white-space: nowrap; background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.info-chip.good { background: var(--jade-soft); color: #1f7a4f; box-shadow: 0 0 0 1.5px var(--jade); }
.info-chip.warn { background: #fff4e0; color: #8a5a00; box-shadow: 0 0 0 1.5px var(--tail); }
/* 你的名牌放在畫面下方（你坐的位置），算台時在手牌正上方 */
body.clean3d .me3d { top: auto; bottom: 10px; left: 10px; }
body.clean3d .stage-slot.has-melds .me3d { bottom: calc(2.5% + 62px); }
body.clean3d .me3d .meta { font-size: 0.95rem; padding: 4px 12px; }
body.clean3d .me3d .bubble { top: 50%; transform: translateY(-50%); font-size: 1.05rem; }

/* 2026-10-14 回饋：莊家要一眼看出來 → 莊家名牌紅底白字、「莊」章放大 */
body.clean3d .seat3d.dealer .meta, body.clean3d .me3d.dealer .meta { background: var(--vermilion); color: #fff; box-shadow: 0 0 0 2px #fff, 0 6px 16px rgb(217 71 58 / 0.35); }
body.clean3d .seat3d.dealer .wind, body.clean3d .me3d.dealer .wind { color: rgb(255 255 255 / 0.85); }
body.clean3d .seat3d.dealer .meta::after, body.clean3d .me3d.dealer .meta::after { width: 22px; height: 22px; font-size: 0.8rem; font-weight: 800; background: #fff; color: var(--vermilion); }
body.clean3d .seat3d.dealer .meta { font-size: 0.92rem; padding: 4px 12px; }

/* 放大的牌牆：選好牌牆後跳出，大顆好按、可左右滑 */
.wall-strip {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 5; display: grid; gap: 6px; padding: 8px 8px 10px;
  border-radius: 16px; background: rgb(255 255 255 / 0.96); box-shadow: 0 0 0 1px var(--line), 0 12px 30px rgb(0 0 0 / 0.14);
  animation: strip-in 220ms var(--ease-out, ease-out) both;
}
@keyframes strip-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.strip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 0.72rem; color: var(--muted); }
.strip-head b { font-size: 0.85rem; color: var(--ink); text-align: center; }
.strip-row { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; -webkit-overflow-scrolling: touch; touch-action: pan-x; }
.strip-row::-webkit-scrollbar { display: none; }
.strip-tile {
  flex: none; width: 40px; height: 54px; border: 0; border-radius: 7px; cursor: pointer; padding: 0;
  background: linear-gradient(#3a3a3a, #262626 62%, #f8f4e8 62%, #ece6d6);
  box-shadow: inset 0 0 0 1px #b9b3a6, 0 2px 0 #cbc6bb; transition: transform 120ms ease-out;
  touch-action: manipulation;
}
.strip-tile:active, .strip-tile:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 2px var(--vermilion), 0 4px 10px rgb(217 71 58 / 0.3); }
.strip-tile.next { opacity: 0.55; }
.strip-gap { flex: none; align-self: center; color: var(--muted); font-size: 0.8rem; padding: 0 2px; }

/* 2026-10-14 回饋：你的名牌放下方正中間（位置由 JS 投影），跟其他三家平行 */
body.clean3d .me3d, body.clean3d .stage-slot.has-melds .me3d { left: 0; top: 0; bottom: auto; }
body.clean3d .me3d .bubble { left: 100%; top: 50%; transform: translateY(-50%); }
/* 骰子點數：紅底白字大膠囊 */
body.clean3d .total3d { background: var(--vermilion); color: #fff; font-size: 1.35rem; padding: 2px 14px; box-shadow: 0 0 0 2px #fff, 0 8px 20px rgb(217 71 58 / 0.35); }
/* 秒數越久越急（3D 白底版） */
body.clean3d .match-hud .clock[data-level="warn"] { color: #c76a00; background: #fff4e0; box-shadow: inset 0 0 0 1.5px #f2b134; text-shadow: none; }
body.clean3d .match-hud .clock[data-level="hot"] { color: #fff; background: var(--vermilion); box-shadow: none; text-shadow: none; }

/* 2026-10-14 回饋：自己的風要一眼看到（名牌上的風位放大、紅色） */
body.clean3d .me3d .wind { font-size: 1.05rem; font-weight: 800; color: var(--vermilion); }
body.clean3d .me3d.dealer .wind { color: #fff; }

/* 2026-10-14 回饋：手牌離牌桌太遠。改由 JS 把手牌放在你那側桌緣上，牌做成立著的樣子 */
body.clean3d .stage-slot .my-hand { top: auto; bottom: auto; }
body.clean3d .stage-slot .my-hand .htile { max-width: 40px; box-shadow: inset 0 0 0 1px var(--edge), 0 4px 0 var(--tile-back), 0 7px 0 var(--tile-back-dark), 0 12px 14px rgb(0 0 0 / 0.22); }
body.clean3d .stage-slot .my-hand .htile.win { box-shadow: inset 0 0 0 1px var(--edge), 0 4px 0 var(--tile-back), 0 7px 0 var(--tile-back-dark), 0 0 0 2.5px var(--tail), 0 10px 18px rgb(242 177 52 / 0.45); }
body.clean3d .stage-slot[data-mode="tai"] { aspect-ratio: 1 / 0.98; }
.pin3d.draw-cap { background: var(--vermilion, #d9473a); color: #fff; font-size: 0.95rem; padding: 4px 12px; box-shadow: 0 0 0 2px #fff, 0 6px 16px rgb(217 71 58 / 0.35); }
.htile.win.arrive { animation: win-arrive 420ms cubic-bezier(0.16, 1, 0.3, 1); }
.htile.win.waiting { visibility: hidden; }
@keyframes win-arrive { from { transform: translateY(-28px) scale(1.25); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .htile.win.arrive { animation: none; } }
.win-cue {
  position: absolute; left: 50%; top: 42%; z-index: 7; pointer-events: none; white-space: nowrap;
  padding: 8px 22px; border-radius: 999px; font-size: 2rem; font-weight: 800; color: var(--ink, #121212);
  background: rgb(255 255 255 / 0.96); box-shadow: 0 0 0 1px var(--line, #d6d3cb), 0 14px 36px rgb(0 0 0 / 0.16);
  transform: translate(-50%, -50%); animation: win-cue 1000ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.win-cue.hot { background: var(--vermilion, #d9473a); color: #fff; box-shadow: 0 0 0 3px #fff, 0 14px 36px rgb(217 71 58 / 0.4); }
@keyframes win-cue {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  30% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%); }
}
@media (prefers-reduced-motion: reduce) { .win-cue { animation: none; } }

/* 2026-10-15 回饋：電腦用滑鼠不能左右滑，放大牌牆改成整排塞得下、不用捲 */
@media (pointer: fine) {
  .strip-row { overflow-x: visible; gap: 3px; }
  .strip-tile { flex: 1 1 0; width: auto; min-width: 0; max-width: 40px; }
  .strip-gap { padding: 0; }
}

/* 2026-10-15 回饋：放大牌牆直接顯示滿的 18 墩，手機電腦都整排塞得下 */
.strip-row { overflow-x: visible; gap: 2px; }
.strip-tile { flex: 1 1 0; width: auto; min-width: 0; max-width: 40px; }

/* 2026-10-15 回饋：答案直接畫在放大牌牆上，不用再看小小的 3D 桌面 */
.wall-strip.answered .strip-row { padding-top: 22px; }
.strip-tile { position: relative; }
.strip-tile:disabled { cursor: default; }
.wall-strip.answered .strip-tile:hover { transform: none; box-shadow: inset 0 0 0 1px #b9b3a6, 0 2px 0 #cbc6bb; }
.strip-tile.tail { background: linear-gradient(#f2b134, #e39e1c 62%, #f8f4e8 62%, #ece6d6); }
.strip-tile.open, .wall-strip.answered .strip-tile.open:hover { background: linear-gradient(#e5483a, #c8352a 62%, #f8f4e8 62%, #ece6d6); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--vermilion, #d9473a); transform: translateY(-3px); }
.strip-tile.picked-wrong, .wall-strip.answered .strip-tile.picked-wrong:hover { box-shadow: inset 0 0 0 2px #121212, 0 0 0 2px #121212; }
.strip-tile.picked-wrong::after { content: "✕"; position: absolute; inset: 0 0 38% 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 0.9rem; }
.strip-tile[data-tag]::before {
  content: attr(data-tag); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 0.68rem; font-weight: 800; padding: 1px 6px; border-radius: 999px; color: #fff; background: var(--vermilion, #d9473a);
}
.strip-tile.picked-wrong[data-tag]::before { background: #121212; }
.wall-strip.answered .strip-row { padding-bottom: 22px; }
.strip-tile.picked-wrong[data-tag]::before { bottom: auto; top: calc(100% + 4px); }
.strip-tile:first-child[data-tag]::before { left: 0; transform: none; }
.strip-tile:last-child[data-tag]::before { left: auto; right: 0; transform: none; }

/* 英文版：莊家徽章寫 D（Dealer） */
html[lang="en"] body.clean3d .seat3d.dealer .meta::after, html[lang="en"] body.clean3d .me3d.dealer .meta::after { content: "D"; }
html[lang="en"] body.clean3d .stamp { white-space: nowrap; }

/* 開場「巷口麻將館」（parlor3d.js）：播放時先藏牌桌上的 HTML，落座後淡入 */
#stage3d .overlay, .stage-slot .over, .stage-slot .my-hand, .stage-slot .info-bar, .stage-slot .wall-strip { transition: opacity 0.5s ease; }
body.parlor-intro #stage3d .overlay, body.parlor-intro .stage-slot .over, body.parlor-intro .stage-slot .my-hand, body.parlor-intro .stage-slot .info-bar, body.parlor-intro .stage-slot .wall-strip { opacity: 0; pointer-events: none; }
.parlor-cap { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 10; display: grid; gap: 2px; justify-items: center; padding: 10px 18px; border-radius: 16px; background: rgb(255 255 255 / 0.88); box-shadow: 0 10px 30px rgb(0 0 0 / 0.12); text-align: center; white-space: nowrap; pointer-events: none; transition: opacity 0.4s ease, transform 0.4s ease; }
.parlor-cap b { font-size: 1.05rem; font-weight: 800; color: #1a1a1a; }
.parlor-cap span { font-size: 0.8rem; color: #6a6a64; }
.parlor-cap.gone { opacity: 0; transform: translate(-50%, 8px); }
@media (max-width: 600px) { .parlor-cap { white-space: normal; max-width: calc(100% - 32px); } }
body.clean3d .over .players-count { color: var(--muted, #6a6a64); }
