/* ============ 潇洒斗地主 · 样式 ============ */
:root {
  --felt-deep: #062e18;
  --felt-mid: #0b4a26;
  --felt-light: #136a35;
  --gold: #f0c76a;
  --gold-deep: #b8862c;
  --gold-line: #7d5a1c;
  --red: #d7382f;
  --red-deep: #9c1f18;
  --cream: #f7f3e8;
  --ink: #241a12;
  --card-w: 58px;
  --shadow-card: 0 2px 5px rgba(0, 0, 0, .35), 0 8px 18px rgba(0, 0, 0, .18);
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-card: "Helvetica Neue", Arial, "PingFang SC", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 关键：.bid-bar/.play-bar/.timer 的 display:flex|grid 会覆盖浏览器默认的 [hidden]{display:none}，
   导致叫分条与出牌条同时出现、计时器在非自己回合也显示。这里做强兜底。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #04200f;
  font-family: var(--font-ui);
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============ 顶栏 ============ */
.topbar {
  position: relative;
  z-index: 30;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #0d2c1b, #07200f);
  border-bottom: 1px solid rgba(240, 199, 106, .22);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(160deg, #fff6dc, #e2c078);
  box-shadow: inset 0 1px 0 #fff, 0 2px 6px rgba(0, 0, 0, .35);
  flex: 0 0 auto;
}

.brand-text {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .5px;
  background: linear-gradient(180deg, #fff3cc, #e7b955 60%, #c08c2a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
  white-space: nowrap;
}

.top-actions { display: flex; align-items: center; gap: 7px; }

.beans {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #ffe9a8;
  background: rgba(0, 0, 0, .38);
  border: 1px solid rgba(240, 199, 106, .35);
  font-variant-numeric: tabular-nums;
}
.beans svg { color: var(--gold); }

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid rgba(240, 199, 106, .26);
  background: rgba(255, 255, 255, .07);
  color: #ffeec2;
  cursor: pointer;
  transition: background .15s, transform .12s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .15); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.off { color: #8d8d8d; }

/* ============ 牌桌 ============ */
.table {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  background:
    radial-gradient(ellipse 78% 62% at 50% 44%, var(--felt-light) 0%, var(--felt-mid) 46%, var(--felt-deep) 100%);
}

/* 桌面细纹 */
.table::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .022) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, .03) 0 2px, transparent 2px 5px);
  opacity: .85;
}

/* 金色椭圆内圈 */
.table::after {
  content: "";
  position: absolute;
  left: 50%; top: 46%;
  width: min(88%, 760px);
  height: min(64%, 520px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(240, 199, 106, .16);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, .25),
    0 0 0 14px rgba(240, 199, 106, .035);
  pointer-events: none;
}

.felt-glow {
  position: absolute;
  left: 50%; top: 44%;
  width: 46%; height: 34%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 220, .1), transparent 70%);
  pointer-events: none;
}

/* ============ 底牌 ============ */
.bottom-zone {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 6;
}

.zone-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(255, 244, 214, .62);
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.bottom-cards { display: flex; gap: 4px; }

/* ============ 座位 ============ */
.seat {
  position: absolute;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 96px;
}
.seat-left { left: 8px; top: 74px; }
.seat-right { right: 8px; top: 74px; }

