/* 西洋棋頁（2026-10-05）：與 css/xiangqi.css 同一個骨架（沿用 css/style.css 的按鈕、對話框與字型），
   色調換成黑底＋金色（參考 Steam Chess 707140 的大理石棋盤與鑲金木框）。 */
/* 字級倍率：象棋頁同一個坑——這一頁沒有 css/themes.css，少了它 calc(… * var(--fs)) 全部失效 */
:root { --fs: 1; }
body.ch { background: #0b0b0d; }
#ch-gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.ch-loading { position: fixed; inset: 0; display: grid; place-content: center; gap: 14px; justify-items: center;
  background: #0b0b0d; color: #e9dfc8; z-index: 30; transition: opacity .4s ease; }
.ch-loading.done { opacity: 0; pointer-events: none; }

.ch-top { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 14px; z-index: 5; pointer-events: none; }
.ch-top > * { pointer-events: auto; }
.ch-top > .btn { display: inline-flex; align-items: center; flex: 0 0 auto; width: auto; }
.ch-title { white-space: nowrap; display: flex; align-items: baseline; gap: 12px; margin-right: auto; color: #f1e7cf; text-shadow: 0 2px 10px rgba(0, 0, 0, .7); }
.ch-title h1 { margin: 0; font-family: var(--serif); font-weight: 900; font-size: calc(26px * var(--fs)); letter-spacing: .14em; }
.ch-title p { margin: 0; font-size: calc(13px * var(--fs)); color: #cdbb93; letter-spacing: .06em; }

.ch-panel { position: fixed; top: 70px; right: 12px; width: min(240px, 34vw); max-height: calc(100% - 150px);
  display: flex; flex-direction: column; padding: 14px 16px; border-radius: 14px; z-index: 4;
  background: rgba(16, 15, 18, .8); border: 1px solid rgba(214, 178, 106, .25); color: #eee6d4; backdrop-filter: blur(4px); }
.ch-panel h2 { margin: 14px 0 6px; font-size: calc(13px * var(--fs)); font-weight: 500; color: #c9ad72; letter-spacing: .12em; }
.ch-turn { display: flex; align-items: center; gap: 10px; font-size: calc(16px * var(--fs)); letter-spacing: .08em; }
.ch-dot { width: 14px; height: 14px; border-radius: 50%; background: #f2f0ea; box-shadow: 0 0 0 3px rgba(242, 240, 234, .25); transition: background .3s, box-shadow .3s; }
.ch-turn.black .ch-dot { background: #151515; box-shadow: 0 0 0 3px rgba(214, 178, 106, .45); }
.ch-status { min-height: 1.4em; margin: 8px 0 0; font-size: calc(14px * var(--fs)); color: #ffb199; font-weight: 700; letter-spacing: .1em; }
.ch-moves { margin: 0; padding: 0 0 0 2.4em; overflow-y: auto; font-size: calc(15px * var(--fs)); line-height: 1.75;
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; font-variant-numeric: tabular-nums; }
.ch-moves li { white-space: nowrap; }
.ch-moves li.black { list-style: none; color: #d8c9a4; }
.ch-moves li.last { text-decoration: underline; text-underline-offset: 4px; }

.ch-actions { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 10px; z-index: 5;
  padding: 8px; border-radius: 999px; background: rgba(16, 15, 18, .65); backdrop-filter: blur(4px); }
.ch-actions .btn[disabled] { opacity: .45; pointer-events: none; }

.ch-result { text-align: center; }
.ch-result .big { font-family: var(--serif); font-size: calc(32px * var(--fs)); font-weight: 900; letter-spacing: .14em; margin: 6px 0 4px; }
.ch-result .why { color: var(--muted); margin: 0 0 6px; }

/* 升變：四個大按鈕，棋子用 Unicode 符號（字型一定有，不用載圖） */
.ch-promo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 6px; }
.ch-promo button { display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 12px; cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(214, 178, 106, .35); color: var(--text); font: inherit; }
.ch-promo button:hover, .ch-promo button:focus-visible { background: rgba(214, 178, 106, .15); outline: none; }
.ch-promo .glyph { font-size: calc(40px * var(--fs)); line-height: 1; }
.ch-promo small { font-size: calc(12px * var(--fs)); color: var(--muted); }

/* ---------- 西洋棋教學頁（2026-10-10）：與 css/xiangqi.css、css/go.css 的教學頁同一個樣子 ---------- */
/* 教學頁沿用網站淺色的閱讀版面（css/learn.css），body.ch 的深底色在這裡蓋回去 */
body.ch.learn-page { background: var(--site-bg-color, #f6f1e6); }
.ch-board-card { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px;
  margin-top: 18px; padding: 16px; border-radius: 14px; background: #241d16; border: 1px solid rgba(214, 178, 106, .22); }
/* 西洋棋的棋盤是正方形（8×8），所以主棋盤與示範卡都用 1 / 1 */
.ch-board-canvas { position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: #17120d; }
.ch-board-canvas canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.ch-board-side { color: #f1e7cf; }
.ch-board-title { margin: 0 0 6px; font: 900 calc(18px * var(--fs)) var(--site-display, "Noto Serif TC", serif); letter-spacing: .06em; }
.ch-board-note { margin: 0 0 8px; color: #d5c4a1; font-size: calc(14px * var(--fs)); line-height: 1.7; }
.ch-board-count { margin: 0 0 10px; color: #ffd166; font-weight: 700; font-size: calc(14px * var(--fs)); }
.ch-board-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.ch-demo-list { display: grid; gap: 22px; margin-top: 20px; }
.ch-demo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; align-items: center;
  padding: 14px; border-radius: 14px; background: var(--site-card, #fffaf0); border: 1px solid var(--site-line, rgba(60, 40, 20, .12)); }
.ch-demo-board { position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: #17120d; }
.ch-demo-board canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.ch-demo-text h3 { margin: 0 0 8px; font: 900 calc(17px * var(--fs)) var(--site-display, "Noto Serif TC", serif); color: var(--site-heading, #2a2622); }
.ch-demo-text p { margin: 0 0 8px; line-height: 1.8; }
.ch-demo-count { color: var(--site-accent, #8a5a2b); font-weight: 700; font-size: calc(13px * var(--fs)); }

@media (max-width: 720px) {
  .ch-title p { display: none; }
  .ch-title h1 { letter-spacing: .06em; }
  .ch-panel { top: auto; bottom: 74px; right: 12px; left: 12px; width: auto; max-height: 128px; padding: 10px 12px; }
  .ch-panel h2 { display: none; }
  .ch-moves { max-height: 52px; }
  .ch-actions { left: 12px; right: 12px; transform: none; justify-content: center; border-radius: 16px; }
  .ch-board-card, .ch-demo { grid-template-columns: minmax(0, 1fr); }
}
