/* AI 象棋馆。颜色变量沿用游戏厅的 games.css（先加载它）；这里是棋盘、棋桌页、首页。类名都带 xq-。
   样子：夜里的棋馆。深色的场子，光打在棋盘上；按钮是能按下去的厚块，菜单用棋子当图标。 */
@font-face { font-family: "XQ Pieces"; src: url("pieces.woff2") format("woff2"); font-display: swap; }
:root {
  --xq-red: #e0432b;
  --paper: #f3efe6;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --piece: "XQ Pieces", "Songti SC", "Noto Serif SC", serif;
}
/* 英文页（/games/xiangqi/，同一份样式）：大标题和终局的字换成拉丁衬线体 */
html:lang(en) { --serif: "Noto Serif", Georgia, "Times New Roman", serif; }
.xq-logo h1 .en { font: 900 clamp(46px, 6.2vw, 80px)/.98 var(--serif); letter-spacing: -.01em; color: var(--paper); text-shadow: 0 5px 0 #000, 0 0 40px rgba(243, 239, 230, .12); }
button { font: inherit; color: inherit; }
body.xq {
  min-height: 100dvh;
  background:
    radial-gradient(70% 60% at 50% 32%, rgba(243, 239, 230, .075), transparent 70%),
    radial-gradient(900px 520px at 0% 0%, rgba(200, 240, 60, .07), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(140, 200, 242, .08), transparent 60%),
    var(--bg);
}
/* 背景里一张看不清的大棋盘 */
body.xq::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(243, 239, 230, .035) 1.5px, transparent 1.5px), linear-gradient(90deg, rgba(243, 239, 230, .035) 1.5px, transparent 1.5px);
  background-size: 96px 96px; background-position: center -20px;
  -webkit-mask-image: radial-gradient(60% 70% at 50% 40%, #000, transparent 75%); mask-image: radial-gradient(60% 70% at 50% 40%, #000, transparent 75%);
}

