/* ============================================================
   爻历 PC 端 · 桌面布局层
   前提：mobile.css 已去掉 @media 包裹，竖排单列布局在所有宽度生效。
   本文件只做宽屏（≥901px）增强。
   ============================================================ */

@media (min-width: 901px) {
  :root {
    --m-chart-fs: 16px;
    --m-shen-fs: 13px;
    --m-ss-fs: 14px;
    --m-q-fs: 16px;
    --m-castbtn-fs: 15px;
    --m-btmbtn-fs: 14px;
    --m-mh-fs: 12px;
  }

  html { overflow-y: scroll; }
  body { background: var(--paper, #dfeada); padding: 0; }

  /* 单列居中 */
  .app { max-width: 1180px; margin: 0 auto; padding: 0 0 96px; }
  .topbar { max-width: 1180px; margin: 0 auto 10px; padding: 10px 18px; }
  .m-card { border-radius: 10px; margin-bottom: 10px; }

  /* ---------- 底部 dock 收成居中胶囊 ---------- */
  #m-dock {
    left: 50% !important;
    right: auto !important;
    width: min(560px, 80vw);
    transform: translateX(-50%);
    bottom: 14px;
    height: 56px;
    border-radius: 14px;
    border: 1px solid var(--line, #cbdbc0);
    box-shadow: 0 10px 30px -12px rgba(60, 42, 20, .35);
    padding: 0;
  }
  /* 桌面固定：不随滚动收起，也不因输入框聚焦而消失 */
  body.dock-hidden #m-dock {
    transform: translateX(-50%) !important;
    pointer-events: auto !important;
  }
  body.kb-open #m-dock { display: flex !important; }
  body.kb-open .app { padding-bottom: 96px !important; }

  /* ---------- 排盘表：整体限宽居中，别撑成一整行 ---------- */
  #view-cast .chart-body { padding: 0 16px 14px; }
  #view-cast .ct-head,
  #view-cast .ct-row { max-width: 880px; margin-left: auto; margin-right: auto; }

  /* 有变卦：六神 | 主卦 | 变卦 */
  #view-cast .ct-head,
  #view-cast .ct-row {
    grid-template-columns: 46px minmax(0, 1fr) minmax(0, 1fr) !important;
    column-gap: 12px !important;
  }

  /* 无变卦：六神 | 主卦（占满，不再固定 174px 居中） */
  #view-cast .chart-body.no-bian .ct-head,
  #view-cast .chart-body.no-bian .ct-row {
    grid-template-columns: 46px minmax(0, 1fr) !important;
  }
  #view-cast .chart-body.no-bian .ct-head .h1,
  #view-cast .chart-body.no-bian .ct-row .ct-shen { grid-column: 1; }
  #view-cast .chart-body.no-bian .ct-head .h2,
  #view-cast .chart-body.no-bian .ct-row .ct-cell:not(.bian) {
    grid-column: 2;
    width: auto;
    justify-content: flex-start;
  }

  /* 爻文字与爻线放大 */
  #view-cast .ct-cell .txt { font-size: var(--m-chart-fs, 16px); }
  #view-cast .yao-graph.yang .bar { width: 46px; }
  #view-cast .yao-graph.yin .bar { width: 21px; }
  #view-cast .ct-row { min-height: 44px; }

  /* 四柱 */
  #view-cast .pillars { gap: 10px; }
  #view-cast .pillar { padding: 10px 4px 9px; }
  #view-cast .pillar b { font-size: 21px; }
  #view-cast .pillar.key b { font-size: 24px; }
  #view-cast .pillar span { font-size: 11px; }

  /* 神煞多列 */
  #view-cast .ss-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 4px 18px;
  }

  /* ---------- 干支历：桌面上不再悬浮，收进单列流程的最下面 ---------- */
  #view-cast.active { display: flex !important; flex-direction: column; align-items: stretch !important; }
  /* 日期格子太宽会散，收一收并放大字 */
  #gcal .gcal-week,
  #gcalBody { max-width: 640px; margin-left: auto; margin-right: auto; }
  #gcalBody { gap: 4px; }
  #gcal .gc-day { padding: 6px 2px 7px; justify-content: center; min-height: 46px; }
  #gcal .gc-date { font-size: 11px; }
  #gcal .gc-gz { font-size: 13px; }


  /* 手机版把「放大」藏了（#btnZoom），PC 上要留 —— 阅读版式很有用 */
  #btnZoom { display: inline-flex !important; align-items: center; }
  /* 手机版把页脚藏了，PC 上把版本号露出来 */
  .foot { display: block !important; }
  /* 手机版隐藏的卡片右侧元信息，PC 上有空间可以显示 */
  .rec-card .rec-side-meta { display: block !important; }

  /* 控件字号 */
  .m-card input[type="text"], .m-card input[type="number"],
  .m-card input[type="datetime-local"], .m-card input[type="date"],
  .m-card select, .m-card textarea { font-size: 14px; }

  /* ---------- 卦历页：按钮按内容宽度，不要拉满 ---------- */
  .m-rec .rec-toolbar .btn { flex: 0 0 auto; width: auto; padding-left: 16px; padding-right: 16px; }
  .m-rec .rec-toolbar select { flex: 0 0 auto; width: auto; min-width: 150px; font-size: 13px; }
  .m-rec .rec-toolbar input[type="search"] { flex: 1 1 100%; }
  .rec-layout { max-width: 1180px; margin: 0 auto; }

  /* ---------- 工具页：十二长生的五行按钮与阶段列表 ---------- */
  .cs-wx { display: flex; flex-wrap: wrap; gap: 8px; }
  .cs-wx > * { flex: 0 0 auto; min-width: 84px; }
  .cs-stage-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px; }

  /* 工具卡片里的胶囊按钮也别拉满 */
  #view-tools .tool-card .btn { width: auto; }

  /* ---------- 设置面板宽一点 ---------- */
  #settingsPop { width: 430px; max-width: 92vw; }
}

/* 打印按钮只在 PC 显示 */
@media (max-width: 900px) {
  #btnPrint { display: none !important; }
}

/* 超宽屏再放宽一点，免得两边空太多 */
@media (min-width: 1600px) {
  .app, .topbar { max-width: 1280px; }
  #view-cast .ct-head, #view-cast .ct-row { max-width: 960px; }
}

/* ============================================================
   打印：底部 dock 是安卓版的组件，PC 打印时必须隐藏
   ============================================================ */
@media print {
  #m-dock { display: none !important; }
  html, body { background: #fff !important; }
  .app { max-width: none !important; padding: 0 !important; margin: 0 !important; }
}
