/* 猫钰棋社 —— 网页版样式
 * 设计语言：精品休闲桌游（Premium Casual Board Game）
 *  - 明亮青绿游戏桌面 + 暖金实体棋盘 + 柔和彩色营地 + 低存在感棋孔
 *  - 首页/大厅：暖米白；对局页：明亮青绿（两者共享圆角/阴影/字体 token）
 */
:root {
  /* —— 全局浅色（首页/大厅）—— */
  --bg1: #f5f0e4;
  --bg2: #eae1cc;
  --bg3: #d9cdb2;
  --panel: #fdfcf8;
  --ink: #284047;
  --muted: #7d898a;
  --accent: #f07b5f;
  --accent-dark: #d95f43;
  --danger: #e5544a;
  --line: #e4ddca;
  --ready: #4e9b6f;

  /* —— 对局桌面（明亮青绿）—— */
  --table-1: #39adb5;
  --table-2: #2498a5;
  --table-deep: #1f8592;
  --surface: rgba(255, 255, 255, 0.3);          /* 浅色半透明面板（游戏 HUD） */
  --surface-strong: rgba(255, 255, 255, 0.92);  /* 近白实心表面（toolbar/胶囊） */
  --on-table: #ffffff;                          /* 青绿底上的文字 */
  --on-table-soft: rgba(255, 255, 255, 0.88);
  --table-line: rgba(255, 255, 255, 0.4);
  --table-line-strong: rgba(255, 255, 255, 0.65);
  --gold: #f2b544;                              /* 回合/行动高亮 */
  --coral: #f07b5f;                             /* 游戏状态 tag / 警告 */
  --ink-deep: #284047;                          /* 浅表面上的主文字 */
  --ink-soft: #647b80;                          /* 浅表面上的次文字 */

  /* —— 设计 token —— */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(23, 60, 70, 0.18);
  --shadow-md: 0 10px 26px rgba(23, 60, 70, 0.22);
  --shadow-lg: 0 18px 46px rgba(23, 60, 70, 0.3);
  --font-stack: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body.in-game, html.in-game { overflow: hidden; }
body {
  font-family: var(--font-stack);
  background:
    radial-gradient(rgba(120,100,70,0.035) 1.5px, transparent 2px) 0 0 / 26px 26px,
    linear-gradient(160deg, var(--bg1), var(--bg2) 60%, var(--bg3));
  color: var(--ink);
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
  font-size: 14px;
  line-height: 1.45;
}

#app { min-height: 100vh; }

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

.hidden { display: none !important; }

/* ---------- 首页 ---------- */
.home-wrap {
  max-width: 460px;
  margin: 0 auto;
  padding: 6vh 16px calc(104px + env(safe-area-inset-bottom, 0px));
  text-align: center;
}

/* 首页顶部房间失效提示：非阻塞（pointer-events:none）、无按钮，约 2.3 秒后自动淡出 */
.home-invalid-notice {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(90, 70, 40, 0.14);
  padding: 10px 16px;
  text-align: center;
  opacity: 1;
  transition: opacity 0.35s ease;
}
.home-invalid-notice.fade-out { opacity: 0; }
.hin-title { font-size: 14px; font-weight: 800; color: #4a4233; }
.hin-text { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) {
  .home-invalid-notice { transition: none; }
}
.logo {
  color: #4a4233;
  font-size: 44px;
  letter-spacing: 6px;
  margin-bottom: 14px;
  font-weight: 800;
}
.logo-marbles {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}
.marble {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-block;
  box-shadow: inset -6px -6px 9px rgba(0,0,0,0.22), 0 3px 6px rgba(60,45,20,0.18);
  animation: float 2.6s ease-in-out infinite;
}
.marble:nth-child(2) { animation-delay: 0.15s; }
.marble:nth-child(3) { animation-delay: 0.3s; }
.marble:nth-child(4) { animation-delay: 0.45s; }
.marble:nth-child(5) { animation-delay: 0.6s; }
.marble:nth-child(6) { animation-delay: 0.75s; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.marble.m1 { background: radial-gradient(circle at 32% 30%, #f2b39e, #d97757 60%, #a8552f); }
.marble.m2 { background: radial-gradient(circle at 32% 30%, #f4dfa4, #d9a62e 60%, #a87c14); }
.marble.m3 { background: radial-gradient(circle at 32% 30%, #b9d3bb, #5e8c61 60%, #3d5f40); }
.marble.m4 { background: radial-gradient(circle at 32% 30%, #aac5e7, #4a72a8 60%, #2f4d78); }
.marble.m5 { background: radial-gradient(circle at 32% 30%, #cfb9e6, #8a5fa8 60%, #5f3f7d); }
.marble.m6 { background: radial-gradient(circle at 32% 30%, #b3aaf0, #534AD8 60%, #37309b); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 18px;
  box-shadow: 0 8px 28px rgba(90,70,40,0.12);
  text-align: left;
}
.field { margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
input[type="text"], input:not([type]) {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  outline: none;
  background: #faf7ef;
}
input:focus { border-color: var(--accent); background: #fff; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1;
  min-width: 52px;
  min-height: 44px;   /* 手机触控友好：足够大的点按区域 */
  border: 1.5px solid var(--line);
  background: #faf7ef;
  border-radius: 10px;
  padding: 10px 4px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
}
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 15px;
  cursor: pointer;
  background: #ede9dc;
  color: var(--ink);
  transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(135deg, #f48a6e, var(--accent-dark)); color: #fff; font-weight: 700; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.ghost { background: transparent; border: 1.5px solid rgba(59,55,43,0.28); }
.btn.ghost.on { background: #f7ece3; border-color: var(--accent); color: var(--accent-dark); font-weight: 700; }
.btn.danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 12px; margin: 18px 0 14px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: 2px; font-weight: 700; text-align: center; }

/* ---------- 大厅 ---------- */
/* 布局：顶部房间码+信息+复制分享 → 中间座位面板（可滚动）→ 底部开始/离开 → 聊天 */
.lobby-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(12px + env(safe-area-inset-bottom, 0px));
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
/* 房间信息与邀请合并卡：唯一暖白外框（背景/边框/圆角/阴影沿用原大厅头部） */
.lobby-room-card {
  margin-top: 52px;   /* 给左上角麦克风 dock 让位（图标横排约 48px 高） */
  background: #FDFCF8;
  border: 1px solid #E4DDCA;
  border-radius: 18px;
  padding: 12px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(90,70,40,0.1);
  flex-shrink: 0;
}
/* 上半部：左房间码、右对局信息胶囊，同一水平栏（右组整体与左组垂直居中） */
.lobby-room-summary {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.lobby-code-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}
/* 标签与号码完全同字号同字重、同基线、不换行；号码仅多 2px 字间距 */
.room-code-label,
.room-code {
  font-size: clamp(18px, 5vw, 20px);
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}
.room-code-label { color: var(--muted); }
.room-code { color: var(--accent-dark); letter-spacing: 2px; }
/* 右侧权威对局信息：三个同高 20px 暖灰小胶囊，宽屏一行、窄屏最多两行且右对齐 */
.lobby-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: center;
  gap: 4px;
  min-width: 0;
}
.lobby-chip {
  height: 20px;
  line-height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  background: #F2EEE3;
  color: #57503D;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
}
/* 上下区域之间的淡分隔线（左右随卡片内边距留 16px） */
.lobby-room-divider {
  height: 1px;
  background: #EEE7D8;
  margin: 0;
  flex-shrink: 0;
}
/* 下半部：主邀请按钮（柔和绿，同 --ready 色）+ 两个同排弱按钮 */
.lobby-invite-actions { display: flex; flex-direction: column; gap: 8px; }
.btn.lobby-invite-primary {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 12px;
  background: var(--ready);   /* #4E9B6F，柔和绿，不用高饱和微信绿 */
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.lobby-invite-secondary { display: flex; gap: 8px; }
.btn.lobby-invite-weak {
  flex: 1 1 0;
  min-width: 0;
  height: 44px;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: #4a4233;
  background: #f6f2e7;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  white-space: nowrap;
}
/* 窄屏（320px 级）：同时缩小左右间距，左右两组仍保持同一水平栏 */
@media (max-width: 359px) {
  .lobby-room-card { padding: 12px 12px 14px; }
  .lobby-room-summary { gap: 8px; }
  .lobby-code-line { gap: 4px; }
  .room-code { letter-spacing: 1px; }
}

/* 中间：状态提示 + 座位面板（谁加入了、是否准备），可滚动 */
.lobby-mid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px;
}
.lobby-status {
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  flex-shrink: 0;
}
.lobby-status b { color: var(--accent-dark); }

/* 底部：开始游戏（准备）/ +机器人 / 离开 / 通话 / 消息 —— 两列 CSS Grid（短屏纵向布局改造） */
.lobby-bottom { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.lobby-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
/* 主操作始终独占整行；通话始终在消息正上方（各占整行） */
#btn-start, #btn-ready, #btn-lobby-voice, #lobby-chat-btn { grid-column: 1 / -1; }
/* 房主 + 等待 + 有空位且无其他真人：#btn-addbot 与离开各占半行；
   房主 + 有其他真人：#btn-dissolve 原位替换添加机器人，与离开各占半行
   （has-split 由 renderLobby 与按钮显示条件同源联动）；
   其余情况离开按钮占满整行，不留空白列 */
#btn-addbot, #btn-dissolve { grid-column: auto; }
#btn-leave-room { grid-column: 1 / -1; }
.lobby-actions.has-split #btn-leave-room { grid-column: auto; }
/* 解散房间：柔和红色描边弱按钮（不填实色）；离开房间保持中性弱按钮 */
.lobby-act.danger-ghost {
  background: transparent;
  border: 1.5px solid rgba(229, 84, 74, 0.55);
  color: var(--danger);
}
/* 开始游戏：绿色主按钮（柔和绿 --ready，与邀请主按钮同系，不缩窄、独占整行） */
#btn-start.lobby-act.primary {
  background: var(--ready);
  color: #fff;
}
.lobby-act {
  width: 100%;
  min-width: 0;
  padding: 16px 8px;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  border: 1.5px solid var(--line);
  background: #f6f2e7;
  position: relative;
  border-radius: 12px;
}
.lobby-act.primary { border: none; }
.lobby-act.ghost { background: transparent; border: 1.5px solid rgba(59,55,43,0.28); }
.lobby-act:disabled { opacity: 0.5; cursor: not-allowed; }
.lobby-act .msg-dot { top: 8px; right: 10px; width: 11px; height: 11px; }

/* 短屏（max-height:680px）：压缩按钮与间距；触控区域 ≥44px，开始/准备保持 50px 高 */
@media (max-height: 680px) {
  .lobby-wrap { gap: 6px; }
  .lobby-room-card { padding: 10px 16px 12px; gap: 8px; }
  .lobby-mid { gap: 6px; }
  .lobby-actions { gap: 6px; }
  .lobby-act {
    height: 44px;
    line-height: 44px;
    padding: 0 8px;
  }
  #btn-start, #btn-ready { height: 50px; line-height: 50px; }
}

/* 聊天大按钮（准备界面底部 / 对局界面底部整行，双端统一） */
.chat-row { flex-shrink: 0; }
.btn.chat-big {
  position: relative;
  display: block;
  width: 100%;
  padding: 13px;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #fdfcf8, #f2edde);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(90,70,40,0.1);
}
.btn.chat-big:active { transform: scale(0.985); }
.btn.chat-big .msg-dot {
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
}

.seats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 640px) { .seats { grid-template-columns: repeat(3, 1fr); } }
.seat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 4px 12px rgba(90,70,40,0.08);
  position: relative;
  min-height: 56px;
  transition: transform .12s ease, box-shadow .12s ease;
}
@media (hover: hover) {
  .seat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(90,70,40,0.14); }
}
.seat-card.empty { opacity: 0.55; }
/* 空位头像：圆框完全留空（不渲染图片/emoji/剪影/加号），虚线空框 */
.seat-card.empty .seat-avatar {
  background: #F0ECE2;
  border: 1.5px dashed #D4CCB8;
  box-shadow: none;
}
/* 预设头像：座位色圆底 + 动物头像（干净圆形，图片不被遮挡） */
.seat-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  box-shadow: 0 2px 5px rgba(60,45,20,0.15);
  border: 2px solid rgba(255,255,255,0.85);
  overflow: hidden;
}
.seat-info { flex: 1; min-width: 0; }
.seat-name { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-sub { font-size: 11.5px; color: var(--muted); }
.seat-sub .ready-yes { color: var(--ready); font-weight: 700; }
.badges { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
}
.badge.host { background: var(--accent); }
.badge.bot { background: #8a5fa8; }
.badge.off { background: var(--muted); }
.seat-card .seat-ops { margin-left: 4px; }
.seat-op-icon {
  width: 22px; height: 22px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--muted, #8A9290);
  cursor: pointer;
}
.seat-op-icon svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.seat-op-icon:hover { color: var(--danger, #c0392b); background: rgba(0, 0, 0, .04); }

/* 仅房主可见的轻提示：紧跟整个座位网格之后（2/4/6 人房在对应座位卡下面），无背景/边框/图标/动画 */
.lobby-host-invite-hint {
  margin: 2px 4px 0;
  color: #8A9290;
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
}

/* ---------- 聊天（弹出面板，大厅与对局共用） ---------- */
.chat-msgs { overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.chat-msg { font-size: 13px; line-height: 1.5; word-break: break-all; background: #f4f1e7; border-radius: 10px; padding: 6px 10px; align-self: flex-start; max-width: 92%; display: flex; align-items: flex-start; gap: 6px; }
.chat-msg > span { min-width: 0; word-break: break-all; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg .who { font-weight: 700; white-space: nowrap; }
.chat-msg .who-avatar { font-size: 14px; line-height: 1; }
.chat-msg.sys { color: var(--muted); font-size: 12px; text-align: center; background: transparent; align-self: center; }
.chat-input-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px; border-top: 1px solid var(--line); flex-shrink: 0; background: var(--panel); margin-top: auto; height: 54px; box-sizing: border-box; }
.chat-input-row input { border: 1px solid var(--line); border-radius: 14px; background: #f4f1e7; flex: 1; min-width: 0; padding: 9px 12px; font-size: 14px; outline: none; }
.chat-input-row input:focus { border-color: var(--coral); }
#chat-send { border-radius: 14px; padding: 9px 16px; background: var(--coral); color: #fff; border: none; font-weight: 700; }
#chat-send:active { filter: brightness(0.94); }
/* ---------- 对局（明亮青绿桌面 + 暖金实体棋盘） ---------- */
#screen-game {
  background:
    repeating-linear-gradient(90deg,
      rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 44px,
      rgba(20, 70, 80, 0.05) 44px, rgba(20, 70, 80, 0.05) 88px),
    linear-gradient(180deg, var(--table-1) 0%, var(--table-2) 100%);
  color: var(--on-table);
  overflow-x: clip;   /* 棋盘放大后左右对称超出视口的部分在此裁掉，不产生横向滚动 */
}
/* 背景皮肤（只作用于 #screen-game 的背景层；canvas/棋盘尺寸/孔位/棋子/大厅背景不受影响）：
   - 碧海竖纹（默认星海鎏金）：青绿竖向 repeating-linear-gradient（上方定义）
   - 米杏浅纹（暖木瓷韵）：Beta 0.1 暖米杏渐变 + 间距约 26px 的极淡圆点纹 */
#screen-game.skin-bg-ivory {
  background:
    radial-gradient(rgba(120, 100, 70, 0.035) 1.5px, transparent 2px) 0 0 / 26px 26px,
    linear-gradient(160deg, #f0eadc, #e6ddc8 60%, #d9cdb2);
}

.game-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  max-width: 430px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  position: relative;
}
.game-main { flex: 0 1 auto; display: flex; flex-direction: column; min-height: 0; }

/* 顶部状态胶囊：左=麦/听图标 · 中=回合 · 右=跳法/规则（三段，均匀排开） */
.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  min-height: 30px;
}
.game-top .gt-left { display: flex; align-items: center; gap: 6px; flex: none; }
/* 麦/听 纯图标小按钮（顶栏内联 + 大厅左上角 dock 共用） */
.vbtn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f2efe4;
  color: var(--muted);
  cursor: pointer;
}
.vbtn svg { width: 18px; height: 18px; display: block; }
.vbtn.on { background: linear-gradient(135deg, #f48a6e, var(--accent-dark)); color: #fff; border-color: transparent; }
.vbtn.speaking { box-shadow: 0 0 0 2px #3f9d6b; }
.gt-right { display: flex; align-items: center; gap: 8px; }
.gt-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.gt-chip b {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 14px;
  text-align: center;
}
/* 跳法：明亮珊瑚 tag */
#gi-mode {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 2px 6px rgba(217, 95, 67, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
/* 回合：白色胶囊 */
.gt-round {
  background: var(--surface-strong);
  color: var(--ink-deep);
  box-shadow: var(--shadow-sm);
}
.gt-round.mine {
  box-shadow: 0 0 0 2px var(--gold), var(--shadow-sm);
}
.gt-round.mine b { color: #b5760c; }
/* 规则：白色半透明小胶囊 + 官方信息图标（18-22px） */
.gt-rule {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px 0 7px;
  background: var(--surface);
  border: 1px solid var(--table-line);
  border-radius: var(--radius-pill);
  color: var(--on-table);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.gt-rule-icon { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; pointer-events: none; }
.gt-rule:active { background: rgba(255, 255, 255, 0.45); }

/* 玩家对战 HUD：一体化浅色半透明面板（两名玩家同一视觉整体） */
.seats-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 3px 6px;
  background: rgba(255, 249, 235, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 15px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(23, 60, 70, 0.1);
}
.seats-2 .seat-slot { max-width: 168px; }
.seat-slot {
  flex: 1 1 0;
  min-width: 0;
  max-width: 96px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  align-content: center;
  gap: 1px 4px;
  padding: 3px 2px 2px;
  border-radius: 12px;
  transition: background 0.18s ease;
}
.seat-slot.empty { opacity: 0.55; }
.seat-slot.on { background: rgba(255, 255, 255, 0.34); }
.seats-vs {
  width: 36px;
  height: 36px;
  align-self: center;
  flex-shrink: 0;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(23, 60, 70, 0.3));
}
.slot-avatar-box {
  position: relative;
  flex-shrink: 0;
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 6px rgba(23, 60, 70, 0.25);
  overflow: hidden;
}
.seats-2 .slot-avatar { width: 48px; height: 48px; font-size: 25px; }
.slot-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-deep);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
.slot-sub {
  font-size: 10.5px;
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot-sub.warn { color: #d95f43; }
.slot-sub.dim { opacity: 0.6; }
/* 倒计时胶囊：官方计时器图标 + 动态秒数；≤10 秒转珊瑚红 */
.slot-count {
  position: absolute;
  top: -6px;
  right: -12px;
  display: none;
  align-items: center;
  gap: 3px;
  height: 20px;
  padding: 0 7px 0 5px;
  border-radius: var(--radius-pill);
  background: rgba(255, 249, 232, 0.96);
  border: 1px solid rgba(120, 90, 40, 0.18);
  color: var(--ink-deep);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(23, 60, 70, 0.25);
}
.slot-count.show { display: inline-flex; }
.slot-count-icon { width: 12px; height: 15px; object-fit: contain; pointer-events: none; }
.slot-count.urgent {
  background: var(--coral);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
  animation: count-alert 1s ease-in-out infinite;
}
@keyframes count-alert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}

/* 棋盘容器：跟随棋盘实际尺寸（棋盘可横向超出列宽、左右对称溢出视口被裁切），
 * 顶部留 20px 间隙（8px 列间隙 + 12px 上边距）贴近玩家信息卡；
 * 柔和悬浮阴影由 CSS drop-shadow 提供（贴合星形轮廓，无黑色晕边）。 */
.board-box {
  position: relative;
  flex: 0 0 auto;
  min-height: 0;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.board-inner { position: relative; }
/* 棋盘加载遮罩：QIPAN 七张素材全部加载并解码前覆盖棋盘区；就绪后由 JS 关闭 */
.board-loading {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(23, 60, 70, 0.32);
  border-radius: 14px;
}
.board-loading.hidden { display: none; }
/* 素材门禁超时后的简化棋盘提示（非阻塞，自动隐藏） */
.board-fallback-tip {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  background: rgba(255, 253, 246, 0.95);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-fallback-tip.hidden { display: none; }
/* <picture> 仅承担 WebP 内容协商：不参与布局，与直接 <img> 完全等价（display:contents） */
.func-btn picture, .gt-rule picture, .msg-tab picture, .voice-title picture { display: contents; }
.board-loading-text {
  background: rgba(255, 253, 246, 0.95);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  animation: loadPulse 1.2s ease-in-out infinite;
}
@keyframes loadPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}
#board-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  filter:
    drop-shadow(0 10px 14px rgba(20, 60, 70, 0.2))
    drop-shadow(0 3px 4px rgba(20, 40, 50, 0.14));
}

/* 底部游戏工具栏：奶油白半透明 dock + 官方 PNG 图标 + HTML 标签；
 * margin-top:auto 把工具栏钉在屏幕底部，多余垂直空间留在棋盘与工具栏之间 */
.func-row {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  margin: auto 4px 0;
  background: rgba(255, 250, 238, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 17px;
  padding: 5px 6px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.func-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 52px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: #5a4635;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.06s ease;
  -webkit-tap-highlight-color: transparent;
}
.func-btn .fc-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  pointer-events: none;
}
.func-btn:active,
.func-btn.on {
  transform: scale(0.96);
  background: rgba(240, 123, 95, 0.14);
  color: #8a4a2f;
}
@media (hover: hover) {
  .func-btn:hover { background: rgba(240, 123, 95, 0.1); color: #8a4a2f; }
}
#msg-btn { position: relative; }
#msg-btn .msg-dot {
  top: 5px;
  right: calc(50% - 20px);
  width: 10px;
  height: 10px;
}

/* ---------- 对局面板（#panel-options）：左列对局动态（可滚动）+ 右列对局操作 ----------
 * 面板顶部没有单独的「对局」标题行：两列标题即面板首行（水平对齐），
 * 关闭按钮绝对定位在右上角、不占一行；顶部内边距压到最小让内容明显上提。
 * 本段所有规则一律以 #panel-options 作用域限定（含 opt-close/opt-cols/opt-col/
 * dyn-col-title/opt-items/opt-item 与 dyn-msgs/dyn-msg 家族），绝不外泄到其他容器；
 * 设置面板等其他 sheet-panel 的 .sheet-head 标题布局与配色完全不受影响。 */
#panel-options {
  /* 不要在此覆盖 position：.sheet-panel 的 position: fixed 已为绝对定位的关闭按钮建立包含块 */
  width: min(560px, calc(100vw - 24px));
  padding-top: 8px;
  gap: 0;
}
/* 关闭按钮：绝对定位在面板右上角（不参与列布局、不单独占一行）。
 * ID 作用域天然压过 .btn.small 的内边距，使按钮完整落在标题行高度内。 */
#panel-options .opt-close {
  position: absolute;
  top: 5px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  border-radius: 8px;
}
#panel-options .opt-cols {
  display: flex;
  gap: 12px;
  min-height: 0;
}
#panel-options .opt-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
#panel-options .opt-col .dyn-msgs {
  flex: 1;
  min-height: 96px;
  max-height: min(300px, 42vh);
}
#panel-options .opt-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* 两列标题：13px / 700 深棕，标题下浅色分隔线 + 8px 间距；两列标题顶端水平对齐 */
#panel-options .dyn-col-title {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  color: #4a3423;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(122, 96, 66, 0.18);
  margin-bottom: 8px;
}
/* 右列标题为关闭按钮预留空间（禁止与 ✕ 重叠），高度与左列标题保持一致 */
#panel-options .dyn-col-title-actions {
  padding-right: 34px;
}
#panel-options .dyn-msgs {
  flex: 1;
  min-height: 0;
  display: block;              /* 普通块级滚动容器：手机上下滑动最稳（避开 flex 滚动怪癖） */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain; /* 左列独立纵向滚动：滚到头不带动面板/页面 */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
#panel-options .dyn-msg {
  font-size: 11.5px;
  line-height: 1.55;
  font-weight: 400;
  color: #6b5c49;
  white-space: normal;         /* 长消息完整换行显示，不截断 */
  overflow-wrap: anywhere;
  word-break: break-all;
  display: flex;
  align-items: flex-start;
  gap: 3px;
  margin-bottom: 3px;
}
/* 非最新消息保持原色不弄淡；仅用加粗区分最新一条 */
#panel-options .dyn-msg.old { opacity: 1; }
#panel-options .dyn-msg > span { min-width: 0; }
#panel-options .dyn-name { flex-shrink: 0; }
#panel-options .dyn-sticker {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(45, 38, 25, 0.2));
}
#panel-options .dyn-msg.new {
  animation: dynIn 0.35s ease;
}
@keyframes dynIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
/* 对局操作按钮：四个按钮尺寸/间距/圆角完全统一（间距见 .opt-items 的 gap: 8px） */
#panel-options .opt-item {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  text-align: center;
  padding: 11px 10px;
  font-size: 14.5px;
  line-height: 1.2;
  font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: #f8f4e9;
}
#panel-options .opt-item:disabled { opacity: 0.45; }

/* 窄屏（320-359px）：进一步压缩玩家条与边距，保证 6 人局放得下 */
@media (max-width: 359px) {
  .game-wrap { padding-left: 4px; padding-right: 4px; gap: 6px; }
  .seats-row { gap: 4px; padding-left: 0; padding-right: 0; }
  .slot-avatar { width: 38px; height: 38px; font-size: 19px; }
  .seats-2 .slot-avatar { width: 44px; height: 44px; font-size: 23px; }
  .slot-name { font-size: 10.5px; }
  .gt-chip { padding: 0 10px; }
}
@media (min-width: 390px) {
  .seats-2 .slot-avatar { width: 50px; height: 50px; font-size: 26px; }
}

/* ---------- 设置面板 / 选项菜单（底部弹出小面板） ---------- */
.sheet-panel {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  z-index: 46;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(23, 60, 70, 0.28);
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: pop .2s ease;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0 8px;
}
.sheet-title { font-size: 15px; font-weight: 800; color: #4a4233; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 4px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
/* 键盘操作可见焦点：Space/Enter 切换开关时滑块显示焦点环 */
.switch-row input:focus-visible + .sw {
  outline: 2px solid #2ca0ad;
  outline-offset: 2px;
}
.switch-row .sw {
  width: 44px; height: 24px;
  border-radius: 999px;
  background: #d8d2c0;
  position: relative;
  transition: background .15s ease;
  flex-shrink: 0;
}
.switch-row .sw::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: left .15s ease;
}
.switch-row input:checked + .sw { background: #2ca0ad; }
.switch-row input:checked + .sw::after { left: 22px; }
/* 设置项右侧：说明按钮 + 开关 */
.switch-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* “i”说明按钮：黑色细圆圈，圆圈里一个 i */
.info-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #000;
  background: transparent;
  color: #000;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.info-btn:active { background: rgba(0, 0, 0, 0.08); }
/* “i”说明弹窗：贴在按钮旁的小气泡（窄幅，居中放置，不遮左右内容） */
.info-popup {
  position: absolute;
  left: 50%;
  width: 180px;
  margin-left: -90px;
  z-index: 5;
  background: rgba(40, 64, 71, 0.95);
  color: #faf7ef;
  font-size: 11.5px;
  line-height: 1.5;
  padding: 7px 9px;
  border-radius: 9px;
  box-shadow: 0 8px 22px rgba(23, 60, 70, 0.3);
  animation: pop .18s ease;
}
body.in-game .info-btn { border-color: var(--ink); color: var(--ink); }
body.in-game .info-popup { background: rgba(40, 64, 71, 0.95); color: #faf7ef; }

/* ---------- 设置面板内的入口行（外观设置 / 声音设置） ---------- */
.sheet-entry {
  width: 100%;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  text-align: left;
  font-family: inherit;
}
.sheet-entry:active { background: rgba(0, 0, 0, 0.04); }
.entry-arrow {
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  font-weight: 400;
}

/* ---------- 外观设置面板（三组独立双选项） ---------- */
.skin-group {
  border-top: 1px solid var(--line);
  padding: 8px 2px 2px;
}
.skin-group-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.3px;
}
.skin-options {
  display: flex;
  gap: 8px;
}
.skin-opt {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 6px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #faf7ef;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.skin-opt:active { background: #f2ecdd; }
.skin-opt.on {
  border-color: var(--accent);
  background: #fdf0e8;
  color: var(--accent-dark);
  font-weight: 800;
}
/* 目标素材未就绪：锁定对应选择（继续显示切换前的完整组合） */
.skin-group.locked .skin-options {
  position: relative;
}
.skin-group.locked .skin-opt {
  opacity: 0.55;
  cursor: default;
}
.skin-group.locked .skin-opt.on { opacity: 1; }
/* 对局页配色下的外观面板仍保持浅色纸面（与设置面板一致） */
body.in-game .sheet-entry { color: var(--ink); border-top-color: var(--line); }
body.in-game .skin-group { border-top-color: var(--line); }
/* 对局操作按钮的样式全部收在上方 #panel-options 段内（本段只放设置面板相关规则） */

/* ---------- 通用确认框 / 手动复制面板 ---------- */
.confirm-text {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 14px;
  text-align: left;
  word-break: break-all;
  white-space: pre-line;   /* 确认文案中的 \n 换行生效（离开/解散确认两行文案） */
}
.copy-text {
  width: 100%;
  height: 92px;
  margin-bottom: 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #faf7ef;
  padding: 8px;
  font-size: 14px;
  color: var(--ink);
  resize: none;
}

/* ---------- 语音通话面板 ---------- */
.voice-panel {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(400px, calc(100vw - 24px));
  z-index: 46;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(23, 60, 70, 0.28);
  padding: 12px 14px;
  animation: pop .2s ease;
}
.voice-body { display: flex; flex-direction: column; gap: 8px; }
.voice-title { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; color: #4a4233; }
.voice-title-icon { width: 22px; height: 22px; aspect-ratio: 1 / 1; object-fit: contain; display: block; }
.voice-status { font-size: 12.5px; color: var(--muted); }
.voice-status.live { color: var(--ready); font-weight: 700; }
.voice-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.voice-btns .btn { flex: 1; min-width: 76px; padding: 9px 6px; font-size: 13.5px; font-weight: 700; }
.voice-hint {
  font-size: 11.5px;
  line-height: 1.55;
  color: #8a6d3b;
  background: #fbf3df;
  border: 1px solid #ecdcb8;
  border-radius: 8px;
  padding: 6px 9px;
}
.voice-diag {
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--muted);
  word-break: break-all;
}
.voice-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* 说话范围：全部麦 / 组队麦 / 队友麦 */
.voice-scope { display: flex; flex-direction: column; gap: 6px; }
.voice-scope-tabs { display: flex; gap: 6px; }
.voice-scope-tabs .vst {
  flex: 1;
  padding: 7px 4px;
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2efe4;
  color: var(--muted);
  cursor: pointer;
}
.voice-scope-tabs .vst.on {
  background: linear-gradient(135deg, #f48a6e, var(--accent-dark));
  color: #fff;
  border-color: transparent;
}
.voice-team-edit { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
.vteam-it {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #f2efe4; color: var(--ink); cursor: pointer;
}
.vteam-it input { margin: 0; }
.vteam-it.on { background: #e3f2ef; border-color: #2ca0ad; color: #166b77; }
.voice-peer-edit { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
.vpeer-it {
  font-size: 12px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #f2efe4; color: var(--ink); cursor: pointer;
}
.vpeer-it.on { background: linear-gradient(135deg, #f48a6e, var(--accent-dark)); color: #fff; border-color: transparent; }
/* 按住说话（PTT） */
.voice-ptt-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vptt-switch { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.vptt-switch input { margin: 0; accent-color: var(--accent-dark); }
.voice-ptt-btn { flex: 1; min-height: 44px; font-size: 15px; font-weight: 800; border-radius: 10px; }
.voice-ptt-btn.active { background: linear-gradient(135deg, #f48a6e, var(--accent-dark)); color: #fff; }
/* 通话成员：每人音量滑块（0 = 单独静音） */
.voice-members-wrap { display: flex; flex-direction: column; gap: 6px; }
.voice-members-head { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.voice-members-head span { flex: 1; }
.voice-members { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.vmem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: #faf7ef; }
.vmem.me { background: #eef6f2; }
.vmem-av {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #f48a6e, var(--accent-dark));
  color: #fff; font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.vmem-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vmem-mic { font-size: 12px; margin-left: 4px; }
.vmem-mute { flex: none; width: 30px; height: 30px; border: none; background: transparent; font-size: 15px; cursor: pointer; border-radius: 8px; }
.vmem-mute.on { background: #fbe4e0; border-radius: 8px; }
.vmem-vol { flex: 1; min-width: 60px; height: 22px; accent-color: var(--accent-dark); }
.vmem-na { font-size: 11px; color: var(--muted); }
.vmem.speaking .vmem-av { box-shadow: 0 0 0 2px #3f9d6b; animation: vmem-pulse 1s ease infinite; }
@keyframes vmem-pulse { 0%, 100% { box-shadow: 0 0 0 2px #3f9d6b; } 50% { box-shadow: 0 0 0 4px rgba(63, 157, 107, 0.45); } }
/* 麦克风面板：两个主按钮（麦克风 / 听筒）竖向排列 + 只听谁座号 tiles */
.voice-head .voice-x {
  margin-left: auto; flex: none;
  width: 26px; height: 26px;
  border: none; background: transparent;
  font-size: 14px; color: var(--muted); cursor: pointer;
  border-radius: 8px; line-height: 1;
}
.voice-ctrl { display: flex; flex-direction: column; gap: 8px; }
.voice-ctl {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #f2efe4; color: var(--ink); cursor: pointer;
  font-size: 15px; font-weight: 800;
  transition: transform .05s ease;
}
.voice-ctl .voice-ctl-ic { font-size: 22px; }
.voice-ctl .voice-ctl-tx { flex: 1; text-align: left; }
.voice-ctl .voice-ctl-sub { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.voice-ctl.mic.on { background: linear-gradient(135deg, #f48a6e, var(--accent-dark)); color: #fff; }
.voice-ctl.mic.on .voice-ctl-sub, .voice-ctl.mic.on .voice-ctl-tx { color: #fff; }
.voice-ctl.hear.on { border-color: #2ca0ad; background: #e3f2ef; }
.voice-ctl.hear.on .voice-ctl-sub { color: #166b77; }
.voice-ctl:active { transform: scale(0.985); }
/* 只听谁：其它玩家座号 tiles（2 人局 1 个号，6 人局 5 个号） */
.voice-hear-panel { display: flex; flex-wrap: wrap; gap: 6px; }
.vh-tile {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #eef6f2; color: var(--ink); cursor: pointer;
  font-weight: 700;
}
.vh-tile .vh-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, #f48a6e, var(--accent-dark));
  color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.vh-tile .vh-name { font-size: 12px; }
.vh-tile.muted { opacity: 0.45; background: #f0ece2; }
.vh-tile.muted .vh-num { background: #b9bfbc; }
.vh-tile.speaking { border-color: #3f9d6b; box-shadow: 0 0 0 2px rgba(63, 157, 107, 0.35); }
.vh-empty { font-size: 11.5px; color: var(--muted); padding: 4px 2px; }

/* ---------- 麦克风 dock（大厅左上角常驻；对局页隐藏用顶栏内联图标） ---------- */
.micdock {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: max(8px, env(safe-area-inset-left, 0px));
  z-index: 47;
  display: flex; flex-direction: row; gap: 6px;
  background: rgba(250, 247, 239, 0.95);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 7px;
  box-shadow: 0 6px 20px rgba(23, 60, 70, 0.22);
}
.micdock .vbtn { width: 30px; height: 30px; }
.micdock .vbtn svg { width: 16px; height: 16px; }

/* ---------- 微信分享指引层（微信内点击邀请/分享链接时显示） ---------- */
#wechat-share-guide {
  position: fixed;
  inset: 0;
  z-index: 80;   /* 高于聊天/语音面板/弹窗/toast */
  background: rgba(17, 32, 36, 0.74);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: guide-fade-in 0.2s ease;
}
@keyframes guide-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* 纯 CSS 箭头指向右上角微信 ··· 菜单 */
#wechat-share-guide .wsg-arrow {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: 26px;
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-bottom: 28px solid #ffffff;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
  animation: wsg-bob 1.5s ease-in-out infinite;
}
@keyframes wsg-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
#wechat-share-guide .wsg-card {
  width: min(312px, calc(100vw - 40px));
  margin-top: calc(74px + env(safe-area-inset-top, 0px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 20px 18px 18px;
  text-align: center;
}
#wechat-share-guide .wsg-title {
  font-size: 19px;
  font-weight: 800;
  color: #4a4233;
}
#wechat-share-guide .wsg-text {
  margin-top: 8px;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.7;
}
#wechat-share-guide .wsg-ok { margin-top: 16px; width: 100%; }
/* 减弱动态：去掉箭头摆动，只保留 120ms 淡入 */
@media (prefers-reduced-motion: reduce) {
  #wechat-share-guide .wsg-arrow { animation: none; }
  #wechat-share-guide { animation: guide-fade-in 0.12s ease; }
}

.msg-dot {
  position: absolute;
  top: 3px; right: 5px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 2px var(--panel);
}

/* ---------- 弹幕（玩家消息飘屏，大厅与对局共用） ---------- */
.danmaku {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}
.danmaku-item {
  position: absolute;
  left: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 74vw;
  background: rgba(40, 64, 71, 0.9);
  color: #fdf8ea;
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;          /* 单行弹幕：20 字内一行显示，超长由 JS 截断 */
  box-shadow: 0 4px 14px rgba(23, 60, 70, 0.3);
  animation: dm-move var(--dm-dur, 9s) linear forwards;
  will-change: transform;
}
.danmaku-item .dm-name { font-weight: 800; flex-shrink: 0; }
.danmaku-item .dm-text { overflow: hidden; text-overflow: ellipsis; }
@keyframes dm-move {
  to { transform: translateX(var(--dm-shift, -1500px)); }
}

/* ---------- 悔棋/和棋请求确认卡（居中弹窗，需处理才能继续走子） ---------- */
.undo-card {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  background: rgba(31, 80, 90, 0.42);
  padding: 20px;
}
.undo-card-body {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 10px 30px rgba(45, 38, 25, 0.32);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(360px, 100%);
  animation: pop .25s ease;
}
.undo-card-text { font-size: 15px; font-weight: 700; line-height: 1.5; text-align: center; }
.undo-card-text b { color: var(--accent-dark); }
.undo-card-btns { display: flex; gap: 10px; }
.undo-card-btns .btn { padding: 10px 26px; font-size: 15px; font-weight: 700; }

/* ---------- 首页：欢迎回来 / 邀请进房提示 ---------- */
.welcome-back {
  margin: -4px 0 12px;
  padding: 9px 16px;
  display: inline-block;
  background: #fdf3ea;
  border: 1px solid #efd9c4;
  border-radius: 999px;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(90,70,40,0.1);
}
.join-hint {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--accent-dark);
  background: #fdf3ea;
  border: 1px dashed #eccdb6;
  border-radius: 10px;
  padding: 9px 11px;
  line-height: 1.55;
  text-align: left;
}
.join-hint b { letter-spacing: 1px; }

/* 消息弹窗：点 💬 弹出，不点不显示（浮在功能区上方，避开输入法） */
.msg-popup {
  position: fixed;
  right: 10px;
  bottom: calc(80px + var(--kb-h, 0px) + env(safe-area-inset-bottom, 0px));
  width: min(360px, calc(100vw - 20px));
  height: 486px;
  max-height: min(62vh, 520px);
  z-index: 45;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(23, 60, 70, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px 8px;
}
.msg-title { font-size: 15px; font-weight: 800; color: #4a4233; }
.msg-tabs { display: flex; gap: 4px; padding: 6px 8px 8px; border-top: 1px solid var(--line); }
.msg-tab {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.msg-tab img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.msg-tab:not(.on) img { opacity: 0.6; }
.msg-tab.on img { opacity: 1; filter: drop-shadow(0 2px 3px rgba(45, 38, 25, 0.28)); }
/* 消息记录贴内容区上沿：高度随消息量自动伸缩（上限 196px，约 10 条完整可见），
 * 少消息时无空白；内容区 flex 填满剩余空间，猫包/狗包 16 个表情一屏全部显现。
 * 弹窗固定总高（bottom 锚定）→ 切换页签顶部齐平、不抖动。 */
.msg-history { flex: 0 0 auto; max-height: 196px; min-height: 0; }
.msg-content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
/* 文字页：记录区填满、消息底部对齐（贴输入框，无下方空白），输入框贴底 */
#chat-popup.tab-text .msg-history { flex: 1 1 auto; max-height: none; }
#chat-popup.tab-text .msg-history .chat-msg:first-child { margin-top: auto; }
#chat-popup.tab-text .msg-content { flex: 0 0 auto; }
/* 对局页：消息记录已转到棋盘下方动态条右列，弹窗只留发送区（表情/常用语），
 * 高度收窄；文字页保留记录区（贴着输入框看最近消息）。总高固定 → 切换不抖动 */
body.in-game .msg-popup { height: 356px; }
body.in-game #chat-popup:not(.tab-text) .msg-history { display: none; }
.msg-presets {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  height: 100%;
  overflow-y: auto;
}
.msg-preset {
  background: #f4f1e7;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 14px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--ink);
  text-align: left;
  flex-shrink: 0;
}
.msg-preset:active { background: #eadfc8; }
.msg-stickers-wrap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 2px;
  padding: 8px;
  border-top: 1px solid var(--line);
  height: 100%;
  overflow: hidden;
  align-content: start;
}
.msg-sticker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
}
.msg-sticker img { width: 44px; height: 44px; display: block; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(45, 38, 25, .15)); }
.msg-sticker span { font-size: 10.5px; color: var(--muted); line-height: 1; }
.msg-sticker:active { background: #f1ecdd; }
.chat-sticker { width: 64px; height: auto; max-height: 80px; display: block; align-self: flex-start; object-fit: contain; }
.dm-sticker { width: 40px; height: 40px; display: block; flex-shrink: 0; margin: -8px 0; object-fit: contain; }

/* ---------- 登录资料（昵称 / 性别 / 头像 + 弹窗内成就墙） ---------- */
.profile-card { width: min(420px, 100%); max-height: calc(100vh - 32px); overflow: hidden; padding: 14px 18px 12px; }
.profile-head { display: flex; align-items: center; gap: 11px; margin-bottom: 7px; padding-right: 28px; }
.profile-head .profile-avatar-box { flex-shrink: 0; width: 58px; height: 58px; font-size: 24px; }
.profile-head-fields { flex: 1; min-width: 0; text-align: left; }
.profile-name-line { display: flex; align-items: center; gap: 5px; width: 100%; }
#profile-name { flex: 1; min-width: 0; border: none; background: transparent; font-size: 18px; font-weight: 800; color: #4a4233; padding: 3px 0; border-bottom: 1px dashed transparent; outline: none; }
#profile-name::placeholder { color: #c9bda6; font-weight: 400; }
#profile-name:focus { border-bottom-color: #cfb06a; background: transparent; }
.profile-name-edit { color: #c3b69c; font-size: 13px; flex-shrink: 0; }
.profile-head-fields .seg { display: inline-flex; flex: 0 0 auto; gap: 2px; margin: 0 0 0 2px; padding: 2px; border: 1px solid #ddd2bc; border-radius: 999px; background: #f7f3e9; }
.profile-head-fields .seg button { flex: 0 0 auto; width: 29px; min-width: 0; min-height: 22px; padding: 2px 0; font-size: 10px; line-height: 1; border-radius: 999px; border: 0; background: transparent; color: #8b7a62; }
.profile-head-fields .seg button.on { border-color: #c9a24a; background: #f6eacb; color: #8a6a1e; font-weight: 700; }
.profile-edit-tip { font-size: 9.5px; color: var(--muted); margin: 0 0 4px; text-align: center; line-height: 1.3; }
.profile-card:not(.is-editing) .profile-edit-controls { display: none; }
.profile-avatar-box {
  width: 88px; height: 88px; border-radius: 50%;
  border: 2.5px solid var(--line);
  background: #f4f1e7;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  overflow: hidden;
  cursor: pointer;
}
.profile-avatar-box img { width: 100%; height: 100%; object-fit: cover; }
.profile-hint { font-size: 10px; color: var(--muted); }
.profile-sign-field { margin-bottom: 5px; display: block; text-align: left; }
.profile-sign-field span { display: block; margin-bottom: 4px; font-size: 12px; color: #4a4233; font-weight: 700; }
.profile-sign-field textarea { width: 100%; min-height: 34px; resize: none; line-height: 1.35; }
.profile-card:not(.is-editing) .profile-sign-field textarea:not(:focus) { border-color: transparent; background: transparent; padding-left: 0; padding-right: 0; outline: none; }
.profile-card:not(.is-editing) .profile-sign-field textarea:focus { border: 1px solid #cfb06a; border-radius: 7px; outline: none; background: #fffdf7; }
.profile-ach-divider { display: flex; align-items: center; gap: 8px; color: #a77525; font-size: 12px; font-weight: 800; letter-spacing: .08em; margin: 6px 0 4px; }
.profile-ach-divider::before, .profile-ach-divider::after { content: ''; flex: 1; height: 1px; background: rgba(190,146,70,.28); }
@keyframes limitFlash { 0% { background: rgba(255,224,150,.9); } 100% { background: transparent; } }
.profile-edit-tip.flash, .profile-hint.flash { border-radius: 8px; animation: limitFlash .7s ease; }
.profile-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.player-info-card { position: relative; text-align: center; width: min(360px, 100%); }
.player-info-card .profile-avatar-box { margin: 0 auto 8px; }
.player-info-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.player-info-stats > div { padding: 10px 4px; border-radius: 12px; background: #f5efe4; }
.player-info-ach { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.player-info-ach span { padding: 6px 9px; border-radius: 999px; background: #fff2c9; color: #6b5424; font-size: 12px; }
.slot-avatar { cursor: pointer; }
.profile-preset {
  border: 2.5px solid transparent; border-radius: 50%;
  padding: 0; background: none; cursor: pointer;
  width: 100%; aspect-ratio: 1; overflow: hidden;
}
.profile-preset img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.profile-preset.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201, 106, 74, 0.25); }
.profile-error { color: var(--danger); font-size: 13px; margin-bottom: 8px; text-align: center; }
/* 首页迷你资料卡（展示用：修改资料去「我的」页） */
.profile-mini { display: flex; align-items: center; gap: 10px; }
.profile-avatar-mini {
  width: 44px; height: 44px; border-radius: 50%;
  background: #f4f1e7; border: 2px solid var(--line);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.profile-avatar-mini img { width: 100%; height: 100%; object-fit: cover; }
.profile-name-mini { font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 各处的头像图（大厅座位 / 对局头像排 / 聊天 / 弹幕） */
.seat-avatar img, .slot-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.who-avatar img { width: 17px; height: 17px; border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: -3px; }
.dm-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

/* ---------- 结算 ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(31, 80, 90, 0.42);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 20px;
}
/* 通用确认框需盖在结算弹窗之上（两者同为 .modal，且确认框 DOM 在结算之前，默认会被压住） */
#modal-confirm { z-index: 55; }
.modal-card {
  background: #fdfcf8;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 16px 44px rgba(23, 60, 70, 0.3);
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-card h2 { color: #4a4233; margin-bottom: 14px; }
.result-list { list-style: none; text-align: left; margin-bottom: 18px; }
.result-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
}
.result-list li:nth-child(1) { background: #f7efe0; font-size: 16px; }
.result-list li:nth-child(2) { background: #f2f0e8; }
.result-list li:nth-child(3) { background: #f6e8e1; }
.result-list li.draw-note { justify-content: center; text-align: center; font-size: 15px; background: #f7efe0; }
.result-list li .r-medal { width: 26px; text-align: center; font-size: 18px; }
.result-list li .r-name { flex: 1; }
.result-list li .r-rank { color: var(--muted); font-size: 12px; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions .btn { flex: 1; }

/* ---------- 连接遮罩 / Toast ---------- */
.conn-overlay {
  position: fixed; inset: 0;
  background: transparent;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 12vh;
  z-index: 60; pointer-events: none;
}
.conn-card { background: rgba(253, 252, 248, 0.96); border-radius: 999px; padding: 7px 14px; text-align: center; box-shadow: 0 4px 16px rgba(23, 60, 70, 0.14); display: flex; align-items: center; gap: 8px; }
.spinner {
  width: 12px; height: 12px;
  border: 2px solid #e2dcc8;
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#conn-text { font-size: 12px; color: var(--muted); margin: 0; }

/* ---------- 服务器离线提示（首页连接失败时显示） ---------- */
.offline-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, rgba(245, 240, 228, 0.9), rgba(217, 205, 178, 0.92));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 60; padding: 16px;
  overflow-y: auto;
}
.offline-card {
  background: var(--panel);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow-lg);
  max-width: 360px; width: 100%;
  max-height: 100%;
  padding: 20px;
  text-align: center;
}
.offline-head { position: relative; width: 76px; height: 76px; margin: 0 auto 6px; }
.offline-cat {
  width: 76px; height: 76px; object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(23, 60, 70, 0.18));
}
.offline-zzz {
  position: absolute; top: -2px; right: -8px;
  font-size: 22px;
  animation: offline-zzz 2.2s ease-in-out infinite;
}
@keyframes offline-zzz {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(-6px); opacity: 1; }
}
.offline-title { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.offline-desc { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.offline-desc-em {
  display: inline-block;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-dark);
}

/* 金色按钮（离线页「再试一次」） */
.btn.gold {
  background: linear-gradient(135deg, #f8cd6b, #f2b544);
  color: #4a3200;
  font-weight: 700;
  border: 1px solid rgba(180, 128, 30, 0.4);
  box-shadow: 0 2px 6px rgba(180, 128, 30, 0.25);
}
.btn.gold:active { box-shadow: none; }

/* 微信名片卡（竖版名片原比例展示，不裁剪不压缩；左右结构，点击可看原图） */
.offline-wechat {
  display: flex; flex-direction: row; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #fff9ea, #fdf0d3);
  border: 1px solid rgba(242, 181, 68, 0.45);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: left;
}
.offline-qr-link { flex: 0 0 auto; line-height: 0; }
.offline-qr {
  width: 124px; height: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  display: block;
}
.offline-wechat-info { min-width: 0; flex: 1; text-align: left; }
.offline-wechat-value { font-size: 12px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.offline-wechat-num { font-size: 15px; font-weight: 700; color: var(--accent-dark); margin-bottom: 8px; white-space: nowrap; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(40, 64, 71, 0.92);
  color: #faf7ef;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 70;
  max-width: 86vw;
  text-align: center;
}

/* ---------- 对局弹层：统一明亮休闲卡片风格（与全局浅色面板一致） ---------- */
body.in-game .sheet-panel,
body.in-game .voice-panel,
body.in-game .msg-popup,
body.in-game .undo-card-body,
body.in-game .modal-card {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 18px 46px rgba(23, 60, 70, 0.3);
}
body.in-game .sheet-title,
body.in-game .voice-title,
body.in-game .modal-card h2,
body.in-game .undo-card-text {
  color: var(--ink);
}
body.in-game .undo-card-text b { color: var(--accent-dark); }
body.in-game .conn-card { background: var(--panel); }
body.in-game .switch-row { border-top-color: var(--line); color: var(--ink); }
body.in-game .switch-row .sw { background: #d3d9d6; }
body.in-game .switch-row input:checked + .sw { background: #2ca0ad; }
/* 对局面板四个操作按钮的对局态配色：历史上 `body.in-game .opt-item` 与
 * `body.in-game .btn` 同优先级、被后者按源码顺序压过，实际渲染为 .btn 的奶油白 #efece1。
 * 收紧到 #panel-options 后本规则优先级升高，这里显式写回当前实际渲染值，
 * 保证「限定作用域」是纯粹的无视觉变更改动（不再依赖源码顺序，行为确定）。 */
body.in-game #panel-options .opt-item {
  background: #efece1;
  border-color: var(--line);
  color: var(--ink);
}
body.in-game .btn { background: #efece1; color: var(--ink); }
body.in-game .btn.primary {
  background: linear-gradient(135deg, #f48a6e, var(--accent-dark));
  color: #fff;
}
body.in-game .btn.ghost {
  background: transparent;
  border-color: rgba(40, 64, 71, 0.3);
  color: var(--ink);
}
body.in-game .chat-msg { background: #f2efe4; color: var(--ink); }
body.in-game .chat-msg.sys { color: var(--muted); background: transparent; }
body.in-game .chat-input-row {
  background: var(--panel);
  border-top-color: var(--line);
}
body.in-game .chat-input-row input { background: #f2efe4; color: var(--ink); }
body.in-game .msg-presets { border-top-color: var(--line); }
body.in-game .msg-preset {
  background: #f2efe4;
  border-color: var(--line);
  color: var(--ink);
}
body.in-game .msg-preset:active { background: #e8e1cf; }
body.in-game .msg-stickers-wrap { border-top-color: var(--line); }
body.in-game .msg-sticker span { color: var(--muted); }
body.in-game .msg-sticker:active { background: #f1ecdd; }
body.in-game .msg-tabs { border-top-color: var(--line); }
body.in-game .msg-tab:not(.on) img { opacity: 0.65; }
body.in-game .voice-status { color: var(--muted); }
body.in-game .voice-status.live { color: #3f9d6b; }
body.in-game .voice-head .voice-x { color: var(--muted); }
body.in-game .voice-ctl { background: #efece1; border-color: var(--line); color: var(--ink); }
body.in-game .voice-ctl.mic.on { background: linear-gradient(135deg, #f48a6e, var(--accent-dark)); color: #fff; }
body.in-game .voice-ctl.mic.on .voice-ctl-tx, body.in-game .voice-ctl.mic.on .voice-ctl-sub { color: #fff; }
body.in-game .voice-ctl.hear.on { border-color: #2ca0ad; background: #e3f2ef; }
body.in-game .voice-ctl.hear.on .voice-ctl-sub { color: #166b77; }
body.in-game .voice-ctl .voice-ctl-sub { color: var(--muted); }
body.in-game .vh-tile { background: #eef6f2; border-color: var(--line); color: var(--ink); }
body.in-game .vh-tile.muted { background: #f0ece2; opacity: 0.5; }
body.in-game .vh-empty { color: var(--muted); }
body.in-game .micdock { display: none; }   /* 对局页用顶栏内联「麦/听」图标，隐藏左上角固定 dock */
body.in-game .md-btn { background: #efece1; border-color: var(--line); color: var(--ink); }
body.in-game .md-btn.on { background: linear-gradient(135deg, #f48a6e, var(--accent-dark)); color: #fff; border-color: transparent; }
body.in-game .mic-scope { background: #efece1; border-color: var(--line); color: var(--muted); }
body.in-game .mic-scope.all { background: #fee9d7; color: #b45a3c; border-color: #e8b98a; }
body.in-game .md-status.live { color: #3f9d6b; }
body.in-game .voice-hint {
  color: #8a6d3b;
  background: #fbf3df;
  border-color: #ecdcb8;
}
body.in-game .voice-diag { color: var(--muted); }
body.in-game .confirm-text { color: var(--ink); }
body.in-game .copy-text {
  background: #faf7ef;
  border-color: var(--line);
  color: var(--ink);
}
body.in-game .result-list li { background: #f2f0e8; }
body.in-game .result-list li:nth-child(1) { background: #f7efe0; }
body.in-game .result-list li:nth-child(2) { background: #f2f0e8; }
body.in-game .result-list li:nth-child(3) { background: #f6e8e1; }
body.in-game .result-list li.draw-note { background: #f7efe0; }
body.in-game .result-list li .r-rank { color: var(--muted); }
body.in-game .msg-dot { box-shadow: 0 0 0 2px var(--panel); }

/* DEV 预览角标：仅本地 8091 预览时显示，线上永不显示 */
.dev-badge {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999;
  padding: 5px 12px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .28);
}

/* ---------- 情人节冠军彩蛋（仅当前客户端本人触发，其余走原结算样式） ---------- */
/* 遮罩：保持棋盘可见（结算层本身透明），只保留淡入动画与心形粒子 */
#modal-result.valentine-modal {
  animation: valentine-mask-in .22s ease;
}
@keyframes valentine-mask-in { from { opacity: 0; } to { opacity: 1; } }

/* 顶部战绩卡：彩蛋粉调渐变 + 金边（覆盖 result-top 默认米白底） */
.valentine-card {
  border: 2px solid rgba(236, 185, 93, .85);
  background: linear-gradient(180deg, #fff9f2 0%, #fff4f5 100%);
  animation: valentine-card-in .36s cubic-bezier(.2, .8, .2, 1);
}
@keyframes valentine-card-in {
  from { transform: translateY(16px) scale(.96); }
  to { transform: none; }
}

/* 彩蛋徽章 */
.valentine-badge {
  display: inline-block;
  background: #ffedbc;
  color: #8f531e;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 2px;
}

/* 插画（WebP 首选 / PNG 回退，picture 包裹；原图不裁切不加字） */
.valentine-art {
  display: block;
  width: 206px;
  height: 206px;
  margin: 8px auto 6px;
  object-fit: contain;
  border-radius: 28px;
}
@media (max-width: 480px) {
  .valentine-art { width: 190px; height: 190px; }
}

/* 标题 / 正文 / 分割线 */
.valentine-title {
  color: #6f4134;
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px;
}
@media (max-width: 480px) {
  .valentine-title { font-size: 21px; }
}
.valentine-text {
  color: #69534c;
  font-size: 15px;
  line-height: 1.8;
  text-align: center;
  margin: 0 0 8px;
}
.valentine-divider {
  border: none;
  border-top: 1px solid #eadacc;
  margin: 10px 0 12px;
}

/* 第一名行高亮（排名本身仍来自服务端权威 ranking） */
#modal-result.valentine-modal .result-list li.valentine-first {
  background: #ffefce;
  border-radius: 13px;
}

/* 主按钮：粉红渐变、白字、46px 高；次按钮沿用原「返回首页」样式 */
#modal-result.valentine-modal .btn-valentine-primary {
  height: 46px;
  border: none;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #ff7a7f, #ef5c6a);
  box-shadow: 0 6px 16px rgba(239, 92, 106, .35);
}

/* CSS 心形粒子（span + 两圆伪元素）：上浮渐隐，结束后由 JS 删除节点 */
.valentine-heart {
  position: absolute;
  pointer-events: none;
  width: 16px;
  height: 16px;
  background: var(--vh-color, #ff7c87);
  transform: rotate(45deg);
  opacity: 0;
  animation: valentine-heart-rise var(--vh-dur, 2.2s) ease-out forwards;
}
.valentine-heart::before,
.valentine-heart::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: inherit;
}
.valentine-heart::before { left: -8px; top: 0; }
.valentine-heart::after { left: 0; top: -8px; }
@keyframes valentine-heart-rise {
  0% { transform: translateY(0) translateX(0) rotate(45deg) scale(.9); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(-42vh) translateX(var(--vh-drift, 0px)) rotate(45deg) scale(.7); opacity: 0; }
}

/* 减弱动态：取消位移/缩放与粒子，只保留 120ms 淡入 */
@media (prefers-reduced-motion: reduce) {
  #modal-result.valentine-modal { animation: valentine-mask-in .12s ease; }
  .valentine-card { animation: valentine-mask-in .12s ease; }
  #modal-result .valentine-heart { display: none; }
}

/* ============================================================
 * 棋谱功能（一期）：结算新样式 / 复盘模式 / 棋谱列表 / 我的棋谱
 * ============================================================ */

/* ---------------- 结算层：双旗对阵 + 缩小的真实终局棋盘 ----------------
 * 结算层不另铺背景，继续使用当前棋盘页的青绿桌面；顶部只承载两面等高旗帜与笔触 VS，
 * 中部透出真实 canvas 终局局面，底部保留再来一局 / 返回首页 / 分享。 */
#modal-result.result-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 8px calc(8px + env(safe-area-inset-bottom));
  background: transparent;
  pointer-events: none;
  overflow: hidden;
}
/* 分享/海报弹窗需盖在结算层之上（同为 .modal，DOM 顺序在结算之前） */
#modal-share { z-index: 56; }
#modal-poster { z-index: 57; }
#modal-result.result-overlay .result-top,
#modal-result.result-overlay .result-actions { pointer-events: auto; }

/* 顶部舞台没有白色弹窗底：旗帜直接悬挂在原桌面上。 */
#modal-result.result-overlay .result-top {
  position: relative;
  width: min(430px, 100%);
  height: clamp(224px, 31dvh, 274px);
  padding: 0 27px;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}
/* 普通结算由大“胜”承担标题；h2 保留给读屏、测试与和棋语义。 */
#modal-result.result-overlay h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.result-note {
  display: none;
}
#modal-result .result-list.result-banners {
  position: relative;
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  width: 100%;
  height: 100%;
  margin: 0;
  text-align: center;
}
#modal-result .result-banners > li {
  display: flex;
  padding: 0;
  border-radius: 0;
  background: none;
  font-weight: 400;
  font-size: 14px;
}
#modal-result .result-banners > li.rb {
  position: relative;
  min-width: 0;
  height: clamp(210px, 29.5dvh, 260px);
  filter: drop-shadow(0 7px 8px rgba(20, 55, 61, .2));
  animation: result-flag-drop .34s cubic-bezier(.2, .78, .25, 1) both;
}
#modal-result .result-banners > li.rb-side-right { animation-delay: .04s; }
@keyframes result-flag-drop {
  from { transform: translateY(-18px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.rb-flag {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 100%;
  padding: calc(15px + env(safe-area-inset-top)) 9px 38px;
  color: #435c5e;
  background:
    linear-gradient(90deg, rgba(184, 143, 66, .34), transparent 8%, transparent 92%, rgba(184, 143, 66, .34)),
    linear-gradient(180deg, rgba(255,255,255,.38), transparent 32%),
    linear-gradient(180deg, #f5f0e2 0%, #e8e1cf 100%);
  clip-path: polygon(0 0, 100% 0, 100% 80%, 92% 97%, 78% 89%, 65% 100%, 50% 90%, 35% 100%, 22% 89%, 8% 97%, 0 80%);
  overflow: hidden;
}
.rb-flag::before {
  content: '';
  position: absolute;
  inset: 5px 6px 24px;
  z-index: -1;
  border: 1px solid rgba(164, 126, 59, .45);
  border-bottom: 0;
  border-radius: 0 0 34px 34px;
  pointer-events: none;
}
#modal-result .result-banners > li.rb-win .rb-flag {
  color: #fff1cf;
  background:
    linear-gradient(90deg, rgba(115, 37, 30, .32), transparent 8%, transparent 92%, rgba(115, 37, 30, .32)),
    linear-gradient(180deg, rgba(255,255,255,.16), transparent 30%),
    linear-gradient(180deg, #d96e59 0%, #b8463d 100%);
}
#modal-result .result-banners > li.rb-win .rb-flag::before {
  border-color: rgba(255, 217, 142, .55);
}
.rb-avatar {
  width: clamp(54px, 8.3dvh, 66px);
  height: clamp(54px, 8.3dvh, 66px);
  border-radius: 50%;
  overflow: hidden;
  background: #efe9d8;
  border: 2px solid #cba85e;
  box-shadow: 0 2px 7px rgba(65, 49, 28, .24), inset 0 0 0 2px rgba(255,255,255,.5);
  flex-shrink: 0;
}
.rb-win .rb-avatar { border-color: #f1cd79; }
.rb-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rb-name {
  order: -1;
  width: 100%;
  min-height: 18px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: .2px;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-sub {
  min-width: 72px;
  min-height: 24px;
  padding: 2px 11px;
  border: 1px solid rgba(174, 130, 55, .62);
  border-radius: 999px;
  background: rgba(255, 250, 232, .78);
  color: #6b552d;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}
#modal-result .rb-win .rb-sub {
  border-color: rgba(255, 221, 151, .72);
  background: rgba(100, 31, 25, .24);
  color: #fff0ca;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
}
.rb-win-tag {
  position: absolute;
  top: clamp(72px, 10.5dvh, 92px);
  z-index: 3;
  display: grid;
  place-items: center;
  width: 58px;
  height: 60px;
  color: #fff0c2;
  font-family: STKaiti, KaiTi, serif;
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
  text-shadow:
    -2px -2px 0 #8d2e28, 2px -2px 0 #8d2e28,
    -2px 2px 0 #8d2e28, 2px 2px 0 #8d2e28,
    0 4px 0 #76231f, 0 7px 9px rgba(72, 27, 23, .35);
  transform: rotate(-4deg);
  pointer-events: none;
}
.rb-side-left .rb-win-tag { left: -25px; }
.rb-side-right .rb-win-tag { right: -25px; }
#modal-result .result-banners > li.rb-vs {
  position: relative;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  padding-top: clamp(68px, 10.5dvh, 92px);
  background: none;
  border: none;
  box-shadow: none;
}
#modal-result .rb-vs picture { display: contents; }
#modal-result .rb-vs-img {
  display: block;
  width: 62px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgba(64, 45, 19, .25));
}
#modal-result .result-banners > li.rb-rankline {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
.rb-chip {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.42);
  background: rgba(255, 250, 235, .72);
  color: #526463;
  font-size: 9.5px;
  white-space: nowrap;
}
.rb-chip.win { border-color: rgba(247, 200, 103, .76); color: #8a4b32; font-weight: 700; }

/* 结算态：隐藏原 HUD，把真实 canvas 缩小、下移。背景 class 完全不变。 */
#screen-game.result-mode .game-top,
#screen-game.result-mode .seats-row,
#screen-game.result-mode .func-row {
  visibility: hidden;
  pointer-events: none;
}
#screen-game.result-mode .game-main {
  position: absolute;
  top: clamp(232px, 32.5dvh, 286px);
  left: 0;
  right: 0;
  z-index: 1;
  overflow: visible;
}
#screen-game.result-mode .board-box { overflow: visible; }
#screen-game.result-mode .board-inner {
  transform-origin: top center;
  animation: result-board-settle .38s cubic-bezier(.2, .76, .24, 1) both;
}
@keyframes result-board-settle {
  from { transform: translateY(-8px) scale(.92); opacity: .82; }
  to { transform: translateY(0) scale(.84); opacity: 1; }
}

/* 底部操作排（再来一局 / 返回首页 / 分享） */
.result-actions {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 252, 244, 0.97);
  border: 1px solid var(--table-line-strong);
  border-radius: 18px;
  padding: 9px 10px;
  box-shadow: 0 8px 26px rgba(23, 60, 70, 0.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.result-actions .btn { flex: 1; font-size: 14px; padding: 12px 4px; font-weight: 700; }
#modal-result .result-actions .btn.result-main {
  background: linear-gradient(135deg, #f48a6e, var(--accent-dark));
  color: #fff;
  border-color: rgba(180, 60, 40, 0.35);
  box-shadow: 0 4px 12px rgba(217, 95, 67, 0.35);
}
#modal-result .result-actions .btn.result-sub {
  background: #efece1;
  color: var(--ink);
  border-color: var(--line);
}
#modal-result .result-actions .btn.result-gold {
  background: linear-gradient(135deg, #f8cd6b, #f2b544);
  color: #4a3200;
  border-color: rgba(180, 128, 30, 0.4);
  box-shadow: 0 4px 12px rgba(180, 128, 30, 0.3);
  font-weight: 700;
}

/* 低矮屏幕压缩旗帜与棋盘，保证六个尖角和底部按钮都完整可见。 */
@media (max-height: 700px) {
  #modal-result.result-overlay .result-top { height: 214px; padding-inline: 25px; }
  #modal-result .result-banners > li.rb { height: 204px; }
  .rb-flag { padding-top: calc(11px + env(safe-area-inset-top)); gap: 5px; }
  .rb-avatar { width: 52px; height: 52px; }
  #modal-result .result-banners > li.rb-vs { padding-top: 65px; }
  #screen-game.result-mode .game-main { top: 218px; }
  @keyframes result-board-settle {
    from { transform: translateY(-8px) scale(.88); opacity: .82; }
    to { transform: translateY(0) scale(.76); opacity: 1; }
  }
}
@media (max-width: 350px) {
  #modal-result.result-overlay .result-top { padding-inline: 23px; }
  #modal-result .result-list.result-banners { grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr); gap: 5px; }
  #modal-result .rb-vs-img { width: 54px; height: 54px; }
  .rb-win-tag { width: 50px; font-size: 34px; }
  .rb-side-left .rb-win-tag { left: -23px; }
  .rb-side-right .rb-win-tag { right: -23px; }
}
@media (prefers-reduced-motion: reduce) {
  #modal-result .result-banners > li.rb,
  #screen-game.result-mode .board-inner { animation-duration: .12s; }
}

/* 节日彩蛋仍使用原独立卡片，不受普通双旗高度约束。 */
#modal-result.valentine-modal { overflow-y: auto; }
#modal-result.valentine-modal .result-top {
  height: auto;
  margin-top: calc(8px + env(safe-area-inset-top));
  padding: 12px;
  border: 2px solid rgba(236, 185, 93, .85);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff9f2 0%, #fff4f5 100%);
  box-shadow: 0 8px 26px rgba(23, 60, 70, .22);
  overflow: hidden;
}

/* ---------------- 复盘模式（复用对局页同一画布：只覆盖 HUD，不动棋盘几何） ---------------- */
#screen-game.replay-mode .game-top,
#screen-game.replay-mode .seats-row,
#screen-game.replay-mode .func-row {
  visibility: hidden;    /* 保留占位：棋盘布局与进出复盘前后完全一致 */
}
#screen-game .replay-hud { display: none; }
#screen-game.replay-mode .replay-hud {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;   /* 透明区不挡棋盘；控件各自恢复 */
}
.replay-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 6px 0;
  pointer-events: auto;
}
.rp-close {
  flex: 0 0 34px;
  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1px solid var(--table-line);
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.rp-close:active { transform: scale(0.94); }
.replay-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}
.replay-chips { display: flex; align-items: center; gap: 5px; margin-left: auto; min-width: 0; flex-wrap: nowrap; }
.rp-result-chip {
  background: linear-gradient(135deg, #f8cd6b, #f2b544) !important;
  color: #4a3200 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(180, 128, 30, 0.35) !important;
}
.rp-listbtn {
  border: none;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* 复盘座位排（复用 .seats-row 视觉；名次徽章挂头像右上） */
.replay-seats { padding: 0 6px; pointer-events: none; }
.rp-slot .slot-name { font-size: 12px; }
.rp-slot-sub { font-size: 10px; }
.rp-slot.rp-forfeit .slot-avatar { filter: grayscale(0.5); opacity: 0.75; }
.rp-rank-badge {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 20px; height: 20px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid var(--table-line);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(23, 60, 70, 0.25);
}
.rp-rank-badge.rp-win {
  background: linear-gradient(135deg, #f8cd6b, #f2b544);
  color: #4a3200;
  border-color: #d99a2b;
}
.rp-slot .slot-avatar-box { position: relative; }

/* 复盘控制面板（底部）：步数 chip + 进度滑块 + 走步按钮 + 速度 */
.replay-panel {
  margin-top: auto;
  pointer-events: auto;
  background: rgba(255, 252, 244, 0.94);
  border: 1px solid var(--table-line-strong);
  border-radius: 15px;
  padding: 8px 10px 9px;
  margin-left: 6px;
  margin-right: 6px;
  box-shadow: 0 6px 20px rgba(23, 60, 70, 0.28);
}
.replay-step-chip {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin-bottom: 6px;
  min-height: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.replay-scrub {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
  display: block;
  margin: 0;
}
.replay-scrub::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f2b544, #e8dcc0);
  box-shadow: inset 0 1px 2px rgba(23, 60, 70, 0.2);
}
.replay-scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #f8cd6b, #e59b2c);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(23, 60, 70, 0.35);
  margin-top: -6px;
}
.replay-scrub::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f2b544, #e8dcc0);
}
.replay-scrub::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #f8cd6b, #e59b2c);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(23, 60, 70, 0.35);
}
.replay-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 2px;
}
.rp-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f7f2e6;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(23, 60, 70, 0.12);
}
.rp-btn:active { transform: scale(0.93); }
.rp-btn.rp-play {
  width: 52px;
  background: linear-gradient(135deg, #f48a6e, var(--accent-dark));
  color: #fff;
  border-color: rgba(180, 60, 40, 0.35);
  font-size: 17px;
}
.rp-btn.rp-play.rp-playing { background: linear-gradient(135deg, #54b6a2, #3d9987); border-color: rgba(40, 120, 100, 0.4); }
.rp-speed {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.rp-speed button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 7px;
  border-radius: 999px;
  cursor: pointer;
}
.rp-speed button.on {
  background: linear-gradient(135deg, #f8cd6b, #f2b544);
  color: #4a3200;
  box-shadow: 0 1px 4px rgba(180, 128, 30, 0.3);
}

/* ---------------- 棋谱记录抽屉（复盘可跳转 / 对局中只读） ---------------- */
.movelist-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 14px 4px;
  border-bottom: 1px solid var(--line);
}
.ml-tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 11px;
  cursor: pointer;
}
.ml-tab.on {
  background: var(--seat-color, #e8e1cf);
  color: #fff;
  border-color: transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.movelist-rows {
  max-height: 46vh;
  overflow-y: auto;
  padding: 6px 12px 14px;
  -webkit-overflow-scrolling: touch;
}
.ml-start {
  font-size: 11px;
  color: var(--muted);
  padding: 6px 4px 4px;
  font-weight: 600;
}
.ml-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 7px 8px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.ml-row:active { background: #f1ecdd; }
.ml-row.cur { background: #fdf3d6; box-shadow: inset 0 0 0 1.5px #ecc774; }
.ml-no {
  flex: 0 0 30px;
  font-weight: 800;
  color: #caa24e;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.ml-dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; }
.ml-who {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.ml-path { flex: 0 0 auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ml-warn { font-size: 11px; color: var(--muted); text-align: center; padding: 8px 0 2px; }

/* ---------------- 我的棋谱 ---------------- */
.hist-wrap { max-width: 460px; margin: 0 auto; padding: 14px 12px calc(108px + env(safe-area-inset-bottom, 0px)); }
.hist-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 251, 240, 0.75);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 8px;
}
.hist-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 9px 0;
  border-radius: 10px;
  cursor: pointer;
}
.hist-tab.on {
  background: linear-gradient(135deg, #f8cd6b, #f2b544);
  color: #4a3200;
  box-shadow: 0 2px 8px rgba(180, 128, 30, 0.3);
}
.hist-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 8px;
}
.hist-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.hist-filter {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.hist-list { display: flex; flex-direction: column; gap: 10px; }
.rec-empty {
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-line;
}

/* 对局卡片：头行 + 玩家 VS + 名次条 + 收藏/分享（视觉参考图8：紧凑卡片、小头像） */
.rec-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.rec-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px 2px;
}
.rec-mode {
  font-size: 11px;
  font-weight: 800;
  color: #8a5b00;
  background: linear-gradient(135deg, #fcebc4, #f5d68e);
  border: 1px solid #ecc774;
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
/* 时间右对齐（参考图8：模式在左、日期在右；最近对局无删除按钮） */
.rec-time { flex: 1; text-align: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* 主体：头像（我=红圈）+ 昵称/蓝牌竖排，中间大水印 VS（参考图8） */
.rec-main {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  min-height: 62px;
}
.rec-side {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
/* 镜像对称（用户要求）：右侧玩家 头像在右、昵称在左，与左侧玩家左右对称 */
.rec-main .rec-side:last-child { flex-direction: row-reverse; }
.rec-main .rec-side:last-child .rec-sideinfo { align-items: flex-end; }
.rec-main .rec-side:last-child .rec-winflag { left: -6px; right: auto; }
.rec-avatarwrap { position: relative; flex-shrink: 0; }
.rec-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: #efe9d8;
  border: 2px solid #e3d5b2;
}
/* 我 = 头像红圈（参考图8：可耻嘉致/我方永远红圈，无粉底红框）；胜方同样红圈 + 胜角标 */
.rec-side.me .rec-avatar,
.rec-side.win .rec-avatar {
  border-color: #e5533f;
  box-shadow: 0 0 0 2px rgba(229, 83, 63, 0.28);
}
.rec-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rec-sideinfo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}
.rec-pname {
  font-size: 12.5px; font-weight: 700; color: #4a4233;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rec-side.me .rec-pname, .rec-side.win .rec-pname { color: #a3452e; }
.rec-pname.dim { color: var(--muted); font-weight: 600; }
/* 名次牌：蓝底白字圆角小牌（参考图8：至尊星云18星 同款） */
.rec-pbadge {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #57a6e0, #2f7fc0);
  border-radius: 999px;
  padding: 1.5px 8px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-pbadge.draw { background: linear-gradient(135deg, #b3a98e, #948a6e); }
.rec-winflag {
  position: absolute;
  top: -5px; right: -6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff7a70, #e5302a 70%);
  color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(200, 40, 40, 0.4);
}
/* 大水印 VS：居中跨卡片高度，浅灰半透明（参考图8） */
.rec-vs {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 2px;
  color: rgba(173, 160, 133, 0.32);
  pointer-events: none;
  user-select: none;
}
.rec-rankline {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  padding: 0 10px 8px;
}
.rec-rank-chip {
  font-size: 10.5px;
  background: #f4eddc;
  border: 1px solid #e6dab8;
  border-radius: 999px;
  padding: 2px 8px;
  color: #6a5b3a;
}
.rec-rank-chip.me { background: #fde8e2; border-color: #f0b4a0; color: #a3452e; font-weight: 700; }
.rec-rank-chip.win { background: #fdf3d6; border-color: #ecc774; color: #8a5b00; font-weight: 700; }
.rec-foot {
  display: flex;
  border-top: 1px solid var(--line);
}
.rec-fav, .rec-share, .rec-show {
  flex: 1;
  border: none;
  background: #fbf8ef;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 0;
  cursor: pointer;
}
.rec-fav { border-right: 1px solid var(--line); }
.rec-fav.on { color: #b5760c; }
.rec-share { color: #2c7f8c; }
.rec-show { color: #6d8276; }
.rec-show.on { color: #079d50; }
.rec-fav:active, .rec-share:active, .rec-show:active { background: #f1ecdd; }

/* 筛选面板 */
.hist-filter-group { padding: 10px 16px 6px; }
.hist-filter-title { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 7px; }
.hist-filter-opts { display: flex; flex-wrap: wrap; gap: 7px; }
.hist-filter-opts button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.hist-filter-opts button.on {
  background: linear-gradient(135deg, #f8cd6b, #f2b544);
  color: #4a3200;
  border-color: #d99a2b;
  box-shadow: 0 2px 6px rgba(180, 128, 30, 0.25);
}
.hist-filter-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
}
.hist-filter-actions .btn { flex: 1; }

/* 复盘/棋谱在小屏上的收紧 */
@media (max-width: 500px) {
  .replay-title { display: none; }   /* 顶部窄：标题让位给 单跳/回合/结果/分享/棋谱列表 徽章 */
  .rp-btn { width: 36px; height: 36px; font-size: 13px; }
  .rp-btn.rp-play { width: 46px; }
  .rp-speed button { padding: 4px 5px; font-size: 10px; }
  .rb-avatar { width: 46px; height: 46px; }
}

/* ---------- 二期：棋谱分享（码 + 链接 + 海报）+ 回看提示 + 棋谱码输入 ---------- */
/* 复盘回看中提示条 */
.rp-live-tip {
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: rgba(217, 95, 67, 0.85);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
#replay-live-tip.hidden { display: none; }

/* 我的棋谱页：棋谱码输入行 */
.hist-code-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.hist-code-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 12px;
  font-size: 14px;
  letter-spacing: 2px;
  font-weight: 700;
  text-transform: uppercase;
}
.hist-code-row input:focus { outline: 2px solid rgba(242, 181, 68, 0.6); border-color: #e6c06a; }
.hist-code-row .btn { border-radius: 12px; padding: 9px 16px; font-weight: 700; }

/* 分享弹窗 */
.share-card { max-width: 400px; }
.share-status { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.share-code {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 8px;
  color: #a8760f;
  background: #fdf6e3;
  border: 1px dashed #e6c06a;
  border-radius: 14px;
  padding: 12px 0 12px 8px;   /* letter-spacing 右侧多出 1 格，左补平衡 */
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 #fff;
}
.share-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.share-link {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf7ef;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 12px;
}
.share-link-row .btn { flex: 0 0 auto; }
.share-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.share-actions .btn { flex: 1; font-weight: 700; }
.share-tip { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }

/* 海报预览 */
.poster-card { max-width: 440px; }
.poster-body {
  background: #e9dfc8;
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 10px;
}
.poster-body img {
  display: block;
  width: 100%;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}
.poster-tip { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 12px; }
#poster-download { text-decoration: none; display: flex; align-items: center; justify-content: center; }

/* ---------- 三期：战绩速览 + 成就徽章墙（主页面「我的」区块） ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.stat-cell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 3px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.stat-cell b {
  font-size: 15px;
  font-weight: 800;
  color: #a8760f;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-cell span { font-size: 9px; color: var(--muted); font-weight: 700; }
.stat-cell i { font-size: 10px; color: #b8ac92; font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-wall {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.ach-head {
  font-size: 13px;
  font-weight: 800;
  color: #7a4d00;
  margin-bottom: 10px;
}
.ach-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.ach-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.ach-ico {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  border: 2px solid var(--line);
  background: #f6f1e3;
}
.ach-badge.on .ach-ico {
  background: radial-gradient(circle at 32% 28%, #ffe9ad, #f2b544 70%);
  border-color: #d99a2b;
  box-shadow: 0 4px 10px rgba(217, 140, 40, 0.35);
}
/* 未解锁：灰色同款徽章（图标 grayscale 去色 + 灰底 + 降透明度），解锁后点亮为金色 */
.ach-badge.locked .ach-ico {
  background: radial-gradient(circle at 32% 28%, #eceade, #d6d1c2 70%);
  border-color: #c9c2af;
  filter: grayscale(1);
  opacity: 0.75;
  box-shadow: none;
}
.ach-badge.locked .ach-name { color: #b3ac9c; }
.ach-name {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ach-badge.on .ach-name { color: #7a4d00; }
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .ach-grid { grid-template-columns: repeat(3, 1fr); }
  .ach-ico { width: 44px; height: 44px; font-size: 22px; }
}

/* ---------- 底部主导航（棋谱 / 大厅 / 我的） ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  gap: 0;
  padding: 5px 10px calc(5px + env(safe-area-inset-bottom, 0px));
  background:
    linear-gradient(180deg, rgba(255,255,255,.78), transparent 9px),
    linear-gradient(180deg, #fffdf6 0%, #fff9e9 100%);
  border-top: 2px solid rgba(224, 176, 92, .72);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 -7px 20px rgba(94, 65, 31, .12);
}
.tab-btn {
  flex: 1;
  min-width: 0;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 3px 0 2px;
  border: none;
  background: transparent;
  color: #76695d;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  left: 50%;
  width: 70px;
  height: 56px;
  border-radius: 17px 17px 15px 15px;
  background: linear-gradient(180deg, #fffef9 0%, #fff0c9 100%);
  box-shadow:
    inset 0 0 0 1px rgba(232, 181, 86, .42),
    inset 0 2px 0 rgba(255,255,255,.96),
    0 3px 8px rgba(190, 117, 35, .14);
  opacity: 0;
  transform: translateX(-50%) scale(.9);
  transition: opacity .16s ease, transform .16s ease;
}
.tab-btn .tab-ico {
  position: relative;
  z-index: 1;
  width: 50px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 16px 16px 13px 13px;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.tab-btn .tab-ico img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: saturate(.82) brightness(.97);
  opacity: .9;
  transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}
.tab-btn .tab-label {
  position: relative;
  z-index: 1;
  letter-spacing: .02em;
  text-shadow: 0 1px 0 rgba(255,255,255,.9);
  transition: color .16s ease, transform .16s ease;
}
.tab-btn.on { color: #e45b25; }
.tab-btn.on::before { opacity: 1; transform: translateX(-50%) scale(1); }
.tab-btn.on .tab-ico {
  transform: translateY(-1px);
}
.tab-btn.on .tab-ico img {
  filter: saturate(1.04) brightness(1.01) drop-shadow(0 2px 2px rgba(138, 72, 22, .14));
  opacity: 1;
  transform: scale(1.05);
}
.tab-btn:active .tab-ico { transform: translateY(1px) scale(.94); }
.tab-btn:focus-visible { outline: 2px solid rgba(229, 91, 37, .72); outline-offset: -2px; }
@media (min-width: 560px) {
  /* 桌面：导航条与内容同宽居中，保持与移动端一致的奶油金边材质。 */
  .tabbar {
    left: 50%;
    right: auto;
    width: 460px;
    transform: translateX(-50%);
    border-radius: 22px 22px 0 0;
    border-left: 1px solid rgba(224, 176, 92, .46);
    border-right: 1px solid rgba(224, 176, 92, .46);
  }
}

/* ---------- 三个主界面共用一个页面背景（body 自带），各自上下连贯、底部预留导航栏空间 ---------- */
/* ---------- 我的 ---------- */
.prof-wrap { max-width: 460px; margin: 0 auto; padding: 8px 12px calc(80px + env(safe-area-inset-bottom, 0px)); }
.me-card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(91, 65, 32, .09), inset 0 1px rgba(255,255,255,.82);
}
.me-card::before {
  content: '';
  position: absolute;
  top: -46px; right: -36px;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(244, 188, 84, .15), rgba(244, 188, 84, 0) 69%);
  pointer-events: none;
}
.me-profile-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}
.me-avatar-btn {
  position: relative;
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 2px solid #e3d5b2;
  padding: 0;
  background: #f4f1e7;
  cursor: pointer;
}
.me-avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-avatar-edit {
  position: absolute;
  right: -3px; bottom: -3px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f48a6e, var(--accent-dark));
  color: #fff;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(200, 90, 60, 0.35);
}
.me-info { flex: 1; min-width: 0; }
.me-name {
  font-size: 17px;
  font-weight: 800;
  color: #4a4233;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-sign {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
}
.me-edit-profile {
  position: relative;
  flex-shrink: 0;
  border-color: rgba(153, 120, 73, .25) !important;
  background: rgba(255, 253, 247, .72) !important;
  color: #705a3d !important;
}
.me-stats { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.me-ach { display: flex; flex-direction: column; gap: 5px; margin-bottom: 6px; }
.achievement-rule {
  margin: 0 0 6px; padding: 5px 8px; border: 1px solid rgba(195,151,76,.32);
  border-radius: 8px; color: #7c6641; background: linear-gradient(100deg,rgba(255,251,238,.96),rgba(248,238,214,.74));
  font-size: 9.5px; letter-spacing: .02em; text-align: center;
}
.achievement-rule span { color: #bf8730; margin-right: 4px; }
.achievement-category {
  position: relative; overflow: hidden; padding: 6px 8px; border: 1px solid rgba(190,146,70,.32);
  border-radius: 10px; background: linear-gradient(145deg,rgba(255,255,252,.97),rgba(248,239,218,.9));
  box-shadow: 0 4px 10px rgba(84,60,25,.05), inset 0 1px rgba(255,255,255,.9);
  display: grid; grid-template-columns: 46px 1fr; gap: 3px 6px; align-items: center;
}
.achievement-category.secret { background: linear-gradient(145deg,#29203d,#171426); border-color:rgba(215,179,112,.4); }
.achievement-category-head { display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:3px; margin:0; min-width:0; }
.achievement-category-title { color:#73501f; font:800 12px/1.1 Georgia,"Noto Serif SC",serif; letter-spacing:.02em; white-space:nowrap; }
.achievement-category-sub { display:none; }
.achievement-category-count { color:#a77525; font-size:10px; font-weight:800; }
.achievement-category.secret .achievement-category-title { color:#f1d79d; }
.achievement-category.secret .achievement-category-sub,.achievement-category.secret .achievement-category-count { color:#a99bbd; }
.achievement-grid { display:grid; grid-template-columns:repeat(auto-fit,46px); justify-content:center; gap:9px 12px; align-items:start; }
.achievement-badge { appearance:none; border:0; background:none; padding:0; color:inherit; min-width:0; cursor:pointer; }
.achievement-badge-art { position:relative; width:38px; aspect-ratio:1; margin:0 auto 2px; }
.achievement-badge-art img { display:block; width:100%; height:100%; object-fit:contain; filter:drop-shadow(0 2px 4px rgba(77,47,13,.2)); }
.achievement-badge.locked .achievement-badge-art img { filter:grayscale(1) sepia(.12) opacity(.42); }
.achievement-badge.secret-locked .achievement-badge-art {
  border-radius:50%; background:radial-gradient(circle at 36% 28%,#625673,#2d273c 63%,#15121e 74%);
  border:2px solid #7f6d92; box-shadow:inset 0 0 0 3px #282133,0 3px 6px rgba(19,13,29,.35);
}
.achievement-badge.secret-locked .achievement-badge-art::after { content:'?'; position:absolute; inset:0; display:grid; place-items:center; color:#b7a8c7; font:700 16px Georgia,serif; }
.achievement-badge-name { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; color:#785829; font-size:9px; line-height:1.1; font-weight:800; }
.achievement-badge.locked .achievement-badge-name { color:#aaa18f; }
.achievement-category.secret .achievement-badge-name { color:#d7c6e7; }
.achievement-mini-progress { width:28px; height:2px; overflow:hidden; margin:2px auto 0; border-radius:9px; background:rgba(100,78,48,.12); }
.achievement-mini-progress i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#bd8025,#f1cc77); }
.achievement-migrate-open { width:100%; border:0; background:transparent; color:#98784b; font-size:10px; padding:3px 10px 8px; text-decoration:underline; text-underline-offset:3px; cursor:pointer; }
.achievement-detail-card,.achievement-unlock-card,.achievement-migrate-card { position:relative; max-width:370px; text-align:center; overflow:hidden; }
.achievement-detail-card::before,.achievement-unlock-card::before { content:''; position:absolute; inset:0; pointer-events:none; background:radial-gradient(circle at 50% 18%,rgba(246,208,128,.23),transparent 42%); }
.achievement-detail-art,.achievement-unlock-art { position:relative; width:164px; height:164px; margin:5px auto 2px; }
.achievement-detail-art img,.achievement-unlock-art img { width:100%; height:100%; object-fit:contain; filter:drop-shadow(0 12px 14px rgba(90,54,14,.22)); }
.achievement-detail-art.secret-locked { width:136px; height:136px; margin:18px auto 13px; border:3px solid #857398; border-radius:50%; background:radial-gradient(circle at 36% 28%,#655875,#2b2539 63%,#15121e 74%); box-shadow:inset 0 0 0 6px #2b2437; }
.achievement-detail-art.secret-locked::after { content:'?'; position:absolute; inset:0; display:grid; place-items:center; color:#c0b1ce; font:700 48px Georgia,serif; }
.achievement-detail-category,.achievement-unlock-kicker { color:#a4742e; font-size:10px; font-weight:800; letter-spacing:.18em; }
.achievement-detail-card h2,.achievement-unlock-card h2 { position:relative; margin:5px 0 8px; color:#604319; font:800 22px/1.25 Georgia,"Noto Serif SC",serif; }
.achievement-detail-desc,.achievement-unlock-card p { position:relative; min-height:38px; margin:0 auto 14px; color:#7d715f; font-size:13px; line-height:1.65; }
.achievement-detail-progress { height:7px; overflow:hidden; border-radius:20px; background:#e9e1cf; }
.achievement-detail-progress i { display:block; width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg,#b5761c,#f4d483); transition:width .35s ease; }
.achievement-detail-count { margin-top:7px; color:#9b7b4d; font-size:11px; }
.achievement-unlock-card { background:linear-gradient(155deg,#fffef8,#f8eac8); border:1px solid #d4aa5f; box-shadow:0 22px 80px rgba(61,38,10,.36); }
.achievement-unlock-card::after { content:'✦  ✧  ✦'; position:absolute; top:20px; left:0; right:0; color:rgba(184,125,29,.38); letter-spacing:1.5em; text-indent:1.5em; }
.achievement-unlock-kicker { margin-top:6px; }
.achievement-unlock-label { color:#9b753c; font-size:11px; }
.achievement-unlock-card .btn { width:100%; margin-top:4px; }
.achievement-migrate-mark { width:52px; height:52px; margin:4px auto 8px; display:grid; place-items:center; border-radius:50%; color:#8b6226; border:1px solid #d8b873; background:#fff5d9; font-size:24px; }
.achievement-migrate-card p { color:#807462; font-size:12px; line-height:1.65; }
.achievement-migrate-code { margin:10px 0 2px; padding:12px; color:#694513; border:1px dashed #c39748; border-radius:12px; background:#fff8e7; font:800 24px/1.2 monospace; letter-spacing:.22em; }
.achievement-migrate-or { display:flex; align-items:center; gap:10px; margin:13px 0; color:#aea18c; font-size:11px; }
.achievement-migrate-or::before,.achievement-migrate-or::after { content:''; flex:1; height:1px; background:#e4dac6; }
.achievement-migrate-input { display:flex; gap:8px; }
.achievement-migrate-input input { min-width:0; flex:1; text-transform:uppercase; letter-spacing:.12em; text-align:center; }
.player-info-ach { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; width:100%; }
.player-info-ach .player-ach-chip { padding:0; background:none; }
.player-ach-chip img { width:48px; height:48px; object-fit:contain; display:block; margin:auto; filter:drop-shadow(0 4px 5px rgba(69,43,14,.18)); }
.player-ach-chip small { display:block; color:#7a6542; font-size:8.5px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
@media (min-width:600px) {
  .achievement-category { grid-template-columns: 88px 1fr; gap: 8px 14px; padding: 14px 16px 12px; }
  .achievement-category-title { font-size: 15px; }
  .achievement-category-sub { display:block; color:#a49378; font-size:10px; margin-top:3px; letter-spacing:.05em; }
  .achievement-grid { grid-template-columns:repeat(auto-fit,minmax(72px,1fr)); gap:14px 10px; }
  .achievement-badge-art { width:64px; }
  .achievement-badge-name { font-size:10.5px; }
  .me-card { padding:16px 14px; gap:14px; }
  .me-avatar-btn { width:74px; height:74px; border-width:2.5px; }
  .me-avatar { font-size:34px; }
  .me-name { font-size:17px; }
  .me-sign { font-size:12.5px; -webkit-line-clamp:2; }
  .me-stats { gap:12px; margin-bottom:12px; }
  .me-ach { gap:12px; margin-bottom:12px; }
  .achievement-rule { margin:2px 0 12px; padding:9px 12px; font-size:11px; }
  .stat-cell { padding:10px 6px 8px; }
  .stat-cell b { font-size:19px; }
  .stat-cell span { font-size:11px; }
  .prof-wrap { padding:14px 12px calc(108px + env(safe-area-inset-bottom, 0px)); }
}
/* 弹窗内成就墙：七个分馆各占一行，徽章放大后仍保持整窗一屏。 */
.profile-card .me-ach { gap: 3px; margin-bottom: 1px; }
.profile-card .achievement-category {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 3px 5px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 10px;
}
.profile-card .achievement-category-head { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; margin: 0; }
.profile-card .achievement-category-title { font-size: 11.5px; }
.profile-card .achievement-category-sub { display: none; }
.profile-card .achievement-category-count { font-size: 9.5px; margin: 0; }
.profile-card .achievement-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  justify-content: stretch;
  align-items: start;
  gap: 1px;
}
.profile-card .achievement-badge { display: block; width: 100%; max-width: 100%; overflow: hidden; }
.profile-card .achievement-badge-art { position: relative; width: 30px; height: 30px; margin: 0 auto 1px; }
.profile-card .achievement-badge-art img { width: 100%; height: 100%; object-fit: contain; }
.profile-card .achievement-badge.secret-locked .achievement-badge-art { border-width: 1px; box-shadow: inset 0 0 0 2px #282133; }
.profile-card .achievement-badge.secret-locked .achievement-badge-art::after { font-size: 13px; }
.profile-card .achievement-badge-name { font-size: 9px; line-height: 1.05; white-space: nowrap; text-overflow: ellipsis; }
.profile-card .achievement-mini-progress { display: none; }
.profile-card .modal-actions { margin-top: 3px; }
.profile-card .modal-actions .btn { padding: 7px 12px; font-size: 13px; }
.profile-card .achievement-migrate-open { padding: 3px 10px 1px; }
@media (max-width: 359px) {
  .profile-card { padding-left: 12px; padding-right: 12px; }
  .profile-card .achievement-category { grid-template-columns: 35px minmax(0, 1fr); padding-left: 5px; padding-right: 5px; }
  .profile-card .achievement-badge-art { width: 27px; height: 27px; }
  .profile-card .achievement-badge-name { font-size: 8px; }
}
/* 资料弹窗：关闭按钮绝对定位右上（避免与标题挤占一行） */
.profile-card { position: relative; }
.profile-close {
  position: absolute;
  top: 10px; right: 10px;
  border-radius: 50%;
  width: 30px; height: 30px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
}
@media (max-width: 380px) {
  .me-card { flex-wrap: wrap; }
  .me-info { flex: 1 1 calc(100% - 68px); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .achievement-category { grid-template-columns: 46px 1fr; gap: 4px 6px; }
  .achievement-badge-art { width: 33px; }
  .achievement-badge-name { font-size: 8.5px; }
}

/* ============================================================
 * 棋谱视觉精修：暖棕案台 + 宣纸列表 / 靛蓝织纹复盘
 * 仅作用于棋谱列表与 replay-mode，不改变大厅和正常对局。
 * ============================================================ */

/* ---------- 棋谱列表：案台与宣纸 ---------- */
#screen-history {
  position: relative;
  min-height: 100vh;
  background: transparent;
  color: #4b392a;
  overflow-x: hidden;
}
#screen-history::before,
#screen-history::after {
  display: none;
}
.hist-wrap {
  position: relative;
  z-index: 1;
  max-width: 480px;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 18px calc(112px + env(safe-area-inset-bottom, 0px));
}
.hist-hero {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: #795a32;
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
}
.hist-hero h1 {
  font-family: "STKaiti", "KaiTi", "FangSong", serif;
  font-size: 37px;
  font-weight: 600;
  letter-spacing: 8px;
  line-height: 1;
  transform: translateX(4px);
}
.hist-hero-rule {
  width: 56px;
  height: 12px;
  position: relative;
  opacity: .58;
}
.hist-hero-rule::before,
.hist-hero-rule::after {
  content: "";
  position: absolute;
  border: 1px solid #c9ad78;
  border-radius: 50%;
  width: 38px;
  height: 8px;
  right: 0;
}
.hist-hero-rule::after { width: 28px; right: 19px; top: 3px; opacity: .7; }
.hist-hero-rule-right { transform: scaleX(-1); }
.hist-paper {
  position: relative;
  padding: 0 12px 18px;
  background:
    radial-gradient(rgba(120,100,70,.025) 1px, transparent 1.5px) 0 0 / 22px 22px,
    rgba(253, 252, 248, .9);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm), inset 0 1px rgba(255,255,255,.7);
}
.hist-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 42px rgba(95, 67, 35, .11);
}
.hist-tabs {
  position: relative;
  z-index: 1;
  gap: 0;
  margin: 0 -12px 8px;
  padding: 0;
  border: 0;
  border-radius: 15px 15px 0 0;
  background: #ede7da;
  box-shadow: inset 0 -1px rgba(120, 96, 66, .12);
}
.hist-tab {
  min-height: 46px;
  padding: 11px 0 10px;
  border-radius: 0;
  color: #766d60;
  font-family: "STKaiti", "KaiTi", var(--font-stack);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: none;
}
.hist-tab + .hist-tab { border-left: 1px solid rgba(120, 96, 66, .12); }
.hist-tab.on {
  color: #503923;
  background: linear-gradient(135deg, #f8cd6b, #f2b544);
  box-shadow: inset 0 1px rgba(255,255,255,.35), 0 2px 8px rgba(180,128,30,.24);
  text-shadow: 0 1px rgba(255,255,255,.3);
}
.hist-sub { padding: 2px 2px 7px; }
.hist-count { color: #837563; font-size: 12px; }
.hist-filter {
  border: 0;
  padding: 5px 7px;
  color: #718b78;
  background: transparent;
  font-size: 12px;
}
.hist-filter span { font-size: 16px; vertical-align: -1px; }
.hist-code-row {
  position: relative;
  z-index: 1;
  gap: 0;
  margin: 0 0 11px;
  border: 1px solid rgba(114, 89, 57, .25);
  border-radius: 8px;
  background: rgba(255, 253, 245, .58);
  box-shadow: inset 0 1px 3px rgba(79, 57, 34, .08);
  overflow: hidden;
}
.hist-code-row input {
  height: 38px;
  border: 0;
  border-radius: 0;
  padding: 8px 11px;
  background: transparent;
  color: #4f4031;
  letter-spacing: 1px;
  font-size: 12.5px;
}
.hist-code-row input::placeholder { color: #968a79; font-weight: 500; }
.hist-code-row input:focus { outline: none; border: 0; background: rgba(255,255,255,.34); }
.hist-code-row .btn {
  border-left: 1px solid rgba(114, 89, 57, .22);
  border-radius: 0;
  padding: 8px 14px;
  background: transparent;
  color: #4f4031;
  font-size: 12px;
}
.hist-list { position: relative; z-index: 1; gap: 7px; }
.rec-card {
  border: 1px solid rgba(122, 96, 61, .22);
  border-radius: 7px;
  background:
    linear-gradient(105deg, rgba(255,255,255,.22), transparent 38%, rgba(115,88,54,.035)),
    rgba(218, 209, 187, .76);
  box-shadow: 0 2px 6px rgba(69, 47, 27, .12), inset 0 1px rgba(255,255,255,.36);
  transition: transform .12s ease, box-shadow .12s ease;
}
.rec-card:active { transform: scale(.988); box-shadow: 0 1px 3px rgba(69, 47, 27, .15); }
.rec-head { gap: 7px; padding: 8px 11px 1px; }
.rec-mode {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #b1763d;
  font-family: "STKaiti", "KaiTi", var(--font-stack);
  font-size: 12px;
  letter-spacing: .3px;
}
.rec-result {
  padding: 1px 6px;
  border: 1px solid rgba(135, 105, 65, .26);
  border-radius: 999px;
  color: #756956;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.4;
}
.rec-won .rec-result { color: #a44131; border-color: rgba(164,65,49,.28); background: rgba(211,91,68,.07); }
.rec-draw .rec-result { color: #65796c; border-color: rgba(74,113,88,.26); }
.rec-time { color: #827566; font-size: 10.5px; }
.rec-main { min-height: 68px; padding: 8px 10px 10px; }
.rec-avatar {
  width: 46px;
  height: 46px;
  border: 2px solid #4e4335;
  background: #c9bda6;
  box-shadow: 0 2px 5px rgba(53,34,19,.2), inset 0 0 0 1px rgba(255,255,255,.45);
}
.rec-side.me .rec-avatar,
.rec-side.win .rec-avatar {
  border-color: #b74a35;
  box-shadow: 0 0 0 1px rgba(183,74,53,.25), 0 2px 5px rgba(53,34,19,.2);
}
.rec-pname { color: #3f352a; font-family: "STKaiti", "KaiTi", var(--font-stack); font-size: 14px; }
.rec-side.me .rec-pname,
.rec-side.win .rec-pname { color: #b24132; }
.rec-pbadge {
  border-radius: 2px;
  padding: 1px 6px;
  background: linear-gradient(180deg, #6f94ad, #4f748d);
  box-shadow: inset 0 1px rgba(255,255,255,.25);
  font-size: 9px;
}
.rec-vs {
  font-family: Georgia, serif;
  font-size: 43px;
  font-style: italic;
  color: rgba(125, 107, 80, .20);
  text-shadow: 0 1px rgba(255,255,255,.28);
}
.rec-winflag {
  top: -6px;
  width: 21px;
  height: 21px;
  border-radius: 2px;
  border: 1px solid #f4d3a6;
  background: linear-gradient(145deg, #c93f31, #9f281f);
  font-family: "STKaiti", "KaiTi", serif;
  box-shadow: 0 2px 4px rgba(90,24,18,.35);
}
.rec-foot { border-top-color: rgba(118, 91, 58, .19); }
.rec-fav,
.rec-share,
.rec-show {
  padding: 8px 0;
  background: rgba(199, 189, 165, .22);
  color: #7c6c56;
  font-family: "STKaiti", "KaiTi", var(--font-stack);
  font-size: 13px;
}
.rec-fav { border-right-color: rgba(118, 91, 58, .19); }
.rec-share { color: #6d8276; }
.rec-show.on { color: #0a7a46; }
.rec-fav:active,
.rec-share:active,
.rec-show:active { background: rgba(168, 151, 119, .18); }
.rec-empty {
  border-color: rgba(100,76,47,.32);
  background: rgba(224,216,197,.54);
  color: #827564;
}

/* 棋谱标签页下方的主导航也融入案台，避免突兀的纯白条。 */
#screen-history.active ~ .tabbar {
  background:
    linear-gradient(180deg, rgba(255,255,255,.78), transparent 9px),
    linear-gradient(180deg, #fffdf6 0%, #fff9e9 100%);
  border-top-color: rgba(224, 176, 92, .72);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 -7px 20px rgba(94,65,31,.12);
}
#screen-history.active ~ .tabbar .tab-btn { color: #76695d; }
#screen-history.active ~ .tabbar .tab-btn.on { color: #e45b25; }

/* ---------- 复盘内页：靛蓝织纹、人物落位与沉浸控制台 ---------- */
#screen-game.replay-mode {
  background:
    repeating-linear-gradient(90deg,
      rgba(255,255,255,.05) 0, rgba(255,255,255,.05) 44px,
      rgba(20,70,80,.05) 44px, rgba(20,70,80,.05) 88px),
    linear-gradient(180deg, var(--table-1) 0%, var(--table-2) 100%);
}
#screen-game.replay-mode.skin-bg-ivory {
  background:
    radial-gradient(rgba(120,100,70,.035) 1.5px, transparent 2px) 0 0 / 26px 26px,
    linear-gradient(160deg, #f0eadc, #e6ddc8 60%, #d9cdb2);
}
#screen-game.replay-mode::after {
  display: none;
}
#screen-game.replay-mode .game-wrap {
  max-width: 480px;
  padding: 8px 4px calc(7px + env(safe-area-inset-bottom, 0px));
}
#screen-game.replay-mode .game-main { position: relative; z-index: 1; }
#screen-game.replay-mode:has(.replay-seats.seats-2) .game-main {
  transform: translateY(60px);
}
#screen-game.replay-mode #board-canvas {
  filter:
    drop-shadow(0 16px 17px rgba(5, 13, 24, .46))
    drop-shadow(0 4px 4px rgba(6, 14, 23, .34));
}
#screen-game.replay-mode .replay-hud { gap: 0; z-index: 7; }
.replay-top {
  min-height: 50px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 9px 6px;
  gap: 6px;
  background: rgba(249, 248, 243, .97);
  border-bottom: 1px solid rgba(25, 39, 53, .15);
  box-shadow: 0 2px 9px rgba(8, 17, 29, .16);
}
.rp-close {
  flex-basis: 37px;
  width: 37px;
  height: 37px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #26313a;
  font-family: Arial, sans-serif;
  font-size: 27px;
  font-weight: 400;
  box-shadow: none;
}
.replay-title {
  color: #27333d;
  text-shadow: none;
  font-family: "STKaiti", "KaiTi", var(--font-stack);
  font-size: 17px;
  letter-spacing: 1px;
}
.replay-chips { gap: 5px; overflow: hidden; }
.replay-chips .gt-chip {
  height: 25px;
  padding: 0 8px;
  border: 0;
  background: rgba(45, 59, 71, .06);
  color: #3f4a52;
  box-shadow: none;
  font-size: 10.5px;
}
.replay-chips .rp-result-chip {
  background: linear-gradient(180deg, #d9b36d, #c89345) !important;
  color: #fffaf0 !important;
  box-shadow: inset 0 1px rgba(255,255,255,.27) !important;
}
.rp-listbtn {
  width: 31px;
  height: 31px;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(39,50,60,.16);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: 0;
  position: relative;
}
#rp-share::before { content: "↗"; }
#rp-list::before { content: "☰"; }
.rp-listbtn::before {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #27333d;
  font: 700 16px/1 Arial, sans-serif;
}

/* 双人时形成“左上对手—棋盘—右下本人”的观战构图。 */
.replay-seats.seats-2 {
  position: absolute;
  inset: 58px 0 82px;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
  visibility: visible !important;
}
.replay-seats.seats-2 .rp-slot {
  position: absolute;
  width: 142px;
  max-width: none;
  min-height: 58px;
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-rows: 28px 20px;
  gap: 0 9px;
  padding: 0;
  background: transparent;
  color: var(--on-table);
  text-align: left;
  text-shadow: 0 1px 3px rgba(15,65,73,.45);
}
.replay-seats.seats-2 .rp-slot:first-child { top: 10px; left: 18px; }
.replay-seats.seats-2 .rp-slot:last-child { right: 16px; bottom: 30px; }
.replay-seats.seats-2 .slot-avatar-box {
  grid-column: 1;
  grid-row: 1 / 3;
  flex-basis: auto;
  justify-content: flex-start;
}
.replay-seats.seats-2 .slot-avatar {
  width: 52px;
  height: 52px;
  border: 2px solid rgba(248,235,208,.84);
  box-shadow: 0 3px 10px rgba(4,11,19,.42), 0 0 0 1px rgba(214,179,112,.38);
}
.replay-seats.seats-2 .slot-name {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  color: #fff8e9 !important;
  font-family: "STKaiti", "KaiTi", var(--font-stack);
  font-size: 15px;
  text-shadow: 0 1px 3px rgba(15,65,73,.65);
}
.replay-seats.seats-2 .rp-slot-sub {
  grid-column: 2;
  grid-row: 2;
  color: rgba(255,255,255,.78);
  font-size: 10px;
}
#screen-game.replay-mode.skin-bg-ivory .replay-seats.seats-2 .slot-name {
  color: var(--ink-deep) !important;
  text-shadow: 0 1px rgba(255,255,255,.7);
}
#screen-game.replay-mode.skin-bg-ivory .replay-seats.seats-2 .rp-slot-sub {
  color: var(--ink-soft);
  text-shadow: none;
}
.replay-seats.seats-2 .rp-slot.is-me {
  grid-template-columns: 1fr 52px;
  text-align: right;
}
.replay-seats.seats-2 .rp-slot.is-me .slot-avatar-box { grid-column: 2; }
.replay-seats.seats-2 .rp-slot.is-me .slot-name,
.replay-seats.seats-2 .rp-slot.is-me .rp-slot-sub { grid-column: 1; }
.rp-rank-badge {
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border: 1px solid rgba(255,246,225,.78);
  background: #40536a;
  color: #f2e5ce;
  box-shadow: 0 2px 5px rgba(4,10,17,.32);
}
.rp-rank-badge.rp-win {
  border-color: #efd69e;
  background: linear-gradient(145deg, #c99a4c, #a97830);
  color: #fff8e8;
}

/* 3—6 人仍保留一排，但改成轻量透明人物条。 */
.replay-seats:not(.seats-2) {
  margin: 8px 8px 0;
  padding: 3px 5px;
  border-color: rgba(235,225,204,.16);
  background: rgba(14,27,43,.18);
  box-shadow: none;
  visibility: visible !important;
}
.replay-seats:not(.seats-2) .slot-name { color: #eadcc3 !important; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.replay-seats:not(.seats-2) .rp-slot-sub { color: rgba(232,238,243,.64); }

.replay-panel {
  margin: auto 12px 0;
  padding: 8px 10px calc(9px + env(safe-area-inset-bottom, 0px));
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 18px 18px 12px 12px;
  background: rgba(255,250,238,.94);
  box-shadow: 0 -6px 22px rgba(23,60,70,.22), inset 0 1px rgba(255,255,255,.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.replay-step-chip {
  margin: 0 0 2px;
  min-height: 16px;
  color: var(--ink-deep);
  font-family: "STKaiti", "KaiTi", var(--font-stack);
  font-size: 11.5px;
  font-weight: 600;
}
.replay-scrub { height: 23px; }
.replay-scrub::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(90deg, var(--gold), #e8dcc0);
  box-shadow: none;
}
.replay-scrub::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -5px;
  border: 2px solid #f3e4c7;
  background: #c59649;
  box-shadow: 0 2px 5px rgba(0,0,0,.35);
}
.replay-scrub::-moz-range-track { height: 3px; background: rgba(227,215,192,.22); }
.replay-scrub::-moz-range-progress { height: 3px; background: #c69a52; }
.replay-scrub::-moz-range-thumb { width: 13px; height: 13px; border-color: #f3e4c7; background: #c59649; }
.replay-controls { gap: 5px; margin-top: 1px; }
.rp-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(247,242,230,.9);
  color: #6c604f;
  font-size: 12px;
  box-shadow: 0 2px 5px rgba(23,60,70,.12), inset 0 1px rgba(255,255,255,.7);
}
.rp-btn.rp-play {
  width: 46px;
  height: 46px;
  border-color: rgba(180,60,40,.3);
  background: linear-gradient(135deg, #f48a6e, var(--accent-dark));
  color: #fff;
  box-shadow: 0 3px 10px rgba(217,95,67,.32), inset 0 1px rgba(255,255,255,.17);
}
.rp-btn.rp-play.rp-playing { background: linear-gradient(145deg, #87977e, #536a5c); }
.rp-speed {
  gap: 1px;
  margin-left: 3px;
  padding: 2px;
  border-color: var(--line);
  background: rgba(247,242,230,.72);
}
.rp-speed button { padding: 4px 5px; color: var(--muted); font-size: 9px; }
.rp-speed button.on { background: var(--gold); color: #4a3200; box-shadow: none; }

@media (max-width: 359px) {
  .hist-wrap { padding-left: 10px; padding-right: 10px; }
  .hist-hero-rule { width: 38px; }
  .hist-hero h1 { font-size: 32px; }
  .replay-chips #rp-mode { display: none; }
  .replay-panel { margin-left: 5px; margin-right: 5px; }
  .rp-speed { margin-left: 0; }
  .rp-speed button { padding-left: 3px; padding-right: 3px; }
}

/* ---------- 棋谱第二轮精修：去标题、统一胜标、重做 VS ---------- */
#screen-history .hist-wrap {
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
}
.rec-main .rec-side:last-child .rec-winflag {
  left: auto;
  right: -6px;
}
.rec-vs {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid #e1c47f;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255,253,244,.94), rgba(246,226,177,.9));
  color: #b47a18;
  font-family: var(--font-stack);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: -.2px;
  text-shadow: 0 1px 0 #fff;
  box-shadow:
    0 3px 8px rgba(110,82,38,.14),
    inset 0 0 0 3px rgba(255,255,255,.38);
}
.rec-vs::before,
.rec-vs::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 11px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d3ad5d);
}
.rec-vs::before { right: 100%; }
.rec-vs::after { left: 100%; transform: scaleX(-1); }

/* ---------- 极简复盘 HUD：参考棋类应用的圆形控制键 ---------- */
.replay-top {
  min-height: 54px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 4px;
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: none;
}
.rp-top-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 50%;
  background: rgba(255,250,238,.9);
  color: #5c5144;
  box-shadow: 0 3px 10px rgba(23,60,70,.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.rp-top-btn span {
  display: block;
  transform: translate(-1px, -1px);
  font: 400 38px/1 Arial, sans-serif;
}
.rp-top-btn:active { transform: scale(.94); }

.replay-panel {
  margin: auto 8px 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.replay-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 2px;
  margin: 0;
}
.rp-btn,
.rp-btn.rp-play {
  width: auto;
  height: 69px;
  min-width: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255,248,235,.92);
  box-shadow: none;
  text-shadow: 0 1px 3px rgba(15,65,73,.5);
}
.rp-btn-icon {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,247,230,.55);
  border-radius: 50%;
  background: rgba(69,88,83,.34);
  color: #f3d39b;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 3px 9px rgba(18,62,69,.2), inset 0 1px rgba(255,255,255,.09);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.rp-more .rp-btn-icon {
  font-size: 17px;
  letter-spacing: 1px;
}
.rp-play .rp-btn-icon {
  width: 51px;
  height: 51px;
  margin-top: -3px;
  border-color: rgba(255,236,195,.7);
  background: linear-gradient(145deg, #d2a766, #a8773d);
  color: #fff7e8;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(75,49,19,.28), inset 0 1px rgba(255,255,255,.18);
}
.rp-btn.rp-play.rp-playing,
.rp-btn.rp-play.rp-playing .rp-btn-icon {
  background: linear-gradient(145deg, #7aa795, #4e7d70);
}
.rp-btn-label {
  color: inherit;
  font-family: var(--font-stack);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.rp-btn:active .rp-btn-icon { transform: scale(.92); filter: brightness(.96); }

/* 米杏背景下沿用同一布局，文字和按钮自动切换为深色。 */
#screen-game.replay-mode.skin-bg-ivory .rp-btn {
  color: #6c604f;
  text-shadow: 0 1px rgba(255,255,255,.7);
}
#screen-game.replay-mode.skin-bg-ivory .rp-btn-icon {
  border-color: rgba(120,96,66,.24);
  background: rgba(255,250,238,.68);
  color: #a8762d;
  box-shadow: 0 3px 9px rgba(90,70,40,.13), inset 0 1px rgba(255,255,255,.6);
}
#screen-game.replay-mode.skin-bg-ivory .rp-play .rp-btn-icon {
  border-color: rgba(180,60,40,.28);
  background: linear-gradient(135deg, #f48a6e, var(--accent-dark));
  color: #fff;
}

/* “…”操作菜单：只承载低频功能，避免把按钮重新堆回顶栏。 */
.rp-action-menu {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  z-index: 9;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 18px;
  background: rgba(255,252,244,.96);
  box-shadow: 0 12px 32px rgba(23,60,70,.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}
.rp-action-menu button {
  min-width: 0;
  min-height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8f4e9;
  color: var(--ink-deep);
  font-family: var(--font-stack);
  font-size: 11.5px;
  font-weight: 700;
}
.rp-action-menu button:active { transform: scale(.97); background: #f1ecdd; }
.rp-menu-ico { color: #b27b31; font-size: 21px; line-height: 1; }
.rp-action-menu .rp-menu-cancel {
  grid-column: 1 / -1;
  min-height: 38px;
  flex-direction: row;
  background: transparent;
  color: var(--muted);
}

@media (max-width: 359px) {
  .replay-panel { margin-left: 2px; margin-right: 2px; }
  .rp-btn-icon { width: 41px; height: 41px; }
  .rp-play .rp-btn-icon { width: 47px; height: 47px; }
  .rp-btn-label { font-size: 9.5px; }
}

/* ---------- 复盘控制器定稿：按参考棋类应用区分主按钮与轻量步进键 ---------- */
.replay-seats.seats-2 .rp-slot:last-child {
  bottom: 82px;
}
.replay-panel {
  margin: auto 6px 3px;
}
.replay-controls {
  gap: 0;
}
.rp-btn,
.rp-btn.rp-play {
  height: 75px;
  gap: 3px;
  color: #ead0a4;
  text-shadow: 0 1px 3px rgba(65,38,16,.4);
}
.rp-btn-icon {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #d2a56b;
  font-size: 24px;
  font-weight: 800;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.rp-more .rp-btn-icon {
  width: 53px;
  height: 53px;
  margin-top: -3px;
  border: 1px solid rgba(235,207,165,.28);
  border-radius: 50%;
  background: rgba(91,65,45,.48);
  color: #e0bd8a;
  font-size: 18px;
  letter-spacing: 2px;
  box-shadow: inset 0 1px rgba(255,255,255,.06), 0 3px 8px rgba(47,28,16,.13);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.rp-play .rp-btn-icon {
  width: 62px;
  height: 62px;
  margin-top: -8px;
  border: 1px solid rgba(238,207,162,.35);
  border-radius: 50%;
  background: rgba(133,91,54,.58);
  color: #ead2ad;
  font-size: 23px;
  box-shadow: inset 0 1px rgba(255,255,255,.08), 0 4px 10px rgba(49,29,14,.14);
}
.rp-btn.rp-play.rp-playing,
.rp-btn.rp-play.rp-playing .rp-btn-icon {
  background: rgba(74,116,100,.68);
}
.rp-btn-label {
  font-size: 12px;
  font-weight: 700;
}

/* 操作弹窗降到底部并压成一条半透明工具带。 */
.rp-action-menu {
  left: 9px;
  right: auto;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  width: 224px;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 7px 8px 6px;
  border: 1px solid rgba(235,217,190,.2);
  border-radius: 13px;
  background: rgba(68,50,39,.9);
  box-shadow: 0 7px 18px rgba(39,22,12,.24), inset 0 1px rgba(255,255,255,.07);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}
.rp-action-menu button {
  min-height: 49px;
  gap: 2px;
  padding: 0 2px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #f0dcc0;
  font-size: 11px;
  text-shadow: 0 1px 2px rgba(0,0,0,.28);
}
.rp-action-menu button:active {
  background: rgba(255,245,225,.1);
}
.rp-menu-ico {
  color: #fff1da;
  font-size: 23px;
  line-height: 1;
}

#screen-game.replay-mode.skin-bg-ivory .rp-btn {
  color: #8b7252;
  text-shadow: 0 1px rgba(255,255,255,.8);
}
#screen-game.replay-mode.skin-bg-ivory .rp-btn-icon {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #a77b47;
  box-shadow: none;
}
#screen-game.replay-mode.skin-bg-ivory .rp-more .rp-btn-icon {
  border: 1px solid rgba(116,84,51,.16);
  border-radius: 50%;
  background: rgba(142,104,67,.15);
}
#screen-game.replay-mode.skin-bg-ivory .rp-play .rp-btn-icon {
  border: 1px solid rgba(180,60,40,.25);
  border-radius: 50%;
  background: rgba(223,112,82,.86);
  color: #fff;
}

@media (max-width: 359px) {
  .rp-btn-icon { width: 43px; height: 43px; font-size: 21px; }
  .rp-more .rp-btn-icon { width: 47px; height: 47px; }
  .rp-play .rp-btn-icon { width: 56px; height: 56px; }
  .rp-btn-label { font-size: 10.5px; }
  .rp-action-menu { width: 210px; }
}

/* ---------- 复盘控制器第三轮：主栏去文字，操作菜单回归现有素材与浅色面板 ---------- */
.rp-btn,
.rp-btn.rp-play {
  height: 62px;
  justify-content: center;
  gap: 0;
}
.rp-btn-label {
  display: none;
}
.rp-play .rp-btn-icon {
  margin-top: 0;
}

.rp-action-menu {
  bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  border-color: rgba(255,255,255,.72);
  background: rgba(255,250,238,.95);
  box-shadow: 0 8px 22px rgba(23,60,70,.22), inset 0 1px rgba(255,255,255,.72);
}
.rp-action-menu button {
  color: var(--ink-deep);
  text-shadow: none;
}
.rp-action-menu button:active {
  background: rgba(240,123,95,.1);
}
.rp-menu-ico {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: inherit;
  font-size: 0;
}
.rp-menu-image picture { display: contents; }
.rp-menu-image img {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(23,60,70,.16));
}

/* 直线返回箭头：蓝白高光与现有棋盘/设置 PNG 的明亮描边保持一致。 */
.rp-return-art {
  position: relative;
  filter: drop-shadow(0 2px 2px rgba(23,60,70,.2));
}
.rp-return-art::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 34px;
  height: 26px;
  background: #e9fbff;
  clip-path: polygon(0 50%, 35% 0, 35% 31%, 100% 31%, 100% 69%, 35% 69%, 35% 100%);
}
.rp-return-art::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  width: 29px;
  height: 20px;
  background: linear-gradient(180deg, #bff8ff 0%, #42c8e7 48%, #1593c2 100%);
  clip-path: polygon(0 50%, 35% 0, 35% 29%, 100% 29%, 100% 71%, 35% 71%, 35% 100%);
}

/* ---------- 复盘一级操作菜单：外观轮换 / 音效 / 注解均点击即生效 ---------- */
.rp-action-menu {
  left: 8px;
  right: 8px;
  width: auto;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 7px 5px 6px;
}
.rp-action-menu button {
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
}
.rp-action-menu button.on {
  background: rgba(46,159,171,.11);
  color: #267985;
}
.rp-action-menu button.on::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4e9b6f;
  box-shadow: 0 0 0 2px rgba(78,155,111,.14);
}
.rp-action-menu button { position: relative; }
.rp-piece-image img {
  border-radius: 50%;
  filter: drop-shadow(0 2px 3px rgba(120,54,35,.22));
}

/* 背景图标：当前项目两种背景的缩略表达。 */
.rp-bg-art {
  border: 2px solid #f4d48c;
  border-radius: 9px;
  background:
    linear-gradient(90deg, transparent 47%, rgba(255,255,255,.75) 47% 53%, transparent 53%),
    repeating-linear-gradient(90deg, #39adb5 0 7px, #2498a5 7px 14px);
  box-shadow: inset 0 1px rgba(255,255,255,.5), 0 2px 3px rgba(23,60,70,.18);
}

/* 走子音效：无现成素材，按设置齿轮的蓝白描边绘制扬声器。 */
.rp-sound-art { position: relative; }
.rp-sound-art::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 20px;
  height: 17px;
  background: linear-gradient(145deg, #c9fbff, #35bfdf 58%, #168ebd);
  clip-path: polygon(0 30%, 38% 30%, 85% 0, 85% 100%, 38% 70%, 0 70%);
  filter: drop-shadow(0 0 1px #087aa9) drop-shadow(0 2px 2px rgba(23,60,70,.2));
}
.rp-sound-art::after {
  content: "";
  position: absolute;
  right: 0;
  top: 8px;
  width: 11px;
  height: 18px;
  border: 3px solid #1ca6d1;
  border-left: 0;
  border-radius: 0 14px 14px 0;
  box-shadow: 2px 0 0 -1px #d7fbff;
}

/* 注解图标：纸张 + 铅笔。 */
.rp-note-art { position: relative; }
.rp-note-art::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 24px;
  height: 27px;
  border: 2px solid #d89b3d;
  border-radius: 5px;
  background: linear-gradient(145deg, #fffdf3, #f7e4b6);
  box-shadow: 0 2px 3px rgba(100,70,30,.14), inset 0 1px #fff;
}
.rp-note-art::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 3px;
  width: 20px;
  height: 5px;
  border: 1px solid #fff1c5;
  border-radius: 4px;
  background: linear-gradient(180deg, #f18b6c, #d95f43);
  box-shadow: 0 0 0 1px #a64c36;
  transform: rotate(-42deg);
}

/* 复盘页当前棋谱注解。 */
.replay-annotation {
  position: absolute;
  z-index: 8;
  top: 130px;
  left: 20px;
  max-width: min(230px, calc(100vw - 36px));
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(235,224,204,.76);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  text-shadow: 0 1px 2px rgba(23,60,70,.5);
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#screen-game.replay-mode.skin-bg-ivory .replay-annotation {
  color: rgba(108,96,79,.78);
  text-shadow: 0 1px #fff;
}

/* 注解编辑框：参考图的遮罩、纸张卡片、棕/绿双操作。 */
.rp-note-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(12,25,31,.63);
  pointer-events: auto;
}
.rp-note-card {
  width: min(350px, 100%);
  padding: 18px 18px 16px;
  border: 1px solid #d6c8aa;
  background:
    radial-gradient(rgba(120,100,70,.025) 1px, transparent 1.5px) 0 0 / 20px 20px,
    #f8f4e9;
  box-shadow: 0 16px 42px rgba(18,24,24,.34), inset 0 1px #fff;
}
.rp-note-card h2 {
  position: relative;
  width: 170px;
  margin: 0 auto 14px;
  color: #766552;
  font-family: "STKaiti", "KaiTi", var(--font-stack);
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  line-height: 34px;
}
.rp-note-card h2::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid #d9cfbb;
  border-radius: 50% / 16%;
  box-shadow: inset 0 0 0 3px rgba(222,213,195,.28);
}
.rp-note-card h2 span { position: relative; z-index: 1; }
.rp-note-card input {
  width: 100%;
  height: 47px;
  border: 1px solid #e1d8c5;
  border-radius: 8px;
  outline: none;
  background: #eee8da;
  color: #615547;
  font-family: var(--font-stack);
  font-size: 15px;
  text-align: center;
}
.rp-note-card input:focus {
  border-color: #d4b46f;
  background: #f7f2e6;
  box-shadow: 0 0 0 3px rgba(242,181,68,.14);
}
.rp-note-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 28px;
}
.rp-note-actions button {
  height: 43px;
  border: 0;
  border-radius: 8px;
  color: #fffdf6;
  font-family: var(--font-stack);
  font-size: 16px;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.14), 0 3px 7px rgba(60,45,25,.18);
}
#rp-note-cancel { background: linear-gradient(180deg, #c49a72, #aa7955); }
#rp-note-ok { background: linear-gradient(180deg, #72a672, #578d5d); }

/* 列表卡片头部的注解，长内容单行省略。 */
.rec-note {
  flex: 1 1 0;
  min-width: 0;
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #766c5e;
  font-size: 10px;
  font-weight: 700;
}
.rec-head .rec-time {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 359px) {
  .rp-action-menu { left: 4px; right: 4px; padding-left: 2px; padding-right: 2px; }
  .rp-menu-ico { transform: scale(.88); }
  .rp-action-menu button { font-size: 9.5px; }
  .rec-note { max-width: 48px; }
}

/* ---------- 复盘控制器：统一矢量图标与轻量主次层级 ---------- */
.rp-btn-icon svg {
  width: 24px;
  height: 24px;
  display: block;
  overflow: visible;
  fill: currentColor;
}
.rp-more .rp-btn-icon {
  width: 44px;
  height: 44px;
  margin: 0;
  border: 1px solid rgba(240, 217, 181, .26);
  border-radius: 14px;
  background: rgba(76, 55, 40, .32);
  color: #e4c292;
  box-shadow: inset 0 1px rgba(255,255,255,.06), 0 3px 10px rgba(35,22,12,.12);
  font-size: 0;
  letter-spacing: 0;
}
.rp-more .rp-btn-icon svg { width: 22px; height: 22px; }
.rp-play .rp-btn-icon {
  width: 56px;
  height: 56px;
  margin: 0;
  border: 1px solid rgba(255, 231, 194, .58);
  border-radius: 50%;
  background: linear-gradient(145deg, #e6b66e 0%, #bd7b38 72%, #9d612b 100%);
  color: #fffaf0;
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.38),
    inset 0 -2px 3px rgba(91,48,15,.2),
    0 5px 14px rgba(72,43,18,.24);
  font-size: 0;
}
.rp-play .rp-btn-icon svg { width: 25px; height: 25px; }
.rp-symbol-pause { display: none; }
.rp-play.rp-playing .rp-symbol-play { display: none; }
.rp-play.rp-playing .rp-symbol-pause { display: inline; }
.rp-btn.rp-play.rp-playing,
.rp-btn.rp-play.rp-playing .rp-btn-icon {
  background: linear-gradient(145deg, #6fa895 0%, #397766 100%);
  border-color: rgba(218, 247, 235, .48);
  color: #fff;
}
.rp-more:hover .rp-btn-icon,
.rp-more:focus-visible .rp-btn-icon { background: rgba(104, 73, 48, .48); }
.rp-play:hover .rp-btn-icon,
.rp-play:focus-visible .rp-btn-icon { filter: brightness(1.06); }
.rp-more:focus-visible,
.rp-play:focus-visible { outline: 2px solid rgba(255, 232, 188, .72); outline-offset: 2px; }
.rp-more:active .rp-btn-icon,
.rp-play:active .rp-btn-icon { transform: translateY(1px) scale(.94); }

#screen-game.replay-mode.skin-bg-ivory .rp-more .rp-btn-icon {
  border-color: rgba(116,84,51,.2);
  background: rgba(142,104,67,.12);
  color: #9c6f3f;
}
#screen-game.replay-mode.skin-bg-ivory .rp-play .rp-btn-icon {
  border-color: rgba(177,91,47,.3);
  background: linear-gradient(145deg, #ee9b72 0%, #d45f45 100%);
  color: #fff;
}
#screen-game.replay-mode.skin-bg-ivory .rp-play.rp-playing .rp-btn-icon {
  border-color: rgba(69,120,99,.3);
  background: linear-gradient(145deg, #77ad98 0%, #477c6b 100%);
}

@media (max-width: 359px) {
  .rp-more .rp-btn-icon { width: 40px; height: 40px; }
  .rp-play .rp-btn-icon { width: 52px; height: 52px; }
}

/* ===== 猫钰棋社账号入口：登录/注册/找回三态页 ===== */
.auth-screen {
  position: fixed; inset: 0; z-index: 2147483300;
  display: flex; align-items: center; justify-content: center;
  overflow: auto;
  background:
    radial-gradient(circle at 80% 24%, rgba(255, 217, 142, .42), transparent 30%),
    radial-gradient(circle at 22% 84%, rgba(226, 184, 111, .22), transparent 29%),
    linear-gradient(145deg, #fffdf7 0%, #fbf0dc 52%, #f1d3a3 100%);
  padding: max(22px, env(safe-area-inset-top, 0px)) 20px max(22px, env(safe-area-inset-bottom, 0px));
}
.auth-screen::before,
.auth-screen::after { content: ''; position: fixed; pointer-events: none; }
.auth-screen::before {
  left: -95px; top: 50%; width: 520px; height: 520px;
  transform: translateY(-50%) rotate(-4deg);
  clip-path: polygon(50% 0,60% 34%,94% 25%,70% 50%,94% 75%,60% 66%,50% 100%,40% 66%,6% 75%,30% 50%,6% 25%,40% 34%);
  background:
    radial-gradient(circle, rgba(191, 144, 68, .22) 0 6px, transparent 7px) 0 0 / 45px 45px,
    rgba(232, 193, 124, .13);
  filter: drop-shadow(0 0 1px rgba(178, 125, 47, .25));
  opacity: .62;
}
.auth-screen::after {
  right: -150px; bottom: -180px; width: 620px; height: 480px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,.64), rgba(255, 223, 166, .18) 48%, transparent 70%);
}
.auth-screen.hidden { display: none; }
.auth-card {
  position: relative;
  width: 390px; max-width: calc(100vw - 32px); max-height: calc(100vh - 40px); overflow: auto;
  box-sizing: border-box;
  background: linear-gradient(155deg, rgba(255,255,252,.995), rgba(249,244,232,.99));
  border: 1px solid rgba(255, 241, 207, .74); border-radius: 28px; padding: 26px 28px 24px;
  box-shadow: 0 28px 70px rgba(111, 77, 32, .22), inset 0 1px rgba(255,255,255,.9);
  scrollbar-width: thin;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 14px; }
.auth-brand-mark { position: relative; flex: 0 0 auto; width: 68px; height: 68px; padding: 0; border-radius: 16px; background: linear-gradient(160deg, #2f8d88, #1f6f6b); box-shadow: none; overflow: hidden; }
.auth-brand-mark img { display: block; width: 100%; height: 100%; border-radius: 0; object-fit: cover; }
/* 安卓 15+ 全面屏/刘海屏：APP 内容避让状态栏与手势条（普通浏览器 env()=0，无影响） */
@media (display-mode: standalone) {
  #app { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}
.auth-brand-copy { min-width: 0; text-align: left; }
.auth-brand-kicker { margin-bottom: 3px; color: #b07b31; font-size: 11px; font-weight: 700; letter-spacing: .16em; }
.auth-logo { color: #284d4f; font-family: "STKaiti", "KaiTi", var(--font-stack); font-size: 29px; font-weight: 900; letter-spacing: .08em; line-height: 1.1; }
.auth-sub { text-align: center; font-size: 12.5px; color: #6f7c78; margin: 14px 0 8px; line-height: 1.6; }
.auth-benefits { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 22px; color: #8c806d; font-size: 10.5px; }
.auth-benefits i { width: 3px; height: 3px; border-radius: 50%; background: #d1a75a; }
.auth-panel { display: flex; flex-direction: column; gap: 12px; }
.auth-panel.hidden { display: none; }
.auth-panel-title { color: #344d4a; font-size: 18px; font-weight: 850; line-height: 1.2; }
.auth-panel-caption { margin-top: -7px; color: #90958e; font-size: 11.5px; line-height: 1.5; }
.auth-err { padding: 9px 11px; border: 1px solid rgba(208,69,60,.2); border-radius: 9px; background: rgba(208,69,60,.06); color: #c64b42; font-size: 12px; line-height: 1.4; }
.auth-err.hidden { display: none; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field > span { color: #566b67; font-size: 12px; font-weight: 700; }
.auth-field input {
  width: 100%; min-height: 47px; box-sizing: border-box; padding: 12px 14px;
  border: 1px solid #ded8ca; border-radius: 12px; background: rgba(255,255,255,.88);
  color: #334440; font-size: 15px; box-shadow: inset 0 1px 2px rgba(64,48,26,.035);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.auth-field input::placeholder { color: #b1afa7; }
.auth-field input:focus { outline: none; border-color: #5e947c; background: #fff; box-shadow: 0 0 0 3px rgba(78,155,111,.12); }
.auth-code-row { display: flex; gap: 9px; }
.auth-code-row input { flex: 1; min-width: 0; }
.auth-btn {
  width: 100%; min-height: 46px; padding: 11px 14px; border: none; border-radius: 12px;
  font-size: 14px; font-weight: 750; cursor: pointer; background: #eee9df; color: #53605b;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.auth-btn:active:not(:disabled) { transform: translateY(1px); }
.auth-btn.primary { background: linear-gradient(135deg, #5c987b, #3f7965); color: #fff; box-shadow: 0 7px 16px rgba(45,112,85,.23), inset 0 1px rgba(255,255,255,.22); }
.auth-btn.ghost { border: 1px solid #ded6c8; background: rgba(247,243,234,.9); color: #53605b; }
.auth-btn:disabled { opacity: .55; cursor: default; }
.auth-btn.hidden { display: none; }
.auth-send { width: auto; min-width: 106px; padding: 11px 12px; white-space: nowrap; font-size: 12.5px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 1px; }
.auth-link { border: none; background: none; color: #478068; font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 4px 0; }
.auth-link:hover { color: #2f6852; }
.auth-privacy { display: flex; align-items: flex-start; gap: 7px; color: #7c857f; font-size: 11.5px; line-height: 1.5; cursor: pointer; }
.auth-privacy input { margin-top: 2px; accent-color: #4e8d70; }
.auth-privacy-link { color: #3e8064; text-decoration: none; }
.auth-mode-row { display: flex; gap: 7px; padding: 4px; border-radius: 12px; background: #ece8df; }
.auth-mode { flex: 1; padding: 9px 0; border: 0; border-radius: 9px; background: transparent; color: #77807b; font-size: 12.5px; cursor: pointer; }
.auth-mode.on { background: #fff; color: #3e7c63; font-weight: 800; box-shadow: 0 2px 7px rgba(59,49,34,.09); }
.auth-recovery-step {
  border: 1px solid #f0d9a8; background: #fff8e8; border-radius: 12px; padding: 12px 12px; margin-top: 4px;
}
.auth-recovery-step.hidden { display: none; }
.auth-recovery-tip { font-size: 12.5px; color: #8a6d1f; margin-bottom: 8px; }
.auth-recovery-code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 20px; font-weight: 800; letter-spacing: 2px; text-align: center;
  color: #2a6280; background: #fff; border: 1px dashed #dcd8ce; border-radius: 8px; padding: 10px 4px; margin: 6px 0;
}
.auth-recovery-warn { font-size: 11.5px; color: #9a7b2e; line-height: 1.5; margin: 6px 0; }
.privacy-card { max-width: 420px; }
.privacy-card h2 { color: #3a3f3d; }

/* 修改密码：三次输入确认 + 明确取消入口 */
.changepw-card { position: relative; width: min(410px, calc(100vw - 28px)); padding: 25px 25px 22px; border-radius: 22px; border-color: rgba(205, 163, 92, .42); background: linear-gradient(155deg, #fffefb, #fbf3e5); box-shadow: 0 22px 60px rgba(88, 61, 29, .2); }
.changepw-card h2 { margin: 0 0 5px; color: #354e49; font-size: 22px; text-align: left; }
.changepw-sub { margin: 0 0 17px; color: #8b8d84; font-size: 12px; line-height: 1.5; }
.changepw-card .field { margin-bottom: 12px; }
.changepw-card .field > span { margin-bottom: 6px; color: #51645f; font-size: 12.5px; font-weight: 750; }
.changepw-card .field input { min-height: 45px; border-color: #ded6c8; border-radius: 11px; background: rgba(255,255,255,.9); }
.changepw-card .field input:focus { border-color: #5e947c; box-shadow: 0 0 0 3px rgba(78,155,111,.11); }
.changepw-error { min-height: 18px; margin: -2px 0 7px; text-align: left; }
.changepw-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.changepw-actions .btn { width: 100%; min-height: 43px; border-radius: 11px; }
.changepw-actions .btn.ghost { border-color: #ddd3c4; background: rgba(255,255,255,.62); color: #65716d; }

/* 我的页账号区：作为资料主卡的一部分 */
.me-account { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; padding-top: 14px; border-top: 1px solid rgba(139, 109, 68, .13); }
.me-account.hidden { display: none; }
.me-account-copy { display: flex; align-items: center; gap: 9px; min-width: 0; }
.me-account-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; background: #edf4ee; color: #538069; }
.me-account-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.me-account-label { margin-bottom: 2px; color: #756a59; font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.me-account-phone { color: #435b56; font-size: 12.5px; font-weight: 750; white-space: nowrap; }
.me-account-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.me-account-action { border: 0; border-radius: 8px; padding: 7px 8px; background: transparent; color: #5c756c; font-size: 11.5px; cursor: pointer; }
.me-account-action:active { background: rgba(78,139,108,.09); }
.me-account-action.danger { color: #b06255; }

@media (max-width: 380px) {
  .auth-card { max-width: calc(100vw - 22px); padding: 22px 20px 20px; border-radius: 23px; }
  .auth-brand-mark { width: 60px; height: 60px; border-radius: 14px; }
  .auth-brand-mark img { border-radius: 0; }
  .auth-logo { font-size: 26px; }
  .auth-benefits { gap: 6px; font-size: 10px; }
  .me-card { padding: 14px; }
  .me-profile-row { gap: 9px; }
  .me-avatar-btn { width: 50px; height: 50px; }
  .me-edit-profile { padding-left: 8px !important; padding-right: 8px !important; }
  .me-account { align-items: flex-start; flex-direction: column; }
  .me-account-actions { align-self: stretch; }
  .me-account-action { flex: 1; background: rgba(241,237,226,.64); }
}

/* 已登录态：隐藏登录页时 body 不再滚动（可选） */
body.auth-gated { overflow: hidden; }

/* ========================================================================== */
/* 2026-09 社交与好友房统一视觉：冷灰白原生层级 + 三维猫狗中央舞台              */
/* ========================================================================== */
:root {
  --wx-bg: #ededed;
  --wx-bg-cool: #e9edf0;
  --wx-surface: #fff;
  --wx-ink: #191919;
  --wx-muted: #7f7f7f;
  --wx-line: rgba(0, 0, 0, .1);
  --wx-green: #07c160;
  --wx-bubble: #95ec69;
  --bg1: #ededed;
  --bg2: #e9edf0;
  --bg3: #e3e7e9;
  --panel: #fff;
  --ink: #191919;
  --muted: #7f7f7f;
  --line: rgba(0, 0, 0, .1);
  --ready: #07c160;
}
body {
  background: var(--wx-bg);
  color: var(--wx-ink);
}
#screen-home,
#screen-game,
#screen-lobby,
#screen-history,
#screen-profile { background: var(--wx-bg-cool) !important; }
#screen-game .game-wrap { background: var(--wx-bg-cool) !important; }
.panel, .hist-paper, .modal-card { background: #fff; border-color: var(--wx-line); }

/* 微信式底部导航：无金边、无米黄选中块 */
.tabbar,
#screen-history.active ~ .tabbar {
  padding: 5px 8px calc(5px + env(safe-area-inset-bottom, 0px));
  border: 0;
  border-top: 1px solid var(--wx-line);
  border-radius: 0;
  background: rgba(248, 248, 248, .98);
  box-shadow: none;
}
.tab-btn { color: #5f5f5f; font-weight: 500; border-radius: 0; }
.tab-btn::before { display: none; }
.tab-btn .tab-ico { width: 40px; height: 34px; border-radius: 0; }
.tab-btn .tab-label { text-shadow: none; }
.tab-btn.on,
#screen-history.active ~ .tabbar .tab-btn.on,
.tab-btn.on .tab-ico-glyph { color: var(--wx-green); }
.tab-ico-glyph { color: #4d4d4d; font-size: 24px; }
.tab-unread { border-color: #f8f8f8; }

/* 好友房三维大厅 */
.friend-lobby {
  position: relative;
  width: min(100%, 560px);
  height: 100dvh;
  min-height: 620px;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 52%, rgba(255,255,255,.96), rgba(233,237,240,.92) 57%, #e5e9eb 100%);
  color: var(--wx-ink);
}
.friend-lobby-head {
  position: absolute;
  z-index: 8;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 0;
  pointer-events: none;
}
.friend-lobby-primary,
.friend-lobby-room { display: flex; flex-direction: column; align-items: stretch; gap: 9px; pointer-events: auto; }
.lobby-start {
  min-width: 122px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #12c865, #06ad54);
  color: #fff;
  box-shadow: 0 7px 18px rgba(7, 193, 96, .2), inset 0 1px rgba(255,255,255,.28);
  font: 750 18px var(--font-stack);
  cursor: pointer;
}
.lobby-start:disabled { opacity: .48; box-shadow: none; }
.lobby-mode-select {
  min-width: 122px;
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--wx-line);
  border-radius: 10px;
  background: rgba(255,255,255,.92);
  color: var(--wx-ink);
  box-shadow: 0 3px 10px rgba(38,55,61,.06);
  font: 600 13px var(--font-stack);
}
.lobby-mode-select b { color: #777; font-size: 21px; font-weight: 400; }
.friend-lobby-room { align-items: flex-end; }
.friend-room-code {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: #4f5558;
  font: 500 13px var(--font-stack);
}
.friend-room-code b { color: #303436; font-size: 14px; letter-spacing: .08em; }
.lobby-voice {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 0;
}
.lobby-voice .vbtn {
  width: auto;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4f5558;
  box-shadow: none;
  font: 500 12px var(--font-stack);
}
.lobby-voice .vbtn.on { background: rgba(7,193,96,.1); color: #079d50; }
.lobby-voice .vbtn.speaking { box-shadow: 0 0 0 2px rgba(7,193,96,.22); }
.friend-lobby-stage { position: absolute; z-index: 1; inset: 100px 0 76px; overflow: hidden; }
#lobby-3d-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#lobby-3d-canvas:active { cursor: grabbing; }
.lobby-3d-labels { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
.lobby-player-label {
  position: absolute;
  transform: translate(-50%, 0);
  min-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 3px 7px;
  border: 0;
  border-radius: 7px;
  background: rgba(255,255,255,.72);
  color: var(--wx-ink);
  backdrop-filter: blur(5px);
  pointer-events: auto;
  white-space: nowrap;
}
.lobby-player-label b { max-width: 92px; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.lobby-player-label small { color: var(--wx-green); font-size: 9px; }
.lobby-player-label.waiting small { color: #df8a24; }
.lobby-player-label.offline small { color: #999; }
.lobby-character-stage > .lobby-player-label {
  min-width: 0;
  max-width: 58px;
  min-height: 12px;
  flex-direction: row;
  justify-content: center;
  gap: 2px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
  line-height: 1;
  opacity: .94;
  color: #2f3437;
  text-shadow: 0 1px 1px #fff, 0 0 3px #fff, 0 0 5px rgba(255,255,255,.9);
}
.lobby-character-stage > .lobby-player-label b { max-width: 44px; overflow: hidden; text-overflow: ellipsis; color: #2f3437; font-size: 9px; font-weight: 700; }
.lobby-character-stage > .lobby-player-label small { flex: 0 0 auto; display: flex; align-items: center; color: #fff; font-size: 8px; }
.lobby-character-stage > .lobby-player-label small span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lobby-character-stage > .lobby-player-label small i { width: 8px; height: 8px; display: inline-grid; place-items: center; border-radius: 50%; background: #38bd58; color: #fff; font-size: 6px; font-style: normal; text-shadow: none; }
.lobby-character-stage > .lobby-player-label small.waiting i { background: #e99a34; }
.lobby-character-stage > .lobby-player-label small.offline i { background: #92999c; }
.lobby-stage-invite {
  position: absolute;
  z-index: 5;
  right: 18px;
  top: 58%;
  padding: 8px 12px;
  border: 1px solid rgba(7,193,96,.48);
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: #099d51;
  box-shadow: 0 4px 14px rgba(38,55,61,.1);
  font: 650 12px var(--font-stack);
}
.friend-lobby-stage[data-player-count="3"] .lobby-stage-invite,
.friend-lobby-stage[data-player-count="4"] .lobby-stage-invite,
.friend-lobby-stage[data-player-count="5"] .lobby-stage-invite {
  top: 14%;
}
.friend-lobby-stage .lobby-status {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 170px);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.76);
  color: #6f7679;
  font-size: 10px;
  text-align: center;
  backdrop-filter: blur(6px);
}
.friend-lobby-tools {
  position: absolute;
  z-index: 7;
  left: 12px;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 6px;
}
.friend-lobby-tools > button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--wx-line);
  border-radius: 8px;
  background: rgba(255,255,255,.86);
  color: #666;
  font: 500 11px var(--font-stack);
}
.friend-lobby-tools > button.danger { color: #d84b43; }
.lobby-mode-sheet {
  position: absolute;
  z-index: 30;
  inset: 0;
  padding: calc(12px + env(safe-area-inset-top,0px)) 14px calc(20px + env(safe-area-inset-bottom,0px));
  overflow-y: auto;
  background: var(--wx-bg);
}
.lobby-mode-sheet-head, .native-subhead {
  min-height: 52px;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  text-align: center;
}
.lobby-mode-sheet-head button, .native-subhead button {
  border: 0; background: transparent; color: var(--wx-ink); font-size: 32px; text-align: left;
}
.lobby-mode-sheet-head b { font-size: 17px; }
.lobby-game-mode {
  width: 100%; min-height: 92px; display: flex; align-items: center; gap: 14px;
  margin: 10px 0; padding: 12px 16px; border: 1px solid transparent; border-radius: 12px;
  background: #fff; color: var(--wx-ink); text-align: left;
}
.lobby-game-mode.on { border-color: var(--wx-green); }
.lobby-game-mode:disabled { opacity: .58; }
.lobby-game-mode i { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 10px; background: #edf3ef; color: #6a4d31; font: 800 25px serif; }
.lobby-game-mode > span { flex: 1; }.lobby-game-mode b { display: block; font-size: 19px; }.lobby-game-mode small { display: block; margin-top: 5px; color: var(--wx-muted); }.lobby-game-mode em { color: var(--wx-green); font-size: 20px; font-style: normal; }
.lobby-jump-config { margin-top: 14px; padding: 14px; border-radius: 12px; background: #fff; }
.lobby-capacity-note { margin: 0 0 14px; color: #68716d; font-size: 12px; line-height: 1.55; }
.lobby-jump-config.non-jump-mode .jump-only-field,
.lobby-jump-config.non-jump-mode .lobby-capacity-note { display: none; }
.lobby-jump-config .field { margin: 0 0 15px; }
.lobby-jump-config .field:last-child { margin-bottom: 0; }
.lobby-jump-config .field > span { display: block; margin-bottom: 8px; color: #666; font-size: 13px; }
.lobby-jump-config .seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.lobby-jump-config #seg-jump { grid-template-columns: repeat(2, 1fr); }
.lobby-jump-config #seg-timer { grid-template-columns: repeat(4, 1fr); }
.lobby-jump-config .seg button { min-width: 0; min-height: 38px; padding: 0 4px; border: 1px solid #dedede; border-radius: 7px; background: #f8f8f8; color: #333; font-size: 12px; }
.lobby-jump-config .seg button.on { border-color: #07c160; background: rgba(7,193,96,.09); color: #079d50; font-weight: 700; }
.lobby-jump-config .seg button:disabled { opacity: .62; }
.lobby-mode-sheet > .btn {
  position: sticky;
  z-index: 2;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  min-height: 45px;
  margin-top: 10px;
  border: 0;
  background: var(--wx-green);
  box-shadow: 0 8px 20px rgba(7,193,96,.18);
}
.lobby-3d-fallback { position: absolute; inset: 45% 0 auto; text-align: center; color: var(--wx-muted); }

/* 社交页统一为冷灰白原生列表 */
.social-screen, .social-subscreen { background: var(--wx-bg); color: var(--wx-ink); }
.social-page { max-width: 560px; background: var(--wx-bg); box-shadow: none; }
.social-head,
.native-subhead {
  position: sticky;
  z-index: 15;
  top: 0;
  min-height: 58px;
  padding: calc(7px + env(safe-area-inset-top,0px)) 14px 7px;
  border-bottom: 1px solid var(--wx-line);
  background: rgba(237,237,237,.96);
  color: var(--wx-ink);
  box-shadow: none;
  backdrop-filter: blur(16px);
}
.social-head h1, .native-subhead h1 { font-size: 17px; font-weight: 650; letter-spacing: 0; }
.social-head-actions { justify-self: end; display: flex; align-items: center; gap: 10px; }
.social-head-btn {
  width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 0;
  background: transparent; color: var(--wx-ink); font-size: 25px; line-height: 1;
}
.social-search-open { font-size: 27px; transform: translateY(-1px); }
.social-plus-menu {
  position: fixed; z-index: 90; top: 58px; right: 12px; width: 158px;
  border: 0; border-radius: 7px; background: #4c4c4c; box-shadow: 0 8px 25px rgba(0,0,0,.25); color: #fff;
}
.social-plus-menu::before { background: #4c4c4c; }
.social-plus-menu button { min-height: 48px; border-color: rgba(255,255,255,.12); color: #fff; font-weight: 450; }
.social-plus-menu button span { color: #fff; }
.social-list { background: #fff; }
.social-list button, .social-row { min-height: 66px; padding: 8px 16px; border-color: var(--wx-line); color: var(--wx-ink); }
.social-list button:active, .social-row:active { background: #f2f2f2; }
.social-avatar { flex-basis: 48px; border-radius: 5px; background: #e6e6e6; }
.social-avatar.publication { border: 0; border-radius: 6px; background: #2887eb; color: #fff; }
.social-row-copy strong { color: var(--wx-ink); font-weight: 550; }
.social-row-copy small, .social-row-side { color: var(--wx-muted); }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: #fa5151; }
.contact-search { margin: 8px; border: 0; border-radius: 5px; background: #fff; }
.contact-special { margin-bottom: 8px; }
.contact-special button { min-height: 58px; }
.contact-icon { border-radius: 5px; }.contact-icon.teal { background: #2887eb; color: #fff; }
.contact-letter { padding: 4px 16px; background: var(--wx-bg); color: #666; }
.alphabet-contacts { padding-right: 14px; }
.contact-count { padding: 17px 0 96px; background: var(--wx-bg); color: var(--wx-muted); font-size: 13px; text-align: center; }
.contact-index { color: #555; }
.social-modal-card { border-radius: 12px; background: #fff; }
.social-empty { padding: 30px 16px; }
.social-submit { width: 100%; margin-top: 12px; }

/* 全屏聊天 */
.social-subscreen.active { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; }
.native-subhead { position: relative; flex: 0 0 auto; width: 100%; display: grid; grid-template-columns: 48px 1fr 48px; }
.native-subhead > button:last-child { text-align: right; font-size: 22px; }
.social-chat-log { flex: 1; min-height: 0; max-height: none; overflow-y: auto; padding: 14px 12px 20px; border-radius: 0; background: var(--wx-bg); }
.chat-date { padding: 10px; color: #aaa; font-size: 11px; text-align: center; }
.native-chat-row { display: flex; align-items: flex-start; gap: 9px; margin: 13px 0; }
.native-chat-row.mine { flex-direction: row-reverse; }
.native-chat-row .social-avatar { flex-basis: 40px; width: 40px; height: 40px; }
.native-chat-bubble { position: relative; max-width: min(72%, 430px); padding: 10px 12px; border-radius: 5px; background: #fff; color: var(--wx-ink); font-size: 15px; line-height: 1.45; word-break: break-word; }
.native-chat-row.mine .native-chat-bubble { background: var(--wx-bubble); }
.native-chat-bubble::before { content: ''; position: absolute; left: -6px; top: 13px; border-width: 5px 7px 5px 0; border-style: solid; border-color: transparent #fff transparent transparent; }
.native-chat-row.mine .native-chat-bubble::before { left: auto; right: -6px; border-width: 5px 0 5px 7px; border-color: transparent transparent transparent var(--wx-bubble); }
.room-invite-message { width: min(280px, 75vw); overflow: hidden; border-radius: 6px; background: #fff; }
.room-invite-message b, .room-invite-message span { display: block; padding: 11px 13px 0; }.room-invite-message span { padding-top: 4px; color: var(--wx-muted); font-size: 12px; }.room-invite-message button { width: calc(100% - 24px); margin: 12px; padding: 9px; border: 0; border-radius: 5px; background: var(--wx-green); color: #fff; }
.room-invite-message button.invite-dead { background: #b9bec2; cursor: default; }
.social-chat-compose { flex: 0 0 auto; min-height: 58px; display: flex; align-items: center; gap: 7px; padding: 7px 9px calc(7px + env(safe-area-inset-bottom,0px)); border-top: 1px solid var(--wx-line); background: #f7f7f7; }
.social-chat-compose input { flex: 1; min-width: 0; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 5px; background: #fff; font: 15px var(--font-stack); }
.social-chat-compose button { flex: 0 0 auto; width: 36px; height: 36px; border: 0; background: transparent; color: #111; font-size: 25px; }
.social-chat-compose #social-message-send { width: auto; padding: 0 11px; border-radius: 5px; background: var(--wx-green); color: #fff; font-size: 13px; }
.social-chat-extra { flex: 0 0 auto; display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; padding: 24px 12px calc(25px + env(safe-area-inset-bottom,0px)); border-top: 1px solid var(--wx-line); background: #f7f7f7; }
.social-chat-extra button { border: 0; background: transparent; color: #666; font-size: 11px; }
.social-chat-extra i { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 7px; border-radius: 10px; background: #fff; color: #202020; font-size: 23px; font-style: normal; }

/* 公众号式棋刊 */
.publication-timeline { flex: 1; overflow-y: auto; padding: 8px 14px 30px; background: var(--wx-bg); }
.publication-push > time { display: block; padding: 13px 0 8px; color: #999; font-size: 11px; text-align: center; }
.publication-push > button { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; overflow: hidden; padding: 12px; border: 0; border-radius: 7px; background: #fff; color: var(--wx-ink); text-align: left; }
.publication-push:first-child > button { display: flex; flex-wrap: wrap; }
.publication-push:first-child > button .publication-cover { flex: 0 0 100%; }
.publication-push > button > span:not(.publication-thumb) { min-width: 0; flex: 1; }.publication-push b { display: block; font-size: 15px; }.publication-push small { display: block; margin-top: 6px; color: var(--wx-muted); }.publication-push em { color: #aaa; font-size: 23px; font-style: normal; }
.publication-thumb { width: 76px; height: 58px; display: grid; place-items: center; border-radius: 4px; background: #e7ede9; color: #557b64; font-size: 23px; }
.publication-cover { position: relative; width: 100%; height: 170px; overflow: hidden; border-radius: 5px; background: linear-gradient(145deg, #d9c4a4, #b18d60); }
.publication-cover::before { content: ''; position: absolute; left: 50%; top: 51%; width: 118px; height: 118px; transform: translate(-50%,-50%) rotate(30deg); clip-path: polygon(50% 0,61% 35%,98% 25%,70% 50%,98% 75%,61% 65%,50% 100%,39% 65%,2% 75%,30% 50%,2% 25%,39% 35%); background: #e8d9bd; box-shadow: 0 8px 22px rgba(0,0,0,.2); }
.publication-cover i { position: absolute; z-index: 2; left: 50%; top: 50%; width: 15px; height: 15px; border-radius: 50%; background: #e94b42; box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.publication-cover i:nth-child(1){transform:translate(-52px,-7px)}.publication-cover i:nth-child(2){transform:translate(-33px,-25px);background:#efbb31}.publication-cover i:nth-child(3){transform:translate(-10px,-41px);background:#2aa65b}.publication-cover i:nth-child(4){transform:translate(16px,-18px);background:#3189d6}.publication-cover i:nth-child(5){transform:translate(34px,5px);background:#7655bf}.publication-cover i:nth-child(6){transform:translate(-10px,22px);background:#f0802c}
.publication-article { flex: 1; overflow-y: auto; padding: 18px 18px 86px; background: #fff; }
.publication-article h1 { font-size: 23px; line-height: 1.35; }.article-byline { margin: 9px 0 18px; color: var(--wx-muted); font-size: 12px; }.publication-article p { margin: 18px 0; color: #333; font-size: 15px; line-height: 1.9; }.publication-article .publication-cover { height: 200px; }.article-board { width: min(310px,100%); aspect-ratio:1; margin: 22px auto; border: 1px solid #c8b89e; background: repeating-linear-gradient(0deg,transparent 0 37px,#d5c8b3 38px 39px),repeating-linear-gradient(90deg,#fff 0 37px,#d5c8b3 38px 39px); }.publication-article footer { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns:repeat(3,1fr); border-top:1px solid var(--wx-line); background:#fff; }.publication-article footer button { padding:14px 4px calc(14px + env(safe-area-inset-bottom,0px)); border:0; border-right:1px solid var(--wx-line); background:#fff; color:#333; }

/* 我的、个人资料、个人主页 */
.native-me-page { width: min(100%,560px); min-height: 100vh; margin: 0 auto; padding: calc(54px + env(safe-area-inset-top,0px)) 0 calc(84px + env(safe-area-inset-bottom,0px)); background: var(--wx-bg); }
.native-me-hero { width: 100%; min-height: 154px; display: flex; align-items: center; gap: 16px; padding: 25px 22px; border: 0; background: #fff; color: var(--wx-ink); text-align: left; }
.native-me-hero .me-avatar { flex: 0 0 70px; width:70px; height:70px; border-radius:7px; overflow:hidden; }.native-me-hero .me-avatar img{width:100%;height:100%;object-fit:cover}.native-me-identity{flex:1;min-width:0}.native-me-identity b{display:block;font-size:21px}.native-me-identity small{display:block;margin-top:9px;color:var(--wx-muted);font-size:13px}.native-chevron{color:#aaa;font-size:28px}
.native-row-group { margin-top: 9px; background: #fff; }
.native-row { width:100%; min-height:58px; display:grid; grid-template-columns:32px minmax(90px,1fr) auto 18px; align-items:center; gap:8px; padding:0 16px; border:0; border-bottom:1px solid var(--wx-line); background:#fff; color:var(--wx-ink); text-align:left; }.native-row:last-child{border-bottom:0}.native-row i{font-size:20px;font-style:normal;text-align:center}.native-row span{font-size:16px}.native-row small{max-width:180px;overflow:hidden;color:var(--wx-muted);text-overflow:ellipsis;white-space:nowrap}.native-row b{color:#aaa;font-size:22px;font-weight:400}
.native-detail-list { flex:1; overflow-y:auto; background:var(--wx-bg); padding-bottom:30px; }.native-detail-group{margin-top:9px;background:#fff}.native-detail-group button{width:100%;min-height:58px;display:flex;align-items:center;gap:10px;padding:8px 16px;border:0;border-bottom:1px solid var(--wx-line);background:#fff;color:var(--wx-ink);text-align:left}.native-detail-group button>span:first-child{flex:1;font-size:16px}.native-detail-group small{color:var(--wx-muted);font-size:14px}.native-detail-group b{color:#aaa;font-size:22px;font-weight:400}.native-detail-group .social-avatar.detail-avatar{flex-basis:48px}.native-detail-group button.danger span{color:#d84b43}
.player-profile-page { flex:1; overflow-y:auto; padding-bottom:90px; background:var(--wx-bg); }.player-profile-hero{min-height:170px;display:flex;align-items:center;gap:18px;padding:24px 20px;background:#fff}.player-profile-avatar{flex:0 0 82px;width:82px;height:82px;display:grid;place-items:center;overflow:hidden;border-radius:7px;background:#e6e6e6;font-size:35px}.player-profile-avatar img{width:100%;height:100%;object-fit:cover}.player-profile-hero h2{font-size:23px}.player-profile-hero p{margin-top:6px;color:var(--wx-muted);font-size:13px}.player-profile-row{width:calc(100% - 24px);min-height:72px;display:flex;align-items:center;gap:12px;margin:10px 12px 0;padding:12px 15px;border:0;border-radius:7px;background:#fff;color:var(--wx-ink);text-align:left}.player-profile-row>span:first-child{font-size:16px;white-space:nowrap}.player-profile-row small{flex:1;color:var(--wx-muted);text-align:right}.player-profile-row>b{color:#aaa;font-size:22px}.player-profile-row .player-ach-chip{width:42px}.player-profile-row .player-ach-chip img{width:35px;height:35px;object-fit:contain}.player-profile-row .player-ach-chip small{display:none}.player-profile-page>.player-social-actions{position:fixed;z-index:20;left:0;right:0;bottom:0;display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));background:#f7f7f7;border-top:1px solid var(--wx-line)}.player-profile-page>.player-social-actions button{min-height:44px;border:1px solid var(--wx-green);border-radius:6px;background:#fff;color:#079d50;font-size:15px}.player-profile-page>.player-social-actions button.primary{background:var(--wx-green);color:#fff}.player-profile-page>.player-social-actions button:disabled{opacity:.5}

/* 个人主页：朋友资料区 / 动作白底栏 / 名片消息 / 主页棋谱选择 */
.player-prof-friend-margin { margin-top: 10px; }
.player-friend-info { margin-top: 10px; }
.player-friend-info .player-profile-row { margin-top: 0; }
.player-profile-page > .player-social-actions { position: static; display: flex; flex-direction: column; gap: 10px; margin: 18px 12px 24px; padding: 0; background: transparent; border: 0; }
.player-profile-action-bar { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; padding: 0 15px; border: 0; border-radius: 8px; background: #fff; color: var(--wx-ink); font-size: 16px; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.player-profile-action-bar.action-primary { color: #079d50; }
.player-profile-action-bar:disabled { opacity: .5; }
textarea#peer-memo-input { width: 100%; min-height: 78px; padding: 10px 12px; border: 1px solid #ddd6c9; border-radius: 10px; font: inherit; resize: vertical; }

/* 聊天网红名片消息 */
.social-card-message { display: flex; align-items: center; gap: 12px; min-width: 230px; max-width: 78%; padding: 10px 12px; border: 0; border-radius: 10px; background: #fff; color: var(--wx-ink); text-align: left; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.social-card-avatar { flex: 0 0 46px; width: 46px; height: 46px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: #e6e6e6; font-size: 22px; }
.social-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.social-card-copy { flex: 1; min-width: 0; }
.social-card-copy b { display: block; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.social-card-copy small { display: block; margin-top: 3px; color: var(--wx-muted); font-size: 12px; }
.social-card-go { color: #aaa; font-size: 22px; }

/* 个人主页棋谱（按玩法分组） */
.peer-records-list { padding: 4px 0; }
.peer-rec-group { margin-bottom: 6px; }
.peer-rec-group-title { padding: 8px 14px 4px; color: var(--wx-muted); font-size: 13px; }
.peer-rec-item { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 8px 16px; border: 0; border-top: 1px solid var(--wx-line); background: #fff; color: var(--wx-ink); text-align: left; }
.peer-rec-item span { flex: 1; font-size: 15px; }
.peer-rec-item small { color: var(--wx-muted); font-size: 12px; }
.peer-rec-item > b { color: #aaa; font-size: 20px; }
.peer-rec-item .peer-rec-remove { color: #079d50; font-size: 13px; font-weight: 600; }

@media (max-width: 390px) {
  .friend-lobby-head { padding-left: 12px; padding-right: 12px; }
  .lobby-start, .lobby-mode-select { min-width: 108px; }
  .lobby-start { min-height: 44px; padding: 0 15px; font-size: 16px; }
  .lobby-voice .vbtn { padding: 0 4px; font-size: 11px; }
  .friend-lobby-stage { top: 92px; }
  .lobby-player-label { min-width: 62px; padding-left: 4px; padding-right: 4px; }
  .social-chat-extra { gap: 7px; }
  .social-chat-extra i { width: 48px; height: 48px; }
}

/* ---------- 社交层：消息 / 棋友录 / 群聊 / 个人码 ---------- */
.social-screen { background: linear-gradient(180deg, #eef2ef, #f7f3e9 42%); }
.social-page { position: relative; max-width: 460px; min-height: 100vh; margin: 0 auto; padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); background: #f7f4ed; box-shadow: 0 0 28px rgba(38,69,68,.08); }
.social-head { position: sticky; top: 0; z-index: 5; min-height: 62px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px; color: #fff; background: linear-gradient(180deg, #25a6ae, #168f99); box-shadow: 0 2px 10px rgba(28,91,97,.2); }
.social-head h1 { font-size: 20px; letter-spacing: .08em; white-space: nowrap; }
.social-brand { align-self: center; color: #ffe39a; font-size: 12px; font-weight: 850; }
.social-head-btn { justify-self: end; width: 36px; height: 36px; border: 1.5px solid rgba(255,255,255,.78); border-radius: 50%; background: rgba(255,255,255,.08); color: #fff; font-size: 27px; line-height: 1; cursor: pointer; }
.social-plus-menu { position: absolute; z-index: 9; top: calc(54px + env(safe-area-inset-top, 0px)); right: 10px; width: 154px; overflow: hidden; border: 1px solid rgba(93,76,53,.18); border-radius: 9px; background: #fffdf8; box-shadow: 0 10px 28px rgba(24,50,52,.24); }
.social-plus-menu::before { content: ''; position: absolute; top: -6px; right: 14px; width: 12px; height: 12px; transform: rotate(45deg); background: #fffdf8; }
.social-plus-menu button { position: relative; width: 100%; display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 0; border-bottom: 1px solid #eee8dc; background: transparent; color: #3d4847; font: 700 14px var(--font-stack); text-align: left; }
.social-plus-menu button:last-child { border-bottom: 0; }
.social-plus-menu button span { width: 22px; color: #39786f; font-size: 18px; text-align: center; }
.social-list { background: rgba(255,255,255,.86); }
.social-list button, .social-row { width: 100%; min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 9px 17px 9px 14px; border: 0; border-bottom: 1px solid #ece8de; background: transparent; color: #314448; font: inherit; text-align: left; cursor: pointer; }
.social-list button:active, .social-row:active { background: #f1ede4; }
.social-avatar { flex: 0 0 48px; width: 48px; height: 48px; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: #e7eee9; color: #fff; font-size: 24px; }
.social-avatar img { width: 100%; height: 100%; object-fit: cover; }
.social-avatar.publication { background: linear-gradient(145deg, #2caeab, #1d817f); color: #ffe6a3; border: 2px solid #d7af59; }
.social-row-copy { min-width: 0; flex: 1; }
.social-row-copy strong { display: block; overflow: hidden; color: #384544; font-size: 15.5px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.social-row-copy small { display: block; overflow: hidden; margin-top: 4px; color: #8b9290; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.social-row-side { align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 5px; color: #a1a49f; font-size: 11px; }
.social-badge, .tab-unread { display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #ef5b4f; color: #fff; font-size: 10px; font-style: normal; line-height: 1; }
.tab-unread { position: absolute; z-index: 3; top: 0; left: calc(50% + 11px); border: 2px solid #fff9e9; }
.tab-ico-glyph { color: #897760; font-size: 25px; font-weight: 400; }
.tab-btn.on .tab-ico-glyph { color: #e45b25; }
.contact-search { display: flex; align-items: center; gap: 7px; margin: 10px 12px; padding: 8px 12px; border: 1px solid #e7dfd1; border-radius: 10px; background: #fff; color: #9da29f; }
.contact-search input { flex: 1; border: 0; outline: 0; background: transparent; color: #3b4948; font: inherit; }
.contact-special { margin-bottom: 10px; }
.contact-special button { min-height: 59px; }
.contact-special span { flex: 1; font-size: 16px; }
.contact-special em { color: #a9a398; font-size: 22px; font-style: normal; }
.contact-icon { flex: 0 0 39px; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 8px; color: #fff; font-style: normal; font-size: 20px; }
.contact-icon.orange { background: #f39a39; }.contact-icon.green { background: #46ae69; }.contact-icon.teal { background: #239f9f; color: #ffe69c; }
.alphabet-contacts { padding-right: 18px; }
.contact-letter { padding: 5px 14px; background: #ecebe6; color: #8f948f; font-size: 12px; }
.contact-index { position: fixed; z-index: 4; top: 145px; left: calc(50% + 210px); color: #526563; font-size: 9px; line-height: 1.12; text-align: center; pointer-events: none; }
@media (max-width: 500px) { .contact-index { left: auto; right: 3px; } }
.social-modal-card { width: min(430px, 100%); max-height: min(82vh, 720px); display: flex; flex-direction: column; overflow: hidden; }
.social-modal-body { min-height: 150px; overflow-y: auto; padding: 4px 0 8px; }
.social-empty { padding: 38px 18px; color: #929995; text-align: center; line-height: 1.7; }
.social-search-box { display: flex; gap: 8px; padding: 8px 0 14px; }
.social-search-tip { margin: -6px 2px 10px; color: #8a918e; font-size: 11px; }
.social-search-box input, .social-compose input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #ddd6c9; border-radius: 10px; font: inherit; }
.social-action-row { display: flex; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee7da; }
.social-action-row .social-row-copy { flex: 1; }
.social-action-row .btn { flex: 0 0 auto; padding: 8px 12px; }
.social-chat-log { min-height: 260px; max-height: 52vh; overflow-y: auto; padding: 10px 4px; background: #f3f1eb; border-radius: 12px; }
.social-bubble { max-width: 82%; margin: 7px 0; padding: 9px 11px; border-radius: 12px; background: #fff; color: #3a4746; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.social-bubble.mine { margin-left: auto; background: #cceecf; }
.social-bubble.invite { border: 1px solid #e3bd68; background: #fff9e5; }
.social-bubble small { display: block; margin-top: 5px; color: #8b918e; }
.social-compose { display: flex; gap: 8px; padding-top: 10px; }
.player-social-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }
.me-profile-code { flex: 0 0 auto; width: 34px; height: 34px; border: 0; border-radius: 9px; background: #edf5ef; color: #4e8270; font-size: 20px; cursor: pointer; }
.me-entry-row { width: 100%; display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 13px 0 0; border: 0; border-top: 1px solid rgba(139,109,68,.13); background: transparent; color: #435b56; font: inherit; text-align: left; cursor: pointer; }
.me-entry-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #fff0cd; color: #a77525; font-size: 19px; }
.me-entry-copy { flex: 1; }.me-entry-copy b { display: block; font-size: 14px; }.me-entry-copy small { display: block; margin-top: 2px; color: #89918d; font-size: 11.5px; }
.me-entry-arrow { color: #aaa394; font-size: 24px; }
.social-scan-modal { background: #071413; }
.scan-page { position: relative; width: min(460px, 100vw); height: 100vh; margin: 0 auto; overflow: hidden; background: radial-gradient(circle at 50% 35%, #35463f, #101917 55%, #050909); color: #fff; }
.scan-page header { position: absolute; z-index: 4; top: 0; left: 0; right: 0; min-height: 58px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: calc(8px + env(safe-area-inset-top,0px)) 16px 8px; background: linear-gradient(#16959e, #168d96); }
.scan-page header button { justify-self: start; border: 0; background: none; color: #fff; font-size: 34px; }.scan-page header label { justify-self: end; cursor: pointer; }
.scan-page video { width: 100%; height: 100%; object-fit: cover; opacity: .72; }
.scan-mask { position: absolute; z-index: 3; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.scan-frame { position: relative; width: min(68vw, 290px); aspect-ratio: 1; border: 1px solid rgba(255,255,255,.45); box-shadow: 0 0 0 999px rgba(0,0,0,.27); }
.scan-frame::before, .scan-frame::after, .scan-frame i::before, .scan-frame i::after { content: ''; position: absolute; width: 34px; height: 34px; border-color: #62d8ce; border-style: solid; }
.scan-frame::before { top:-3px;left:-3px;border-width:4px 0 0 4px}.scan-frame::after{top:-3px;right:-3px;border-width:4px 4px 0 0}.scan-frame i::before{bottom:-3px;left:-3px;border-width:0 0 4px 4px}.scan-frame i::after{bottom:-3px;right:-3px;border-width:0 4px 4px 0}
.scan-frame i { position: absolute; left: 5%; right: 5%; top: 50%; height: 2px; background: #65e3d5; box-shadow: 0 0 8px #65e3d5; animation: scanLine 2s ease-in-out infinite alternate; }
@keyframes scanLine { from { transform: translateY(-110px); } to { transform: translateY(110px); } }
.scan-mask p { margin-top: 20px; font-size: 15px; }
.scan-light, .scan-my-code { position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); border: 0; background: none; color: #fff; cursor: pointer; }.scan-light { bottom: 112px; display:flex;flex-direction:column;gap:5px;align-items:center;font-size:24px}.scan-light span{font-size:12px}.scan-my-code{bottom:56px;padding:10px 16px;border-top:1px solid rgba(255,255,255,.35);font-size:14px}
.profile-code-card { width: min(370px, 100%); text-align: center; background: #fffdf7; }
.profile-code-avatar { width: 70px; height: 70px; display: grid; place-items: center; overflow: hidden; margin: 0 auto 7px; border: 3px solid #d9bd7a; border-radius: 50%; background: #eaf1e8; font-size: 32px; }.profile-code-avatar img{width:100%;height:100%;object-fit:cover}
.profile-code-id { margin: 4px 0 12px; color: #827969; font-size: 12px; }.profile-code-card canvas{width:min(296px,78vw);height:auto;background:#fff;border:10px solid #fff;box-shadow:0 2px 10px rgba(48,42,31,.12)}.profile-code-card p{margin:10px 0;color:#756f64;font-size:12px}.profile-code-card>.btn{width:100%;margin-top:7px}

/* 最终覆盖：旧社交样式仍服务于兼容弹层，主页面统一使用冷灰白原生层级。 */
.social-screen, .social-subscreen { background: var(--wx-bg); color: var(--wx-ink); }
.social-page { position: relative; max-width: 560px; min-height: 100vh; margin: 0 auto; padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); background: var(--wx-bg); box-shadow: none; }
.social-head, .native-subhead { position: sticky; top: 0; z-index: 15; min-height: 58px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: calc(7px + env(safe-area-inset-top,0px)) 14px 7px; border-bottom: 1px solid var(--wx-line); background: rgba(237,237,237,.96); color: var(--wx-ink); box-shadow: none; backdrop-filter: blur(16px); }
.social-head h1, .native-subhead h1 { font-size: 17px; font-weight: 650; letter-spacing: 0; }
.social-head-actions { justify-self: end; display: flex; align-items: center; gap: 10px; }
.social-head-btn { justify-self: auto; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 0; background: transparent; color: var(--wx-ink); font-size: 25px; line-height: 1; }
.social-plus-menu { position: fixed; z-index: 90; top: 58px; right: 12px; width: 158px; overflow: hidden; border: 0; border-radius: 7px; background: #4c4c4c; box-shadow: 0 8px 25px rgba(0,0,0,.25); color: #fff; }
.social-plus-menu::before { background: #4c4c4c; }
.social-plus-menu button { min-height: 48px; border-color: rgba(255,255,255,.12); color: #fff; font-weight: 450; }
.social-plus-menu button span { color: #fff; }
.social-list { background: #fff; }
.social-list button, .social-row { min-height: 66px; padding: 8px 16px; border-bottom-color: var(--wx-line); background: transparent; color: var(--wx-ink); }
.social-list button:active, .social-row:active { background: #f2f2f2; }
.social-avatar { flex-basis: 48px; border-radius: 5px; background: #e6e6e6; }
.social-avatar.publication { border: 0; border-radius: 6px; background: #2887eb; color: #fff; }
.social-row-copy strong { color: var(--wx-ink); font-weight: 550; }
.social-row-copy small, .social-row-side { color: var(--wx-muted); }
.contact-special { margin-bottom: 8px; }
.contact-icon { border-radius: 5px; }
.contact-icon.teal { background: #2887eb; color: #fff; }
.contact-letter { padding: 4px 16px; background: var(--wx-bg); color: #666; }
.contact-count { padding: 17px 0 96px; background: var(--wx-bg); color: var(--wx-muted); font-size: 13px; text-align: center; }
.contact-index { color: #555; }
.social-modal-card { border-radius: 12px; background: #fff; }
.social-empty { padding: 30px 16px; }
.social-subscreen.active { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; }
.social-chat-log { flex: 1; min-height: 0; max-height: none; overflow-y: auto; padding: 14px 12px 20px; border-radius: 0; background: var(--wx-bg); }

/* 大厅保留底部四栏导航，舞台与房间工具为导航让位。 */
#screen-lobby.active .friend-lobby-stage { bottom: 139px; }
#screen-lobby.active .friend-lobby-tools { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
.honor-mini { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #f4c54d; color: #7b5722; font-size: 21px; }
.native-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 12px; overflow: hidden; border-radius: 8px; background: var(--wx-line); }
.native-stats-grid div { min-height: 105px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; background: #fff; }
.native-stats-grid b { color: var(--wx-ink); font-size: 25px; }.native-stats-grid span { color: var(--wx-muted); font-size: 12px; }

/* 社交与个人中心 V2：生成式统一图标母版（3×3 sprite） */
.app-art-icon {
  display: inline-block;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  background-image: url('../img/social-ui/social-icons-v1.webp');
  background-repeat: no-repeat;
  background-size: 300% 300%;
  font-size: 0 !important;
  font-style: normal;
}
.icon-new-friend { background-position: 0 0; }
.icon-group { background-position: 50% 0; }
.icon-publication { background-position: 100% 0; }
.icon-record { background-position: 0 50%; }
.icon-stats { background-position: 50% 50%; }
.icon-honor { background-position: 100% 50%; }
.icon-settings { background-position: 0 100%; }
.icon-voice { background-position: 50% 100%; }
.icon-sticker { background-position: 100% 100%; }
.contact-special .app-art-icon { width: 42px; height: 42px; flex-basis: 42px; }
.social-avatar.publication { background: #e8f0ec; }
.social-avatar.publication .app-art-icon { width: 48px; height: 48px; }
.native-row .app-art-icon { width: 42px; height: 42px; }
.native-row { grid-template-columns: 46px minmax(90px,1fr) auto 18px; min-height: 66px; }

/* 聊天工具：输入栏先抬起，工具/表情面板固定落在它的下方。 */
#screen-social-chat.panel-open .social-chat-compose { padding-bottom: 7px; }
.social-chat-extra,
.social-chat-emoji-panel {
  flex: 0 0 246px;
  height: 246px;
  overflow-y: auto;
  border-top: 1px solid var(--wx-line);
  background: #f7f7f7;
  padding-bottom: env(safe-area-inset-bottom,0px);
}
.social-chat-extra { grid-template-columns: repeat(4,1fr); align-content: start; gap: 12px; padding: 22px 16px calc(20px + env(safe-area-inset-bottom,0px)); }
.social-chat-extra i.app-art-icon { width: 58px; height: 58px; display: block; margin: 0 auto 7px; border-radius: 12px; }
.social-chat-compose .chat-tool-icon { display: grid; place-items: center; }
.social-chat-compose .chat-tool-icon .app-art-icon { width: 34px; height: 34px; }
.social-chat-compose .chat-tool-icon.on { border-radius: 50%; background: #e1e6e3; }
.social-voice-hold {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0;
  height: 40px !important;
  border: 1px solid #ddd !important;
  border-radius: 5px !important;
  background: #fff !important;
  color: #222 !important;
  font-size: 14px !important;
  font-weight: 600;
}
.social-voice-hold.recording { background: #dce6df !important; color: #087c42 !important; }
.social-sticker-tabs { height: 43px; display: flex; gap: 20px; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--wx-line); }
.social-sticker-tabs button { height: 43px; padding: 0 4px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #777; }
.social-sticker-tabs button.on { border-bottom-color: var(--wx-green); color: #078e48; font-weight: 700; }
.social-sticker-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; padding: 12px; }
.social-sticker-grid button { min-width: 0; aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 10px; background: #fff; }
.social-sticker-grid img { width: 70px; max-width: 88%; height: 70px; max-height: 88%; object-fit: contain; }
.social-sticker-grid.smiley { grid-template-columns: repeat(8,1fr); gap: 2px; padding: 10px; }
.social-sticker-grid button[data-emoji-char] { font-size: 24px; line-height: 1; background: #fff; }
.social-sticker-grid .social-emoji-add { color: #8a8a8a; font-size: 24px; }
.social-emoji-cell { position: relative; min-width: 0; aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 10px; background: #fff; }
.social-emoji-cell img { width: 70px; max-width: 88%; height: 70px; max-height: 88%; object-fit: contain; }
.social-emoji-cell .social-emoji-x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; line-height: 16px; text-align: center; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; cursor: pointer; }
.social-chat-emoji { font-size: 32px; line-height: 1; }
.social-chat-sticker { width: 88px; height: 88px; object-fit: contain; }
.social-voice-message { min-width: 92px; max-width: 210px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 11px 14px; border: 0; border-radius: 6px; background: #fff; color: #222; }
.native-chat-row.mine .social-voice-message { flex-direction: row-reverse; background: var(--wx-bubble); }
.social-voice-message span { color: #258557; letter-spacing: -3px; transform: rotate(180deg); }
.social-voice-message b { font-size: 13px; font-weight: 500; }
.native-chat-row [data-profile-id] { cursor: pointer; }

/* 所有二级内容是全屏页面，底部主导航由 showScreen 自动隐藏。 */
.social-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: calc(24px + env(safe-area-inset-bottom,0px)); background: var(--wx-bg); }
.social-panel-list { margin-top: 10px; padding: 0 16px; background: #fff; }
.social-panel-list .social-action-row { min-height: 68px; }
.honor-badge-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 16px; }
.honor-badge-card { min-height: 188px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 14px 8px; border: 1px solid #eadfca; border-radius: 14px; background: #fff; text-align: center; }
.honor-badge-card .app-art-icon { width: 72px; height: 72px; }
.honor-badge-card b { color: #423629; font-size: 15px; }.honor-badge-card span { color: #888; font-size: 11px; }.honor-badge-card em { color: #ab7a1d; font-size: 11px; font-style: normal; }
.honor-badge-card.locked { filter: grayscale(1); opacity: .48; }
.stats-page { padding: 2px 0 30px; }
.game-stat-list { margin: 12px; overflow: hidden; border-radius: 10px; background: #fff; }
.game-stat-list article { min-height: 78px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--wx-line); }
.game-stat-list article:last-child { border-bottom: 0; }.game-stat-list .app-art-icon { width: 50px; height: 50px; }.game-stat-list b,.game-stat-list span{display:block}.game-stat-list span{margin-top:5px;color:var(--wx-muted);font-size:12px}.game-stat-list .muted{opacity:.62}

/* 棋谱整页：带返回键，按玩法分类；收藏保留在每张棋谱卡内。 */
.hist-native-head { margin: -16px -16px 10px; width: calc(100% + 32px); }
.hist-tabs { display: flex; grid-template-columns: none; gap: 4px; overflow-x: auto; padding: 5px 4px 8px; scrollbar-width: none; }
.hist-tabs::-webkit-scrollbar { display:none; }
.hist-tabs .hist-tab { flex: 0 0 auto; min-width: 60px; padding: 8px 12px; }

@media (max-width: 360px) {
  .social-chat-compose { gap: 3px; padding-left: 5px; padding-right: 5px; }
  .social-chat-compose button { width: 33px; }
  .social-sticker-grid { grid-template-columns: repeat(4,1fr); gap: 5px; padding: 9px; }
  .honor-badge-grid { gap: 8px; padding: 10px; }
}
@media (max-width: 500px) {
  .contact-index { display: none; }
  .native-me-page { padding-top: calc(22px + env(safe-area-inset-top,0px)); }
}

/* 2026-09-02 信息架构修订：大厅、搜索、资料与聊天控制。 */
.friend-lobby-head {
  display: grid;
  grid-template-columns: minmax(104px, 1fr) auto minmax(104px, 1fr);
  align-items: start;
  gap: 8px;
}
.lobby-self-card { pointer-events: auto; display: flex; align-items: center; gap: 6px; min-width: 0; padding-top: 5px; }
.lobby-self-card > span { max-width: 92px; overflow: hidden; color: #333; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.lobby-self-card > button { min-height: 28px; padding: 0 8px; border: 1px solid rgba(216,75,67,.25); border-radius: 7px; background: rgba(255,255,255,.86); color: #c54d47; font: 500 11px var(--font-stack); }
.friend-lobby-room { min-width: 112px; }
.lobby-config-open { width: 100%; min-height: 31px; display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 0 7px; border: 1px solid var(--wx-line); border-radius: 7px; background: rgba(255,255,255,.86); color: #555; font: 500 10px var(--font-stack); }
.lobby-config-open b { color: #999; font-size: 17px; font-weight: 400; }
.lobby-head-actions { width: 100%; display: grid; grid-template-columns: 1fr; gap: 4px; }
.lobby-head-actions button { min-height: 31px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 2px 7px; border: 1px solid var(--wx-line); border-radius: 7px; background: rgba(255,255,255,.88); color: #555; font: 500 10px var(--font-stack); }
.lobby-head-actions button.danger { color: #c54d47; }
.lobby-head-actions picture, .lobby-head-actions img { width: 22px; height: 22px; object-fit: contain; }
.lobby-head-actions .app-art-icon { width: 22px; height: 22px; flex-basis: 22px; }
.friend-lobby-tools { display: none; }
#screen-lobby.active .friend-lobby-tools { display: none; }
#screen-lobby.active .friend-lobby-stage { bottom: calc(72px + env(safe-area-inset-bottom,0px)); }
.friend-lobby-stage .lobby-status { display: none !important; }

.social-head-btn { width: 34px; height: 34px; }
.search-circle { position: relative; width: 26px; height: 26px; display: block; border: 1.8px solid currentColor; border-radius: 50%; box-sizing: border-box; }
.search-circle::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 1.8px; border-radius: 2px; background: currentColor; transform: rotate(-45deg); transform-origin: right center; }
.search-native-head { grid-template-columns: 42px 1fr 12px; gap: 4px; }
.search-native-head label { min-width: 0; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border-radius: 7px; background: #fff; }
.search-native-head .search-circle { width: 20px; height: 20px; color: #8a8a8a; }
.search-native-head input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font: 14px var(--font-stack); }
.social-search-results { flex: 1; min-height: 0; overflow-y: auto; background: var(--wx-bg); }
.search-result-section { margin-top: 9px; background: #fff; }
.search-result-section > h2 { padding: 10px 16px 5px; color: #888; font-size: 12px; font-weight: 500; }
.search-result-section button { width: 100%; min-height: 62px; display: flex; align-items: center; gap: 11px; padding: 8px 16px; border: 0; border-bottom: 1px solid var(--wx-line); background: #fff; color: #222; text-align: left; }
.search-result-copy { min-width: 0; flex: 1; }.search-result-copy b,.search-result-copy small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.search-result-copy small{margin-top:5px;color:#888;font-size:12px}.search-hit{color:#07a653}

.player-profile-row { width: 100%; min-height: 68px; margin: 9px 0 0; border-radius: 0; padding-left: 20px; padding-right: 16px; }
.player-profile-row::before { content: ''; width: 3px; align-self: stretch; border-radius: 3px; background: #07c160; opacity: .5; }
.player-profile-page > .player-social-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
.player-profile-page > .player-social-actions button.hidden { display: none; }
.player-profile-page > .player-social-actions button:only-child { grid-column: 1 / -1; }
.native-detail-section { margin: 14px 16px 6px; color: #888; font-size: 12px; }
.native-setting-switch { width: 44px; height: 25px; position: relative; flex: 0 0 44px; border-radius: 15px; background: #d6d6d6; }
.native-setting-switch::after { content:''; position:absolute; top:2px; left:2px; width:21px; height:21px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.18); transition:.16s; }
button.on .native-setting-switch { background: #07c160; } button.on .native-setting-switch::after { left:21px; }
/* 权限界面（我的展示设置）：好友/非好友 子档 + 个人主页棋谱空态 */
.priv-subs { margin-top: 4px; border-top: 1px solid var(--wx-line); }
.priv-subs button { min-height: 50px; padding-left: 30px; }
.priv-subs button span:first-child { font-size: 14px; }
.priv-subs button:disabled { opacity: .45; }
.peer-records-list { padding: 6px 12px 30px; }
.peer-records-list .rec-card { margin-bottom: 8px; }
.peer-records-empty { text-align: center; padding: 60px 20px; color: var(--wx-muted); }
.peer-records-empty b { display: block; color: var(--wx-ink); font-size: 15px; margin-bottom: 8px; }
.peer-records-empty small { font-size: 12.5px; }
.friend-setting-danger > span { color: #e64340 !important; text-align: center; }

.social-photo-message { max-width: min(64vw,280px); padding:0;border:0;border-radius:7px;overflow:hidden;background:transparent}.social-photo-message img{display:block;max-width:100%;max-height:320px;object-fit:cover}
.tab-contact-art .app-art-icon { width: 34px; height: 34px; }
.tab-btn .tab-ico picture { display:block; width:34px; height:34px; }.tab-btn .tab-ico picture img{width:100%;height:100%;object-fit:contain}

@media (max-width: 390px) {
  .friend-lobby-head { grid-template-columns: 104px minmax(82px,auto) 104px; padding-left: 8px; padding-right: 8px; }
  .lobby-self-card { flex-direction: column; gap: 2px; }
  .lobby-self-card > button { min-height: 24px; }
}

/* 2026-09-02 大厅上半区 V3：按确认稿统一两侧高度、纯图标语音行与透明退出图标。 */
.friend-lobby-head {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr);
  justify-content: stretch;
  gap: clamp(28px, 8vw, 36px);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 14px 0;
}
.friend-lobby-primary { height: 138px; gap: 10px; }
.lobby-start {
  width: 100%;
  min-width: 0;
  height: 64px;
  min-height: 64px;
  border-radius: 12px;
  font-size: 17px;
}
.lobby-mode-select {
  width: 100%;
  min-width: 0;
  height: 64px;
  min-height: 64px;
  justify-content: center;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 750;
}
.friend-lobby-room {
  width: 100%;
  height: 138px;
  min-width: 0;
  display: grid;
  grid-template-rows: 38px 40px 36px;
  gap: 6px;
  box-sizing: border-box;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 14px;
  background: rgba(255,255,255,.56);
  box-shadow: 0 5px 18px rgba(45,61,67,.07);
  backdrop-filter: blur(9px);
}
.lobby-voice {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr)) minmax(0,1.08fr);
  gap: 4px;
  padding: 0;
}
.lobby-voice .vbtn {
  width: 100%;
  height: 38px;
  justify-content: center;
  padding: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.72);
}
.lobby-voice .vbtn svg { width: 19px; height: 19px; }
.lobby-voice #lobby-chat-btn.lobby-message-icon { position: relative; grid-column: auto; margin-left: 3px; }
.lobby-voice .lobby-message-icon picture,
.lobby-voice .lobby-message-icon img { display: block; width: 23px; height: 23px; object-fit: contain; }
.lobby-voice .lobby-message-icon .msg-dot { top: 4px; right: 4px; }
.lobby-head-actions {
  width: 100%;
  display: block;
}
.lobby-head-actions button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.78);
  font-size: 12px;
}
.lobby-head-actions #btn-addbot,
.lobby-head-actions #btn-dissolve { grid-column: auto; }
.lobby-head-actions button > span:last-child { white-space: nowrap; }
.lobby-head-actions .app-art-icon { width: 21px; height: 21px; flex-basis: 21px; }
.lobby-config-open {
  width: 100%;
  min-height: 36px;
  justify-content: center;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.78);
  font-size: 12px;
}
#screen-lobby.active .friend-lobby-stage { top: 158px; }
.lobby-character-stage > .lobby-player-label.self {
  max-width: none;
  pointer-events: auto;
}
.lobby-character-stage > .lobby-player-label.self b { max-width: 54px; }
.lobby-inline-leave {
  width: 22px;
  min-width: 22px;
  height: 22px;
  margin-left: 3px;
  padding: 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #737a7d;
  box-shadow: none;
  text-shadow: none;
  pointer-events: auto;
}
.lobby-inline-leave svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.social-head-actions .search-circle { width: 20px; height: 20px; border-width: 1.7px; }
.social-head-actions .search-circle::after { right: 3px; bottom: 3px; width: 6px; height: 1.7px; }
@media (max-width: 390px) {
  .friend-lobby-head {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr);
    gap: 28px;
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* 大厅角色 V2：精细多角度毛绒角色，替换上一版基础几何体。 */
#lobby-3d-canvas.lobby-character-stage {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: auto;
  height: auto;
  display: block;
  overflow: hidden;
  touch-action: none;
  cursor: default;
}
#lobby-3d-canvas.lobby-character-stage::before {
  content: '';
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 57%;
  width: min(94%, 520px);
  height: 32%;
  transform: translate(-50%, -50%);
  border: clamp(7px, 2vw, 11px) solid #d6dce1;
  border-bottom-width: clamp(16px, 4.8vw, 25px);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 28%, #fff 0 49%, #f4f6f7 79%, #e7ebee 100%);
  box-shadow:
    inset 0 0 0 2px rgba(92, 222, 138, .72),
    inset 0 -13px 23px rgba(93, 108, 116, .11),
    0 19px 27px rgba(68, 83, 91, .2),
    0 4px 3px rgba(255, 255, 255, .9);
}
#lobby-3d-canvas.lobby-character-stage::after {
  content: '';
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 71.5%;
  width: min(83%, 455px);
  height: 7%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(87, 103, 112, .13);
  filter: blur(11px);
}
.lobby-character {
  position: absolute;
  z-index: var(--order);
  left: var(--x);
  top: var(--y);
  width: 132px;
  height: 202px;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--wx-ink);
  font: inherit;
  transform: translate(-50%, -100%);
  transform-origin: 50% 100%;
  cursor: grab;
  touch-action: none;
  animation: mascot-breathe 3.1s ease-in-out var(--delay) infinite;
}
.lobby-character:active { cursor: grabbing; }
.lobby-character::before {
  content: '';
  position: absolute;
  z-index: 0;
  left: 50%;
  top: calc(100% - 6px);
  width: calc(66% * var(--scale));
  height: 8%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(49, 57, 61, .2);
  filter: blur(5px);
  pointer-events: none;
}
.lobby-character-art {
  position: absolute;
  z-index: 1;
  left: 0;
  bottom: 0;
  width: 132px;
  height: 202px;
  display: block;
  background-repeat: no-repeat;
  background-size: 400% 100%;
  background-position: 0 50%;
  filter: drop-shadow(0 7px 7px rgba(47, 57, 62, .19));
  transform: scale(var(--scale)) scaleX(var(--flip));
  transform-origin: 50% 100%;
  transition: background-position .08s steps(1), transform .14s ease;
}
.lobby-character.cat .lobby-character-art { background-image: url('../img/lobby/cat-turnaround-v1.webp'); }
.lobby-character.dog .lobby-character-art { background-image: url('../img/lobby/dog-turnaround-v1.webp'); }
.lobby-character:hover .lobby-character-art { transform: translateY(-2px) scale(var(--scale)) scaleX(var(--flip)); }
@keyframes mascot-breathe {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -3px; }
}
@media (prefers-reduced-motion: reduce) { .lobby-character { animation: none; } }
@media (max-width: 390px) {
  .lobby-character { width: 118px; height: 184px; }
  .lobby-character-art { width: 118px; height: 184px; }
}


/* 2026-09 棋谱分享弹窗：终局棋盘预览（分享图 = 对局最后一幕） */
.share-board-wrap { margin: 8px auto 2px; width: min(232px, 60vw); }
.share-board-img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid rgba(200, 150, 60, .35); box-shadow: 0 2px 10px rgba(120, 90, 30, .12); }
.share-board-caption { display: block; margin-top: 5px; color: #a08d62; font-size: 11px; line-height: 1.4; text-align: center; }

