﻿:root {
  --lacquer: #8b1616;
  --lacquer-dark: #5a0d0d;
  --gold: #e0b94a;
  --gold-soft: #f3d98a;
  --ink: #1a120c;
  --ivory: #f7f1de;
  --felt: #6b1c28;
  --felt-deep: #4a1018;
  --wood: #6a4424;
  --wood-dark: #3a2414;
  --paper: #f4ecd6;
  --danger: #c41e3a;
  --jade: #2f9e6a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --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: #120806;
  overflow: hidden;
  user-select: none;
}

button, input { font-family: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.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); }
.mj-lang-row button.on { background: var(--gold); color: #3a2408; font-weight: 700; border-color: var(--gold); }
.mj-lang-row button:hover { filter: brightness(1.1); }
#app { height: 100%; position: relative; }

.screen {
  position: absolute; inset: 0;
  display: none;
  overflow: hidden;
}
.screen.active { display: flex; flex-direction: column; }

.bg-stage {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(180, 40, 40, 0.25), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(14, 74, 56, 0.35), transparent 45%),
    linear-gradient(180deg, #1a0c0a 0%, #0c0706 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.07;
  pointer-events: none;
}

.lantern {
  position: absolute;
  width: 54px; height: 78px;
  background: radial-gradient(circle at 50% 30%, #e85a4a, #9b1b1b 70%);
  border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%;
  box-shadow: 0 0 30px rgba(232, 90, 74, 0.35), inset 0 0 0 2px rgba(224, 185, 74, 0.5);
  opacity: 0.7;
  animation: sway 5.5s ease-in-out infinite;
}
.lantern::before {
  content: "";
  position: absolute; left: 50%; top: -10px; width: 2px; height: 12px;
  background: var(--gold); transform: translateX(-50%);
}
.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: linear-gradient(180deg, rgba(72, 18, 16, 0.72), rgba(24, 10, 8, 0.78));
  border: 1px solid rgba(224, 185, 74, 0.45);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 240, 200, 0.08);
  border-radius: 18px;
  backdrop-filter: blur(8px);
}
.logo {
  width: 108px; height: 108px;
  margin: 0 auto 10px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}