/* ---------------------------------------------------------------- 棋盘 */
.xq-board { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; font-family: var(--piece); font-weight: 900; }
.xq-board.playable { cursor: pointer; }
.xq-coords text { font: 700 25px var(--mono); fill: #111; opacity: .46; }
.xq-board.nocoords .xq-coords { display: none; }
.xq-pc { transition: transform .26s cubic-bezier(.22, .9, .24, 1); }
.xq-pc.still { transition: none; }
.xq-pc .sh { fill: #111; }
.xq-pc .disc { fill: #faf6ec; stroke: #111; stroke-width: 4.5; }
.xq-pc .ring { fill: none; stroke-width: 2.6; }
.xq-pc.red .ring { stroke: var(--xq-red); }
.xq-pc.red .gl { fill: var(--xq-red); }
.xq-pc.black .ring { stroke: #111; }
.xq-pc.black .gl { fill: #111; }
.xq-pc .gl { font-size: 58px; }
.xq-pc .halo { fill: #c8f03c; stroke: #111; stroke-width: 3; opacity: 0; transition: opacity .1s; }
.xq-pc .body { transition: transform .12s ease-out; }
.xq-pc.sel .halo { opacity: 1; }
.xq-pc.sel .body { transform: translateY(-8px); }
.xq-pc.check .disc { stroke: #ff3b1f; stroke-width: 7; animation: xq-check .9s ease-in-out infinite; }
.xq-pc.in .body, .xq-pc.in .sh { animation: xq-in .26s ease-out both; }
.xq-pc.out .body, .xq-pc.out .sh { animation: xq-out .24s ease-in both; }
.xq-pc.no .body { animation: xq-no .28s ease-out; }
.xq-marks .from, .xq-marks .to, .xq-hints .dot { fill: #c8f03c; stroke: #111; stroke-width: 3.2; }
.xq-hints .take { fill: none; stroke: #ff5a3c; stroke-width: 7.5; stroke-dasharray: 15 9; animation: xq-spin 6s linear infinite; transform-box: fill-box; transform-origin: center; }
.xq-hints .dot { animation: xq-pop .16s ease-out both; transform-box: fill-box; transform-origin: center; }
.xq-board.mini .xq-coords { display: none; }
.xq-board.mini .xq-pc .sh { display: none; }
@keyframes xq-check { 50% { stroke: #ffb199; } }
@keyframes xq-in { from { opacity: 0; transform: scale(.6); } }
@keyframes xq-out { to { opacity: 0; transform: scale(.55); } }
@keyframes xq-no { 25% { transform: translateX(-7px); } 60% { transform: translateX(6px); } }
@keyframes xq-pop { from { transform: scale(.3); opacity: 0; } }
@keyframes xq-spin { to { stroke-dashoffset: -48; } }
.xq-pc.in .body, .xq-pc.out .body { transform-box: fill-box; transform-origin: center; }

.xq-boardwrap { position: relative; border-radius: 3.2% / 2.9%; box-shadow: 0 0 0 3px #05060d, 8px 9px 0 3px var(--lime), 0 30px 80px rgba(0, 0, 0, .55); background: var(--paper); }
.xq-boardwrap svg { border-radius: inherit; }

/* 一颗棋子当图标（菜单、棋手头像、印章） */
.xq-seal { width: 32px; height: 32px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; background: #faf6ec; border: 2.5px solid #111; font: 900 17px/1 var(--piece); font-style: normal; box-shadow: 0 2px 0 #000; color: #111; }
.xq-seal.red { color: var(--xq-red); }

/* ---------------------------------------------------------------- 共用：顶栏、按钮 */
.xq-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); background: rgba(13, 15, 30, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid rgba(46, 52, 102, .7); }
.xq-top .logo .wm { font-size: 22px; }
.xq-top .logo .cap { font-size: 13px; padding: 4px 7px 3px 9px; }
.xq-back { display: inline-flex; align-items: center; gap: 4px; flex: none; text-decoration: none; font-weight: 800; font-size: 15px; padding: 7px 12px 7px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); }
.xq-back:hover { border-color: var(--lime); }
.xq-back svg { width: 16px; height: 16px; }
.xq-topr { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.xq-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; padding: 0; flex: none; }
.xq-icon:hover { border-color: var(--lime); }
.xq-icon svg { width: 18px; height: 18px; }
.xq-icon.off { color: var(--muted); }
.xq-pill { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); font-weight: 800; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.xq-pill:hover { border-color: var(--lime); }

/* 厚块按钮：按下去会沉 */
.xq-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 900; font-size: 15px; line-height: 1.2; padding: 10px 18px; border-radius: 12px; border: 2px solid #000; background: var(--card2); color: var(--text); box-shadow: 0 4px 0 #000; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s, box-shadow .08s, background .12s; }
.xq-btn:hover { background: #2a3060; }
.xq-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
.xq-btn:disabled { opacity: .5; cursor: default; }
.xq-btn.go { background: var(--lime); color: var(--ink); }
.xq-btn.go:hover { background: #d6f75e; }
.xq-btn.ghost { background: transparent; border-color: var(--line); box-shadow: none; }
.xq-btn.ghost:hover { border-color: var(--text); }
.xq-btn.ghost:active { transform: none; }
.xq-btn.warn:hover { background: var(--coral); color: #1a0703; }
.xq-btn.sm { font-size: 13.5px; padding: 6px 12px; border-radius: 10px; box-shadow: 0 3px 0 #000; }

/* 能复制的一句话 */
.xq-copy { display: flex; align-items: stretch; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.xq-copy pre { flex: 1; min-width: 0; margin: 0; padding: 9px 12px; font: 14px/1.6 var(--sans); color: var(--text); white-space: pre-wrap; word-break: break-word; max-height: 168px; overflow: auto; }
.xq-copy pre.code { font: 13px/1.6 var(--mono); }
.xq-copy button { flex: none; font-weight: 900; font-size: 13.5px; background: var(--lime); color: var(--ink); border: 0; border-left: 2px solid #000; padding: 0 14px; cursor: pointer; white-space: nowrap; }
.xq-copy button.done { background: var(--text); }
.xq-seg { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.xq-seg button { flex: 1; font-weight: 800; font-size: 13.5px; padding: 6px 6px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.xq-seg button:hover { color: var(--text); }
.xq-seg button.on { background: var(--card2); color: var(--text); box-shadow: inset 0 0 0 1px var(--lime); }
.xq-hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; line-height: 1.55; }
.xq-hint a { color: var(--text); }
.xq-err { font-size: 13.5px; color: var(--coral); font-weight: 700; margin: 8px 0 0; }
.xq-field { display: flex; gap: 8px; }
.xq-field input { flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.xq-field input:focus { outline: 2px solid var(--lime); outline-offset: 0; border-color: transparent; }
.xq-agentline { font-size: 12px; line-height: 1.6; color: #6f7096; margin: 0; }
.xq-agentline a { color: inherit; }

/* ---------------------------------------------------------------- 棋桌页 */
body.xq-play { display: flex; flex-direction: column; overscroll-behavior-y: none; }
.xq-title { min-width: 0; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; }
.xq-title .name { overflow: hidden; text-overflow: ellipsis; }
.xq-code { font-family: var(--mono); font-weight: 700; font-size: 13.5px; letter-spacing: .08em; color: var(--ink); background: var(--lime); border-radius: 6px; padding: 2px 7px 1px; flex: none; }
.xq-state { font-size: 13px; font-weight: 700; color: var(--muted); flex: none; }
.xq-state.live { color: var(--lime); }
.xq-state.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); margin-right: 6px; vertical-align: 1px; animation: xq-blink 1.4s ease-in-out infinite; }
@keyframes xq-blink { 50% { opacity: .25; } }
.xq-eyes { font-size: 13px; color: var(--muted); font-weight: 700; margin-right: 2px; white-space: nowrap; }

.xq-main { flex: 1; display: grid; grid-template-columns: auto minmax(300px, 360px); justify-content: center; align-items: start; gap: 34px; padding: 18px 20px 26px; }
.xq-stage { width: min(600px, calc((100dvh - 56px - 36px - 2 * 62px - 52px - 30px) * .905)); min-width: 300px; display: flex; flex-direction: column; gap: 10px; }
.xq-boardbox { position: relative; display: flex; gap: 10px; align-items: stretch; margin: 2px 8px 10px 0; }
.xq-boardbox .xq-boardwrap { flex: 1; min-width: 0; }

/* 引擎评估条（只有名局回放有） */
.xq-eval { width: 14px; flex: none; border-radius: 7px; background: #15161f; border: 1px solid var(--line); position: relative; overflow: hidden; }
.xq-eval i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--xq-red); transition: height .35s ease; }
.xq-eval::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(255, 255, 255, .5); }
.xq-eval.flip i { bottom: auto; top: 0; }

/* 棋手牌：头像（帅 / 将）、名字、在干嘛、吃掉的子、钟 */
.xq-plate { position: relative; display: flex; align-items: center; gap: 11px; height: 62px; padding: 0 10px 0 9px; margin-right: 8px; border-radius: 16px; background: var(--bg2); border: 2px solid #05060d; box-shadow: 0 4px 0 #05060d; transition: background .2s, box-shadow .2s; }
.xq-plate.turn { background: #1b2142; box-shadow: 0 4px 0 #05060d, 0 0 0 2px var(--lime); }
.xq-plate.empty { background: transparent; border-style: dashed; border-color: var(--line); box-shadow: none; }
.xq-ava { position: relative; width: 44px; height: 44px; flex: none; }
.xq-ava .xq-seal { width: 44px; height: 44px; font-size: 24px; box-shadow: 0 3px 0 #000; }
.xq-plate.empty .xq-ava .xq-seal { opacity: .45; }
.xq-ava .dot { position: absolute; right: -2px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: #5a5d80; border: 2.5px solid var(--bg2); }
.xq-ava .dot.on { background: var(--lime); }
.xq-ava .dot.away { background: var(--coral); }
.xq-id { min-width: 0; flex: 0 1 auto; display: flex; flex-direction: column; gap: 1px; }
.xq-id .nm { display: flex; align-items: center; gap: 7px; min-width: 0; }
.xq-id b { font-size: 16px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 2.4em; }
.xq-id .st { font-size: 12.5px; line-height: 1.3; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xq-id .st.me { color: var(--lime); }
.xq-id .st.away { color: var(--coral); }
.xq-plate.empty .xq-id b { color: var(--muted); }
.xq-think::after { content: "…"; display: inline-block; width: 1.1em; overflow: hidden; vertical-align: bottom; animation: xq-dots 1.2s steps(4) infinite; }
@keyframes xq-dots { from { width: 0; } to { width: 1.1em; } }
.xq-kind { font-size: 11.5px; font-weight: 800; border-radius: 5px; padding: 0 5px; line-height: 1.6; flex: none; }
.xq-kind.agent { background: var(--sky); color: var(--ink); }
.xq-kind.human { background: rgba(255, 255, 255, .14); color: var(--text); }
.xq-kind.engine { background: var(--paper); color: var(--ink); }
.xq-kind.me { background: var(--lime); color: var(--ink); }
.xq-kind.foul { background: rgba(255, 106, 85, .18); color: var(--coral); }
.xq-took { display: flex; flex-wrap: wrap; align-content: center; gap: 1px; margin-left: 2px; min-width: 0; flex: 0 1 auto; max-height: 36px; overflow: hidden; }
.xq-took i { font: 900 10.5px/15px var(--piece); width: 16px; height: 16px; text-align: center; border-radius: 50%; background: #faf6ec; border: 1px solid #111; font-style: normal; color: #111; }
.xq-took i.red { color: var(--xq-red); }
.xq-clock { margin-left: auto; flex: none; font: 700 19px var(--mono); letter-spacing: .02em; color: var(--muted); padding: 5px 10px; border-radius: 9px; background: rgba(0, 0, 0, .25); min-width: 76px; text-align: center; }
.xq-clock:empty { display: none; }
.xq-plate.turn .xq-clock { color: var(--ink); background: var(--lime); }
.xq-plate.turn .xq-clock.low { background: var(--coral); animation: xq-blink 1s ease-in-out infinite; }
/* 棋手说的话：一个气泡，从他的牌子上冒出来 */
.xq-say { position: absolute; left: 62px; right: 8px; z-index: 6; display: flex; align-items: center; background: var(--paper); color: var(--ink); font-size: 14.5px; line-height: 1.4; font-weight: 700; padding: 8px 13px; border-radius: 14px; border: 2px solid #000; box-shadow: 3px 4px 0 #000; animation: xq-sayin .25s cubic-bezier(.2, 1.4, .4, 1) both; pointer-events: none; }
.xq-plate.top .xq-say { top: calc(100% + 8px); }
.xq-plate.bottom .xq-say { bottom: calc(100% + 8px); }
.xq-say::before { content: ""; position: absolute; left: 22px; width: 12px; height: 12px; background: inherit; border: 2px solid #000; transform: rotate(45deg); }
.xq-plate.top .xq-say::before { top: -8px; border-right: 0; border-bottom: 0; }
.xq-plate.bottom .xq-say::before { bottom: -8px; border-left: 0; border-top: 0; }
.xq-say span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes xq-sayin { from { opacity: 0; transform: translateY(var(--from, -6px)) scale(.94); } }

/* 棋盘上的提示和终局 */
.xq-toast { position: absolute; left: 50%; top: 50%; z-index: 8; transform: translate(-50%, -50%) rotate(-2deg); max-width: 84%; background: var(--coral); color: #1a0703; font-weight: 800; font-size: 15px; line-height: 1.45; padding: 10px 16px; border-radius: 12px; border: 2.5px solid #111; box-shadow: 4px 5px 0 #111; text-align: center; pointer-events: none; animation: xq-toast .25s cubic-bezier(.2, 1.4, .4, 1) both; }
.xq-toast.plain { background: var(--paper); color: var(--ink); }
.xq-toast small { display: block; font-weight: 700; font-size: 13px; opacity: .85; }
@keyframes xq-toast { from { opacity: 0; transform: translate(-50%, -50%) rotate(-2deg) scale(.8); } }
.xq-result { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; background: rgba(13, 15, 30, .45); border-radius: 3.2% / 2.9%; animation: xq-fade .3s ease both; }
.xq-result .card { text-align: center; background: var(--lime); color: var(--ink); border: 3px solid #111; border-radius: 18px; padding: 18px 30px 16px; box-shadow: 6px 7px 0 #111; transform: rotate(-4deg); animation: xq-stamp .4s cubic-bezier(.2, 1.5, .4, 1) both; max-width: 84%; }
.xq-result .card b { display: block; font: 900 clamp(34px, 6.4vw, 52px)/1.1 var(--serif); letter-spacing: .06em; }
.xq-result .card span { display: block; font-weight: 800; font-size: 15px; margin-top: 4px; }
.xq-result .acts { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.xq-result .acts button, .xq-result .acts a { font-weight: 800; font-size: 14px; background: #111; color: var(--text); border: 0; border-radius: 9px; padding: 7px 13px; cursor: pointer; text-decoration: none; }
@keyframes xq-fade { from { opacity: 0; } }
@keyframes xq-stamp { from { opacity: 0; transform: rotate(-4deg) scale(1.6); } }

/* 等人入座：盖在棋盘上的一张牌 */
.xq-call { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; padding: 4%; background: rgba(9, 10, 22, .62); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); border-radius: 3.2% / 2.9%; overflow: auto; }
.xq-callcard { width: min(100%, 430px); max-height: 100%; overflow: auto; background: var(--card); border: 2px solid #000; border-radius: 18px; box-shadow: 0 7px 0 #000, 0 30px 60px rgba(0, 0, 0, .5); padding: 16px 16px 14px; animation: xq-rise .3s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes xq-rise { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.xq-callcard h2 { margin: 0; font-size: 19px; font-weight: 900; display: flex; align-items: center; gap: 9px; line-height: 1.3; }
.xq-callcard h2 small { margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.xq-sides { display: flex; gap: 6px; margin: 12px 0 0; }
.xq-sides button { flex: 1; display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 14px; padding: 6px 8px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; }
.xq-sides button .xq-seal { width: 24px; height: 24px; font-size: 13px; box-shadow: none; border-width: 2px; }
.xq-sides button.on { border-color: var(--lime); box-shadow: inset 0 0 0 1px var(--lime); }
.xq-sides button small { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 700; }
.xq-opts { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 6px; margin: 12px 0 12px; }
.xq-opts button { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-size: 13.5px; padding: 9px 4px 8px; border-radius: 12px; border: 2px solid #000; background: var(--bg2); box-shadow: 0 3px 0 #000; cursor: pointer; line-height: 1.2; }
.xq-opts button .xq-seal { width: 30px; height: 30px; font-size: 16px; box-shadow: none; }
.xq-opts button:hover { background: var(--card2); }
.xq-opts button.on { background: var(--lime); color: var(--ink); }
.xq-waiting { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; font-weight: 800; color: var(--lime); }
.xq-waiting i { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); animation: xq-blink 1.2s ease-in-out infinite; }
.xq-callcard .xq-seg { margin-bottom: 10px; }
.xq-link { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 700; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.xq-link:hover { color: var(--text); }

/* 棋盘下面一条：回看 + 工具 */
.xq-ctrl { display: flex; align-items: center; gap: 6px; margin: 4px 8px 0 0; flex-wrap: wrap; }
.xq-replay { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 240px; }
.xq-replay button, .xq-tools .t { width: 38px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; padding: 0; }
.xq-replay button:hover:not(:disabled), .xq-tools .t:hover { border-color: var(--lime); }
.xq-replay button:disabled { opacity: .35; cursor: default; }
.xq-replay button svg, .xq-tools svg { width: 17px; height: 17px; }
.xq-replay button.on { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.xq-replay input[type=range] { flex: 1; min-width: 40px; accent-color: var(--lime); height: 28px; }
.xq-replay .at { font: 700 12.5px var(--mono); color: var(--muted); min-width: 52px; text-align: right; }
.xq-replay .xq-golive { display: none; width: auto; height: 34px; font-weight: 900; font-size: 13.5px; background: var(--lime); color: var(--ink); border: 2px solid #000; border-radius: 999px; padding: 0 13px; cursor: pointer; white-space: nowrap; }
.xq-replay.behind .xq-golive { display: inline-block; }
.xq-replay.behind .at { display: none; }
.xq-replay.empty { visibility: hidden; }
.xq-tools { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.xq-tools .t.on { color: var(--lime); border-color: rgba(200, 240, 60, .55); }
.xq-tools .t b { font: 800 12px var(--mono); }

/* 右边一栏 */
.xq-side > div:empty { display: none; }
.xq-side { min-width: 0; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 74px; height: calc(100dvh - 56px - 44px); }
.xq-panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 15px 17px; }
.xq-panel h2 { margin: 0 0 4px; font-size: 17px; font-weight: 900; line-height: 1.35; }
.xq-panel p { margin: 0 0 8px; font-size: 14px; color: #d9d6cd; line-height: 1.6; }
.xq-panel .meta { margin: 0; font-size: 13px; color: var(--muted); }
.xq-panel .meta a { color: var(--text); font-weight: 800; }
.xq-panel.note { border-color: rgba(200, 240, 60, .55); }
.xq-offer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14.5px; font-weight: 800; }
.xq-offer span { margin-right: auto; }

/* 棋谱 */
.xq-feed { flex: 1; min-height: 160px; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.xq-main.nomoves .xq-feed { flex: none; min-height: 0; }
.xq-feed .hd { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 17px 9px; border-bottom: 1px solid var(--line); }
.xq-feed .hd h2 { margin: 0; font-size: 16px; }
.xq-feed .hd span { font-size: 13px; color: var(--muted); font-weight: 700; }
.xq-moves { flex: 1; overflow-y: auto; padding: 6px 8px 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; overscroll-behavior: contain; }
.xq-round { display: grid; grid-template-columns: 28px 1fr 1fr; align-items: start; gap: 2px; }
.xq-round .n { font: 700 12.5px/34px var(--mono); color: var(--muted); text-align: right; padding-right: 6px; }
.xq-mv { display: flex; align-items: baseline; gap: 6px; padding: 6px 8px; border-radius: 9px; cursor: pointer; border: 0; background: transparent; text-align: left; min-width: 0; }
.xq-mv:hover { background: rgba(255, 255, 255, .06); }
.xq-mv.at { background: var(--lime); color: var(--ink); }
.xq-mv b { font-size: 15px; font-weight: 800; white-space: nowrap; }
.xq-mv.red b { color: #ff8a73; }
.xq-mv.at b { color: var(--ink); }
.xq-mv code { font: 11.5px var(--mono); color: var(--muted); }
.xq-mv.at code { color: rgba(11, 12, 22, .7); }
.xq-mv em { font-style: normal; font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.xq-mv.at em { color: rgba(11, 12, 22, .7); }
.xq-line { grid-column: 2 / 4; font-size: 13.5px; line-height: 1.55; color: #d9d6cd; background: rgba(255, 255, 255, .05); border-radius: 4px 12px 12px 12px; padding: 6px 10px; margin: 1px 4px 6px 2px; }
.xq-line.black { margin-left: 22%; border-radius: 12px 4px 12px 12px; }
.xq-line b { font-weight: 800; color: var(--text); }
.xq-line.foul { color: var(--coral); background: rgba(255, 106, 85, .1); }
.xq-moves .none { color: var(--muted); font-size: 14px; padding: 18px 12px; text-align: center; margin: 0; }
.xq-side .xq-agentline { padding: 0 4px; }

.xq-gone { max-width: 460px; margin: 12vh auto 0; text-align: center; padding: 0 20px; }
.xq-gone h1 { font: 900 30px/1.3 var(--serif); margin: 0 0 10px; }
.xq-gone p { color: var(--muted); margin: 0 0 22px; }

@media (max-width: 899px) {
  .xq-main { grid-template-columns: minmax(0, 1fr); padding: 10px 10px 26px; gap: 16px; }
  .xq-stage { width: min(100%, 560px); min-width: 0; margin: 0 auto; gap: 8px; }
  .xq-side { position: static; height: auto; width: min(100%, 560px); margin: 0 auto; }
  .xq-feed { max-height: 380px; }
  .xq-title .name { display: none; }
  .xq-eyes { display: none; }
  .xq-boardbox { margin-right: 7px; gap: 6px; }
  .xq-boardwrap { box-shadow: 0 0 0 3px #05060d, 6px 7px 0 3px var(--lime), 0 20px 50px rgba(0, 0, 0, .5); }
  .xq-plate, .xq-ctrl { margin-right: 7px; }
  .xq-plate { height: 56px; gap: 9px; }
  .xq-ava, .xq-ava .xq-seal { width: 38px; height: 38px; }
  .xq-ava .xq-seal { font-size: 21px; }
  .xq-say { left: 50px; }
  .xq-eval { width: 9px; }
  .xq-took { max-height: 17px; }
  .xq-clock { font-size: 17px; min-width: 66px; padding: 4px 8px; }
  .xq-call { padding: 3%; place-items: start center; }
  .xq-callcard { padding: 12px 12px 12px; }
  .xq-callcard h2 { font-size: 17px; }
  .xq-opts { margin: 10px 0; }
  .xq-opts button { flex-direction: row; justify-content: center; gap: 6px; padding: 6px 4px; }
  .xq-opts button .xq-seal { width: 24px; height: 24px; font-size: 13px; border-width: 2px; }
  .xq-sides { margin-top: 10px; }
  .xq-callcard .xq-seg { margin-bottom: 8px; }
  .xq-callcard .xq-copy pre { font-size: 13.5px; padding: 8px 10px; }
  .xq-callcard .xq-hint { font-size: 12.5px; margin-top: 6px; }
  .xq-waiting { margin-top: 6px; }
}
@media (max-width: 480px) {
  .xq-back { padding: 7px 9px; }
  .xq-back span { display: none; }
  .xq-opts.n4 button .xq-seal { display: none; }
  .xq-replay [data-go=first], .xq-replay [data-go=last] { display: none; }
  .xq-replay { min-width: 200px; }
  .xq-opts.n4 button { padding: 8px 2px; }
  .xq-top { gap: 8px; }
  .xq-topr { gap: 6px; }
}
@media (max-width: 380px) {
  .xq-id b { font-size: 15px; }
  .xq-clock { font-size: 15px; min-width: 58px; padding: 3px 6px; }
  .xq-opts button { font-size: 12.5px; }
}

/* ---------------------------------------------------------------- 首页 */
.xq-hero { max-width: 1240px; margin: 0 auto; padding: 22px max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left)); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; min-height: calc(100dvh - 56px - 60px); }
.xq-logo { position: relative; margin: 0 0 26px; }
.xq-logo .no { display: inline-block; font-family: var(--display); font-weight: 800; font-size: 12.5px; letter-spacing: .14em; color: var(--muted); }
.xq-logo h1 { margin: 6px 0 0; display: flex; align-items: center; gap: 14px; line-height: 1; }
.xq-logo h1 .ai { font-family: "Inter", var(--display); font-weight: 900; font-size: clamp(34px, 4.6vw, 54px); background: var(--lime); color: var(--ink); border: 3px solid #000; border-radius: 12px; padding: 4px 12px 6px; transform: rotate(-6deg); box-shadow: 4px 5px 0 #000; }
.xq-logo h1 .zh { font: 900 clamp(60px, 8.4vw, 104px)/1 var(--serif); letter-spacing: .04em; color: var(--paper); text-shadow: 0 5px 0 #000, 0 0 40px rgba(243, 239, 230, .12); }
.xq-logo p { margin: 14px 0 0; font-size: 17px; font-weight: 700; color: #cfccdf; }

.xq-menu { display: flex; flex-direction: column; gap: 10px; max-width: 470px; }
.xq-menu > * { display: flex; align-items: center; gap: 14px; text-align: left; text-decoration: none; padding: 10px 18px 10px 12px; border-radius: 16px; border: 2px solid #000; background: var(--card); box-shadow: 0 5px 0 #000; cursor: pointer; transition: transform .08s, box-shadow .08s, background .12s; }
.xq-menu > *:hover { background: var(--card2); }
.xq-menu > *:active { transform: translateY(4px); box-shadow: 0 1px 0 #000; }
.xq-menu .xq-seal { width: 44px; height: 44px; font-size: 24px; box-shadow: 0 3px 0 #000; transition: transform .18s cubic-bezier(.2, 1.4, .4, 1); }
.xq-menu > *:hover .xq-seal { transform: rotate(-12deg) translateY(-2px); }
.xq-menu b { display: block; font-size: 18px; font-weight: 900; line-height: 1.25; }
.xq-menu small { display: block; font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.35; }
.xq-menu .go { background: var(--lime); color: var(--ink); padding-top: 14px; padding-bottom: 14px; }
.xq-menu .go:hover { background: #d6f75e; }
.xq-menu .go b { font-size: 21px; }
.xq-menu .go small { color: rgba(11, 12, 22, .66); }
.xq-menu .arrow { margin-left: auto; font-weight: 900; font-size: 20px; opacity: .55; }
.xq-menu .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0; border: 0; background: none; box-shadow: none; cursor: default; }
.xq-menu .row2:hover, .xq-menu .row2:active { background: none; transform: none; box-shadow: none; }
.xq-menu .row2 > * { display: flex; align-items: center; gap: 11px; text-align: left; text-decoration: none; padding: 9px 12px 9px 10px; border-radius: 16px; border: 2px solid #000; background: var(--card); box-shadow: 0 5px 0 #000; cursor: pointer; min-width: 0; transition: transform .08s, box-shadow .08s, background .12s; }
.xq-menu .row2 > *:hover { background: var(--card2); }
.xq-menu .row2 > *:hover .xq-seal { transform: rotate(-12deg) translateY(-2px); }
.xq-menu .row2 > *:active { transform: translateY(4px); box-shadow: 0 1px 0 #000; }
.xq-menu .row2 .xq-seal { width: 38px; height: 38px; font-size: 20px; }
.xq-menu .row2 b { font-size: 16px; }
.xq-menu .row2 small { font-size: 12px; }

.xq-ticket { max-width: 470px; margin: 18px 0 0; }
.xq-ticket .lab { display: block; font-size: 13px; font-weight: 800; color: var(--muted); margin: 0 0 6px; }

/* 首页右边：一台电视，正在下的棋（没有就放名局） */
.xq-tv { min-width: 0; display: flex; flex-direction: column; align-items: center; }
.xq-tv .screen { width: min(100%, 470px); }
.xq-tv .head { display: flex; align-items: center; gap: 10px; margin: 0 9px 10px 0; font-size: 13.5px; font-weight: 800; }
.xq-tv .tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 900; letter-spacing: .06em; padding: 3px 9px; border-radius: 6px; background: var(--card2); color: var(--text); }
.xq-tv .tag.live { background: var(--coral); color: #1a0703; }
.xq-tv .tag.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #1a0703; animation: xq-blink 1.2s ease-in-out infinite; }
.xq-tv .head em { font-style: normal; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xq-tv .head a { margin-left: auto; color: var(--text); text-decoration: none; white-space: nowrap; border-bottom: 2px solid var(--lime); }
.xq-tv .seat { display: flex; align-items: center; gap: 9px; margin: 0 9px 0 0; padding: 7px 4px; font-weight: 800; font-size: 15px; min-width: 0; }
.xq-tv .seat .xq-seal { width: 30px; height: 30px; font-size: 16px; }
.xq-tv .seat span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xq-tv .seat .xq-kind { margin-left: 2px; }
.xq-tv .seat.turn span { color: var(--lime); }
.xq-tv .frame { padding: 2px 9px 12px 0; }
.xq-tv .say { min-height: 64px; margin: 8px 9px 0 0; }
.xq-tv .say p { margin: 0; background: var(--paper); color: var(--ink); border: 2px solid #000; box-shadow: 3px 4px 0 #000; border-radius: 4px 16px 16px 16px; padding: 8px 13px; font-size: 14.5px; line-height: 1.5; font-weight: 700; animation: xq-sayin .25s cubic-bezier(.2, 1.4, .4, 1) both; }
.xq-tv .say p.black { border-radius: 16px 4px 16px 16px; }
.xq-tv .say b { font-weight: 900; }

/* 大厅、名局 */
.xq-hall { max-width: 1240px; margin: 34px auto 0; padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); }
.xq-hall .hd { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; flex-wrap: wrap; }
.xq-hall h2 { margin: 0; font: 900 28px/1.2 var(--sans); display: flex; align-items: center; gap: 10px; }
.xq-hall h2 .xq-seal { width: 34px; height: 34px; font-size: 18px; }
.xq-hall .hd .fresh { font-size: 13px; color: var(--muted); }
.xq-hall .hd .xq-btn { margin-left: auto; }
.xq-lists { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.xq-list { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 12px 10px; min-width: 0; }
.xq-list h3 { margin: 0 6px 8px; font-size: 16px; font-weight: 900; display: flex; align-items: baseline; gap: 8px; }
.xq-list h3 span { font-family: var(--display); font-size: 14px; color: var(--muted); }
.xq-list .none { color: var(--muted); font-size: 13.5px; padding: 4px 6px 8px; margin: 0; }
.xq-hallempty { display: flex; align-items: center; gap: 14px; background: var(--bg2); border: 1px dashed var(--line); border-radius: var(--r); padding: 16px 18px; color: var(--muted); font-weight: 700; font-size: 14.5px; }
.xq-row { display: flex; align-items: center; gap: 12px; padding: 7px 6px; border-radius: 12px; text-decoration: none; }
.xq-row:hover { background: rgba(255, 255, 255, .05); }
.xq-row .thumb { width: 54px; flex: none; border-radius: 5px; overflow: hidden; box-shadow: 0 0 0 1.5px #05060d, 3px 3px 0 1px var(--lime); }
.xq-row .txt { min-width: 0; flex: 1; }
.xq-row .vs { display: flex; flex-direction: column; gap: 1px; font-size: 14.5px; font-weight: 800; }
.xq-row .vs span { display: flex; align-items: center; gap: 6px; min-width: 0; }
.xq-row .vs span b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.xq-row .vs i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.xq-row .vs i.red { background: var(--xq-red); }
.xq-row .vs i.black { background: var(--paper); }
.xq-row .vs .open { color: var(--lime); }
.xq-row .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.xq-row .go { font-weight: 900; font-size: 13px; color: var(--ink); background: var(--lime); border-radius: 8px; padding: 4px 10px; flex: none; }
.xq-row .go.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.xq-fresh button { background: none; border: 0; color: var(--text); font-weight: 800; cursor: pointer; padding: 0; font-size: 13px; text-decoration: underline; }

.xq-famous { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.xq-fame { display: flex; align-items: center; gap: 16px; text-decoration: none; background: var(--card); border: 2px solid #000; box-shadow: 0 5px 0 #000; border-radius: var(--r); padding: 14px 16px 14px 14px; transition: transform .12s, background .12s; min-width: 0; }
.xq-fame:hover { background: var(--card2); transform: translateY(-3px); }
.xq-fame .thumb { width: 92px; flex: none; border-radius: 7px; overflow: hidden; box-shadow: 0 0 0 2px #05060d, 4px 4px 0 2px var(--lime); }
.xq-fame .body { min-width: 0; }
.xq-fame h3 { font-size: 16px; line-height: 1.35; margin: 0 0 6px; font-weight: 900; }
.xq-fame .meta { font-size: 12.5px; font-weight: 700; color: var(--muted); }

.xq-foot { max-width: 1240px; margin: 56px auto 0; padding: 20px max(20px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; color: var(--muted); font-size: 13.5px; }
.xq-foot a { color: var(--text); text-decoration: none; }
.xq-foot .lang-link { color: var(--muted); }
.xq-foot .lang-link:hover { color: var(--text); }
.xq-foot .xq-agentline { flex-basis: 100%; }

/* 弹窗：开桌、怎么玩 */
.xq-dialog { border: 2px solid #000; background: var(--card); color: var(--text); border-radius: 22px; padding: 20px 22px 0; width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; box-shadow: 0 8px 0 #000, 0 30px 80px rgba(0, 0, 0, .6); }
.xq-dialog[open] { animation: xq-rise .28s cubic-bezier(.2, 1.3, .4, 1) both; }
.xq-dialog::backdrop { background: rgba(6, 7, 14, .74); backdrop-filter: blur(3px); }
.xq-dialog h2 { margin: 0 0 6px; font-size: 22px; font-weight: 900; display: flex; align-items: center; gap: 10px; }
.xq-dialog h2 .xq-seal { width: 36px; height: 36px; font-size: 19px; }
.xq-dialog h3 { margin: 18px 0 8px; font-size: 16px; font-weight: 900; }
.xq-dialog .lab { display: block; font-size: 13px; font-weight: 800; color: var(--muted); margin: 14px 0 6px; }
.xq-dialog ul { margin: 0; padding-left: 1.15em; font-size: 14.5px; color: #dedbd2; line-height: 1.65; }
.xq-dialog li { margin: 3px 0; }
.xq-dialog code { font: 13px var(--mono); color: var(--lime); }
.xq-dialog .xq-copy + .xq-copy { margin-top: 8px; }
.xq-dialog .foot2 { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin: 18px -22px 0; padding: 12px 22px 16px; position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); }
.xq-pick { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.xq-pick button { font-weight: 800; font-size: 14px; padding: 9px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; text-align: center; }
.xq-pick button.on { border-color: var(--lime); background: rgba(200, 240, 60, .12); box-shadow: inset 0 0 0 1px var(--lime); }
.xq-pick button small { display: block; font-weight: 700; font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .xq-hero { grid-template-columns: 1fr; min-height: 0; gap: 26px; padding-top: 18px; }
  .xq-logo { margin-bottom: 20px; }
  .xq-menu, .xq-ticket { max-width: none; }
  .xq-lists, .xq-famous { grid-template-columns: 1fr; }
  .xq-hall { margin-top: 30px; }
  .xq-hall h2 { font-size: 24px; }
}
@media (max-width: 420px) {
  .xq-top .logo .zh { display: none; }
  .xq-menu .row2 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .xq-menu .row2 > * { padding: 8px 8px 8px 8px; gap: 8px; }
  .xq-menu .row2 .xq-seal { width: 32px; height: 32px; font-size: 17px; }
  .xq-menu .row2 b { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .xq-pc, .xq-pc .body { transition: none; }
  .xq-hints .take, .xq-state.live::before, .xq-think::after, .xq-waiting i { animation: none; }
}
