/* =====================================================================
 * GoPower Web PC · 名局续下 / 阶段训练专属工作台
 *
 * 原则：
 * 1) 真实棋盘始终完整正方形，并优先占用中间视觉区域；
 * 2) 左栏只解释“原局 + 起点评估”，右栏只承载“当前接手 + 进度 + 操作”；
 * 3) PC 横屏不在棋盘上下堆控件，避免像截图旧版一样把棋盘顶出视口；
 * 4) 仅接管 data-train-mode="aiStage"，不污染其它训练模式。
 * ===================================================================== */

#trainStageBrief[hidden],
#trainStageBrief.is-hidden{display:none!important}

@media (min-width:901px){
  body.train-stage-open .view-page[data-view="train"]{
    height:calc(100dvh - 66px)!important;
    min-height:0!important;
    overflow:hidden!important;
    background:
      radial-gradient(circle at 50% 18%,rgba(113,82,229,.045),transparent 38%),
      linear-gradient(180deg,#fbfaff 0%,#f7f7fb 100%)!important;
  }
  body.train-stage-open .view-page[data-view="train"]>.train-stage{
    width:100%!important;
    max-width:none!important;
    height:100%!important;
    min-height:0!important;
    padding:8px 12px 10px!important;
    overflow:hidden!important;
  }

  .train-play[data-train-mode="aiStage"]{
    width:100%!important;
    max-width:none!important;
    height:100%!important;
    min-height:0!important;
    margin:0!important;
    display:grid!important;
    grid-template-columns:clamp(224px,15vw,258px) minmax(500px,1fr) clamp(282px,18vw,318px)!important;
    grid-template-rows:50px minmax(0,1fr)!important;
    grid-template-areas:
      "head head head"
      "brief board side"!important;
    gap:8px 12px!important;
    align-items:stretch!important;
  }

  /* ---------- 顶栏：只保留导航、模式和进度 ---------- */
  .train-play[data-train-mode="aiStage"] .train-play-head{
    grid-area:head!important;
    min-height:50px!important;
    height:50px!important;
    padding:5px 9px!important;
    border:1px solid #ebe8f1!important;
    border-radius:15px!important;
    background:rgba(255,255,255,.94)!important;
    box-shadow:0 4px 14px rgba(53,42,88,.035)!important;
  }
  .train-play[data-train-mode="aiStage"] .course-level-number{display:none!important}
  .train-play[data-train-mode="aiStage"] .train-title-stack{
    grid-template-columns:auto minmax(0,1fr)!important;
    gap:1px 8px!important;
  }
  .train-play[data-train-mode="aiStage"] .train-mode-eyebrow{
    font-size:10px!important;
    line-height:1.1!important;
    letter-spacing:.035em!important;
  }
  .train-play[data-train-mode="aiStage"] .train-title-stack>b{
    font-size:17px!important;
    line-height:1.18!important;
    letter-spacing:-.015em!important;
  }
  .train-play[data-train-mode="aiStage"] .train-play-meta{font-size:10px!important}
  .train-play[data-train-mode="aiStage"] .train-head-state{gap:7px!important}
  .train-play[data-train-mode="aiStage"] .train-turn-chip,
  .train-play[data-train-mode="aiStage"] .train-goal-hint{
    min-height:29px!important;
    padding:0 10px!important;
    font-size:10px!important;
    border-radius:999px!important;
  }

  /* ---------- 左栏：原局信息 + 本次比较基准 ---------- */
  .train-play[data-train-mode="aiStage"] .train-stage-brief{
    grid-area:brief!important;
    min-width:0!important;
    min-height:0!important;
    height:100%!important;
    display:flex!important;
    flex-direction:column!important;
    padding:16px 15px!important;
    border:1px solid #e9e5f1!important;
    border-radius:18px!important;
    background:
      radial-gradient(circle at 10% 1%,rgba(115,83,232,.09),transparent 150px),
      #fff!important;
    box-shadow:0 9px 24px rgba(52,40,88,.045)!important;
    overflow:auto!important;
    scrollbar-width:none!important;
  }
  .train-play[data-train-mode="aiStage"] .train-stage-brief::-webkit-scrollbar{display:none}
  .stage-brief-head{padding-bottom:12px;border-bottom:1px solid #efecf4}
  .stage-brief-kicker{
    display:inline-flex;align-items:center;min-height:23px;padding:0 8px;border-radius:999px;
    background:#f0ebff;color:#6849df;font-size:9px;font-weight:900;letter-spacing:.04em
  }
  .stage-brief-head h2{margin:9px 0 5px;color:#211b3e;font-size:22px;line-height:1.16;letter-spacing:-.02em}
  .stage-brief-head p{margin:0;color:#756e83;font-size:10.5px;line-height:1.55}

  .stage-brief-source{
    min-width:0;margin-top:12px;padding:11px 12px;border:1px solid #eeebf4;border-radius:13px;background:#fbfafd
  }
  .stage-brief-source>small{display:block;color:#948c9e;font-size:9px;font-weight:800}
  .stage-brief-source>b{
    display:-webkit-box;margin-top:4px;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;
    color:#28223d;font-size:12px;line-height:1.48;word-break:break-word
  }
  .stage-brief-original{display:grid;gap:6px;margin-top:9px;padding-top:9px;border-top:1px dashed #e6e1ed}
  .stage-brief-original>span{
    min-width:0;display:grid;grid-template-columns:16px 18px minmax(0,1fr);align-items:center;gap:5px
  }
  .stage-brief-original em{color:#9a92a4;font-size:9px;font-style:normal;font-weight:800}
  .stage-brief-original strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#4d465b;font-size:10px;font-weight:800}
  .stage-mini-stone,.stage-live-stone{display:block;border-radius:50%;box-sizing:border-box;flex:0 0 auto}
  .stage-mini-stone{width:14px;height:14px}
  .stage-mini-stone.black,.stage-live-stone.black{
    background:radial-gradient(circle at 34% 28%,#55555d 0,#202025 53%,#070708 100%);
    box-shadow:0 2px 5px rgba(0,0,0,.19)
  }
  .stage-mini-stone.white,.stage-live-stone.white{
    background:radial-gradient(circle at 34% 28%,#fff 0,#f5f5f6 58%,#dadade 100%);
    border:1px solid #d4d0da;box-shadow:0 2px 5px rgba(42,34,65,.09)
  }

  .stage-brief-baseline{
    margin-top:10px;padding:11px 12px;border:1px solid #ded5ff;border-radius:13px;
    background:linear-gradient(135deg,#f4f0ff 0%,#fbf9ff 100%)
  }
  .stage-brief-baseline>div{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
  .stage-brief-baseline small{color:#766a99;font-size:9px;font-weight:800}
  .stage-brief-baseline b{color:#5c42d1;font-size:18px;line-height:1;font-weight:950;letter-spacing:-.02em;white-space:nowrap}
  .stage-brief-baseline>span{display:block;margin-top:7px;color:#827a91;font-size:9px;line-height:1.45}

  .stage-brief-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin-top:9px}
  .stage-brief-facts>span{
    min-width:0;min-height:48px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
    padding:5px 3px;border:1px solid #efecf5;border-radius:11px;background:#fff;text-align:center
  }
  .stage-brief-facts small{color:#938b9d;font-size:8px;font-weight:800;white-space:nowrap}
  .stage-brief-facts b{max-width:100%;overflow:hidden;text-overflow:ellipsis;color:#312a43;font-size:10px;font-weight:900;white-space:nowrap}

  .stage-brief-rule{
    display:grid;grid-template-columns:30px minmax(0,1fr);align-items:start;gap:9px;margin-top:auto;
    padding:10px;border-radius:13px;background:#f6f3ff;color:#554785
  }
  .stage-brief-rule-icon{width:30px;height:30px;display:grid;place-items:center;border-radius:10px;background:#fff;color:#6f52e5}
  .stage-brief-rule-icon .ui-icon{width:16px;height:16px}
  .stage-brief-rule b{display:block;font-size:10px;color:#5843bd}
  .stage-brief-rule small{display:block;margin-top:3px;font-size:9px;line-height:1.48;color:#78708a}

  /* ---------- 中间棋盘：完整正方形、垂直完全落在当前视口 ---------- */
  .train-play[data-train-mode="aiStage"] .train-board-column{
    grid-area:board!important;
    min-width:0!important;
    min-height:0!important;
    height:100%!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    overflow:hidden!important;
  }
  .train-play[data-train-mode="aiStage"] .train-board-wrap{
    width:min(100%,calc(100dvh - 154px),820px)!important;
    height:auto!important;
    max-width:none!important;
    max-height:100%!important;
    aspect-ratio:1/1!important;
    flex:0 0 auto!important;
    margin:0!important;
    padding:7px!important;
    box-sizing:border-box!important;
    border-radius:20px!important;
    background:linear-gradient(145deg,#c79249,#a66d2f)!important;
    box-shadow:0 13px 30px rgba(95,65,26,.17)!important;
  }
  .train-play[data-train-mode="aiStage"] #trainBoard{
    width:100%!important;height:100%!important;aspect-ratio:1/1!important;border-radius:14px!important
  }
  /* 棋盘下方状态在 PC 阶段训练中是重复信息：轮次/AI 状态已进入右栏与棋盘遮罩。 */
  .train-play[data-train-mode="aiStage"] .train-status{display:none!important}
  /* controls 会由 dockBattleControls() 挪到右栏；若首帧尚未搬运，先隐藏避免撑开棋盘列。 */
  .train-play[data-train-mode="aiStage"] .train-board-column>.train-controls{display:none!important}
  .train-play[data-train-mode="aiStage"] .train-board-wait{
    border-radius:14px!important;background:rgba(255,255,255,.84)!important;backdrop-filter:none!important
  }

  /* ---------- 右栏：当前接手方 + 实时进度 + 操作 ---------- */
  .train-play[data-train-mode="aiStage"] .train-side-stack{
    grid-area:side!important;
    min-width:0!important;
    min-height:0!important;
    height:100%!important;
    display:block!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-panel.stage-mode{
    height:100%!important;
    min-height:0!important;
    display:flex!important;
    flex-direction:column!important;
    padding:15px!important;
    border:1px solid #e9e5f1!important;
    border-radius:18px!important;
    background:#fff!important;
    box-shadow:0 9px 24px rgba(52,40,88,.045)!important;
    overflow:hidden!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-heading{
    display:flex!important;align-items:flex-start!important;justify-content:space-between!important;gap:10px!important;
    padding-bottom:11px!important;border-bottom:1px solid #efecf4!important
  }
  .train-play[data-train-mode="aiStage"] .train-match-heading span{font-size:9px!important}
  .train-play[data-train-mode="aiStage"] .train-match-heading b{margin-top:4px!important;font-size:12px!important;line-height:1.45!important;color:#28223b!important}
  .train-play[data-train-mode="aiStage"] .train-runtime-badge{font-size:8px!important;white-space:nowrap!important}

  .train-play[data-train-mode="aiStage"] .train-roster{display:block!important;margin-top:12px!important}
  .stage-live-roster{display:grid;grid-template-columns:minmax(0,1fr) 20px minmax(0,1fr);align-items:stretch;gap:5px}
  .stage-live-vs{display:grid;place-items:center;color:#a29aa9;font-size:8px;font-weight:950}
  .stage-live-player{
    position:relative;min-width:0;min-height:72px;display:grid;grid-template-columns:31px minmax(0,1fr);align-items:center;gap:7px;
    padding:8px 7px;border:1px solid #ebe7f1;border-radius:13px;background:#faf9fc;transition:border-color .18s ease,background .18s ease,box-shadow .18s ease
  }
  .stage-live-player.active{border-color:#aa94f5;background:#f6f2ff;box-shadow:inset 0 0 0 1px rgba(111,82,229,.08)}
  .stage-live-player.black.active{border-color:#b9b1c3;background:#f5f4f7}
  .stage-live-stone{width:29px;height:29px}
  .stage-live-player>div{min-width:0}
  .stage-live-player small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#9991a2;font-size:7.5px;font-weight:800}
  .stage-live-player b{display:block;margin-top:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#322b44;font-size:10px;font-weight:900}
  .stage-live-player>em{
    position:absolute;right:6px;top:6px;min-width:18px;height:16px;display:grid;place-items:center;padding:0 4px;border-radius:999px;
    background:#eee9ff;color:#674ddb;font-size:7px;font-style:normal;font-weight:900
  }
  .stage-live-player.ai>em{background:#f0eff3;color:#756e7e}

  .train-play[data-train-mode="aiStage"] .train-current-turn{
    position:relative!important;min-height:52px!important;margin-top:11px!important;padding:0 10px 0 44px!important;
    display:flex!important;align-items:center!important;
    border:1px solid #e4dcff!important;border-radius:13px!important;background:linear-gradient(135deg,#f3efff,#fbf9ff)!important;
    color:#5740c5!important;font-size:12px!important;font-weight:900!important;line-height:1.3!important
  }
  .train-play[data-train-mode="aiStage"] .train-current-turn::before{
    content:"";position:absolute;left:13px;top:50%;width:22px;height:22px;transform:translateY(-50%);border-radius:50%;box-sizing:border-box
  }
  .train-play[data-train-mode="aiStage"] .train-match-panel.stage-turn-black .train-current-turn::before{
    background:radial-gradient(circle at 34% 28%,#4c4c54 0,#18181d 55%,#050507 100%);box-shadow:0 2px 7px rgba(0,0,0,.22)
  }
  .train-play[data-train-mode="aiStage"] .train-match-panel.stage-turn-white .train-current-turn::before{
    background:radial-gradient(circle at 34% 28%,#fff 0,#f3f3f4 58%,#d9d9dd 100%);border:1px solid #d0ccd7;box-shadow:0 2px 7px rgba(38,31,64,.10)
  }

  .train-play[data-train-mode="aiStage"] .train-match-facts{
    display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:5px!important;margin-top:9px!important
  }
  .train-play[data-train-mode="aiStage"] .train-match-facts span{
    min-width:0;min-height:46px!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:2px!important;
    padding:5px 3px!important;border-radius:10px!important;background:#faf9fc!important;text-align:center
  }
  .train-play[data-train-mode="aiStage"] .train-match-facts small{font-size:8px!important;color:#938b9d!important;white-space:nowrap}
  .train-play[data-train-mode="aiStage"] .train-match-facts b{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px!important;color:#302941!important}
  .train-play[data-train-mode="aiStage"] .train-match-progress{
    position:relative!important;height:6px!important;margin-top:9px!important;border-radius:999px!important;background:#efedf3!important;overflow:hidden!important
  }
  .train-play[data-train-mode="aiStage"] .train-match-progress i{
    display:block!important;height:100%!important;border-radius:inherit!important;background:linear-gradient(90deg,#8267ec,#6c4edc)!important;transition:width .22s ease!important
  }

  .train-play[data-train-mode="aiStage"] .train-match-controls-host{
    margin-top:auto!important;padding-top:11px!important;border-top:1px solid #efecf4!important
  }
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls{
    width:100%!important;max-width:none!important;min-height:0!important;display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;padding:0!important;
    border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important
  }
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-stat{display:none!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls>button{
    min-width:0!important;min-height:38px!important;display:flex!important;align-items:center!important;justify-content:center!important;gap:5px!important;
    padding:0 7px!important;border:1px solid #e8e4f0!important;border-radius:10px!important;background:#fff!important;
    color:#5f586e!important;font-size:9px!important;font-weight:850!important;white-space:nowrap!important
  }
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls>button:hover:not(:disabled){
    border-color:#cfc4ff!important;background:#f8f5ff!important;color:#6047d7!important
  }
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls>button:disabled{opacity:.45!important;cursor:not-allowed!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls>button .ui-icon{width:14px!important;height:14px!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls>button em{font-size:7px!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host #trainAiNextBtn,
  .train-play[data-train-mode="aiStage"] .train-match-controls-host #trainSituationBtn{color:#6048cf!important;background:#faf8ff!important;border-color:#ddd5fb!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host #trainSoundBtn{grid-column:1/-1!important;min-height:34px!important;color:#777080!important;background:#faf9fc!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host #trainRetryAiBtn{grid-column:1/-1!important;color:#bd4a56!important;border-color:#efd7da!important;background:#fffafa!important}
}

/* 125% 缩放 / 较窄 PC：先压两边，再守住棋盘。 */
@media (min-width:901px) and (max-width:1280px){
  .train-play[data-train-mode="aiStage"]{
    grid-template-columns:194px minmax(420px,1fr) 248px!important;
    gap:7px 9px!important
  }
  .train-play[data-train-mode="aiStage"] .train-stage-brief{padding:12px 11px!important}
  .stage-brief-head h2{font-size:18px}.stage-brief-head p{font-size:9px}
  .stage-brief-source{padding:9px}.stage-brief-baseline{padding:9px}
  .stage-brief-baseline b{font-size:15px}.stage-brief-facts>span{min-height:43px}
  .stage-brief-rule{padding:8px}.stage-brief-rule small{font-size:8px}
  .train-play[data-train-mode="aiStage"] .train-match-panel.stage-mode{padding:11px!important}
  .stage-live-player{grid-template-columns:25px minmax(0,1fr);min-height:62px;padding:6px 5px}.stage-live-stone{width:24px;height:24px}
  .train-play[data-train-mode="aiStage"] .train-board-wrap{width:min(100%,calc(100dvh - 154px),700px)!important}
}

/* 低高度笔记本：收紧文字与侧栏，不扩大棋盘公式，保证底边永不越界。 */
@media (min-width:901px) and (max-height:820px){
  body.train-stage-open .view-page[data-view="train"]>.train-stage{padding-top:6px!important;padding-bottom:8px!important}
  .train-play[data-train-mode="aiStage"]{grid-template-rows:46px minmax(0,1fr)!important;gap-block:6px!important}
  .train-play[data-train-mode="aiStage"] .train-play-head{height:46px!important;min-height:46px!important}
  .train-play[data-train-mode="aiStage"] .train-stage-brief{padding:11px!important}
  .stage-brief-head{padding-bottom:8px}.stage-brief-head h2{margin:6px 0 4px;font-size:18px}.stage-brief-head p{font-size:8.5px;line-height:1.4}
  .stage-brief-source{margin-top:8px;padding:8px}.stage-brief-source>b{font-size:10px}.stage-brief-original{margin-top:6px;padding-top:6px;gap:4px}
  .stage-brief-baseline{margin-top:7px;padding:8px}.stage-brief-baseline b{font-size:14px}.stage-brief-baseline>span{margin-top:4px;font-size:7.5px}
  .stage-brief-facts{margin-top:6px}.stage-brief-facts>span{min-height:39px}.stage-brief-facts small{font-size:7px}.stage-brief-facts b{font-size:9px}
  .stage-brief-rule{padding:7px}.stage-brief-rule-icon{width:26px;height:26px}.stage-brief-rule small{font-size:7.5px}
  .train-play[data-train-mode="aiStage"] .train-match-panel.stage-mode{padding:10px!important}
  .train-play[data-train-mode="aiStage"] .train-match-heading{padding-bottom:8px!important}.train-play[data-train-mode="aiStage"] .train-match-heading b{font-size:10px!important}
  .train-play[data-train-mode="aiStage"] .train-roster{margin-top:8px!important}.stage-live-player{min-height:57px;padding:5px}.stage-live-stone{width:24px;height:24px}
  .train-play[data-train-mode="aiStage"] .train-current-turn{min-height:44px!important;margin-top:7px!important;font-size:10px!important}
  .train-play[data-train-mode="aiStage"] .train-match-facts{margin-top:6px!important}.train-play[data-train-mode="aiStage"] .train-match-facts span{min-height:38px!important}
  .train-play[data-train-mode="aiStage"] .train-match-progress{margin-top:6px!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host{padding-top:7px!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls>button{min-height:32px!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host #trainSoundBtn{min-height:30px!important}
  .train-play[data-train-mode="aiStage"] .train-board-wrap{width:min(100%,calc(100dvh - 142px),680px)!important}
}

/* =====================================================================
 * 阶段训练结算：不再使用“普通胜负卡”，而是明确展示起始 → 续下后的比较结果。
 * ===================================================================== */
#trainSettle .train-settle-card:has(.stage-settle-eval){max-width:620px}
.stage-settle-eval{
  display:grid;grid-template-columns:128px minmax(0,1fr);gap:14px;margin:12px 0 4px;padding:14px;
  border:1px solid #e1daf7;border-radius:16px;background:linear-gradient(135deg,#f8f5ff,#fff)
}
.stage-settle-rating{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:112px;border-radius:13px;background:#f0ebff;text-align:center}
.stage-settle-rating small{color:#7d719c;font-size:10px;font-weight:850}
.stage-settle-rating b{margin:2px 0;color:#6448d8;font-size:46px;line-height:1;font-weight:950;letter-spacing:-.04em}
.stage-settle-rating span{color:#62577c;font-size:9px;font-weight:800}
.stage-settle-eval.improved .stage-settle-rating{background:#eef8f2}
.stage-settle-eval.improved .stage-settle-rating b{color:#27835a}
.stage-settle-flow{display:grid;grid-template-columns:minmax(0,1fr) 22px minmax(0,1fr);align-items:center;gap:7px}
.stage-settle-flow article{min-width:0;padding:12px 8px;border:1px solid #ece8f2;border-radius:12px;background:#fff;text-align:center}
.stage-settle-flow small{display:block;color:#948c9d;font-size:9px;font-weight:800}
.stage-settle-flow b{display:block;margin-top:5px;color:#302840;font-size:17px;font-weight:950;white-space:nowrap}
.stage-settle-flow>i{color:#7560db;font-size:18px;font-style:normal;font-weight:900;text-align:center}
.stage-settle-eval>p{grid-column:2;margin:-1px 0 0;color:#766e81;font-size:9px;line-height:1.45;text-align:center}
.train-settle-metrics.stage-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
.train-settle-actions.stage-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.train-settle-actions.stage-actions>button{min-width:0}

@media (max-width:640px){
  .stage-settle-eval{grid-template-columns:1fr;gap:10px}
  .stage-settle-rating{min-height:86px}.stage-settle-rating b{font-size:38px}
  .stage-settle-eval>p{grid-column:1}
  .train-settle-actions.stage-actions{grid-template-columns:1fr}
}

@media (min-width:901px){
  body.train-stage-open{
    min-width:1080px!important;
    overflow:hidden!important;
    background:#f8f7fb!important;
  }
  body.train-stage-open .topbar{
    height:84px!important;
    min-height:84px!important;
    padding:0 30px!important;
    border-bottom:1px solid #e9e4f0!important;
    background:rgba(253,252,255,.98)!important;
    box-shadow:0 2px 12px rgba(73,54,116,.035)!important;
  }
  body.train-stage-open .topbar .brand{
    width:auto!important;
    min-width:300px!important;
    gap:10px!important;
  }
  body.train-stage-open .topbar-user{
    min-width:300px!important;
    justify-content:flex-end!important;
  }

  body.train-stage-open .view-page[data-view="train"]{
    height:calc(100dvh - 84px)!important;
    min-height:0!important;
    padding:0!important;
    overflow:hidden!important;
    background:transparent!important;
  }
  body.train-stage-open .view-page[data-view="train"]>.train-stage{
    width:100%!important;
    max-width:none!important;
    height:100%!important;
    min-height:0!important;
    padding:18px!important;
    overflow:hidden!important;
    background:
      radial-gradient(circle at 50% 0,rgba(255,255,255,.92),transparent 45%),
      linear-gradient(180deg,#faf9fc 0%,#f6f4f9 100%)!important;
  }

  .train-play[data-train-mode="aiStage"]{
    width:min(1720px,calc(100vw - 28px))!important;
    max-width:none!important;
    height:100%!important;
    min-height:0!important;
    margin:0 auto!important;
    padding:0!important;
    display:grid!important;
    grid-template-columns:330px minmax(0,1fr) 330px!important;
    grid-template-rows:minmax(0,1fr)!important;
    grid-template-areas:none!important;
    column-gap:22px!important;
    row-gap:0!important;
    align-items:stretch!important;
    overflow:hidden!important;
  }
  .train-play[data-train-mode="aiStage"] .train-play-head,
  .train-play[data-train-mode="aiStage"] .train-stage-brief{
    display:none!important;
  }

  /* 左栏：与 1v1 单挑一致的导师主视觉，原棋谱成为紧凑的次级信息。 */
  .train-play[data-train-mode="aiStage"] #trainAutoEnemyWing{
    grid-column:1!important;
    grid-row:1!important;
    min-width:0!important;
    min-height:0!important;
    display:block!important;
    overflow:hidden!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-wing-card.stage-mentor-wing{
    height:100%!important;
    min-height:0!important;
    display:flex!important;
    flex-direction:column!important;
    padding:20px!important;
    border:1px solid #e7e1ef!important;
    border-radius:24px!important;
    background:rgba(255,255,255,.98)!important;
    box-shadow:0 12px 30px rgba(53,42,86,.05)!important;
    overflow:hidden!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-wing-title{
    padding-bottom:14px!important;
    border-bottom:1px solid #efebf3!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-wing-title small{
    font-size:11.5px!important;
    letter-spacing:.09em!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-wing-title b{
    margin-top:5px!important;
    font-size:20px!important;
    line-height:1.2!important;
  }
  .train-play[data-train-mode="aiStage"] .challenge-mentor-hero{
    gap:9px!important;
    margin-top:14px!important;
  }
  .train-play[data-train-mode="aiStage"] .challenge-mentor-avatar{
    width:176px!important;
    height:176px!important;
    border-radius:24px!important;
  }
  .train-play[data-train-mode="aiStage"] .challenge-mentor-avatar img,
  .train-play[data-train-mode="aiStage"] .challenge-mentor-avatar .train-role-seated{
    width:100%!important;
    height:100%!important;
    object-fit:contain!important;
    object-position:center bottom!important;
  }
  .train-play[data-train-mode="aiStage"] .challenge-mentor-hero>div:last-child b{
    font-size:19px!important;
    line-height:1.22!important;
  }
  .train-play[data-train-mode="aiStage"] .challenge-mentor-hero>div:last-child small{
    margin-top:5px!important;
    color:#777087!important;
    font-size:13.5px!important;
    font-weight:750!important;
  }
  .train-play[data-train-mode="aiStage"] .challenge-speech.stage-mentor-speech{
    grid-template-columns:30px minmax(0,1fr)!important;
    gap:9px!important;
    margin-top:13px!important;
    padding:11px 12px!important;
    border-radius:14px!important;
  }
  .train-play[data-train-mode="aiStage"] .challenge-speech.stage-mentor-speech>span{
    width:30px!important;
    height:30px!important;
  }
  .train-play[data-train-mode="aiStage"] .challenge-speech.stage-mentor-speech p{
    font-size:13px!important;
    line-height:1.58!important;
  }

  .stage-source-card{
    min-width:0;
    margin-top:14px;
    padding:14px;
    border:1px solid #ebe6f1;
    border-radius:17px;
    background:linear-gradient(180deg,#fbfafd,#fff);
  }
  .stage-source-card>header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
  }
  .stage-source-card>header>div small{
    display:block;
    color:#8d7ca4;
    font-size:10.5px;
    font-weight:900;
    letter-spacing:.09em;
  }
  .stage-source-card>header>div b{
    display:block;
    margin-top:3px;
    color:#30283e;
    font-size:16px;
  }
  .stage-source-card>header>span{
    flex:0 0 auto;
    padding:4px 7px;
    border-radius:999px;
    background:#f0ebff;
    color:#684ddb;
    font-size:11px;
    font-weight:850;
  }
  .stage-source-card>h3{
    display:-webkit-box;
    margin:10px 0 0;
    overflow:hidden;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    color:#211b31;
    font-size:15px;
    line-height:1.4;
    font-weight:850;
    word-break:break-word;
  }
  .stage-source-players{
    display:grid;
    grid-template-columns:minmax(0,1fr) 20px minmax(0,1fr);
    align-items:center;
    gap:5px;
    margin-top:10px;
    padding:9px 0;
    border-top:1px dashed #ebe5f0;
    border-bottom:1px dashed #ebe5f0;
  }
  .stage-source-players>span{
    min-width:0;
    display:grid;
    grid-template-columns:17px minmax(0,1fr);
    grid-template-rows:auto auto;
    align-items:center;
    column-gap:6px;
  }
  .stage-source-players .stage-mini-stone{
    grid-row:1/3;
    width:16px!important;
    height:16px!important;
  }
  .stage-source-players small{
    color:#91899b;
    font-size:10.5px;
    line-height:1.1;
  }
  .stage-source-players b{
    min-width:0;
    margin-top:2px;
    overflow:hidden;
    color:#423a4d;
    font-size:12.5px;
    line-height:1.25;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .stage-source-players>em{
    color:#aaa2b2;
    font-size:9px;
    font-style:normal;
    font-weight:900;
    text-align:center;
  }
  .stage-source-facts{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:6px;
    margin-top:10px;
  }
  .stage-source-facts>span{
    min-width:0;
    min-height:49px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    padding:5px 4px;
    border-radius:11px;
    background:#f8f6fb;
    text-align:center;
  }
  .stage-source-facts small{
    color:#948c9e;
    font-size:10px;
    font-weight:800;
    white-space:nowrap;
  }
  .stage-source-facts b{
    max-width:100%;
    overflow:hidden;
    color:#342b40;
    font-size:13px;
    font-weight:900;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .stage-source-open{
    width:100%;
    min-height:42px;
    display:grid;
    grid-template-columns:18px minmax(0,1fr) 16px;
    align-items:center;
    gap:8px;
    margin-top:11px;
    padding:0 11px;
    border:1px solid #dcd3f7;
    border-radius:12px;
    background:#fff;
    color:#6045d1;
    font-size:13px;
    font-weight:850;
    text-align:left;
    transition:background .16s ease,border-color .16s ease,transform .16s ease;
  }
  .stage-source-open:hover{
    border-color:#bcaaf1;
    background:#f7f4ff;
    transform:translateY(-1px);
  }
  .stage-source-open .ui-icon{width:17px;height:17px}
  .stage-source-open .ui-icon:last-child{justify-self:end;width:14px;height:14px}

  /* 中央：左右等宽后，棋盘几何中心与页面视口中心一致。 */
  .train-play[data-train-mode="aiStage"] .train-board-column{
    grid-column:2!important;
    grid-row:1!important;
    min-width:0!important;
    min-height:0!important;
    height:100%!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:0!important;
    gap:0!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    overflow:hidden!important;
  }
  .train-play[data-train-mode="aiStage"] .train-board-wrap{
    width:min(100%,calc(100dvh - 120px),820px)!important;
    max-width:820px!important;
    height:auto!important;
    max-height:100%!important;
    aspect-ratio:1/1!important;
    flex:0 0 auto!important;
    margin:0 auto!important;
    padding:9px!important;
    box-sizing:border-box!important;
    border-radius:24px!important;
    background:linear-gradient(145deg,#d2a15b,#aa7437)!important;
    box-shadow:0 14px 32px rgba(91,61,21,.15),inset 0 0 0 1px rgba(91,54,16,.18)!important;
  }
  .train-play[data-train-mode="aiStage"] #trainBoard{
    width:100%!important;
    height:100%!important;
    aspect-ratio:1/1!important;
    border-radius:17px!important;
  }
  .train-play[data-train-mode="aiStage"] .train-status,
  .train-play[data-train-mode="aiStage"] .train-board-column>.train-controls{
    display:none!important;
  }
  .train-play[data-train-mode="aiStage"] .train-board-wait{
    border-radius:17px!important;
    background:rgba(255,255,255,.86)!important;
  }
  .train-play[data-train-mode="aiStage"] .train-board-wait b{font-size:15px!important}
  .train-play[data-train-mode="aiStage"] .train-board-wait small{font-size:11.5px!important}

  /* 右栏：与 1v1 单挑一致的“我方 + 当前轮次 + 操作”结构。 */
  .train-play[data-train-mode="aiStage"] .train-side-stack{
    grid-column:3!important;
    grid-row:1!important;
    min-width:0!important;
    min-height:0!important;
    height:100%!important;
    display:block!important;
    overflow:hidden!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-panel.stage-mode{
    height:100%!important;
    min-height:0!important;
    display:flex!important;
    flex-direction:column!important;
    padding:20px!important;
    border:1px solid #e7e1ef!important;
    border-radius:24px!important;
    background:rgba(255,255,255,.98)!important;
    box-shadow:0 12px 30px rgba(53,42,86,.05)!important;
    overflow:hidden!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-heading{
    display:flex!important;
    align-items:flex-start!important;
    justify-content:space-between!important;
    gap:10px!important;
    padding-bottom:14px!important;
    border-bottom:1px solid #efebf3!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-heading>div>span{
    display:block!important;
    color:#7b65e3!important;
    font-size:11.5px!important;
    font-weight:900!important;
    letter-spacing:.04em!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-heading>div>b{
    display:block!important;
    margin-top:5px!important;
    color:#272036!important;
    font-size:20px!important;
    line-height:1.3!important;
    font-weight:900!important;
  }
  .train-play[data-train-mode="aiStage"] .train-runtime-badge{
    min-height:30px!important;
    padding:0 10px!important;
    border-radius:999px!important;
    font-size:10px!important;
  }
  .train-play[data-train-mode="aiStage"] .train-roster{
    margin-top:14px!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-self-roster>header{
    min-height:0!important;
    display:flex!important;
    align-items:baseline!important;
    justify-content:flex-start!important;
    gap:8px!important;
    margin:0 0 10px!important;
    padding:0!important;
    border:0!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-self-roster>header small{
    display:inline!important;
    color:#7b65e3!important;
    font-size:10px!important;
    line-height:1!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-self-roster>header b{
    display:inline!important;
    margin:0!important;
    color:#31283d!important;
    font-size:17px!important;
    line-height:1.2!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-self-roster>div{
    display:grid!important;
    grid-template-columns:1fr!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-self-roster .train-role-card{
    min-height:88px!important;
    display:grid!important;
    grid-template-columns:62px minmax(0,1fr)!important;
    align-items:center!important;
    gap:12px!important;
    padding:11px 12px!important;
    border:1px solid #e7e1ef!important;
    border-radius:15px!important;
    background:#faf9fc!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-self-roster .train-role-card.active{
    border-color:#9278f2!important;
    background:linear-gradient(180deg,#f3efff,#fff)!important;
    box-shadow:0 0 0 2px rgba(122,89,229,.08)!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-self-roster .train-role-avatar{
    width:62px!important;
    height:62px!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-self-roster .train-role-card b{
    color:#2f273a!important;
    font-size:16px!important;
    line-height:1.25!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-self-roster .train-role-card small{
    display:block!important;
    margin-top:5px!important;
    color:#81798b!important;
    font-size:12.5px!important;
  }
  .train-play[data-train-mode="aiStage"] .train-current-turn{
    min-height:48px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    margin-top:12px!important;
    padding:0 10px!important;
    border:1px solid #ddd4fa!important;
    border-radius:13px!important;
    background:#f5f1ff!important;
    color:#6248d8!important;
    font-size:14px!important;
    font-weight:900!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-facts{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    margin-top:10px!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-facts span{
    min-height:55px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:3px!important;
    padding:6px 7px!important;
    border-radius:12px!important;
    background:#f8f6fb!important;
    text-align:center!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-facts span small{
    color:#91899a!important;
    font-size:10.5px!important;
    font-weight:800!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-facts span b{
    color:#30283a!important;
    font-size:14px!important;
    line-height:1.2!important;
    font-weight:900!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-progress{
    height:8px!important;
    margin-top:10px!important;
    border-radius:999px!important;
    background:#ece8f3!important;
    overflow:hidden!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-progress i{
    display:block!important;
    height:100%!important;
    border-radius:inherit!important;
    background:linear-gradient(90deg,#8165ee,#a88ff8)!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-inline-notice{
    min-height:46px!important;
    display:flex!important;
    align-items:center!important;
    margin-top:11px!important;
    padding:9px 11px!important;
    border-radius:12px!important;
    background:#f8f6fb!important;
    color:#756d7f!important;
    font-size:12.5px!important;
    line-height:1.5!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-inline-notice.thinking{
    color:#6752cd!important;
    background:#f3efff!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-controls-host{
    margin-top:auto!important;
    padding-top:12px!important;
    border-top:1px solid #efebf3!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls{
    width:100%!important;
    max-width:none!important;
    min-height:0!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
    box-shadow:none!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-controls-host #trainMoveCount,
  .train-play[data-train-mode="aiStage"] .train-match-controls-host #trainCaps,
  .train-play[data-train-mode="aiStage"] .train-match-controls-host #trainResignBtn{
    display:none!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls>button{
    min-width:0!important;
    min-height:43px!important;
    height:43px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:5px!important;
    padding:0 8px!important;
    border-radius:11px!important;
    font-size:12.5px!important;
    font-weight:800!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-controls-host #trainSoundBtn{
    grid-column:1/-1!important;
  }
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls>button .ui-icon{
    width:15px!important;
    height:15px!important;
  }

}

/* 1690~1900 常见 PC 宽度：保持左右对称，仅略收侧栏，让棋盘继续优先。 */
@media (min-width:901px) and (max-width:1500px){
  .train-play[data-train-mode="aiStage"]{
    grid-template-columns:292px minmax(0,1fr) 292px!important;
    column-gap:18px!important;
  }
  .train-play[data-train-mode="aiStage"] .battle-wing-card.stage-mentor-wing,
  .train-play[data-train-mode="aiStage"] .train-match-panel.stage-mode{padding:16px!important}
  .train-play[data-train-mode="aiStage"] .challenge-mentor-avatar{width:152px!important;height:152px!important}
  .stage-source-card{padding:11px}
  .stage-source-card>h3{font-size:13px}
  .stage-source-facts>span{min-height:44px}
}

@media (min-width:901px) and (max-height:820px){
  body.train-stage-open .view-page[data-view="train"]>.train-stage{padding:12px!important}
  .train-play[data-train-mode="aiStage"] .battle-wing-card.stage-mentor-wing,
  .train-play[data-train-mode="aiStage"] .train-match-panel.stage-mode{padding:14px!important}
  .train-play[data-train-mode="aiStage"] .challenge-mentor-hero{margin-top:9px!important}
  .train-play[data-train-mode="aiStage"] .challenge-mentor-avatar{width:130px!important;height:130px!important}
  .train-play[data-train-mode="aiStage"] .challenge-speech.stage-mentor-speech{margin-top:9px!important;padding:9px 10px!important}
  .train-play[data-train-mode="aiStage"] .challenge-speech.stage-mentor-speech p{font-size:11.5px!important}
  .stage-source-card{margin-top:9px;padding:10px}
  .stage-source-card>h3{margin-top:7px;font-size:12.5px}
  .stage-source-players{margin-top:7px;padding:6px 0}
  .stage-source-facts{margin-top:7px}.stage-source-facts>span{min-height:39px}.stage-source-open{min-height:38px;margin-top:8px}
  .train-play[data-train-mode="aiStage"] .train-board-wrap{width:min(100%,calc(100dvh - 108px),720px)!important}
  .train-play[data-train-mode="aiStage"] .train-match-heading{padding-bottom:10px!important}
  .train-play[data-train-mode="aiStage"] .train-match-heading>div>b{font-size:17px!important}
  .train-play[data-train-mode="aiStage"] .train-roster{margin-top:10px!important}
  .train-play[data-train-mode="aiStage"] .battle-self-roster .train-role-card{min-height:75px!important;grid-template-columns:54px minmax(0,1fr)!important;padding:8px 10px!important}
  .train-play[data-train-mode="aiStage"] .battle-self-roster .train-role-avatar{width:54px!important;height:54px!important}
  .train-play[data-train-mode="aiStage"] .train-current-turn{min-height:42px!important;margin-top:8px!important}
  .train-play[data-train-mode="aiStage"] .train-match-facts{gap:6px!important;margin-top:7px!important}.train-play[data-train-mode="aiStage"] .train-match-facts span{min-height:45px!important}
  .train-play[data-train-mode="aiStage"] .battle-inline-notice{min-height:40px!important;margin-top:7px!important;font-size:11px!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host{padding-top:8px!important}
  .train-play[data-train-mode="aiStage"] .train-match-controls-host .train-controls>button{min-height:38px!important;height:38px!important;font-size:11px!important}
}
