/* ==========================================================================
   app.css — 群组游戏中心 MiniApp 手绘样式
   设计基调：深夜棋室。墨绿黑呢绒台面、黄铜描边、暖纸白字、木质棋盘。
   反 AI 味约定：
   - 禁止紫蓝渐变；主色只用墨绿/炭黑/黄铜/暖白，棋子棋盘用 CSS 几何绘制；
   - 卡片不用模板化白卡堆叠，用发丝线 + 暗纹区分层级；
   - 动效克制：落子弹跳、胜利连线、思考呼吸点，其余一律 ≤160ms 微过渡；
   - 固定深色棋室色板，不跟随 TG 浅色主题（老板实测：浅底上深面板混搭、
     浅灰小字与深色正文都看不清；任何主题下统一呢绒黄铜，对比稳定）。
   ========================================================================== */

/* ---------- 0. 设计令牌 ---------- */
:root {
  --felt: #131814;            /* 呢绒底，近黑的墨绿 */
  --felt-2: #1a211c;          /* 抬升一层的台面 */
  --panel: #202924;           /* 面板 */
  --panel-2: #27312b;         /* 面板提亮 */
  --line: rgba(210, 178, 106, 0.16);   /* 黄铜发丝线 */
  --line-strong: rgba(210, 178, 106, 0.38);
  --brass: #d2a356;           /* 黄铜主色 */
  --brass-deep: #8f6f38;
  --brass-ink: #241a08;       /* 黄铜上的深色字 */
  --ink: #ece6d6;             /* 暖纸白 */
  --ink-dim: #b6beaf;         /* 次级文字（实测提亮：浅灰看不清） */
  --ink-faint: #8e9689;       /* 再次级（实测提亮：时间/来源群一眼看清） */
  --danger: #c8553d;
  --ok: #7fae7a;
  --wood: #d9a860;            /* 棋盘木色 */
  --wood-deep: #b9853f;
  --stone-black: #1c1c1e;
  --stone-white: #f2eee2;
  --paper: #ece2c8;           /* 暖纸米白：游戏卡片文字条底（深色看不清的反馈修正） */
  --paper-ink: #2c2314;       /* 暖纸上的深色字 */
  --paper-dim: #71634b;       /* 暖纸上的次级字 */
  --tabbar-h: 56px;           /* 底部导航高度（单手可达） */
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

/* ---------- 1. 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--felt);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* 呢绒细点暗纹：两层极淡的径向点阵，肉眼几乎不可辨但去掉了"平涂塑料感" */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.022) 1px, transparent 1.6px),
    radial-gradient(circle at 3px 3px, rgba(0, 0, 0, 0.05) 1px, transparent 1.8px);
  background-size: 7px 7px, 11px 11px;
  z-index: 0;
}

#app { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; min-height: 100%; }

