/* ==========================================================================
   棋牌游戏厅 —— 统一样式
   牌桌采用「视口变量」驱动：所有尺寸用 clamp()/dvh 计算，随屏幕实时缩放，
   不需要固定档位，转屏/拉伸/任意手机尺寸都自适应。
   ========================================================================== */

:root {
  --bg: #0b1220;
  --bg-1: #131c2e;
  --bg-2: #1b2740;
  --bg-3: #24344f;
  --line: #2f4062;
  --text: #eaf0fa;
  --muted: #93a4c0;
  --primary: #4f7cff;
  --primary-d: #3a63d8;
  --primary-l: #7a9cff;
  --gold: #f5b544;
  --green: #35c47a;
  --red: #f0554d;
  --radius: 14px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.75);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --content-max: 1000px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #18243c 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: var(--primary-l); text-decoration: none; }
button, input, select { font-family: inherit; }

/* ============================ 一、通用组件 ============================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 10px 16px; border: 1px solid transparent; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
  background: var(--bg-3); color: var(--text);
  transition: filter 0.16s, transform 0.08s;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.btn-primary { background: linear-gradient(180deg, var(--primary), var(--primary-d)); color: #fff; }
.btn-gold { background: linear-gradient(180deg, #f7c964, #e0a32c); color: #3a2a05; }
.btn-green { background: linear-gradient(180deg, #47d68b, #26a866); color: #04220f; }
.btn-danger { background: linear-gradient(180deg, #f2695f, #cf3b33); color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, 0.08); border-color: #3f5680; color: #dbe6f7; }
.btn-sm { padding: 8px 13px; font-size: 13.5px; border-radius: 9px; }
.btn-block { width: 100%; }

.card {
  background: rgba(27, 39, 64, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-title .spacer { flex: 1; }

.grid { display: grid; gap: 12px; }
.lobby-shortcuts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.lobby-shortcut {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0;
  padding: 10px 8px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer;
}
.lobby-shortcut:hover { border-color: rgba(245,181,68,.45); color: var(--gold); }
.lobby-shortcut.active { border-color: rgba(245,181,68,.55); background: rgba(245,181,68,.1); color: var(--gold); }
.lobby-shortcut .ico { width: 20px; height: 20px; flex: 0 0 auto; color: var(--gold); }
.lobby-shortcut img.ico { object-fit: contain; }
.lobby-shortcut svg.ico path, .lobby-shortcut svg.ico rect {
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.agent-content {
  width: 100%; max-width: 1100px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px;
}
.agent-content > div { width: 100%; min-width: 0; }
.agent-content .card { width: 100%; min-width: 0; }
.agent-profile { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.agent-profile .pill { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.agent-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  position: sticky; top: 0; z-index: 30;
  margin: -6px 0 12px; padding: 6px 0;
  background: rgba(11, 18, 32, .94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.agent-tabs .ptab { flex: 0 1 auto; min-width: 0; }
.agent-content .table-wrap { margin-top: 4px; }
.agent-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 10px;
}
.date-field { position: relative; display: inline-flex; flex: 0 0 auto; }
.agent-date-input { min-width: 0; padding-right: 30px; font-variant-numeric: tabular-nums; }
.agent-filters .date-field { position: relative; display: inline-flex; flex: 0 0 auto; }
.agent-filters .agent-date-input { width: 122px; min-width: 0; padding-right: 30px; }
.date-toggle {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  width: 27px; height: 27px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.date-toggle:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.date-pop {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 80;
  width: 252px; padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: #1b2740; box-shadow: 0 14px 34px rgba(0, 0, 0, .48);
}
.date-field.open .date-pop { display: block; }
.date-field.open-left .date-pop { left: auto; right: 0; }
.date-field.open-up .date-pop { top: auto; bottom: calc(100% + 6px); }
.date-head { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.date-nav {
  width: 26px; height: 28px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); font-size: 16px; cursor: pointer;
}
.date-nav:hover { background: rgba(255, 255, 255, .08); }
.date-title { flex: 1; text-align: center; font-size: 13px; font-weight: 700; white-space: nowrap; }
.date-week, .date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-week span { padding: 3px 0; text-align: center; font-size: 11px; color: var(--muted); }
.date-day {
  height: 28px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text); font-size: 12px; cursor: pointer;
}
.date-day:hover { background: rgba(255, 255, 255, .1); }
.date-day.empty { cursor: default; }
.date-day.today { color: var(--gold); }
.date-day.selected { background: var(--gold); color: #1a2138; font-weight: 700; }
.date-foot {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
}
.agent-filters .agent-filter-keyword { flex: 1 1 180px; min-width: 0; }
@media (max-width: 640px) {
  .agent-filters { gap: 6px; }
  .agent-filters .date-field { flex: 1 1 125px; }
  .agent-filters .agent-date-input { width: 100%; }
  .agent-filters .agent-filter-keyword { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .agent-content { padding: 10px 8px 18px; gap: 10px; }
  .agent-content .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .agent-content .stat-box { padding: 12px 10px; }
  .agent-content .stat-box .value { font-size: 24px; }
  .agent-content .card { padding: 13px 11px; }
  .agent-tabs {
    flex-wrap: wrap; overflow: visible; justify-content: center;
    padding-bottom: 0;
  }
  .agent-tabs .ptab { flex: 0 0 auto; padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 380px) {
  .agent-content .grid-4 { grid-template-columns: 1fr; }
  .agent-tabs .ptab { font-size: 12px; }
  .agent-content .card-title { font-size: 14px; }
}
.dash-system-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 18px;
  flex-wrap: wrap; margin-bottom: 12px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(17, 28, 48, .62); color: var(--muted); font-size: 12px;
}
.dash-system-bar b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-system-bar #serverClock { color: var(--gold); }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  font-size: 16px; /* iOS 上 <16px 会触发自动放大 */
  color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; width: 100%;
  transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--primary); }

