/* ============================================================
   楚河汉界 · v7「一局一室」
   - 令牌唯一真相源：tokens.css（暗色已改为冷调玻璃，棋盘仍暖木）
   - 布局：桌面三列（对手｜棋盘｜棋谱），手机全出血棋盘 + 底部常驻输入
   - 本文件不含任何写死的棋盘/棋子色：那些只在 tokens.css 里
   ============================================================ */

@import url("./tokens.css");

/* ---------- 结构补充令牌 ---------- */
:root {
  --col: 250px;                       /* 桌面左右栏宽 */
  --col-gap: clamp(20px, 3vw, 52px);
  --gut: clamp(16px, 4vw, 64px);      /* 页面左右留白 */
  --gbar-h: 52px;

  --glass: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .015));
  --glass-line: rgba(255, 255, 255, .075);
  --glass-blur: blur(22px);
}

[data-theme="light"] {
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .5));
  --glass-line: rgba(58, 40, 20, .12);
  --glass-blur: blur(18px);
}

/* ============================================================
   基础
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-15);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
}

/* 页面底：一室一灯。冷底 + 暖光，层次全在这里 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1000px 680px at 50% -8%, rgba(92, 116, 168, .16), transparent 64%),
    radial-gradient(820px 600px at 92% 106%, rgba(224, 74, 53, .07), transparent 70%),
    radial-gradient(780px 640px at 50% 54%, rgba(206, 142, 60, .145), transparent 72%);
}

[data-theme="light"] body::before {
  background:
    radial-gradient(1000px 680px at 50% -8%, rgba(120, 96, 60, .10), transparent 64%),
    radial-gradient(820px 600px at 92% 106%, rgba(168, 39, 32, .06), transparent 70%);
  opacity: .9;
}

/* 极细网格，只在中间淡淡铺开 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
  background-size: 54px 54px;
  -webkit-mask-image: radial-gradient(76% 64% at 50% 46%, #000, transparent 80%);
  mask-image: radial-gradient(76% 64% at 50% 46%, #000, transparent 80%);
}

[data-theme="light"] body::after { opacity: .5; }

.hidden { display: none !important; }
[hidden] { display: none !important; }

ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
button { font-family: inherit; }
input { font-family: inherit; }
img, svg { display: block; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection { background: var(--accent-soft); }

.shell {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- 通用按钮 ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  color: #fff;
  border-radius: var(--radius-pill);
  background: linear-gradient(160deg, #f1543b, #c9341f);
  box-shadow: 0 18px 40px -18px rgba(226, 84, 60, .85), inset 0 1px 0 rgba(255, 255, 255, .26);
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1);
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 22px 46px -18px rgba(226, 84, 60, .95), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn-primary:active { transform: translateY(0) scale(.99); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }

[data-theme="light"] .btn-primary {
  background: linear-gradient(160deg, #b83024, #8d1f19);
  box-shadow: 0 16px 34px -18px rgba(168, 39, 32, .7), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 14.5px;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: background var(--dur-1), border-color var(--dur-1);
  -webkit-tap-highlight-color: transparent;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .09); border-color: var(--border-strong); }
[data-theme="light"] .btn-ghost:hover { background: #fff; }

.ico {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  transition: color var(--dur-1), background var(--dur-1);
}
.ico:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.ico.off { color: var(--text-faint); text-decoration: line-through; }
[data-theme="light"] .ico:hover { background: rgba(58, 40, 20, .06); }

/* ============================================================
   顶栏（大厅 / 对局共用骨架）
   ============================================================ */
.gbar {
  flex: 0 0 auto;
  height: var(--gbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 var(--gut);
  color: var(--text-dim);
  font-size: 12.5px;
  position: relative;
  z-index: 4;
}

.gbar-r { display: flex; align-items: center; gap: 4px; }

/* ---------- 大厅顶栏 ---------- */
.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700;
  color: #ffe8e2;
  background: linear-gradient(150deg, #c0392b, #7a1e14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 22px -12px rgba(192, 57, 43, .9);
}
.brand-t { display: flex; flex-direction: column; line-height: 1.25; }
.brand-t b { font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: .09em; }
.brand-t i { font-style: normal; font-size: 10.5px; color: var(--text-faint); letter-spacing: .1em; }

/* ============================================================
   大厅
   ============================================================ */
.lobby {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.lbody {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto 440px;
  justify-content: center;
  align-content: center;
  align-items: center;
  gap: clamp(40px, 7vw, 120px);
  padding: 0 var(--gut) clamp(16px, 3vh, 40px);
}

/* ---------- hero ---------- */
.lhero { max-width: 620px; min-width: 0; }
.lkick {
  font-size: 11px;
  letter-spacing: .28em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: clamp(16px, 3vh, 28px);
}
.lhero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(40px, 5.2vw, 68px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--text);
}
.lhero h1 em { font-style: normal; color: var(--accent); }
.lsub {
  margin-top: clamp(14px, 2.4vh, 24px);
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--text-dim);
  letter-spacing: .02em;
  max-width: 42ch;
}

.lform { margin-top: clamp(22px, 3.6vh, 40px); display: flex; flex-direction: column; gap: 16px; }

.lf { display: flex; flex-direction: column; gap: 7px; max-width: 260px; }
.lf > span { font-size: 10.5px; letter-spacing: .18em; color: var(--text-faint); }
.lf input {
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--glass-line);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--dur-1), background var(--dur-1);
}
.lf input::placeholder { color: var(--text-faint); }
.lf input:focus {
  outline: none;
  border-color: var(--accent-ring);
  background: rgba(255, 255, 255, .07);
}
[data-theme="light"] .lf input { background: rgba(255, 255, 255, .8); }

.lcta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lcta .btn-primary { height: 54px; padding: 0 40px; }
.lcta .btn-ghost { height: 54px; padding: 0 28px; }

.ljoin {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 4px;
  font-size: 12px;
  color: var(--text-faint);
  flex-wrap: wrap;
}
.lj-l { letter-spacing: .06em; }
.ljoin input {
  flex: 0 0 118px;
  width: 118px; height: 34px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--glass-line);
  color: var(--text);
  font-size: 12.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.ljoin input::placeholder { letter-spacing: .1em; text-transform: none; color: var(--text-faint); }
.ljoin input:focus { outline: none; border-color: var(--accent-ring); }
.ljoin button {
  height: 34px; padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, .05);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: color var(--dur-1), background var(--dur-1);
}
.ljoin button:hover { color: var(--text); background: rgba(255, 255, 255, .1); }

/* ---------- 右侧面板 ---------- */
.lpanel {
  position: relative;
  height: min(620px, calc(100dvh - 140px));
  border-radius: 20px;
  padding: 20px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 40px 90px -50px rgba(0, 0, 0, .9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
[data-theme="light"] .lpanel { box-shadow: 0 30px 70px -45px rgba(72, 50, 24, .5); }

.lp-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.lp-ai { display: none; }
.lpanel.ai-open .lp-rooms { display: none; }
.lpanel.ai-open .lp-ai { display: flex; }

.lp-h {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--glass-line);
  font-size: 10.5px;
  letter-spacing: .22em;
  color: var(--text-faint);
}
.lp-cnt {
  font-size: 10px;
  letter-spacing: 0;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-ring);
  font-variant-numeric: tabular-nums;
}
.lp-link {
  margin-left: auto;
  background: none; border: 0; padding: 0;
  color: var(--text-faint);
  font-size: 11.5px;
  cursor: pointer;
  letter-spacing: .06em;
  transition: color var(--dur-1);
}
.lp-link:hover { color: var(--text-dim); }
.lp-back {
  width: 26px; height: 26px; margin-left: -8px;
  border: 0; background: none; padding: 0;
  color: var(--text-dim);
  font-size: 19px; line-height: 1;
  cursor: pointer;
}

.lp-body { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; }
.lp-body::-webkit-scrollbar { display: none; }

/* 房间列表 */
.room-list { display: flex; flex-direction: column; padding: 6px 0; height: 100%; }
.room-list li.empty::before {
  content: "";
  display: block;
  width: 34px; height: 34px;
  margin: 0 auto 12px;
  border: 1px dashed var(--glass-line);
  border-radius: 50%;
}
.room-list li.empty,
.chat-log .empty {
  padding: 28px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: .08em;
}
.room-list li.empty {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
}
.room-list li:not(.empty) {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 10px;
  border-radius: 12px;
  transition: background var(--dur-1);
}
.room-list li:not(.empty):hover { background: rgba(255, 255, 255, .05); }
[data-theme="light"] .room-list li:not(.empty):hover { background: rgba(58, 40, 20, .05); }
.room-list li > span { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.rname {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22ch;
}
.rmeta { font-size: 10.5px; color: var(--text-faint); letter-spacing: .06em; }
.room-list li button {
  flex: 0 0 auto;
  height: 30px; padding: 0 15px;
  border-radius: 9px;
  font-size: 11.5px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--glass-line);
  cursor: pointer;
  transition: color var(--dur-1), background var(--dur-1);
}
.room-list li button:hover { color: var(--text); background: rgba(255, 255, 255, .12); }

/* 人机面板 */
.ai-body { display: flex; flex-direction: column; gap: 22px; padding: 18px 2px 2px; }
.ap-group { display: flex; flex-direction: column; gap: 10px; }
.ap-label { font-size: 10px; letter-spacing: .22em; color: var(--text-faint); }
.chips { display: flex; gap: 8px; }
.chip {
  flex: 1;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, .04);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--dur-1);
}
.chip:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.chip.active {
  color: var(--accent);
  border-color: var(--accent-ring);
  background: var(--accent-soft);
  font-weight: 600;
}
.ap-hint { font-size: 11.5px; color: var(--text-faint); letter-spacing: .02em; }
.ap-go { height: 50px; margin-top: auto; }

/* 规则折叠 */
.lp-rule {
  flex: 0 0 auto;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-line);
  font-size: 11.5px;
  color: var(--text-faint);
}
.lp-rule summary {
  cursor: pointer;
  list-style: none;
  letter-spacing: .04em;
  color: var(--text-faint);
  transition: color var(--dur-1);
}
.lp-rule summary::-webkit-details-marker { display: none; }
.lp-rule summary:hover { color: var(--text-dim); }
.lp-rule ul { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; padding-left: 14px; }
.lp-rule li { position: relative; line-height: 1.6; }
.lp-rule li::before {
  content: "";
  position: absolute; left: -12px; top: 8px;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--text-faint);
}

/* ============================================================
   对局 · 桌面（三列）
   ============================================================ */
.game {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--col) minmax(0, 1fr) var(--col);
  grid-template-rows: var(--gbar-h) minmax(0, 1fr);
  column-gap: var(--col-gap);
  padding: 0 var(--gut) 16px;
  overflow: hidden;
}

.gbar--game { grid-column: 1 / -1; grid-row: 1; padding: 0; }

/* 顶栏三段 */
.gbar--game {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.gb-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.gb-r { display: flex; align-items: center; gap: 12px; justify-self: end; }

.gb-room { font-size: 11.5px; color: var(--text-faint); letter-spacing: .08em; white-space: nowrap; }
.gb-room b { color: var(--text); font-size: 12.5px; letter-spacing: .16em; font-variant-numeric: tabular-nums; }

.gb-link {
  background: none; border: 0; padding: 4px 0;
  color: var(--text-faint);
  font-size: 11.5px;
  letter-spacing: .06em;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-1);
  position: relative;
}
.gb-link:hover { color: var(--text); }
.gb-exit:hover { color: var(--accent); }

.gb-spec { font-size: 11px; color: var(--text-faint); letter-spacing: .06em; white-space: nowrap; }