.avatar {
  position: relative;
  width: 54px; height: 54px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(160deg, rgba(240, 199, 106, .9), rgba(120, 88, 30, .7));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .45);
  transition: transform .2s;
}
.avatar svg { display: block; border-radius: 50%; width: 100%; height: 100%; }
.avatar.is-landlord { background: linear-gradient(160deg, #ffe08a, #e03a2c); }
.avatar.is-farmer { background: linear-gradient(160deg, rgba(200, 220, 255, .8), rgba(70, 100, 140, .6)); }

.seat.active .avatar,
.my-seat.active .avatar {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 0 0 3px rgba(255, 225, 140, .55), 0 0 20px rgba(255, 214, 120, .65);
}

.role-badge {
  position: absolute;
  left: 50%; bottom: -7px;
  transform: translateX(-50%);
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  white-space: nowrap;
  border-radius: 8px;
  color: #fff;
  background: #2f6fa8;
  border: 1px solid rgba(255, 255, 255, .4);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .35);
}
.role-badge[data-role="landlord"] { background: linear-gradient(180deg, #f0574a, #b3201a); }

.seat-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-top: 6px;
}

.seat-name {
  font-size: 12px;
  font-weight: 600;
  color: #f2e7cd;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
  white-space: nowrap;
}

.seat-cards {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  color: #ffe6a6;
  font-variant-numeric: tabular-nums;
}
.seat-cards b { font-weight: 700; }

.mini-back {
  display: inline-block;
  width: 9px; height: 13px;
  border-radius: 2px;
  background: linear-gradient(140deg, #2f6fb0, #1b4775);
  border: 1px solid rgba(255, 255, 255, .45);
}

.bubble {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translate(-50%, 4px) scale(.9);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: #33230f;
  background: linear-gradient(180deg, #fffdf3, #f2e2bb);
  border-radius: 10px;
  border: 1px solid rgba(180, 140, 70, .5);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s, transform .16s;
  z-index: 3;
}
.bubble::after {
  content: "";
  position: absolute;
  top: -5px; left: 50%;
  width: 9px; height: 9px;
  transform: translateX(-50%) rotate(45deg);
  background: #fdf8e9;
  border-left: 1px solid rgba(180, 140, 70, .5);
  border-top: 1px solid rgba(180, 140, 70, .5);
}
.bubble.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ============ 出牌区 ============ */
.played {
  position: absolute;
  z-index: 7;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  max-width: 46vw;
  min-height: 44px;
  opacity: 0;
  transition: opacity .2s;
}
.played.show { opacity: 1; }

.played-left { left: 108px; top: 150px; }
.played-right { right: 108px; top: 150px; justify-content: flex-end; }
.played-self {
  left: 50%;
  bottom: 212px;
  transform: translateX(-50%);
  justify-content: center;
  max-width: 92vw;
}

.pass-mark {
  padding: 5px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #ffe0a0;
  background: rgba(0, 0, 0, .38);
  border: 1px solid rgba(240, 199, 106, .35);
  border-radius: 999px;
  letter-spacing: 1px;
}

.reveal-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  max-width: 46vw;
}

/* ============ 出牌提示 ============ */
.turn-hint {
  position: absolute;
  left: 50%;
  top: 58px;
  transform: translateX(-50%);
  font-size: 12.5px;
  color: rgba(255, 244, 214, .78);
  letter-spacing: .5px;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
  z-index: 9;
}

/* ============ 计时器 ============ */
.timer {
  position: absolute;
  right: 22px;
  bottom: 176px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
  color: #ffe9a8;
  background: rgba(0, 0, 0, .45);
  border: 2px solid rgba(240, 199, 106, .5);
  z-index: 12;
  font-variant-numeric: tabular-nums;
}
.timer.warn { color: #ffb0a4; border-color: rgba(224, 70, 60, .8); animation: pulse .8s infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }

/* ============ 按钮 ============ */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 9px 20px;
  border-radius: 10px;
  color: #4a3308;
  background: linear-gradient(180deg, #ffe9a8, #eabf5e 55%, #d2a03c);
  box-shadow: 0 2px 0 #9c7326, 0 5px 12px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .7);
  transition: transform .1s, box-shadow .1s, filter .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 #9c7326, 0 2px 6px rgba(0, 0, 0, .35); }

.btn-gold { color: #4a3308; background: linear-gradient(180deg, #ffeaa9, #ecc25f 55%, #d3a13d); }
.btn-red {
  color: #fff;
  background: linear-gradient(180deg, #f2634f, #cf3227 55%, #a8201a);
  box-shadow: 0 2px 0 #7d1310, 0 5px 12px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.btn-ghost {
  color: #ffeec9;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(240, 199, 106, .4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .18); }
.btn-ghost.disabled, .btn-ghost:disabled { opacity: .4; cursor: not-allowed; }
.btn-lg { font-size: 17px; padding: 13px 54px; border-radius: 12px; }
.btn-mini { font-size: 12px; padding: 7px 12px; border-radius: 8px; }
.btn-mini.active { color: #4a3308; background: linear-gradient(180deg, #ffe9a8, #d9ab48); }

/* ============ 叫分条 ============ */
.bid-bar {
  position: absolute;
  left: 50%;
  bottom: 138px;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(4, 26, 14, .78);
  border: 1px solid rgba(240, 199, 106, .3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  backdrop-filter: blur(6px);
}
.bid-title { font-size: 12.5px; color: #ffe9b4; letter-spacing: .5px; }
.bid-actions { display: flex; gap: 8px; }
.bid-actions .btn { padding: 8px 15px; font-size: 13.5px; }

/* ============ 出牌条 ============ */
.play-bar {
  position: absolute;
  left: 50%;
  bottom: 138px;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 9px;
}

/* ============ 我的座位 / 手牌 ============ */
.my-seat {
  position: absolute;
  left: 8px;
  bottom: 228px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 78px;
}
.my-seat .avatar { width: 42px; height: 42px; }
.my-seat .seat-info { flex-direction: column; align-items: center; margin-top: 4px; gap: 1px; }

.hand-area {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  height: 148px;
  z-index: 10;
}

.hand {
  position: relative;
  width: 100%;
  height: 100%;
}

/* 手牌底部锚定，向上扇形展开 */
.hand .card {
  top: auto;
  bottom: 12px;
}

/* ============ 纸牌 ============ */
.card {
  position: absolute;
  width: var(--card-w);
  height: calc(var(--card-w) * 1.4);
  border-radius: 7px;
  background: linear-gradient(168deg, #fffdf8 0%, #f8f4e9 62%, #ece4d2 100%);
  border: 1px solid #cdbf9f;
  box-shadow: var(--shadow-card);
  font-family: var(--font-card);
  color: #1c1c1c;
  transform-origin: 50% 100%;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s;
  cursor: pointer;
  overflow: hidden;
}

.card.is-red { color: #cc2b22; }
.card.is-black { color: #1c1c1c; }

.card .c-corner {
  position: absolute;
  top: 3px; left: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.card .c-corner b { font-size: 15px; font-weight: 800; letter-spacing: -.5px; }
.card .c-corner i { font-size: 11px; font-style: normal; margin-top: 1px; }

.card .c-big {
  position: absolute;
  right: 3px; bottom: 1px;
  font-size: 27px;
  line-height: 1;
  opacity: .9;
}

.card.is-joker .jk-name {
  position: absolute;
  top: 4px; left: 4px;
  font-size: 12px;
  font-weight: 800;
  writing-mode: vertical-rl;
  letter-spacing: 1px;
}
.card.is-joker .jk-mark {
  position: absolute;
  right: 3px; bottom: 2px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .5px;
  writing-mode: vertical-rl;
  opacity: .55;
}
.card.is-joker[data-rank="17"] { background: linear-gradient(168deg, #fff8ee, #ffe6dd 65%, #f8cfc0); }

.card.card-back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .14) 0 3px, transparent 3px 6px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .1) 0 3px, transparent 3px 6px),
    linear-gradient(160deg, #2f6fb0, #17406b);
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14), var(--shadow-card);
}
.card.card-back .back-pattern {
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .28);
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .2), transparent 62%);
}

.card.mini {
  position: relative;
  width: 30px;
  height: 42px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
.card.mini .c-corner { top: 1px; left: 2px; }
.card.mini .c-corner b { font-size: 10px; }
.card.mini .c-corner i { font-size: 7px; }
.card.mini .c-big { font-size: 14px; right: 1px; bottom: 0; }
.card.mini.is-joker .jk-name { font-size: 7px; letter-spacing: 0; }
.card.mini.is-joker .jk-mark { display: none; }

.card.played-card {
  position: relative;
  width: 42px;
  height: 59px;
  border-radius: 5px;
  cursor: default;
  transition: none;
}
.card.played-card .c-corner b { font-size: 12px; }
.card.played-card .c-corner i { font-size: 9px; }
.card.played-card .c-big { font-size: 19px; }
.card.played-card.is-joker .jk-name { font-size: 9px; letter-spacing: .5px; }
.card.played-card.is-joker .jk-mark { display: none; }

/* 手牌交互 */
.card.selected {
  transform-origin: 50% 100%;
  filter: drop-shadow(0 0 6px rgba(255, 224, 130, .9));
}
.card.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 7px;
  border: 2px solid #ffd766;
  box-shadow: inset 0 0 12px rgba(255, 210, 90, .45);
  pointer-events: none;
}

/* ============ 炸弹特效 ============ */
.bomb-fx {
  position: absolute;
  left: 50%; top: 44%;
  transform: translate(-50%, -50%) scale(.4);
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 8px;
  color: #fff6d0;
  text-shadow: 0 0 18px #ff9a3c, 0 0 42px #e8481f, 0 4px 0 #8c2a10;
  z-index: 25;
  pointer-events: none;
  animation: bombPop 1.05s ease-out forwards;
}
@keyframes bombPop {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  22% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
  42% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* ============ 遮罩层 ============ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 14, 8, .78);
  backdrop-filter: blur(7px);
  animation: fadeIn .22s ease;
}
.overlay[hidden] { display: none; }
.overlay.hide { display: none; }
@keyframes fadeIn { from { opacity: 0; } }

/* 开始面板 */
.overlay-start {
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, color-mix(in srgb, var(--felt-light) 92%, transparent), color-mix(in srgb, var(--felt-deep) 97%, transparent)),
    var(--felt-deep);
}

.start-panel {
  width: min(92vw, 420px);
  text-align: center;
  padding: 30px 24px 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(0, 0, 0, .18));
  border: 1px solid rgba(240, 199, 106, .28);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
}

.start-logo { margin-bottom: 26px; }

.logo-seal {
  display: inline-grid;
  place-items: center;
  width: 62px; height: 62px;
  margin-bottom: 12px;
  font-size: 34px;
  font-weight: 900;
  color: #fff3cc;
  border-radius: 14px;
  background: linear-gradient(160deg, #e0483a, #a51f18);
  border: 2px solid rgba(255, 228, 160, .75);
  box-shadow: 0 8px 22px rgba(160, 30, 20, .55), inset 0 2px 0 rgba(255, 255, 255, .28);
  text-shadow: 0 2px 3px rgba(0, 0, 0, .35);
}

.start-panel h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 3px;
  background: linear-gradient(180deg, #fff6d4, #f0c76a 55%, #c8952f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.start-sub {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: rgba(255, 244, 214, .68);
  letter-spacing: .8px;
}

.start-tips {
  list-style: none;
  margin: 22px 0 0;
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  line-height: 1.95;
  color: rgba(255, 246, 222, .76);
  background: rgba(0, 0, 0, .24);
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .07);
}
.start-tips b { color: #ffd980; }

.start-foot {
  margin: 16px 0 0;
  font-size: 11px;
  color: rgba(255, 255, 255, .38);
}

/* 结算 */
.result-panel {
  width: min(92vw, 360px);
  padding: 24px 22px 20px;
  text-align: center;
  border-radius: 18px;
  background: linear-gradient(180deg, #10402a, #062414 70%);
  border: 1px solid rgba(240, 199, 106, .38);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .1);
  animation: popIn .26s cubic-bezier(.3, 1.4, .6, 1);
}
@keyframes popIn { from { transform: scale(.85); opacity: 0; } }

.result-tag {
  display: inline-block;
  padding: 2px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.result-tag.win { color: #4a3308; background: linear-gradient(180deg, #ffe9a8, #d9ab48); }
.result-tag.lose { color: #ffe0d8; background: rgba(180, 50, 40, .75); }

.result-panel h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 2px;
  color: #fff6dc;
}

.result-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 16px;
}
.score-num { font-size: 40px; font-weight: 900; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.score-num.plus { color: #7ee89a; text-shadow: 0 0 20px rgba(110, 230, 140, .4); }
.score-num.minus { color: #ff8a7a; text-shadow: 0 0 20px rgba(255, 110, 90, .35); }
.score-unit { font-size: 12px; color: rgba(255, 244, 214, .6); }

.result-detail {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0 0 18px;
  padding: 12px 14px;
  font-size: 12.5px;
  text-align: left;
  background: rgba(0, 0, 0, .3);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .06);
}
.result-detail dt { color: rgba(255, 244, 214, .52); }
.result-detail dd { margin: 0; color: #ffe9b4; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.result-actions { display: flex; gap: 10px; justify-content: center; }

/* 规则 */
.help-panel {
  width: min(92vw, 440px);
  max-height: 82vh;
  overflow: auto;
  padding: 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, #10402a, #062414);
  border: 1px solid rgba(240, 199, 106, .32);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}
.help-panel h2 { margin: 0 0 14px; font-size: 18px; color: #ffe9b4; letter-spacing: 1px; }
.help-body { font-size: 13px; line-height: 1.9; color: rgba(255, 246, 222, .82); }
.help-body p { margin: 0 0 10px; }
.help-body b { color: #ffd980; }
.help-panel .btn { width: 100%; margin-top: 8px; }

/* 记牌器 */
.overlay-sheet { align-items: flex-end; padding: 0; }
.board-panel {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, #0d3520, #062414);
  border-top: 1px solid rgba(240, 199, 106, .35);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .55);
  animation: slideUp .24s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } }
.board-panel h2 { margin: 0 0 12px; font-size: 14px; color: #ffe9b4; letter-spacing: .5px; }

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}
.board-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px 5px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .1);
}
.bc-rank { font-size: 13px; font-weight: 700; color: #f2e7cd; }
.bc-left { font-size: 12px; font-weight: 800; color: #ffe6a6; font-variant-numeric: tabular-nums; }
.board-cell.gone { opacity: .32; }
.board-cell.mine { border-color: rgba(255, 215, 102, .6); background: rgba(255, 215, 102, .12); }
.bc-mine {
  position: absolute;
  top: -6px; right: -4px;
  font-size: 8.5px;
  padding: 0 4px;
  border-radius: 6px;
  color: #4a3308;
  background: #ffd766;
  font-weight: 700;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.94);
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff8e2;
  background: rgba(6, 26, 14, .92);
  border: 1px solid rgba(240, 199, 106, .38);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 60;
  white-space: nowrap;
  max-width: 84vw;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ============ 品牌版本 / 更新日志 ============ */
.brand-info {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.ver-chip {
  flex: 0 0 auto;
  padding: 1px 7px;
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: .3px;
  color: #ffe9b4;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(240, 199, 106, .42);
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-variant-numeric: tabular-nums;
}
.ver-chip:hover { background: rgba(255, 215, 102, .22); color: #fff6d4; }
.ver-chip.fresh::after {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  margin-left: 4px;
  vertical-align: 1px;
  border-radius: 50%;
  background: #ff6a52;
  box-shadow: 0 0 6px rgba(255, 106, 82, .9);
}

.link-btn {
  padding: 2px 0;
  font-family: inherit;
  font-size: 12px;
  color: #ffd980;
  background: none;
  border: 0;
  border-bottom: 1px dashed rgba(255, 217, 128, .45);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.link-btn:hover { color: #fff6d4; border-color: rgba(255, 246, 212, .8); }
.link-btn.center { display: block; margin: 10px auto 0; }

.start-ver {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 11px;
  color: rgba(255, 244, 214, .42);
  font-variant-numeric: tabular-nums;
}

.log-panel {
  width: min(92vw, 460px);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #10402a, #062414);
  border: 1px solid rgba(240, 199, 106, .32);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}

.log-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(240, 199, 106, .18);
}
.log-head h2 { margin: 0; font-size: 17px; letter-spacing: 1px; color: #ffe9b4; }
.log-sub { margin: 4px 0 0; font-size: 11.5px; color: rgba(255, 244, 214, .5); }
.log-sub b { color: #ffd980; font-variant-numeric: tabular-nums; }
.log-close { width: 28px; height: 28px; flex: 0 0 auto; }

.log-body {
  flex: 1 1 auto;
  overflow-y: auto;
  margin: 10px -4px 12px;
  padding: 0 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.log-item { margin-bottom: 16px; }
.log-item:last-child { margin-bottom: 4px; }

.log-item-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.log-ver {
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  color: #4a3308;
  background: linear-gradient(180deg, #ffe9a8, #d9ab48);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.log-title { font-size: 13px; font-weight: 700; color: #fff2d4; }
.log-date { margin-left: auto; font-size: 10.5px; color: rgba(255, 244, 214, .38); font-variant-numeric: tabular-nums; }

.log-item.current .log-ver { background: linear-gradient(180deg, #a8f0b8, #4fc472); }

.log-items {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 12px;
  line-height: 1.85;
  color: rgba(255, 246, 222, .76);
}
.log-items li { position: relative; padding-left: 12px; }
.log-items li::before {
  content: "";
  position: absolute;
  left: 2px; top: 9px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255, 215, 128, .5);
}

.log-empty { font-size: 12.5px; color: rgba(255, 244, 214, .5); text-align: center; padding: 20px 0; }
.log-panel > .btn { width: 100%; flex: 0 0 auto; }

/* ============ 规则设置 ============ */
.btn-rules {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  padding: 9px 22px;
  font-size: 13px;
  border-radius: 10px;
}

.rules-summary {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: rgba(255, 244, 214, .45);
  letter-spacing: .2px;
}

.rules-panel {
  width: min(94vw, 500px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: linear-gradient(180deg, #10402a, #062414);
  border: 1px solid rgba(240, 199, 106, .32);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  overflow: hidden;
}

.rules-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 18px 13px;
  border-bottom: 1px solid rgba(240, 199, 106, .18);
  flex: 0 0 auto;
}
.rules-head h2 { margin: 0; font-size: 17px; letter-spacing: 1px; color: #ffe9b4; }
.rules-sub { margin: 4px 0 0; font-size: 11.5px; color: rgba(255, 244, 214, .48); }

.rules-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 18px 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.rule-row {
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.rule-row:last-of-type { border-bottom: 0; }

.rule-label { margin-bottom: 9px; }
.rule-label b {
  display: block;
  font-size: 13.5px;
  color: #fff2d4;
  letter-spacing: .3px;
  margin-bottom: 3px;
}
.rule-label span {
  display: block;
  font-size: 11px;
  line-height: 1.6;
  color: rgba(255, 244, 214, .45);
}

.seg {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.seg button {
  flex: 1 1 0;
  min-width: 62px;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 240, 210, .72);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.seg button:hover { background: rgba(255, 255, 255, .12); }
.seg button.on {
  color: #4a3308;
  font-weight: 800;
  background: linear-gradient(180deg, #ffe9a8, #e2b455);
  border-color: rgba(255, 233, 168, .9);
  box-shadow: 0 2px 8px rgba(230, 180, 80, .35), inset 0 1px 0 rgba(255, 255, 255, .6);
}

.rules-note {
  margin: 14px 0 2px;
  padding: 8px 11px;
  font-size: 11px;
  line-height: 1.6;
  color: rgba(255, 233, 168, .62);
  background: rgba(255, 215, 102, .07);
  border-left: 2px solid rgba(255, 215, 102, .4);
  border-radius: 6px;
}

.rules-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  padding: 13px 18px calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(240, 199, 106, .16);
  background: rgba(0, 0, 0, .18);
}
.rules-actions .btn { flex: 1 1 0; }

/* ============ 响应式 ============ */
@media (max-width: 560px) {
  .brand-text { font-size: 15px; letter-spacing: 0; }
  .ver-chip { font-size: 9.5px; padding: 0 5px; line-height: 15px; }
  .brand-info { gap: 5px; }
  .seat { width: 78px; }
  .seat-left { left: 4px; top: 66px; }
  .seat-right { right: 4px; top: 66px; }
  .avatar { width: 46px; height: 46px; }
  .avatar svg { width: 46px; height: 46px; }
  .bubble { top: 46px; font-size: 11px; padding: 3px 8px; }
  .seat-name { font-size: 11px; }
  .played-left { left: 88px; top: 132px; }
  .played-right { right: 88px; top: 132px; }
  .played-self { bottom: 218px; }
  .card.played-card { width: 34px; height: 48px; border-radius: 4px; }
  .card.played-card .c-corner b { font-size: 10px; }
  .card.played-card .c-corner i { font-size: 7.5px; }
  .card.played-card .c-big { font-size: 15px; }
  .hand-area { height: 132px; }
  .my-seat { bottom: 176px; width: 70px; }
  .my-seat .avatar { width: 38px; height: 38px; }
  .turn-hint { top: 52px; font-size: 11.5px; }
  .bid-bar { bottom: 114px; padding: 8px 12px; }
  .bid-actions .btn { padding: 7px 11px; font-size: 12.5px; }
  .play-bar { bottom: 114px; gap: 6px; }
  .play-bar .btn { padding: 8px 12px; font-size: 12.5px; }
  .bottom-zone { top: 4px; }
  .card.mini { width: 26px; height: 37px; }
  .card.mini .c-corner b { font-size: 9px; }
  .card.mini .c-big { font-size: 12px; }
  .bomb-fx { font-size: 34px; letter-spacing: 5px; }
  .start-panel h1 { font-size: 25px; }
  .seg button { min-width: 54px; font-size: 11.5px; padding: 7px 4px; }
  .rule-label b { font-size: 12.5px; }
  .rules-body { padding: 4px 14px 10px; }
  .rules-actions { padding: 11px 14px calc(13px + env(safe-area-inset-bottom)); }
  .btn-rules { padding: 8px 18px; font-size: 12.5px; margin-top: 8px; }
}

@media (max-height: 640px) {
  .hand-area { height: 118px; }
  .my-seat { bottom: 168px; }
  .played-self { bottom: 212px; }
  .play-bar { bottom: 108px; }
  .bid-bar { bottom: 108px; }
}

@media (min-width: 900px) {
  .table { max-width: 1100px; margin: 0 auto; width: 100%; }
  .card { --card-w: 62px; }
  .hand-area { height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   潇洒斗地主 v2.0 —— 主题皮肤 / 宽屏三栏 / 牌面精修 / 动画 / 新面板
   ============================================================ */

/* ---------- 主题皮肤（覆盖牌桌配色变量） ---------- */
html[data-theme="classic"] {
  --felt-deep: #062e18; --felt-mid: #0b4a26; --felt-light: #136a35;
  --gold: #f0c76a; --gold-deep: #b8862c; --gold-line: #7d5a1c;
  --rail: #3a2412; --rail-light: #5a3a1d;
}
html[data-theme="wood"] {
  --felt-deep: #33200f; --felt-mid: #53351b; --felt-light: #754c26;
  --gold: #f5cf87; --gold-deep: #c08a3a; --gold-line: #8a6222;
  --rail: #241408; --rail-light: #432a12;
}
html[data-theme="night"] {
  --felt-deep: #0b0f1a; --felt-mid: #131c2e; --felt-light: #1e2b44;
  --gold: #cdd8ea; --gold-deep: #8e9dba; --gold-line: #55637d;
  --rail: #060911; --rail-light: #131a28;
}
html[data-theme="ocean"] {
  --felt-deep: #062b3a; --felt-mid: #08475e; --felt-light: #0b6580;
  --gold: #b6ecf7; --gold-deep: #63b9cf; --gold-line: #3a7c92;
  --rail: #04202c; --rail-light: #083b4d;
}
html[data-theme="wood"] body { background: #25160a; }
html[data-theme="night"] body { background: #05070d; }
html[data-theme="ocean"] body { background: #041c26; }

/* ---------- 顶栏图标状态 ---------- */
.ver-chip.fresh::after {
  content: ""; position: absolute; top: -2px; right: -2px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #ff5b4a; box-shadow: 0 0 0 2px #07200f;
}
.icon-btn.off { opacity: .45; }

/* ---------- 牌面精修：数字牌点数阵列 ---------- */
.card .c-pips {
  position: absolute;
  top: 20px; bottom: 6px; left: 14px; right: 5px;
  display: grid;
  place-items: center;
  grid-template-columns: 1fr 1fr;
  font-size: 11px;
  line-height: 1;
  opacity: .92;
}
.card .c-pips i {
  font-style: normal;
  font-size: 12px;
  transform: scale(.92);
}
.card .c-pips[data-n="1"] { grid-template-columns: 1fr; font-size: 24px; }
.card .c-pips[data-n="1"] i { font-size: 24px; }
.card .c-pips[data-n="2"] { grid-template-columns: 1fr; }
.card .c-pips[data-n="2"] i:nth-child(2) { transform: rotate(180deg) scale(.92); }
.card .c-pips[data-n="3"] i:nth-child(1) { grid-column: 1 / -1; }
.card .c-pips[data-n="4"] { grid-template-columns: 1fr 1fr; }
.card .c-pips[data-n="4"] i:nth-child(n+3) { transform: rotate(180deg) scale(.92); }
.card .c-pips[data-n="5"],
.card .c-pips[data-n="6"],
.card .c-pips[data-n="7"],
.card .c-pips[data-n="8"],
.card .c-pips[data-n="9"],
.card .c-pips[data-n="10"] { grid-template-columns: 1fr 1fr; gap: 1px 0; }

/* ---------- 牌面精修：JQK 人头 ---------- */
.card.is-face .c-face {
  position: absolute;
  inset: 17px 4px 5px 15px;
  display: block;
  color: inherit;
  opacity: .9;
}
.card.is-face .c-face svg.face-art { width: 100%; height: 100%; display: block; }
.card.is-face .face-letter {
  position: absolute;
  right: 1px; bottom: -1px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.5px;
  opacity: .95;
}

/* ---------- 牌面精修：大小王 ---------- */
.card.is-joker .jk-mark {
  writing-mode: initial;
  right: 3px; bottom: 3px; left: 3px;
  opacity: .8;
}
.card.is-joker .jk-mark svg.jk-art { width: 100%; height: auto; display: block; }
.card.is-joker.joker-big { box-shadow: inset 0 0 0 1px rgba(215, 56, 47, .35), var(--shadow-card); }

/* ---------- 出牌动画 ---------- */
.played .card.played-card.fly-in { animation: flyIn .26s cubic-bezier(.22, .9, .3, 1) both; }
@keyframes flyIn {
  from { opacity: 0; transform: translateY(-22px) scale(.86); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.played .card.played-card.tight { margin-left: -14px; }
.played .card.played-card.tight:first-child { margin-left: 0; }
.played .pass-mark {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: rgba(255, 255, 255, .78);
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .16);
  animation: fadeIn .2s ease;
}
.reveal-wrap { display: flex; align-items: center; }

/* ---------- 炸弹震屏 ---------- */
body.screen-shake { animation: screenShake .46s cubic-bezier(.36, .07, .19, .97); }
@keyframes screenShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 1px, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, -2px, 0); }
  40%, 60% { transform: translate3d(7px, 2px, 0); }
}

/* ---------- 关键牌常驻（座位下方） ---------- */
.key-box {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  margin-top: 3px;
  min-height: 15px;
}
.key-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(0, 0, 0, .34);
  border: 1px solid rgba(240, 199, 106, .26);
  font-size: 9px;
  line-height: 1.35;
  color: rgba(255, 255, 255, .88);
}
.key-chip b { font-weight: 700; color: var(--gold); }
.key-chip i { font-style: normal; opacity: .9; }
.key-chip.scarce { border-color: rgba(240, 120, 90, .7); }
.key-chip.scarce i { color: #ffb0a4; }
.key-chip.gone { opacity: .34; text-decoration: line-through; }

/* ---------- 宽屏三栏（D 组·13） ---------- */
.side-panel { display: none; }
@media (min-width: 1180px) {
  .table {
    max-width: 1580px;
    padding-left: 190px;
    padding-right: 190px;
  }
  .side-panel {
    display: block;
    position: absolute;
    top: 96px;
    width: 168px;
    z-index: 9;
    padding: 12px 12px 14px;
    border-radius: 12px;
    background: rgba(4, 22, 13, .52);
    border: 1px solid rgba(240, 199, 106, .18);
    backdrop-filter: blur(3px);
  }
  .side-panel-left { left: 10px; }
  .side-panel-right { right: 10px; }
  .side-title {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--gold);
    opacity: .9;
    margin-bottom: 7px;
  }
  .side-title.sm { margin-top: 10px; }
  .side-rank {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .5);
  }
  .side-line {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    padding: 3px 0;
    color: rgba(255, 255, 255, .72);
    border-bottom: 1px dashed rgba(255, 255, 255, .08);
  }
  .side-line b { color: #fff; font-weight: 700; }
  .side-history { display: flex; flex-wrap: wrap; gap: 4px; }
  .side-history i {
    font-style: normal;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .08);
  }
  .side-history i.w { color: #8fe6ad; }
  .side-history i.l { color: #ff9d92; }

  /* A 组·1：宽屏放大牌桌与牌面 */
  .card { --card-w: 66px; }
  .hand-area { height: 172px; }
  .played .card.played-card { width: 42px; height: 59px; }
  .seat { width: 96px; }
  .seat-left { left: 208px; top: 92px; }
  .seat-right { right: 208px; top: 92px; }
  .played-left { left: 300px; }
  .played-right { right: 300px; }
  .bottom-zone { top: 8px; }
  .card.mini { width: 34px; height: 48px; }
  .my-seat { left: 208px; bottom: 250px; width: 92px; }
  .my-seat .avatar { width: 48px; height: 48px; }
  .bid-bar, .play-bar { bottom: 178px; }
  .played-self { bottom: 236px; }
}

/* ---------- 通用小面板（战绩/主题/语言/音量/快捷语） ---------- */
.mini-panel {
  width: min(430px, calc(100vw - 32px));
  max-height: 84vh;
  overflow-y: auto;
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  border-radius: 16px;
  background: linear-gradient(180deg, #0e3520, #072314);
  border: 1px solid rgba(240, 199, 106, .3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .08);
  animation: popIn .18s ease;
}
.mini-panel-sm { width: min(340px, calc(100vw - 32px)); }
.mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.mini-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: .5px;
}
.mini-actions { display: flex; gap: 10px; margin-top: 14px; }
.mini-actions .btn { flex: 1 1 0; }

/* 战绩面板 */
.rank-card {
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .26);
  border: 1px solid rgba(240, 199, 106, .2);
  margin-bottom: 14px;
}
.rank-badge {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
}
.rank-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
  margin: 9px 0 7px;
}
.rank-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transition: width .35s ease;
}
.rank-note { margin: 0; font-size: 11px; color: rgba(255, 255, 255, .66); }
.stats-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 12px;
  margin: 0;
}
.stats-grid dt { font-size: 12.5px; color: rgba(255, 255, 255, .7); }
.stats-grid dd { margin: 0; font-size: 13.5px; font-weight: 700; color: #fff; text-align: right; }
.stats-empty { margin: 6px 0 2px; font-size: 12.5px; color: rgba(255, 255, 255, .62); }

/* 主题 / 语言 / 音量 / 快捷语 */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-swatch {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .25);
  border: 2px solid transparent;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.theme-swatch i { display: block; height: 48px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18); }
.theme-swatch.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(240, 199, 106, .18); }

.lang-list { display: flex; flex-direction: column; gap: 8px; }
.lang-opt {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .26);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.lang-opt.on { border-color: var(--gold); color: var(--gold); background: rgba(240, 199, 106, .1); }

.vol-row { margin-bottom: 12px; }
.vol-row label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .8);
  margin-bottom: 6px;
}
.vol-row label b { color: var(--gold); }
.vol-row input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), rgba(255, 255, 255, .16));
  outline: none;
}
.vol-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff9e6;
  border: 2px solid var(--gold-deep);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  cursor: pointer;
}
.toggle-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-top: 4px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .26);
  border: 1px solid rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .82);
  font-size: 12.5px;
  cursor: pointer;
}
.toggle-btn i {
  position: relative;
  width: 34px; height: 19px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  transition: background .18s ease;
  flex: 0 0 auto;
}
.toggle-btn i::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
}
.toggle-btn.on { border-color: rgba(240, 199, 106, .5); color: var(--gold); }
.toggle-btn.on i { background: var(--gold-deep); }
.toggle-btn.on i::after { transform: translateX(15px); }

.chat-grid { display: grid; grid-template-columns: 1fr; gap: 7px; }
.chat-grid button {
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(0, 0, 0, .24);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.chat-grid button:hover { background: rgba(240, 199, 106, .14); border-color: rgba(240, 199, 106, .4); }

/* 复盘 */
.result-review {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .26);
  border: 1px solid rgba(240, 199, 106, .16);
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .82);
}
.result-review h3 {
  margin: 0 0 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .5px;
}
.result-review ul { margin: 0; padding-left: 16px; }
.result-review li { margin-bottom: 3px; }
.result-review .review-ok { margin: 0; color: rgba(255, 255, 255, .7); }

/* 记牌器格子里补「手牌」标记 */
.board-cell { position: relative; }
.board-cell .bc-mine {
  position: absolute;
  top: -4px; right: -4px;
  padding: 0 3px;
  border-radius: 4px;
  font-size: 8px;
  line-height: 12px;
  background: #d7382f;
  color: #fff;
}
.board-cell.gone { opacity: .32; }
.board-cell.mine { border-color: rgba(240, 199, 106, .6); }

/* 开始界面按钮行 */
.start-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.start-row .btn-rules { margin-top: 8px; }

/* 窄屏适配新增面板 */
@media (max-width: 560px) {
  .mini-panel { padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
  .theme-grid { gap: 8px; }
  .theme-swatch i { height: 40px; }
  .key-chip { font-size: 8px; padding: 1px 3px; }
  .card .c-pips { top: 17px; left: 11px; font-size: 9px; }
  .card .c-pips i { font-size: 10px; }
  .card.is-face .c-face { inset: 14px 3px 4px 12px; }
  .chat-grid button { font-size: 12px; padding: 8px 10px; }
}

/* 左栏剩余牌数为 0 时弱化 */
.side-line.zero { opacity: .38; }
.side-line.zero b { color: #ff9d92; }

/* 宽屏底牌区与提示分离 */
@media (min-width: 1180px) {
  .turn-hint { top: 104px; }
  .bottom-zone { top: 14px; }
}

/* 关键牌计数：点数与剩余数之间加分隔，避免挤成「24」 */
.key-chip b { margin-right: 2px; }
.key-chip i::before { content: "·"; margin-right: 1px; opacity: .55; }
.key-chip i { letter-spacing: 0; }

/* 计时器贴近出牌区：窄屏上移，避免压住手牌 */
@media (max-width: 900px) {
  .timer { right: 14px; bottom: 148px; }
}
@media (max-width: 560px) {
  .timer { right: 10px; bottom: 120px; width: 30px; height: 30px; font-size: 12px; }
}
@media (max-width: 640px) and (max-height: 700px) {
  .timer { bottom: 112px; }
}

/* 结算面板关闭后，牌桌上保留「再来一局」入口 */
.replay-btn {
  position: absolute;
  left: 50%;
  bottom: 168px;
  transform: translateX(-50%);
  z-index: 60;
  min-width: 132px;
  height: 42px;
  font-size: 14.5px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
  animation: popIn .2s ease;
}
@media (max-width: 900px) {
  .replay-btn { bottom: 140px; height: 40px; }
}
@media (max-width: 560px) {
  .replay-btn { bottom: 116px; height: 38px; min-width: 116px; font-size: 13.5px; }
}
@media (min-width: 1180px) {
  .replay-btn { bottom: 196px; }
}