button { font-family: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
input, select { font-family: inherit; }
img { display: block; }

/* ---------- 2. 加载屏 ---------- */
.boot-splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--ink-dim);
  letter-spacing: 0.2em;
  font-size: 13px;
}
.boot-board {
  width: 72px; height: 72px; border-radius: 8px; position: relative;
  background:
    repeating-linear-gradient(0deg, rgba(60, 38, 16, 0.5) 0 1px, transparent 1px 17px),
    repeating-linear-gradient(90deg, rgba(60, 38, 16, 0.5) 0 1px, transparent 1px 17px),
    linear-gradient(150deg, #e0b273, #c8934e);
  box-shadow: var(--shadow);
}
.boot-stone {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  animation: bootPulse 1.4s ease-in-out infinite;
}
.boot-stone.b { left: 9px; top: 26px; background: radial-gradient(circle at 35% 30%, #5a5a5e, #101012 70%); }
.boot-stone.w { right: 9px; bottom: 9px; background: radial-gradient(circle at 35% 30%, #ffffff, #cfc9b8 75%); animation-delay: 0.5s; }
@keyframes bootPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.82); opacity: 0.75; } }

/* ---------- 3. 通用元件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 10px;
  font-size: 14px; letter-spacing: 0.06em;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}
.btn:active { transform: scale(0.96); filter: brightness(1.12); }
.btn.primary {
  background: linear-gradient(160deg, var(--brass), var(--brass-deep));
  color: var(--brass-ink);
  border-color: rgba(255, 226, 160, 0.35);
  font-weight: 600;
}
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-dim); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.22);
}

/* 轻提示 */
.toast-wrap {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 90; pointer-events: none; width: max-content; max-width: 86vw;
}
.toast {
  padding: 9px 16px; border-radius: 10px; font-size: 13px;
  background: rgba(12, 15, 13, 0.92); border: 1px solid var(--line);
  color: var(--ink); box-shadow: var(--shadow);
  animation: toastIn 0.18s ease both;
}
.toast.error { border-color: rgba(200, 85, 61, 0.55); color: #f0b9ab; }
.toast.ok { border-color: rgba(127, 174, 122, 0.5); color: #c3e0bf; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 页面骨架 */
.page { min-height: 100vh; padding: 0 14px calc(20px + env(safe-area-inset-bottom)); }
/* 带底部导航的三页：内容底部让开导航 */
.page.with-tabs { padding-bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom)); }
.conn-bar {
  margin: 8px 14px 0; padding: 7px 12px; border-radius: 9px; font-size: 12px;
  border: 1px solid var(--line); color: var(--ink-dim); background: rgba(0,0,0,0.25);
  display: flex; align-items: center; gap: 8px;
}
.conn-bar b { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.conn-bar.online b { background: var(--ok); }
.conn-bar.offline b { background: var(--danger); animation: bootPulse 1.2s infinite; }

.sec-title {
  display: flex; align-items: baseline; gap: 10px;
  margin: 26px 2px 12px;
  font-family: var(--serif);
  font-size: 17px; font-weight: 600; letter-spacing: 0.1em; color: var(--ink);
}
.sec-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }

/* ---------- 4. 大厅：A3 广告位 ---------- */
.ad-banner {
  margin-top: 12px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(210, 163, 86, 0.09), transparent 55%),
    var(--felt-2);
  text-align: left; width: 100%;
}
.ad-banner .ad-tag {
  flex: none; font-size: 10px; letter-spacing: 0.2em; color: var(--brass);
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 2px 5px;
}
.ad-banner .ad-body { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-banner .ad-body b { color: var(--ink); font-weight: 500; }
.ad-banner .ad-arrow { flex: none; color: var(--brass); font-size: 15px; }

/* ---------- 5. 大厅：顶部用户信息条（简化，点击进个人中心） ---------- */
.me-bar {
  margin-top: 12px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background:
    linear-gradient(140deg, rgba(210, 163, 86, 0.10), transparent 42%),
    var(--panel);
  border: 1px solid var(--line);
}
.me-bar-name {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-bar-bal {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: 15px; font-weight: 700; color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.me-bar-go { width: 15px; height: 15px; color: var(--ink-faint); flex: none; }

/* 头像：三页共用，sm/lg 两个尺寸变体 */
.me-avatar {
  width: 54px; height: 54px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 22px; color: var(--brass);
  background: radial-gradient(circle at 32% 28%, #313c35, #141a16 78%);
  border: 1px solid var(--line-strong);
  overflow: hidden;
}
.me-avatar.sm { width: 36px; height: 36px; font-size: 15px; }
.me-avatar.lg { width: 64px; height: 64px; font-size: 26px; }
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }

.coin-ico {
  width: 17px; height: 17px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 34% 30%, #f4d98d, #c99b45 62%, #8f6f38);
  border: 1px solid rgba(255, 230, 170, 0.5);
  position: relative;
}
.coin-ico::after { content: ""; position: absolute; inset: 3.5px; border-radius: 50%; border: 1px solid rgba(90, 62, 20, 0.55); }
.me-badge {
  display: inline-block;
  font-size: 10px; letter-spacing: 0.18em; padding: 2.5px 8px; border-radius: 5px;
}
.me-badge.vip { color: var(--brass); border: 1px solid var(--line-strong); background: rgba(210, 163, 86, 0.10); }
.me-badge.free { color: var(--ink-faint); border: 1px solid rgba(255, 255, 255, 0.08); }

/* ---------- 6. 创建页：游戏卡片（文字条浅色暖底 + 深色字，修正深色看不清） ---------- */
.game-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.game-tile {
  text-align: left;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform 0.14s ease, border-color 0.14s ease;
  display: flex; flex-direction: column;
}
.game-tile:active { transform: scale(0.97); border-color: var(--line-strong); }
.game-tile .cover {
  height: 92px; position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 42%, #1c2620 0%, #121815 70%, #0c100e 100%); /* 未知玩法/无图时的呢绒兜底 */
}
.game-tile .cover .cv { position: absolute; display: block; }
/* 真实摄影封面（P2）：铺满卡片，盖住底层 CSS 几何；@error 隐藏后几何封面兜底可见 */
.game-tile .cover .cover-img {
  position: absolute; inset: 0; z-index: 2; display: block;
  width: 100%; height: 100%; object-fit: cover;
}
.game-tile .gname { font-family: var(--serif); font-size: 16px; letter-spacing: 0.1em; padding: 10px 12px 0; color: var(--paper-ink); }
.game-tile .gtag { font-size: 11px; color: var(--paper-dim); padding: 2px 12px 0; }
.game-tile .gmeta {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px 12px; font-size: 11px; color: var(--paper-dim);
  font-variant-numeric: tabular-nums;
}
.game-tile .gmeta .dot { width: 6px; height: 6px; border-radius: 50%; background: #5d8a52; flex: none; }
.game-tile.soon { opacity: 0.62; }
.game-tile.soon .gmeta .dot { background: var(--paper-dim); }

/* --- 封面：真实摄影图为主（.cover-img，assets/covers/<id>.jpg），纯 CSS 几何降为兜底层
       （img 加载失败 @error 隐藏后可见）；::before 统一收边（顶部微光 + 底部暗角）压在最上 --- */
.game-tile .cover::before {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    radial-gradient(ellipse 120% 90% at 50% -30%, rgba(255, 244, 214, 0.10), transparent 55%),
    radial-gradient(ellipse 140% 110% at 50% 130%, rgba(0, 0, 0, 0.42), transparent 60%);
}
.game-tile .cover .cv { z-index: 1; }

/* 五子棋：墨绿绒底 + 荧光经纬 + 双子辉光 */
.cover-gomoku {
  background:
    repeating-linear-gradient(0deg, rgba(126, 240, 195, 0.15) 0 1px, transparent 1px 15px),
    repeating-linear-gradient(90deg, rgba(126, 240, 195, 0.15) 0 1px, transparent 1px 15px),
    radial-gradient(ellipse at 50% 46%, #17281f 0%, #0d1712 70%, #080f0b 100%);
}
.cover-gomoku .cv { border-radius: 50%; }
.cover-gomoku .cv.a {  /* 黑子：墨玉 + 冷辉 */
  width: 30px; height: 30px; left: 27%; top: 44%;
  background: radial-gradient(circle at 34% 28%, #4c5450, #141816 62%, #050706);
  box-shadow: 0 0 14px rgba(126, 240, 195, 0.35), 0 3px 6px rgba(0, 0, 0, 0.6);
}
.cover-gomoku .cv.b {  /* 白子：暖瓷 + 金辉 */
  width: 30px; height: 30px; right: 26%; top: 22%;
  background: radial-gradient(circle at 34% 28%, #fffdf4, #d9d2bd 70%, #b3aa92);
  box-shadow: 0 0 16px rgba(240, 214, 150, 0.5), 0 3px 6px rgba(0, 0, 0, 0.5);
}
.cover-gomoku .cv.c {  /* 星位：小铜点 + 光晕 */
  width: 7px; height: 7px; left: 47%; top: 58%;
  background: #d2a356;
  box-shadow: 0 0 9px rgba(210, 163, 86, 0.9);
}

/* 象棋：绛红木纹底 + 立体棋子（帅/将）+ 河界光带 */
.cover-xiangqi {
  background: radial-gradient(ellipse at 50% 40%, #3d1712 0%, #250d0a 68%, #180806 100%);
}
.cover-xiangqi .cv {
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 232, 180, 0.28), transparent 52%),
    radial-gradient(circle at 50% 50%, #caa15e 0%, #a67c3e 58%, #7a5526 100%);
  border: 2px solid rgba(255, 226, 160, 0.5);
  box-shadow:
    0 0 16px rgba(224, 120, 80, 0.30),
    0 4px 8px rgba(0, 0, 0, 0.55),
    inset 0 -3px 6px rgba(60, 34, 8, 0.55);
}
.cover-xiangqi .cv::after {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; color: #571c12;
  text-shadow: 0 1px 0 rgba(255, 226, 170, 0.45);
}
.cover-xiangqi .cv.a { width: 46px; height: 46px; left: 18%; top: 24%; }
.cover-xiangqi .cv.a::after { content: "帅"; font-size: 24px; }
.cover-xiangqi .cv.b { width: 38px; height: 38px; right: 17%; bottom: 16%; opacity: 0.92; }
.cover-xiangqi .cv.b::after { content: "将"; font-size: 20px; color: #2c2118; }
.cover-xiangqi .cv.c {  /* 河界光带 */
  width: 56%; height: 2px; left: 22%; top: 55%;
  border-radius: 2px; border: 0;
  background: linear-gradient(90deg, transparent, rgba(224, 120, 80, 0.75), transparent);
  box-shadow: 0 0 10px rgba(224, 120, 80, 0.5);
}

/* 斗地主：深绿绒底 + 暖光晕 + 扇形牌组（霓虹描边） */
.cover-doudizhu {
  background:
    radial-gradient(ellipse at 50% 68%, rgba(240, 214, 150, 0.12), transparent 55%),
    radial-gradient(ellipse at 50% 42%, #1c4433 0%, #10291f 70%, #0a1c15 100%);
}
.cover-doudizhu .cv {
  width: 32px; height: 45px; border-radius: 4px;
  background: linear-gradient(168deg, #fbf6e8, #e2d9c0);
  border: 1px solid rgba(140, 110, 60, 0.4);
  box-shadow: 0 0 12px rgba(126, 240, 195, 0.18), 0 4px 8px rgba(0, 0, 0, 0.5);
}
.cover-doudizhu .cv::after {
  content: ""; position: absolute; left: 5px; top: 5px; width: 8px; height: 8px;
  transform: rotate(45deg); border-radius: 1px;
}
.cover-doudizhu .cv.a { left: 28%; top: 30%; transform: rotate(-16deg); }
.cover-doudizhu .cv.a::after { background: #22262c; }
.cover-doudizhu .cv.b {
  left: 46%; top: 22%;
  box-shadow: 0 0 16px rgba(240, 214, 150, 0.4), 0 4px 8px rgba(0, 0, 0, 0.5);
}
.cover-doudizhu .cv.b::after { background: #b23a2c; }
.cover-doudizhu .cv.c { left: 63%; top: 30%; transform: rotate(16deg); }
.cover-doudizhu .cv.c::after { background: #22262c; }

/* 炸金花：炭底金晕 + 金筹码堆（前后叠落）+ 红筹点缀 */
.cover-zhajinhua {
  background:
    radial-gradient(ellipse at 50% 60%, rgba(240, 200, 110, 0.14), transparent 58%),
    radial-gradient(ellipse at 50% 40%, #241f14 0%, #15120c 70%, #0c0a07 100%);
}
.cover-zhajinhua .cv { border-radius: 50%; }
.cover-zhajinhua .cv::before {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  border: 2px dashed rgba(255, 240, 200, 0.65);
}
.cover-zhajinhua .cv.a {  /* 主金筹（压在最上） */
  width: 42px; height: 42px; left: 30%; top: 26%; z-index: 2;
  background: radial-gradient(circle at 34% 28%, #f2d488, #c99b45 58%, #7d5f2d);
  box-shadow: 0 0 18px rgba(240, 200, 110, 0.55), 0 5px 9px rgba(0, 0, 0, 0.55);
}
.cover-zhajinhua .cv.b {  /* 堆在后的一枚 */
  width: 42px; height: 42px; left: 44%; top: 34%;
  background: radial-gradient(circle at 34% 28%, #d8b264, #a37c33 60%, #6b4e20);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
}
.cover-zhajinhua .cv.c {  /* 红筹点缀 */
  width: 26px; height: 26px; right: 20%; top: 28%;
  background: radial-gradient(circle at 34% 28%, #e0745c, #b0473a 60%, #73291f);
  box-shadow: 0 0 12px rgba(224, 116, 92, 0.5), 0 4px 7px rgba(0, 0, 0, 0.5);
}
.cover-zhajinhua .cv.c::before { inset: 3px; border-width: 1.5px; }

/* 德州扑克：深青绒底 + 椭圆桌剪影 + 双色筹码 */
.cover-texas {
  background: radial-gradient(ellipse at 50% 42%, #173c33 0%, #0e241e 68%, #081612 100%);
}
.cover-texas .cv.a {  /* 椭圆桌剪影：呢面 + 铜边 + 木沿 */
  width: 96px; height: 56px; left: 50%; top: 52%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #2f7a5c 0%, #1d5c44 62%, #124233 100%);
  border: 3px solid rgba(210, 163, 86, 0.55);
  box-shadow:
    0 0 20px rgba(64, 200, 150, 0.28),
    inset 0 0 0 3px rgba(74, 48, 19, 0.9),
    inset 0 6px 14px rgba(0, 0, 0, 0.45),
    0 6px 12px rgba(0, 0, 0, 0.5);
}
.cover-texas .cv.b, .cover-texas .cv.c { border-radius: 50%; }
.cover-texas .cv.b::before, .cover-texas .cv.c::before {
  content: ""; position: absolute; inset: 3px; border-radius: 50%;
  border: 1.5px dashed rgba(255, 240, 200, 0.6);
}
.cover-texas .cv.b {  /* 黄铜筹 */
  width: 24px; height: 24px; left: 22%; top: 24%;
  background: radial-gradient(circle at 34% 28%, #f2d488, #c99b45 60%, #7d5f2d);
  box-shadow: 0 0 12px rgba(240, 200, 110, 0.55), 0 3px 6px rgba(0, 0, 0, 0.5);
}
.cover-texas .cv.c {  /* 绛红筹 */
  width: 24px; height: 24px; right: 22%; bottom: 18%;
  background: radial-gradient(circle at 34% 28%, #e0745c, #b0473a 60%, #73291f);
  box-shadow: 0 0 12px rgba(224, 116, 92, 0.5), 0 3px 6px rgba(0, 0, 0, 0.5);
}

/* ---------- 7. 大厅：底部弹层（房间面板） ---------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5, 7, 6, 0.62);
  animation: fadeIn 0.16s ease both;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  max-width: 520px; margin: 0 auto;
  background: var(--felt-2);
  border-top: 1px solid var(--line-strong);
  border-radius: 16px 16px 0 0;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  animation: sheetUp 0.2s cubic-bezier(0.2, 0.9, 0.3, 1) both;
  max-height: 82vh; overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(36px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet-head .t { font-family: var(--serif); font-size: 18px; letter-spacing: 0.12em; flex: 1; }
.sheet-head .x { color: var(--ink-faint); font-size: 20px; padding: 4px 8px; }
.sheet-label { font-size: 12px; color: var(--ink-faint); margin: 14px 2px 8px; letter-spacing: 0.1em; }

.room-empty { padding: 18px; text-align: center; color: var(--ink-faint); font-size: 13px; border: 1px dashed var(--line); border-radius: 10px; }

/* 人数滑块（创建页设置面板） */
.seat-slider input[type="range"] {
  width: 100%; height: 26px; background: transparent;
  -webkit-appearance: none; appearance: none; outline: none;
}
.seat-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brass), var(--panel-2));
}
.seat-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%; margin-top: -8px;
  background: radial-gradient(circle at 34% 30%, #f4d98d, #c99b45 62%, #8f6f38);
  border: 1px solid rgba(255, 230, 170, 0.5);
}
.seat-slider input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brass), var(--panel-2));
}
.seat-slider input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #f4d98d, #c99b45 62%, #8f6f38);
  border: 1px solid rgba(255, 230, 170, 0.5);
}
.seat-slider-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); }
.seat-slider-row b { color: var(--brass); font-size: 13px; font-variant-numeric: tabular-nums; }

.mode-hint { margin: 8px 2px 0; font-size: 12px; color: var(--ink-faint); }
.create-tip { margin: 16px 2px 0; text-align: center; font-size: 12px; color: var(--ink-faint); letter-spacing: 0.08em; }

.seg-row { display: flex; gap: 8px; flex-wrap: wrap; }
.seg {
  padding: 8px 16px; border-radius: 9px; font-size: 13px;
  border: 1px solid var(--line); color: var(--ink-dim); background: var(--panel);
}
.seg.on { color: var(--brass); border-color: var(--line-strong); background: rgba(210, 163, 86, 0.10); }

.fund-row { display: flex; align-items: center; gap: 10px; }
.fund-row input {
  flex: 1; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; color: var(--ink); font-size: 15px; outline: none;
  font-variant-numeric: tabular-nums;
}
.fund-row input:focus { border-color: var(--line-strong); }
.fund-row input::placeholder { color: var(--ink-faint); }
.fund-row .unit { color: var(--ink-faint); font-size: 13px; flex: none; }

.switch { position: relative; width: 44px; height: 25px; flex: none; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  transition: background 0.15s ease;
}
.switch i::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 19px; height: 19px; border-radius: 50%;
  background: #cfc9b8; transition: transform 0.15s ease, background 0.15s ease;
}
.switch.on i { background: rgba(210, 163, 86, 0.35); border-color: var(--line-strong); }
.switch.on i::after { transform: translateX(19px); background: var(--brass); }

.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }

/* ---------- 8. 大厅：对局记录 ---------- */
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 13px;
}
.hist-row .hg { font-family: var(--serif); letter-spacing: 0.08em; }
.hist-row .ht { flex: 1; color: var(--ink-faint); font-size: 12px; }
.hist-row .hr { font-size: 12px; padding: 2px 8px; border-radius: 6px; letter-spacing: 0.1em; }
.hist-row .hr.win { color: var(--ok); border: 1px solid rgba(127, 174, 122, 0.4); }
.hist-row .hr.lose { color: var(--danger); border: 1px solid rgba(200, 85, 61, 0.4); }
.hist-row .hr.draw { color: var(--ink-dim); border: 1px solid var(--line); }
.hist-row .hp { font-variant-numeric: tabular-nums; color: var(--ink-dim); font-size: 12px; }
.hist-empty { padding: 22px; text-align: center; color: var(--ink-faint); font-size: 13px; border: 1px dashed var(--line); border-radius: 10px; }

.lobby-foot { margin: 30px 0 6px; text-align: center; font-size: 11px; color: var(--ink-faint); letter-spacing: 0.2em; }

/* ---------- 8a. 底部导航（三页共用，房间对局页隐藏防误触） ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: 520px; margin: 0 auto;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--felt-2);
  border-top: 1px solid var(--line-strong);
}
.tab-btn {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-faint); font-size: 11px; letter-spacing: 0.08em;
  transition: color 0.15s ease, transform 0.12s ease;
}
.tab-btn svg { width: 21px; height: 21px; }
.tab-btn.on { color: var(--brass); font-weight: 600; }
.tab-btn.on::before {
  content: ""; position: absolute; top: 0;
  width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--brass-deep), var(--brass), var(--brass-deep));
}
.tab-btn:active { transform: scale(0.94); }

/* ---------- 8b. 大厅：房间挑战列表 ---------- */
.refresh-btn {
  width: 26px; height: 26px; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint);
}
.refresh-btn svg { width: 16px; height: 16px; }
.refresh-btn.spin svg { animation: refreshSpin 0.6s ease; }
@keyframes refreshSpin { to { transform: rotate(360deg); } }

.room-cards { display: flex; flex-direction: column; gap: 8px; }
.room-card {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
}
.rc-main { flex: 1; min-width: 0; }
.rc-game {
  font-family: var(--serif); font-size: 15px; letter-spacing: 0.08em;
  display: flex; align-items: baseline; gap: 8px;
  overflow: hidden; white-space: nowrap;
}
.rc-id { font-size: 11px; color: var(--brass); letter-spacing: 0.12em; flex: none; }
.rc-meta {
  margin-top: 3px; font-size: 12px; color: var(--ink-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rc-status {
  flex: none; font-size: 11px; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--ink-dim);
}
.rc-status.playing { color: var(--brass); border-color: var(--line-strong); }
.rc-act { flex: none; display: flex; gap: 8px; }
.rc-act .mini {
  font-size: 12px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); color: var(--brass);
  transition: transform 0.12s ease;
}
.rc-act .mini:active { transform: scale(0.94); }
.rc-act .mini.plain { color: var(--ink-dim); border-color: var(--line); }
.rc-act .mini.poor { color: var(--ink-faint); border-color: var(--line); }
.rc-act .mini[disabled] { opacity: 0.6; pointer-events: none; }

/* ---------- 8c. 大厅：群组赛事（观望信息卡） ---------- */
.ev-list { display: flex; flex-direction: column; gap: 8px; }
.ev-card {
  padding: 11px 13px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  transition: border-color 0.15s ease;
}
.ev-card.open { border-color: var(--line-strong); }
.ev-head { display: flex; align-items: center; gap: 10px; }
.ev-name {
  flex: 1; min-width: 0;
  font-family: var(--serif); letter-spacing: 0.06em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-status { flex: none; font-size: 11px; padding: 2px 8px; border-radius: 6px; }
.ev-status.signup { color: var(--ok); border: 1px solid rgba(127, 174, 122, 0.4); }
.ev-status.running { color: var(--brass); border: 1px solid var(--line-strong); }
.ev-status.over { color: var(--ink-faint); border: 1px solid var(--line); }
.ev-meta { margin-top: 4px; font-size: 12px; color: var(--ink-dim); }
.ev-detail {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--ink-dim); line-height: 1.9;
}
.ev-watch { color: var(--ink-faint); letter-spacing: 0.06em; }
.ev-empty { padding: 18px; text-align: center; color: var(--ink-faint); font-size: 13px; border: 1px dashed var(--line); border-radius: 10px; }

/* ---------- 9. 房间页通用壳 ---------- */
.room-top {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0 10px;
}
.room-top .back {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  border: 1px solid var(--line); color: var(--ink-dim);
  display: flex; align-items: center; justify-content: center;
}
.room-top .back svg { width: 16px; height: 16px; }
.room-code {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--serif); font-size: 17px; letter-spacing: 0.14em; color: var(--brass);
}
.room-code .cp { font-size: 10px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; letter-spacing: 0.1em; }
.room-top .spacer { flex: 1; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  border: 1px solid var(--line); color: var(--ink-dim);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.off { opacity: 0.45; }

/* 席位条 */
.seat-row { display: flex; gap: 10px; margin: 4px 0 12px; }
.seat {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.seat.turn { border-color: var(--line-strong); box-shadow: 0 0 0 1px var(--line-strong), 0 4px 14px rgba(210, 163, 86, 0.12); }
.seat.me { background: linear-gradient(150deg, rgba(210, 163, 86, 0.10), var(--panel)); }
.seat-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--brass);
  background: radial-gradient(circle at 32% 28%, #313c35, #141a16 78%);
  border: 1px solid var(--line);
  overflow: hidden;
}
.seat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.seat-info { flex: 1; min-width: 0; }
.seat-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-st { font-size: 11px; color: var(--ink-faint); }
.seat-st.ready { color: var(--ok); }
.seat.empty { justify-content: center; color: var(--ink-faint); font-size: 12px; border-style: dashed; letter-spacing: 0.15em; }
/* 席位上的棋色小棋子（游戏通过 .seat-stone.b/.w 使用） */
.seat-stone { width: 15px; height: 15px; border-radius: 50%; flex: none; box-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.seat-stone.b { background: radial-gradient(circle at 35% 30%, #5a5a5e, #101012 72%); }
.seat-stone.w { background: radial-gradient(circle at 35% 30%, #ffffff, #cfc9b8 78%); }

/* 游戏挂载区 */
.game-stage {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--felt-2);
  min-height: 320px;
  overflow: hidden;
  position: relative;
}
/* 房间对局页：纵向撑满可视高度（扣除顶部栏/底部操作区后舞台吃尽剩余空间），
   小屏内容超高时整页自然滚动，不横向溢出 */
.room-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.room-page .game-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.game-mount {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.game-mount > * { flex: 1 1 auto; min-height: 0; }
.game-missing { padding: 40px 20px; text-align: center; color: var(--ink-faint); font-size: 13px; line-height: 2; }

/* 悬浮聊天：右下角圆形按钮 + 紧凑弹出面板（玩家/观战者均可用） */
.chat-fab {
  position: fixed; z-index: 57;
  right: max(14px, calc(50% - 246px));
  bottom: calc(76px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(160deg, var(--brass), var(--brass-deep));
  color: var(--brass-ink);
  border: 1px solid rgba(255, 226, 160, 0.35);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease;
}
.chat-fab:active { transform: scale(0.92); }
.chat-fab svg { width: 24px; height: 24px; }
.chat-fab.open { filter: brightness(1.1); }
.chat-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fdf3ee;
  font-size: 11px; line-height: 19px; text-align: center;
  border: 2px solid var(--felt);
  font-variant-numeric: tabular-nums;
}
.chat-panel {
  position: fixed; z-index: 56;
  right: max(12px, calc(50% - 248px));
  bottom: calc(140px + env(safe-area-inset-bottom));
  width: min(400px, calc(100vw - 24px));
  height: 40vh; min-height: 240px;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: sheetUp 0.18s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.chat-head {
  padding: 9px 13px; font-size: 11px; letter-spacing: 0.2em; color: var(--ink-dim);
  border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center;
}
.chat-head .spec-n { letter-spacing: 0.08em; }
.chat-fold {
  margin-left: auto; font-size: 11px; letter-spacing: 0.1em;
  color: var(--ink-dim); border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px;
}
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 13px; display: flex; flex-direction: column; gap: 7px; }
/* 消息气泡：文字固定暖纸白 + 底色描边，浅色/深色 TG 主题下都清晰 */
.chat-line {
  font-size: 14px; line-height: 1.5; overflow-wrap: break-word;
  color: var(--ink);
  padding: 6px 10px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}
.chat-line .cn { color: var(--brass); }
.chat-line .cn.spec { color: var(--ink-dim); }
.chat-line .spec-tag { font-size: 10px; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-right: 4px; color: var(--ink-dim); }
.chat-line.sys {
  color: var(--ink-dim); font-size: 12px; text-align: center; letter-spacing: 0.08em;
  background: none; border: none; padding: 2px 10px;
}
.chat-line.mine { background: rgba(210, 163, 86, 0.10); border-color: var(--line-strong); }
.chat-line.mine .cn { color: #a8c4a2; }
.chat-input { display: flex; gap: 8px; padding: 9px; border-top: 1px solid var(--line); }
.chat-input input {
  flex: 1; min-width: 0; background: var(--felt);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; color: var(--ink); font-size: 14px; outline: none;
}
.chat-input input::placeholder { color: var(--ink-faint); }
.chat-input input:focus { border-color: var(--line-strong); }
.chat-input .btn { padding: 9px 16px; }

.room-foot { display: flex; gap: 10px; margin-top: 14px; }
.room-foot .btn { flex: 1; }

/* ---------- 9b. 创建页：指定挑战邀请卡 ---------- */
.invite-label { font-size: 12px; color: var(--ink-faint); letter-spacing: 0.1em; margin: 6px 2px 10px; text-align: center; }
.invite-code {
  display: block; width: 100%;
  padding: 16px 12px; border-radius: 12px;
  font-family: var(--serif); font-size: 32px; letter-spacing: 0.3em; text-indent: 0.3em;
  color: var(--brass);
  background: rgba(210, 163, 86, 0.08);
  border: 1px dashed var(--line-strong);
}
.invite-code .cp {
  display: inline-block; margin-left: 10px; vertical-align: middle;
  font-family: var(--sans); font-size: 11px; letter-spacing: 0.1em; text-indent: 0;
  color: var(--ink-faint); border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px;
}
.invite-guide { margin: 14px 4px 2px; font-size: 13px; color: var(--ink-dim); line-height: 1.9; }
.invite-guide b { color: var(--brass); font-weight: 600; }

/* ---------- 9c. 个人中心 ---------- */
.pf-head {
  margin-top: 14px;
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background:
    linear-gradient(140deg, rgba(210, 163, 86, 0.10), transparent 42%),
    var(--panel);
  border: 1px solid var(--line);
}
.pf-id { flex: 1; min-width: 0; }
.pf-name {
  font-size: 17px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  overflow: hidden; white-space: nowrap;
}
.pf-sub { margin-top: 3px; font-size: 12px; color: var(--ink-faint); }
.pf-balance {
  margin-top: 12px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
}
.pf-bal-label { font-size: 12px; color: var(--ink-faint); letter-spacing: 0.14em; }
.pf-bal-num {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 24px; font-weight: 700; color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.pf-bal-unit { font-size: 13px; color: var(--ink-dim); font-weight: 400; }
.coin-list { display: flex; flex-direction: column; gap: 8px; }
.coin-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 13px;
}
.coin-chip {
  font-family: var(--serif); letter-spacing: 0.08em; color: var(--brass);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px 8px;
}
.coin-bal { font-variant-numeric: tabular-nums; font-weight: 600; }
.coin-src {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; text-align: right;
  font-size: 11px; color: var(--ink-faint); line-height: 1.6;
}

/* ---------- 10. 动效克制声明 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01s !important; transition-duration: 0.01s !important; }
}