/* 状态：顶栏中缝 */
.gb-c {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 0;
}
.gb-main { color: var(--text-dim); }
.gb-c.st-me .gb-main { color: var(--accent-hi); font-weight: 500; }
.gb-c.st-wait .gb-main { color: var(--text-dim); }
.gb-c.st-end .gb-main { color: var(--text-faint); }
.gb-pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cue);
  box-shadow: 0 0 0 3px rgba(69, 179, 154, .16);
  flex: 0 0 auto;
  animation: gbpulse 2.4s var(--ease-inout) infinite;
}
.gb-c.st-me .gb-pulse { background: var(--accent); box-shadow: 0 0 0 3px rgba(226, 84, 60, .18); }
.gb-c.hide .gb-pulse { animation: none; opacity: .35; }
.gb-c.st-wait .gb-pulse { background: var(--text-faint); box-shadow: none; }
@keyframes gbpulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.82); }
}
.gb-sep { width: 1px; height: 9px; background: var(--border-strong); flex: 0 0 auto; }
.gb-last {
  color: var(--text-faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 座位 ---------- */
.seats {
  grid-column: 1; grid-row: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
  padding: 12px 0;
}

.seat {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
}
.seat.turn {
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 1px rgba(226, 84, 60, .1), 0 24px 50px -30px rgba(226, 84, 60, .6);
}
.seat.offline { opacity: .55; }
.seat.offline .seat-sub { color: var(--warn); }

.seat-side {
  position: absolute;
  left: 0; top: 16px; bottom: 16px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background var(--dur-2);
}
.seat.turn .seat-side { background: var(--accent); }

.avatar {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: #ffe6df;
  background: linear-gradient(158deg, #963627, #5a1b12);
  border: 1px solid rgba(255, 255, 255, .13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 20px -10px rgba(0, 0, 0, .95);
}
.avatar.black {
  color: #e9f2ed;
  background: linear-gradient(158deg, #3f5f4e, #1c3026);
}

.seat-meta { min-width: 0; }
.seat-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seat-sub {
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: .06em;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clock {
  grid-column: 1 / -1;
  margin-top: 4px;
  font-family: var(--font-num);
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  transition: color var(--dur-2);
}
.seat.turn .clock { color: var(--text); }
.clock.low { color: var(--danger); animation: clocklow 1s steps(2, end) infinite; }
.clock.is-txt { font-size: 17px; letter-spacing: .08em; color: var(--text-faint); font-family: var(--font-ui); }
@keyframes clocklow { 50% { opacity: .45; } }

/* 双段时钟：主时间 + 本步/读秒（局时·步时·读秒三段时间制） */
.clock .ck-m { font-weight: 300; font-variant-numeric: tabular-nums; }
.clock .ck-s {
  display: block;
  margin-top: 2px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: .06em;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.clock .ck-s.byo { color: var(--accent); }

/* ---------- 子力对比（左栏中缝，全部由盘面推导，不造假数据） ---------- */
.force {
  width: 100%;
  padding: 14px 14px 15px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.force-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--text-faint);
  margin-bottom: 11px;
}
.force-d { letter-spacing: 0; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.force-bar {
  display: flex;
  gap: 2px;
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, .06);
}
.force-bar i { display: block; height: 100%; border-radius: 3px; transition: width var(--dur-4) var(--ease-out); }
.force-bar .fr { background: linear-gradient(90deg, #b8331f, #e2543c); }
.force-bar .fb { background: linear-gradient(90deg, #2f4a42, #45b39a); }
.force-n {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  font-size: 10.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
}

/* ---------- 棋盘区 ---------- */
.board-stage {
  grid-column: 2; grid-row: 2;
  position: relative;
  width: 100%;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  /* 上沿留 46px：着法播报与悔棋请求条住在这里，永不压到棋子 */
  padding-top: 46px;
}

.board-wrap {
  position: relative;
  padding: 0;
  border-radius: 8px;
  transition: box-shadow var(--dur-3);
}

.board-holder { position: relative; display: flex; justify-content: center; }
.ml-mid { display: none; }

/* 吃子震屏：只在吃子瞬间抖一下，幅度小到不干扰看盘 */
.board-holder.sk-sm { animation: skSm .26s var(--ease-out) both; }
.board-holder.sk-lg { animation: skLg .38s var(--ease-out) both; }
@keyframes skSm {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-2px, 1px, 0); }
  55% { transform: translate3d(2px, -1px, 0); }
  80% { transform: translate3d(-1px, 1px, 0); }
}
@keyframes skLg {
  0%, 100% { transform: translate3d(0, 0, 0); }
  18% { transform: translate3d(-4px, 2px, 0) rotate(-.18deg); }
  42% { transform: translate3d(4px, -2px, 0) rotate(.18deg); }
  66% { transform: translate3d(-3px, 1px, 0) rotate(-.1deg); }
  86% { transform: translate3d(2px, 0, 0); }
}
.board-holder canvas {
  display: block;
  border-radius: 8px;
  touch-action: none;
  cursor: pointer;
}

/* 一灯光晕：棋盘底下那团暖 */
.board-wrap::before {
  content: "";
  position: absolute;
  left: 50%; top: 52%;
  width: 132%; height: 122%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(206, 142, 60, .16), rgba(206, 142, 60, 0) 74%);
}
[data-theme="light"] .board-wrap::before { opacity: .5; }

/* 回合光带：贴着棋盘上下沿 */
.edge-light {
  position: absolute;
  left: 6%; right: 6%;
  height: 2px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2);
}
.edge-light.top { top: -5px; }
.edge-light.bottom { bottom: -5px; }
.edge-light::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--band-lit) 22%, var(--band-lit) 78%, transparent);
}
.board-wrap.turn-mine .edge-light.bottom { opacity: 1; }
.board-wrap.turn-theirs .edge-light.top { opacity: 1; }
.board-wrap.low-time.turn-mine .edge-light.bottom::before { background: linear-gradient(90deg, transparent, var(--danger) 22%, var(--danger) 78%, transparent); }
.board-wrap.low-time.turn-theirs .edge-light.top::before { background: linear-gradient(90deg, transparent, var(--danger) 22%, var(--danger) 78%, transparent); }

/* 等待对手：棋盘蒙一层 + 中心提示（邀请卡之外的空态） */
.board-wrap.is-waiting .board-holder::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 8px;
  pointer-events: none;
  z-index: 1;
  background: rgba(8, 6, 3, .30);
}
[data-theme="light"] .board-wrap.is-waiting .board-holder::after { background: rgba(58, 40, 20, .18); }

.board-wrap:has(#board:focus-visible) { box-shadow: inset 0 0 0 2px var(--focus); }

/* 将军闪字 */
.check-flash {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.92);
  padding: 10px 26px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .3em;
  text-indent: .3em;
  color: #ffe9e3;
  background: rgba(168, 39, 32, .92);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 20px 50px -18px rgba(168, 39, 32, .9);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
}
.check-flash.show {
  animation: checkflash var(--dur-check) var(--ease-out) both;
}
@keyframes checkflash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.9); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(1.02); }
}

/* ---------- 着法播报：浮在棋盘上沿 ---------- */
.move-toast {
  position: absolute;
  left: 50%; top: 6px;
  transform: translate(-50%, -8px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border-radius: 999px;
  background: rgba(14, 16, 22, .88);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 14px 34px -20px rgba(0, 0, 0, .95);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 8;
  transition: opacity var(--dur-2), transform var(--dur-2) var(--ease-out);
}
[data-theme="light"] .move-toast { background: rgba(255, 253, 248, .94); }
.move-toast.show { opacity: 1; transform: translate(-50%, 0); }
.move-toast.out { opacity: 0; }
.mt-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.mt-dot.red { background: var(--accent); box-shadow: 0 0 0 3px rgba(226, 84, 60, .16); }
.mt-dot.black { background: var(--cue); box-shadow: 0 0 0 3px rgba(69, 179, 154, .16); }
.mt-name { color: var(--text-faint); font-size: 11px; letter-spacing: .06em; }
.mt-move { color: var(--text); font-weight: 500; letter-spacing: .04em; }

/* ---------- 邀请卡 ---------- */
.invite-card {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, 82%);
  padding: 22px 20px 18px;
  border-radius: 18px;
  text-align: center;
  background: rgba(13, 15, 21, .965);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(26px) saturate(1.1);
  -webkit-backdrop-filter: blur(26px) saturate(1.1);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .95);
  z-index: 7;
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
}
[data-theme="light"] .invite-card { background: rgba(255, 253, 248, .985); }

.ic-label { font-size: 10px; letter-spacing: .26em; color: var(--text-faint); }
.ic-code {
  margin-top: 8px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: .22em;
  text-indent: .22em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-num);
}
.ic-copy { margin-top: 16px; height: 44px; width: 100%; font-size: 13.5px; }
.ic-url {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--glass-line);
  font-size: 10.5px;
  color: var(--text-faint);
  word-break: break-all;
  cursor: pointer;
  transition: background var(--dur-1);
}
.ic-url.flash { background: var(--accent-soft); color: var(--accent); }
.ic-wait {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--text-faint);
}
.ic-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--cue);
  animation: gbpulse 1.8s var(--ease-inout) infinite;
}

/* ---------- 右栏：棋谱 / 对话 ---------- */
.rail {
  grid-column: 3; grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 12px 0;
}

.sheet {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  overflow: hidden;
}

.sheet-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

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

.pb-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 15px 11px;
  border-bottom: 1px solid var(--glass-line);
}
.pb-title { font-size: 10px; letter-spacing: .26em; color: var(--text-faint); }
.pb-cnt { margin-left: auto; font-size: 10.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.pb-close { display: none; }

/* 棋谱 */
.moves-block { flex: 1; min-height: 0; }
.moves {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr);
  align-content: start;
  gap: 0 6px;
  padding: 6px 8px 14px;
  /* 稿纸横线：内容没写满时，空位也是"纸"，不是空洞 */
  background-image: repeating-linear-gradient(180deg, transparent 0 25px, rgba(255, 255, 255, .045) 25px 26px);
  background-origin: content-box;
  background-clip: content-box;
}
[data-theme="light"] .moves { background-image: repeating-linear-gradient(180deg, transparent 0 25px, rgba(58, 40, 20, .07) 25px 26px); }
.moves::-webkit-scrollbar { display: none; }
.moves li { line-height: 26px; height: 26px; }
.moves li.no {
  font-size: 9.5px;
  color: var(--text-faint);
  text-align: right;
  padding-right: 4px;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.moves li.mv {
  font-size: 12.5px;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.moves li.mv.red { color: #d99c8e; }
.moves li.mv.black { color: #c3cad6; }
[data-theme="light"] .moves li.mv.red { color: #9c4a3c; }
[data-theme="light"] .moves li.mv.black { color: #3d4451; }
.moves li.mv.last { font-weight: 600; color: var(--text); }
.moves li.mv.ph { color: var(--text-faint); opacity: .38; }
.moves li.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  padding: 26px 0;
  letter-spacing: .08em;
}

/* 对话 */
.chat-block {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--glass-line);
}
.chat-log {
  flex: 1;
  min-height: 0;
  max-height: 152px;
  overflow: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 14px;
  justify-content: flex-end;
}
.chat-log::-webkit-scrollbar { display: none; }
.chat-log .line {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 92%;
  animation: msgIn var(--dur-2) var(--ease-out) both;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(5px); } }
.chat-log .line.own { align-items: flex-end; align-self: flex-end; }
.chat-log .who { font-size: 9.5px; letter-spacing: .14em; color: var(--text-faint); }
.chat-log .bubble-text {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
  padding: 7px 10px;
  border-radius: 11px 11px 11px 4px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--glass-line);
  word-break: break-word;
}
.chat-log .line.own .bubble-text {
  border-radius: 11px 11px 4px 11px;
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--text);
}
[data-theme="light"] .chat-log .bubble-text { background: rgba(58, 40, 20, .045); }

.chat-form {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--glass-line);
}
.chat-form input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--glass-line);
  color: var(--text);
  font-size: 12.5px;
}
.chat-form input::placeholder { color: var(--text-faint); }
.chat-form input:focus { outline: none; border-color: var(--accent-ring); }
.chat-form input:disabled { opacity: .5; }
.chat-send {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--accent-ring);
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--dur-1);
}
.chat-send:hover { background: rgba(226, 84, 60, .24); }

/* ---------- 三个动作 ---------- */
.actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}
.actions button {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: color var(--dur-1), background var(--dur-1), border-color var(--dur-1);
}
.actions button:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, .09); }
.actions button:disabled { opacity: .38; cursor: not-allowed; }
.actions button.danger { color: var(--accent); border-color: var(--accent-ring); background: var(--accent-soft); }
.actions button.danger:hover:not(:disabled) { background: rgba(226, 84, 60, .2); color: var(--accent-hi); }

/* 桌面不显示手机专用的常驻输入条与气泡 */
.sheet-handle { display: none; }
.chat-fab { display: none; }

/* ---------- 悔棋 / 求和 请求条 ---------- */
.offer-bar {
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translate(-50%, -8px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border-radius: 999px;
  background: rgba(16, 18, 25, .94);
  border: 1px solid var(--border-brass);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-3);
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  z-index: 30;
  opacity: 0;
  transition: opacity var(--dur-2), transform var(--dur-2) var(--ease-out);
}
[data-theme="light"] .offer-bar { background: rgba(255, 253, 248, .96); }
.offer-bar.show { opacity: 1; transform: translate(-50%, 0); }
.ob-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ob-dot.b { background: var(--cue); box-shadow: 0 0 0 3px var(--cue-dim); }
.ob-text { color: var(--text); }
.ob-more { font-size: 10.5px; color: var(--text-faint); }
.ob-actions { display: flex; gap: 6px; }
.ob-actions button {
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 11.5px;
  cursor: pointer;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, .06);
  color: var(--text-dim);
}
.ob-actions .ob-yes { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--accent-hi); }
.ob-actions button:hover { background: rgba(255, 255, 255, .12); color: var(--text); }

/* ============================================================
   结算
   ============================================================ */
.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(4, 5, 8, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn var(--dur-3) var(--ease-out) both;
}
@keyframes fadeIn { from { opacity: 0; } }

