﻿/* 牌桌有約 · 寶島16張 — 精美版外觀（視覺升級專用）
   原則：只改顏色 / 漸層 / 陰影 / 質感 / 動畫。
   未新增、刪除或更名任何 HTML 結構、JS 勾選的 ID / class；版面位置、尺寸邏輯維持不變。 */
:root {
  --lacquer: #9b1b1b;
  --lacquer-dark: #5a0d0d;
  --lacquer-glow: rgba(232, 90, 74, 0.35);
  --gold: #e0b94a;
  --gold-hi: #ffe9a8;
  --gold-soft: #f3d98a;
  --gold-deep: #8a6410;
  --ink: #1a120c;
  --ivory: #f7f1de;
  --felt: #7c2233;
  --felt-deep: #420e16;
  --felt-glow: #a93a4a;
  --wood: #7a4e28;
  --wood-dark: #33200f;
  --paper: #f4ecd6;
  --tile-ivory-hi: #fffdf6;
  --tile-ivory: #f5ecd2;
  --tile-ivory-lo: #ddcfa6;
  --danger: #c41e3a;
  --jade: #2f9e6a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.38);
  --gold-ring: 0 0 0 1px rgba(255, 233, 168, 0.55), 0 0 18px rgba(224, 185, 74, 0.35);
  --font-serif: "Noto Serif TC", "I.Ming", "PMingLiU", "Songti TC", serif;
  --font-sans: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { color-scheme: dark; }
body {
  font-family: var(--font-sans);
  color: var(--ivory);
  background: #0f0605 radial-gradient(120% 90% at 50% 0%, #2a1210 0%, #120806 55%, #070302 100%);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font-family: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); border-radius: 8px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #caa23e, #7a5514);
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.4);
}

.mj-lang-row { display: flex; gap: 6px; justify-content: center; }
.mj-lang-row button { background: rgba(20,10,8,.55); border: 1px solid rgba(224,185,74,.35); color: var(--gold-soft); border-radius: 8px; padding: 6px 10px; font-size: 12px; letter-spacing: 0.08em; backdrop-filter: blur(6px); transition: filter .15s ease, transform .15s ease, background .15s ease; }
.mj-lang-row button.on { background: linear-gradient(180deg, #f3d98a, #c79a2e); color: #3a2408; font-weight: 700; border-color: var(--gold-hi); box-shadow: var(--gold-ring); }
.mj-lang-row button:hover { filter: brightness(1.12); transform: translateY(-1px); }
#app { height: 100%; position: relative; }
/* 電影感暗角＋細緻紙紋，全域不擋點擊 */
#app::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 40;
  background:
    radial-gradient(120% 100% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.42) 100%);
  mix-blend-mode: multiply;
}

