:root {
  --bg: #061b15;
  --bg-soft: #0d3b2c;
  --felt: #0b5a41;
  --felt-deep: #073728;
  --felt-light: #1d8a63;
  --panel: rgba(4, 22, 17, 0.78);
  --panel-2: rgba(10, 47, 35, 0.9);
  --gold: #e8c46b;
  --gold-soft: #f7e7b8;
  --text: #fbf8ef;
  --muted: #afcdbd;
  --danger: #ffb4a2;
  --blue: #9ad7ff;
  --table-design-w: 1400px;
  --table-design-h: 1400px;
  --table-scale: 1;
  --tile-w: 60px;
  --tile-h: 84px;
  --meld-tile-w: 46px;
  --meld-tile-h: 64px;
  --action-tile-w: 48px;
  --action-tile-h: 67px;
  --tile-small-w: 26px;
  --tile-small-h: 36px;
  --tile-tiny-w: 20px;
  --tile-tiny-h: 28px;
  --side-overlap: calc(var(--tile-small-h) * -0.36);
  --radius: 12px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -8%, rgba(34, 135, 94, 0.2), transparent 38%),
    radial-gradient(circle at 50% 110%, rgba(6, 22, 17, 0.8), transparent 50%),
    linear-gradient(160deg, #09261d, #04120e 72%);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 顶栏 ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(232, 196, 107, 0.18);
  background: rgba(3, 16, 12, 0.78);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  background: linear-gradient(145deg, #f4d989, #b98831);
  color: #09251d;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 5px 16px rgba(232, 196, 107, 0.22);
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--gold-soft);
  font-size: 12px;
  user-select: none;
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid rgba(232, 196, 107, 0.26);
  border-radius: 999px;
  background: rgba(232, 196, 107, 0.05);
}

.toggle input {
  accent-color: var(--gold);
}

.btn {
  border: 1px solid rgba(244, 241, 232, 0.16);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 13px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(232, 196, 107, 0.5);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #d6ae50, #b37e28);
  border-color: #f6e4ad;
  color: #10291f;
  font-weight: 800;
}

.btn-danger {
  background: linear-gradient(135deg, #c85b48, #9e3427);
  border-color: #ffc1b4;
  color: #fff;
  font-weight: 700;
}

.btn-ready {
  background: linear-gradient(135deg, #7fe7ff, #1d78d8);
  border-color: #d6f7ff;
  color: #06243a;
  font-weight: 900;
  box-shadow:
    0 0 0 1px rgba(127, 231, 255, 0.35),
    0 0 20px rgba(80, 200, 255, 0.38);
  animation: ready-pulse 1.6s ease-in-out infinite;
}

.btn-ready:hover:not(:disabled) {
  background: linear-gradient(135deg, #a9f0ff, #2d8bea);
  border-color: #ffffff;
}

@keyframes ready-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(127, 231, 255, 0.3),
      0 0 14px rgba(80, 200, 255, 0.28);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(127, 231, 255, 0.52),
      0 0 24px rgba(80, 200, 255, 0.5);
  }
}

.btn-ghost {
  background: transparent;
}

/* ---------- 主布局 ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 12px;
  padding: 12px;
  width: 100%;
  height: 100vh;
  max-width: none;
  margin: 0;
  align-items: stretch;
  overflow: hidden;
}

.table-area {
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ---------- 雀魂风牌桌 ---------- */

.table-shell {
  position: relative;
  width: 100%;
  height: auto;
  margin: 0 auto;
  overflow: hidden;
}

.table {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--table-design-w);
  height: var(--table-design-h);
  transform: translate(-50%, -50%) scale(var(--table-scale, 1));
  transform-origin: center center;
  isolation: isolate;
  display: grid;
  grid-template-columns:
    minmax(88px, 0.66fr)
    minmax(360px, 2.75fr)
    minmax(88px, 0.66fr);
  grid-template-rows:
    minmax(170px, 0.8fr)
    minmax(0, 4fr)
    0px
    minmax(150px, 1.1fr);
  grid-template-areas:
    "seat-top seat-top seat-top"
    "seat-left center-area seat-right"
    "action action action"
    "seat-bottom seat-bottom seat-bottom";
  gap: 10px;
  padding: 20px;
  border-radius: 34px;
  border: 1px solid rgba(232, 196, 107, 0.24);
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.1), transparent 28%),
    radial-gradient(circle at 50% 50%, rgba(34, 148, 104, 0.34), transparent 58%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.013) 0 2px, transparent 2px 8px),
    linear-gradient(145deg, #0c6246, #0a4c37 52%, #073728);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.045),
    inset 0 0 80px rgba(0, 0, 0, 0.34),
    0 24px 62px rgba(0, 0, 0, 0.42);
}

.table::before {
  content: "";
  position: absolute;
  inset: 7px;
  z-index: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.24),
    inset 0 0 0 3px rgba(0, 0, 0, 0.04);
  pointer-events: none;
}

.table::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 255, 255, 0.1), transparent 34%),
    radial-gradient(circle at 50% 118%, rgba(0, 0, 0, 0.42), transparent 48%);
  pointer-events: none;
}

.table > * {
  position: relative;
  z-index: 1;
}

/* ---------- 玩家座位 ---------- */

.seat {
  min-width: 0;
  min-height: 0;
}