.result-card {
  width: min(360px, calc(100vw - 48px));
  padding: 34px 28px 22px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(180deg, rgba(26, 29, 38, .97), rgba(13, 15, 20, .99));
  border: 1px solid var(--glass-line);
  box-shadow: 0 50px 110px -40px rgba(0, 0, 0, .95);
  animation: cardIn var(--dur-3) var(--ease-spring) both;
}
[data-theme="light"] .result-card { background: linear-gradient(180deg, #fffdf8, #f4ede0); }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.result-title {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text);
}
.result-card.rc-win .result-title { color: var(--accent); }
.result-card.rc-lose .result-title { color: var(--text-dim); }
.result-card.rc-draw .result-title { color: var(--text-dim); }
.result-reason { margin-top: 8px; font-size: 12.5px; color: var(--text-dim); letter-spacing: .08em; }
.result-meta { margin-top: 6px; font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.result-actions { margin-top: 24px; display: flex; gap: 10px; }
.result-actions .btn-primary { flex: 1; height: 48px; }
.result-actions .btn-ghost { flex: 0 0 auto; padding: 0 22px; height: 48px; }
.result-review {
  margin-top: 16px;
  background: none;
  border: 0;
  color: var(--text-faint);
  font-size: 11.5px;
  letter-spacing: .08em;
  cursor: pointer;
}
.result-review:hover { color: var(--text-dim); }

/* ============================================================
   询问弹层 / toast / 断线
   ============================================================ */
.ask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(4, 5, 8, .58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn var(--dur-2) both;
}
.ask-card {
  width: min(320px, calc(100vw - 56px));
  padding: 26px 22px 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(26, 29, 38, .98), rgba(13, 15, 20, 1));
  border: 1px solid var(--glass-line);
  box-shadow: 0 40px 90px -34px rgba(0, 0, 0, .95);
  text-align: center;
}
[data-theme="light"] .ask-card { background: #fffdf8; }
.ask-card p { font-size: 14.5px; color: var(--text); line-height: 1.6; }
.ask-actions { margin-top: 20px; display: flex; gap: 10px; }
.ask-actions .btn-primary { flex: 1; height: 46px; }
.ask-actions .btn-ghost { flex: 1; height: 46px; }

/* ---------- 开局设置 ---------- */
.nr-card {
  width: min(430px, calc(100vw - 32px));
  padding: 20px 20px 18px;
  text-align: left;
}
.nr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.nr-head h2 { font-size: 16px; font-weight: 500; letter-spacing: .04em; color: var(--text); }
.nr-close {
  width: 28px; height: 28px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  color: var(--text-dim); font-size: 12px;
  cursor: pointer;
}
.nr-row { margin-bottom: 13px; }
.nr-lab {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 7px;
  font-size: 12px; letter-spacing: .1em; color: var(--text-dim);
}
.nr-lab i { font-style: normal; font-size: 10px; letter-spacing: .02em; color: var(--text-faint); }
.nr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nr-chips button {
  flex: 0 1 auto;
  min-width: 56px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .04);
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all var(--dur-2);
}
.nr-chips button:hover { border-color: var(--accent-ring); color: var(--text); }
.nr-chips button.on {
  background: var(--accent-soft, rgba(200, 56, 40, .16));
  border-color: var(--accent);
  color: var(--accent-text, #ff8a72);
  font-weight: 500;
}
.nr-chips button:disabled { opacity: .34; cursor: not-allowed; }
.nr-sum {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--glass-line);
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.nr-actions { margin-top: 14px; display: flex; gap: 10px; }
.nr-actions .btn-primary { flex: 1.6; height: 46px; }
.nr-actions .btn-ghost { flex: 1; height: 46px; }
@media (max-width: 719px) {
  .nr-card { width: calc(100vw - 24px); max-height: 88dvh; overflow-y: auto; }
  .nr-chips button { min-width: 52px; height: 34px; }
}

.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(16, 18, 25, .94);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-2);
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  animation: toastIn var(--dur-2) var(--ease-out) both;
}
.toast.warn { border-color: var(--border-brass); color: var(--warn); }
.toast.out { animation: toastOut var(--dur-2) var(--ease-fade) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
[data-theme="light"] .toast { background: rgba(255, 253, 248, .97); }

.net-banner {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translate(-50%, -20px);
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(226, 84, 60, .95);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 16px 40px -20px rgba(0, 0, 0, .9);
  opacity: 0;
  transition: opacity var(--dur-2), transform var(--dur-3) var(--ease-out);
}
.net-banner.show { opacity: 1; transform: translate(-50%, 0); }
.net-banner.ok { background: rgba(35, 120, 106, .95); }
.nb-act {
  background: rgba(255, 255, 255, .18);
  border: 0;
  color: #fff;
  font-size: 11.5px;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
}

/* ---------- 语音按钮 ---------- */
.voice-btn { position: relative; }
.v-dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  background: var(--cue);
}
.voice-btn.ringing .v-dot { animation: gbpulse .8s infinite; }
.voice-btn.peer-talking { color: var(--cue); }
.voice-btn.muted { color: var(--text-faint); }
.voice-btn.muted .v-dot { background: var(--text-faint); }

/* ============================================================
   平板 720 – 1023：单列，棋谱/对话横向排
   ============================================================ */
@media (max-width: 1023px) and (min-width: 720px) {
  .lbody { grid-template-columns: 1fr; gap: 32px; align-items: start; align-content: start; padding-top: 12px; overflow-y: auto; }
  .lpanel { height: auto; max-height: 460px; justify-self: center; width: min(560px, 100%); }
  .lhero { max-width: 640px; justify-self: center; width: 100%; }

  .game {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--gbar-h) auto minmax(0, 1fr) clamp(180px, 32vh, 320px) auto;
    padding: 0 24px 12px;
  }
  .gbar--game { grid-column: 1; grid-row: 1; }
  .seats {
    grid-column: 1; grid-row: 2;
    flex-direction: row;
    gap: 12px;
    padding: 4px 0 10px;
  }
  .seat { flex: 1; grid-template-columns: 38px 1fr; padding: 11px 12px; }
  .seat .avatar { width: 38px; height: 38px; font-size: 17px; }
  .clock { font-size: 24px; }
  .force { display: none; }
  .board-stage { grid-column: 1; grid-row: 3; width: 100%; padding-top: 42px; }
  .rail {
    grid-column: 1; grid-row: 4;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    min-height: 0;
  }
  .sheet { flex: 1; min-height: 0; }
  .sheet-body { flex-direction: row; min-height: 0; }
  .moves-block { flex: 1; border-right: 1px solid var(--glass-line); }
  .chat-block { flex: 1; border-top: 0; min-width: 0; }
  .chat-log { max-height: none; }
  .actions { grid-column: 1; grid-row: 5; padding-top: 10px; margin-top: 0; }
}

/* ============================================================
   手机 ≤ 719：全出血棋盘 + 底部常驻输入 + 上浮抽屉
   ============================================================ */