.screen {
  position: absolute; inset: 0;
  display: none;
  overflow: hidden;
}
.screen.active { display: flex; flex-direction: column; }
.screen.active .menu-wrap, .screen.active .panel { animation: menuEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes menuEnter {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bg-stage {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 34% at 50% -4%, rgba(255, 150, 110, 0.22), transparent 60%),
    radial-gradient(ellipse 34% 26% at 12% 20%, rgba(232, 90, 74, 0.16), transparent 65%),
    radial-gradient(ellipse 34% 26% at 88% 22%, rgba(232, 90, 74, 0.14), transparent 65%),
    radial-gradient(ellipse at 80% 100%, rgba(14, 74, 56, 0.38), transparent 48%),
    radial-gradient(ellipse at 50% 118%, rgba(224, 185, 74, 0.1), transparent 55%),
    linear-gradient(180deg, #241011 0%, #160a08 48%, #0a0605 100%);
}
.bg-stage::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.45'/></svg>");
  opacity: 0.08;
  pointer-events: none;
}
/* 地面光暈：宮燈在地上的倒影感 */
.bg-stage::after {
  content: "";
  position: absolute; inset: auto 0 0 0; height: 34%;
  background: radial-gradient(60% 100% at 50% 100%, rgba(224, 185, 74, 0.1), transparent 70%);
  pointer-events: none;
}

.lantern {
  position: absolute;
  width: 54px; height: 78px;
  background:
    radial-gradient(circle at 50% 26%, #ffb08a 0%, #e85a4a 34%, #9b1b1b 72%, #6d1010 100%);
  border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%;
  box-shadow: 0 0 34px rgba(232, 90, 74, 0.5), 0 0 90px rgba(232, 90, 74, 0.18), inset 0 0 0 2px rgba(255, 233, 168, 0.65), inset 0 -10px 18px rgba(60, 5, 5, 0.55), inset 0 8px 14px rgba(255, 200, 150, 0.35);
  opacity: 0.85;
  animation: sway 5.5s ease-in-out infinite;
  overflow: visible;
}
.lantern::before {
  content: "";
  position: absolute; left: 50%; top: -22px; width: 2px; height: 24px;
  background: linear-gradient(180deg, transparent, var(--gold));
  transform: translateX(-50%);
}
.lantern::after {
  content: "";
  position: absolute; left: 18%; top: 12%; width: 22%; height: 44%;
  background: linear-gradient(180deg, rgba(255,255,255,.55), transparent 70%);
  border-radius: 50%;
  filter: blur(1px);
}
.lantern.l1 { left: 7%; top: 8%; animation-delay: 0s; }
.lantern.l2 { right: 9%; top: 12%; animation-delay: -1.6s; }
.lantern.l3 { left: 18%; bottom: 14%; width: 36px; height: 52px; animation-delay: -3s; }
@keyframes sway {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
}

.menu-wrap {
  position: relative; z-index: 2;
  margin: auto;
  width: min(560px, calc(100% - 32px));
  text-align: center;
  padding: 28px 28px 32px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 190, 120, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(86, 22, 18, 0.82), rgba(26, 11, 8, 0.86));
  border: 1px solid rgba(255, 233, 168, 0.55);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 240, 200, 0.35), inset 0 0 0 1px rgba(90, 13, 13, 0.6), inset 0 0 46px rgba(0, 0, 0, 0.35), 0 0 34px rgba(224, 185, 74, 0.14);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  overflow: hidden;
}
/* 上緣金線高光＋底部暗部，純裝飾 */
.menu-wrap::before {
  content: "";
  position: absolute; left: 8%; right: 8%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 240, 200, 0.9), transparent);
  pointer-events: none;
}
.logo {
  width: 108px; height: 108px;
  margin: 0 auto 10px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 18px rgba(224, 185, 74, 0.25));
  animation: logoFloat 5s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.game-title {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: 0.18em;
  margin: 0;
  background: linear-gradient(180deg, #fff6d0 0%, #f3d98a 38%, #d9a93c 62%, #9c6f14 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  filter: drop-shadow(0 2px 0 rgba(90, 13, 13, 0.9));
}
.game-sub {
  margin: 6px 0 0;
  letter-spacing: 0.42em;
  font-size: 28px;
  color: #f4e2ae;
  opacity: 0.95;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.game-tag {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 12px;
  border: 1px solid rgba(255, 233, 168, 0.45);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: #f0dca6;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.menu-actions { display: grid; gap: 12px; margin-top: 28px; }
.btn {
  appearance: none;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 233, 168, 0.6);
  background: linear-gradient(180deg, #b82a2a 0%, #8b1616 45%, #631010 100%);
  color: #fff6d8;
  border-radius: 10px;
  min-height: 48px;
  padding: 12px 20px;
  font-size: 18px;
  letter-spacing: 0.14em;
  box-shadow: 0 6px 0 #3d0a0a, 0 12px 22px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
/* 按鈕掃光 */
.btn::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: -60%; width: 46%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-18deg);
  transition: left 0.5s ease;
  pointer-events: none;
}
.btn:hover { filter: brightness(1.09); transform: translateY(-1px); }
.btn:hover::after { left: 120%; }
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #3d0a0a, 0 6px 12px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.gold {
  background: linear-gradient(180deg, #fff0bd 0%, #ecd27e 34%, #c79a2e 68%, #9c6f14 100%);
  color: #3a2408;
  border-color: #fff0bd;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 0 #6a4a12, 0 12px 22px rgba(0, 0, 0, 0.35), inset 0 1px 0 #fff, 0 0 18px rgba(224, 185, 74, 0.35);
}
.btn.ghost {
  background: rgba(0, 0, 0, 0.22);
  box-shadow: none;
  color: var(--gold-soft);
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.btn.ghost:hover { background: rgba(224, 185, 74, 0.12); }
.btn.small { min-height: 40px; padding: 8px 12px; font-size: 15px; letter-spacing: 0.08em; box-shadow: 0 3px 0 #3d0a0a, inset 0 1px 0 rgba(255,255,255,.25); }
.btn.gold.small { box-shadow: 0 3px 0 #6a4a12, inset 0 1px 0 #fff, 0 0 12px rgba(224,185,74,.3); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.menu-foot {
  margin-top: 18px;
  font-size: 12px;
  color: rgba(247, 241, 222, 0.62);
  letter-spacing: 0.08em;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}

.panel {
  position: relative; z-index: 2;
  margin: auto;
  width: min(720px, calc(100% - 28px));
  background:
    radial-gradient(120% 50% at 50% 0%, rgba(255, 190, 120, 0.1), transparent 60%),
    linear-gradient(180deg, rgba(34, 17, 12, 0.92), rgba(16, 8, 6, 0.95));
  border: 1px solid rgba(255, 233, 168, 0.45);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 240, 200, 0.25), 0 0 28px rgba(224, 185, 74, 0.1);
  max-height: calc(100% - 24px);
  overflow: auto;
  backdrop-filter: blur(10px);
}
.panel h2 {
  font-family: var(--font-serif);
  margin: 0 0 8px;
  letter-spacing: 0.16em;
  color: var(--gold-soft);
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.panel p.lead { color: rgba(247, 241, 222, 0.86); margin: 0 0 16px; line-height: 1.75; font-size: 17px; }
.field { text-align: left; margin-bottom: 16px; }
.field label { display: block; font-size: 15px; letter-spacing: 0.1em; color: var(--gold); margin-bottom: 7px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.field input {
  width: 100%;
  background: linear-gradient(180deg, #1d100b, #2a1712);
  border: 1px solid rgba(224, 185, 74, 0.35);
  color: var(--ivory);
  border-radius: 8px;
  min-height: 48px;
  padding: 11px 14px;
  font-size: 18px;
  outline: none;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.5);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { border-color: var(--gold-hi); box-shadow: inset 0 2px 6px rgba(0,0,0,.5), 0 0 0 3px rgba(224,185,74,.22); }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.row-btns .btn { flex: 1; min-width: 140px; }

.code-xl {
  font-family: var(--font-serif);
  font-size: clamp(28px, 6vw, 42px);
  letter-spacing: 0.28em;
  color: var(--gold-soft);
  background: radial-gradient(100% 140% at 50% 0%, #2c1510 0%, #170d09 70%);
  border: 1px dashed rgba(255, 233, 168, 0.55);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0 14px;
  text-align: center;
  text-shadow: 0 0 18px rgba(224, 185, 74, 0.35);
  box-shadow: inset 0 2px 10px rgba(0,0,0,.5);
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.lobby-seat {
  background: linear-gradient(180deg, rgba(139, 36, 52, 0.32), rgba(40, 12, 16, 0.5));
  border: 1px solid rgba(255, 233, 168, 0.28);
  border-radius: 12px;
  padding: 12px;
  min-height: 208px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 8px 18px rgba(0,0,0,.3);
}
.lobby-seat.empty { opacity: 0.75; }
.lobby-seat .av-circle { width: 138px; height: 138px; }
.lobby-seat .avatar-fallback { width: 138px; height: 138px; font-size: 40px; }
.lobby-seat video, .av-bubble video, .av-bubble img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: #111;
}
.avatar-fallback {
  width: 118px; height: 118px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 32%, #fff3cb 0 26%, #e8c872 27%, #8d3b29 52%, #3d0d0d 100%);
  border: 3px solid var(--gold);
  box-shadow: 0 8px 18px rgba(0,0,0,.45), 0 0 14px rgba(224,185,74,.25), inset 0 2px 6px rgba(255,255,255,.4);
  font-family: var(--font-serif);
  font-size: 34px;
  overflow: hidden;
}
.avatar-fallback img { width: 100%; height: 100%; object-fit: cover; border: 0; }
.avatar-emoji { position: relative; z-index: 1; text-shadow: 0 2px 4px rgba(0,0,0,.5); }
.empty-avatar { background: linear-gradient(180deg, #46584f, #1a2723); font-size: 24px; box-shadow: inset 0 2px 8px rgba(0,0,0,.5); }
.seat-name { font-size: 13px; letter-spacing: 0.08em; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
.seat-tag { font-size: 11px; color: var(--gold); }

.chat-box {
  background: linear-gradient(180deg, #100a08, #181008);
  border: 1px solid rgba(224, 185, 74, 0.22);
  border-radius: 10px;
  height: 120px;
  overflow: auto;
  padding: 8px 10px;
  font-size: 13px;
  text-align: left;
  line-height: 1.6;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.5);
}
.chat-row { display: flex; gap: 8px; margin-top: 8px; }
.chat-row input {
  flex: 1;
  background: linear-gradient(180deg, #1d100b, #2a1712);
  border: 1px solid rgba(224, 185, 74, 0.3);
  color: var(--ivory);
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 15px;
  outline: none;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.5);
}

.rules {
  text-align: left;
  max-height: min(70vh, 560px);
  overflow: auto;
  line-height: 1.8;
  font-size: 14px;
  color: rgba(247, 241, 222, 0.9);
}
.rules h3 { color: var(--gold-soft); font-family: var(--font-serif); letter-spacing: 0.12em; margin: 16px 0 6px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.rules ul { padding-left: 1.2em; }
.rules b { color: #ffe9a8; }

/* ===== Game table ===== */
#screen-game { background: radial-gradient(130% 100% at 50% 0%, #2b3f52 0%, #182635 45%, #0b141d 100%); }
.table-sky {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 14, 20, 0.55) 0%, rgba(8, 14, 20, 0.15) 34%, rgba(8, 14, 20, 0.42) 100%),
    url("../assets/bg-table.svg") center / cover no-repeat,
    linear-gradient(180deg, #7ec8e8 0%, #6a9a4a 100%);
  pointer-events: none;
  filter: saturate(1.06) contrast(1.02);
}
.game-hud {
  position: relative; z-index: 8;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  background: linear-gradient(180deg, rgba(24, 12, 9, 0.9), rgba(20, 10, 8, 0.62));
  border-bottom: 1px solid rgba(255, 233, 168, 0.32);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  gap: 10px;
}
.hud-brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-serif);
  letter-spacing: 0.18em;
  color: var(--gold-soft);
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.hud-brand img { width: 28px; height: 28px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.hud-stats {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: #f0d9a0;
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
}
.hud-stats b { color: #fff; font-weight: 700; }
.hud-actions { display: flex; gap: 6px; }

.playfield {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 8px 0;
}

.av-slot { position: absolute; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.av-top { left: 50%; top: 2px; transform: translateX(-50%); }
.av-left { left: 6px; top: 38%; }
.av-right { right: 6px; top: 38%; }
.av-self { position: relative; left: auto; top: auto; transform: none; flex: 0 0 auto; pointer-events: auto; }

.av-circle {
  width: 118px; height: 118px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid transparent;
  background: linear-gradient(#2a1810, #2a1810) padding-box, linear-gradient(160deg, #fff0bd, #c79a2e 45%, #6a4a12 80%, #ffe9a8) border-box;
  box-shadow: 0 10px 24px rgba(0,0,0,.55), 0 0 16px rgba(224,185,74,.22), inset 0 2px 6px rgba(255,255,255,.2);
  position: relative;
}
.av-self .av-circle { width: 86px; height: 86px; }
.av-circle img, .av-circle video {
  width: 100%; height: 100%;
  object-fit: cover;
  border: 0;
  border-radius: 50%;
}
.av-circle.turn {
  box-shadow: 0 0 0 3px #ffd24a, 0 0 22px rgba(255, 180, 40, .85), 0 0 46px rgba(255, 140, 20, .4), 0 10px 24px rgba(0,0,0,.55);
  animation: turnGlow 1.2s ease-in-out infinite;
}
@keyframes turnGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}
.av-meta { text-align: center; line-height: 1.2; }
.av-name { font-size: 12px; color: #fff8e4; text-shadow: 0 1px 3px #000, 0 0 8px rgba(0,0,0,.6); max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(0,0,0,.38); border-radius: 999px; padding: 1px 8px; border: 1px solid rgba(255,255,255,.1); }
.av-tags { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; }
.av-tags span {
  font-size: 10px;
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(224,185,74,.5);
  border-radius: 999px;
  padding: 0 6px;
  color: #f3d98a;
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.av-tags .ting-badge { background: linear-gradient(180deg, #3f8cff, #1a5fd0); border-color: #bcd8ff; color: #fff; }
.av-tags .turn-badge { background: linear-gradient(180deg, #e85a4a, #a31226); border-color: #ffd24a; color: #fff; box-shadow: 0 0 10px rgba(255,80,60,.6); }

.table-3d {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  perspective: 1100px;
  padding: 60px 108px 8px;
}
.wood-rim {
  width: min(980px, 100%);
  height: 100%;
  transform: rotateX(26deg);
  transform-origin: center 70%;
  background:
    linear-gradient(180deg, rgba(255, 220, 160, 0.5) 0%, transparent 6%),
    repeating-linear-gradient(93deg, rgba(46, 24, 8, 0.16) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(88deg, rgba(255, 220, 160, 0.06) 0 2px, transparent 2px 12px),
    linear-gradient(180deg, #9a6530 0%, #6b4423 34%, #4a2d14 62%, #2e1c0d 100%);
  border-radius: 18px;
  border: 1px solid rgba(255, 233, 168, 0.4);
  padding: 16px 18px 20px;
  box-shadow:
    inset 0 2px 0 #f0cd8e,
    inset 0 0 0 4px rgba(58, 36, 16, 0.55),
    inset 0 -8px 14px rgba(0,0,0,.4),
    inset 0 0 44px rgba(0,0,0,.3),
    0 30px 56px rgba(0,0,0,.5),
    0 0 44px rgba(224, 185, 74, 0.12);
}
.felt {
  height: 100%;
  border-radius: 10px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 36%, rgba(255, 150, 140, 0.16) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 42%, #93303f 0%, #671b29 46%, #43101a 72%, #320a12 100%);
  box-shadow: inset 0 0 0 3px rgba(60, 12, 18, 0.7), inset 0 0 0 4px rgba(224, 185, 74, 0.22), inset 0 14px 44px rgba(0,0,0,.42), inset 0 -12px 34px rgba(0,0,0,.4);
  position: relative;
  overflow: hidden;
}
/* 絨布織紋 */
.felt::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23f)' opacity='0.5'/></svg>");
  opacity: 0.1;
  pointer-events: none;
}
.felt::after {
  content: "牌桌有約";
  position: absolute;
  left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(26px, 4.5vw, 48px);
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  background: linear-gradient(180deg, rgba(255,236,190,.22), rgba(255,236,190,.06));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.4));
  pointer-events: none;
  white-space: nowrap;
}

.wall { position: absolute; display: flex; gap: 1px; pointer-events: none; }
.wall-top { top: 7%; left: 22%; right: 22%; justify-content: center; transform: scaleY(0.78); }
.wall-bot { bottom: 6%; left: 28%; right: 28%; justify-content: center; }
.wall-left {
  left: 5%; top: 18%; bottom: 16%;
  flex-direction: column;
  justify-content: center;
  transform: perspective(240px) rotateY(48deg);
}
.wall-right {
  right: 5%; top: 18%; bottom: 16%;
  flex-direction: column;
  justify-content: center;
  transform: perspective(240px) rotateY(-48deg);
}
.wtile {
  display: block;
  width: 17px; height: 25px;
  background: linear-gradient(180deg, #ffe9a8 0%, #f0c95e 34%, #c99200 70%, #8a6410 100%);
  border: 1px solid rgba(90, 58, 8, 0.6);
  border-radius: 2px;
  box-shadow: 0 1px 0 #6a4a10, inset 0 1px 0 #fff8d8, 0 1px 3px rgba(0,0,0,.4);
  flex: 0 0 auto;
}
.wall-left .wtile, .wall-right .wtile { width: 25px; height: 17px; }

.opp-hand { position: absolute; display: flex; pointer-events: none; }
.hand-top { top: 1.5%; left: 50%; transform: translateX(-50%) scaleY(0.86); gap: 1px; }
.hand-left {
  left: 1.5%; top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  gap: 0;
}
.hand-right {
  right: 1.5%; top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  gap: 0;
}
.stand-tile {
  width: 24px; height: 34px;
  background: linear-gradient(180deg, #ffe9a8 0%, #eec25c 45%, #b57e12 100%);
  border: 1px solid rgba(90, 58, 8, 0.55);
  border-radius: 2px 2px 1px 1px;
  box-shadow: 1px 1px 0 #5a3a08, inset 0 1px 0 #fff4c8, 0 2px 5px rgba(0,0,0,.35);
  flex: 0 0 auto;
}
.hand-left .stand-tile, .hand-right .stand-tile {
  width: 34px; height: 24px;
  margin: -2px 0;
}
.hand-top .stand-tile { margin-left: -2px; }

.meld-slot, .disc-slot, .flower-slot { position: absolute; display: flex; flex-wrap: wrap; gap: 2px; z-index: 2; }
.meld-top { top: 11%; left: 50%; transform: translateX(-50%); }
.meld-left { left: 15%; top: 26%; max-width: 190px; }
.meld-right { right: 15%; top: 26%; max-width: 190px; justify-content: flex-end; }
.disc-top { top: 27%; left: 50%; transform: translateX(-50%); max-width: 320px; justify-content: center; }
.disc-left { left: 16%; top: 38%; max-width: 190px; }
.disc-right { right: 16%; top: 38%; max-width: 190px; justify-content: flex-end; }
.disc-self { bottom: 15%; left: 50%; transform: translateX(-50%); max-width: 460px; justify-content: center; }
.fl-top { top: 14%; right: 24%; }
.fl-left { left: 14%; top: 18%; }
.fl-right { right: 14%; top: 18%; }
.fl-self { bottom: 8%; left: 18%; }

.dealer-chip {
  position: absolute;
  right: 22%;
  bottom: 28%;
  width: 36px; height: 36px;
  border-radius: 9px;
  background: radial-gradient(circle at 38% 28%, #ff9a7a 0%, #d43a2e 34%, #8b1616 78%);
  border: 2px solid #ffe9a8;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 16px;
  display: grid; place-items: center;
  color: #fff8e4;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  box-shadow: 0 5px 12px rgba(0,0,0,.45), 0 0 14px rgba(224,185,74,.4), inset 0 1px 0 rgba(255,255,255,.5);
  z-index: 3;
}
.dealer-chip.rel-0 { right: 22%; bottom: 22%; }
.dealer-chip.rel-1 { right: 12%; top: 42%; bottom: auto; }
.dealer-chip.rel-2 { left: 50%; right: auto; top: 18%; bottom: auto; transform: translateX(-50%); }
.dealer-chip.rel-3 { left: 12%; right: auto; top: 42%; bottom: auto; }

.table-timer {
  position: absolute;
  left: 14px; top: 12px;
  transform: none;
  z-index: 7;
}
.clock-face {
  width: 118px; height: 118px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #c93a3a 0%, #8b1616 52%, #4d0a0a 100%);
  border: 3px solid transparent;
  background-clip: padding-box;
  outline: 3px solid #e8c872;
  outline-offset: -3px;
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-size: 50px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 16px rgba(255, 210, 74, 0.4);
  box-shadow: 0 10px 24px rgba(0,0,0,.5), 0 0 22px rgba(232,90,74,.35), inset 0 2px 8px rgba(255,255,255,.25), inset 0 -8px 16px rgba(0,0,0,.45);
}
.table-timer.urgent .clock-face {
  animation: pulse 0.5s ease-in-out infinite;
  outline-color: #ff6a5a;
}
@keyframes pulse {
  50% { transform: scale(1.08); }
}
.table-chat {
  position: absolute;
  left: 142px;
  width: min(340px, calc(50% - 210px));
  right: auto;
  top: 14px;
  z-index: 6;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 78px;
  overflow: hidden;
}
.table-chat div {
  background: rgba(10, 6, 5, 0.62);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 16px;
  line-height: 1.35;
  color: #fff8e4;
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(3px);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.table-chat:empty { display: none; }

.last-pop {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, rgba(60, 16, 16, 0.72), rgba(0, 0, 0, 0.6));
  box-shadow:
    0 0 0 2px rgba(255, 220, 140, 0.98),
    0 0 18px rgba(255, 180, 60, 0.95),
    0 0 36px rgba(255, 140, 20, 0.7),
    0 0 60px rgba(255, 100, 10, 0.4),
    0 14px 30px rgba(0,0,0,.5);
  animation: popIn 0.28s ease-out;
  backdrop-filter: blur(1px);
}
.last-pop:empty { display: none; }
.last-pop .mj-tile { --tw: 70px; }
.last-pop .mj-tile::before { height: 8px; top: -7px; }
.flying-pop {
  position: fixed;
  left: 0; top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, rgba(60, 16, 16, 0.72), rgba(0, 0, 0, 0.6));
  box-shadow:
    0 0 0 2px rgba(255, 220, 140, 0.98),
    0 0 18px rgba(255, 180, 60, 0.95),
    0 0 36px rgba(255, 140, 20, 0.7),
    0 0 60px rgba(255, 100, 10, 0.4);
  z-index: 8;
  pointer-events: none;
  will-change: left, top, transform;
  transition: left 420ms cubic-bezier(0.22, 1, 0.36, 1), top 420ms cubic-bezier(0.22, 1, 0.36, 1), transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}
.flying-pop .mj-tile { --tw: 70px; }
.flying-pop .mj-tile::before { height: 8px; top: -7px; }
@keyframes popIn {
  from { transform: translate(-50%, -50%) scale(0.45); opacity: 0.2; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.self-strip {
  position: relative;
  z-index: 7;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 0 10px 4px;
  min-height: 142px;
}
.self-strip::before {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; top: 26px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.42));
  pointer-events: none;
}
.self-melds {
  display: flex; flex-wrap: wrap; gap: 4px;
  align-items: flex-end;
  max-width: 28%;
}
.self-hand {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 3px;
  min-width: 0;
  overflow-x: auto;
  /* 注意：overflow-x:auto 時 overflow-y:visible 會被瀏覽器強制算成 auto；
     懸停上浮／發牌動畫的位移會觸發垂直捲軸忽現忽隱＋版面位移（即閃爍），
     故垂直方向用 hidden 鎖死（上浮位移都在 padding 範圍內，不會被裁到牌面） */
  overflow-y: hidden;
  padding: 18px 8px 8px;
  scrollbar-width: thin;
}
.self-hand .mj-tile.drawn { margin-left: 16px; }
.self-hand .mj-tile { --tw: var(--hand-tw, clamp(44px, 5.2vw, 72px)); touch-action: pan-x; }
/* 發牌進場動畫只在新一局由 JS 掛 .deal-fx 觸發一次（backwards 結束後不殘留，hover 上浮不受影響） */
.self-hand.deal-fx .mj-tile { animation: tileIn 0.25s ease backwards; }
@keyframes tileIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.av-media { line-height: 0; }
.av-circle .av-media { width: 100%; height: 100%; }
.lobby-seat .av-media { width: 100%; height: 100%; }
.av-media video { width: 100%; height: 100%; object-fit: cover; }

/* tiles — 玉面象牙質感 */
.mj-tile {
  --tw: clamp(44px, 5.2vw, 72px);
  width: var(--tw);
  height: calc(var(--tw) * 1.38);
  appearance: none;
  border: 1px solid #b39a6e;
  padding: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, var(--tile-ivory-hi) 0%, #faf3dd 30%, var(--tile-ivory) 68%, var(--tile-ivory-lo) 100%);
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -3px 5px rgba(150, 118, 64, 0.32),
    inset 2px 0 3px rgba(255, 255, 255, 0.55),
    inset -2px 0 4px rgba(120, 92, 44, 0.22),
    2px 3px 0 #4a2c14,
    3px 6px 12px rgba(0, 0, 0, 0.32);
  position: relative;
  flex: 0 0 auto;
  color: #1a120c;
  line-height: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  z-index: 1;
  margin-top: 6px;
}
.mj-tile::before {
  content: "";
  position: absolute;
  left: 1px; right: 1px; top: -6px;
  height: 7px;
  background: linear-gradient(180deg, #fff0bd 0%, #f0c95e 45%, #b57e12 100%);
  border-radius: 5px 5px 0 0;
  box-shadow: inset 0 1px 0 #fff8d8, 0 -1px 2px rgba(0,0,0,.2);
  border: 1px solid rgba(122, 85, 20, 0.55);
  border-bottom: 0;
}
.mj-tile::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 7px;
  background: linear-gradient(115deg, rgba(255,255,255,.5) 0%, transparent 26%);
  pointer-events: none;
}
.mj-tile .tile-face {
  position: absolute; inset: 4px 4px 5px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: radial-gradient(100% 100% at 50% 20%, #fffef9 0%, #faf3dd 60%, #efe3c2 100%);
  box-shadow: inset 0 1px 3px rgba(120, 92, 44, 0.28), inset 0 0 0 1px rgba(190, 160, 110, 0.35);
}
.mj-tile.mini { --tw: clamp(30px, 3.4vw, 46px); margin-top: 4px; }
.mj-tile.tiny { --tw: 22px; box-shadow: 1px 2px 0 #4a2c14, 0 2px 5px rgba(0,0,0,.3), inset 0 1px 0 #fff; margin-top: 3px; border-radius: 5px; }
.mj-tile.opponent { --tw: 44px; }
.mj-tile.exposed { --tw: 32px; }
.mj-tile.selected {
  transform: translateY(-14px);
  z-index: 8;
  outline: 2px solid var(--gold-hi);
  outline-offset: 1px;
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.4), 0 0 0 2px #8b1616, 0 0 18px rgba(255, 210, 74, 0.75), inset 0 1px 0 #fff;
  filter: brightness(1.04);
}
.mj-tile.drawn {
  transform: translateY(-8px);
  box-shadow: 0 10px 18px rgba(0,0,0,.38), 0 0 14px rgba(255,210,74,.5), 2px 3px 0 #4a2c14, inset 0 1px 0 #fff;
}
.self-hand .mj-tile:hover:not(.back) {
  transform: translateY(-12px);
  z-index: 7;
  filter: brightness(1.05);
  box-shadow: 0 12px 20px rgba(0,0,0,.4), 0 0 14px rgba(255,210,74,.45), 2px 3px 0 #4a2c14, inset 0 1px 0 #fff;
}
.mj-tile.back {
  background: linear-gradient(180deg, #f2c659 0%, #cf9520 52%, #96700f 100%);
  border-color: #7a5514;
}
.mj-tile.back::before { display: none; }
.mj-tile.back::after { background: linear-gradient(115deg, rgba(255,255,255,.45) 0%, transparent 30%); }
.back-pattern {
  position: absolute; inset: 4px;
  border: 1px solid rgba(90, 52, 8, 0.55);
  outline: 1px solid rgba(255, 240, 200, 0.5);
  outline-offset: -3px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(45deg, rgba(90, 40, 0, 0.14) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(90, 40, 0, 0.12) 0 2px, transparent 2px 6px),
    radial-gradient(circle at 50% 40%, #e8b84a 0%, #c99200 60%, #8a5f0c 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -4px 8px rgba(60,30,0,.35);
}

.face-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 0 rgba(255,255,255,.7)); }
.face-wan { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; }
.face-wan .num {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: calc(var(--tw) * 0.4);
  line-height: 1.05;
  color: #254a92;
  text-shadow: 0 1px 0 #fff, 0 -1px 1px rgba(30, 50, 120, 0.25);
}
.face-wan .suit {
  font-size: calc(var(--tw) * 0.4);
  color: #b81f30;
  font-weight: 900;
  font-family: var(--font-serif);
  line-height: 1.05;
  text-shadow: 0 1px 0 #fff, 0 -1px 1px rgba(150, 20, 30, 0.25);
}
.face-honor {
  font-family: var(--font-serif); font-weight: 900;
  font-size: calc(var(--tw) * 0.6);
  display: grid; place-items: center; height: 100%;
  text-shadow: 0 1px 0 #fff, 0 2px 3px rgba(0,0,0,.18);
}
.face-honor.zhong { color: #b81f30; }
.face-honor.fa { color: #177a3e; }
.face-honor.wind { color: #254a92; }
/* 白板：藍色雙框（無字） */
.bai-o {
  display: grid; place-items: center;
  width: calc(var(--tw) * 0.66);
  height: calc(var(--tw) * 0.82);
  border: calc(var(--tw) * 0.085) solid #254a92;
  border-radius: calc(var(--tw) * 0.05);
  box-shadow: inset 0 1px 2px rgba(30,50,120,.25);
}
.bai-i {
  width: calc(var(--tw) * 0.42);
  height: calc(var(--tw) * 0.56);
  border: calc(var(--tw) * 0.06) solid #254a92;
}
/* 花牌：角標數字＋植物插畫 */
.face-flower {
  position: relative;
  width: 100%;
  display: flex; align-items: flex-end; justify-content: center;
  height: 100%;
}
.fl-badge {
  position: absolute;
  top: calc(var(--tw) * 0.04);
  left: calc(var(--tw) * 0.07);
  font-weight: 900;
  font-size: calc(var(--tw) * 0.27);
  line-height: 1;
  z-index: 1;
  text-shadow: 0 1px 0 #fff;
}
.fl-badge.arabic { color: #c43a2e; font-family: Georgia, "Times New Roman", serif; }
.fl-badge.cn { color: #254a92; font-family: var(--font-serif); }
.fl-art { position: absolute; inset: calc(var(--tw) * 0.1) 0 0; width: 100%; height: calc(100% - var(--tw) * 0.1); }

.action-overlay {
  position: absolute;
  left: 0; right: 0;
  bottom: 160px;
  z-index: 9;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  min-height: 0;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.45));
}
.action-overlay:empty { display: none; }
.action-overlay .act-btn,
.action-overlay .act-cancel,
.action-overlay .btn { pointer-events: auto; }
.act-btn {
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 3px solid rgba(255, 240, 200, 0.35);
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  background: radial-gradient(circle at 50% 28%, #8a8a8a, #3a3a3a 58%, #1e1e1e 100%);
  box-shadow: 0 8px 0 #141414, 0 14px 22px rgba(0,0,0,.4), inset 0 2px 4px rgba(255,255,255,.4), inset 0 -6px 10px rgba(0,0,0,.5);
  letter-spacing: 0;
  padding: 0;
  min-height: 0;
  text-shadow: 0 2px 3px rgba(0,0,0,.6);
  transition: transform .12s ease, filter .12s ease;
}
.act-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.act-btn.off { opacity: 0.42; filter: grayscale(.5); pointer-events: none; box-shadow: 0 4px 0 #1a1a1a, inset 0 2px 4px rgba(255,255,255,.25); }
.act-btn.peng.on, .act-btn.gang.on {
  background: radial-gradient(circle at 50% 28%, #ffb066, #e05a00 55%, #8a3200 100%);
  box-shadow: 0 8px 0 #6a2400, 0 14px 22px rgba(0,0,0,.4), inset 0 2px 4px rgba(255,255,255,.5), 0 0 18px rgba(255,140,40,.55);
}
.act-btn.chi.on {
  background: radial-gradient(circle at 50% 28%, #7edd9a, #1e8a4c 55%, #0d4530 100%);
  box-shadow: 0 8px 0 #0e3d2a, 0 14px 22px rgba(0,0,0,.4), inset 0 2px 4px rgba(255,255,255,.5), 0 0 18px rgba(80,220,140,.45);
}
.act-btn.ting.on {
  background: radial-gradient(circle at 50% 28%, #8ec4ff, #1f66d8 55%, #0e2f6a 100%);
  box-shadow: 0 8px 0 #0d3a80, 0 14px 22px rgba(0,0,0,.4), inset 0 2px 4px rgba(255,255,255,.5), 0 0 18px rgba(110,180,255,.5);
}
.act-btn.pending {
  animation: pulse 0.7s ease-in-out infinite;
}

/* HUD 代打開關 */
.hud-actions .btn.on {
  background: linear-gradient(180deg, #fff0bd, #c79a2e);
  color: #3a2408;
  border-color: #fff0bd;
  box-shadow: 0 0 12px rgba(255,210,74,.6), inset 0 1px 0 #fff;
}
.act-btn.hu.on {
  background: radial-gradient(circle at 50% 28%, #fff3c0, #f0c33c 52%, #a87812 100%);
  color: #3a2408;
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
  box-shadow: 0 8px 0 #6a4a12, 0 14px 22px rgba(0,0,0,.4), inset 0 2px 4px #fff, 0 0 26px rgba(255, 210, 74, 0.85);
  animation: huGlow 1s ease-in-out infinite;
}
@keyframes huGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.14); }
}
.act-cancel {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, #f07a62, #c92a2a 55%, #8b1616 100%);
  border: 1px solid #ffd9a8;
  color: #fff;
  font-size: 16px;
  letter-spacing: 0.12em;
  box-shadow: 0 4px 0 #5a0d0d, 0 8px 14px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.5);
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.action-overlay .wait-msg {
  pointer-events: none;
  background: rgba(16, 8, 6, 0.62);
  padding: 8px 16px;
  border-radius: 999px;
  letter-spacing: .12em;
  font-size: 13px;
  color: #f3d98a;
  border: 1px solid rgba(224,185,74,.35);
  backdrop-filter: blur(4px);
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
}

.bottom-bar {
  position: relative; z-index: 8;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 6px 14px;
  background: linear-gradient(180deg, #1c100b, #0a0605);
  border-top: 1px solid rgba(255, 233, 168, 0.24);
  font-size: 13px;
  color: #efe1b8;
  min-height: 34px;
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
}
.bottom-bar .bb-left { letter-spacing: 0.08em; }
.bottom-bar .bb-mid { display: flex; gap: 16px; opacity: 0.92; }
.bottom-bar .seat-wind {
  background: linear-gradient(180deg, #2f9e6a, #166b42);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 2px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.4);
}

.room-drawer {
  position: absolute;
  top: 48px; right: 8px; bottom: 40px;
  width: 240px;
  z-index: 10;
  display: none;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}
.room-drawer.open { display: flex; }
.side-card {
  background: linear-gradient(180deg, rgba(40, 20, 14, 0.95), rgba(20, 10, 8, 0.95));
  border: 1px solid rgba(255, 233, 168, 0.3);
  border-radius: 12px;
  padding: 8px;
  min-height: 0;
  box-shadow: 0 10px 22px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.1);
  backdrop-filter: blur(8px);
}
.side-card h3 {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--gold);
  font-weight: 600;
}
.video-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.av-bubble { text-align: center; min-width: 0; }
.av-bubble video, .av-bubble .avatar-fallback {
  width: 92px; height: 92px;
  margin: 0 auto;
  font-size: 30px;
}
.av-bubble img { width: 92px; height: 92px; margin: 0 auto; object-fit: cover; border-radius: 50%; border: 3px solid var(--gold); background: #111; box-shadow: 0 6px 14px rgba(0,0,0,.45); }
.av-bubble span { display: block; font-size: 11px; color: #efe1b8; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-controls { display: flex; gap: 6px; margin-top: 6px; }
.chat-live { height: 120px; overflow: auto; font-size: 12px; line-height: 1.5; color: #efe1b8; }
.scores { font-size: 12px; line-height: 1.7; }
.scores div { display: flex; justify-content: space-between; gap: 8px; }
.scores b { color: var(--gold-soft); }

.call-stamp {
  position: absolute;
  left: 50%; top: 42%;
  transform: translate(-50%, -50%) scale(.6);
  font-family: var(--font-serif);
  font-size: 92px;
  font-weight: 900;
  background: linear-gradient(180deg, #fff8dc 0%, #ffd24a 45%, #c99200 75%, #8a5f0c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #6d0d0d) drop-shadow(0 10px 24px rgba(0,0,0,.5)) drop-shadow(0 0 22px rgba(255,200,60,.4));
  opacity: 0;
  pointer-events: none;
  z-index: 25;
  letter-spacing: 0.08em;
}
.call-stamp.show {
  animation: stamp 0.85s ease-out forwards;
}
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.9); }
}

.overlay {
  position: absolute; inset: 0;
  background: rgba(8, 4, 3, 0.66);
  display: none;
  align-items: center; justify-content: center;
  z-index: 20;
  padding: 16px;
  backdrop-filter: blur(6px);
}
.overlay.show { display: flex; }
.overlay.show .modal { animation: modalPop 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes modalPop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal {
  width: min(520px, 100%);
  background:
    radial-gradient(120% 46% at 50% 0%, rgba(255, 190, 120, 0.14), transparent 60%),
    linear-gradient(180deg, #46211a, #1c0d0a 70%);
  border: 1px solid rgba(255, 233, 168, 0.55);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,240,200,.3), 0 0 30px rgba(224,185,74,.16);
}
#overlay-result .modal {
  width: fit-content;
  min-width: min(624px, calc(100% - 16px));
  max-width: calc(100% - 16px);
  max-height: 99vh;
  padding-top: 19px;
  padding-bottom: 19px;
  overflow: auto;
}
#overlay-result .mj-tile.tiny { --tw: 23px; }
.modal h2 { font-family: var(--font-serif); color: var(--gold-soft); letter-spacing: 0.16em; margin: 0 0 10px; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.hu-banner {
  text-align: center;
}
.hu-banner .hu-xl {
  font-family: var(--font-serif);
  font-size: 67px;
  font-weight: 900;
  line-height: 1;
  margin: 4px 0 8px;
  background: linear-gradient(180deg, #fff8dc 0%, #ffd24a 45%, #c99200 78%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #6d0d0d) drop-shadow(0 12px 30px rgba(0,0,0,.5));
}
.tai-list { margin: 10px 0; font-size: 14px; }
.tai-list div { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid rgba(224, 185, 74, 0.14); }
.tai-list .pay-title { color: var(--gold); font-size: 12px; letter-spacing: .08em; }
.congrats {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 18px;
  color: #ffd24a;
  letter-spacing: 0.12em;
  margin: 12px 0 2px;
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.congrats.big { font-size: 24px; text-shadow: 0 2px 0 #5a0d0d, 0 8px 20px rgba(0,0,0,.5), 0 0 18px rgba(255,200,60,.35); }
.final-list { margin: 10px 0 4px; font-size: 16px; }
.final-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 6px;
  border-bottom: 1px solid rgba(224, 185, 74, 0.14);
}
.final-row .rank { width: 30px; text-align: center; font-size: 18px; }
.final-row .fname { flex: 1; letter-spacing: 0.08em; }
.final-row b { color: var(--gold-soft); font-size: 18px; }
.final-row.champion {
  background: linear-gradient(90deg, rgba(255, 220, 140, 0.22), transparent);
  border-radius: 8px;
  border-bottom-color: rgba(255,220,140,.35);
}
.final-row.champion b { color: #ffd24a; font-size: 20px; text-shadow: 0 0 12px rgba(255,200,60,.5); }
.end-xl { font-size: 64px; }
.chi-opts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0; }
.chi-opt {
  background: linear-gradient(180deg, #2e1a13, #1e100b);
  border: 1px solid rgba(255, 233, 168, 0.4);
  border-radius: 10px;
  padding: 8px;
  display: flex; gap: 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
  transition: transform .12s ease, box-shadow .12s ease;
}
.chi-opt:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0,0,0,.4), 0 0 12px rgba(224,185,74,.3); }

.toast {
  position: absolute;
  left: 50%; bottom: 168px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(22, 11, 8, 0.94);
  border: 1px solid rgba(255, 233, 168, 0.5);
  color: var(--gold-soft);
  padding: 8px 14px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 30;
  letter-spacing: 0.12em;
  font-size: 13px;
  box-shadow: 0 8px 18px rgba(0,0,0,.45), 0 0 14px rgba(224,185,74,.2);
  backdrop-filter: blur(6px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.float-tiles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float-tiles .mj-tile {
  position: absolute;
  opacity: 0.24;
  filter: saturate(1.1);
  animation: drift 14s linear infinite;
}
@keyframes drift {
  from { transform: translateY(0) rotate(0deg); }
  to { transform: translateY(-120px) rotate(12deg); }
}

@media (max-width: 980px) {
  .table-3d { padding: 56px 84px 6px; }
  .av-circle { width: 94px; height: 94px; }
  .av-self .av-circle { width: 72px; height: 72px; }
  .act-btn { width: 62px; height: 62px; font-size: 24px; }
  .mj-tile { --tw: clamp(40px, 5.2vw, 58px); }
}
@media (max-width: 760px) {
  .table-3d { padding: 54px 8px 4px; }
  .av-left { left: 0; }
  .av-right { right: 0; }
  .av-circle { width: 74px; height: 74px; }
  .av-self .av-circle { width: 62px; height: 62px; }
  .av-name { font-size: 10px; max-width: 100px; }
  .wood-rim { padding: 10px; }
  .mj-tile { --tw: 40px; }
  .mj-tile.mini { --tw: 36px; }
  .mj-tile.tiny { --tw: 18px; }
  .mj-tile.exposed { --tw: 26px; }
  .last-pop { width: 110px; height: 110px; }
  .last-pop .mj-tile { --tw: 58px; }
  .flying-pop { width: 110px; height: 110px; }
  .flying-pop .mj-tile { --tw: 58px; }
  .flying-pop .mj-tile::before { height: 7px; top: -6px; }
  .table-chat { left: 100px; width: min(260px, calc(50% - 145px)); right: auto; top: 8px; max-height: 66px; }
  .table-chat div { font-size: 16px; }
  .clock-face { width: 84px; height: 84px; font-size: 36px; }
  .stand-tile { width: 18px; height: 26px; }
  .hand-left .stand-tile, .hand-right .stand-tile { width: 26px; height: 18px; }
  .wtile { width: 13px; height: 19px; }
  .wall-left .wtile, .wall-right .wtile { width: 19px; height: 13px; }
  .act-btn { width: 54px; height: 54px; font-size: 20px; }
  .action-overlay { bottom: 122px; gap: 8px; }
  .hud-brand span { display: none; }
  .seat-grid { grid-template-columns: 1fr; }
  .self-melds { max-width: 34%; }
  .room-drawer { width: min(100% - 16px, 280px); }
}