/* 深色背景下让原生日期/时间控件的图标可见 */
input[type='date'], input[type='time'] { color-scheme: dark; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.big { font-size: 24px; font-weight: 700; }
.mono { font-family: 'Consolas', 'SF Mono', monospace; }
.center { text-align: center; }
.hidden { display: none !important; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.gold { color: var(--gold); }

.points-ico {
  display: inline-flex; width: 1.15em; height: 1.15em;
  vertical-align: -.18em; margin-right: 3px; flex: 0 0 auto;
}
.points-ico svg { width: 100%; height: 100%; display: block; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--bg-3); color: var(--muted); white-space: nowrap;
}
.badge.player { background: rgba(79, 124, 255, 0.22); color: #9db8ff; }
.badge.bot { background: rgba(245, 181, 68, 0.2); color: var(--gold); }
.badge.guest { background: rgba(147, 164, 192, 0.2); color: var(--muted); }
.badge.on { background: rgba(53, 196, 122, 0.22); color: #6fe0a5; }
.badge.coin { background: rgba(245, 181, 68, 0.18); color: var(--gold); }
.coin-ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; object-fit: contain; }
.online-dot {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
  vertical-align: -1px; background: #6b7a91; box-shadow: 0 0 0 2px rgba(107, 122, 145, .16);
}
.online-dot.on { background: #35c47a; box-shadow: 0 0 0 2px rgba(53, 196, 122, .18); }
.online-dot.off { background: #6b7a91; }
.badge.off { background: rgba(147, 164, 192, 0.16); color: var(--muted); }
.badge.landlord { background: rgba(240, 85, 77, 0.25); color: #ff9a94; }
.badge.farmer { background: rgba(79, 124, 255, 0.22); color: #9db8ff; }
.badge.ready {
  background: linear-gradient(180deg, rgba(53, 196, 122, 0.34), rgba(53, 196, 122, 0.13));
  color: #8ff0bd;
  border: 1px solid rgba(53, 196, 122, 0.5);
  box-shadow: 0 2px 10px -4px rgba(53, 196, 122, 0.85), inset 0 0 8px rgba(53, 196, 122, 0.12);
}
.badge.ready::before {
  content: '✓';
  font-weight: 900;
  color: #6fe0a5;
  text-shadow: 0 0 6px rgba(53, 196, 122, 0.65);
}
.badge.lock { background: rgba(245, 181, 68, 0.2); color: var(--gold); }
.badge.accent { background: rgba(79, 124, 255, 0.2); color: #adc2ff; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  cursor: grab;
}
.table-wrap.dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}
.table-wrap.dragging * { cursor: grabbing !important; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; }
/* 后台表格里可点的会员昵称（点开会员详情） */
.creator-link { color: #adc2ff; cursor: pointer; border-bottom: 1px dashed rgba(173, 194, 255, 0.55); }
.creator-link:hover { color: #dbe5ff; border-bottom-color: rgba(219, 229, 255, 0.8); }
/* 房间管理：列多，收紧内边距 + 长游戏名省略，避免「详情」按钮被挤出可视区 */
.rooms-table th, .rooms-table td { padding: 9px 6px; }
.rooms-table .game-cell { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.rooms-table .creator-cell { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
/* 牌局管理：牌面选择器 */
/* 后台：牌局管理快捷模板编辑 */
.tpl-block { margin-top: 12px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
.tpl-block + .tpl-block { margin-top: 10px; }
.tpl-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.tpl-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.tpl-row .tpl-name { flex: 0 0 160px; }
.tpl-row .tpl-cards { flex: 1; min-width: 0; font-family: 'Consolas', 'SF Mono', monospace; }
.tpl-block .btn { margin-top: 8px; }

.rig-deck { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
.rig-tpl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.rig-tpl {
  border: 1px solid rgba(79, 124, 255, 0.45);
  background: rgba(79, 124, 255, 0.12);
  color: #cfd9ee; border-radius: 999px; padding: 4px 12px;
  font-size: 12.5px; cursor: pointer;
}
.rig-tpl:hover { background: rgba(79, 124, 255, 0.28); color: #fff; }
.rig-times { width: auto; padding: 6px 10px; font-size: 13px; }
.rig-deck-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rig-card {
  min-width: 42px; height: 54px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text);
  font-weight: 700; font-size: 14px; cursor: pointer;
  user-select: none; transition: transform 0.08s, border-color 0.12s, background 0.12s;
}
.rig-card.red { color: #ff8a84; }
.rig-card.joker { color: var(--gold); }
.rig-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.rig-card.on {
  background: linear-gradient(180deg, rgba(79, 124, 255, 0.42), rgba(79, 124, 255, 0.18));
  border-color: rgba(124, 160, 255, 0.9);
  color: #fff;
  box-shadow: 0 3px 12px -4px rgba(79, 124, 255, 0.9);
}
.rig-card.taken { opacity: 0.32; cursor: not-allowed; text-decoration: line-through; }
.rig-card.taken:hover { transform: none; border-color: var(--line); }
/* 牌局管理：待生效的排队条目（按添加时间从上到下，一局一条） */
.queue-list { display: flex; flex-direction: column; gap: 5px; }
.queue-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 6px 3px 8px; border-radius: 8px;
  background: rgba(79, 124, 255, 0.14); border: 1px solid rgba(79, 124, 255, 0.35);
  font-size: 12.5px; line-height: 1.2;
}
.queue-chip b { font-size: 11px; color: #8fa3c4; font-weight: 700; white-space: nowrap; }
.queue-cards { color: var(--gold); font-weight: 700; white-space: nowrap; }
.queue-x {
  border: 0; background: transparent; color: #8fa3c4; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 2px;
}
.queue-x:hover { color: #ff8a84; }
tbody tr:hover { background: rgba(79, 124, 255, 0.07); }

.stat-box { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat-box .value { font-size: 22px; font-weight: 700; }
.stat-box .label { font-size: 12px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

/* ============================ 二、顶栏 / 布局 ============================ */

.topbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
  padding: 10px 12px;
  background: rgba(19, 28, 46, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand { display: flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 700; white-space: nowrap; min-width: 0; }
.topbar .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1 1 0; min-width: 0; }
.topbar #myName { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 会员中心下拉（大厅顶栏最右） */
.member-menu { position: relative; display: inline-flex; align-items: center; flex: 0 0 auto; }
.auth-buttons { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.auth-buttons .btn { padding: 5px 10px; font-size: 12.5px; }
.member-toggle {
  display: inline-flex; align-items: center; gap: 3px;
  background: #16223a; border: 1px solid var(--line); border-radius: 999px;
  color: #adc2ff; padding: 4px 9px; cursor: pointer; touch-action: manipulation;
}
.member-toggle:hover { background: rgba(79, 124, 255, 0.18); border-color: rgba(79, 124, 255, 0.5); }
.member-toggle .ico { width: 1.15em; height: 1.15em; flex: 0 0 auto; }
.member-toggle .ico circle, .member-toggle .ico path {
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.member-toggle .caret { font-size: 9px; color: var(--muted); }
.member-drop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 168px; padding: 6px;
  background: #141d31; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 36px -16px #000;
  display: flex; flex-direction: column; gap: 2px;
}
.member-points {
  padding: 7px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
  color: var(--gold); font-weight: 800; font-size: 13.5px; white-space: nowrap;
}
/* 下拉里的「积分 + 金币」并排 */
.member-points-row {
  display: flex; align-items: center; gap: 14px;
  padding: 7px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
.member-points-row .member-points { padding: 0; margin: 0; border: 0; }
.member-item {
  text-align: left; background: transparent; border: 0; color: #cfdaea;
  padding: 9px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
.member-item:hover { background: rgba(79, 124, 255, 0.16); }
.member-item.danger { color: #ff9a94; }
.member-item.danger:hover { background: rgba(240, 85, 77, 0.16); }

.lang-row { display: flex; gap: 5px; align-items: center; }
.lang-btn {
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
.lang-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.lang-ico { width: 16px; height: 12px; object-fit: cover; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

.lang-drop { position: relative; display: inline-flex; align-items: center; }
.lang-select {
  appearance: none; -webkit-appearance: none; width: auto;
  background: #16223a; color: #cfdaea; border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 22px 4px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.lang-select:focus { outline: none; border-color: var(--primary); }
.lang-drop .caret { position: absolute; right: 8px; font-size: 9px; color: var(--muted); pointer-events: none; }
/* 自定义语言下拉（带图标） */
.lang-toggle {
  display: inline-flex; align-items: center; gap: 5px; position: relative;
  background: #16223a; color: #cfdaea; border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 22px 4px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
.lang-toggle .caret { position: absolute; right: 8px; font-size: 9px; color: var(--muted); font-style: normal; }
.lang-item { display: inline-flex; align-items: center; gap: 5px; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70;
  min-width: 140px; padding: 5px; display: none;
  background: #141d31; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 16px 34px -16px #000;
}
.lang-menu.open { display: block; }
.lang-menu-item {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: transparent; border: 0; color: var(--text); text-align: left;
  padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.lang-menu-item:hover { background: rgba(79, 124, 255, .16); }
.lang-menu-item.active { color: #adc2ff; background: rgba(79, 124, 255, .14); }

/* 语言设置弹窗里的选项 */
.lang-options { display: flex; flex-direction: column; gap: 6px; }
.lang-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; text-align: left; font-family: inherit; touch-action: manipulation;
}
.lang-option:hover { border-color: rgba(79, 124, 255, .5); }
.lang-option.active { border-color: var(--primary); color: #adc2ff; background: rgba(79, 124, 255, .14); }
.lang-option .tick { margin-left: auto; color: var(--green); }

.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
/* 大厅页：固定视口高度，内容在 .content 内滚动，底部导航不随页面滚动 */
.page-lobby { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.layout { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.sidebar {
  display: flex; flex-direction: row; gap: 6px;
  padding: 8px 10px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: rgba(19, 28, 46, 0.75);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.nav-btn {
  padding: 8px 12px; border: none; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; flex-shrink: 0; touch-action: manipulation;
}
.nav-btn.active { background: linear-gradient(90deg, var(--primary), var(--primary-d)); color: #fff; }

.content { flex: 1; padding: 12px; overflow-y: auto; min-width: 0; }

/* ============================ 三、登录页 ============================ */

.auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { text-align: center; font-size: 23px; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.auth-card .lang-row { justify-content: center; margin-bottom: 16px; }
.auth-card .lang-btn { padding: 5px 13px; font-size: 12.5px; }
.google-signin { display: flex; justify-content: center; margin-top: 10px; min-height: 40px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--bg); padding: 4px; border-radius: 12px; }
.tab-btn {
  flex: 1; padding: 9px; border: none; border-radius: 9px; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer;
}
.tab-btn.active { background: var(--bg-3); color: var(--text); }

.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ============================ 四、大厅 ============================ */

/* 游戏卡片（美化） */
.game-card {
  position: relative; overflow: visible;
  background: linear-gradient(150deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.game-card::before {
  content: ''; position: absolute; left: 1px; right: 1px; top: 1px; height: 3px;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  background: linear-gradient(90deg, var(--gold), transparent); opacity: .5;
}
/* 手机上卡片是竖排的：拉开间距，两张卡片之间用一条「金蓝渐变 + 中间亮点」的装饰线 */
@media (max-width: 767px) {
  #gameGrid { gap: 26px; }
  .game-card:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 12px; right: 12px; bottom: -13px;
    height: 10px;
    background:
      radial-gradient(circle at 50% 50%, #fff2cf 0 1.7px, rgba(245, 181, 68, .75) 2.6px, rgba(245, 181, 68, 0) 5.5px),
      linear-gradient(90deg,
        rgba(245, 181, 68, 0) 0%,
        rgba(245, 181, 68, .80) 20%,
        rgba(190, 170, 255, .65) 50%,
        rgba(79, 124, 255, .80) 80%,
        rgba(79, 124, 255, 0) 100%);
    background-size: 100% 100%, 100% 1.5px;
    background-position: 50% 50%, 50% 50%;
    background-repeat: no-repeat;
    pointer-events: none;
  }
}
.game-card:hover { border-color: rgba(79, 124, 255, .55); transform: translateY(-1px); box-shadow: 0 16px 30px -20px #000; }
.game-head { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
/* 右侧内容区：第一行 名称+人数+玩法，第二行 房间数 */
.game-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.game-icon {
  width: 76px; height: 76px; flex: 0 0 auto; border-radius: 18px;
  display: grid; place-items: center; font-size: 40px;
  background: radial-gradient(circle at 35% 30%, rgba(245, 181, 68, .35), rgba(79, 124, 255, .18));
  border: 1px solid rgba(245, 181, 68, .35);
}
.game-title { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.game-card h3 { margin: 0; font-size: 17px; line-height: 1.2; }
.game-card .meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.rules-link {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  color: #adc2ff; font-size: 11.5px; font-weight: 600; padding: 1px 8px;
  cursor: pointer; touch-action: manipulation; white-space: nowrap;
}
.rules-link:hover { background: rgba(79, 124, 255, .16); border-color: rgba(79, 124, 255, .5); }
.game-stats { display: flex; flex-wrap: nowrap; gap: 8px; min-width: 0; }
.game-stat {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line); color: var(--muted);
  min-width: 0; flex: 0 1 auto;
}
.game-stat .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[lang="vi"] .game-stat { font-size: 10.5px; padding: 4px 7px; gap: 3px; }
html[lang="vi"] .game-stat .ico { font-size: 10.5px; }
.game-stat .ico {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  flex: 0 0 auto; font-size: 0; line-height: 1; background: #6b7a91;
}
.game-stat.playing .ico { background: #f5b544; box-shadow: 0 0 0 2px rgba(245, 181, 68, .16); }
.game-stat.idle .ico { background: #35c47a; box-shadow: 0 0 0 2px rgba(53, 196, 122, .16); }
.game-stat b { color: var(--text); font-weight: 800; }
.game-stat.playing { border-color: rgba(245, 181, 68, .4); color: #f0c988; }
.game-stat.playing b { color: #f5b544; }
.game-stat.idle { border-color: rgba(53, 196, 122, .4); color: #6fe0a5; }
.game-stat.idle b { color: #6fe0a5; }
.game-stat.password { border-color: rgba(147, 164, 192, .4); }
/* 超窄屏（<360px）再收一点，避免两个胶囊换行 */
@media (max-width: 360px) {
  .game-stat { padding: 5px 8px; font-size: 11.5px; gap: 4px; }
  .game-stat .ico { font-size: 11.5px; }
  .game-stats { gap: 6px; }
}
.game-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

/* 后台：大厅房间数基数设置 */
.lobby-stat-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
}
.lobby-stat-row + .lobby-stat-row { margin-top: 8px; }
.lobby-stat-name { min-width: 120px; }
.lobby-stat-field { display: flex; flex-direction: column; gap: 4px; }
.lobby-stat-field input { width: 120px; }

/* 首页轮播图 */
.banner-carousel {
  position: relative; overflow: hidden; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-2);
  width: 100%;
  aspect-ratio: 3 / 1; max-height: 220px; margin-bottom: 14px;
}
.banner-track { display: flex; height: 100%; transition: transform .45s ease; }
.banner-slide { width: 100%; height: 100%; flex: 0 0 100%; object-fit: cover; display: block; }
.banner-dots { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; justify-content: center; gap: 5px; }
.banner-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.banner-dot.active { background: #fff; width: 16px; border-radius: 4px; }

/* 游戏 LOGO（后台可上传） */
.game-logo { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

/* 底部导航 */
.tabbar {
  flex: 0 0 auto; display: flex; align-items: stretch;
  background: rgba(19, 28, 46, 0.96); border-top: 1px solid var(--line);
  padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
}
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: transparent; border: 0; padding: 6px 4px; cursor: pointer;
  color: var(--muted); font-size: 11.5px; font-weight: 600; touch-action: manipulation; border-radius: 10px;
}
.tab-btn .tab-ico { font-size: 20px; line-height: 1; }
.tab-btn .tab-dice-cup { width: 22px; height: 22px; display: block; }
.tab-btn.active { color: #adc2ff; background: rgba(79, 124, 255, .14); }

/* 会员中心栏目（一行一个，前面带图标，点进去查看/修改） */
.me-menu {
  margin: 16px 0 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.me-menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; background: transparent; border: 0; border-bottom: 1px solid var(--line);
  color: var(--text); font-size: 14.5px; font-weight: 600; text-align: left;
  cursor: pointer; touch-action: manipulation;
}
.me-menu-item:last-child { border-bottom: 0; }
.me-menu-item .me-menu-ico { font-size: 18px; line-height: 1; flex: 0 0 auto; }
.me-menu-item .me-menu-label { flex: 1; min-width: 0; }
.me-menu-item .me-menu-arrow { color: var(--muted); font-size: 18px; flex: 0 0 auto; }
.me-menu-item.active { background: rgba(79, 124, 255, .14); color: #adc2ff; }
.me-menu-item.active .me-menu-arrow { color: #adc2ff; }

/* 头像选择（我的资料） */
.avatar-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.avatar-opt {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; line-height: 1;
  background: var(--bg); border: 2px solid var(--line);
  cursor: pointer; touch-action: manipulation;
  transition: border-color .15s, background .15s, transform .1s;
}
.avatar-opt:hover { border-color: rgba(79, 124, 255, .6); }
.avatar-opt:active { transform: scale(.94); }
.avatar-opt.active { border-color: var(--gold); background: rgba(245, 181, 68, .16); }

/* 「我的资料」里的头像入口：点它弹窗选择（省位置） */
.avatar-pick {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 5px 14px 5px 5px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
  cursor: pointer; touch-action: manipulation; align-self: flex-start;
  transition: border-color .15s, background .15s;
}
.avatar-pick:hover { border-color: rgba(79, 124, 255, .6); }
.avatar-pick:active { transform: translateY(1px); }
.avatar-pick-face {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; line-height: 1;
  background: var(--bg-3); border: 2px solid var(--line);
}
.avatar-pick-tip { color: #adc2ff; font-size: 13px; font-weight: 600; }
.avatar-img { display: block; object-fit: contain; pointer-events: none; }
.avatar-opt .avatar-img { width: 30px; height: 30px; }
.avatar-pick-face .avatar-img { width: 32px; height: 32px; }

/* 分页控件（前台/后台共用；放在列表容器外、固定居中不移动） */
.pager-host { margin-top: 12px; }
.pager {
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.pager .pager-btn { flex: 0 0 auto; min-width: 44px; }
.pager .pager-info {
  flex: 0 0 auto; min-width: 150px; text-align: center; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pager .btn[disabled] { opacity: .4; cursor: default; }

/* 我的房间列表 */
.room-search { display: flex; gap: 8px; margin-bottom: 10px; }
.room-search input { flex: 1; min-width: 0; }
.room-search .btn { flex: 0 0 auto; }
/* 积分流水搜索：房间号 + 玩法 + 搜索/重置 */
.points-search { flex-wrap: wrap; }
.points-search input { flex: 1 1 120px; }
.points-search .points-game { flex: 0 0 auto; width: auto; padding: 8px 10px; font-size: 13px; }
/* 积分 / 金币 流水选项卡 */
.points-tabs { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ptab {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.ptab.active { background: rgba(79, 124, 255, 0.22); border-color: rgba(79, 124, 255, 0.6); color: #cfe0ff; }
/* 额度转换弹层 */
.exchange-balance { display: flex; gap: 12px; margin: 4px 0 10px; }
.ex-bal {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.ex-bal b { font-size: 20px; }
.exchange-tabs { display: flex; gap: 8px; margin: 2px 0 4px; }
.exchange-tab {
  flex: 1; text-align: center; padding: 7px 0; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.exchange-tab.active { background: rgba(79, 124, 255, 0.22); border-color: rgba(79, 124, 255, 0.6); color: #cfe0ff; }
.room-mode-tabs { display: flex; gap: 8px; margin-top: 6px; }
.room-mode {
  flex: 1; text-align: center; padding: 7px 0; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.room-mode.active { background: rgba(79, 124, 255, 0.22); border-color: rgba(79, 124, 255, 0.6); color: #cfe0ff; }

/* 积分商城 */
.shop-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.shop-tab {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.shop-tab.active { background: rgba(79, 124, 255, 0.22); border-color: rgba(79, 124, 255, 0.6); color: #cfe0ff; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.shop-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  transition: border-color 0.15s, transform 0.08s;
}
.shop-card:hover { border-color: rgba(79, 124, 255, 0.55); }
.shop-card:active { transform: scale(0.99); }
.shop-cover {
  aspect-ratio: 1 / 1; background: linear-gradient(135deg, #1b2740, #22304d);
  display: flex; align-items: center; justify-content: center; font-size: 42px; color: #6f86b5;
}
.shop-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-meta { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 6px; }
.shop-name {
  font-size: 13.5px; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.shop-price { color: var(--gold); font-weight: 800; font-size: 13px; }
.shop-badge { font-size: 11px; color: var(--muted); }
.shop-empty { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 30px 0; }
.shop-detail-cover {
  width: 100%; max-height: 220px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, #1b2740, #22304d);
  display: flex; align-items: center; justify-content: center; font-size: 56px;
}
.shop-detail-cover img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.shop-detail-title { font-size: 17px; font-weight: 800; margin-top: 12px; }
.shop-detail-desc { color: var(--muted); font-size: 13px; line-height: 1.6; margin-top: 6px; white-space: pre-wrap; }
.shop-detail-price { color: var(--gold); font-weight: 800; margin-top: 10px; }
.shop-form { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.shop-form textarea { resize: vertical; }
.shop-card.soldout { opacity: 0.55; }
.shop-code {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px dashed rgba(79, 124, 255, 0.55);
  font-family: 'Consolas', 'SF Mono', monospace; font-size: 18px; letter-spacing: 1px;
  text-align: center; color: #cfe0ff; word-break: break-all;
}
/* 后台：商品多语言标签 */
.shop-lang-tab {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 4px 12px; border-radius: 999px; font-size: 12px; cursor: pointer;
}
.shop-lang-tab.active { background: rgba(79, 124, 255, 0.22); border-color: rgba(79, 124, 255, 0.6); color: #cfe0ff; }

/* 盲盒 */
.shop-mode-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.shop-mode {
  flex: 1; text-align: center; padding: 7px 0; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.shop-mode.active { background: rgba(79, 124, 255, 0.22); border-color: rgba(79, 124, 255, 0.6); color: #cfe0ff; }
.box-odds-title { margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--muted); }
.box-odds { margin-top: 6px; font-size: 12.5px; }
.box-odds th, .box-odds td { padding: 5px 8px; }
.box-opening {
  display: flex; align-items: center; justify-content: center;
  height: 180px; font-size: 84px;
  animation: box-shake 0.6s ease-in-out infinite;
}
@keyframes box-shake {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  50% { transform: rotate(6deg) scale(1.08); }
}
.box-result {
  margin: 8px 0 4px; padding: 22px 16px; border-radius: 16px; text-align: center;
  border: 1px solid var(--line); background: var(--bg-2);
  animation: box-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes box-pop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.box-result-label { font-size: 54px; line-height: 1; }
.box-prize-name { margin-top: 10px; font-size: 22px; font-weight: 800; }
.box-result-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.box-result.rarity-rare { border-color: rgba(79, 124, 255, 0.75); box-shadow: 0 0 26px -6px rgba(79, 124, 255, 0.75); }
.box-result.rarity-rare .box-prize-name { color: #9db8ff; }
.box-result.rarity-epic { border-color: rgba(168, 108, 255, 0.8); box-shadow: 0 0 30px -6px rgba(168, 108, 255, 0.8); }
.box-result.rarity-epic .box-prize-name { color: #c9a7ff; }
.box-result.rarity-legend { border-color: rgba(245, 181, 68, 0.85); box-shadow: 0 0 34px -4px rgba(245, 181, 68, 0.85); }
.box-result.rarity-legend .box-prize-name { color: var(--gold); }
.my-room-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
}
.my-room-item + .my-room-item { margin-top: 8px; }
.my-room-item .no { display: inline-flex; align-items: baseline; gap: 2px; font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.my-room-item .no .no-label { font-size: 11px; font-weight: 600; color: #8fa3c4; letter-spacing: 0; }
.my-room-item .no .no-label::after { content: ':'; margin-right: 1px; }
.my-room-item .grow { flex: 1; min-width: 0; }
/* 一行显示：游戏名 + 状态徽标 */
.my-room-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.my-room-line .my-room-game {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.my-room-line .badge { flex: 0 0 auto; }
.my-room-change { font-weight: 800; white-space: nowrap; }
.my-room-change.up { color: var(--green); }
.my-room-change.down { color: var(--red); }
.my-room-change.flat { color: var(--muted); }

/* 后台：内容管理 */
.banner-row, .logo-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
}
.banner-row + .banner-row, .logo-row + .logo-row { margin-top: 8px; }
.banner-thumb { width: 120px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.html-editor { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg-2); }
.html-editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 6px;
  border-bottom: 1px solid var(--line); background: var(--bg-1);
}
.html-editor-toolbar button {
  min-width: 30px; height: 28px; padding: 0 7px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  font-size: 13px; cursor: pointer;
}
.html-editor-toolbar button:hover { border-color: var(--primary-l); color: #fff; }
.html-color-pick {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2);
  color: var(--text); font-size: 13px; cursor: pointer;
}
.html-color-pick:hover { border-color: var(--primary-l); }
.html-color-pick input[type='color'] {
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px;
  background: transparent; cursor: pointer;
}
.html-editor-area {
  min-height: 160px; padding: 10px 12px; outline: none;
  color: var(--text); line-height: 1.7; font-size: 14px;
}
.html-editor-area:empty::before {
  content: attr(data-placeholder); color: var(--muted); pointer-events: none;
}
.html-editor-area a { color: var(--primary-l); }
.banner-meta { min-width: 120px; flex: 1; }
.content-images-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px;
}
.content-image-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  background: var(--bg-1); min-width: 0;
}
.content-image-thumb {
  height: 130px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--bg); overflow: hidden;
}
.content-image-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.content-image-name { margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-image-url-row { display: flex; gap: 4px; margin-top: 6px; align-items: center; }
.content-image-url { flex: 1; min-width: 0; font-size: 11px; padding: 6px 8px; }
.content-image-actions { display: flex; gap: 6px; margin-top: 8px; }
.logo-preview {
  width: 48px; height: 48px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center;
  background: var(--bg-1); border: 1px solid var(--line); font-size: 24px; overflow: hidden;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* 后台：翻译列表 */
.tr-table { display: flex; flex-direction: column; }
.tr-row {
  display: grid; grid-template-columns: minmax(180px, 280px) 1fr 1.2fr; gap: 10px; align-items: center;
  padding: 6px 4px; border-bottom: 1px solid var(--line);
}
.tr-key, .tr-en { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-input { width: 100%; }
@media (max-width: 760px) {
  .tr-row { grid-template-columns: 1fr; }
  .tr-en { display: none; }
}

.room-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
}
.room-item + .room-item { margin-top: 8px; }
.room-item .no { font-size: 15px; font-weight: 700; letter-spacing: 0.5px; }
.room-item .grow { flex: 1; min-width: 0; }

.rank-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.rank-no {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); font-size: 12px; font-weight: 700;
}
.rank-no.top1 { background: linear-gradient(180deg, #f7d06a, #d99b1c); color: #3a2a05; }
.rank-no.top2 { background: linear-gradient(180deg, #d8e2f0, #9fb0c8); color: #1b2740; }
.rank-no.top3 { background: linear-gradient(180deg, #e3a877, #bf7a41); color: #2c1a07; }
.rank-row .grow { flex: 1; min-width: 0; }

/* ============================ 五、牌桌（视口变量自适应） ============================ */
/* 所有尺寸都由视口推导：宽看 vw、高看 dvh，取小值，所以屏幕再小也不会挤爆 */

.table-page {
  /* 牌面尺寸：整体收小一档，给中央区留足空间（不出现滚动条） */
  --card-w: clamp(28px, 9.8vw, 54px);
  --card-h: min(calc(var(--card-w) * 1.42), max(calc(var(--card-w) * 0.95), 6.6vh));
  --card-h: min(calc(var(--card-w) * 1.42), max(calc(var(--card-w) * 0.95), 6.6dvh));
  /* 手牌：预留两排但更矮 */
  --hand-zone: clamp(84px, 16.5vh, 168px);
  --hand-zone: clamp(84px, 16.5dvh, 168px);
  --hand-w: clamp(26px, 9.4vw, 50px);
  --hand-h: min(calc((var(--hand-zone) - 26px) / 2), calc(var(--hand-w) * 1.4));
  /* 头像：手机约 36，桌面封顶 52，同时受屏幕高度约束（整体收小给出牌区让位） */
  --ava: min(clamp(26px, 9vw, 52px), 7.6dvh);
  /* 文字 */
  --fs-name: clamp(12px, 3.8vw, 18px);
  --fs-coin: clamp(11px, 3.4vw, 16px);
  --fs-plate: clamp(14px, 4.6vw, 23px);
  --fs-msg: clamp(11.5px, 3.4vw, 15px);
  --fs-badge: clamp(9px, 2.6vw, 13px);
  /* 间距 */
  --gap-1: clamp(2px, 0.6vh, 8px);
  --gap-2: clamp(5px, 1.4vh, 14px);

  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: radial-gradient(700px 420px at 50% 46%, #1b3357 0%, #0c1526 72%);
}

/* —— 顶栏 —— */
.tbl-top {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(max-content, 1fr); align-items: center; gap: var(--gap-1);
  padding: clamp(5px, 1vh, 10px) clamp(8px, 2.4vw, 18px);
  background: rgba(11, 18, 32, 0.94);
  border-bottom: 1px solid #22304d;
  position: relative;
}
.tbl-top .brand { justify-self: start; }
.tbl-right { display: flex; align-items: center; justify-content: flex-end; gap: var(--gap-1); min-width: 0; flex-wrap: nowrap; justify-self: end; }
.tbl-support {
  justify-self: center; z-index: 2; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid rgba(245,181,68,.42); background: rgba(245,181,68,.12);
  color: var(--gold); cursor: pointer; touch-action: manipulation;
}
.tbl-support:hover { background: rgba(245,181,68,.22); border-color: rgba(245,181,68,.7); }
.tbl-support .ico { width: 18px; height: 18px; flex: 0 0 auto; }
.tbl-support .ico path {
  fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round;
}
.tbl-top .brand {
  font-size: clamp(13px, 3.9vw, 18px); font-weight: 700; white-space: nowrap;
  display: inline-flex; align-items: center; gap: clamp(4px, 1.4vw, 7px); min-width: 0;
}
.tbl-top .brand #gameTitle { overflow: hidden; text-overflow: ellipsis; }
.brand-ico { width: 1.25em; height: 1.25em; flex: 0 0 auto; color: var(--gold); }
.brand-ico path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-ico circle { fill: currentColor; stroke: none; }
.pill {
  background: #16223a; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px clamp(7px, 2vw, 12px); font-size: clamp(11px, 3.1vw, 13px);
  font-weight: 600; white-space: nowrap; color: #cfdaea;
}
.pill.accent { background: rgba(79, 124, 255, 0.18); border-color: rgba(79, 124, 255, 0.5); color: #adc2ff; }
/* 顶栏可点击的 pill 按钮（会员中心图标） */
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer; touch-action: manipulation; font: inherit;
}
.pill-btn .ico { width: 1.15em; height: 1.15em; flex: 0 0 auto; }
.pill-btn .ico circle, .pill-btn .ico path {
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.member-btn { color: #adc2ff; border-color: rgba(79, 124, 255, 0.5); background: rgba(79, 124, 255, 0.16); }
.member-btn:hover { background: rgba(79, 124, 255, 0.3); }
/* 牌桌顶栏不再显示「我的」按钮（会员中心从大厅底部导航进入），省出横向空间 */
.tbl-top .member-btn { display: none; }
.tbl-top .lang-select { font-size: clamp(11px, 3.1vw, 14px); padding: 4px clamp(16px, 4vw, 26px) 4px clamp(8px, 2.4vw, 13px); }
.tbl-top .btn { display: inline-flex; align-items: center; gap: 4px; padding: clamp(5px, 1vh, 9px) clamp(9px, 2.6vw, 16px); font-size: clamp(11.5px, 3.2vw, 14px); }
.tbl-top .btn .ico { width: 1.05em; height: 1.05em; flex: 0 0 auto; }
.tbl-top .btn .ico path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.grow { flex: 1; min-width: 0; }

/* 对手框中间那颗「结果」按钮 */
.opp-result {
  align-self: center; flex: 0 0 auto; cursor: pointer; touch-action: manipulation;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px clamp(6px, 2vw, 10px);
  border-radius: 999px;
  background: rgba(79, 124, 255, 0.16); border: 1px solid rgba(79, 124, 255, 0.5); color: #adc2ff;
  font-weight: 700; white-space: nowrap;
}
.opp-result .ico { font-size: clamp(11px, 3vw, 14px); line-height: 1; }
.opp-result .txt { font-size: clamp(10px, 2.6vw, 12px); line-height: 1.1; }
.opp-result b { color: var(--gold); font-size: clamp(10px, 2.6vw, 12px); }
.opp-result:hover { background: rgba(79, 124, 255, 0.28); }
/* 中间：房间号 + 本房结果，竖排两行（房间号移到奖杯正上方），整体压扁收窄，保持与两侧框同一行高 */
.opp-center {
  align-self: center; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
}
.opp-room-id {
  display: inline-flex; align-items: baseline; gap: 3px;
  background: #16223a; border: 1px solid var(--line); border-radius: 999px;
  padding: 1px clamp(5px, 1.6vw, 9px);
  font-size: clamp(9px, 2.6vw, 11px); font-weight: 600; color: #cfdaea; white-space: nowrap;
}
.opp-room-id .lbl { color: #7f92b8; font-weight: 500; font-size: 0.86em; }
.opp-room-id b { color: #adc2ff; }
/* 只有 1 个对手时占位，保证对手框还是半宽、靠右 */
.opp-spacer { flex: 1 1 0; min-width: 0; }

/* 对手账户框 */
.opps {
  flex: 0 0 auto; display: flex; align-items: flex-start;
  gap: clamp(6px, 2.4vw, 12px); padding: clamp(4px, 0.8vh, 9px) clamp(6px, 1.8vw, 12px) 0;
  /* 对手还没进来时也占好高度，避免对手框出现时整屏下移 */
  min-height: clamp(38px, 8vh, 58px);
}
.opp {
  flex: 1 1 0; min-width: 0; position: relative;
  display: flex; align-items: center; gap: clamp(4px, 1.4vw, 10px);
  background: linear-gradient(135deg, rgba(36, 52, 79, 0.95), rgba(20, 30, 48, 0.95));
  border: 1px solid #33456a; border-radius: clamp(9px, 2.6vw, 14px);
  padding: clamp(3px, 0.7vh, 7px) clamp(6px, 2vw, 13px);
  box-shadow: 0 10px 22px -14px #000;
}
.opp.right { flex-direction: row-reverse; }
.opp.turn { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245, 181, 68, 0.22), 0 10px 22px -14px #000; }
.opp.offline { opacity: 0.6; }
/* 空座位占位：默认头像 + 等待玩家 */
.opp.empty { opacity: 0.55; border-style: dashed; }
.opp .waiting { color: #8f9fbb; font-weight: 600; font-size: calc(var(--fs-name) * 0.86); }

.ava {
  width: var(--ava); height: var(--ava); border-radius: 50%; flex: 0 0 auto; position: relative;
  display: grid; place-items: center; font-size: calc(var(--ava) * 0.54);
  background: radial-gradient(circle at 35% 30%, #4a6fa8, #1d2b45); border: 2px solid #5b7bb5;
}
.ava.me { border-color: var(--gold); background: radial-gradient(circle at 35% 30%, #a8792f, #2c2216); }
.opp.turn .ava { animation: pulse 1.5s ease-out infinite; }
.ava.me.myturn { animation: pulseGreen 1.5s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(245, 181, 68, 0.55); } 100% { box-shadow: 0 0 0 11px rgba(245, 181, 68, 0); } }
@keyframes pulseGreen { 0% { box-shadow: 0 0 0 0 rgba(53, 196, 122, 0.6); } 100% { box-shadow: 0 0 0 11px rgba(53, 196, 122, 0); } }
.ava .dot {
  position: absolute; right: 0; bottom: 0;
  width: calc(var(--ava) * 0.24); height: calc(var(--ava) * 0.24);
  border-radius: 50%; background: var(--green); border: 2px solid #131c2e;
}
.ava .dot.off { background: #6b7a91; }

.opp-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.opp-name {
  font-size: var(--fs-name); font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 5px;
  min-width: 0;
}
/* 昵称过长时省略号截断，准备/托管等徽标保持完整
   （用 :not(.badge) 而不是 :first-child —— 大老二右侧座位的牌数会插到名字前面，
   用 :first-child 会让昵称失去省略号并挤掉牌数） */
.opp-name > span:not(.badge):not(.name-delta) {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.opp-name > .badge { flex: 0 0 auto; }
.opp-name > .name-delta { flex: 0 0 auto; }
/* 斗地主 / 大老二：自己账户行最右侧的「房间汇总」按钮 */
#myAccount .room-stat-btn { margin-left: auto; flex: 0 0 auto; white-space: nowrap; }
.opp-name > .name-pile { margin: 0 4px; flex: 0 0 auto; }
/* 大老二：张数只保留数字（隐藏牌堆图标）——名字行还要放「托管」等徽标，图标会把数字挤掉 */
.game-tienlen .opp .name-pile { margin: 0; }
.game-tienlen .opp .name-pile .stack { display: none; }
.game-tienlen .opp .name-pile .count { padding: 0 5px; min-width: 0; }
.opp.right .opp-name { justify-content: flex-end; }
.opp .badge { font-size: var(--fs-badge); padding: 1px clamp(4px, 1.4vw, 9px); }
.opp-coin { font-size: var(--fs-coin); color: var(--gold); font-weight: 700; white-space: nowrap; }
/* 第二行：金币 + 剩余牌数 */
.opp-line2 { display: flex; align-items: center; gap: clamp(4px, 1.6vw, 10px); min-width: 0; }
.opp.right .opp-line2 { justify-content: flex-end; }
.opp-line2 .pile { gap: clamp(2px, 0.8vw, 5px); }

/* 准备状态胶囊 + 房主「踢出」按钮（准备阶段显示在出牌区「—」的位置） */
.ready-row { display: flex; align-items: center; gap: clamp(5px, 1.8vw, 12px); }
.play-side.right .ready-row { flex-direction: row-reverse; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  padding: 0 clamp(10px, 4vw, 20px); height: calc(var(--card-h) * 0.62);
  border-radius: calc(var(--card-w) * 0.18); border: 1px solid transparent;
  font-size: calc(var(--card-w) * 0.36); font-weight: 800;
}
.chip.ready {
  color: #8ff0bd;
  background: linear-gradient(180deg, rgba(53, 196, 122, 0.28), rgba(53, 196, 122, 0.12));
  border-color: rgba(53, 196, 122, 0.5);
  box-shadow: 0 2px 12px -6px rgba(53, 196, 122, 0.9), inset 0 0 10px rgba(53, 196, 122, 0.12);
}
.chip.notready { color: #8f9fbb; background: transparent; border-color: #3a5285; border-style: dashed; }
.kick-btn {
  padding: clamp(4px, 1vh, 7px) clamp(9px, 2.8vw, 15px); border-radius: 999px; cursor: pointer;
  font-size: calc(var(--card-w) * 0.32); font-weight: 700; white-space: nowrap;
  color: #ff9a94; background: rgba(240, 85, 77, 0.16); border: 1px solid rgba(240, 85, 77, 0.55);
  touch-action: manipulation;
}
.kick-btn:hover { background: rgba(240, 85, 77, 0.3); }
.kick-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* 座位宽度略放宽 + 第二行内容收紧：剩余张数不再顶出边框 */
.game-shuisan .opps .opp { width: clamp(136px, 27vw, 300px); }
.game-tienlen .opps .opp { width: clamp(172px, 40vw, 320px); }
.game-shuisan .opp .opp-coin,
.game-tienlen .opp .opp-coin { font-size: 12.5px; }
.game-shuisan .opp .opp-line2,
.game-tienlen .opp .opp-line2 {
  gap: 4px;
  min-width: 0;
}
.game-shuisan .opp .opp-line2 .pile,
.game-tienlen .opp .opp-line2 .pile {
  flex: 0 0 auto;
  transform: scale(0.86);
  transform-origin: right center;
}
/* 座位框外（正下方）一行：准备状态 + 踢出 */
.opp .seat-foot {
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  z-index: 7;
}
.opp .seat-foot .badge { font-size: 13px; padding: 3px 12px; }
.opp .seat-foot .kick-btn { padding: 2px 12px; font-size: 12.5px; line-height: 1.7; }

/* 4 人局（十三水）用紧凑卡 */
.opp.tiny { padding: clamp(4px, 1vh, 8px) clamp(5px, 1.6vw, 10px); }
.opp.tiny .ava { width: calc(var(--ava) * 1); height: calc(var(--ava) * 1); font-size: calc(var(--ava) * 0.5); }
.opp.tiny .opp-name { font-size: calc(var(--fs-name) * 0.8); }

/* —— 出牌区：张数在上、牌面在下 —— */
.mid {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start; gap: var(--gap-1); padding: 0 clamp(6px, 2vw, 16px);
  overflow-y: auto; overflow-x: hidden; /* 兜底可滚，但正常情况下不会出现滚动条 */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;
  position: relative;
}
.mid::-webkit-scrollbar { width: 0; height: 0; } /* Chrome/Safari：不显示滚动条 */
.table-plays {
  width: 100%; display: flex; align-items: flex-start; gap: clamp(8px, 3.6vw, 18px);
  justify-content: space-between; padding-top: clamp(6px, 1.6vh, 18px);
  /* 预留「两排牌面」的高度，并吃掉上方的余量（出牌区更大）；设上限避免中间空太多 */
  flex: 1 1 auto;
  min-height: calc(var(--card-h) * 2 + clamp(26px, 6vh, 54px));
  max-height: calc(var(--card-h) * 2 + clamp(42px, 10vh, 92px));
}
.play-side { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap-1); }
.play-side.right { align-items: flex-end; }

.pile { display: flex; align-items: center; gap: clamp(3px, 1vw, 6px); }
.play-side.right .pile { flex-direction: row-reverse; }
.pile .stack { position: relative; width: calc(var(--card-w) * 0.4); height: calc(var(--card-w) * 0.5); flex: 0 0 auto; }
.pile .stack i {
  position: absolute; top: 0; left: 0;
  width: calc(var(--card-w) * 0.36); height: calc(var(--card-w) * 0.46);
  border-radius: 3px; background: linear-gradient(150deg, #3b6bd6, #1d3a7d); border: 1px solid #6f93e0;
}
.pile .stack i:nth-child(2) { top: 2px; left: 2px; }
.pile .count {
  min-width: calc(var(--card-w) * 0.54); text-align: center; font-weight: 800;
  font-size: calc(var(--card-w) * 0.28); background: #16223a; border: 1px solid #3a5285;
  border-radius: 6px; padding: 1px 3px; line-height: 1.15;
}

/* 出牌牌面：点数在左上角（重叠也看得见） */
.cards { display: flex; flex-wrap: wrap; align-items: flex-end; row-gap: var(--gap-1); padding-left: calc(var(--card-w) * 0.5); }
.cards .pc {
  width: var(--card-w); height: var(--card-h); margin-left: calc(var(--card-w) * -0.5); flex: 0 0 auto;
  border-radius: calc(var(--card-w) * 0.13);
  background: linear-gradient(170deg, #fff, #e6ecf7); color: #16203a; border: 1px solid #b9c4d6;
  box-shadow: 0 6px 12px -8px rgba(0, 0, 0, 0.85);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start;
  padding: calc(var(--card-w) * 0.09) 0 0 calc(var(--card-w) * 0.11); font-weight: 800;
}
.cards .pc .r { font-size: calc(var(--card-w) * 0.42); line-height: 1; }
.cards .pc .s { font-size: calc(var(--card-w) * 0.33); line-height: 1; margin-top: 1px; }
.cards .pc.red { color: #d5342c; }
.cards .pc.tight { margin-left: calc(var(--card-w) * -0.55); }
.cards .pc.pass {
  width: auto; padding: 0 clamp(10px, 4vw, 22px); height: calc(var(--card-h) * 0.62); align-self: center;
  font-size: calc(var(--card-w) * 0.4); font-weight: 800; color: #dbe6f7; background: #1f2c46;
  border-color: #4a6a9c; justify-content: center;
}
.cards .pc.none {
  width: auto; padding: 0 clamp(10px, 4vw, 22px); height: calc(var(--card-h) * 0.62); align-self: center;
  font-size: calc(var(--card-w) * 0.36); color: #8f9fbb; background: transparent;
  border-style: dashed; justify-content: center;
}
/* 准备状态胶囊（替代「—」，准备阶段显示） */
.cards .pc.ready {
  width: auto; padding: 0 clamp(10px, 4vw, 22px); height: calc(var(--card-h) * 0.62); align-self: center;
  font-size: calc(var(--card-w) * 0.36); font-weight: 800; color: #6fe0a5;
  background: rgba(53, 196, 122, 0.16); border-color: rgba(53, 196, 122, 0.5); justify-content: center;
}
.cards-rows { display: flex; flex-direction: column; gap: var(--gap-1); width: 100%; }
.play-side.right .cards-rows { align-items: flex-end; }
.play-status { font-size: var(--fs-coin); color: var(--muted); padding: 6px 0; }

/* —— 中央：场次信息 / 叫地主 / 单行提示 ——
   信息带吸收「出牌区 → 我本轮」之间的剩余空间并垂直居中；
   上下两块高度固定（出牌区预留两排、手牌区固定两排），所以位置稳定不跳。 */
.mid-info {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--gap-1);
}
.mid-info .call-btn { pointer-events: auto; }

/* 底牌 / 叫地主按钮 + 单行提示同一行：不占两行，也不改变高度 */
.bottom-row {
  --bw: clamp(22px, 7.2vw, 40px);
  display: flex; align-items: center; justify-content: center; flex-wrap: nowrap;
  gap: clamp(6px, 2.2vw, 14px);
  /* 高度按底牌卡片定死（比叫地主按钮略高），任何状态切换都不改变布局高度 */
  min-height: calc(var(--bw) * 1.42 + 2px);
}
.bottom-row .mid-msg { flex: 0 1 auto; min-width: 0; }

/* 两行信息块：上行「玩法 · 房间输赢」，下行「出牌/提示」。开场就有欢迎语占位，绝不改变高度 */
.mid-lines {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; min-width: 0; max-width: 100%;
}
/* 叫地主时：这块让位给「不叫 / 叫地主」按钮，整行高度仍由底牌决定 */
.mid-lines.calling .mid-msg { display: none; }
.mid-info-line {
  display: flex; align-items: center; gap: 2px;
  font-size: clamp(10px, 2.9vw, 13px); color: #93a3bd; font-weight: 700;
  white-space: nowrap; overflow: hidden; max-width: 100%;
  line-height: 1.25;
}
.info-btn {
  background: transparent; border: none; padding: 0; cursor: pointer;
  font: inherit; color: inherit; font-weight: 700;
  border-bottom: 1px dashed #55688c; touch-action: manipulation;
}
.info-btn:hover { color: #cfe0ff; border-bottom-color: #7f9ad0; }
.info-btn b { color: var(--gold); }
.info-dot { color: #55617a; }

/* 通用确认弹窗 */
#confirmModal { z-index: 320; }
.confirm-box { text-align: center; max-width: min(88vw, 380px); }
.confirm-box .confirm-ico { font-size: clamp(24px, 7vw, 34px); line-height: 1; margin-bottom: 6px; }
.confirm-box .modal-title { text-align: center; }
.confirm-text {
  margin: 10px 0 4px; font-size: clamp(12.5px, 3.6vw, 14.5px); line-height: 1.7;
  color: #b9c6dd; white-space: pre-line;
}
.confirm-box .modal-actions { justify-content: center; }

/* 规则说明弹窗正文 */
.rules-body { margin: 10px 0 0; }
.rules-body .rules-game { font-size: clamp(14px, 4vw, 17px); font-weight: 800; margin: 0 0 6px; color: #dbe6f7; }
.rules-body .rules-text { white-space: pre-line; font-size: clamp(12px, 3.5vw, 14px); line-height: 1.7; color: #b9c6dd; margin: 0; }

/* 房间输赢弹窗：自己那一行高亮 */
#roomResultBody tbody tr.me-row { background: rgba(79, 124, 255, 0.14); }
#roomResultBody tbody tr.me-row td { font-weight: 800; }

/* 底牌：叫地主结束后亮在「基础分」下面，三家都看得见 */
.bottom-cards {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(4px, 1.4vw, 10px);
}
.bottom-cards .bottom-label { font-size: clamp(10px, 2.9vw, 13px); color: #8f9fbb; font-weight: 700; }
.bottom-cards .pc {
  width: var(--bw); height: calc(var(--bw) * 1.42);
  border-radius: calc(var(--bw) * 0.14);
  background: linear-gradient(#fff, #eef2f8); color: #16223a;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start;
  padding: calc(var(--bw) * 0.07) 0 0 calc(var(--bw) * 0.12);
  font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); border: 1px solid #cdd7e6;
}
.bottom-cards .pc .r { font-size: calc(var(--bw) * 0.46); line-height: 1; }
.bottom-cards .pc .s { font-size: calc(var(--bw) * 0.36); line-height: 1; margin-top: 1px; }
.bottom-cards .pc.red { color: #d5342c; }
/* 底牌背面：开局先用三张背面占位，开牌时翻过来 */
.bottom-cards .pc.back {
  background: linear-gradient(150deg, #3b6bd6, #1d3a7d);
  border: 1px solid #6f93e0;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.14), 0 2px 6px rgba(0, 0, 0, 0.45);
  position: relative; padding: 0;
}
.bottom-cards .pc.back::after {
  content: ''; position: absolute; inset: 20% 20% 20% 20%;
  border-radius: 3px;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.3) 0 2px, transparent 2px 5px);
}
@keyframes cardFlip {
  from { transform: rotateY(90deg); }
  to { transform: rotateY(0deg); }
}
.bottom-cards .pc.flip { animation: cardFlip 0.45s ease-out both; }

/* 底牌弹层（美化）：标题带金线、三张牌放大居中、柔和光晕、关闭按钮弱化 */
.bottom-modal-title { text-align: center; letter-spacing: 3px; margin-bottom: 6px; }
.bottom-modal-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 2px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(245, 181, 68, 0), var(--gold), rgba(245, 181, 68, 0));
}
.bottom-modal-body {
  --bw: clamp(48px, 16vw, 68px);
  position: relative;
  z-index: 1;
  gap: clamp(8px, 3.4vw, 16px);
  padding: 6px 0 2px;
}
.bottom-modal-body::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 230px;
  height: 130px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(245, 181, 68, 0.16), rgba(245, 181, 68, 0) 70%);
  pointer-events: none;
}
.bottom-modal-body .pc {
  border-radius: calc(var(--bw) * 0.12);
  box-shadow: 0 12px 24px -14px rgba(0, 0, 0, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.bottom-modal .modal-actions { justify-content: center; }
.bottom-modal .modal-actions .btn { flex: 0 0 auto; min-width: 132px; }

.plate {
  background: rgba(10, 18, 34, 0.72); border: 1px solid #2b3d5f; border-radius: 999px;
  padding: clamp(2px, 0.45vh, 6px) clamp(10px, 4vw, 24px);
  line-height: 1.25;
  font-size: var(--fs-plate); color: #adc2ff; white-space: nowrap;
}
.plate b { color: var(--gold); font-size: calc(var(--fs-plate) * 1.1); }
/* 牛牛：场次条里的「点【准备】开始」提示，比正文小一号 */
.plate .plate-hint { color: #e7d3a2; font-size: calc(var(--fs-plate) * 0.62); font-weight: 600; letter-spacing: 0; }
/* 场次条里的房间号：和正文一样大（稍微亮一点，方便一眼找到） */
.plate .plate-id { font-size: 1em; color: #c7d6ef; font-weight: 600; }
.call-actions { display: flex; align-items: center; gap: clamp(6px, 2.4vw, 12px); }
.call-btn {
  min-width: clamp(64px, 21vw, 118px); padding: clamp(4px, 0.85vh, 9px) clamp(10px, 3.8vw, 22px);
  border-radius: 10px; border: none; font-size: clamp(13px, 4vw, 17px); font-weight: 800; line-height: 1.2; cursor: pointer;
}
.call-btn.no { background: rgba(255, 255, 255, 0.1); border: 1px solid #3f5680; color: #dbe6f7; }
.call-btn.yes { background: linear-gradient(180deg, #ffb64d, #e08a12); color: #3b2503; }

/* 第二行提示：固定占位（有没有消息高度都不变），两行信息块里靠左对齐 */
.mid-msg {
  display: flex; align-items: center; justify-content: center;
  min-height: clamp(14px, 2.6vh, 24px); max-width: 100%; padding: 0 clamp(7px, 2.2vw, 13px);
  border-radius: 999px; font-size: var(--fs-msg); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(240, 85, 77, 0.18); border: 1px solid rgba(240, 85, 77, 0.5); color: #ff9a94;
}
/* 隐藏态：同样脱离文档流（只保留不可见），避免把中间的底牌挤偏 */
.mid-msg.off { position: fixed; visibility: hidden; }
.mid-msg.ok { background: rgba(53, 196, 122, 0.16); border-color: rgba(53, 196, 122, 0.45); color: #6fe0a5; }
.mid-msg.info { background: rgba(79, 124, 255, 0.16); border-color: rgba(79, 124, 255, 0.45); color: #adc2ff; }
/* 操作提示（要不起 / 没有能压过的牌 / 请先选好…）：改成屏幕正中的浮层，
   fixed 定位不占牌桌布局，出现/消失都不会把牌桌顶动 */
.mid-msg:not(.off) {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 31;
  max-width: min(86vw, 520px);
  min-height: 0;
  padding: 12px 24px;
  border-radius: 16px;
  /* 深色实底：浮在牌面上也能看清（原来是半透明，牌会透出来） */
  background: rgba(10, 17, 30, 0.97);
  border: 1px solid rgba(240, 85, 77, 0.8);
  color: #ffb8b2;
  font-size: clamp(14px, 4.2vw, 18px);
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  box-shadow: 0 22px 50px -18px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
  animation: midMsgPop 0.18s ease-out both;
}
.mid-msg.ok:not(.off) {
  background: rgba(8, 26, 20, 0.97);
  border-color: rgba(53, 196, 122, 0.8);
  color: #86f0bd;
}
.mid-msg.info:not(.off) {
  background: rgba(12, 20, 40, 0.97);
  border-color: rgba(79, 124, 255, 0.8);
  color: #c2d1ff;
}
@keyframes midMsgPop {
  from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* 十三水摆牌区 */
#ssZones { width: 100%; max-width: 900px; display: flex; flex-direction: column; gap: var(--gap-1); }
.zones { display: grid; grid-template-columns: 1fr; gap: var(--gap-1); width: 100%; }
.zone { border: 1.5px dashed var(--line); border-radius: calc(var(--card-w) * 0.2); padding: clamp(4px, 1vh, 8px) clamp(6px, 1.8vw, 12px); background: rgba(19, 28, 46, 0.7); }
.zone.full { border-style: solid; border-color: rgba(79, 124, 255, 0.5); }
.zone-head { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-coin); color: var(--muted); margin-bottom: 4px; }
.zone .cards { padding-left: calc(var(--card-w) * 0.5); min-height: calc(var(--card-h) * 0.8); }
.zone-acts { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* —— 我本轮出的牌 + 我的账户信息 —— */
.my-play {
  position: relative;
  width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: var(--gap-1);
  /* 固定一张牌的高度：出牌 / 不要 / 还没出牌 都不改变布局（防止整屏上下跳） */
  min-height: calc(var(--card-h) + 6px);
}
/* 牌面绝对定位贴底：长牌（两排）向上叠，不再撑高布局 */
.my-play > .cards,
.my-play > .cards-rows {
  position: absolute; left: 0; right: 0; bottom: 0;
}
.my-play .cards { justify-content: center; }
.my-play .cards-rows { align-items: center; }
.my-account {
  display: flex; align-items: center; gap: clamp(6px, 2.4vw, 14px);
  padding: clamp(2px, 0.7vh, 7px) clamp(10px, 4vw, 20px) clamp(4px, 1.2vh, 14px);
}
.who { display: flex; align-items: center; gap: clamp(6px, 2.4vw, 13px); min-width: 0; flex-wrap: wrap; }
.my-name { font-size: var(--fs-name); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-account .badge { font-size: var(--fs-badge); padding: 2px clamp(5px, 2vw, 11px); }
.coin { font-size: var(--fs-coin); font-weight: 800; color: var(--gold); white-space: nowrap; }

/* 倒计时圆环 */
.ring {
  position: absolute; top: 50%; transform: translateY(-50%);
  right: calc(var(--ava) * -0.19); width: calc(var(--ava) * 0.6); height: calc(var(--ava) * 0.6);
}
.opp.right .ring { right: auto; left: calc(var(--ava) * -0.19); }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.ring circle { fill: #0f1a2e; stroke-width: 3; }
.ring .bg { stroke: #2b3d5f; }
.ring .fg { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; transition: stroke-dashoffset 0.95s linear; }
.ring b {
  position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800;
  font-size: calc(var(--ava) * 0.28); color: var(--gold); font-variant-numeric: tabular-nums;
}
.ring.low .fg { stroke: var(--red); }
.ring.low b { color: #ff9a94; }

/* —— 底部：手牌 + 操作 —— */
.mine { flex: 0 0 auto; background: linear-gradient(180deg, rgba(11, 18, 32, 0.5), rgba(11, 18, 32, 0.96)); border-top: 1px solid #22304d; }
.hand {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end;
  /* 固定高度（两排预算）：手牌数量变化不会带动上方元素上下跳 */
  height: var(--hand-zone);
  padding: clamp(4px, 1vh, 10px) clamp(6px, 2vw, 16px) clamp(4px, 1.2vh, 12px) calc(var(--hand-w) * 0.6);
  row-gap: 4px; overflow: hidden;
}
.c {
  width: var(--hand-w); height: var(--hand-h); margin-left: calc(var(--hand-w) * -0.32); flex: 0 0 auto;
  border-radius: calc(var(--hand-w) * 0.12);
  background: linear-gradient(170deg, #fff, #e6ecf7); color: #16203a; border: 1px solid #b9c4d6;
  box-shadow: 0 6px 12px -7px rgba(0, 0, 0, 0.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: manipulation; transition: transform 0.12s, box-shadow 0.12s;
}
.c .r { font-size: calc(var(--hand-w) * 0.38); line-height: 1; }
.c .s { font-size: calc(var(--hand-w) * 0.3); line-height: 1.05; }
.c.red { color: #d5342c; }
.c.sel { transform: translateY(calc(var(--hand-h) * -0.19)); box-shadow: 0 0 0 2px var(--gold), 0 12px 18px -10px #000; }
.c.dis { cursor: default; opacity: 0.9; }
/* 等待开局的牌背（占住手牌位置） */
/* 牌背统一样式：座位 / 桌面 / 手牌 一致 */
.pc.back {
  cursor: default;
  position: relative;
  background: linear-gradient(150deg, #3b6bd6, #1d3a7d);
  border-color: #6f93e0;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14), 0 6px 12px -7px rgba(0, 0, 0, 0.85);
}
.pc.back::after {
  content: '';
  position: absolute;
  inset: 18% 20% 18% 20%;
  border-radius: 2px;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.3) 0 2px, transparent 2px 5px);
}

.c.back {
  cursor: default; position: relative;
  background: linear-gradient(150deg, #3b6bd6, #1d3a7d); border-color: #6f93e0;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14), 0 6px 12px -7px rgba(0, 0, 0, 0.85);
}
.c.back::after {
  content: ''; position: absolute; inset: 18% 20% 18% 20%;
  border-radius: 2px;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.3) 0 2px, transparent 2px 5px);
}
/* 发牌：逐张翻开 */
@keyframes handReveal {
  from { transform: rotateY(90deg); opacity: 0.4; }
  to { transform: rotateY(0deg); opacity: 1; }
}
.c.reveal { animation: handReveal 0.32s ease-out both; }

.mybar {
  display: flex; align-items: center; gap: clamp(2px, 0.8vw, 7px); flex-wrap: nowrap;
  padding: clamp(3px, 0.8vh, 6px) clamp(4px, 1.2vw, 12px) calc(clamp(6px, 1.6vh, 16px) + var(--safe-b));
}
.mybar .my-tools { display: flex; align-items: center; gap: clamp(3px, 1vw, 7px); padding-left: clamp(2px, 0.8vw, 6px); }
.my-tools { display: flex; gap: clamp(3px, 1vw, 7px); }
.tool {
  padding: clamp(5px, 1vh, 8px) clamp(7px, 2.3vw, 14px); border-radius: 999px;
  font-size: clamp(11px, 3.1vw, 14px); font-weight: 700;
  background: rgba(255, 255, 255, 0.08); border: 1px solid #3f5680; color: #dbe6f7;
  cursor: pointer; touch-action: manipulation;
}
.tool.on { background: var(--gold); border-color: var(--gold); color: #3b2503; }
/* 玩法 / 房间输赢：底部信息按钮（和「托管」并排，紧凑蓝色胶囊） */
.tool.info {
  display: inline-flex; align-items: center; gap: 2px; white-space: nowrap;
  padding: clamp(4px, 0.85vh, 7px) clamp(6px, 1.9vw, 10px);
  font-size: clamp(10.5px, 2.9vw, 13px); font-weight: 700;
  background: rgba(79, 124, 255, 0.14); border-color: rgba(79, 124, 255, 0.45); color: #adc2ff;
}
.tool.info .ico { font-size: 1.05em; line-height: 1; }
.tool.info b { color: var(--gold); }
.tool.info:hover { background: rgba(79, 124, 255, 0.26); }
/* 防连点：按钮提交中（禁用 + 变暗） */
.btn.busy, .tool.busy, .call-btn.busy { opacity: 0.55; pointer-events: none; }
.tool:disabled, .call-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* 引导脉冲（例如"要不起"按钮） */
.pulse { animation: btnPulse 0.6s ease-in-out 3; }
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 181, 68, 0.65); }
  50% { box-shadow: 0 0 0 8px rgba(245, 181, 68, 0); }
}
/* 操作条按钮：越南语等长文案也要一行放下 → 不换行、内边距更紧、字号随屏缩放 */
.mybar .btn {
  flex: 0 0 auto; white-space: nowrap;
  padding: clamp(4px, 1.5vw, 14px);
  padding-top: clamp(5px, 1vh, 8px);
  padding-bottom: clamp(5px, 1vh, 8px);
  font-size: clamp(10px, 2.9vw, 13.5px);
}
.mybar .tool {
  white-space: nowrap;
  padding-left: clamp(5px, 1.7vw, 14px);
  padding-right: clamp(5px, 1.7vw, 14px);
  padding-top: clamp(5px, 1vh, 8px);
  padding-bottom: clamp(5px, 1vh, 8px);
  font-size: clamp(10px, 2.9vw, 14px);
}
.mybar .my-tools { padding-left: 0; }

/* ============================ 六、弹窗 / 提示 ============================ */

.modal {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 12px;
  background: rgba(4, 8, 16, 0.75); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.modal.open { display: flex; }
.modal-box {
  width: 100%; max-width: 460px; max-height: 88vh; max-height: 88dvh; overflow-y: auto;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; box-shadow: var(--shadow);
}
.modal-box.wide { max-width: 720px; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.captcha-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.captcha-row input { flex: 1 1 120px; min-width: 0; }
.captcha-img {
  width: 132px; height: 42px; border-radius: 8px; flex: 0 0 auto;
  border: 1px solid var(--line); background: #101b2e;
}
.captcha-row .btn { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 420px) {
  .captcha-img { width: 116px; height: 38px; }
}

.perm-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
  margin-top: 6px; max-height: 230px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.03);
}
.perm-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 6px; border-radius: 7px; font-size: 12px; color: var(--text);
  cursor: pointer;
}
.perm-item:hover { background: rgba(79,124,255,.1); }
.perm-item input { width: auto; margin: 0; }
.perm-item.disabled { opacity: .55; cursor: not-allowed; }
.permission-tree { display: flex; flex-direction: column; gap: 9px; margin: 14px 0; }
.perm-category {
  margin: 10px 0 1px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--primary-l); text-transform: uppercase;
}
.perm-category:first-child { margin-top: 0; }
.perm-group {
  border: 1px solid var(--line); border-radius: 11px;
  background: rgba(255,255,255,.025); padding: 9px 11px;
}
.perm-group-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.perm-group-head input { width: auto; margin: 0; }
.perm-children {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px 12px; margin: 7px 0 0 24px;
}
.perm-children .perm-item { padding: 3px 5px; }
@media (max-width: 760px) {
  .perm-children { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-left: 18px; }
}
@media (max-width: 460px) {
  .perm-children { grid-template-columns: 1fr; }
}
.support-content { font-size: 14px; line-height: 1.7; color: var(--text); word-break: break-word; }
.support-content p { margin: 0 0 8px; }
.support-content p:last-child { margin-bottom: 0; }
.support-content h2, .support-content h3, .support-content h4 { margin: 8px 0 6px; color: #fff; }
.support-content ul, .support-content ol { margin: 6px 0; padding-left: 20px; }
.support-content a { color: var(--primary-l); text-decoration: underline; }
.support-content img {
  display: block; max-width: 100%; height: auto; margin: 10px auto;
  border-radius: 10px;
}
.support-content .muted { color: var(--muted); }
.home-ad-content { font-size: 14px; line-height: 1.7; color: var(--text); word-break: break-word; }
.home-ad-content p { margin: 0 0 10px; }
.home-ad-content p:last-child { margin-bottom: 0; }
.home-ad-content h2, .home-ad-content h3, .home-ad-content h4 { margin: 10px 0 8px; color: #fff; }
.home-ad-content ul, .home-ad-content ol { margin: 8px 0; padding-left: 22px; }
.home-ad-content a { color: var(--primary-l); text-decoration: underline; }
.home-ad-content img {
  display: block; max-width: 100%; height: auto; margin: 10px auto;
  border-radius: 10px;
}
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

.toasts {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 400;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  max-width: calc(100vw - 24px); max-height: 90dvh;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  max-width: min(86vw, 360px); width: fit-content;
  padding: 11px 16px; border-radius: 14px;
  font-size: 13.5px; font-weight: 600; line-height: 1.35; color: #eef3ff;
  background: rgba(26, 38, 62, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: toastIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast-msg { min-width: 0; }
.toast-ico {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; line-height: 1;
  background: rgba(255, 255, 255, 0.12);
}
/* 类型：整圈 1px 类型色描边 + 图标底衬同色（取代原来左侧色条） */
.toast.err { border-color: rgba(240, 85, 77, 0.55); }
.toast.err .toast-ico { background: rgba(240, 85, 77, 0.22); }
.toast.ok { border-color: rgba(53, 196, 122, 0.55); }
.toast.ok .toast-ico { background: rgba(53, 196, 122, 0.22); }
.toast.warn { border-color: rgba(245, 181, 68, 0.55); }
.toast.warn .toast-ico { background: rgba(245, 181, 68, 0.22); }
.toast.info { border-color: rgba(79, 124, 255, 0.5); }
.toast.info .toast-ico { background: rgba(79, 124, 255, 0.22); }
/* 不支持毛玻璃时用纯色回退，保证可读 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .toast { background: rgba(26, 38, 62, 0.96); }
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(0.94); } }
.toast.leaving { animation: toastOut 0.2s ease forwards; }

.settle-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.settle-row .grow { flex: 1; min-width: 0; }

/* ============================ 七、结构性断点（只改布局，不改尺寸） ============================ */

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
  .grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
  .grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .content { padding: 20px; }

  .layout { flex-direction: row; }
  .sidebar {
    flex-direction: column; width: 210px; flex-shrink: 0;
    border-bottom: none; border-right: 1px solid var(--line);
    overflow-x: visible; padding: 14px 10px;
  }
  .nav-btn { text-align: left; }

  .topbar { padding: 12px 20px; gap: 12px; }
  .topbar .brand { font-size: 19px; }

  /* 牌桌：桌面把出牌区收窄居中，避免左右散得太开 */
  .opps { max-width: var(--content-max); margin: 0 auto; width: 100%; }
  .table-plays { max-width: var(--content-max); margin: 0 auto; }
  .zones { grid-template-columns: repeat(3, 1fr); gap: var(--gap-2); }
}

@media (min-width: 1200px) {
  .content { padding: 24px; }
}

/* 横屏矮屏：压缩中央留白，保证手牌始终可见 */
@media (max-height: 460px) and (orientation: landscape) {
  .table-plays { padding-top: 4px; }
  .my-play .cards { display: none; }
}

/* ============================ 九、十三水：上下左右四家（对齐 App / 参考图） ============================ */
/* 斗地主专用的「出牌区」在十三水不显示；「我本轮出的牌」由 JS 控制显隐（有摊牌才显示） */
.game-shuisan .table-plays { display: none; }

/* 四家座位：上 / 左 / 右（我固定在下方） */
.game-shuisan .opps {
  height: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  display: block;
  overflow: visible;
}
.game-shuisan .opps .opp {
  position: fixed;
  z-index: 6;
  width: clamp(120px, 26vw, 300px);
}
.game-shuisan .opps .opp.ss-seat-top {
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  width: clamp(140px, 34vw, 300px);
}
/* 十三水：本房战绩榜（贴在「我」账户右边，按积分实时排序） */
.ss-score { display: none; }
.game-shuisan .ss-score {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
  max-width: 44vw;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(19, 28, 46, 0.82);
  border: 1px solid var(--line);
}
.ss-score-head { font-size: 11px; color: var(--muted); }
.ss-score-row { display: flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1.35; }
.ss-score-ava { flex: 0 0 auto; }
.ss-score-ava.avatar-img { width: 22px; height: 22px; }
.ava > .avatar-img { width: 82%; height: 82%; }
.ss-score-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #dbe6f7; }
.ss-score-pts { flex: 0 0 auto; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.ss-score-pts.pos { color: #4ee08a; }
.ss-score-pts.neg { color: #ff9b9b; }
.ss-score-pts.zero { color: #8f9fbb; }
.ss-score-row.me .ss-score-name { color: var(--gold); font-weight: 800; }
/* 自己那行加一层淡底，别用 .mine（那是底部操作条的类，会带上深色背景+边框） */
.ss-score-row.me { background: rgba(245, 181, 68, 0.12); border-radius: 6px; }
/* 场次信息（每道分/倍数/局数/已准备）：置顶，放在「上一家」上面 */
.game-shuisan .plate {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
}
/* 十三水：上方那家的「已准备/踢出」放到座位框右边（原来在框下方，会被摊牌的三道牌盖住） */
.game-shuisan .opp.ss-seat-top .seat-foot {
  left: calc(100% + 6px);
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  max-width: calc(50vw - 76px);
  flex-wrap: wrap;
  justify-content: flex-start;
  row-gap: 4px;
  z-index: 9;
}
.game-shuisan .opps .opp.ss-seat-left { left: 8px; top: 54%; transform: translateY(-50%); }
.game-shuisan .opps .opp.ss-seat-right { right: 8px; top: 54%; transform: translateY(-50%); }
/* 房号挪到标题里，中央的「结果」按钮在十三水隐藏 */
.game-shuisan .opps .opp-center { display: none; }

/* 中间留给三道摆牌区（上方必须让开「顶座位」面板：顶座位底边约 152px，mid 顶 47px） */
.game-shuisan .mid {
  padding-top: 116px;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden; /* 不上下滚动（否则会滑到固定座位下面被盖住） */
}
/* 结算摊牌时顶部座位的三道会垂下来，再让出高度 */
.game-shuisan.ss-settled .mid { padding-top: 224px; }
.game-shuisan .mid-info { padding-top: 4px; }

/* 大老二：和十三水一样的十字座位（上/左/右 + 我） */
.game-tienlen .opps { height: 0; min-height: 0; padding: 0; margin: 0; display: block; overflow: visible; }
.game-tienlen .opps .opp { position: fixed; z-index: 6; width: clamp(120px, 26vw, 300px); }
.game-tienlen .opps .opp.ss-seat-top {
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  width: clamp(180px, 46vw, 420px);
}
.game-tienlen .opps .opp.ss-seat-left { left: 8px; top: 54%; transform: translateY(-50%); }
.game-tienlen .opps .opp.ss-seat-right { right: 8px; top: 54%; transform: translateY(-50%); }
.game-tienlen .opps .opp-center { display: none; }
/* 大老二：中间信息条置顶（字号小一点，带上房间号） */
.game-tienlen .plate {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  font-size: clamp(11px, 3.1vw, 13px);
  padding: 3px 12px;
}
/* 斗地主：场次信息（基础分 / 倍数 / 局数）独立一行，置顶放在座位上方 */
.game-doudizhu .plate {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  font-size: clamp(13px, 3.9vw, 17px);
  padding: 4px 15px;
}
.game-doudizhu .plate b { font-size: 1.2em; }
/* 牌局中：底牌精确居中（提示语改成屏幕正中的浮层，见 .mid-msg 规则） */
.game-doudizhu .bottom-row { position: relative; }
/* 提示语已脱离文档流，这里让它的容器不参与布局，底牌才真正居中 */
.game-doudizhu .bottom-row .mid-lines { display: contents; }
/* 座位整体下移，给顶部信息条让出一行 */
.game-doudizhu .opps { padding-top: 40px; }
/* 大老二：十字布局后，出牌区不再单独占一行（准备/踢人已放进座位里） */
.game-tienlen .table-plays { display: none; }
/* 大老二：13 张手牌强制一排（略缩牌宽以适配屏宽），上方留 15px 间距 */
.game-tienlen .hand {
  --hand-w: clamp(22px, 7.8vw, 42px);
  --hand-h: calc(var(--hand-w) * 1.4);
  height: auto;
  min-height: calc(var(--hand-h) + 8px);
  padding-top: 15px;
  padding-bottom: 4px;
  flex-wrap: nowrap;
}
/* 手牌上方的小工具条（斗地主查底牌） */
.hand-tools { display: flex; justify-content: center; gap: 8px; padding: 3px 0 1px; }
.hand-tools.hidden { display: none; }
/* 大老二：座位里显示本轮出的牌（浮在座位「上方」，不挤压座位框） */
.game-tienlen .opp .round-play {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 5px);
  margin-top: 0;
  z-index: 7;
  pointer-events: none;
  display: flex;
  justify-content: center; /* 「过」也居中显示在座位正上方 */
}
/* 上方那家：牌/「过」放在座位框下方（贴紧一点，原来留 36px 给「已准备/踢出」那行） */
.game-tienlen .opp.ss-seat-top .round-play {
  top: calc(100% + 4px);
  bottom: auto;
}
.game-tienlen .opp .round-play .cards {
  --card-w: clamp(28px, 7.2vw, 40px);
  --card-h: calc(var(--card-w) * 1.42);
  padding-left: 0;
  gap: 0;
  row-gap: 0;
  justify-content: center;
  flex-wrap: nowrap; /* 尽量一行显示 */
  max-width: none;
}
/* 多张时像手牌一样叠起来（露出左上角点数），一行放得下 */
.game-tienlen .opp .round-play .cards .pc {
  margin-left: calc(var(--card-w) * -0.4);
}
.game-tienlen .opp .round-play .cards .pc:first-child { margin-left: 0; }
/* 左右两家也居中（不贴边） */
.game-tienlen .opp .round-play .cards .pc { margin-left: 0; }
.game-tienlen .opp .round-play .play-status,
.game-tienlen .my-play .play-status {
  font-size: 13px;
  font-weight: 800;
  color: #cbd8ee;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(30, 43, 66, 0.92);
  border: 1px solid #3f5680;
  box-shadow: 0 4px 10px -6px #000;
  letter-spacing: 1px;
}
/* 牛牛：结算明细（每家 5 张牌 + 牛几 + 输赢） */
/* 牛牛摊牌：牌型/得分放最上面，5 张牌在下面，左右留边距、牌叠压得更紧 */
.game-tienlen .opp .round-play.nn-reveal {
  flex-direction: column-reverse; /* DOM 是「牌 + 结果」，反过来 → 结果在上、牌在下 */
  align-items: center;
  gap: 3px;
  left: 10px;
  right: 10px;
  box-sizing: border-box;
}
.game-tienlen .opp .round-play.nn-reveal .cards {
  flex-wrap: nowrap;
  justify-content: center;
  max-width: 100%;
}
.game-tienlen .opp .round-play.nn-reveal .cards .pc {
  flex: 0 0 auto;
  margin-left: -13px;
}
.game-tienlen .opp .round-play.nn-reveal .cards .pc:first-child { margin-left: 0; }
/* 上方那家：牌紧贴座位框、结果在牌下面（保持原来的位置，不跟着结果上下移动） */
.game-tienlen .opp.ss-seat-top .round-play.nn-reveal { flex-direction: column; }
/* 牛牛：屏幕正中那块小卡片 —— 「开奖倒计时」和「下一局庄家」共用同一位置和尺寸，
   两者切换时不会一上一下、也不会大小跳动 */
.nn-countdown,
.nn-next-banker {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-sizing: border-box;
  min-width: 84px;
  min-height: 46px;
  padding: 4px 12px;
  border-radius: 11px;
  white-space: nowrap;
  pointer-events: none;
}

/* 牛牛：下一局庄家（两行：标题 + 名字） */
.nn-next-banker {
  z-index: 24;
  background: rgba(10, 18, 34, 0.72);
  border: 1px solid #2b3d5f;
}
.nn-next-banker .lbl { font-size: 11px; color: #8fa3c4; letter-spacing: 0.5px; }
.nn-next-banker .name { font-size: 14px; font-weight: 800; color: var(--gold); }
.nn-next-banker.hidden { display: none; }

/* 牛牛：右侧座位贴边（和左侧对称，原来的 32px 右边距太大） */
.game-niuniu .opps .opp.ss-seat-right { right: 8px; }
/* 牛牛：上方那家的「未准备/踢出」放到座位框右边（不再占牌的上方/下方空间） */
.game-niuniu .opps .opp.ss-seat-top { width: clamp(140px, 34vw, 300px); }
.game-niuniu .opp.ss-seat-top .seat-foot {
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  width: max-content;              /* 绝对定位 + left：不写死会被父容器宽度挤成多行 */
  max-width: calc(50vw - 76px);   /* 窄屏不顶出屏幕，必要时自动换行 */
  flex-wrap: wrap;
  justify-content: flex-start;
  row-gap: 4px;
  z-index: 8;
}
/* 「未准备/踢出」移到右侧后，牌可以紧贴座位框（不用再留 36px 给按钮） */
.game-niuniu .opp.ss-seat-top .round-play { top: calc(100% + 5px); }

.nn-row { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-bottom: 1px solid #22304d; }
.nn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.nn-name { font-weight: 700; color: #dbe6f7; }
.nn-bull { color: var(--gold); font-weight: 800; }
.nn-cards { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
.nn-cards .pc {
  width: 26px;
  height: 37px;
  border-radius: 4px;
  padding: 2px 0 0 3px;
  background: linear-gradient(170deg, #fff, #e6ecf7);
  color: #16203a;
  border: 1px solid #b9c4d6;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-weight: 800;
  flex: 0 0 auto;
}
.nn-cards .pc.red { color: #d5342c; }
.nn-cards .pc .r { font-size: 13px; line-height: 1; }
.nn-cards .pc .s { font-size: 11px; line-height: 1.05; }

/* 牛牛下注倍数：醒目金色胶囊 */
.opp-name > .bet-badge {
  background: rgba(245, 181, 68, 0.22);
  border: 1px solid rgba(245, 181, 68, 0.65);
  color: var(--gold);
  font-weight: 800;
  font-size: 11.5px;
  padding: 1px 8px;
}
/* 「准备」按钮加大：手机上好按（其它按钮保持紧凑） */
.mybar .btn[data-action="ready"] {
  padding: clamp(9px, 2.1vh, 13px) clamp(16px, 5.4vw, 30px);
  font-size: clamp(14px, 4vw, 17px);
  font-weight: 800;
  min-width: 88px;
  border-radius: 12px;
}

/* 牛牛：庄家徽标（金色渐变 + 描边 + 光晕，一眼看出谁是庄） */
.opp-name > .badge.banker,
#myAccount .badge.banker {
  background: linear-gradient(180deg, #ffc85e, #e3951f);
  color: #3b2503;
  font-weight: 900;
  font-size: 12px;
  padding: 1px 9px;
  border: 1px solid #ffe3a3;
  box-shadow: 0 0 0 2px rgba(245, 181, 68, 0.28), 0 4px 10px -6px #000;
  letter-spacing: 1px;
}

/* 牛牛开奖倒计时 */
.nn-countdown {
  z-index: 30;
  flex-direction: row;   /* 图标 + 数字 排成一行（和之前一样） */
  gap: 6px;
  background:
    radial-gradient(140% 140% at 50% 0%, rgba(245, 181, 68, 0.20) 0%, rgba(11, 18, 32, 0.96) 62%);
  border: 1px solid rgba(245, 181, 68, 0.55);
  box-shadow: 0 12px 28px -16px rgba(0, 0, 0, 0.9), inset 0 0 14px rgba(245, 181, 68, 0.10);
  animation: nnCountPop 0.26s ease-out both;
}
.nn-countdown b {
  font-size: 34px;
  line-height: 1;
  color: var(--gold);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  min-width: 1ch;
  text-align: center;
  text-shadow: 0 0 12px rgba(245, 181, 68, 0.45);
}
.nn-countdown .nn-clock { font-size: 21px; line-height: 1; filter: drop-shadow(0 0 6px rgba(245, 181, 68, 0.35)); }
@keyframes nnCountPop {
  from { transform: translate(-50%, -50%) scale(0.84); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
/* 牛牛：牌型 + 本局得分同一行 */
.nn-foot { display: flex; align-items: center; justify-content: center; gap: 6px; }
/* 牌背阶段用来占住「牛几 + 得分」那一行的高度，翻牌时牌不会上下移动 */
.nn-foot.ghost { height: 24px; visibility: hidden; }

/* 牛牛摊牌旁的「本局得分」 */
.nn-delta { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nn-delta.pos { color: #4ee08a; }
.nn-delta.neg { color: #ff9b9b; }
.nn-countdown.hidden { display: none; }

/* 牛牛：自己上方结果区固定高度，出现/消失不改变页面布局（避免上下跳） */
.game-tienlen .my-play { height: calc(var(--card-h) + 26px); min-height: 0; overflow: visible; }

/* 牛牛：提示语合并进中间场次条，不再单独占一行 */
/* 牛牛：欢迎语已并入中间场次条，这里只隐藏欢迎语；操作提示/错误仍然显示 */
.game-niuniu .mid-msg:not(.live),
.game-shuisan .mid-msg:not(.live) { display: none; }

/* 牛牛：手牌区高度固定（牌背↔明牌切换不改变布局，避免倒计时上下跳） */
.game-niuniu .hand {
  height: calc(var(--hand-h) + 20px);
  min-height: 0;
  padding-top: 6px;
  padding-bottom: 4px;
  align-items: center;
}

/* 底牌：斗地主直接在牌桌中央显示（不再用「底牌」按钮 + 弹层），其它游戏不显示 */
#bottomCards { display: none !important; }
.game-doudizhu #bottomCards {
  display: flex !important;
  align-items: center;
  gap: clamp(6px, 2vw, 10px);
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(10, 18, 32, 0.62);
  border: 1px solid #2b3d5f;
}

/* 十三水：摆牌弹出层（三道说明 + 放入按钮）——浮在座位之上（座位 z6 / 场次条 z7），不会被遮住 */
.arrange-panel { display: none; }
.game-shuisan .arrange-panel {
  position: fixed;
  left: 50%;
  top: 158px; /* 让开顶栏(50~89)与顶座位(96~152) */
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(94vw, 560px);
  max-height: calc(100vh - 158px - 130px);
  overflow-y: auto;
  padding: 8px 10px 10px;
  border-radius: 14px;
  background: rgba(11, 18, 32, 0.97);
  border: 1px solid #2f4062;
  box-shadow: 0 18px 44px -18px #000;
}
/* 摆牌弹层底部：确认牌型按钮（吸底，弹层滚动时也一直看得到） */
.arrange-foot {
  position: sticky;
  bottom: 0;
  margin-top: 4px;
  padding: 8px 0 2px;
  background: linear-gradient(180deg, rgba(11, 18, 32, 0), rgba(11, 18, 32, 0.97) 45%);
}
.arrange-foot .btn { width: 100%; font-weight: 800; }
/* 弹层里三道铺满整宽、说明与牌都居中（桌面上那套「贴座位避让」的尺寸在这里不需要） */
.game-shuisan .arrange-panel .zone { width: 100%; margin: 0; position: relative; }
/* 三道说明里也用同一套「牌型 / 分值」胶囊（略小一号） */
.game-shuisan .zone .zone-cat,
.game-shuisan .zone .zone-pts { font-size: 11.5px; padding: 1px 8px; }
.game-shuisan .arrange-panel .zone-head { justify-content: center; gap: 8px; }
/* 每一道右上角的「放回」 */
.game-shuisan .zone .zone-back {
  position: absolute;
  right: 6px;
  top: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid #3f5680;
  background: rgba(255, 255, 255, 0.08);
  color: #cfe0ff;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.game-shuisan .zone .zone-back:hover { background: rgba(255, 255, 255, 0.18); }
.game-shuisan .zone.empty .zone-back { opacity: 0.45; }
.game-shuisan .zone .zone-back:disabled { opacity: 0.35; cursor: not-allowed; }
/* 弹层标题栏：左边「请摆牌」，中间摆牌进度（1/4），右边倒计时 + 关闭 */
.game-shuisan .arrange-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 0 2px 2px;
}
/* 摆牌进度：绝对居中，不参与左右布局 */
.game-shuisan .arrange-count {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid var(--line);
  color: #eaf1ff;
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  pointer-events: none;
}
.game-shuisan .arrange-count.hidden { display: none; }
.game-shuisan .arrange-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-coin);
  font-weight: 800;
  color: #dbe6f7;
}
/* 摆牌倒计时（提醒玩家还剩多久） */
.game-shuisan .arrange-timer {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(245, 181, 68, 0.14);
  border: 1px solid rgba(245, 181, 68, 0.4);
  color: var(--gold);
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.game-shuisan .arrange-timer i { font-style: normal; font-size: 11px; opacity: 0.85; }
.game-shuisan .arrange-timer.low {
  background: rgba(255, 92, 92, 0.18);
  border-color: rgba(255, 92, 92, 0.55);
  color: #ff9b9b;
  animation: btnPulse 0.9s ease-in-out infinite;
}
.game-shuisan .arrange-x {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #3f5680;
  background: rgba(255, 255, 255, 0.08);
  color: #cfe0ff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.game-shuisan .arrange-x:hover { background: rgba(255, 255, 255, 0.18); }
/* 越南规则：ăn trắng 提示条 */
.game-shuisan .arrange-white {
  padding: 4px 8px;
  border-radius: 8px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 800;
  background: rgba(245, 181, 68, 0.16);
  border: 1px solid rgba(245, 181, 68, 0.5);
  color: var(--gold);
  animation: btnPulse 1.4s ease-in-out infinite;
}

/* 底部：我的账户靠左、本房战绩靠右（整行铺开） */
.game-shuisan .my-account {
  width: 100%;
  justify-content: center; /* 头像+名字+积分+「查看房间成绩」整组居中 */
  gap: clamp(8px, 2.6vw, 16px);
  padding-left: clamp(6px, 2vw, 12px);
  padding-right: clamp(6px, 2vw, 12px);
  padding-bottom: 2px;   /* 贴近下方那条分隔线（原来最多留 14px） */
}
.game-shuisan .ss-score { margin-left: auto; } /* 本房战绩推到最右 */
/* 十三水账户行是居中的，「查看房间成绩」按钮跟着居中，不再被 margin-left:auto 推到最右 */
.game-shuisan #myAccount .room-stat-btn { margin-left: 0; }

/* 三道：竖排 + 便签式居中，牌按内容尺寸显示（绝不压缩/裁剪/换行） */.game-shuisan #ssZones {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.game-shuisan .zones {
  grid-template-columns: 1fr; /* 竖排：一排 5 张才有足够宽度 */
  flex: 0 0 auto;
  min-height: 0;
  gap: 6px;
}
.game-shuisan .zone {
  flex: 0 0 auto;
  min-height: 0;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  background: rgba(19, 28, 46, 0.5);
  /* 三道整体更紧凑：给「尾道」留出让开左右座位的高度 */
  padding-top: clamp(3px, 0.7vh, 6px);
  padding-bottom: clamp(3px, 0.7vh, 6px);
}
.game-shuisan .zone .zone-head { margin-bottom: 2px; }
.game-shuisan .zone .cards {
  flex: 0 0 auto;
  min-height: calc(var(--card-h) + 4px); /* 预留满一行：空的道和满的道一样高，摆牌时不跳 */
  overflow: visible; /* 关键：牌面完整显示，不裁掉 */
  flex-wrap: nowrap;
  justify-content: center;
  padding-left: 0;
}
.game-shuisan .zone .cards .pc { margin-left: -9px; }
.game-shuisan .zone .cards .pc:first-child { margin-left: 0; }

/* 摊牌：结算后把「该玩家的三道牌」摊在他座位下方 */
.ss-reveal {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;   /* 三道（3/5/5）居中对齐，不再左对齐 */
  gap: 2px;
  z-index: 8;
  pointer-events: none;
}
.ss-reveal .cards { padding-left: 0; flex-wrap: nowrap; row-gap: 0; }
.ss-reveal .pc {
  width: 24px;
  height: 34px;
  border-radius: 4px;
  padding: 2px 0 0 3px;
  margin-left: -6px;
  box-shadow: 0 2px 6px -3px rgba(0, 0, 0, 0.9);
}
.ss-reveal .cards .pc:first-child { margin-left: 0; }
.ss-reveal .pc .r { font-size: 13px; line-height: 1; }
.ss-reveal .pc .s { font-size: 11px; line-height: 1.05; }
/* 左右两家的摊牌放到座位上方，避免压到手牌 */
.ss-seat-left .ss-reveal,
.ss-seat-right .ss-reveal {
  top: auto;
  bottom: calc(100% + 5px);
}
/* 自己的摊牌：不用绝对定位，居中排在自己账户上方（注意别叫 mine——那是底部操作条的类） */
.ss-reveal.own {
  position: static;
  transform: none;
  align-items: center;
}
/* 十三水：摆牌阶段每家先摆 13 张盖住的牌（3/5/5），位置与结算摊牌一致，填补座位上方的空白 */
.ss-back { opacity: 0.92; }
.ss-back .cards { padding-left: 0; }
/* 每道后面跟「赢/输」徽标（结算后） */
.ss-reveal .ss-row { display: flex; align-items: center; gap: 6px; }
.ss-net { font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ss-net.pos { color: #4ee08a; }
.ss-net.neg { color: #ff9b9b; }
.ss-net.zero { color: #8f9fbb; }
/* 十三水：结算后名字旁边显示本局输赢（+20 / -20） */
.name-delta {
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  white-space: nowrap;
}
.name-delta.pos { color: #4ee08a; text-shadow: 0 0 8px rgba(78, 224, 138, 0.35); }
.name-delta.neg { color: #ff9b9b; text-shadow: 0 0 8px rgba(255, 155, 155, 0.28); }
.name-delta.zero { color: #8f9fbb; }
.game-shuisan .my-play { min-height: 0; }

/* 玩法说明：十三水牌型示例表 */
.ss-rules-table { width: 100%; border-collapse: collapse; margin-top: 2px; }
.ss-rules-table td { padding: 4px 6px; border-bottom: 1px solid #22304d; vertical-align: middle; }
.ss-rules-table tr:last-child td { border-bottom: 0; }
.ss-rules-table td.name { width: 72px; font-weight: 800; color: var(--gold); white-space: nowrap; }
.ss-rules-table td.demo .cards {
  --card-w: clamp(24px, 6.6vw, 34px);
  --card-h: calc(var(--card-w) * 1.42);
  padding-left: 0;
  gap: 3px;
  justify-content: flex-start;
}
.ss-rules-table td.demo .cards .pc { margin-left: 0; }
/* 特殊牌型示例：13 张一行，牌更小（手机也放得下） */
.ss-rules-table.whites td.name { width: 92px; }
.ss-rules-table.whites td.name .chi { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
.ss-rules-table.whites td.demo .cards {
  --card-w: clamp(15px, 4.2vw, 22px);
  --card-h: calc(var(--card-w) * 1.42);
  gap: 2px;
}
.ss-rules-table.whites td.demo .cards + .cards { margin-top: 3px; }

/* 「重置 / 放入头道 / 中道 / 尾道 / 查看牌型」按钮条：紧贴手牌上方，一行放下 */
#zoneActs {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  gap: clamp(4px, 1.4vw, 8px);
  padding: 6px 8px 0;
  background: linear-gradient(180deg, rgba(11, 18, 32, 0.25), rgba(11, 18, 32, 0.9));
}
/* 十三水手牌只有一行：容器贴合牌面，按钮才真正紧贴扑克牌。
   min-height 预留一行牌的高度：13 张全放进三道后手牌区也不塌陷，按钮不会上下跳 */
.game-shuisan .hand {
  height: auto;
  min-height: calc(var(--hand-h) + 8px);
  padding-top: 2px;
  padding-bottom: 4px;
}
#zoneActs .btn {
  white-space: nowrap;
  padding: clamp(5px, 1.1vh, 9px) clamp(6px, 2vw, 14px);
  font-size: clamp(11px, 2.9vw, 14px);
  font-weight: 700;
}
/* 查看牌型弹窗 */
.va-body { display: flex; flex-direction: column; gap: 10px; padding: 2px 0; }
.va-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 35, 56, 0.92), rgba(15, 23, 39, 0.92));
  border: 1px solid #2b3d5f;
}
.va-head { display: flex; align-items: center; gap: 8px; font-size: var(--fs-coin); color: var(--muted); }
.cat-chip {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #dbe6f7;
}
/* 牌型越大越显眼 */
.cat-chip.cat-8, .cat-chip.cat-7 { background: rgba(255, 92, 92, 0.18); border-color: rgba(255, 92, 92, 0.5); color: #ff9b9b; }
.cat-chip.cat-6, .cat-chip.cat-5 { background: rgba(198, 120, 255, 0.18); border-color: rgba(198, 120, 255, 0.5); color: #d7b3ff; }
.cat-chip.cat-4, .cat-chip.cat-3 { background: rgba(79, 124, 255, 0.18); border-color: rgba(79, 124, 255, 0.5); color: #adc2ff; }
.cat-chip.cat-2, .cat-chip.cat-1 { background: rgba(53, 196, 122, 0.16); border-color: rgba(53, 196, 122, 0.45); color: #6fe0a5; }
.cat-chip.cat-0 { background: rgba(143, 159, 187, 0.14); border-color: rgba(143, 159, 187, 0.35); color: #c3cede; }
.cat-chip.cat-empty { background: transparent; border-style: dashed; border-color: #3f5680; color: #6f7f9c; }
/* 这道值多少分 */
.pts-chip {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(245, 181, 68, 0.14);
  border: 1px solid rgba(245, 181, 68, 0.4);
  color: var(--gold);
}
.pts-chip.hot { background: rgba(255, 92, 92, 0.18); border-color: rgba(255, 92, 92, 0.55); color: #ff9b9b; }
.va-back {
  margin-left: auto; /* 贴右 */
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #3f5680;
  background: rgba(255, 255, 255, 0.08);
  color: #dbe6f7;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.va-back:hover { background: rgba(255, 255, 255, 0.18); }
.va-back:disabled { opacity: 0.4; cursor: not-allowed; }
/* 弹窗里的牌：放大、不重叠，方便核对牌型 */
.va-row .cards {
  --card-w: clamp(26px, 7.6vw, 40px);
  --card-h: calc(var(--card-w) * 1.42);
  padding-left: 0;
  gap: 3px;
}
.va-row .cards .pc { margin-left: 0; }
/* ============================ 八、宽屏内容约束（居中不铺满；手机端不受影响） ============================ */
/* 大厅内容：限制最大宽度并居中。
   （.content 的内边距不影响居中效果：居中后左边缘恒为 (视口 - 宽度)/2） */
.content > section {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}

/* 宽屏：顶栏 / 底栏 / 牌桌各条对齐到中间列（背景仍通栏） */
@media (min-width: 1060px) {
  .topbar,
  .tbl-top,
  .tabbar {
    padding-left: calc((100% - var(--content-max)) / 2);
    padding-right: calc((100% - var(--content-max)) / 2);
  }
  /* 手牌 / 操作条 / 我的账户：整体收窄居中（保留各自原有内边距） */
  .hand,
  .mybar,
  .my-account,
  .mid-info {
    width: 100%;
    max-width: var(--content-max);
    margin-left: auto;
    margin-right: auto;
  }
}


/* 掷骰子 */
.dice-page { min-height: 100vh; background: radial-gradient(700px 420px at 50% 46%, #1b3357 0%, #0c1526 72%); padding-bottom: 32px; }
.dice-wrap { max-width: 720px; margin: 0 auto; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.dice-wrap > .card + .card { margin-top: 0; padding: 10px 12px; }
.dice-wrap .card-title { margin-bottom: 8px; }
.dice-bet-head { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; flex-wrap: nowrap; }
.dice-bet-head .pill { justify-self: end; }
.dice-limit-btn {
  padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(245,181,68,.38);
  background: rgba(245,181,68,.1); color: var(--gold); font-size: 11.5px; font-weight: 700;
  line-height: 1.2; white-space: nowrap; cursor: pointer;
}
.dice-limit-btn:hover { background: rgba(245,181,68,.18); border-color: rgba(245,181,68,.65); }
.dice-status { text-align: center; padding: 8px 12px 8px; }
.dice-status-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 38px; min-height: 38px; }
.dice-status-head .badge { justify-self: end; }
.dice-status-head #dicePeriodNo {
  min-width: 0; overflow: visible; text-overflow: clip; white-space: nowrap;
  font-size: clamp(12px, 3.4vw, 16px); font-weight: 800; letter-spacing: .2px;
  color: #f6d58a; text-align: left; justify-self: start;
  width: fit-content; max-width: 100%;
  padding: 3px 8px; border-radius: 9px;
  border: 1px solid rgba(245,181,68,.24);
  background: linear-gradient(180deg, rgba(245,181,68,.14), rgba(245,181,68,.04));
  text-shadow: 0 1px 6px rgba(245,181,68,.22);
}
.dice-head-timer { justify-self: center; display: flex; align-items: center; gap: 5px; white-space: nowrap; height: 38px; min-height: 38px; }
.dice-head-timer.clock-mode { align-items: center; }
.dice-clock {
  position: relative; width: 38px; height: 38px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
}
.dice-clock-svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 0 5px rgba(245,181,68,.2)); }
.dice-clock-num {
  position: relative; z-index: 1; color: var(--gold); font-size: 14px; font-weight: 900;
  line-height: 1; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 6px rgba(245,181,68,.35), 0 1px 1px rgba(0,0,0,.75);
}
.dice-countdown { font-size: clamp(24px, 7vw, 34px); font-weight: 900; letter-spacing: .5px; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1; }
.dice-countdown.long { font-size: clamp(20px, 5.5vw, 28px); letter-spacing: 0; }
.dice-countdown-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.dice-status .btn-sm { padding: 6px 9px; font-size: clamp(10px, 2.6vw, 12.5px); }
.dice-status-actions { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 2px; height: 32px; min-height: 32px; flex-wrap: nowrap; }
.dice-status-actions .grow { flex: 1 1 0; min-width: 0; }
.dice-history-btn { color: var(--gold); border-color: rgba(245,181,68,.38); }
.dice-trend-legend { display: flex; align-items: center; gap: 12px; margin: 2px 0 10px; color: var(--muted); font-size: 12px; }
.dice-trend-legend .item { display: inline-flex; align-items: center; gap: 5px; }
.dice-trend-legend .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dice-trend-legend .dot.blue { background: #2f7fe8; border: 1px solid #7dbaff; }
.dice-trend-legend .dot.red { background: #d64343; border: 1px solid #ff8a8a; }
.dice-trend-legend .dot.tie { background: #59657a; border: 1px solid #8995a8; }
.dice-trend-scroll { overflow: auto; max-height: 62vh; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.dice-trend-grid {
  display: flex; align-items: flex-start; justify-content: flex-start; gap: 4px;
}
.dice-trend-grid.empty-grid { display: block; }
.dice-trend-col { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.dice-trend-dot {
  width: 16px; height: 16px; border-radius: 50%;
  display: block; color: transparent; font-size: 0; line-height: 0;
  border: 1.5px solid transparent; box-shadow: 0 2px 5px rgba(0,0,0,.28);
}
.dice-trend-dot.blue {
  background: radial-gradient(circle at 35% 28%, #7fc0ff, #2f7fe8 48%, #174aa0);
  border-color: #9bcaff;
}
.dice-trend-dot.red {
  background: radial-gradient(circle at 35% 28%, #ff9a9a, #d64343 48%, #8f1d1d);
  border-color: #ffb0b0;
}
.dice-trend-dot.tie {
  background: radial-gradient(circle at 35% 28%, #8b96a8, #59657a 55%, #303a4c);
  border-color: #9ba6b8;
}
.dice-stage { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 12px 0 8px; flex-wrap: wrap; }
.die {
  width: 58px; height: 58px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; background: linear-gradient(160deg, #fefefe, #d9e1f2);
  color: #121a2a; box-shadow: 0 6px 16px rgba(0,0,0,.35), inset 0 -3px 0 rgba(0,0,0,.15);
  transition: transform .2s ease;
}
.die.rolling { animation: dice-roll .7s ease-in-out; }
@keyframes dice-roll {
  0% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-14px) rotate(-18deg); }
  55% { transform: translateY(4px) rotate(14deg); }
  80% { transform: translateY(-4px) rotate(-6deg); }
  100% { transform: translateY(0) rotate(0); }
}
.dice-sum { width: 100%; font-size: 13px; color: var(--muted); margin-top: 2px; }
.dice-hash-row { display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-height: 34px; margin: 1px 0 2px; transition: opacity .2s ease; }
.dice-hash { flex: 1; min-width: 0; margin: 0; white-space: normal; word-break: break-all; font-family: ui-monospace, monospace; font-size: 12px; text-align: center; line-height: 16px; }
.dice-hash-copy {
  flex: 0 0 auto; padding: 2px 7px; border-radius: 6px;
  border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--muted);
  font-size: 11px; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.dice-hash-copy:hover { color: var(--text); border-color: #4f6b95; }
.verify-lines { display: flex; flex-direction: column; gap: 7px; text-align: left; }
.verify-line { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.verify-label { flex: 0 0 auto; color: var(--muted); }
.verify-value {
  flex: 1 1 220px; min-width: 0;
  font-family: ui-monospace, monospace; word-break: break-all;
  color: var(--text); line-height: 1.55;
}
.verify-line .dice-hash-copy { flex: 0 0 auto; align-self: flex-start; }
.verify-algo { margin: 10px 0 0; line-height: 1.6; }
.dice-hash-edit {
  margin: 12px 0; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255, 255, 255, .03);
}
.dice-hash-edit input { font-family: ui-monospace, monospace; font-size: 12px; }
.dice-hash-edit .btn { margin-top: 8px; }
#dicePeriodBody .table-wrap td.mono { word-break: break-all; font-size: 11px; }
.dice-hash-row.hash-hidden { opacity: 0; visibility: hidden; }
.dice-hash-row.no-hash { visibility: hidden; pointer-events: none; }
.dice-market { display: flex; flex-direction: column; gap: 7px; }
.dice-market-tabs {
  display: flex; gap: 4px; padding: 2px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2);
}
.dice-market-tab {
  flex: 1; padding: 5px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.dice-market-tab.active {
  background: rgba(79,124,255,.2); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(79,124,255,.35);
}
.dice-market-row { display: flex; gap: 5px; }
.dice-opt {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 14px; line-height: 1.15; cursor: pointer;
}
.dice-opt b { font-size: 15px; }
.dice-opt span { color: var(--gold); font-size: 11px; }
.dice-opt.active, .dice-opt:not(:disabled):active { border-color: rgba(79,124,255,.8); background: rgba(79,124,255,.18); box-shadow: 0 0 0 1px rgba(79,124,255,.35) inset; }
.dice-opt:disabled { opacity: .45; cursor: not-allowed; }
.dice-opt.wide { flex: 1; }
.dice-sum-title { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.dice-sum-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.dice-sum-opt {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 2px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); cursor: pointer;
}
.dice-sum-opt b { font-size: 14px; }
.dice-sum-opt span { font-size: 9.5px; color: var(--gold); }
.dice-sum-opt.active { border-color: rgba(79,124,255,.8); background: rgba(79,124,255,.18); }
.dice-sum-opt:disabled { opacity: .4; cursor: not-allowed; }
.dice-selected-summary { font-size: 12.5px; line-height: 1.5; color: var(--text); word-break: break-word; }
.dice-selected-summary:empty { display: none; }
.dice-selected-total { font-size: 12px; font-weight: 700; color: var(--gold); }
.chip:disabled, #diceStakeInput:disabled { opacity: .45; cursor: not-allowed; }
.dice-stake-row { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.dice-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer;
}
.chip.active { background: rgba(245,181,68,.18); border-color: rgba(245,181,68,.6); color: var(--gold); }
#diceStakeInput {
  width: 100px; padding: 5px 9px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text);
}
.dice-bet-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dice-bet-summary { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dice-bet-actions #diceSelectionText { flex: 1; min-width: 0; }
.dice-bet-actions .btn { flex: 0 0 auto; padding: 7px 12px; font-size: 13px; }
.dice-pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 0 2px; flex-wrap: wrap; }
.dice-pager .btn { padding: 5px 10px; font-size: 12px; }
@media (max-width: 420px) {
  .dice-sum-grid { grid-template-columns: repeat(4, 1fr); }
  .die { width: 50px; height: 50px; font-size: 22px; }
}

/* 掷骰子：骰盅动画 */
.dice-cup-stage {
  position: relative; height: 220px; margin: 10px 0 4px;
  display: flex; align-items: flex-end; justify-content: center;
}
.dice-record-actions {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  z-index: 6; display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  max-width: 42%;
}
.dice-record-actions .btn {
  max-width: 100%; white-space: normal; text-align: left; line-height: 1.2; font-size: 14px;
}
.dice-stage-badge {
  position: absolute; left: 50%; right: auto; top: 75%; transform: translate(-50%, -50%);
  z-index: 6; font-size: 12px;
}
.dice-stage-badge .badge {
  gap: 6px; padding: 4px 12px; font-size: 12px; font-weight: 800; letter-spacing: .4px;
  border: 1px solid rgba(111,224,165,.4); border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 5px 16px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.16);
}
.dice-stage-badge .badge::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 8px currentColor;
  animation: dice-status-pulse 1.6s ease-in-out infinite;
}
.dice-stage-badge .badge.on {
  color: #b9ffda;
  border-color: rgba(111,224,165,.6);
  background: linear-gradient(180deg, rgba(53,196,122,.42), rgba(16,78,48,.88));
  box-shadow: 0 0 0 3px rgba(53,196,122,.1), 0 5px 16px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.2);
  text-shadow: 0 1px 5px rgba(53,196,122,.55);
}
.dice-stage-badge .badge.bot {
  color: #ffe8ad;
  border-color: rgba(245,181,68,.55);
  background: linear-gradient(180deg, rgba(245,181,68,.4), rgba(92,57,12,.9));
  box-shadow: 0 0 0 3px rgba(245,181,68,.08), 0 5px 16px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.2);
  text-shadow: 0 1px 5px rgba(245,181,68,.5);
}
.dice-stage-badge .badge.off {
  color: #c4d0e1;
  border-color: rgba(147,164,192,.35);
  background: linear-gradient(180deg, rgba(147,164,192,.22), rgba(20,30,48,.88));
}
.dice-stage-badge .badge.off::before { animation: none; opacity: .6; }
@keyframes dice-status-pulse {
  0%, 100% { opacity: .55; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.15); }
}
.dice-dice {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%) scale(.86);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  opacity: 0; transition: opacity .35s ease, transform .35s ease; pointer-events: none;
}
.dice-dice .dice-row { display: flex; gap: 12px; }
.dice-dice .dice-sum { width: auto; margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.dice-cup-stage.open .dice-dice { opacity: 1; transform: translateX(-50%) scale(1); }
.dice-cup {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 214px; height: 180px; pointer-events: none;
  filter: drop-shadow(0 18px 24px rgba(0,0,0,.55));
}
.cup-body {
  position: absolute; bottom: 0; left: 0; width: 214px; height: 132px;
  clip-path: polygon(7% 0, 93% 0, 100% 100%, 0 100%);
  background: linear-gradient(155deg, #8d2020 0%, #4a0c0c 55%, #210404 100%);
  border: 2px solid rgba(245, 181, 68, .72);
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: transform .55s cubic-bezier(.4,0,.2,1), opacity .55s ease;
}
.cup-body::after {
  content: ''; position: absolute; inset: 8px 10px 10px;
  border: 1px solid rgba(245, 181, 68, .25); border-radius: 8px; pointer-events: none;
}
.cup-lid {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 228px; height: 54px; border-radius: 50%;
  background: radial-gradient(ellipse at 40% 35%, #b52a2a, #570d0d 70%, #2a0505);
  border: 2px solid rgba(245, 181, 68, .8);
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.45), 0 6px 12px rgba(0,0,0,.4);
  transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .6s ease;
}
.cup-lid::after {
  content: ''; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 28px; height: 12px; border-radius: 50%;
  background: linear-gradient(180deg, #f5c15a, #a96b13);
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
}
.dice-cup-stage.open .cup-lid { transform: translate(-50%, -96px) rotate(-18deg); opacity: 0; }
.dice-cup-stage.open .cup-body { transform: translateY(74px) scale(.82); opacity: 0; }
.dice-last-line {
  height: 24px; min-height: 24px; line-height: 24px; margin: 2px 0 0;
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dice-result-mini { width: 20px; height: 20px; margin: 0 1px; vertical-align: -4px; }
.dice-plus { margin: 0 1px; color: var(--muted); }
.dice-result-cell { white-space: nowrap; }
.dice-result-cell .dice-result-mini { vertical-align: middle; }
@media (max-width: 420px) {
  .dice-cup-stage { height: 200px; }
  .dice-cup { width: 196px; height: 166px; }
  .cup-body { width: 196px; height: 122px; }
  .cup-lid { width: 210px; height: 50px; }
  .dice-dice .die { width: 48px; height: 48px; font-size: 21px; }
}

/* 骰盅：透明罩 + 黑底座 + 可揭开的黑盖 */
.dice-cup-stage { height: 180px; margin: 0; align-items: flex-end; }
.cup-shaker { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.dice-cup-stage.shaking .cup-shaker {
  animation: dice-cup-shake .2s linear infinite;
  will-change: transform;
}
@keyframes dice-cup-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-5px); }
  60% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}
.dice-dice {
  position: absolute; bottom: 82px; left: 50%; transform: translateX(-50%);
  opacity: 0; z-index: 2; transition: opacity .25s ease; display: flex; flex-direction: column; align-items: center;
}
.dice-dice .dice-row { display: flex; gap: 8px; }
.dice-dice .die {
  width: 40px; height: 40px; font-size: 18px;
  box-shadow: 0 5px 12px rgba(0,0,0,.45), inset 0 -3px 0 rgba(0,0,0,.12);
}
.cup-base {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 240px; height: auto; z-index: 3; pointer-events: none;
}
.cup-cover {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  width: 202px; height: auto; z-index: 4; pointer-events: none;
  transition: transform .68s cubic-bezier(.2,.8,.2,1), opacity .68s ease;
  filter: drop-shadow(0 14px 18px rgba(0,0,0,.5));
}
.dice-cup-stage.open .cup-cover { transform: translate(-50%, -105px) rotate(-16deg); opacity: 0; }
.dice-sum-line {
  height: 22px; min-height: 22px; line-height: 22px; margin: 2px 0 0;
  text-align: center; font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity .25s ease;
}
.dice-sum-line.show { opacity: 1; }
@media (max-width: 420px) {
  .dice-hash { font-size: 10px; line-height: 15px; }
  .dice-hash-copy { font-size: 10px; }
  .dice-status-head #dicePeriodNo { font-size: 10.5px; padding: 2px 6px; letter-spacing: 0; }
  .dice-limit-btn { font-size: 10.5px; padding: 3px 7px; }
  .dice-record-actions { left: -4px; max-width: 80px; gap: 6px; }
  .dice-record-actions .btn { font-size: 10.5px; padding: 4px 5px; }
  .dice-stage-badge { left: 50%; right: auto; font-size: 10.5px; padding: 2px 6px; }
  .dice-stage-badge .badge { font-size: 10.5px; padding: 3px 9px; gap: 5px; }
  .dice-cup-stage { height: 155px; }
  .cup-base { width: 210px; }
  .cup-cover { width: 180px; bottom: 30px; }
  .dice-dice { bottom: 74px; }
  .dice-dice .dice-row { gap: 7px; }
  .dice-dice .die { width: 34px; height: 34px; font-size: 15px; }
  .dice-last-line { font-size: 11px; }
  .dice-result-mini { width: 19px; height: 19px; }
}
@media (max-width: 360px) {
  .dice-status-head #dicePeriodNo { font-size: 10px; padding: 2px 5px; letter-spacing: 0; }
  .dice-countdown-label { display: none; }
  .dice-last-line { font-size: 10.5px; }
  .dice-result-mini { width: 18px; height: 18px; }
}
@media (max-width: 480px) {
  .dice-status-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    height: 38px;
    min-height: 38px;
  }
  .dice-status-head #dicePeriodNo {
    flex: 0 1 auto;
    font-size: 12px;
    padding: 2px 6px;
    max-width: none;
  }
  .dice-head-timer { flex: 0 0 auto; height: 38px; min-height: 38px; }
}
@media (max-width: 360px) {
  .dice-status-head #dicePeriodNo { font-size: 11px; padding: 2px 5px; }
}