@media (max-width: 719px) {
  :root { --gut: 16px; --gbar-h: 48px; }

  .lbody { grid-template-columns: 1fr; gap: 28px; align-items: start; align-content: start; padding: 18px var(--gut) 28px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .lhero h1 { font-size: clamp(34px, 10vw, 46px); }
  .lsub { font-size: 13.5px; }
  .lf { max-width: none; }
  .lcta { flex-direction: column; align-items: stretch; }
  .lcta .btn-primary, .lcta .btn-ghost { width: 100%; height: 52px; }
  .ljoin { justify-content: space-between; }
  .ljoin input { flex: 1; width: auto; }
  .lpanel { height: auto; min-height: 0; max-height: none; padding: 16px; border-radius: 18px; }
  .lp-body { max-height: 46vh; }
  .ai-body { gap: 18px; }
  .ap-go { margin-top: 8px; }

  /* --- 对局：单列 flex，高度锁死视口 --- */
  .game {
    display: flex;
    flex-direction: column;
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    overflow: hidden;
  }

  .gbar--game {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    height: auto;
    padding: 11px var(--gut) 0;
    gap: 8px;
  }
  .gb-l { display: none; }
  .gb-c { order: 1; font-size: 12px; gap: 7px; flex: 1; min-width: 0; }
  .gb-main { overflow: hidden; text-overflow: ellipsis; }
  .gb-last, .gb-sep { display: none; }
  .gb-r { order: 2; gap: 8px; }
  .gb-spec { display: none; }
  .gb-exit {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    font-size: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--glass-line);
  }
  .gb-exit::after { content: "✕"; font-size: 12px; color: var(--text-dim); }
  .gb-link { padding: 0; }

  /* 座位：上下两条，各 54px */
  .seats { display: contents; }
  .force { display: none; }
  .seat {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 30px 1fr auto;
    gap: 9px;
    padding: 7px var(--gut);
    background: none;
    border: 0;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .seat .avatar {
    width: 30px; height: 30px;
    font-size: 14px;
  }
  .seat-meta { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
  .seat-name { font-size: 13px; }
  .seat-sub { margin-top: 0; font-size: 10px; letter-spacing: .14em; }
  .seat .clock { grid-column: 3; margin: 0; font-size: 22px; font-weight: 300; letter-spacing: .01em; }
  .seat .clock.is-txt { font-size: 13px; }
  .seat .clock .ck-s { font-size: 9px; margin-top: 1px; }
  .seat-side {
    position: static;
    width: 0; height: 0;
    display: none;
  }
  #seat-top { order: 2; padding-top: 2px; grid-template-columns: 1fr auto; }
  #seat-top .avatar { display: none; }
  #seat-top .seat-name { font-size: 13.5px; letter-spacing: .05em; }
  #seat-top .clock { grid-column: 2; }
  #seat-bottom { order: 6; padding-top: 12px; padding-bottom: 4px; border-top: 1px solid var(--glass-line); margin: 0 var(--gut); padding-left: 0; padding-right: 0; grid-template-columns: 1fr auto; }
  #seat-bottom .avatar { display: none; }
  #seat-bottom .seat-name { font-size: 13.5px; }
  #seat-bottom .clock { font-size: 28px; color: var(--text); grid-column: 2; }
  #seat-bottom .clock.is-txt { font-size: 15px; color: var(--text-dim); }

  /* 连麦：手机上收成小胶囊，塞进顶栏右侧（旧版直接 display:none，等于没有入口） */
  .voice-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 26px;
    padding: 0 9px;
    border: 1px solid var(--glass-line);
    border-radius: 13px;
    background: rgba(255, 255, 255, .06);
    font-size: 11px;
    letter-spacing: .02em;
    color: var(--text-dim);
  }
  .voice-btn .v-dot { width: 5px; height: 5px; }
  .voice-btn.ringing { color: var(--accent); border-color: var(--accent-ring); }
  .voice-btn.unsupported { opacity: .55; }
  .voice-mute {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 9px;
    border: 1px solid var(--glass-line);
    border-radius: 13px;
    background: rgba(255, 255, 255, .06);
    font-size: 11px;
    color: var(--text-dim);
  }

  /* 棋盘：全出血 */
  .board-stage {
    order: 3;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    align-self: stretch;
    justify-self: stretch;
    padding: 0;
    width: 100%;
  }
  .ml-mid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    flex: 1 1 auto;
    padding: 0 var(--gut);
    font-size: 12px;
    letter-spacing: .06em;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
  }
  .ml-mid b { font-weight: 500; color: var(--text-dim); }
  .ml-force {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(240px, 70%);
  }
  .mlf-n { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; min-width: 16px; text-align: center; }
  .mlf-bar {
    display: flex;
    flex: 1;
    height: 3px;
    border-radius: 2px;
    overflow: hidden;
    background: rgba(255, 255, 255, .07);
  }
  .mlf-bar i { display: block; height: 100%; transition: width var(--dur-4) var(--ease-out); }
  .mlf-bar .fr { background: linear-gradient(90deg, #b8331f, #e2543c); }
  .mlf-bar .fb { background: linear-gradient(90deg, #2f4a42, #45b39a); }
  .board-wrap { border-radius: 0; padding: 0; }
  .board-wrap::before {
    width: 100%; height: 100%;
    border-radius: 0;
  }
  .board-holder canvas { border-radius: 0; }
  .board-wrap.is-waiting .board-holder::after { border-radius: 0; }
  .board-wrap:has(#board:focus-visible) { box-shadow: none; }
  .edge-light { left: 0; right: 0; height: 2px; }
  .edge-light.top { top: 0; }
  .edge-light.bottom { bottom: 0; }

  /* 棋谱：手机上整块不要了（看不清且没必要），手数并进下方常驻输入条 */
  .rail { display: contents; }
  .sheet {
    order: 4;
    flex: 0 0 auto;
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: hidden;
  }
  .sheet-body { min-height: 0; }
  .moves-block { display: none; }
  .pb-head { display: none; }
  .moves:has(li.empty) { align-content: center; }
  .moves {
    padding: 6px 0 8px;
    grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 4px;
    overflow: hidden;
    align-content: end;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 30px);
    mask-image: linear-gradient(180deg, transparent, #000 30px);
  }
  .moves li { line-height: 25px; height: 25px; }
  .moves li.mv { font-size: 12.5px; }
  .chat-block { display: none; }

  /* 常驻输入条 */
  .sheet-handle {
    order: 5;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    height: 44px;
    margin: 0 var(--gut);
    padding: 0;
    border: 0;
    border-top: 1px solid var(--glass-line);
    border-bottom: 1px solid var(--glass-line);
    background: none;
    color: var(--text-faint);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .sheet-handle .sh-grip { display: none; }
  .sheet-handle .sh-text { flex: 1; letter-spacing: .02em; }
  .sheet-handle .sh-arrow { color: var(--text-faint); font-size: 15px; }

  /* 三个动作 */
  .actions {
    order: 7;
    gap: 8px;
    padding: 6px var(--gut) 12px;
  }
  .actions button { height: 44px; border-radius: 22px; font-size: 12.5px; }

  /* 气泡：压在棋盘右下角、棋谱上沿 */
  .chat-fab {
    display: grid;
    place-items: center;
    position: absolute;
    right: 6px;
    bottom: -17px;
    width: 38px; height: 38px;
    border-radius: 50%;
    z-index: 12;
    border: 1px solid rgba(255, 255, 255, .2);
    background: linear-gradient(160deg, rgba(62, 70, 86, .95), rgba(26, 31, 42, .97));
    color: #dee4ee;
    box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .18);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .chat-fab svg { width: 15px; height: 15px; }
  .chat-fab .fbadge {
    position: absolute;
    right: -2px; top: -3px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: grid; place-items: center;
    font-size: 9.5px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 1.5px solid #0a0b0f;
    font-variant-numeric: tabular-nums;
  }

  /* --- 抽屉：同一个 .sheet 元素，fixed 上浮 --- */
  .sheet.open {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 71;
    height: 56dvh;
    display: flex;
    flex-direction: column;
    border-radius: 24px 24px 0 0;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, .1);
    background: linear-gradient(180deg, rgba(20, 23, 31, .97), rgba(9, 11, 16, .995));
    backdrop-filter: blur(26px) saturate(1.08);
    -webkit-backdrop-filter: blur(26px) saturate(1.08);
    box-shadow: 0 -30px 70px -24px rgba(0, 0, 0, .92);
    padding: 0 var(--gut) calc(10px + env(safe-area-inset-bottom, 0px));
    animation: sheetIn .38s cubic-bezier(.32, .72, 0, 1) both;
  }
  [data-theme="light"] .sheet.open {
    background: linear-gradient(180deg, rgba(255, 253, 248, .98), rgba(244, 237, 224, .99));
  }
  @keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .sheet.open.closing { animation: sheetOut .26s var(--ease-fade) both; }
  @keyframes sheetOut { to { transform: translateY(100%); } }

  .sheet.open .sheet-body { flex: 1; min-height: 0; }
  .sheet.open .moves-block { display: none; }
  .sheet.open .pb-head {
    display: flex;
    padding: 14px 0 12px;
    border-bottom: 1px solid var(--glass-line);
  }
  .sheet.open .pb-title { font-size: 12px; letter-spacing: .18em; color: var(--text-dim); }
  .sheet.open .pb-close {
    display: block;
    margin-left: auto;
    background: none; border: 0; padding: 0;
    color: var(--text-faint);
    font-size: 11.5px;
    letter-spacing: .08em;
    cursor: pointer;
  }
  .sheet.open .chat-block {
    display: flex;
    flex: 1;
    min-height: 0;
    border-top: 0;
  }
  .sheet.open .chat-log {
    max-height: none;
    padding: 14px 0 10px;
    gap: 14px;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 22px);
    mask-image: linear-gradient(180deg, transparent, #000 22px);
  }
  .sheet.open .chat-log .line { max-width: 86%; gap: 5px; }
  .sheet.open .chat-log .who { font-size: 10px; }
  .sheet.open .chat-log .bubble-text {
    font-size: 13px;
    line-height: 1.68;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    color: #c3cad6;
  }
  .sheet.open .chat-log .line.own .bubble-text {
    background: none;
    border: 0;
    color: var(--text);
  }
  [data-theme="light"] .sheet.open .chat-log .bubble-text { color: #3d4451; }
  .sheet.open .chat-form { padding: 12px 0 4px; border-top: 1px solid var(--glass-line); }
  .sheet.open .chat-form input { height: 40px; border-radius: 20px; font-size: 13px; }

  /* 抽屉里的抓手 */
  .sheet.open::before {
    content: "";
    width: 38px; height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .2);
    margin: 11px auto 0;
    flex: 0 0 auto;
  }

  .sheet-scrim {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(3, 4, 7, .52);
    animation: fadeIn var(--dur-3) both;
  }

  /* 移动端浮层 */
  .offer-bar {
    top: auto;
    bottom: calc(100% - 100dvh + 96px);
    font-size: 12px;
  }
  .move-toast { top: 4px; font-size: 11.5px; padding: 6px 12px; }
  .check-flash { font-size: 24px; padding: 8px 20px; }
  .invite-card { width: min(300px, 84%); padding: 18px 16px 14px; }
  .ic-code { font-size: 28px; }
  .result-actions { flex-direction: column-reverse; }
  .result-actions .btn-ghost { width: 100%; }
  .toast-wrap { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}

/* 极窄机 */
@media (max-width: 380px) {
  .gb-main { font-size: 11.5px; }
  .moves li.mv { font-size: 12px; }
  .lhero h1 { font-size: 32px; }
}

/* ============================================================
   无障碍降级
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: rgba(255, 255, 255, .2);
    --glass-line: rgba(255, 255, 255, .2);
    --text-dim: #c8ced7;
    --text-faint: #9aa1ae;
  }
  .board-wrap.turn-mine .edge-light.bottom,
  .board-wrap.turn-theirs .edge-light.top { opacity: 1; height: 3px; }
}

/* ============================================================
   v9：全屏特效 / 回合提示 / 准备开始 / 暂停 / 皮肤预览 / 棋谱样式
   ============================================================ */

/* 手机点棋子整块棋盘冒灰框 = 浏览器默认 tap-highlight，全局关掉 */
html, body, canvas, button, .sk-card, .av-opt { -webkit-tap-highlight-color: transparent; }
#board { outline: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* ---------- 全屏特效层（将军 / 绝杀 / 读秒 / 开局 / 进房） ---------- */
.fx-layer { position: fixed; inset: 0; z-index: 95; pointer-events: none; overflow: hidden; }
.fx-veil { position: absolute; inset: 0; opacity: 0; }
.fx-veil.k-check {
  background:
    radial-gradient(closest-side at 50% 46%, rgba(228, 66, 44, .5), rgba(96, 12, 8, .22) 58%, rgba(0, 0, 0, 0) 80%),
    radial-gradient(ellipse at 50% 50%, rgba(6, 5, 4, .36), rgba(6, 5, 4, .16) 62%, rgba(6, 5, 4, 0) 100%);
  animation: fxVeilIn 1.15s ease-out both;
}
.fx-veil.k-mate {
  background:
    radial-gradient(closest-side at 50% 46%, rgba(255, 176, 84, .5), rgba(160, 30, 12, .3) 55%, rgba(0, 0, 0, .08) 82%),
    radial-gradient(ellipse at 50% 50%, rgba(6, 5, 4, .42), rgba(6, 5, 4, .18) 64%, rgba(6, 5, 4, 0) 100%);
  animation: fxVeilIn 2.1s ease-out both;
}
.fx-veil.k-byo {
  background: radial-gradient(closest-side at 50% 50%, rgba(224, 161, 60, .3), rgba(0, 0, 0, 0) 72%);
  animation: fxVeilIn 1.25s ease-out both;
}
.fx-veil.k-start { background: radial-gradient(closest-side at 50% 50%, rgba(12, 10, 8, .74), rgba(6, 5, 4, .92) 78%); animation: fxVeilIn 1.9s ease-out both; }
.fx-veil.k-join { background: radial-gradient(closest-side at 50% 44%, rgba(69, 179, 154, .22), rgba(0, 0, 0, 0) 74%); animation: fxVeilIn 1.6s ease-out both; }
@keyframes fxVeilIn { 0% { opacity: 0; } 14% { opacity: 1; } 72% { opacity: .82; } 100% { opacity: 0; } }

.fx-ring {
  position: absolute; left: 50%; top: 50%;
  width: 12vmin; height: 12vmin; margin: -6vmin 0 0 -6vmin;
  border-radius: 50%; border: 2px solid rgba(255, 138, 106, .9);
  opacity: 0;
}
.fx-ring.on { animation: fxRingOut .72s cubic-bezier(.2, .7, .3, 1) both; }
.fx-ring.gold { border-color: rgba(255, 208, 130, .95); border-width: 3px; }
@keyframes fxRingOut { 0% { opacity: .95; transform: scale(.35); } 100% { opacity: 0; transform: scale(8.5); } }

.fx-word {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center;
  gap: .08em;
  opacity: 0;
  text-align: center;
}
.fx-word .fw-main {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: .92;
  letter-spacing: .1em;
  text-indent: .1em;
  white-space: nowrap;
}
.fx-word .fw-sub {
  font-family: var(--font-ui);
  font-style: normal;
  font-size: clamp(13px, 3.4vw, 18px);
  letter-spacing: .42em;
  text-indent: .42em;
  color: rgba(255, 235, 214, .82);
  opacity: 0;
}

/* 将军：两个字铺满半个屏幕，像砸下来 */
.fx-word.k-check .fw-main {
  font-size: clamp(96px, 30vw, 240px);
  color: #ec2a10;
  -webkit-text-stroke: 2px rgba(255, 226, 186, .92);
  text-shadow:
    0 0 22px rgba(255, 84, 40, .92),
    0 0 58px rgba(196, 28, 10, .8),
    0 10px 26px rgba(0, 0, 0, .66);
}
.fx-word.k-check.show { animation: fwSlam 1.15s cubic-bezier(.16, 1.1, .3, 1) both; }
/* 副行（"你被将军·快应一手"）之前漏了动画 → 永远 opacity:0，压根不显示 */
.fx-word.k-check .fw-sub {
  animation: fwSub 1.15s ease-out both;
  margin-top: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(14, 7, 5, .62);
  border: 1px solid rgba(255, 168, 120, .34);
  color: #ffe6cf;
  font-size: clamp(13px, 3.6vw, 19px);
  letter-spacing: .3em;
  text-indent: .3em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .85);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* 绝杀：更大更久，金色描边 */
.fx-word.k-mate .fw-main {
  font-size: clamp(88px, 27vw, 220px);
  color: #ffb347;
  -webkit-text-stroke: 2px rgba(255, 248, 232, .92);
  text-shadow:
    0 0 30px rgba(255, 176, 84, .95),
    0 0 72px rgba(226, 84, 60, .8),
    0 12px 32px rgba(0, 0, 0, .65);
}
.fx-word.k-mate.show { animation: fwSlam 2.1s cubic-bezier(.16, 1.1, .3, 1) both; }
.fx-word.k-mate .fw-sub { animation: fwSub 2.1s ease-out both; }

.fx-word.k-byo .fw-main {
  font-size: clamp(56px, 17vw, 130px);
  color: #ffcf72;
  -webkit-text-stroke: 1.5px rgba(255, 246, 226, .8);
  text-shadow: 0 0 24px rgba(224, 161, 60, .9), 0 8px 22px rgba(0, 0, 0, .55);
}
.fx-word.k-byo.show { animation: fwSlam 1.25s cubic-bezier(.16, 1.1, .3, 1) both; }

/* 开局：金字 + 副行「红方先行」 */
.fx-word.k-start .fw-main {
  font-size: clamp(64px, 20vw, 160px);
  color: #f0d296;
  -webkit-text-stroke: 1.5px rgba(255, 250, 236, .75);
  letter-spacing: .18em; text-indent: .18em;
  text-shadow: 0 0 34px rgba(232, 200, 138, .8), 0 10px 28px rgba(0, 0, 0, .7);
}
.fx-word.k-start.show { animation: fwSlam 1.9s cubic-bezier(.16, 1.1, .3, 1) both; }
.fx-word.k-start .fw-sub { animation: fwSub 1.9s ease-out both; }

/* 进房：胶囊底 + 青碧字，别太吵 */
.fx-word.k-join .fw-main {
  font-size: clamp(26px, 7.2vw, 44px);
  letter-spacing: .12em; text-indent: .12em;
  color: #d9fff6;
  padding: 12px 30px;
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(30, 92, 78, .92), rgba(12, 40, 34, .92));
  border: 1px solid rgba(120, 232, 200, .5);
  box-shadow: 0 18px 46px -18px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .16);
  text-shadow: 0 0 18px rgba(69, 179, 154, .8);
}
.fx-word.k-join { place-content: start center; padding-top: 15vh; }
.fx-word.k-join.show { animation: fwJoin 1.65s cubic-bezier(.2, 1, .3, 1) both; }

@keyframes fwSlam {
  0% { opacity: 0; transform: scale(2.7) rotate(-5deg); filter: blur(7px); }
  20% { opacity: 1; transform: scale(.94) rotate(0deg); filter: blur(0); }
  32% { transform: scale(1.05); }
  44% { transform: scale(.99); }
  56% { transform: scale(1); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.09); }
}
@keyframes fwSub {
  0%, 26% { opacity: 0; transform: translateY(8px); }
  38% { opacity: 1; transform: none; }
  84% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes fwJoin {
  0% { opacity: 0; transform: translateY(18px) scale(.9); }
  16% { opacity: 1; transform: none; }
  82% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* 将军/绝杀时整屏轻微抖一下（只抖棋盘容器，不抖 UI） */
.shake-hard .board-holder { animation: skLg .5s var(--ease-out) both; }

/* ---------- 回合提示：红方走 / 黑方走 ---------- */
.turn-banner {
  position: absolute;
  left: 50%; top: 46px;
  transform: translate(-50%, -50%) scale(.94);
  display: flex; align-items: center; gap: 8px;
  padding: 6px 18px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .16em;
  text-indent: .16em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out);
}
.turn-banner b { font-weight: 600; }
.turn-banner.r { color: #ffe2d8; background: rgba(160, 38, 24, .92); border: 1px solid rgba(255, 150, 120, .45); box-shadow: 0 14px 34px -16px rgba(200, 50, 30, .95); }
.turn-banner.b { color: #dff0e8; background: rgba(24, 44, 36, .92); border: 1px solid rgba(140, 210, 180, .4); box-shadow: 0 14px 34px -16px rgba(0, 0, 0, .9); }
.turn-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- 准备开始 ---------- */
.ready-card {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center;
  gap: 16px;
  padding: 24px;
  border-radius: 8px;
  background: rgba(9, 10, 14, .66);
  -webkit-backdrop-filter: blur(5px) saturate(.85);
  backdrop-filter: blur(5px) saturate(.85);
  z-index: 5;
  text-align: center;
}
[data-theme="light"] .ready-card { background: rgba(248, 242, 231, .74); }
.rc-label { font-size: 11px; letter-spacing: .34em; text-indent: .34em; color: var(--text-faint); }
.rc-vs { display: flex; align-items: center; gap: 18px; }
.rc-side { display: grid; gap: 4px; justify-items: center; min-width: 84px; }
.rc-side b { font-size: 18px; font-weight: 500; color: var(--text); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-side i { font-style: normal; font-size: 11px; color: var(--text-faint); }
.rc-side.r b { color: #ff9c86; }
.rc-side.b b { color: #9fd8c4; }
.rc-vs-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 12px; color: var(--text-dim);
}
.rc-go { min-width: 196px; height: 52px; border-radius: 26px; font-size: 16px; letter-spacing: .12em; }
.rc-go:disabled { opacity: .55; }
.rc-hint { font-size: 11.5px; color: var(--text-dim); letter-spacing: .04em; }

/* ---------- 暂停遮罩 ---------- */
.pause-veil {
  position: absolute; inset: 0;
  display: grid; place-content: center;
  border-radius: 8px;
  background: rgba(8, 9, 12, .62);
  -webkit-backdrop-filter: blur(3px) saturate(.7);
  backdrop-filter: blur(3px) saturate(.7);
  z-index: 6;
}
[data-theme="light"] .pause-veil { background: rgba(246, 240, 228, .66); }
.pv-card { display: grid; justify-items: center; gap: 8px; padding: 22px 30px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 26px 60px -26px rgba(0, 0, 0, .85); }
.pv-icon { font-size: 13px; letter-spacing: .2em; color: var(--accent-2); }
.pv-title { font-family: var(--font-display); font-size: 22px; letter-spacing: .22em; text-indent: .22em; color: var(--text); }
.pv-sub { font-size: 11.5px; color: var(--text-dim); margin-bottom: 6px; }
.pv-go { min-width: 150px; height: 42px; border-radius: 21px; font-size: 14px; }

/* ---------- 皮肤缩略图选择 ---------- */
.skin-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sk-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 4px 7px;
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  background: var(--glass);
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: .04em;
  cursor: pointer;
  transition: border-color var(--dur-2), color var(--dur-2), transform var(--dur-2);
}
.sk-card:hover { border-color: var(--accent-ring); color: var(--text); transform: translateY(-1px); }
.sk-card.on {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent), 0 10px 24px -14px rgba(226, 84, 60, .9);
}
.sk-thumb { width: 54px; height: 54px; border-radius: 7px; display: block; }
.sk-card span { line-height: 1; }

/* ---------- 头像选择 ---------- */
.av-pick { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.av-opt {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 16px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--dur-2), color var(--dur-2);
}
.av-opt:hover { border-color: var(--accent-ring); color: var(--text); }
.av-opt.on { border-color: var(--accent); color: #fff; background: var(--accent-fill); }
.av-opt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-up { width: auto; padding: 0 13px; border-radius: 19px; font-family: var(--font-ui); font-size: 12px; }

/* 座位头像：支持图片 */
.avatar { overflow: hidden; background-size: cover; background-position: center; background-repeat: no-repeat; }
.avatar.has-img { color: transparent; }

/* ---------- 棋谱：字号 / 行距 / 底纹 ---------- */
:root { --mv-row: 26px; }
[data-mvgap="tight"] { --mv-row: 22px; }
[data-mvgap="loose"] { --mv-row: 33px; }
.moves {
  background-image: repeating-linear-gradient(180deg,
    transparent 0 calc(var(--mv-row) - 1px),
    rgba(255, 255, 255, .045) calc(var(--mv-row) - 1px) var(--mv-row));
}
[data-theme="light"] .moves {
  background-image: repeating-linear-gradient(180deg,
    transparent 0 calc(var(--mv-row) - 1px),
    rgba(58, 40, 20, .07) calc(var(--mv-row) - 1px) var(--mv-row));
}
.moves li { line-height: var(--mv-row); height: var(--mv-row); }
[data-mvbg="plain"] .moves { background-image: none; }
[data-mvbg="bamboo"] .moves {
  background-image:
    repeating-linear-gradient(180deg, transparent 0 calc(var(--mv-row) - 1px), rgba(255, 255, 255, .035) calc(var(--mv-row) - 1px) var(--mv-row)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 10px);
}
[data-mvsize="s"] .moves li.mv { font-size: 11px; }
[data-mvsize="m"] .moves li.mv { font-size: 12.5px; }
[data-mvsize="l"] .moves li.mv { font-size: 15px; letter-spacing: 0; }
[data-mvsize="l"] .moves { grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr); }

/* 设置面板变长了：允许滚动，别把「开一间房」挤出屏幕 */
.nr-card { max-height: min(86dvh, 760px); overflow-y: auto; overscroll-behavior: contain; }
.nr-actions { position: sticky; bottom: -18px; padding-top: 10px; padding-bottom: 4px; background: linear-gradient(180deg, transparent, var(--surface) 26%); }

@media (max-width: 719px) {
  .fx-word.k-check .fw-main { font-size: clamp(84px, 33vw, 150px); }
  .fx-word.k-mate .fw-main { font-size: clamp(76px, 30vw, 140px); }
  .fx-word.k-start .fw-main { font-size: clamp(52px, 22vw, 96px); letter-spacing: .1em; text-indent: .1em; }
  .fx-word.k-join .fw-main { font-size: 22px; padding: 10px 22px; max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .turn-banner { top: 12px; font-size: 15px; padding: 5px 14px; }
  .sk-thumb { width: 46px; height: 46px; }
  .sk-card { font-size: 11px; padding: 6px 2px 6px; }
  .skin-grid { gap: 6px; }
  .av-opt { width: 34px; height: 34px; font-size: 15px; }
  .ready-card { gap: 13px; padding: 18px; }
  .rc-vs { gap: 12px; }
  .rc-side { min-width: 66px; }
  .rc-side b { font-size: 13.5px; max-width: 84px; }
  .rc-go { min-width: 150px; height: 44px; font-size: 14px; }
  .pv-card { padding: 18px 22px; }
  .nr-card { max-height: 88dvh; }
}

/* 暂停按钮：暂停中显示为「继续」，用青碧勾一下 */
.actions button.on { color: var(--cue); border-color: rgba(69, 179, 154, .55); background: var(--cue-dim); }

/* 设置面板页签：对局 / 外观，各自一屏放得下 */
.nr-tabs {
  display: flex; gap: 5px;
  padding: 4px;
  margin: -4px 0 14px;
  border-radius: 12px;
  background: var(--surface-sunk);
  border: 1px solid var(--border);
}
.nr-tabs button {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-dim);
  font-size: 12.5px;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background var(--dur-2), color var(--dur-2);
}
.nr-tabs button:hover { color: var(--text); }
.nr-tabs button.on { background: var(--surface-3); color: var(--text); box-shadow: inset 0 1px 0 var(--hairline-top); }
.nr-pane.hidden { display: none; }

/* 外观页：短设置行改成「标签在左、选项在右」，一屏放得下 */
.nr-row--inline { display: flex; align-items: center; gap: 12px; }
.nr-row--inline .nr-lab { margin-bottom: 0; flex: 0 0 78px; flex-direction: column; align-items: flex-start; gap: 1px; line-height: 1.25; }
.nr-row--inline .nr-chips, .nr-row--inline .av-pick { flex: 1; }
.nr-row--inline .nr-chips button { min-width: 0; height: 30px; padding: 0 10px; font-size: 12px; }
.nr-pane[data-pane="look"] .nr-row { margin-bottom: 10px; }
.nr-pane[data-pane="look"] .sk-thumb { width: 46px; height: 46px; }
.nr-pane[data-pane="look"] .sk-card { padding: 6px 3px 5px; gap: 4px; }

/* 手机棋盘下方：把手数/子力之上那行大字利用起来（桌面隐藏） */
.ml-turn { display: none; }
@media (max-width: 719px) {
  .ml-turn {
    display: block;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    letter-spacing: .22em;
    text-indent: .22em;
    color: var(--text-dim);
    transition: color var(--dur-3);
  }
  .ml-turn.r { color: #ff9c86; text-shadow: 0 0 24px rgba(226, 84, 60, .45); }
  .ml-turn.b { color: #9fd8c4; text-shadow: 0 0 24px rgba(69, 179, 154, .4); }
  .ml-turn.paused { color: var(--text-faint); font-size: 22px; }
  .ml-mid { gap: 12px; }
  .ml-mid .ml-line { font-size: 11.5px; }
}

/* 手机：棋盘全出血，没有上沿留白 —— 播报/回合胶囊会压住第一排棋子，改到别处 */
@media (max-width: 719px) {
  .move-toast { display: none; }
  .turn-banner { display: none; }

  /* 悔棋/求和/暂停请求：改成屏幕中央的浮层，不遮棋子也更好点 */
  .offer-bar {
    position: fixed;
    left: 50%;
    top: 42%;
    bottom: auto;
    width: min(340px, 86vw);
    transform: translate(-50%, calc(-50% - 8px)) scale(.97);
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 10px;
    padding: 14px 14px 12px;
    border-radius: 16px;
    white-space: normal;
    text-align: center;
  }
  .offer-bar.show { transform: translate(-50%, -50%) scale(1); }
  .ob-text { font-size: 13.5px; }
  .ob-more { display: none; }
  .ob-actions { flex: 1 0 100%; justify-content: center; }
  .ob-actions button { height: 38px; padding: 0 22px; font-size: 13px; border-radius: 19px; }
}

/* 吃重子（车/士/相）时整屏一闪：很轻，但会让人"感觉到那一下" */
.fx-veil.k-cap {
  background: radial-gradient(closest-side at 50% 50%, rgba(255, 214, 170, .16), rgba(255, 214, 170, 0) 72%);
  animation: fxVeilIn .34s ease-out both;
}
.fx-veil.k-cap-gold {
  background: radial-gradient(closest-side at 50% 50%, rgba(255, 208, 130, .22), rgba(255, 208, 130, 0) 72%);
  animation: fxVeilIn .34s ease-out both;
}
/* 对方吃我的子：冷白暗角收一下，中心不遮（丢子的"疼"，但不挡看盘） */
.fx-veil.k-cap-cold {
  background: radial-gradient(ellipse at 50% 50%, rgba(120, 168, 190, 0) 34%, rgba(90, 130, 150, .34) 76%, rgba(20, 26, 30, .6) 100%);
  animation: fxVignette .48s ease-out both;
}
@keyframes fxVignette {
  0% { opacity: 0; }
  22% { opacity: 1; }
  100% { opacity: 0; }
}

/* ============================================================
   v11 · 手机重排（覆盖层，全部放在最后，方便整体回退）
   目标顺序：操作条 → 状态 → 子力 → 对手 → 棋盘 → 自己 → 输入
   ============================================================ */
.lh-art { display: none; }
.chat-log-btn { display: none; }

/* 暂停按钮：文字与图标两套内容都由 data-* 提供，手机上只留图标省位置 */
#btn-pause { font-size: 0; }
#btn-pause::after { content: attr(data-label); font-size: 13px; letter-spacing: .04em; }

/* 弹幕：挂在棋盘上方预留带里，不压棋子 */
.dm-layer {
  position: absolute; left: 0; right: 0; top: -34px;
  height: 26px; overflow: hidden;
  pointer-events: none; z-index: 9;
}
.dm-item {
  position: absolute; top: 0; right: 0;
  max-width: 76vw; display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 12px; border-radius: 999px;
  background: rgba(10, 11, 15, .68);
  border: 1px solid rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  will-change: transform;
  animation: dmRide var(--dm-dur, 7500ms) linear forwards;
}
.dm-item > b { font-size: 9.5px; font-weight: 500; color: var(--accent-2); letter-spacing: .06em; flex: 0 0 auto; }
.dm-item.own > b { color: var(--cue); }
.dm-item.own { border-color: rgba(69, 179, 154, .38); }
@keyframes dmRide {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(calc(-100vw - 100%), 0, 0); }
}
.danmaku-dim .dm-item { opacity: .3; transition: opacity .3s; }
[data-theme="light"] .dm-item { background: rgba(255, 253, 248, .88); border-color: rgba(58, 40, 20, .16); color: #241d15; }

/* 「和电脑下」弹窗 */
.na-card { width: min(430px, calc(100vw - 28px)); padding: 18px 18px 14px; }
.na-slot { margin: 4px 0 2px; }
.na-slot .ai-body { padding: 0; gap: 16px; }
.na-slot .ap-go { margin-top: 10px; }
.na-card .nr-actions { margin-top: 4px; }

@media (max-width: 719px) {
  /* ---------- 首页 hero：右侧象棋图 ---------- */
  .lhero.has-art {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    column-gap: 12px;
    align-items: start;
  }
  .lhero.has-art .lkick { grid-column: 1 / -1; }
  .lhero.has-art h1 { grid-column: 1; }
  .lhero.has-art .lh-art {
    grid-column: 2; grid-row: 2;
    display: block; width: 112px; height: 112px;
    align-self: center; margin-top: 0;
    filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .46));
  }
  .lh-art svg { width: 100%; height: 100%; display: block; }
  .lhero.has-art .lsub,
  .lhero.has-art .lform { grid-column: 1 / -1; }

  /* ---------- 对局：六层固定预算 ---------- */
  .game {
    gap: 0;
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));  /* 底部输入条让位 */
  }

  /* ① 操作条：最顶上，46px 触控 */
  .actions {
    order: 1;
    display: flex; gap: 7px;
    padding: 8px var(--gut) 6px;
    margin: 0;
  }
  .actions button {
    flex: 1 1 0; min-width: 0;
    height: 46px; border-radius: var(--radius-md);
    font-size: 14px; letter-spacing: .06em; font-weight: 500;
  }
  .actions button.danger {
    color: var(--accent); font-weight: 600;
    border-color: var(--accent-ring); background: var(--accent-soft);
  }
  #btn-pause { flex: 0 0 46px; }
  #btn-pause::after { content: attr(data-ico); font-size: 13px; letter-spacing: 0; }

  /* 连麦 / 闭麦 不许被状态条挤没（之前 .gb-r 可收缩，真机上按钮被压到 0 宽） */
  .gb-r { flex: 0 0 auto; }
  .voice-btn, .voice-mute { flex: 0 0 auto; white-space: nowrap; }

  /* ② 状态行（含谁走 / 被将军） */
  .gbar--game {
    order: 2;
    padding: 2px var(--gut) 4px;
    align-items: center;
  }
  .gb-c {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 7px;
    height: 30px; padding: 0 11px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    font-size: 13.5px; letter-spacing: .03em;
  }
  .gb-last {
    display: block; margin-left: auto; flex: 0 1 auto; min-width: 0;
    max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 11px; letter-spacing: 0; color: var(--text-faint);
    font-variant-numeric: tabular-nums;
  }
  .gb-sep { display: none; }
  .gb-c.st-me { background: var(--accent-soft); border-color: var(--accent-ring); }
  .gb-c.st-me .gb-main { color: var(--accent-hi); font-weight: 600; }
  .gb-c.st-check {
    background: var(--accent-soft); border-color: var(--accent);
    animation: ckPulse var(--dur-check, 700ms) ease-in-out infinite;
  }
  .gb-c.st-check .gb-main { color: var(--accent); font-weight: 700; }
  @keyframes ckPulse { 50% { box-shadow: 0 0 0 3px var(--accent-soft); } }

  /* ③ 子力条：从隐藏改为 20px 细条 */
  .force {
    order: 3;
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) 26px auto;
    column-gap: 8px; align-items: center;
    height: 20px;
    padding: 0 var(--gut);
    background: none; border: 0; border-radius: 0;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .force-h, .force-n { display: contents; }
  .force-h > span:first-child { display: none; }
  .force-bar { grid-column: 2; grid-row: 1; height: 5px; border-radius: 3px; gap: 2px; }
  .force-n > span { grid-row: 1; font-size: 10.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
  .force-n > span:first-child { grid-column: 1; text-align: left; color: var(--accent); }
  .force-n > span:last-child { grid-column: 3; text-align: right; color: var(--cue); }
  .force-d { grid-column: 4; grid-row: 1; justify-self: end; font-size: 9.5px; min-width: 40px; text-align: right; }

  /* ④ 对手 */
  #seat-top {
    order: 4;
    height: 40px;
    padding: 2px var(--gut) 0;
  }
  #seat-top .clock { font-size: 18px; color: var(--text-dim); }
  #seat-top.turn .clock { color: var(--text); }

  /* ⑤ 棋盘：吃掉全部余量，上下居中 */
  .board-stage {
    order: 5;
    flex: 1 1 0;
    min-height: 0;
    justify-content: center;
    padding: 34px 0 6px;
  }
  .ml-mid { display: none !important; }
  .sheet { order: 6; height: 0; overflow: visible; }
  .sheet-handle { display: none !important; }

  /* ⑧ 自己 */
  #seat-bottom {
    order: 8;
    height: 46px;
    padding: 6px var(--gut) 2px;
    border-top: 1px solid var(--glass-line);
  }
  #seat-bottom .clock { font-size: 26px; font-weight: 300; }
  #seat-bottom .clock .ck-s { font-size: 10px; }

  /* ⑨ 底部输入：把抽屉里那个真表单固定到底部，不再"点一下才出" */
  .chat-block { display: block; }
  .chat-block .pb-head, .chat-block .chat-log { display: none; }
  .chat-form {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 76;
    display: flex; align-items: center; gap: 8px;
    height: 58px;
    padding: 6px var(--gut) calc(6px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(10, 12, 16, 0) 0%, rgba(10, 12, 16, .82) 22%, rgba(10, 12, 16, .98) 100%);
    border: 0;
  }
  [data-theme="light"] .chat-form {
    background: linear-gradient(180deg, rgba(247, 242, 232, 0) 0%, rgba(247, 242, 232, .9) 22%, rgba(247, 242, 232, .99) 100%);
  }
  .chat-form input {
    flex: 1; min-width: 0; height: 44px;
    padding: 0 15px;
    border-radius: 999px;
    background: var(--surface-2, rgba(255, 255, 255, .06));
    border: 1px solid var(--glass-line);
    color: var(--text); font-size: 14px;
  }
  .chat-form input::placeholder { color: var(--text-faint); }
  .chat-form input:focus { outline: none; border-color: var(--accent-ring); }
  .chat-send { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 44px; }
  .chat-form { padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }

  /* 抽屉抬高，别压住输入框 */
  .sheet.open {
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    height: 48dvh;
    z-index: 71;
  }
  .sheet.open .pb-head { display: flex; }
  .sheet.open .chat-log { display: block; }

  /* 气泡取消：输入框左侧已有「记录」按钮，不再悬浮一个挡视线的圆球 */
  .chat-fab { display: none; }
  .chat-log-btn {
    display: block;
    flex: 0 0 40px; width: 40px; height: 44px;
    border: 0; background: none; color: var(--text-faint);
    font-size: 16px; line-height: 1;
  }
  .chat-log-btn:active { color: var(--text); }

  /* 手机：认输确认改成底部 action sheet，不再糊在棋盘中央 */
  .ask { align-items: flex-end; padding: 0; }
  .ask-card {
    width: 100%; max-width: none;
    max-height: 88dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px var(--gut) calc(16px + env(safe-area-inset-bottom, 0px));
    animation: askUp .26s cubic-bezier(.32, .72, 0, 1) both;
  }
  @keyframes askUp { from { transform: translateY(100%); } to { transform: none; } }
  .ask-actions { flex-direction: column-reverse; gap: 8px; }
  .ask-actions button { width: 100%; height: 48px; }
  #newai { align-items: center; padding: 16px; }
  #newai .ask-card { border-radius: var(--radius-lg); padding: 18px; animation: none; }
  .na-card { width: min(430px, calc(100vw - 32px)); }
}

/* ============================================================
   v12 · 双钟层级 / 空房态 / 最近两手 / 横屏
   ============================================================ */
/* 最近两手：棋盘下沿内侧（落在盘面边距里，不压棋子），桌面有完整棋谱就不显示 */
/* 棋盘里没有空白能放这行（底边距 31px，棋子占 47px），改由状态行右侧的「上一手」承担 */
.recent-moves { display: none; }

/* 双钟层级：只有行棋方的钟在上色，另一方静止 */
.seat .clock.running .ck-m { color: var(--text); }
.seat .clock.low { color: var(--accent); }

.invite-cta { display: none; }

@media (max-width: 719px) {
  /* ② 空房态：顶栏换成房间码 + 复制邀请 */
  .room-waiting .actions { display: none; }
  .room-waiting .invite-cta {
    order: 1;
    display: flex; align-items: center; gap: 12px;
    padding: 8px var(--gut) 6px;
  }
  .invite-cta .ivc-code {
    flex: 0 0 auto; font-size: 12px; letter-spacing: .1em; color: var(--text-dim);
  }
  .invite-cta .ivc-code b {
    font-family: var(--font-num); font-size: 18px; letter-spacing: .16em;
    color: var(--text); margin-left: 4px;
  }
  .invite-cta button { flex: 1; height: 46px; border-radius: var(--radius-md); font-size: 14px; }
}

/* ⑤ 横屏（手机横过来）：左棋盘 + 右侧 220px 竖列 */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1023px) {
  .game {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 228px;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    column-gap: 14px;
    padding: 0 12px calc(56px + env(safe-area-inset-bottom, 0px)) 0;
  }
  .seats { display: contents; }
  .invite-cta, .actions { grid-column: 2; grid-row: 1; padding: 6px 0 4px; margin: 0; }
  .gb-l { display: none; }
  .force {
    grid-column: 2; grid-row: 3; display: grid;
    grid-template-columns: 26px minmax(0, 1fr) 26px auto;
    column-gap: 8px; align-items: center; height: 20px; padding: 4px 0 0;
    background: none; border: 0; border-radius: 0;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .force-h, .force-n { display: contents; }
  .force-h > span:first-child { display: none; }
  .force-bar { grid-column: 2; grid-row: 1; height: 5px; border-radius: 3px; gap: 2px; }
  .force-n > span { grid-row: 1; font-size: 10.5px; color: var(--text-faint); }
  .force-n > span:first-child { grid-column: 1; text-align: left; color: var(--accent); }
  .force-n > span:last-child { grid-column: 3; text-align: right; color: var(--cue); }
  .force-d { grid-column: 4; grid-row: 1; justify-self: end; font-size: 9.5px; min-width: 40px; text-align: right; }
  .room-waiting .invite-cta { padding: 6px 0 4px; }
  .gbar--game { grid-column: 2; grid-row: 2; padding: 0; }
  .force { grid-column: 2; grid-row: 3; padding: 4px 0 0; }
  #seat-top { grid-column: 2; grid-row: 4; align-self: start; padding: 6px 0 0; height: auto; }
  .board-stage { grid-column: 1; grid-row: 1 / 6; padding: 0; justify-content: center; }
  #seat-bottom { grid-column: 2; grid-row: 5; padding: 4px 0 0; height: auto; border-top: 0; }
  /* .rail 必须 contents，否则 .actions 会被包在第 1 列里横跨整个棋盘 */
  .rail { display: contents; }
  .sheet, .sheet-body, .chat-block {
    display: block; height: 0; position: static;
    transform: none; filter: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .actions {
    grid-column: 2; grid-row: 1;
    display: flex; gap: 6px; padding: 6px 0 4px; margin: 0;
  }
  .actions button { flex: 1 1 0; min-width: 0; height: 40px; font-size: 12.5px; }
  #btn-pause { flex: 0 0 40px; font-size: 0; }
  #btn-pause::after { content: attr(data-ico); font-size: 12px; }
  /* 状态行：左侧状态（可截断）+ 右侧连麦/退出，同一行放得下 */
  .gbar--game {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    align-items: center; column-gap: 6px;
    padding: 0; height: auto;
  }
  .gb-c { min-width: 0; height: 26px; font-size: 12.5px; }
  .gb-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gb-last, .gb-sep { display: none; }
  .gb-r { justify-content: flex-end; gap: 6px; }
  .gb-spec { display: none; }
  .gb-exit { width: 26px; height: 26px; }
  .chat-form {
    position: fixed; left: auto; right: 0; bottom: 0; width: 232px;
    display: flex; align-items: center; gap: 8px; height: 52px;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px)) 0;
    background: none; border: 0;
  }
  .chat-form input {
    flex: 1; min-width: 0; height: 40px; padding: 0 12px;
    border-radius: 999px; background: rgba(255, 255, 255, .06);
    border: 1px solid var(--glass-line); color: var(--text); font-size: 13px;
  }
  .chat-send { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; }
  .dm-layer { top: 4px; height: 22px; }
  .recent-moves { display: none; }
}

/* ============================================================
   v13 · 手机对战界面从零重排（senior-ui）
   设计主张：棋盘是主角；提示贴棋盘上沿；拇指管操作；聊天收进抽屉。
   竖屏层级：顶栏 → 对手条 → 主提示带 → 棋盘 → 我的条 → 子力 → 操作栏
   只覆盖 ≤719px 与横屏，桌面不受影响。整段可删即回退到 v12。
   ============================================================ */

/* 手机专用元素：桌面一律不出现 */
.cue-bar, .gb-ico { display: none; }

/* 弹幕：改走「河界」。棋盘上下边距相等、河界正好在盘面正中，
   所以 top:50% 精确落在河界带上 —— 全盘唯一永远不会有棋子停留的横带。 */
@media (max-width: 719px) {
  .dm-layer { top: calc(50% - 13px); height: 26px; }
}

/* ---------- 竖屏 ---------- */
@media (max-width: 719px) {
  :root {
    --m-gbar: 48px;
    --m-seat-op: 52px;
    --m-cue: 44px;
    --m-seat-me: 56px;
    --m-act-btn: 54px;
    --m-act-pad: 9px;
  }

  .game {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
  }
  .seats, .rail { display: contents; }
  /* 子力并进棋盘下方的「最近两手」条，不再单独占一行 */
  .force { display: none; }

  /* ① 顶栏：房间码（左）· 连麦 / 对话 / 退出（右）。状态胶囊让位给提示带 */
  .gbar--game {
    order: 1;
    flex: 0 0 var(--m-gbar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: var(--m-gbar);
    padding: 0 var(--gut);
  }
  .gb-c { display: none; }
  .gb-l { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
  .gb-room { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gb-room b { font-size: 13px; }
  #btn-copy { display: none; }              /* 空房态由底部邀请栏承担，对局中不需要 */
  .gb-spec { display: none; }              /* 观战数是元信息，让位 */
  .gb-r { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

  .voice-btn, .voice-mute {
    display: inline-flex; align-items: center; gap: 5px;
    height: 40px; min-width: 44px; padding: 0 12px;
    border-radius: 20px;
    border: 1px solid var(--glass-line);
    background: rgba(255, 255, 255, .06);
    font-size: 12.5px; color: var(--text-dim);
    white-space: nowrap;
  }
  .voice-btn[hidden], .voice-mute[hidden] { display: none; }
  .voice-btn.ringing { color: var(--accent); border-color: var(--accent-ring); background: var(--accent-soft); }

  .gb-ico, .gb-exit {
    position: relative;
    display: grid; place-items: center;
    width: 44px; height: 44px; padding: 0;
    background: none; border: 0; border-radius: 50%;
    color: var(--text-dim);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .gb-ico svg { width: 19px; height: 19px; }
  .gb-ico::before, .gb-exit::before {
    content: "";
    position: absolute; left: 50%; top: 50%;
    width: 34px; height: 34px; margin: -17px 0 0 -17px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--glass-line);
  }
  .gb-ico svg, .gb-exit::after { position: relative; z-index: 1; }
  .gb-exit { font-size: 0; }
  .gb-exit::after { content: "✕"; font-size: 13px; color: var(--text-dim); }
  .gb-ico:active::before, .gb-exit:active::before { background: rgba(255, 255, 255, .12); }

  .fbadge {
    position: absolute; right: 3px; top: 3px; z-index: 2;
    min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: 9px;
    display: grid; place-items: center;
    font-size: 10px; font-weight: 700; font-style: normal;
    color: #fff; background: var(--accent);
    border: 1.5px solid var(--bg);
    font-variant-numeric: tabular-nums;
  }
  .fbadge[hidden] { display: none; }

  /* ② 对手条 */
  #seat-top {
    order: 2;
    flex: 0 0 var(--m-seat-op);
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    height: var(--m-seat-op);
    padding: 0 var(--gut);
    margin: 0;
    background: none; border: 0; border-radius: 0;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  #seat-top .avatar { display: grid; width: 32px; height: 32px; font-size: 15px; }
  #seat-top .seat-name { font-size: 13.5px; }
  #seat-top .clock { grid-column: 3; margin: 0; font-size: 19px; color: var(--text-dim); }
  #seat-top .clock .ck-s { font-size: 9.5px; }
  #seat-top.turn .clock { color: var(--text); }
  #seat-top.turn { background: linear-gradient(90deg, var(--accent-soft), transparent 55%); }

  /* ③ 主提示带：浮在棋盘舞台顶边，紧贴棋盘上沿 —— 视觉焦点正上方 */
  .board-stage {
    order: 3;
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--m-cue) 0 8px;
    width: 100%;
  }
  .cue-bar {
    position: absolute;
    left: 0; right: 0;
    top: calc(var(--m-gbar) + var(--m-seat-op));
    height: var(--m-cue);
    display: flex; align-items: center; gap: 10px;
    padding: 0 var(--gut);
    z-index: 8;
    pointer-events: none;
  }
  .cue-pill {
    display: inline-flex; align-items: center; gap: 8px;
    flex: 0 1 auto; min-width: 0;
    height: 32px; padding: 0 15px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 14.5px; font-weight: 500; letter-spacing: .05em;
    color: var(--text-dim);
    white-space: nowrap;
  }
  .cue-pill b { font-weight: inherit; overflow: hidden; text-overflow: ellipsis; }
  .cue-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-faint); flex: 0 0 auto;
  }
  .cue-sub {
    margin-left: auto; flex: 0 1 auto; min-width: 0;
    font-size: 11px; letter-spacing: .02em;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* 强弱层级：被将军 > 该你走 > 暂停 > 普通 */
  .cue-bar.st-me .cue-pill {
    height: 34px; padding: 0 16px;
    font-size: 15.5px; font-weight: 700;
    color: var(--text-invert);
    background: var(--accent-fill);
    box-shadow: 0 8px 20px -10px rgba(226, 84, 60, .95);
  }
  .cue-bar.st-me .cue-dot { background: var(--text-invert); animation: cueBeat 1.2s var(--ease-inout) infinite; }
  @keyframes cueBeat { 50% { opacity: .35; transform: scale(.7); } }
  /* 被将军：比「该你走」更亮 + 整圈脉冲，一眼分得出 */
  .cue-bar.st-check .cue-pill {
    height: 36px; padding: 0 17px;
    font-size: 16px; font-weight: 700;
    color: var(--text-invert);
    background: var(--accent);
    border-color: rgba(255, 255, 255, .28);
    box-shadow: 0 0 0 0 var(--accent-ring);
    animation: ckPulse var(--dur-check, 700ms) ease-in-out infinite;
  }
  .cue-bar.st-check .cue-dot { background: var(--text-invert); animation: none; }
  .cue-bar.st-pause .cue-pill {
    color: var(--accent-2);
    background: var(--accent-2-soft);
    border-color: var(--border-brass);
    box-shadow: none;
  }
  .cue-bar.st-pause .cue-dot { background: var(--accent-2); }
  .cue-bar.st-end .cue-pill { color: var(--text-faint); box-shadow: none; }

  /* 请求条（悔棋/求和）：占提示带同一条位置，z 更高 —— 有人请你决定时它最大。
     旧层把它设成 position:fixed + flex-wrap:wrap（会飘到屏幕顶并把按钮挤到第二行），必须逐项覆盖。 */
  .offer-bar {
    position: absolute;
    left: 8px; right: 8px; top: 4px; bottom: auto;
    width: auto;
    transform: translate(0, -8px);
    height: calc(var(--m-cue) - 8px);
    padding: 0 8px 0 14px;
    border-radius: 999px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    row-gap: 0;
    text-align: left;
    font-size: 13px;
    z-index: 30;
    background: rgba(16, 18, 25, .97);
  }
  .offer-bar.show { transform: translate(0, 0); }
  .offer-bar .ob-text { flex: 1 1 auto; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
  .offer-bar .ob-more { display: none; }
  .offer-bar .ob-actions { flex: 0 0 auto; justify-content: flex-end; gap: 6px; }
  .offer-bar .ob-actions button { height: 32px; min-width: 52px; padding: 0 14px; font-size: 13px; border-radius: 16px; }

  /* 着法播报：提示带右侧已常驻「上一手」，盘面也有落子高亮 —— 手机上重复且必然压棋盘，去掉 */
  .move-toast { display: none; }
  /* 回合胶囊：提示带已常驻说清谁走，冗余，去掉 */
  .turn-banner { display: none !important; }

  /* 「最近两手 + 子力」条：只在高屏有余量时出现，短屏藏起来把空间还给棋盘
     （必须 !important：v11 留了一条 .ml-mid { display:none !important }） */
  .ml-mid {
    display: none !important;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center; justify-content: space-between;
    gap: 14px;
    width: 100%;
    height: 40px;
    margin-top: 10px;
    padding: 0 var(--gut);
    font-size: 12px; letter-spacing: .04em;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
  }
  .ml-turn { display: none !important; }
  .ml-line { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ml-line b { font-weight: 500; color: var(--text-dim); }
  .ml-force { display: flex; align-items: center; gap: 8px; flex: 0 0 148px; width: auto; }
  .mlf-n { font-size: 11px; font-variant-numeric: tabular-nums; min-width: 16px; text-align: center; }
  .mlf-n:first-child { color: var(--accent); }
  .mlf-n:last-child { color: var(--cue); }
  .mlf-bar { display: flex; flex: 1; height: 4px; border-radius: 2px; overflow: hidden; gap: 2px; background: rgba(255, 255, 255, .07); }
  .mlf-bar i { display: block; height: 100%; transition: width var(--dur-4) var(--ease-out); }
  .mlf-bar .fr { background: linear-gradient(90deg, #b8331f, #e2543c); }
  .mlf-bar .fb { background: linear-gradient(90deg, #2f4a42, #45b39a); }

  /* ④ 我的条 */
  #seat-bottom {
    order: 4;
    flex: 0 0 var(--m-seat-me);
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    height: var(--m-seat-me);
    padding: 0 var(--gut);
    margin: 0;
    background: none; border: 0; border-top: 0; border-radius: 0;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  #seat-bottom .avatar { display: grid; width: 36px; height: 36px; font-size: 16px; }
  #seat-bottom .seat-name { font-size: 14px; }
  #seat-bottom .clock { grid-column: 3; margin: 0; font-size: 25px; color: var(--text-dim); }
  #seat-bottom .clock .ck-s { font-size: 10px; }
  #seat-bottom.turn .clock { color: var(--text); }
  #seat-bottom.turn { background: linear-gradient(90deg, var(--accent-soft), transparent 55%); }

  /* ⑤ 操作栏：拇指区，4 个等宽大按钮；危险操作靠右、描边不填色 */
  .actions {
    order: 6;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: var(--m-act-pad) var(--gut) calc(var(--m-act-pad) + env(safe-area-inset-bottom, 0px));
    margin: 0;
  }  .actions button {
    height: var(--m-act-btn);
    min-width: 0;
    border-radius: var(--radius-md);
    font-size: 14.5px; font-weight: 500; letter-spacing: .08em;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  #btn-pause { flex: none; font-size: 14.5px; }
  #btn-pause::after { content: attr(data-label); font-size: 14.5px; letter-spacing: .08em; }
  #btn-pause.on { color: var(--accent-2); border-color: var(--border-brass); background: var(--accent-2-soft); }
  .actions button.danger {
    color: var(--accent);
    background: none;
    border: 1px dashed var(--accent-ring);
  }

  /* 空房态：底部换成一条邀请栏，四个对局按钮不出现（都是灰的，白占一行） */
  .invite-cta {
    order: 6;
    display: none;
    align-items: center; gap: 12px;
    padding: var(--m-act-pad) var(--gut) calc(var(--m-act-pad) + env(safe-area-inset-bottom, 0px));
  }
  .room-waiting .invite-cta { order: 6; display: flex; }
  .room-waiting .actions,
  .room-waiting #seat-bottom { display: none; }
  .invite-cta .ivc-code {
    flex: 0 0 auto; font-size: 12px; letter-spacing: .1em; color: var(--text-dim);
  }
  .invite-cta .ivc-code b {
    font-family: var(--font-num); font-size: 19px; letter-spacing: .16em;
    color: var(--text); margin-left: 4px;
  }
  .invite-cta button {
    flex: 1; height: var(--m-act-btn);
    border-radius: var(--radius-md); font-size: 15px; letter-spacing: .06em;
  }

  /* 聊天/棋谱抽屉：不占布局，只有打开才存在 */
  .sheet { display: none; }
  .sheet-handle { display: none !important; }
  .chat-fab { display: none !important; }
  .sheet.open {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 71;
    display: flex;
    flex-direction: column;
    height: min(62dvh, 460px);
    margin: 0;
    padding: 0 var(--gut) calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 24px 24px 0 0;
    border: 0; border-top: 1px solid rgba(255, 255, 255, .1);
    background: linear-gradient(180deg, rgba(20, 23, 31, .98), rgba(9, 11, 16, .995));
    -webkit-backdrop-filter: blur(26px); backdrop-filter: blur(26px);
    box-shadow: 0 -30px 70px -24px rgba(0, 0, 0, .92);
    overflow: hidden;
    animation: sheetIn .34s cubic-bezier(.32, .72, 0, 1) both;
  }
  [data-theme="light"] .sheet.open {
    background: linear-gradient(180deg, rgba(255, 253, 248, .98), rgba(244, 237, 224, .99));
  }
  .sheet.open.closing { animation: sheetOut .24s var(--ease-fade) both; }
  /* 抽屉里两个 tab：棋谱 / 对话 */
  .sheet.open .sheet-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .sheet.open .moves-block { display: flex; flex: 0 0 auto; max-height: 34%; border-bottom: 1px solid var(--glass-line); }
  .sheet.open .moves { padding: 4px 0 6px; }
  .sheet.open .chat-block { display: flex; flex: 1; min-height: 0; border-top: 0; }
  .sheet.open .pb-head { display: flex; flex: 0 0 auto; padding: 12px 0 10px; border-bottom: 1px solid var(--glass-line); }
  .sheet.open .pb-title { font-size: 12px; letter-spacing: .18em; color: var(--text-dim); }
  .sheet.open .pb-close {
    display: block; margin-left: auto; min-width: 44px; height: 30px;
    background: none; border: 0; padding: 0;
    color: var(--text-faint); font-size: 12px; letter-spacing: .08em;
  }
  .sheet.open .chat-log { display: block; flex: 1; min-height: 0; max-height: none; padding: 12px 0 8px; gap: 12px; }
  /* 输入框回到抽屉里（v11 把它钉在屏幕底部，白占 58px） */
  .sheet.open .chat-form {
    position: static;
    display: flex; align-items: center; gap: 8px;
    height: auto;
    padding: 10px 0 2px;
    background: none; border: 0; border-top: 1px solid var(--glass-line);
  }
  .sheet.open .chat-form input {
    flex: 1; min-width: 0; height: 44px; padding: 0 15px;
    border-radius: 999px; font-size: 14px;
    background: var(--surface-2, rgba(255, 255, 255, .06));
    border: 1px solid var(--glass-line); color: var(--text);
  }
  .sheet.open .chat-send { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; }
  .sheet.open .chat-log-btn { display: none; }
}

/* 高屏才放出「最近两手 + 子力」条（短屏把空间还给棋盘） */
@media (max-width: 719px) and (min-height: 760px) {
  .ml-mid { display: flex !important; }
  .room-waiting .ml-mid { display: none !important; }
}

/* 小屏紧凑档：360×640 这类必须全宽棋盘又不能溢出的机器 */
@media (max-width: 719px) and (max-height: 700px) {
  :root {
    --m-gbar: 44px;
    --m-seat-op: 38px;
    --m-cue: 32px;
    --m-seat-me: 40px;
    --m-act-btn: 44px;
    --m-act-pad: 5px;
  }
  .board-stage { padding-bottom: 6px; }
  .cue-pill { height: 26px; font-size: 13px; padding: 0 12px; }
  .cue-bar.st-me .cue-pill, .cue-bar.st-check .cue-pill { height: 28px; font-size: 14px; }
  #seat-top .avatar { width: 26px; height: 26px; font-size: 12px; }
  #seat-top .clock { font-size: 17px; }
  #seat-bottom .avatar { width: 28px; height: 28px; font-size: 13px; }
  #seat-bottom .clock { font-size: 21px; }
  .voice-btn, .voice-mute { height: 34px; }
  .actions button { font-size: 13.5px; }
  #btn-pause::after { font-size: 13.5px; }
}

/* ---------- 横屏（手机横过来）：左棋盘 + 右 232px 竖列 ---------- */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1023px) {
  :root { --l-gbar: 40px; --l-cue: 36px; --l-seat: 42px; --l-force: 16px; --l-act: 42px; }

  .game {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 232px;
    grid-template-rows: var(--l-gbar) var(--l-cue) var(--l-seat) minmax(0, 1fr) var(--l-force) var(--l-seat) auto;
    column-gap: 14px;
    padding: 0 12px 0 0;
    overflow: hidden;
  }
  .seats, .rail { display: contents; }

  /* 右列：顶栏 → 提示带 → 对手 → 弹性空白 → 子力 → 我 → 操作栏 */
  .gbar--game {
    grid-column: 2; grid-row: 1;
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    height: var(--l-gbar); padding: 0;
  }
  .gb-c { display: none; }
  .gb-l { display: flex; min-width: 0; flex: 1 1 auto; }
  #btn-copy, .gb-spec { display: none; }
  .gb-r { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
  .voice-btn, .voice-mute {
    display: inline-flex; align-items: center; gap: 4px;
    height: 32px; min-width: 44px; padding: 0 9px;
    border-radius: 16px; border: 1px solid var(--glass-line);
    background: rgba(255, 255, 255, .06);
    font-size: 11.5px; color: var(--text-dim); white-space: nowrap;
  }
  .voice-btn[hidden], .voice-mute[hidden] { display: none; }
  .gb-ico, .gb-exit {
    position: relative; display: grid; place-items: center;
    width: 40px; height: 40px; padding: 0;
    background: none; border: 0; border-radius: 50%;
    color: var(--text-dim);
  }
  .gb-ico svg { width: 17px; height: 17px; }
  .gb-ico::before, .gb-exit::before {
    content: ""; position: absolute; left: 50%; top: 50%;
    width: 30px; height: 30px; margin: -15px 0 0 -15px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--glass-line);
  }
  .gb-ico svg, .gb-exit::after { position: relative; z-index: 1; }
  .gb-exit { font-size: 0; }
  .gb-exit::after { content: "✕"; font-size: 12px; color: var(--text-dim); }

  .cue-bar {
    grid-column: 2; grid-row: 2;
    position: static;
    display: flex; align-items: center; gap: 8px;
    height: var(--l-cue); padding: 0;
    pointer-events: none;
  }  .cue-pill {
    display: inline-flex; align-items: center; gap: 6px;
    flex: 0 1 auto; min-width: 0;
    height: 28px; padding: 0 12px;
    border-radius: 999px; border: 1px solid transparent;
    font-size: 13px; font-weight: 500; letter-spacing: .04em;
    color: var(--text-dim); white-space: nowrap;
  }
  .cue-pill b { font-weight: inherit; overflow: hidden; text-overflow: ellipsis; }
  .cue-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); flex: 0 0 auto; }
  .cue-sub {
    margin-left: auto; flex: 0 1 auto; min-width: 0;
    font-size: 10.5px; color: var(--text-faint);
    font-variant-numeric: tabular-nums;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cue-bar.st-me .cue-pill {
    height: 30px; font-size: 14px; font-weight: 700;
    color: var(--text-invert); background: var(--accent-fill);
  }
  .cue-bar.st-me .cue-dot { background: var(--text-invert); animation: cueBeat 1.2s var(--ease-inout) infinite; }
  .cue-bar.st-check .cue-pill {
    height: 32px; font-size: 14.5px; font-weight: 700;
    color: var(--text-invert); background: var(--accent);
    border-color: rgba(255, 255, 255, .28);
    animation: ckPulse var(--dur-check, 700ms) ease-in-out infinite;
  }
  .cue-bar.st-check .cue-dot { background: var(--text-invert); animation: none; }
  .cue-bar.st-pause .cue-pill { color: var(--accent-2); background: var(--accent-2-soft); border-color: var(--border-brass); box-shadow: none; }
  .cue-bar.st-end .cue-pill { box-shadow: none; }

  #seat-top {
    grid-column: 2; grid-row: 3;
    display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center; gap: 8px;
    height: var(--l-seat); padding: 0; margin: 0;
    background: none; border: 0; border-radius: 0;
  }
  #seat-top .avatar { display: grid; width: 28px; height: 28px; font-size: 13px; }
  #seat-top .clock { grid-column: 3; margin: 0; font-size: 17px; color: var(--text-dim); }
  #seat-top .clock .ck-s { font-size: 9px; }
  #seat-top.turn { background: linear-gradient(90deg, var(--accent-soft), transparent 55%); }

  /* 第 4 行留空：给 offer-bar / 着法播报 / 弹幕余量，棋盘不受影响 */
  .board-stage {
    grid-column: 1; grid-row: 1 / 8;
    position: relative;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 0; min-height: 0;
  }
  /* 请求条：横屏放进右栏那块空地（舞台宽 = 左栏宽，右栏 = 100% + 14px），绝不压棋盘 */
  .offer-bar {
    position: absolute;
    left: calc(100% + 14px); right: auto; bottom: auto;
    width: 232px; top: 122px;
    transform: translate(0, -8px);
    height: 44px; padding: 0 8px 0 12px;
    border-radius: var(--radius-md);
    flex-wrap: nowrap;
    justify-content: flex-start;
    row-gap: 0;
    text-align: left;
    font-size: 12px; z-index: 30;
    white-space: normal;
  }
  .offer-bar.show { transform: translate(0, 0); }
  .offer-bar .ob-text { flex: 1 1 auto; min-width: 0; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .offer-bar .ob-more { display: none; }
  .offer-bar .ob-actions { flex: 0 0 auto; justify-content: flex-end; gap: 5px; }
  .offer-bar .ob-actions button { height: 30px; min-width: 42px; padding: 0 8px; font-size: 12px; border-radius: 15px; }
  .move-toast { display: none; }
  .turn-banner { display: none !important; }

  .force {
    grid-column: 2; grid-row: 5;
    display: grid; grid-template-columns: 22px minmax(0, 1fr) 22px auto;
    column-gap: 7px; align-items: center;
    height: var(--l-force); padding: 0;
    background: none; border: 0; border-radius: 0;
  }
  .force-h, .force-n { display: contents; }
  .force-h > span:first-child { display: none; }
  .force-bar { grid-column: 2; grid-row: 1; height: 4px; border-radius: 2px; gap: 2px; }
  .force-n > span { grid-row: 1; font-size: 10.5px; font-variant-numeric: tabular-nums; }
  .force-n > span:first-child { grid-column: 1; text-align: left; color: var(--accent); }
  .force-n > span:last-child { grid-column: 3; text-align: right; color: var(--cue); }
  .force-d { grid-column: 4; grid-row: 1; justify-self: end; font-size: 10px; min-width: 40px; text-align: right; }

  #seat-bottom {
    grid-column: 2; grid-row: 6;
    display: grid; grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center; gap: 8px;
    height: var(--l-seat); padding: 0; margin: 0;
    background: none; border: 0; border-top: 0; border-radius: 0;
  }
  #seat-bottom .avatar { display: grid; width: 30px; height: 30px; font-size: 14px; }
  #seat-bottom .clock { grid-column: 3; margin: 0; font-size: 20px; color: var(--text-dim); }
  #seat-bottom .clock .ck-s { font-size: 9.5px; }
  #seat-bottom.turn { background: linear-gradient(90deg, var(--accent-soft), transparent 55%); }

  .actions {
    grid-column: 2; grid-row: 7;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px; padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px)); margin: 0;
  }
  .actions button {
    height: var(--l-act); min-width: 0;
    border-radius: var(--radius-sm);
    font-size: 12.5px; letter-spacing: .04em;
  }
  #btn-pause { font-size: 12.5px; }
  #btn-pause::after { content: attr(data-label); font-size: 12.5px; letter-spacing: .04em; }
  #btn-pause.on { color: var(--accent-2); border-color: var(--border-brass); background: var(--accent-2-soft); }
  .actions button.danger { color: var(--accent); background: none; border: 1px dashed var(--accent-ring); }

  .invite-cta {
    grid-column: 2; grid-row: 7;
    display: none; align-items: center; gap: 8px;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .room-waiting .invite-cta { display: flex; }
  .room-waiting .actions, .room-waiting .force { display: none; }
  .invite-cta .ivc-code { flex: 0 0 auto; font-size: 11px; letter-spacing: .08em; color: var(--text-dim); }
  .invite-cta .ivc-code b { font-family: var(--font-num); font-size: 16px; letter-spacing: .12em; color: var(--text); margin-left: 3px; }
  .invite-cta button { flex: 1; height: var(--l-act); border-radius: var(--radius-sm); font-size: 13px; }

  /* 弹幕：横屏同样走河界 */
  .dm-layer { top: calc(50% - 12px); height: 24px; }
  .dm-item { height: 24px; font-size: 12px; }

  /* 抽屉：横屏从右侧滑出，不挡左边的棋盘 */
  .sheet { display: none; }
  .sheet-handle, .chat-fab { display: none !important; }
  .sheet.open {
    position: fixed;
    left: auto; right: 0; top: 0; bottom: 0;
    width: min(300px, 44vw);
    height: auto;
    z-index: 71;
    display: flex; flex-direction: column;
    margin: 0;
    padding: 0 14px calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 0; border: 0; border-left: 1px solid rgba(255, 255, 255, .1);
    background: linear-gradient(180deg, rgba(20, 23, 31, .98), rgba(9, 11, 16, .995));
    box-shadow: -30px 0 70px -24px rgba(0, 0, 0, .92);
    overflow: hidden;
    animation: sheetInR .3s cubic-bezier(.32, .72, 0, 1) both;
  }
  [data-theme="light"] .sheet.open {
    background: linear-gradient(180deg, rgba(255, 253, 248, .98), rgba(244, 237, 224, .99));
  }
  @keyframes sheetInR { from { transform: translateX(100%); } to { transform: none; } }
  .sheet.open.closing { animation: sheetOutR .22s var(--ease-fade) both; }
  @keyframes sheetOutR { to { transform: translateX(100%); } }
  .sheet.open .sheet-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .sheet.open .moves-block { display: flex; flex: 0 0 auto; max-height: 32%; border-bottom: 1px solid var(--glass-line); }
  .sheet.open .chat-block { display: flex; flex: 1; min-height: 0; border-top: 0; }
  .sheet.open .pb-head { display: flex; flex: 0 0 auto; padding: 10px 0 8px; border-bottom: 1px solid var(--glass-line); }
  .sheet.open .pb-close { display: block; margin-left: auto; min-width: 44px; height: 28px; background: none; border: 0; padding: 0; color: var(--text-faint); font-size: 12px; }
  .sheet.open .chat-log { display: block; flex: 1; min-height: 0; max-height: none; padding: 10px 0 6px; }
  .sheet.open .chat-form {
    position: static; display: flex; align-items: center; gap: 6px;
    height: auto; padding: 8px 0 2px; background: none; border: 0; border-top: 1px solid var(--glass-line);
  }
  .sheet.open .chat-form input {
    flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 999px; font-size: 13px;
    background: var(--surface-2, rgba(255, 255, 255, .06)); border: 1px solid var(--glass-line); color: var(--text);
  }
  .sheet.open .chat-send { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; }
  .sheet.open .chat-log-btn { display: none; }
}

/* ============================================================
   v13 补丁：手机竖屏「有人进房」的大字不盖住主提示带。
   app.js 在 isMobile() && portrait 时给 fxBig 传 cls:'fx-below-cue'，
   并把实测的提示带下沿（+14px）写进内联 padding-top，覆盖
   .fx-word.k-join 的 15vh —— 具体数值必须实测，写死会在不同
   屏高下错位，所以这里只固定对齐方式，不给死像素。
   桌面 / 横屏不匹配本查询，进房特效保持原样。
   ============================================================ */
@media (max-width: 719px) and (orientation: portrait) {
  .fx-word.k-join.fx-below-cue { place-content: start center; }
}

/* ============================================================
   v14 补丁 A：快捷短语（手机）。
   只在抽屉打开时出现，插在 .chat-log 之后、.chat-form 之前：
   竖屏 chat-form 是 fixed 在视口底部的，所以这一行正好落在
   输入框正上方；横屏 chat-form 在侧栏里，这行也在它上面。
   桌面一律 display:none —— 桌面有键盘，且必须保持零污染
   （加一行会把右栏 chat-log 的高度挤掉）。
   ============================================================ */
.chat-quick { display: none; }

@media (max-width: 719px) {
  .sheet.open .chat-quick {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    padding: 8px 0 2px;
    /* 放不下就横向滚，绝不换行撑高抽屉 */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .sheet.open .chat-quick::-webkit-scrollbar { display: none; }
  .sheet.open .cq-btn {
    flex: 0 0 auto;
    height: 36px;
    min-width: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--glass-line);
    background: var(--surface-2, rgba(255, 255, 255, .06));
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
  }
  .sheet.open .cq-btn:active {
    background: var(--accent-soft);
    border-color: var(--accent-ring);
    color: var(--accent-hi);
  }
  .sheet.open .cq-btn.sent { animation: cqSent .32s var(--ease-out) both; }
  @keyframes cqSent {
    0% { transform: scale(1); }
    40% { transform: scale(.94); background: var(--accent-soft); border-color: var(--accent-ring); }
    100% { transform: scale(1); }
  }
}

/* 横屏（812×375 这类）：侧栏抽屉里同样显示 */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1023px) {
  .sheet.open .chat-quick {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    padding: 6px 0 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .sheet.open .chat-quick::-webkit-scrollbar { display: none; }
  .sheet.open .cq-btn {
    flex: 0 0 auto;
    height: 36px;
    min-width: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--glass-line);
    background: var(--surface-2, rgba(255, 255, 255, .06));
    color: var(--text-dim);
    font-size: 12.5px;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
  }
  .sheet.open .cq-btn:active {
    background: var(--accent-soft);
    border-color: var(--accent-ring);
    color: var(--accent-hi);
  }
}

/* ============================================================
   v14 补丁 B：特效三档（自动 / 开 / 关）。
   放在「外观 · 音效」面板里「音效特效」那一行下面，
   直接复用 .nr-chips 的视觉，这里只补一条说明的字号。
   ============================================================ */
#nr-fx button { min-width: 56px; }