.seat-top,
.seat-bottom {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.seat-top {
  grid-area: seat-top;
  /* 对家视角的左→右，在屏幕上是从右往左，所以用 row-reverse。 */
  flex-direction: row-reverse;
  padding: 2px 4px 0;
}

.seat-bottom {
  grid-area: seat-bottom;
  flex-direction: row;
  padding: 1px 4px 4px;
}

.seat-top > .seat-head,
.seat-bottom > .seat-head {
  grid-area: seat-head;
  justify-self: start;
}

.seat-top > .hand,
.seat-bottom > .hand {
  grid-area: hand;
  justify-self: center;
  flex: 0 0 auto;
  max-width: none;
}

.seat-top > .melds,
.seat-bottom > .melds {
  grid-area: melds;
  justify-self: center;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  max-width: none;
}

.seat-balance {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* DOM 顺序统一为：头部平衡位 → 手牌区 → 副露区 → 尾部平衡位。
   再由每个座位的本地坐标方向决定屏幕排列，保证从各家视角看都是
   头像/ID → 听牌 → 手牌 → 副露。 */

.seat-left,
.seat-right {
  grid-area: seat-left;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px;
  /* 左右家副露使用更紧凑的牌面，避免副露多时挤占竖排手牌。 */
  --meld-tile-w: 32px;
  --meld-tile-h: 46px;
}

.seat-right {
  grid-area: seat-right;
}

.seat-left > .seat-head,
.seat-right > .seat-head {
  grid-area: seat-head;
  width: 100%;
}

.seat-left > .hand,
.seat-right > .hand {
  grid-area: hand;
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
}

.seat-left > .melds,
.seat-right > .melds {
  grid-area: melds;
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  min-height: 0;
}

.seat-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  min-width: 0;
  padding: 5px 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(2, 15, 11, 0.87), rgba(2, 15, 11, 0.58));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.seat-name {
  font-weight: 800;
  font-size: clamp(11px, 1.05vw, 13px);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.seat-identity {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.seat-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.seat-score {
  color: var(--gold-soft);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.seat-badges {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.7;
  white-space: nowrap;
}

.badge-ready {
  background: rgba(232, 196, 107, 0.16);
  color: var(--gold-soft);
  border: 1px solid rgba(232, 196, 107, 0.42);
}

.badge-current {
  background: rgba(154, 215, 255, 0.16);
  color: var(--blue);
  border: 1px solid rgba(154, 215, 255, 0.42);
}

.badge-dealer {
  background: rgba(255, 180, 162, 0.16);
  color: var(--danger);
  border: 1px solid rgba(255, 180, 162, 0.4);
}

.seat.active-turn .seat-head {
  border-color: rgba(232, 196, 107, 0.88);
  background: linear-gradient(180deg, rgba(31, 72, 55, 0.94), rgba(10, 42, 31, 0.8));
  box-shadow:
    0 0 0 1px rgba(232, 196, 107, 0.22),
    0 0 24px rgba(232, 196, 107, 0.26),
    0 4px 14px rgba(0, 0, 0, 0.28);
}

.seat.is-dealer .seat-name {
  color: var(--gold-soft);
}

.seat.is-ready .seat-head {
  border-color: rgba(255, 216, 110, 0.92);
  background: linear-gradient(180deg, rgba(78, 58, 20, 0.92), rgba(43, 31, 12, 0.84));
  box-shadow:
    0 0 0 1px rgba(255, 216, 110, 0.26),
    0 0 26px rgba(255, 216, 110, 0.3),
    0 4px 14px rgba(0, 0, 0, 0.28);
}

.seat.is-ready .seat-head::after {
  content: "听";
  position: absolute;
  top: -10px;
  right: -8px;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe18a, #d39a29);
  color: #231a08;
  font-size: 12px;
  font-weight: 900;
  box-shadow:
    0 0 0 2px rgba(20, 12, 4, 0.55),
    0 4px 10px rgba(0, 0, 0, 0.36);
}

/* ---------- 手牌与副露 ---------- */

.hand,
.melds,
.discards {
  display: flex;
  align-items: flex-end;
  min-width: 0;
}

.hand {
  justify-content: center;
  gap: clamp(2px, 0.32vw, 4px);
}

.hand-ready {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2em;
  min-height: 1.2em;
  flex: 0 0 auto;
  color: transparent;
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
  user-select: none;
}

.hand-ready.active {
  color: #ffd76e;
  text-shadow: 0 0 14px rgba(255, 215, 110, 0.75);
}


.seat-bottom .hand {
  flex-wrap: nowrap;
  align-items: flex-end;
  min-height: calc(var(--tile-h) + 4px);
}

.seat-top .hand {
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.seat-left .hand,
.seat-right .hand {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-height: 100%;
}

.side-hand-slot {
  width: var(--tile-w);
  height: var(--tile-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.seat-left .side-hand-slot,
.seat-right .side-hand-slot {
  width: var(--tile-h);
  /* 左右家竖排手牌略微重叠，为头像/ID、听牌区、抓牌区留出稳定高度。 */
  height: calc(var(--tile-w) - 6px);
}

.seat-left .side-hand-slot:not(:first-child),
.seat-right .side-hand-slot:not(:first-child) {
  margin-top: 0;
}

.seat-left .side-hand-slot.drawn,
.seat-right .side-hand-slot.drawn {
  margin-top: 8px;
}

.seat-top .side-hand-slot.drawn {
  margin-left: 12px;
}

.seat-left .side-hand-slot .tile {
  transform: rotate(90deg);
}

.seat-right .side-hand-slot .tile {
  transform: rotate(-90deg);
}

/* 手牌区与副露区之间的抓牌区，平时保留空位。 */
.draw-area {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--tile-w);
  height: var(--tile-h);
}

.draw-area .draw-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.18);
}

.seat-left .draw-area,
.seat-right .draw-area {
  width: var(--tile-h);
  height: var(--tile-w);
}

.seat-left .draw-area .tile {
  transform: rotate(90deg);
}

.seat-right .draw-area .tile {
  transform: rotate(-90deg);
}

/* 抓牌区单独占位，不再使用手牌区的靠右间距。 */
.draw-area .tile.drawn,
.draw-area .tile.win-tile.drawn {
  margin-left: 0;
}

.melds {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
  min-height: 0;
}

.seat-left .melds,
.seat-right .melds {
  justify-content: center;
  max-width: 100%;
}

.meld {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.meld.concealed {
  background: rgba(0, 0, 0, 0.24);
  border-style: dashed;
}

.meld .tile {
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.meld-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--meld-tile-w);
  height: var(--meld-tile-h);
  flex: 0 0 auto;
}

.meld-tile.claimed {
  width: var(--meld-tile-h);
  height: var(--meld-tile-w);
}

.meld-tile.claimed .tile {
  transform: rotate(90deg);
}

/* 副露朝向各自玩家，并把“吃碰哪家”体现在对应牌横放上。 */
.seat-top .meld {
  transform: rotate(180deg);
}

.seat-left .meld {
  transform: rotate(90deg);
}

.seat-right .meld {
  transform: rotate(-90deg);
}

.seat-left .melds,
.seat-right .melds {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
}

.seat-left .meld,
.seat-right .meld {
  margin-block: 40px;
}

.seat-left .meld.meld-kong,
.seat-right .meld.meld-kong {
  margin-block: 52px;
}


.seat-right {
  flex-direction: column-reverse;
}

.zone-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.zone-empty {
  color: rgba(175, 205, 189, 0.5);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 4px 2px;
}

/* ---------- 牌面 ---------- */

.tile {
  width: var(--tile-w);
  height: var(--tile-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  border-radius: clamp(4px, 0.52vw, 8px);
  border: 1px solid rgba(55, 43, 26, 0.48);
  background: linear-gradient(180deg, #fffef8 0%, #f2ead6 72%, #d9cdb0 100%);
  box-shadow:
    0 2px 0 rgba(45, 33, 20, 0.42),
    0 6px 11px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset 0 -2px 0 rgba(92, 70, 40, 0.12);
  user-select: none;
  appearance: none;
  cursor: default;
  transition: transform 0.12s ease, outline-color 0.12s ease, box-shadow 0.12s ease;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.tile-small {
  width: var(--tile-small-w);
  height: var(--tile-small-h);
  border-radius: clamp(3px, 0.4vw, 5px);
  box-shadow:
    0 2px 0 rgba(45, 33, 20, 0.36),
    0 4px 7px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.tile-tiny {
  width: var(--tile-tiny-w);
  height: var(--tile-tiny-h);
  border-radius: clamp(2px, 0.3vw, 4px);
  box-shadow:
    0 1px 0 rgba(45, 33, 20, 0.34),
    0 3px 5px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.tile-meld {
  width: var(--meld-tile-w);
  height: var(--meld-tile-h);
  border-radius: clamp(3px, 0.4vw, 5px);
  box-shadow:
    0 2px 0 rgba(45, 33, 20, 0.36),
    0 4px 7px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.tile-back {
  background: linear-gradient(180deg, #2a7a55, #154c38 76%, #0e382a);
  border-color: rgba(2, 22, 15, 0.72);
}

.tile-back img {
  opacity: 0.98;
}

.tile.clickable {
  cursor: pointer;
  outline: 2px solid transparent;
}

.tile.clickable:hover {
  transform: translateY(-7px);
  outline-color: rgba(232, 196, 107, 0.82);
  box-shadow:
    0 2px 0 rgba(45, 33, 20, 0.42),
    0 11px 18px rgba(0, 0, 0, 0.24),
    0 0 0 3px rgba(232, 196, 107, 0.14);
}

.tile.forced {
  outline: 2px solid rgba(232, 196, 107, 0.96);
  box-shadow:
    0 0 0 3px rgba(232, 196, 107, 0.18),
    0 2px 0 rgba(45, 33, 20, 0.42),
    0 7px 12px rgba(0, 0, 0, 0.2);
}

.tile.drawn {
  margin-left: clamp(12px, 1.35vw, 22px);
  outline: 1px solid rgba(232, 196, 107, 0.34);
  box-shadow:
    0 0 0 3px rgba(232, 196, 107, 0.08),
    0 2px 0 rgba(45, 33, 20, 0.42),
    0 6px 11px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.tile.fx-discard-flying {
  visibility: hidden;
}

.tile.last-discard {
  z-index: 4;
  outline: 3px solid rgba(255, 224, 138, 0.98);
  box-shadow:
    0 0 0 4px rgba(255, 196, 80, 0.32),
    0 0 22px rgba(255, 182, 56, 0.68),
    0 2px 0 rgba(45, 33, 20, 0.36);
  filter: brightness(1.12) saturate(1.06);
  animation: last-discard-pulse 1.1s ease-in-out infinite;
}

@keyframes last-discard-pulse {
  0%,
  100% {
    filter: brightness(1.08) saturate(1.04);
  }
  50% {
    filter: brightness(1.4) saturate(1.22);
  }
}

/* 胡牌后亮出的那张胡牌，与普通手牌区分并留出间隔。 */
.tile.win-tile {
  z-index: 5;
  outline: 3px solid rgba(255, 226, 130, 0.98);
  box-shadow:
    0 0 0 4px rgba(255, 208, 86, 0.34),
    0 0 26px rgba(255, 190, 60, 0.8),
    0 2px 0 rgba(45, 33, 20, 0.36);
  filter: brightness(1.14) saturate(1.08);
}

.tile.win-tile.drawn {
  margin-left: clamp(18px, 2vw, 30px);
}

.side-hand-slot.win-tile-slot {
  margin-left: 18px;
}

.seat-left .side-hand-slot.win-tile-slot,
.seat-right .side-hand-slot.win-tile-slot {
  margin-top: 18px;
  margin-left: 0;
}

/* ---------- 中央牌河与信息盘 ---------- */

.center-area {
  grid-area: center-area;
  position: relative;
  min-width: 0;
  min-height: 0;
  display: block;
}

.discard-zone {
  position: absolute;
  z-index: 3;
  min-width: 0;
  min-height: 0;
  display: grid;
  align-items: normal;
  gap: 2px;
  align-content: center;
  justify-content: center;
  pointer-events: none;
}

.discard-zone .tile {
  pointer-events: auto;
}

.discard-top,
.discard-bottom {
  grid-template-columns: repeat(6, var(--tile-w));
  grid-auto-rows: var(--tile-h);
}

.discard-left,
.discard-right {
  grid-template-columns: repeat(3, var(--tile-h));
  grid-auto-rows: var(--tile-w);
}

.discard-left .tile,
.discard-right .tile {
  align-self: center;
  justify-self: center;
}

.discard-top {
  bottom: calc(50% + 190px);
  left: 50%;
  transform: translateX(-50%);
}

.discard-bottom {
  top: calc(50% + 190px);
  left: 50%;
  transform: translateX(-50%);
}

.discard-left {
  right: calc(50% + 190px);
  top: 50%;
  transform: translateY(-50%);
  justify-content: flex-end;
}

.discard-right {
  left: calc(50% + 190px);
  top: 50%;
  transform: translateY(-50%);
  justify-content: flex-start;
}

.discard-top .tile {
  transform: rotate(180deg);
}

.discard-left .tile {
  transform: rotate(90deg);
}

.discard-right .tile {
  transform: rotate(-90deg);
}

/* 报听打出的牌横置：在各自弃牌朝向基础上再转 90°。 */
.discard-bottom .tile.ready-mark {
  transform: rotate(90deg);
}

.discard-top .tile.ready-mark {
  transform: rotate(270deg);
}

.discard-left .tile.ready-mark {
  transform: rotate(180deg);
}

.discard-right .tile.ready-mark {
  transform: rotate(0deg);
}

/* 横置的报听牌占两格，保持居中；同排/同列的相邻牌各自向中间靠拢。 */
.discard-top .tile.ready-mark,
.discard-bottom .tile.ready-mark,
.discard-left .tile.ready-mark,
.discard-right .tile.ready-mark {
  justify-self: center;
  align-self: center;
}

.discard-bottom .tile.ready-before {
  position: relative;
  left: 19px;
}

.discard-bottom .tile.ready-after {
  position: relative;
  left: -19px;
}

.discard-top .tile.ready-before {
  position: relative;
  left: -19px;
}

.discard-top .tile.ready-after {
  position: relative;
  left: 19px;
}

.discard-left .tile.ready-before {
  position: relative;
  top: 19px;
}

.discard-left .tile.ready-after {
  position: relative;
  top: -19px;
}

.discard-right .tile.ready-before {
  position: relative;
  top: -19px;
}

.discard-right .tile.ready-after {
  position: relative;
  top: 19px;
}

.center-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  min-width: 0;
  width: 380px;
  height: 380px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px;
  text-align: center;
  border-radius: clamp(14px, 1.8vw, 24px);
  border: 1px solid rgba(232, 196, 107, 0.32);
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 196, 107, 0.13), transparent 58%),
    linear-gradient(165deg, rgba(7, 43, 32, 0.97), rgba(2, 18, 13, 0.96));
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.32),
    inset 0 0 30px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.center-panel::before,
.center-panel::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: rgba(232, 196, 107, 0.46);
  border-style: solid;
  pointer-events: none;
}

.center-panel::before {
  top: 6px;
  left: 6px;
  border-width: 1px 0 0 1px;
  border-top-left-radius: 9px;
}

.center-panel::after {
  right: 6px;
  bottom: 6px;
  border-width: 0 1px 1px 0;
  border-bottom-right-radius: 9px;
}

/* 中央方形计分板：四个分数牌面向各自玩家，中间放局况/宝牌。 */
.score-board {
  width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns:
    38px
    minmax(0, 1fr)
    38px;
  grid-template-rows:
    38px
    minmax(0, 1fr)
    38px;
  gap: 4px;
  padding: 7px;
  border-radius: 18px;
  border: 2px solid rgba(232, 196, 107, 0.34);
  background:
    radial-gradient(circle at 50% 40%, rgba(70, 115, 144, 0.26), transparent 62%),
    linear-gradient(160deg, rgba(29, 41, 49, 0.98), rgba(10, 18, 22, 0.98));
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.56),
    0 10px 28px rgba(0, 0, 0, 0.34);
}

.score-plate {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.score-plate-top {
  grid-area: 1 / 2 / 2 / 3;
}

.score-plate-right {
  grid-area: 2 / 3 / 3 / 4;
}

.score-plate-bottom {
  grid-area: 3 / 2 / 4 / 3;
}

.score-plate-left {
  grid-area: 2 / 1 / 3 / 2;
}

.score-plate.active {
  border-color: rgba(127, 231, 255, 0.96);
  background: rgba(19, 70, 96, 0.72);
  box-shadow:
    0 0 0 1px rgba(127, 231, 255, 0.38),
    0 0 20px rgba(80, 200, 255, 0.42);
}

.score-plate.dealer .score-plate-wind {
  color: #ffb4a2;
}

.score-plate-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
  transform-origin: center center;
  line-height: 1.05;
}

.score-plate-wind {
  color: var(--gold-soft);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.plate-dealer {
  display: inline-block;
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 180, 162, 0.2);
  color: #ffb4a2;
  font-size: 10px;
  vertical-align: middle;
}

.score-plate-score {
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.score-plate-ready {
  color: #9fe7ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.score-center {
  grid-area: 2 / 2 / 3 / 3;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
}

/* 中间信息盘压缩，给四个方位分数牌让位。 */
.score-center .turn-banner {
  font-size: clamp(10px, 1vw, 13px);
}

.score-center .turn-banner .turn-label {
  display: none;
}

.score-center .treasure-area {
  min-height: 0;
  padding: 3px 5px;
  gap: 6px;
  flex-direction: column;
  align-items: center;
  border-style: none;
  background: rgba(255, 255, 255, 0.035);
}

.treasure-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.treasure-line strong {
  font-size: 27px;
  white-space: nowrap;
}

.treasure-sub {
  font-size: 23px;
  line-height: 1.15;
  white-space: nowrap;
  text-align: center;
}

.score-center .treasure-sub .dice-face {
  font-size: 31px;
}

.score-center .treasure-info {
  font-size: 26px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.score-center .treasure-info strong {
  font-size: 27px;
  margin-bottom: 0;
  white-space: nowrap;
}

.score-center .treasure-hint {
  display: none;
}

.score-center .dice-face {
  font-size: 34px;
}

.score-center .table-meta {
  grid-template-columns: 1fr;
  gap: 4px;
}

.score-center .meta-cell {
  padding: 5px 2px;
}

.score-center .meta-cell b {
  font-size: 26px;
  white-space: nowrap;
}

.score-center .meta-cell small {
  font-size: 19px;
  white-space: nowrap;
}

.turn-banner {
  color: var(--gold-soft);
  font-size: clamp(13px, 1.35vw, 18px);
  font-weight: 900;
  line-height: 1.22;
  text-shadow: 0 3px 18px rgba(232, 196, 107, 0.18);
}

.turn-banner .turn-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.turn-banner strong {
  display: block;
  font-weight: 900;
}

.treasure-area {
  width: 100%;
  min-height: calc(var(--tile-small-h) + 14px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.048);
  border: 1px dashed rgba(232, 196, 107, 0.3);
}

.treasure-info {
  min-width: 0;
  color: var(--muted);
  font-size: clamp(10px, 0.9vw, 12px);
  line-height: 1.42;
  text-align: left;
}

.treasure-info strong {
  display: block;
  color: var(--gold-soft);
  font-size: clamp(11px, 1vw, 13px);
  margin-bottom: 2px;
}

.treasure-hint {
  display: block;
  font-size: 9px;
  color: rgba(175, 205, 189, 0.78);
}

.dice-face {
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

.table-meta {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.meta-cell {
  min-width: 0;
  padding: 4px 2px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.meta-cell b {
  display: block;
  color: var(--gold-soft);
  font-size: clamp(10px, 0.92vw, 12px);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-cell small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.05em;
}

/* ---------- 操作栏 ---------- */

.action-bar {
  position: absolute;
  left: 50%;
  bottom: 225px;
  z-index: 12;
  transform: translateX(-50%);
  width: auto;
  max-width: 880px;
  height: 72px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}

.action-bar.hidden {
  display: none;
}

/* “过”也需要明显的按钮底色，避免看起来像纯文字。 */
.action-btn-pass {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text);
}

.action-btn-pass:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(232, 196, 107, 0.55);
}

.action-hint {
  color: var(--muted);
  font-size: 13px;
}

.action-hint strong {
  color: var(--gold-soft);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 12px;
  min-height: 68px;
  border-radius: 12px;
}

.action-label {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.action-tiles {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transform: translateY(1px);
}

.action-tiles .tile,
.action-btn > .tile-face {
  width: var(--action-tile-w);
  height: var(--action-tile-h);
  box-shadow:
    0 1px 0 rgba(45, 33, 20, 0.34),
    0 2px 4px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.action-tiles .tile img,
.action-btn > .tile-face img {
  pointer-events: none;
}

.action-arrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* 左右两家的弃牌：用显式网格位置控制方向，旋转牌面本身。 */
.discard-left,
.discard-right {
  grid-template-columns: repeat(3, var(--tile-h));
  grid-template-rows: repeat(6, var(--tile-w));
}

.discard-left .tile,
.discard-right .tile {
  align-self: center;
  justify-self: center;
}

/* ---------- 侧边辅助面板 ---------- */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  align-self: stretch;
  position: static;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-top .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-top .brand h1 {
  margin: 0;
  font-size: 16px;
}

.sidebar-top .brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.sidebar-top .toggle,
.sidebar-top .btn {
  width: 100%;
  justify-content: center;
}

.audio-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.audio-toggle {
  width: 100%;
  padding: 6px 7px;
  font-size: 11px;
}

.audio-toggle.off {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.audio-toggle.unavailable {
  opacity: 0.55;
}

.panel {
  border-radius: 16px;
  border: 1px solid rgba(232, 196, 107, 0.16);
  background: rgba(4, 20, 15, 0.68);
  padding: 11px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
}

.panel-title {
  color: var(--gold-soft);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  margin-bottom: 9px;
}

.score-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 7px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.score-row.current {
  border-color: rgba(232, 196, 107, 0.55);
  background: rgba(232, 196, 107, 0.06);
}

.score-name {
  font-size: 12px;
  font-weight: 700;
}

.score-value {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--gold-soft);
}

.score-delta {
  font-size: 11px;
  color: var(--muted);
  min-width: 44px;
  text-align: right;
}

.log-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.log-list {
  height: clamp(190px, 30vh, 340px);
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
  gap: 5px;
  padding-right: 3px;
  scrollbar-width: thin;
}

.log-entry {
  font-size: 11px;
  line-height: 1.45;
  color: #d9eadf;
  padding: 5px 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid rgba(255, 255, 255, 0.12);
}

.log-entry.draw {
  border-left-color: rgba(154, 215, 255, 0.75);
}

.log-entry.claim,
.log-entry.kong {
  border-left-color: rgba(232, 196, 107, 0.8);
}

.log-entry.ready,
.log-entry.treasure {
  border-left-color: rgba(246, 228, 173, 0.95);
}

.log-entry.win {
  border-left-color: #9ee6a8;
  background: rgba(82, 190, 112, 0.12);
}

.log-entry.settle,
.log-entry.muted {
  color: var(--muted);
}

.log-entry.error {
  border-left-color: #ff8b73;
  color: #ffd8cf;
}

/* ---------- 结算弹层 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 12, 9, 0.76);
  backdrop-filter: blur(7px);
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow: auto;
  border-radius: 20px;
  border: 1px solid rgba(232, 196, 107, 0.42);
  background: linear-gradient(160deg, #123d30, #08231b);
  padding: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.overlay-card h2 {
  margin: 0 0 14px;
  color: var(--gold-soft);
}

.result-hand-block {
  margin-bottom: 14px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(232, 196, 107, 0.18);
}

.result-section-title {
  margin-bottom: 6px;
  color: var(--gold-soft);
  font-size: 13px;
  font-weight: 800;
}

.result-section-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.result-hand {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 4px;
}

.result-hand-group {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  padding-right: 7px;
  margin-right: 3px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.result-hand-group:last-child {
  padding-right: 0;
  margin-right: 0;
  border-right: none;
}

.result-tile {
  display: inline-flex;
  border-radius: 5px;
}

.result-tile.win-tile {
  transform: translateY(-3px);
  outline: 2px solid #ffd76e;
  box-shadow: 0 0 14px rgba(255, 215, 110, 0.66);
}

.result-melds {
  margin-top: 4px;
}

.result-meld {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-summary {
  font-size: 15px;
  margin-bottom: 12px;
  line-height: 1.6;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.result-table th,
.result-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.result-table td:last-child,
.result-table th:last-child {
  text-align: right;
}

.overlay-card .btn-primary {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(232px, 276px);
  }
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    height: 100vh;
    /* 竖屏/窄屏时允许在布局内部滚动，侧栏不会被 100vh 裁掉。 */
    overflow-y: auto;
  }

  .table-area {
    min-height: min(68vh, 560px);
    height: auto;
  }

  .sidebar {
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    align-items: start;
  }

  .log-list {
    height: clamp(180px, 26vh, 280px);
  }
}

/* 手机横屏：保留左右两栏，避免侧栏被挤到牌桌下面完全看不到。 */
@media (max-width: 1080px) and (orientation: landscape) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 230px);
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .table-area {
    min-height: 0;
    height: 100%;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    overflow-y: auto;
  }

  .log-list {
    height: clamp(110px, 24vh, 180px);
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .seat-top,
  .seat-bottom {
    gap: 8px;
  }

  .seat-head {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px 7px;
    border-radius: 13px;
  }

  .seat-meta {
    justify-content: center;
  }

  .treasure-info {
    font-size: 10px;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .layout {
    padding: 9px;
  }

  .brand p {
    display: none;
  }

  .table-area {
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .log-list {
    height: 220px;
  }
}

.tile-preload {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.tile-preload img {
  width: 1px;
  height: 1px;
  display: block;
}

/* ---------- 零素材动画层 ---------- */

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
  contain: layout paint;
}

.fx-tile {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 5px;
  border: 1px solid rgba(55, 43, 26, 0.52);
  background: linear-gradient(180deg, #fffef8 0%, #f2ead6 72%, #d9cdb0 100%);
  box-shadow:
    0 2px 0 rgba(45, 33, 20, 0.4),
    0 7px 13px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  will-change: transform, opacity;
}

.fx-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.fx-dice {
  position: absolute;
  color: #fff8e8;
  font-size: 40px;
  line-height: 1;
  text-shadow:
    0 0 12px rgba(255, 218, 120, 0.95),
    0 0 28px rgba(255, 174, 52, 0.6),
    0 4px 8px rgba(0, 0, 0, 0.7);
  will-change: transform;
}

.fx-stamp {
  position: absolute;
  z-index: 2;
  color: #ffe29a;
  font-size: 62px;
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-shadow:
    0 0 18px rgba(255, 218, 120, 0.95),
    0 0 44px rgba(255, 164, 40, 0.55),
    0 5px 0 rgba(96, 54, 0, 0.85);
  will-change: transform, opacity;
}

.fx-stamp-big {
  font-size: 84px;
}

.fx-action-stamp {
  position: absolute;
  z-index: 3;
  color: #ffe6a3;
  font-size: clamp(58px, 6vw, 88px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-shadow:
    0 0 18px rgba(255, 220, 130, 0.95),
    0 0 46px rgba(255, 166, 44, 0.6),
    0 5px 0 rgba(96, 54, 0, 0.85);
  will-change: transform, opacity;
}

.fx-action-stamp-ready {
  color: #a9f1ff;
  text-shadow:
    0 0 18px rgba(127, 231, 255, 0.95),
    0 0 46px rgba(29, 120, 216, 0.6),
    0 5px 0 rgba(4, 53, 86, 0.85);
}

.fx-action-stamp-win {
  color: #fff0b8;
  font-size: clamp(54px, 6vw, 88px);
  text-shadow:
    0 0 22px rgba(255, 230, 150, 1),
    0 0 58px rgba(255, 170, 48, 0.72),
    0 6px 0 rgba(105, 56, 0, 0.88);
}

.fx-burst {
  position: absolute;
  border-radius: 50%;
  border: 3px solid rgba(255, 217, 124, 0.92);
  box-shadow:
    0 0 34px rgba(255, 209, 96, 0.72),
    inset 0 0 24px rgba(255, 209, 96, 0.42);
  will-change: transform, opacity;
}

.fx-burst-ring {
  border-color: rgba(255, 255, 255, 0.86);
  box-shadow:
    0 0 30px rgba(255, 255, 255, 0.62),
    inset 0 0 20px rgba(255, 255, 255, 0.36);
}

.fx-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(255, 248, 222, 0.98),
    rgba(255, 205, 96, 0.36) 38%,
    transparent 72%
  );
  will-change: opacity;
}

#table-shell.fx-shake {
  animation: fx-table-shake 0.36s ease-in-out;
}

@keyframes fx-table-shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  18% {
    transform: translate(-5px, 2px) rotate(-0.18deg);
  }
  38% {
    transform: translate(4px, -3px) rotate(0.18deg);
  }
  58% {
    transform: translate(-3px, 2px) rotate(-0.1deg);
  }
  78% {
    transform: translate(2px, -1px) rotate(0.06deg);
  }
}

.meld.fx-pop {
  animation: fx-meld-glow 0.48s ease-out;
}

.meld.fx-kong {
  animation: fx-meld-glow 0.62s ease-out;
}

.meld.fx-pop .meld-tile,
.meld.fx-kong .meld-tile {
  animation: fx-tile-pop 0.46s cubic-bezier(0.2, 1.15, 0.35, 1) both;
}

.meld.fx-pop .meld-tile:nth-child(2),
.meld.fx-kong .meld-tile:nth-child(2) {
  animation-delay: 0.045s;
}

.meld.fx-pop .meld-tile:nth-child(3),
.meld.fx-kong .meld-tile:nth-child(3) {
  animation-delay: 0.09s;
}

.meld.fx-kong .meld-tile:nth-child(4) {
  animation-delay: 0.135s;
}

@keyframes fx-tile-pop {
  0% {
    opacity: 0.25;
    transform: scale(0.62) translateY(4px);
  }
  68% {
    opacity: 1;
    transform: scale(1.08) translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fx-meld-glow {
  0% {
    box-shadow: none;
  }
  36% {
    box-shadow: 0 0 24px rgba(255, 210, 102, 0.78);
  }
  100% {
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .fx-layer {
    display: none;
  }
}

/* ---------- 账号 / 大厅 / 房间 ---------- */

.app-gate {
  position: relative;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
  overflow: visible;
  background:
    radial-gradient(circle at 50% -8%, rgba(34, 135, 94, 0.2), transparent 38%),
    radial-gradient(circle at 50% 110%, rgba(6, 22, 17, 0.8), transparent 50%),
    linear-gradient(160deg, #09261d, #04120e 72%);
}

.app-gate.hidden {
  display: none;
}

/* 大厅/登录页打开时隐藏牌桌，避免两个页面叠在一起。 */
#app-gate:not(.hidden) ~ .layout {
  display: none;
}

body.gate-open {
  overflow: auto;
}

.gate-card {
  width: min(760px, 100%);
  max-height: none;
  margin: 12px auto 40px;
  overflow: visible;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid rgba(232, 196, 107, 0.42);
  background: linear-gradient(160deg, #123d30, #08231b);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

#lobby-panel.gate-card,
#room-panel.gate-card {
  width: min(920px, 100%);
}

@media (max-width: 820px) {
  .app-gate {
    padding: 10px;
  }

  .gate-card {
    margin-bottom: 24px;
    padding: 16px;
  }
}

.gate-card h2 {
  margin: 0 0 6px;
  color: var(--gold-soft);
}

.gate-sub {
  color: var(--muted);
  font-size: 12px;
}

.auth-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.auth-actions .auth-action {
  width: 100%;
  padding: 6px 8px;
  border-radius: 9px;
  font-size: 13px;
  white-space: nowrap;
}

.form-submit-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.gate-form.compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.gate-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--gold-soft);
  font-size: 12px;
}

.gate-form input,
.gate-form select,
.chat-form input {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
}

.gate-error {
  min-height: 1em;
  color: #ffb4a2;
  font-size: 12px;
}

.lobby-header {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.lobby-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lobby-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(232, 196, 107, 0.5);
  background: rgba(255, 255, 255, 0.1);
}

.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-soft);
  font-weight: 900;
}

.lobby-actions {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.room-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.room-player {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin-bottom: 5px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.seat-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(232, 196, 107, 0.2);
  color: var(--gold-soft);
  font-size: 11px;
}

.chat-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 220px;
  overflow: auto;
  padding: 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.chat-message {
  color: var(--text);
  font-size: 12px;
  word-break: break-word;
}

.chat-message strong {
  margin-right: 5px;
  color: var(--gold-soft);
}

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-form input {
  flex: 1;
}

@media (max-width: 640px) {
  .gate-form.compact,
  .room-body {
    grid-template-columns: 1fr;
  }
}

.hidden {
  display: none !important;
}

.turn-timer {
  min-height: 1.2em;
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.game-chat-list {
  height: 180px;
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

/* ---------- 头像裁剪 ---------- */

.avatar-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-editor {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 12, 9, 0.82);
  backdrop-filter: blur(8px);
}

.avatar-editor-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, 100%);
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(232, 196, 107, 0.42);
  background: linear-gradient(160deg, #123d30, #08231b);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.avatar-editor-card h3 {
  margin: 0;
  color: var(--gold-soft);
}

.avatar-crop-view {
  align-self: center;
  width: 260px;
  height: 260px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #020806;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.6);
}

.avatar-crop-view canvas {
  display: block;
  width: 260px;
  height: 260px;
  cursor: grab;
  touch-action: none;
}

.avatar-crop-view canvas:active {
  cursor: grabbing;
}

.avatar-zoom {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--gold-soft);
  font-size: 12px;
}

.avatar-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toggle-inline {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
  color: var(--muted) !important;
}

.admin-panel {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-audio-title {
  margin-top: 12px;
}

.admin-audio-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  margin-bottom: 8px;
  overflow: auto;
}

.admin-audio-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-audio-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.admin-audio-name {
  max-width: 160px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-audio-row input[type="file"] {
  max-width: 100%;
  font-size: 10px;
}

.admin-audio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.admin-audio-actions .btn {
  padding: 3px 8px;
  font-size: 11px;
}

.admin-audio-row audio {
  width: 100%;
  height: 30px;
}

.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-user-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.admin-user-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-user-actions .btn {
  padding: 3px 8px;
  font-size: 11px;
}

.register-disabled {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 180, 162, 0.35);
  background: rgba(255, 180, 162, 0.08);
  color: var(--text);
  text-align: center;
}

.register-disabled strong {
  display: block;
  margin-bottom: 6px;
  color: var(--danger);
  font-size: 16px;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.captcha-image {
  width: 132px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #08231b;
}

.captcha-row input {
  width: 88px;
  flex: 0 0 auto;
}

/* ---------- 页面模式：登录 / 大厅 / 房间 ---------- */

.app-gate {
  position: relative;
  display: block;
  min-height: 100vh;
  padding: 0;
  overflow: auto;
  background: transparent;
  --gate-bg-image: url("assets/ui/dorm_entrance.svg");
}

.gate-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(
      90deg,
      rgba(7, 10, 9, 0.96) 0%,
      rgba(9, 22, 17, 0.84) 38%,
      rgba(9, 28, 22, 0.48) 68%,
      rgba(6, 20, 15, 0.28) 100%
    ),
    var(--gate-bg-image, none);
  background-size: cover, cover;
  background-position: center, center 32%;
  background-repeat: no-repeat, no-repeat;
  opacity: 1;
}

@media (max-width: 760px) {
  .gate-bg {
    background-image:
      linear-gradient(
        180deg,
        rgba(6, 14, 11, 0.9) 0%,
        rgba(6, 22, 17, 0.96) 72%
      ),
      var(--gate-bg-image, none);
    background-position: center, center 32%;
  }
}

/* 大厅 / 房间使用寝室插画作为背景，并通过暗绿 + 金色光晕和 UI 统一色调。 */
body[data-gate-screen="lobby-panel"] .app-gate,
body[data-gate-screen="room-panel"] .app-gate {
  --gate-bg-image: url("assets/ui/dorm_room.svg");
}

body[data-gate-screen="lobby-panel"] .gate-bg,
body[data-gate-screen="room-panel"] .gate-bg {
  background-image:
    radial-gradient(circle at 18% 44%, rgba(3, 18, 13, 0.74), transparent 48%),
    radial-gradient(circle at 82% 20%, rgba(232, 196, 107, 0.1), transparent 34%),
    linear-gradient(
      180deg,
      rgba(4, 20, 15, 0.56) 0%,
      rgba(4, 20, 15, 0.16) 42%,
      rgba(4, 24, 18, 0.72) 100%
    ),
    var(--gate-bg-image, none);
  background-size: cover;
  background-position: center, center, center, center 42%;
  background-color: #071c14;
  filter: saturate(0.76) brightness(0.68) contrast(1.05) sepia(0.08)
    hue-rotate(-6deg);
}

body[data-gate-screen="lobby-panel"] .lobby-header,
body[data-gate-screen="room-panel"] .lobby-header {
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid rgba(232, 196, 107, 0.24);
  background: rgba(4, 22, 17, 0.74);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

body[data-gate-screen="lobby-panel"] .lobby-sidebar {
  background: rgba(4, 22, 17, 0.78);
}

body[data-gate-screen="lobby-panel"] .lobby-section-title,
body[data-gate-screen="room-panel"] .lobby-section-title {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.68);
}

@media (max-width: 760px) {
  body[data-gate-screen="lobby-panel"] .gate-bg,
  body[data-gate-screen="room-panel"] .gate-bg {
    background-image:
      linear-gradient(
        180deg,
        rgba(4, 18, 14, 0.78) 0%,
        rgba(4, 20, 15, 0.34) 44%,
        rgba(4, 24, 18, 0.86) 100%
      ),
      var(--gate-bg-image, none);
    background-position: center, center 36%;
  }
}

#auth-panel.auth-page,
#lobby-panel.lobby-page,
#room-panel.room-page {
  width: min(1280px, 100%);
  max-height: none;
  margin: 0 auto;
  padding: 36px 22px 60px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#auth-panel.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  gap: 48px;
  align-items: center;
}

.auth-brand {
  min-width: 0;
}

.auth-logo {
  display: block;
  width: 92px;
  height: auto;
  margin-bottom: 18px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-logo img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.34));
}

.auth-brand h2 {
  margin: 0 0 8px;
  color: var(--gold-soft);
  font-size: 32px;
  letter-spacing: 0.05em;
}

.auth-feature-list {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.auth-feature-list li::before {
  content: "◆";
  margin-right: 8px;
  color: var(--gold);
}

.auth-panel-card {
  padding: 26px;
  border-radius: 24px;
  border: 1px solid rgba(232, 196, 107, 0.38);
  background: linear-gradient(
    160deg,
    rgba(28, 22, 18, 0.9),
    rgba(8, 27, 21, 0.92)
  );
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(10px);
}

#lobby-panel.lobby-page {
  padding-top: 24px;
}

.lobby-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 18px;
}

.lobby-sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(232, 196, 107, 0.22);
  background: rgba(4, 22, 17, 0.72);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}

.lobby-section-title {
  color: var(--gold-soft);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.lobby-rooms {
  min-width: 0;
}

.lobby-rooms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.room-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  margin-top: 0;
}

.room-table-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 30px;
  border: 2px solid rgba(232, 196, 107, 0.35);
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.09), transparent 42%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.014) 0 2px, transparent 2px 9px),
    linear-gradient(145deg, #0c6246, #0a4c37 52%, #073728);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.04),
    inset 0 0 40px rgba(0, 0, 0, 0.34),
    0 16px 34px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.room-table-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 216, 110, 0.85);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.05),
    0 0 0 3px rgba(232, 196, 107, 0.14),
    0 22px 44px rgba(0, 0, 0, 0.4);
}