.game-title {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: 0.18em;
  margin: 0;
  color: var(--gold-soft);
  text-shadow: 0 2px 0 #5a0d0d, 0 10px 24px rgba(0, 0, 0, 0.45);
}
.game-sub {
  margin: 6px 0 0;
  letter-spacing: 0.18em;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(32px, 5vw, 44px);
  color: var(--gold-soft);
  text-shadow: 0 2px 0 #5a0d0d, 0 10px 24px rgba(0,0,0,.45);
  opacity: 0.98;
}
.game-tag {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 12px;
  border: 1px solid rgba(224, 185, 74, 0.35);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: #e8d7a8;
}
.menu-actions { display: grid; gap: 12px; margin-top: 28px; }
.btn {
  appearance: none;
  border: 1px solid rgba(224, 185, 74, 0.55);
  background: linear-gradient(180deg, #a31f1f, #6d1212);
  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 10px 18px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #3d0a0a; }
.btn.gold {
  background: linear-gradient(180deg, #ead07a, #b8892a);
  color: #3a2408;
  box-shadow: 0 6px 0 #6a4a12, 0 10px 18px rgba(0, 0, 0, 0.3);
}
.btn.ghost {
  background: transparent;
  box-shadow: none;
  color: var(--gold-soft);
}
.btn.small { min-height: 40px; padding: 8px 12px; font-size: 15px; letter-spacing: 0.08em; box-shadow: 0 3px 0 #3d0a0a; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.menu-foot {
  margin-top: 18px;
  font-size: 12px;
  color: rgba(247, 241, 222, 0.55);
  letter-spacing: 0.08em;
}

.panel {
  position: relative; z-index: 2;
  margin: auto;
  width: min(720px, calc(100% - 28px));
  background: linear-gradient(180deg, rgba(28, 14, 10, 0.88), rgba(16, 8, 6, 0.92));
  border: 1px solid rgba(224, 185, 74, 0.4);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
  max-height: calc(100% - 24px);
  overflow: auto;
}
.panel h2 {
  font-family: var(--font-serif);
  margin: 0 0 8px;
  letter-spacing: 0.16em;
  color: var(--gold-soft);
}
.panel p.lead { color: rgba(247, 241, 222, 0.82); 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; }
.field input {
  width: 100%;
  background: #24140f;
  border: 1px solid rgba(224, 185, 74, 0.3);
  color: var(--ivory);
  border-radius: 8px;
  min-height: 48px;
  padding: 11px 14px;
  font-size: 18px;
  outline: none;
}
.field input:focus { border-color: var(--gold); }
.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: #1a0e0a;
  border: 1px dashed rgba(224, 185, 74, 0.45);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0 14px;
  text-align: center;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.lobby-seat {
  background: rgba(107, 28, 40, 0.28);
  border: 1px solid rgba(224, 185, 74, 0.22);
  border-radius: 12px;
  padding: 12px;
  min-height: 208px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.lobby-seat.empty { opacity: 0.7; }
.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% 36%, #fff1c7 0 27%, transparent 28%), linear-gradient(180deg, #8d3b29, #3d0d0d);
  border: 3px solid var(--gold);
  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; }
.empty-avatar { background: linear-gradient(180deg, #3f514c, #1c2a25); font-size: 24px; }
.seat-name { font-size: 13px; letter-spacing: 0.08em; }
.seat-tag { font-size: 11px; color: var(--gold); }

.chat-box {
  background: #140c0a;
  border: 1px solid rgba(224, 185, 74, 0.2);
  border-radius: 10px;
  height: 120px;
  overflow: auto;
  padding: 8px 10px;
  font-size: 13px;
  text-align: left;
  line-height: 1.6;
}
.chat-row { display: flex; gap: 8px; margin-top: 8px; }
.chat-row input {
  flex: 1;
  background: #24140f;
  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;
}

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

/* ===== Game table ===== */
#screen-game { background: #1a3040; }
.table-sky {
  position: absolute; inset: 0;
  background:
    url("../assets/bg-table.svg") center / cover no-repeat,
    linear-gradient(180deg, #7ec8e8 0%, #6a9a4a 100%);
  pointer-events: none;
}
.game-hud {
  position: relative; z-index: 8;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  background: linear-gradient(180deg, rgba(20, 10, 8, 0.82), rgba(20, 10, 8, 0.55));
  border-bottom: 1px solid rgba(224, 185, 74, 0.28);
  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;
}
.hud-brand img { width: 28px; height: 28px; }
.hud-stats {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: #f0d9a0;
}
.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: 50%; transform:translateY(-50%); }
.av-right { right: 6px; top: 50%; transform:translateY(-50%); }
.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 var(--gold);
  box-shadow: 0 8px 22px rgba(0,0,0,.5), 0 0 0 2px rgba(90,13,13,.5);
  background: #2a1810;
  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 18px rgba(255, 180, 40, .7); }
.av-meta { text-align: center; line-height: 1.2; }
.av-name { font-size: 12px; color: #fff8e4; text-shadow: 0 1px 3px #000; max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-tags { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; }
.av-tags span {
  font-size: 10px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(224,185,74,.45);
  border-radius: 999px;
  padding: 0 6px;
  color: #f3d98a;
}
.av-tags .ting-badge { background: #1a5fd0; border-color: #8ec0ff; color: #fff; }
.av-tags .turn-badge { background: #c41e3a; border-color: #f0b33a; color: #fff; }

.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, #8a5a2e 0%, #5a3818 40%, #3a2410 100%);
  border-radius: 18px;
  padding: 16px 18px 20px;
  box-shadow:
    inset 0 2px 0 #e0b87a,
    inset 0 -6px 10px rgba(0,0,0,.35),
    0 28px 50px rgba(0,0,0,.45);
}
.felt {
  height: 100%;
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 50% 40%, #8a2434 0%, #5c1522 55%, #3a0e16 100%);
  box-shadow: inset 0 0 0 3px rgba(90, 20, 28, 0.6), inset 0 0 70px rgba(0,0,0,.28);
  position: relative;
  overflow: hidden;
}
.felt::after {
  content: "牌桌有約";
  position: absolute;
  left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  font-family: var(--font-serif);
  font-size: clamp(26px, 4.5vw, 48px);
  letter-spacing: 0.4em;
  color: rgba(255, 220, 160, 0.07);
  pointer-events: none;
}

.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, #f3d36a 0%, #d4a017 55%, #a87812 100%);
  border-radius: 2px;
  box-shadow: 0 1px 0 #6a4a10, inset 0 1px 0 #ffe08a;
  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, #f6d56e, #c98918);
  border-radius: 2px 2px 1px 1px;
  box-shadow: 1px 1px 0 #5a3a08, inset 0 1px 0 #ffe9a8;
  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: 8px;
  background: radial-gradient(circle at 40% 30%, #e85a4a, #8b1616);
  border: 2px solid #f3d98a;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 16px;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,.4);
  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: #8b1616;
  border: 3px solid #e0b94a;
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-size: 50px;
  font-weight: 900;
  color: #fff;
}
.table-timer.urgent .clock-face {
  animation: pulse 0.5s ease-in-out infinite;
}
@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(0,0,0,.42);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  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(2px);
}
.table-chat:empty { display: none; }

.last-pop {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
  filter: drop-shadow(0 0 22px rgba(255, 210, 80, .9));
  animation: popIn 0.28s ease-out;
}
.last-pop .mj-tile { --tw: 88px; }
.last-pop .mj-tile::before { height: 10px; top: -9px; }
@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-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-y: visible;
  padding: 18px 8px 6px;
  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; }
.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; }

/* poker cards */
.pcard{
  --tw: clamp(48px,5.6vw,76px);
  width:var(--tw);
  height:calc(var(--tw)*1.42);
  appearance:none;
  border:1px solid #cbb58a;
  padding:0;
  border-radius:6px;
  background:linear-gradient(180deg,#fffef9 0%,#f7f1de 70%, #ede0b8 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(160,130,80,.2), 2px 3px 0 #3a1810, 3px 6px 14px rgba(0,0,0,.28);
  position:relative; flex:0 0 auto; color:#1a120c; line-height:1;
  transition:transform .12s ease, box-shadow .12s ease;
  overflow:hidden; margin-top:6px;
}
.pcard.red{ color:#c41e3a; }
.pcard.black{ color:#1a1a1a; }
.pcard.mini{ --tw:clamp(32px,3.6vw,48px); margin-top:4px;}
.pcard.tiny{ --tw:22px; margin-top:3px;}
.pcard.selected{ transform:translateY(-14px); z-index:8; outline:2px solid var(--gold); box-shadow:0 10px 16px rgba(0,0,0,.35),0 0 0 2px #8b1616; }
.pcard.trump{ box-shadow:0 0 0 2px #ffd24a, 2px 3px 0 #3a1810; }
.pcard.back{ background:linear-gradient(135deg,#1e5a96 0%, #1a3a6b 55%, #0f2a4f 100%); border-color:#1e3a6b; }
.pcard.back .pc-back{ position:absolute; inset:6px; border:1px solid rgba(255,255,255,.22); border-radius:4px; background: repeating-linear-gradient(45deg, rgba(255,255,255,.06) 0 3px, transparent 3px 9px), repeating-linear-gradient(-45deg, rgba(255,255,255,.04) 0 3px, transparent 3px 9px); display:grid; place-items:center; color:rgba(255,255,255,.55); font-family:var(--font-serif); font-size:calc(var(--tw)*.22); letter-spacing:.14em;}
.pcard.back .pc-back::after{ content:"百分"; }
.pcard.empty{ background:transparent; border:1px dashed rgba(255,255,255,.18); box-shadow:none; }
.pcard .pc-inner{ position:absolute; inset:4px; display:grid; place-items:center; }
.pc-face{ display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; font-family:var(--font-serif); font-weight:900; }
.pc-rank{ font-size:calc(var(--tw)*.38); line-height:1; }
.pc-suit{ font-size:calc(var(--tw)*.42); line-height:1; }
.pc-rank-sm{ font-size:calc(var(--tw)*.14); opacity:.7; letter-spacing:.04em;}
.stand-card{ width:22px; height:32px; background:linear-gradient(180deg,#f0c14a,#c98918); border-radius:3px; box-shadow:1px 1px 0 #5a3a08; display:block; flex:0 0 auto; }
.poker-hand{ position:absolute; z-index:4; pointer-events:none; }
.ph-top{ top:8px; left:50%; transform:translateX(-50%); }
.ph-left{ left:12px; bottom:28px; top:auto; transform:none; }
.ph-right{ right:8px; top:50%; transform:translateY(-50%); }
.poker-fan{ display:flex; align-items:center; }
.poker-fan.vertical{ flex-direction:column; }
.poker-fan.side{ flex-direction:column; align-items:center; gap:0; }
.poker-fan .fan-card{ box-shadow:1px 1px 3px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08); border-width:1px; margin-left:-14px; }
.poker-fan .fan-card:first-child{ margin-left:0; }
.poker-fan.vertical .fan-card{ margin-left:0; margin-top:-10px; }
.poker-fan.vertical .fan-card:first-child{ margin-top:0; }
.poker-fan.side .fan-card{ margin-left:0; margin-top:-18px; box-shadow:1px 2px 4px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.06); }
.poker-fan.side .fan-card:first-child{ margin-top:0; }
.poker-fan.side .fan-card:last-child{ --tw:48px; margin-top:8px; box-shadow:0 4px 14px rgba(0,0,0,.48), inset 0 1px 0 rgba(255,255,255,.10); border-width:1.2px; }
.pcard.side{ width:calc(var(--tw) * 1.42); height:var(--tw); border-radius:4px; }
.pcard.side .pc-back{ inset:4px; }
.hand-count{ margin-left:6px; background:rgba(0,0,0,.58); color:#f3d98a; padding:2px 7px; border-radius:999px; font-size:11px; border:1px solid rgba(224,185,74,.32); font-weight:700; letter-spacing:.04em; }
.poker-fan.vertical .hand-count{ margin-left:0; margin-top:6px; }
.poker-fan.side .hand-count{ margin-left:0; margin-top:8px; }
.ph-left .poker-fan, .ph-right .poker-fan{ flex-wrap:nowrap; }
.ph-right .poker-fan{ flex-direction:column; align-items:center; }
.ph-right .poker-fan .hand-count{ margin-left:0; margin-right:0; margin-top:8px; }
.ph-left .poker-fan .fan-card{ margin-left:0; }
.ph-left .poker-fan .fan-card:first-child{ margin-left:0; }
.ph-right .poker-fan .fan-card{ margin-left:0; margin-right:0; }
.points-pile{ --pile-tw:36px; position:absolute; z-index:4; display:flex; flex-direction:column; align-items:center; background:rgba(8,4,4,.42); border:1.5px solid rgba(224,185,74,.28); border-radius:10px; width:74px; height:188px; padding:7px 6px 25px; pointer-events:none; align-content:flex-start; overflow-y:auto; overflow-x:hidden; backdrop-filter:blur(4px); box-shadow:0 4px 16px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.07); scrollbar-width:none; }
.points-pile::-webkit-scrollbar{ display:none; }
.points-pile::after{ content:""; position:absolute; inset:0; border-radius:10px; box-shadow:inset 0 0 18px rgba(224,185,74,.06); pointer-events:none; }
/* 左右兩家採直向疊牌；我與對家維持原有橫向位置與橫排疊牌。 */
.pile-left{ left:78px; top:50%; right:auto; bottom:auto; transform:translateY(-50%); } /* 左家分數：上移置中 */
.pile-right{ right:78px; top:50%; left:auto; bottom:auto; transform:translateY(-50%); } /* 右家：中間手牌上方空位，直排 */
.pile-top, .pile-self{ flex-direction:row; flex-wrap:nowrap; align-items:flex-start; align-content:flex-start; justify-content:flex-start; width:220px; height:auto; min-height:62px; max-height:84px; padding:10px 6px 22px; overflow-x:auto; overflow-y:hidden; }
.pile-top{ top:8px; left:12px; right:auto; bottom:auto; transform:none; } /* 對家：左上角與手牌平行 */
.pile-self{ bottom:16px; left:auto; right:28px; top:auto; transform:none; } /* 自家：下移不碰左家手牌 */
.points-pile .pile-card{ position:relative; display:block; height:calc(var(--pile-tw) * 1.42); flex:0 0 auto; }
.points-pile .pile-card + .pile-card{ margin-top:calc(var(--pile-tw) * -0.355); }
.pile-top .pile-card, .pile-self .pile-card{ width:var(--pile-tw); height:calc(var(--pile-tw) * 1.42); }
.pile-top .pile-card + .pile-card, .pile-self .pile-card + .pile-card{ margin-top:0; margin-left:calc(var(--pile-tw) * -0.25); }
.pile-top .pile-count, .pile-self .pile-count{ left:auto; right:6px; bottom:3px; top:auto; transform:none; }
.points-pile .pcard{ --tw:var(--pile-tw); margin:0; box-shadow:0 2px 6px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.08); border-width:1px; display:block; }
.points-pile .pcard .pc-back::after{ font-size:calc(var(--tw)*.18); }
.points-pile .pile-count{ position:absolute; z-index:20; bottom:3px; left:50%; transform:translateX(-50%); font-size:11px; color:#ffd24a; font-weight:800; text-shadow:0 1px 3px #000, 0 0 6px rgba(0,0,0,.6); letter-spacing:.04em; white-space:nowrap; }
.flying-card{ position:fixed; z-index:30; pointer-events:none; transition:transform .82s cubic-bezier(.22,.61,.36,1), opacity .78s ease; will-change:transform; filter:drop-shadow(0 8px 18px rgba(0,0,0,.5)); }
.flying-card .pcard{ --tw:52px; }
.trick-hold{ animation: trickHold 3s ease; }
@keyframes trickHold{ 0%,92%{ opacity:1; transform:scale(1);} 100%{ opacity:0; transform:scale(.96);} }
.trick-slot.win .pcard{ box-shadow:0 0 0 2.5px #ffd24a, 0 6px 18px rgba(0,0,0,.42); }
.trick-slot .win-mark{ display:inline-block; background:#ffd24a; color:#3a2408; font-size:9px; font-weight:900; padding:1px 4px; border-radius:4px; margin-left:4px; letter-spacing:.06em; }
.bidding-board{ background:rgba(10,6,4,.55); border:1px solid rgba(224,185,74,.28); border-radius:12px; padding:14px 16px; text-align:center; max-width:520px; margin:0 auto; backdrop-filter:blur(4px); }
.bidding-title{ font-family:var(--font-serif); color:var(--gold-soft); letter-spacing:.14em; margin-bottom:8px; font-weight:800; font-size:16px;}
.bidding-hist{ display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin:8px 0; font-size:13px;}
.bid-pass{ background:rgba(255,255,255,.08); padding:4px 8px; border-radius:999px; border:1px solid rgba(255,255,255,.12); color:#ccc;}
.bid-item{ background:rgba(224,185,74,.14); padding:4px 8px; border-radius:999px; border:1px solid rgba(224,185,74,.35); color:var(--gold-soft);}
.bidding-cur{ font-size:13px; color:#f0d9a0; margin-top:6px;}
.score-rule{ font-size:11px; opacity:.7; margin-top:4px; letter-spacing:.06em;}
.bid-panel{ display:flex; gap:8px; align-items:center; }
.bid-opts{ display:flex; flex-wrap:wrap; gap:6px; max-width:560px; justify-content:center; margin-top:8px; }
.bid-opt{ background:rgba(20,10,8,.7); border:1px solid rgba(224,185,74,.35); color:var(--gold-soft); border-radius:8px; padding:6px 10px; font-size:13px;}
.bid-ui{
  display:flex;
  align-items:center;
  gap:12px;
  background:rgba(10,6,4,.78);
  border:1px solid rgba(224,185,74,.38);
  border-radius:14px;
  padding:10px 12px;
  backdrop-filter:blur(8px);
  box-shadow:0 10px 28px rgba(0,0,0,.4);
  max-width:min(720px, calc(100vw - 28px));
}
.bid-ui .act-btn{ flex:0 0 auto; }
.bid-chart{ display:flex; flex-direction:column; gap:8px; min-width:0; }
.bid-rounds{ display:flex; gap:4px; flex-wrap:wrap; justify-content:center; padding-left:10px; }
.bid-round-tab{
  appearance:none;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(224,185,74,.28);
  color:#e8d7a4;
  border-radius:999px;
  min-width:62px;
  padding:5px 13px;
  font-size:12px;
  letter-spacing:.08em;
  font-weight:700;
}
.bid-round-tab .short{ display:none; }
.bid-round-tab.on{
  background:linear-gradient(180deg, #ead07a, #b8892a);
  color:#3a2408;
  border-color:#f3d98a;
}
.bid-round-tab.dead,
.bid-round-tab:disabled{
  opacity:.38;
  cursor:default;
}
.bid-rows{ display:flex; flex-direction:column; gap:6px; }
.bid-row{
  display:flex;
  align-items:center;
  gap:8px;
  min-height:36px;
}
.bid-row.dead{ opacity:.42; }
.bid-score{
  flex:0 0 40px;
  font-family:var(--font-serif);
  font-size:22px;
  font-weight:900;
  color:var(--gold-soft);
  letter-spacing:.04em;
  text-align:center;
}
.bid-modes{
  display:flex;
  align-items:center;
  gap:4px;
  flex:0 0 auto;
}
.bid-mode{
  appearance:none;
  min-width:36px;
  background:rgba(20,10,8,.7);
  border:1px solid rgba(224,185,74,.4);
  color:var(--gold-soft);
  border-radius:8px;
  padding:5px 10px;
  font-size:14px;
  font-weight:800;
  letter-spacing:.12em;
}
.bid-mode.on{
  background:linear-gradient(180deg, #ead07a, #b8892a);
  color:#3a2408;
  border-color:#f3d98a;
}
.bid-mode:disabled{ opacity:.35; cursor:default; }
.bid-suits{ display:flex; gap:4px; flex-wrap:wrap; min-width:0; }
.bid-suit{
  appearance:none;
  display:inline-flex;
  align-items:center;
  gap:3px;
  background:rgba(20,10,8,.7);
  border:1px solid rgba(224,185,74,.35);
  color:var(--gold-soft);
  border-radius:8px;
  padding:5px 8px;
  font-size:13px;
  font-weight:700;
  letter-spacing:.04em;
}
.bid-suit .sym{ font-size:14px; line-height:1; }
.bid-suit.suit-heart,
.bid-suit.suit-diamond{ color:#ff6b6b; border-color:rgba(255,107,107,.45); }
.bid-suit.suit-spade .sym,
.bid-suit.suit-club .sym{ color:#f3f3f3; }
.bid-suit:hover:not(:disabled){ background:rgba(224,185,74,.25); }
.bid-suit:disabled{ opacity:.32; cursor:default; filter:grayscale(.35); }
.trick-center{ display:grid; grid-template-areas:"top top top" "left center right" "self self self"; gap:10px; align-items:center; justify-items:center; max-width:420px; margin:0 auto;}
.trick-slot{ display:flex; flex-direction:column; align-items:center; gap:6px;}
.trick-slot.pos-top{ grid-area:top; transform:translateY(14px); }
.trick-slot.pos-left{ grid-area:left;}
.trick-slot.pos-right{ grid-area:right;}
.trick-slot.pos-self{ grid-area:self;}
.trick-center .pcard{ --tw:68px;}
.slot-label{ font-size:11px; color:var(--gold-soft); letter-spacing:.08em;}
.trick-info{ grid-column:1/-1; font-size:11px; opacity:.75; letter-spacing:.08em;}
#trick-overlay{ position:absolute; inset:12px; display:grid; place-items:center; z-index:2; pointer-events:none;}
.discard-pile{ display:flex; gap:6px; align-items:center; justify-content:center; flex-wrap:wrap; margin-top:8px;}
.discard-pile .pcard{ --tw:44px;}
.rev-tag{ font-size:10px; background:#c41e3a; color:#fff; padding:1px 4px; border-radius:4px; margin-left:2px;}
.call-panel{ display:flex; gap:6px; justify-content:center; flex-wrap:wrap;}
#wall-info{ position:absolute; top:8px; right:12px; font-size:11px; background:rgba(0,0,0,.45); padding:4px 8px; border-radius:999px; border:1px solid rgba(224,185,74,.28); color:#f3d98a; z-index:2;}
.bid-opts .bid-opt:hover{ background:rgba(224,185,74,.25);}

/* tiles */
.mj-tile {
  --tw: clamp(44px, 5.2vw, 72px);
  width: var(--tw);
  height: calc(var(--tw) * 1.38);
  appearance: none;
  border: 1px solid #cbb58a;
  padding: 0;
  border-radius: 4px;
  background: linear-gradient(180deg, #fffdf6 0%, #f3ead0 70%, #e6d7b0 100%);
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -2px 0 rgba(160, 130, 80, 0.35),
    2px 3px 0 #3a1810,
    3px 5px 10px rgba(0, 0, 0, 0.28);
  position: relative;
  flex: 0 0 auto;
  color: #1a120c;
  line-height: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  z-index: 1;
  margin-top: 6px;
}
.mj-tile::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -6px;
  height: 7px;
  background: linear-gradient(180deg, #f6d56e, #d4a017);
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 1px 0 #ffe9a8;
}
.mj-tile .tile-face {
  position: absolute; inset: 3px 3px 4px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.mj-tile.mini { --tw: clamp(30px, 3.4vw, 46px); margin-top: 4px; }
.mj-tile.tiny { --tw: 22px; box-shadow: 1px 1px 0 #3a1810; margin-top: 3px; }
.mj-tile.opponent { --tw: 44px; }
.mj-tile.exposed { --tw: 32px; }
.mj-tile.selected {
  transform: translateY(-14px);
  z-index: 8;
  outline: 2px solid var(--gold);
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.35), 0 0 0 2px #8b1616;
}
.mj-tile.drawn { transform: translateY(-8px); }
.self-hand .mj-tile:hover:not(.back) {
  transform: translateY(-12px);
  z-index: 7;
}
.mj-tile.back {
  background: linear-gradient(180deg, #f0c14a, #c98918 60%, #a07010);
  border-color: #8a6410;
}
.mj-tile.back::before { display: none; }
.back-pattern {
  position: absolute; inset: 3px;
  border: 1px solid rgba(120, 70, 10, 0.35);
  border-radius: 2px;
  background:
    repeating-linear-gradient(45deg, rgba(90, 40, 0, 0.12) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(90, 40, 0, 0.1) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #e8b84a, #c98918);
}

.face-svg { width: 100%; height: 100%; display: block; }
.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: #28539c;
}
.face-wan .suit {
  font-size: calc(var(--tw) * 0.4);
  color: #c41e3a;
  font-weight: 900;
  font-family: var(--font-serif);
  line-height: 1.05;
}
.face-honor {
  font-family: var(--font-serif); font-weight: 900;
  font-size: calc(var(--tw) * 0.6);
  display: grid; place-items: center; height: 100%;
}
.face-honor.zhong { color: #c41e3a; }
.face-honor.fa { color: #1e7a46; }
.face-honor.wind { color: #28539c; }
/* 白板：藍色雙框（無字） */
.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 #28539c;
  border-radius: calc(var(--tw) * 0.05);
}
.bai-i {
  width: calc(var(--tw) * 0.42);
  height: calc(var(--tw) * 0.56);
  border: calc(var(--tw) * 0.06) solid #28539c;
}
/* 花牌：角標數字＋植物插畫 */
.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;
}
.fl-badge.arabic { color: #c43a2e; font-family: Georgia, "Times New Roman", serif; }
.fl-badge.cn { color: #28539c; 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;
}
.action-overlay:empty { display: none; }
.action-overlay .act-btn,
.action-overlay .act-cancel,
.action-overlay .btn,
.action-overlay .bid-ui { pointer-events: auto; }
.act-btn {
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.22);
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  background: radial-gradient(circle at 50% 30%, #6a6a6a, #2e2e2e);
  box-shadow: 0 8px 0 #1a1a1a, 0 12px 18px rgba(0,0,0,.35);
  letter-spacing: 0;
  padding: 0;
  min-height: 0;
}
.act-btn.off { opacity: 0.38; filter: grayscale(.4); pointer-events: none; box-shadow: 0 4px 0 #1a1a1a; }
.act-btn.peng.on, .act-btn.gang.on {
  background: radial-gradient(circle at 50% 30%, #ff9a4a, #d45200);
  box-shadow: 0 8px 0 #7a2800, 0 12px 18px rgba(0,0,0,.35);
}
.act-btn.chi.on {
  background: radial-gradient(circle at 50% 30%, #4cbf68, #176044);
  box-shadow: 0 8px 0 #0e3d2a, 0 12px 18px rgba(0,0,0,.35);
}
.act-btn.ting.on {
  background: radial-gradient(circle at 50% 30%, #6db6ff, #1a5fd0);
  box-shadow: 0 8px 0 #0d3a80, 0 12px 18px rgba(0,0,0,.35);
}
.act-btn.pending {
  animation: pulse 0.7s ease-in-out infinite;
}

/* HUD 代打開關 */
.hud-actions .btn.on {
  background: linear-gradient(180deg, #ead07a, #b8892a);
  color: #3a2408;
  border-color: #f3d98a;
}
.act-btn.hu.on {
  background: radial-gradient(circle at 50% 30%, #ffe08a, #c99200);
  color: #3a2408;
  box-shadow: 0 8px 0 #6a4a12, 0 12px 18px rgba(0,0,0,.35);
}
.act-cancel {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 8px;
  background: linear-gradient(180deg, #e85a4a, #a31f1f);
  border: 1px solid #f0b33a;
  color: #fff;
  font-size: 16px;
  letter-spacing: 0.12em;
  box-shadow: 0 4px 0 #5a0d0d;
}
.action-overlay .wait-msg {
  pointer-events: none;
  background: rgba(20,10,8,.55);
  padding: 8px 16px;
  border-radius: 999px;
  letter-spacing: .12em;
  font-size: 13px;
  color: #f3d98a;
}

.bottom-bar {
  position: relative; z-index: 8;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 6px 14px;
  background: #0c0806;
  font-size: 13px;
  color: #efe1b8;
  min-height: 34px;
}
.bottom-bar .bb-left { letter-spacing: 0.08em; }
.bottom-bar .bb-mid { display: flex; gap: 16px; opacity: 0.9; }
.bottom-bar .seat-wind {
  background: #1e7a46;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.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: rgba(28, 14, 10, 0.92);
  border: 1px solid rgba(224, 185, 74, 0.25);
  border-radius: 12px;
  padding: 8px;
  min-height: 0;
}
.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; }
.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;
  color: #fff;
  text-shadow: 0 4px 0 #8b1616, 0 10px 24px rgba(0,0,0,.45);
  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); }
}
/* 叫朋友動畫：朋友牌＋跑警報／不跑警報，牌桌中央停留約5秒 */
.call-stamp.show-card {
  animation: stampCard 6s ease-out forwards;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 20px; letter-spacing: 0.1em;
}
.call-stamp.show-card .pcard { --tw: 88px; }
.call-stamp .stamp-label {
  color: #fff; font-weight: 900;
  text-shadow: 0 3px 0 #8b1616, 0 8px 20px rgba(0,0,0,.5);
}
.call-stamp .stamp-tag { font-size: 32px; font-weight: 900; }
.call-stamp .stamp-tag.alert { color: #ff6a5a; text-shadow: 0 3px 0 #5a0d0d, 0 8px 22px rgba(0,0,0,.5); }
.call-stamp .stamp-tag.noalert { color: #ffd24a; text-shadow: 0 3px 0 #5a3a08, 0 8px 22px rgba(0,0,0,.5); }
@keyframes stampCard {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.35); }
  7% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.94); }
}

.overlay {
  position: absolute; inset: 0;
  background: rgba(8, 4, 3, 0.72);
  display: none;
  align-items: center; justify-content: center;
  z-index: 20;
  padding: 16px;
}
.overlay.show { display: flex; }
.modal {
  width: min(520px, 100%);
  background: linear-gradient(180deg, #3a1a14, #1a0c0a);
  border: 1px solid rgba(224, 185, 74, 0.5);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.modal h2 { font-family: var(--font-serif); color: var(--gold-soft); letter-spacing: 0.16em; margin: 0 0 10px; }
.hu-banner {
  text-align: center;
}
.hu-banner .hu-xl {
  font-family: var(--font-serif);
  font-size: 84px;
  font-weight: 900;
  color: #f3d98a;
  text-shadow: 0 4px 0 #8b1616, 0 12px 30px rgba(0,0,0,.5);
  line-height: 1;
  margin: 4px 0 8px;
}
.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.12); }
.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;
}
.congrats.big { font-size: 24px; text-shadow: 0 2px 0 #5a0d0d, 0 8px 20px rgba(0,0,0,.5); }
.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(224,185,74,.18), transparent);
  border-radius: 8px;
}
.final-row.champion b { color: #ffd24a; font-size: 20px; }
.end-xl { font-size: 64px; }
.chi-opts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0; }
.chi-opt {
  background: #24140f;
  border: 1px solid rgba(224, 185, 74, 0.35);
  border-radius: 10px;
  padding: 8px;
  display: flex; gap: 4px;
}

.toast {
  position: absolute;
  left: 50%; bottom: 168px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(20, 10, 8, 0.92);
  border: 1px solid rgba(224, 185, 74, 0.45);
  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;
}
.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.22;
  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); }
  .bid-ui { gap: 8px; padding: 8px 10px; }
  .bid-score { font-size: 18px; flex-basis: 34px; }
}
@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 .mj-tile { --tw: 72px; }
  .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; }
  .bid-ui { flex-direction: column; align-items: stretch; padding: 8px; }
  .bid-ui .act-btn { align-self: center; width: 54px; height: 54px; font-size: 16px; }
  .bid-round-tab { padding: 4px 8px; }
  .bid-round-tab .full { display: none; }
  .bid-round-tab .short { display: inline; }
  .bid-row { gap: 6px; }
  .bid-score { font-size: 16px; flex-basis: 28px; }
  .bid-mode { min-width: 30px; padding: 4px 7px; font-size: 13px; }
  .bid-suit { padding: 4px 6px; font-size: 12px; }
  .bid-suit .nm { display: none; }
  .hud-brand span { display: none; }
  .seat-grid { grid-template-columns: 1fr; }
  .self-melds { max-width: 34%; }
  .room-drawer { width: min(100% - 16px, 280px); }
}
