/* ============================================================
   太一 · 混合设计系统
   C 极简骨架（浅） + 深色画布可视化（.dark section） + 中式点缀
   ============================================================ */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --ink: #1a1d21;
  --ink-2: #4b5563;
  --ink-3: #9aa0a6;
  --line: #e5e7eb;
  --accent: #1f6f5c;
  --accent-soft: #e6f2ee;
  --seal: #a63c2b;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;

  --wood: #3f9b6f; --fire: #d05a4a; --earth: #d9a03d; --metal: #9aa0a6; --water: #3d7fa6;

  /* 深色画布 */
  --d-bg: #0b1120;
  --d-card: #151f38;
  --d-line: #24304f;
  --d-ink: #e6eaf2;
  --d-ink2: #8b96b0;
  --d-accent: #5eead4;
  --d-wood: #4ade80; --d-fire: #f87171; --d-earth: #fbbf24; --d-metal: #e2c792; --d-water: #5eead4;

  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16px;
  overflow-wrap: break-word; /* 长URL/连续拉丁串放不下时断行——防行盒把窄屏顶出横向滚动（yuce 的 yzwlz.cn/...do 实例） */
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* 长代码串/文件名按任意字符断行——防不可断 token 把窄屏文档撑出横向滚动（liuyao 的 js/{config,...}.js 实例） */
code, .code { overflow-wrap: anywhere; word-break: break-all; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 250, 250, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; font-size: 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.seal {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--seal); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-family: var(--serif);
  box-shadow: 0 2px 6px rgba(166, 60, 43, .35);
  flex: none;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--ink-2); font-size: 14px; padding: 6px 12px;
  border-radius: 8px; white-space: nowrap;
}
.nav-links a:hover { background: #f0f1f3; text-decoration: none; }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
/* 手机汉堡导航（桌面默认隐藏，≤720px 由移动端断点亮出） */
.nav-burger, .nav-mask, .nav-drawer { display: none; }

/* ---------- 通用区块 ---------- */
.section { padding: 56px 0; }
.section.tight { padding: 36px 0; }
.eyebrow {
  font-size: 13px; letter-spacing: .14em; color: var(--accent);
  font-weight: 700; text-transform: uppercase; margin-bottom: 8px;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.35; }
.h-title { font-size: 30px; margin-bottom: 12px; }
.lead { color: var(--ink-2); max-width: 640px; }
.quote {
  font-family: var(--serif); color: var(--ink-2);
  border-left: 3px solid var(--seal); padding: 4px 0 4px 16px;
  margin: 20px 0; font-size: 15px;
}

/* ---------- 卡片 / 网格 ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.2,.9,.2,1), box-shadow .3s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(16,24,40,.13); }
.card h3 { font-size: 17px; margin-bottom: 8px; }
.card p { color: var(--ink-2); font-size: 14px; }
.card .num { font-family: var(--serif); font-size: 26px; color: var(--accent); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 12px 24px; border-radius: 10px; font-size: 15px; font-weight: 600;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { text-decoration: none; box-shadow: 0 6px 16px rgba(31, 111, 92, .3); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); box-shadow: none; }

/* ---------- 五行标签 ---------- */
.wx { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.wx.wood  { color: var(--wood);  background: color-mix(in srgb, var(--wood) 12%, #fff); }
.wx.fire  { color: var(--fire);  background: color-mix(in srgb, var(--fire) 12%, #fff); }
.wx.earth { color: var(--earth); background: color-mix(in srgb, var(--earth) 14%, #fff); }
.wx.metal { color: #6b7280;      background: color-mix(in srgb, var(--metal) 20%, #fff); }
.wx.water { color: var(--water); background: color-mix(in srgb, var(--water) 12%, #fff); }

/* ---------- 表单 ---------- */
label.f-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
input[type="date"], input[type="text"], select {
  width: 100%; padding: 11px 14px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  font-family: var(--sans);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* ---------- 表格 ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { color: var(--ink-2); font-weight: 600; font-size: 13px; background: #f6f7f8; }
.tbl tr:hover td { background: #fafbfc; }

/* ---------- 评分条 ---------- */
.score-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
.score-row .zang { width: 88px; flex: none; color: var(--ink-2); }
/* 注：.score-track / .score-fill 在页面中以 <span> 书写，须显式 blockify，否则 width/height 失效 */
.score-track { display: block; flex: 1; height: 10px; background: #eef0f2; border-radius: 999px; overflow: hidden; }
.score-fill { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.score-val { width: 40px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- 深色画布区块 ---------- */
.dark {
  background: var(--d-bg); color: var(--d-ink);
  border-radius: 20px; padding: 40px 32px; margin: 24px 0;
  position: relative; overflow: hidden;
}
.dark::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 300px at 85% -10%, rgba(94, 234, 212, .08), transparent 60%),
    radial-gradient(500px 260px at 5% 110%, rgba(248, 113, 113, .06), transparent 60%);
}
.dark .eyebrow { color: var(--d-accent); }
.dark h2, .dark h3 { color: var(--d-ink); }
.dark .lead, .dark p { color: var(--d-ink2); }
.dark .d-card {
  background: var(--d-card); border: 1px solid var(--d-line);
  border-radius: var(--radius); padding: 18px;
}
.dark .wx.wood  { color: var(--d-wood);  background: rgba(74, 222, 128, .12); }
.dark .wx.fire  { color: var(--d-fire);  background: rgba(248, 113, 113, .12); }
.dark .wx.earth { color: var(--d-earth); background: rgba(251, 191, 36, .12); }
.dark .wx.metal { color: var(--d-metal); background: rgba(226, 199, 146, .12); }
.dark .wx.water { color: var(--d-water); background: rgba(94, 234, 212, .12); }

/* ---------- 周天环 ---------- */
.ring-box { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ring {
  --seg: 60deg;
  width: 280px; height: 280px; border-radius: 50%;
  background: conic-gradient(
    var(--d-wood) 0 60deg, var(--d-fire) 60deg 120deg, var(--d-earth) 120deg 180deg,
    var(--d-metal) 180deg 240deg, var(--d-water) 240deg 300deg, var(--d-fire) 300deg 360deg);
  -webkit-mask: radial-gradient(circle, transparent 96px, #000 97px);
          mask: radial-gradient(circle, transparent 96px, #000 97px);
  opacity: .9;
}
.ring-hub {
  margin-top: -196px; width: 160px; height: 160px; border-radius: 50%;
  background: var(--d-bg); border: 1px solid var(--d-line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--serif); z-index: 1;
}
.ring-hub .gz { font-size: 30px; color: var(--d-accent); }
.ring-hub .sub { font-size: 12px; color: var(--d-ink2); }

/* ---------- 时间轴 ---------- */
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--d-line); }
.tl-item { position: relative; padding: 0 0 22px 12px; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--d-card); border: 2px solid var(--d-accent);
}
.tl-item.now::before { background: var(--d-accent); box-shadow: 0 0 12px var(--d-accent); }
.tl-item .yr { font-family: var(--serif); color: var(--d-accent); font-size: 15px; }
.tl-item .doc { font-size: 13px; color: var(--d-ink2); }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); padding: 32px 0 48px; margin-top: 40px; color: var(--ink-3); font-size: 13px; }

/* ---------- 梅花易数：分段切换 ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button {
  border: 0; background: transparent; cursor: pointer; font-family: var(--sans);
  padding: 9px 18px; font-size: 14px; color: var(--ink-2); border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: #f6f7f8; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }

/* ---------- 卦画 ---------- */
/* lines 数组以初爻为下标 0，故 column-reverse 让初爻落在最下方（传统画法）*/
.gua { display: flex; flex-direction: column-reverse; align-items: center; gap: 7px; }
.gua .yao { position: relative; display: block; height: 10px; width: 82px; border-radius: 2px; background: var(--ink-2); }
.gua .yao.yang { background: var(--ink-2); }
.gua .yao.yin { background: linear-gradient(90deg, var(--ink-2) 0 41%, transparent 41% 59%, var(--ink-2) 59% 100%); }
.gua .yao.moving { background: var(--seal); }
.gua .yao.moving.yin { background: linear-gradient(90deg, var(--seal) 0 41%, transparent 41% 59%, var(--seal) 59% 100%); }
.gua .yao.moving::after { content: "动"; position: absolute; left: 90px; top: -3px; font-size: 11px; color: var(--seal); }
.gua.big .yao { width: 110px; height: 13px; }
.gua.big .yao.moving::after { left: 118px; top: 0; }

/* ---------- 三卦卡（本 / 互 / 变）---------- */
.gua-card { text-align: center; cursor: pointer; }
.gua-card .g-role { font-size: 12px; letter-spacing: .1em; color: var(--ink-3); }
.gua-card .g-box { display: flex; justify-content: center; margin: 14px 0 12px; min-height: 100px; }
.gua-card .g-name { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.gua-card .g-struct { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.mark { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin-top: 6px; }
.mark.ti { color: var(--accent); background: var(--accent-soft); }
.mark.yong { color: var(--seal); background: color-mix(in srgb, var(--seal) 12%, #fff); }

/* ---------- 断语徽标 ---------- */
.luck { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.luck.ji { color: var(--wood); background: color-mix(in srgb, var(--wood) 12%, #fff); }
.luck.xiaoji { color: var(--earth); background: color-mix(in srgb, var(--earth) 14%, #fff); }
.luck.xiong { color: var(--seal); background: color-mix(in srgb, var(--seal) 12%, #fff); }
.luck.unknown { color: var(--ink-3); background: #f2f3f5; }

/* ---------- 列表小标签 ---------- */
.chip {
  display: inline-block; padding: 2px 9px; margin: 4px 5px 0 0; font-size: 12px;
  color: var(--ink-2); background: #fff; border: 1px solid var(--line); border-radius: 999px;
}
.chip.btnish { cursor: pointer; }
.chip.btnish:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 卦气 / 运气并比条 ---------- */
.cmp-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; font-size: 14px; }
.cmp-row .zang { width: 88px; flex: none; color: var(--ink-2); }
.cmp-stack { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.cmp-line { display: flex; align-items: center; gap: 8px; }
.cmp-line .who { width: 30px; flex: none; font-size: 11px; color: var(--ink-3); }
.cmp-track { display: block; flex: 1; height: 8px; background: #eef0f2; border-radius: 999px; overflow: hidden; }
.cmp-fill { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.cmp-val { width: 84px; flex: none; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.cmp-val .raw { font-size: 11px; color: var(--ink-3); margin-left: 4px; }
.cmp-delta { width: 58px; flex: none; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; }
.cmp-delta.up { color: var(--fire); } .cmp-delta.down { color: var(--water); } .cmp-delta.flat { color: var(--ink-3); }

/* ---------- 详情弹窗 ---------- */
.mh-modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(16, 24, 40, .45);
}
.mh-modal .box {
  width: 100%; max-width: 600px; max-height: 82vh; overflow: auto; background: #fff;
  border-radius: var(--radius); padding: 26px; box-shadow: 0 20px 60px rgba(16, 24, 40, .3);
}
.mh-modal h3 { font-family: var(--serif); font-size: 21px; margin-bottom: 2px; }
.mh-modal .close { float: right; border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-3); }
.mh-modal h4 { font-size: 13px; color: var(--accent); margin: 18px 0 6px; letter-spacing: .06em; }
.mh-modal p { font-size: 14px; color: var(--ink-2); }

/* ---------- 工具类 ---------- */
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.muted { color: var(--ink-3); font-size: 13px; }
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; }
/* 宽表横滚容器：常开，桌面与窄屏一律可滚，触屏带惯性 */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
  body { font-size: 15px; }
  .wrap { padding: 0 16px; }
  .section { padding: 40px 0; }
  .h-title { font-size: 24px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .nav-inner { padding: 10px 16px; gap: 12px; }
  .brand { font-size: 16px; }
  .dark { padding: 28px 18px; border-radius: 16px; }
  .btn { width: 100%; }
  input[type="date"], input[type="text"], select { font-size: 15px; } /* 防 iOS 聚焦缩放 */
  .score-row .zang { width: 72px; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; padding: 9px 6px; }
  .gua .yao { width: 64px; }
  .gua .yao.moving::after { left: 72px; }
  .gua-card .g-box { min-height: 0; }
  .cmp-row .zang { width: 68px; }
  .cmp-delta { width: 38px; }
  table.tbl { display: block; width: max-content; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; } /* 窄屏宽表横滚兜底，无需包裹层 */
  /* 弹窗改底部抽屉：全宽贴底 + 顶部圆角 + 小灰条拖动暗示 */
  .mh-modal { padding: 0; align-items: flex-end; }
  .mh-modal .box {
    max-width: 100%; max-height: 80vh; padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(16, 24, 40, .28);
    animation: dy-sheet-up .22s ease-out;
  }
  .mh-modal .box::before {
    content: ""; display: block; width: 38px; height: 4px; border-radius: 2px;
    background: var(--line); margin: -4px auto 12px;
  }

  /* ===== 手机汉堡导航：横滑导航隐藏，☰ 下拉分组面板切换模块 ===== */
  .nav-links { display: none; }                    /* 横滑 11 项退役 */
  .nav-burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin-left: auto;
    border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .nav-burger span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; position: relative; }
  .nav-burger span::before, .nav-burger span::after {
    content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: var(--ink); border-radius: 2px;
  }
  .nav-burger span::before { top: -6px; } .nav-burger span::after { top: 6px; }
  .nav-mask {
    display: block;
    position: fixed; inset: 0; z-index: 90; background: rgba(16, 24, 40, .4);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .nav-mask.on { opacity: 1; pointer-events: auto; }
  .nav-drawer {
    display: block;
    position: fixed; top: 0; left: 0; right: 0; z-index: 95;
    background: var(--surface); border-bottom: 1px solid var(--line);
    border-radius: 0 0 16px 16px; box-shadow: 0 12px 32px rgba(16, 24, 40, .12);
    max-height: 78vh; overflow-y: auto; padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateY(-100%); transition: transform .22s ease-out;
    pointer-events: none; visibility: hidden;
  }
  .nav-drawer.on { transform: none; pointer-events: auto; visibility: visible; }
  .nav-drawer .nd-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
  .nav-drawer .nd-title { font-family: var(--serif); font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: .08em; }
  .nav-drawer .nd-close { border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--ink-3); padding: 8px 10px; cursor: pointer; }
  .nav-drawer .nd-group { margin-top: 12px; }
  .nav-drawer .nd-gname { font-size: 12px; font-weight: 600; letter-spacing: .16em; color: var(--ink-3); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
  .nav-drawer .nd-gname::after { content: ""; flex: 1; height: 1px; background: var(--line); }
  .nav-drawer .nd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .nav-drawer .nd-grid a {
    display: flex; align-items: center; justify-content: center; min-height: 48px;
    border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
    color: var(--ink-2); font-size: 14px; font-weight: 600; text-decoration: none;
  }
  .nav-drawer .nd-grid a.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
  .nav-drawer .nd-grid a:active { transform: scale(.96); }

  /* ===== 移动阅读层（375px 体检数据驱动的四项修复，仅手机端生效） ===== */
  /* ① iOS 聚焦缩放根治：可聚焦控件一律 16px（覆盖各页内联小号输入框，全站 60+ 处） */
  input, select, textarea { font-size: 16px !important; }
  /* ② 小字下限 12px：全站 <12px 的标签/徽章/注脚类统一提升（体检：.tag×112 / .badge×51 / .anchor×35 / .small×12 / .text×13 / .n×11 等） */
  .tag, .anchor, .badge, .small, .text, .sub, .bal, .uv-k, .n, .nc-tag, .tl-label,
  .fx-mark, .now-badge, .wcol-label, kbd, small { font-size: 12px !important; }
  /* ③ 触控目标加大：控件型命中区 ≥44px（导航链接 33h→44h、折叠头/按钮兜底） */
  .nav-links a { padding: 10px 12px; }
  .seg button, button, summary { min-height: 44px; }
  summary { display: flex; align-items: center; }
  /* 手册页密排锚点（35 个 14h）：内联块 + padding 扩命中区，44 会爆版取折中 */
  .anchor { display: inline-block; padding: 7px 9px; margin: 2px; line-height: 1.2; }
}
@keyframes dy-sheet-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ===== 触控反馈（桌面无感知的全局微调） ===== */
html { -webkit-tap-highlight-color: transparent; }  /* 去灰闪 */
body { touch-action: manipulation; }                 /* 去双击缩放延迟，保留双指缩放 */
button:active, a:active { opacity: .72; }            /* 轻按压反馈 */
