/* ========== 第7课 · 简易国际象棋（你 vs 小深蓝） ========== */
.ch { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.ch-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ch-badge { font-family: var(--font-serif); font-weight: 900; color: var(--acc); font-size: 16px; }
.ch-tag { font-size: 12px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--acc), var(--acc2)); border-radius: 20px; padding: 3px 12px; }
.ch-helpbtn { font-family: inherit; font-size: 12px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #4F6DF5, #7ea0ff); border: none; border-radius: 30px; padding: 5px 14px; cursor: pointer; transition: all .15s; }
.ch-helpbtn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(79, 109, 245, .35); }
.ch-help { position: fixed; inset: 0; z-index: 9998; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(13, 20, 38, .55); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.ch-help.open { opacity: 1; pointer-events: auto; }
.ch-help-box { position: relative; width: min(680px, 100%); max-height: 86vh; overflow-y: auto; background: #fff; border-radius: 18px;
  padding: 22px 24px; box-shadow: 0 24px 70px rgba(0, 0, 0, .4); }
.ch-help-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: #eef1f8; color: #556; font-size: 15px; font-weight: 800; }
.ch-help-close:hover { background: #dfe5f5; }
.ch-help-title { font-family: var(--font-serif); font-weight: 900; font-size: 19px; color: #0d2259; margin-bottom: 12px; padding-right: 30px; }
.ch-help-sec { font-size: 14px; font-weight: 900; color: var(--acc); margin: 12px 0 5px; }
.ch-help-p { font-size: 13.5px; color: #38415f; line-height: 1.8; }
.ch-help-list { list-style: none; padding: 0; margin: 2px 0 0; display: flex; flex-direction: column; gap: 5px; }
.ch-help-list li { font-size: 13.5px; color: #38415f; line-height: 1.7; background: #f6f8fd; border-radius: 10px; padding: 7px 11px; }
.ch-help-list li b { color: #0d2259; }
.ch-help-body p.ch-help-sec:first-child { margin-top: 0; }
.ch-help-body b { color: #0d2259; }
.ch-tip { font-size: 13px; color: var(--ink3); line-height: 1.75; margin-bottom: 12px; background: #fffdf2; border: 1px dashed #f0c98a; border-radius: 12px; padding: 8px 12px; }
.ch-body { display: grid; grid-template-columns: minmax(300px, 440px) 1fr; gap: 14px; align-items: start; }
.ch-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ch-left .ch-panel { width: 100%; }
.ch-board-wrap { background: #fff; border: 1px solid var(--rule); border-radius: 14px; padding: 10px; box-shadow: 0 2px 8px -5px rgba(0, 0, 0, .06); }
.ch-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ch-mode { font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1; border-radius: 30px; padding: 6px 12px; cursor: pointer;
  border: 1.5px solid #ccd4e6; background: #fff; color: var(--ink3); transition: all .15s; }
.ch-mode:hover:not(.active):not(:disabled) { border-color: var(--acc); color: var(--acc); }
.ch-mode.active { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--acc), var(--acc2)); }
.ch-mode:disabled { opacity: .5; cursor: default; }
/* 坐标框：左列放行号，底行放列号字母（a,b,c…） */
.ch-frame { display: grid; grid-template-columns: 20px 1fr; grid-template-rows: 1fr 20px; column-gap: 6px;
  width: 100%; max-width: 460px; margin: 0 auto; }
.ch-ranks { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; }
.ch-ranks .rk { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #7d869e; }
.ch-files { grid-column: 2; grid-row: 2; display: flex; }
.ch-files .fl { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #7d869e; }
.ch-board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  grid-column: 2; grid-row: 1; width: 100%; aspect-ratio: 1 / 1; border: 3px solid #3b445c; border-radius: 6px; overflow: hidden; background: #fff; }
/* 5×5 迷你入门棋盘：5 列 5 行 → 每格更大，适合小朋友 */
.ch-board.mini { grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); }
.ch-sq { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; width: 100%; height: 100%; }
.ch-sq.light { background: #f0d9b5; }
.ch-sq.dark { background: #b58863; }
.ch-sq.legal::after { content: ''; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(34, 120, 60, .55); }
.ch-sq.legal-capt { box-shadow: inset 0 0 0 4px rgba(34, 120, 60, .7); }
.ch-sq.sel { box-shadow: inset 0 0 0 4px #e8b13a; }
.ch-sq.last { box-shadow: inset 0 0 0 2px #f0c14b; }
.ch-sq.chk { background: radial-gradient(circle, #ffb3b3 0%, #e57373 70%) !important; }
.ch-pc { font-size: clamp(20px, 5.2vmin, 42px); line-height: 1; }
.ch-pc.w { color: #fdfdfd; text-shadow: 0 0 2px #000, 0 0 2px #000, 1px 1px 2px #000; }
.ch-pc.b { color: #1c2333; text-shadow: 0 0 1px rgba(255, 255, 255, .35); }
.ch-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ch-panel { background: #fff; border: 1px solid var(--rule); border-radius: 14px; padding: 11px 13px; box-shadow: 0 2px 8px -5px rgba(0, 0, 0, .06); }
.ch-ptitle { font-size: 13.5px; font-weight: 800; color: var(--ink2); margin-bottom: 9px; display: flex; align-items: center; gap: 7px; }
.ch-turn { font-size: 14px; font-weight: 800; }
.ch-turn b { color: var(--acc); }
.ch-hint { font-size: 12.5px; color: #4a4f63; line-height: 1.7; }
.ch-msg { background: #101828; color: #dbe2f2; border-radius: 12px; padding: 9px 12px; font-size: 13px; line-height: 1.7; min-height: 38px; }
.ch-msg.good { background: #eaf9f0; color: #1b5e3d; }
.ch-msg.bad { background: #fdeeee; color: #a33; }
.ch-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-btn { font-family: inherit; font-size: 12.5px; font-weight: 700; border-radius: 30px; padding: 8px 14px; cursor: pointer; border: 1.5px solid transparent; color: #fff; transition: all .15s; }
.ch-btn:hover { transform: translateY(-1px); }
.ch-btn:disabled { opacity: .55; cursor: default; }
.ch-btn.cat { background: linear-gradient(135deg, #f7b955, #ffd98c); color: #5b4308; }
.ch-btn.brain { background: linear-gradient(135deg, var(--acc), var(--acc2)); }
.ch-btn.ghost { background: #fff; border-color: #ccd4e6; color: var(--ink3); }
.ch-btn.giveup { background: linear-gradient(135deg, #ef7a6a, #f2a39a); }
/* 小深蓝“看几步”选择器（1—5 步） */
.ch-lvls { gap: 6px; }
.ch-lvl { font-family: inherit; font-size: 12px; font-weight: 800; line-height: 1; cursor: pointer; border-radius: 30px;
          padding: 7px 11px; border: 1.5px solid #ccd4e6; background: #fff; color: var(--ink3); transition: all .15s; }
.ch-lvl:hover:not(.active):not(:disabled) { border-color: var(--acc); color: var(--acc); transform: translateY(-1px); }
.ch-lvl.active { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--acc), var(--acc2));
                 box-shadow: 0 4px 10px -6px var(--acc); }
.ch-lvl:disabled { opacity: .5; cursor: default; }
.ch-captured { font-size: 16px; letter-spacing: 2px; line-height: 1.4; min-height: 26px; }
.ch-moves { font-size: 12px; color: #6a7290; line-height: 1.8; max-height: 110px; overflow-y: auto; background: #f7f9fd; border-radius: 10px; padding: 6px 9px; }
.ch-recap { margin-top: 12px; font-size: 13px; color: var(--ink3); line-height: 1.9; background: #fff7e8; border: 1px dashed #f0c98a; border-radius: 12px; padding: 10px 14px; }
/* ========== 深蓝“算法”实时可视化（右侧面板） ========== */
.ch-vizp .ch-ptitle { color: #3046b8; }
.ch-viz-hint { font-size: 12px; color: var(--ink3); line-height: 1.75; margin-bottom: 8px; }
.ch-viz-hint b { color: var(--acc); }
.ch-viz-hint #chVizD { color: #e0662a; }
.ch-viz-state { font-size: 12.5px; font-weight: 800; color: #33407d; background: #eef1ff; border: 1px dashed #b7c2ef; border-radius: 10px; padding: 6px 10px; margin-bottom: 8px; line-height: 1.55; }
.ch-viz-list { background: #fafbfe; border: 1px solid var(--rule); border-radius: 10px; padding: 8px; }
.ch-viz-empty { font-size: 12px; color: #a6adc4; text-align: center; padding: 16px 6px; line-height: 1.6; }
/* —— 搜索树：树干 + 每支分叉 —— */
.ch-tree { position: relative; padding: 2px 2px 4px 26px; }
.ch-tree::before { content: ''; position: absolute; left: 13px; top: 6px; bottom: 12px; width: 2px; border-radius: 2px; background: linear-gradient(#9fb2ec, #dfe5f7); }
.tl { position: relative; display: block; margin: 5px 0; padding: 5px 9px; border-radius: 9px; background: #fff; border: 1px solid #edf0f8; font-size: 12.5px; line-height: 1.4; opacity: 0; animation: tIn .22s ease forwards; }
.tl::before { content: ''; position: absolute; left: -13px; top: 50%; width: 13px; height: 2px; background: #c3cff1; }
.tl-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tl-t { font-weight: 800; color: #333c56; min-width: 0; }
.tl-s { flex: none; font-weight: 900; border-radius: 20px; padding: 1px 9px; font-size: 11.5px; white-space: nowrap; }
.tl.good { border-left: 3px solid #3aa86a; }
.tl-s.good { background: #e3f6ea; color: #187a3e; }
.tl.bad { border-left: 3px solid #e07a72; }
.tl-s.bad { background: #fdeaea; color: #c0392b; }
.tl.zero { border-left: 3px solid #c6cddf; }
.tl-s.zero { background: #eef0f5; color: #8a93ad; }
.tl-root { background: linear-gradient(135deg, #e7edff, #f3edff); border: none; font-size: 13px; }
.tl-root .tl-t { color: #26337e; }
.tl-more { background: transparent; border-style: dashed; border-color: #e2e6f2; }
.tl-more .tl-t { color: #9aa3bd; font-weight: 600; font-size: 11.5px; }
/* 选中的那支：绿色高亮 + ⭐；若有“白会回敬”子分支则纵排 */
.tl-move.has-sub { display: block; }
.tl-move.pick { border-color: #36a867; background: #eefaf2; box-shadow: inset 0 0 0 1px #36a867; }
.tl-move.pick > .tl-line > .tl-t::before { content: '⭐ '; }
.tl-reply { display: block; margin-top: 5px; padding: 4px 2px 1px; border-top: 1px dashed #bcd9cd; color: #3b4b96; font-weight: 700; font-size: 11.5px; }
.ch-viz-note { margin-top: 8px; font-size: 12px; color: var(--ink3); line-height: 1.75; background: #fff7e8; border: 1px dashed #f0c98a; border-radius: 10px; padding: 6px 10px; min-height: 18px; }
/* 搜索树：点一支 → 展开“后面几步怎么走” */
.tl-move.expandable { cursor: pointer; }
.tl-move.expandable:hover { background: #f4f7ff; border-color: #c9d6f5; }
.tl-move.expandable.open { background: #f7faff; }
.tl-more { flex: none; font-size: 11px; font-weight: 800; color: #5c6b96; background: #eef2fd;
           border-radius: 20px; padding: 1px 8px; white-space: nowrap; }
.tl-move.open .tl-more { color: #1f7a48; background: #e3f5e9; }
.tl-chain { margin: 6px 0 2px 6px; padding-left: 9px; border-left: 2px dashed #cfdcf7; }
.tl-chain .tl::before { display: none; }
.tl-cont { margin: 4px 0; padding: 4px 8px; font-size: 12px; background: #fbfcff; animation: tIn .2s ease forwards; }
.tl-cont.w { border-left: 3px solid #9fb6e8; }
.tl-cont.b { border-left: 3px solid #3f4b5c; }
.tl-cont .tl-t { font-weight: 700; color: #45507a; }
@keyframes tIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (max-width: 860px) { .ch-body { grid-template-columns: 1fr; } }