.room-table-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.room-table-center strong {
  display: block;
  color: var(--gold-soft);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-table-center .gate-sub {
  margin-top: 4px;
}

.room-chair {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 66px;
  pointer-events: none;
}

.room-chair-top {
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
}

.room-chair-bottom {
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
}

.room-chair-left {
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
}

.room-chair-right {
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
}

.room-chair .avatar,
.room-chair-empty {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(232, 196, 107, 0.5);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.room-chair-empty {
  display: grid;
  place-items: center;
  color: rgba(175, 205, 189, 0.55);
  font-size: 11px;
}

.room-chair-name {
  max-width: 66px;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-chair.ready .avatar {
  border-color: #ffd76e;
  box-shadow:
    0 0 0 2px rgba(255, 215, 110, 0.28),
    0 0 14px rgba(255, 215, 110, 0.6);
}

.room-table-status {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(232, 196, 107, 0.14);
  color: var(--gold-soft);
  font-size: 10px;
}

.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  margin-top: 16px;
}

@media (max-width: 980px) {
  #auth-panel.auth-page {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-top: 28px;
  }

  .lobby-layout,
  .room-layout {
    grid-template-columns: 1fr;
  }

  .lobby-sidebar {
    position: static;
  }
}

.treasure-hidden {
  visibility: hidden;
}

.tile.tile-treasure {
  width: calc(var(--tile-small-w) * 2);
  height: calc(var(--tile-small-h) * 2);
}

/* ---------- 手牌旁的玩家头像 / ID ---------- */

.hand-player {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 14px;
  background: rgba(2, 15, 11, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.hand-player-name {
  max-width: 108px;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hand-player.is-ai {
  color: var(--muted);
}

.avatar-xs {
  width: 36px;
  height: 36px;
  font-size: 16px;
}

/* 左右家的“听”跟上下家保持同一种字形，放在头像/ID 与竖排手牌之间。 */
.seat-left .hand-ready,
.seat-right .hand-ready {
  position: static;
  z-index: 3;
  min-width: 36px;
  min-height: 36px;
  font-size: 36px;
  line-height: 1;
  pointer-events: none;
}


/* 左右家的头像/ID 区也统一为头像在上、ID 在下。 */
.seat-left .hand-player,
.seat-right .hand-player {
  max-width: 100%;
  padding: 2px 6px;
}

.seat-left .hand-player-name,
.seat-right .hand-player-name {
  max-width: 68px;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 移动端浏览器地址栏会改变可视高度，优先使用 dvh。 */
@supports (height: 100dvh) {
  .layout {
    height: 100dvh;
  }

  .app-gate {
    min-height: 100dvh;
  }

  .sidebar {
    max-height: 100dvh;
  }
}
