/* =========================================================
   玄机盘 · 样式
   墨黑 / 宣纸 / 鎏金 / 朱砂
   ========================================================= */

:root {
  --ink: #12100d;
  --ink-2: #1b1815;
  --ink-3: #242019;
  --paper: #f7f2e7;
  --paper-2: #efe7d6;
  --paper-3: #e6dbc4;
  --line: #d9cdb4;
  --line-2: #c9b997;
  --gold: #b8913f;
  --gold-2: #d8b76a;
  --gold-soft: rgba(200, 164, 92, 0.16);
  --red: #b03a2e;
  --red-2: #d05a4a;
  --text: #2b261e;
  --text-2: #5d5446;
  --text-3: #8a7f6b;
  --green: #2f7d5b;
  --blue: #2f5f9e;
  --brand: #4d6bfe;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", "STSong", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(40, 30, 10, 0.06), 0 4px 14px rgba(40, 30, 10, 0.05);
  --shadow: 0 2px 6px rgba(40, 30, 10, 0.07), 0 14px 40px rgba(40, 30, 10, 0.08);
  --max: 1200px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 宣纸肌理 */
body::before {
  content: "";
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(184, 145, 63, 0.07), transparent 40%),
    radial-gradient(circle at 85% 0%, rgba(176, 58, 46, 0.05), transparent 45%),
    radial-gradient(circle at 50% 120%, rgba(47, 95, 158, 0.05), transparent 50%);
}

main, header, footer { position: relative; z-index: 1; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.3; margin: 0; letter-spacing: 0.01em; }
p { margin: 0 0 0.8em; }
a { color: inherit; }
img, canvas { max-width: 100%; }
b, strong { font-weight: 700; }

.wrap { width: min(var(--max), calc(100% - 48px)); margin: 0 auto; }

/* ---------------- 导航 ---------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(18, 16, 13, 0.72);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid rgba(200, 164, 92, 0.16);
  transition: background 0.3s;
}
.nav.solid { background: rgba(18, 16, 13, 0.95); }
.nav-inner {
  width: min(var(--max), calc(100% - 40px)); margin: 0 auto;
  height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #f3ead6; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, #2a241c, #14110d);
  border: 1px solid rgba(200, 164, 92, 0.55);
  color: var(--gold-2); font-family: var(--serif); font-size: 18px;
  box-shadow: inset 0 0 12px rgba(200, 164, 92, 0.12);
}
.brand-text { font-family: var(--serif); font-size: 17px; font-weight: 700; line-height: 1.1; letter-spacing: 0.06em; display: flex; flex-direction: column; }
.brand-text small { font-family: var(--sans); font-size: 9px; letter-spacing: 0.16em; color: rgba(216, 183, 106, 0.6); font-weight: 400; }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none; color: rgba(243, 234, 214, 0.72); font-size: 13px;
  padding: 6px 11px; border-radius: 8px; transition: 0.2s; letter-spacing: 0.04em;
}
.nav-links a:hover, .nav-links a.active { color: var(--gold-2); background: rgba(200, 164, 92, 0.12); }
.nav-links a.nav-result { display: none; }
body.has-result .nav-links a.nav-result { display: block; }
.nav-toggle {
  display: none; background: none; border: 1px solid rgba(200, 164, 92, 0.4); color: var(--gold-2);
  width: 38px; height: 34px; border-radius: 8px; font-size: 16px; cursor: pointer;
}



/* ---------------- 通用组件 ---------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin-bottom: 12px;
}
.eyebrow .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }

.card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 19px; }
.muted { color: var(--text-3); font-size: 12px; font-weight: 400; }
.tiny { font-size: 11.5px; color: var(--text-3); margin: 12px 0 0; }
.hint { font-size: 11.5px; color: var(--text-3); margin: 6px 0 0; line-height: 1.5; }
.opt { font-size: 10.5px; color: var(--text-3); font-weight: 400; margin-left: 4px; }
.sub-h { font-size: 13px; color: var(--text-2); margin: 20px 0 10px; letter-spacing: 0.08em; }
.gold { color: var(--gold); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  font-family: var(--sans); font-size: 14px; font-weight: 600; padding: 11px 20px;
  transition: 0.18s; text-decoration: none;
}
.btn-main {
  background: linear-gradient(160deg, #2a2318, #17130e);
  color: #f4e8c8; border-color: rgba(200, 164, 92, 0.5);
  box-shadow: 0 6px 18px rgba(30, 22, 8, 0.22), inset 0 1px 0 rgba(255, 236, 190, 0.12);
  width: 100%; padding: 14px 20px; font-size: 15px; letter-spacing: 0.06em;
}
.btn-main:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(30, 22, 8, 0.28), inset 0 1px 0 rgba(255, 236, 190, 0.18); }
.btn-ghost {
  background: #fffdf8; color: var(--text-2); border-color: var(--line-2);
  font-weight: 500; padding: 9px 14px; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); background: #fff; }
.btn.sm { padding: 7px 12px; font-size: 12px; }
.btn:active { transform: scale(0.985); }

.pill {
  font-size: 10.5px; letter-spacing: 0.12em; color: var(--gold);
  border: 1px solid rgba(184, 145, 63, 0.35); border-radius: 99px; padding: 3px 10px;
}

/* ---------------- Hero ---------------- */
.hero {
  position: relative; overflow: hidden;
  background: radial-gradient(1200px 600px at 15% 0%, #221d16 0%, #12100d 55%, #0c0a08 100%);
  color: #f3ead6; padding: 118px 0 72px;
}
.hero-bg {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0; opacity: 0.5;
  background-image:
    repeating-linear-gradient(0deg, rgba(200, 164, 92, 0.05) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(90deg, rgba(200, 164, 92, 0.05) 0 1px, transparent 1px 64px);
  mask-image: radial-gradient(700px 500px at 70% 20%, #000 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(700px 500px at 70% 20%, #000 0%, transparent 80%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 48px; align-items: start; position: relative; }
.hero-left { padding-top: 8px; }
.hero h1 { font-size: clamp(34px, 4.4vw, 54px); color: #fbf5e6; letter-spacing: 0.02em; line-height: 1.22; }
.hero h1 .gold { color: var(--gold-2); }
.hero-sub { color: rgba(243, 234, 214, 0.66); font-size: 15px; margin: 18px 0 0; max-width: 30em; line-height: 1.8; }
.hero-compass { position: relative; width: min(100%, 380px); aspect-ratio: 1; margin: 26px 0 4px; }
.hero-compass canvas { width: 100%; height: 100%; display: block; border-radius: 50%; }
.hero-compass-cap { text-align: center; font-size: 10.5px; letter-spacing: 0.16em; color: rgba(200, 164, 92, 0.5); margin-top: 6px; }
.hero-points { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.hero-points li { font-size: 12.5px; color: rgba(243, 234, 214, 0.6); padding-left: 16px; position: relative; }
.hero-points li::before { content: "◆"; position: absolute; left: 0; color: var(--gold); font-size: 8px; top: 4px; }
.hero-points b { color: var(--gold-2); font-weight: 600; margin-right: 8px; }

.hero-stats {
  display: flex;
  gap: 26px;
  margin: 22px 0 0;
  padding: 15px 0 0;
  border-top: 1px solid rgba(200, 164, 92, 0.16);
  flex-wrap: wrap;
}
.hero-stats > div { display: flex; flex-direction: column; gap: 3px; }
.hero-stats b {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1;
  color: #ecd8a8;
  font-weight: 700;
}
.hero-stats span { font-size: 10.5px; letter-spacing: 0.12em; color: rgba(243, 234, 214, 0.35); }

/* 表单 */
.form { color: var(--text); position: sticky; top: 84px; }
.form-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.form-head h2 { font-size: 22px; }
.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; letter-spacing: 0.04em; }
input[type="text"], input[type="date"], input[type="time"], input[type="number"], input[type="search"], select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: #fffefb; color: var(--text); font-family: var(--sans); font-size: 14px;
  transition: 0.18s; appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238a7f6b' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 145, 63, 0.14); }
.seg { display: flex; gap: 6px; background: var(--paper-2); padding: 4px; border-radius: 10px; }
.seg button {
  flex: 1; border: none; background: transparent; padding: 8px 10px; border-radius: 7px;
  font-family: var(--sans); font-size: 13px; color: var(--text-2); cursor: pointer; transition: 0.18s; font-weight: 500;
}
.seg button.on { background: #fffdf8; color: var(--text); box-shadow: 0 1px 4px rgba(40, 30, 10, 0.1); font-weight: 700; }
.seg.small button { font-size: 12px; padding: 6px 8px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-2); margin-top: 9px; cursor: pointer; line-height: 1.5; }
.check input { margin: 3px 0 0; accent-color: var(--gold); width: 15px; height: 15px; flex: none; }
.adv { margin: 4px 0 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.adv summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary::before { content: "+"; color: var(--gold); font-weight: 700; }
.adv[open] summary::before { content: "−"; }
.adv-body { padding-top: 12px; }
.solar-box { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; }
.solar-box label { font-size: 11.5px; color: var(--text-2); font-weight: 600; display: block; margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.form-note { font-size: 11px; color: var(--text-3); text-align: center; margin: 12px 0 0; line-height: 1.6; }

/* ---------------- 结果 ---------------- */
.result { padding: 52px 0 28px; background: var(--paper); scroll-margin-top: 70px; }
.result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.result-head h2 { font-size: clamp(26px, 3vw, 34px); }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.overview { display: grid; grid-template-columns: 1fr 1.1fr 1.5fr 1fr; gap: 0; padding: 0; overflow: hidden; margin-bottom: 16px; }
.overview > div { padding: 20px 22px; border-right: 1px solid var(--line); }
.overview > div:last-child { border-right: none; }
.ov-label { font-size: 10.5px; letter-spacing: 0.14em; color: var(--text-3); margin-bottom: 6px; }
.ov-value { font-family: var(--serif); font-size: 17px; font-weight: 700; line-height: 1.4; }
.ov-sub { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.ov-bazi { display: flex; gap: 8px; flex-wrap: wrap; }
.ov-bazi span {
  font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1;
  padding: 6px 8px; border-radius: 8px; background: var(--paper);
}
.ov-bazi small { display: block; font-family: var(--sans); font-size: 9px; color: var(--text-3); text-align: center; font-weight: 400; margin-top: 4px; letter-spacing: 0.1em; }

/* 四柱表 */
.pillar-scroll { overflow-x: auto; }
.pillar-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 620px; }
.pillar-table th, .pillar-table td { padding: 9px 8px; text-align: center; vertical-align: middle; border-bottom: 1px solid var(--paper-3); }
.pillar-table thead th {
  font-family: var(--serif); font-size: 13px; color: #f4e8c8; background: var(--ink-2); font-weight: 600;
  letter-spacing: 0.16em; padding: 10px;
}
.pillar-table thead th:first-child { border-radius: 10px 0 0 0; }
.pillar-table thead th:last-child { border-radius: 0 10px 0 0; }
.pillar-table tbody th { font-size: 11.5px; color: var(--text-3); text-align: left; padding-left: 14px; font-weight: 500; letter-spacing: 0.08em; width: 86px; background: #fffdf8; }
.pillar-table td.ganzhi-cell { padding: 10px 8px 12px; }
.gan-row, .zhi-row { font-family: var(--serif); font-weight: 700; line-height: 1.15; }
.gan-row { font-size: 40px; }
.zhi-row { font-size: 40px; margin-top: 2px; }
.ss-tag { font-size: 10.5px; color: var(--text-3); margin-bottom: 2px; letter-spacing: 0.06em; }
.wx-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-left: 3px; vertical-align: middle; }
.pillar-table td.wx-cell { font-size: 12px; color: var(--text-2); }
.hide-gan { display: inline-flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.hide-gan span { font-family: var(--serif); font-size: 14px; padding: 1px 5px; border-radius: 5px; background: var(--paper); }
.pillar-table td.day-col { background: rgba(184, 145, 63, 0.055); }
.pillar-table thead th.day-col { background: #3a2f1c; color: var(--gold-2); }
.dm-badge { display: inline-block; font-size: 10px; color: #fff; background: var(--gold); border-radius: 99px; padding: 1px 8px; margin-bottom: 6px; letter-spacing: 0.08em; }

/* 五行条 */
.wx-bars { display: grid; gap: 11px; }
.wx-row { display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; gap: 10px; }
.wx-name { font-family: var(--serif); font-size: 16px; font-weight: 700; white-space: nowrap; }
.wx-name em { font-family: var(--sans); font-style: normal; font-size: 9.5px; color: var(--text-3); margin-left: 3px; font-weight: 400; }
.wx-bar { height: 9px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.wx-bar i { display: block; height: 100%; border-radius: 99px; transition: width 0.8s cubic-bezier(.2, .8, .2, 1); }
.wx-val { font-size: 11.5px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wx-verdict { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--text-2); line-height: 1.75; }
.wx-verdict b { color: var(--text); }

.ss-list { display: grid; gap: 9px; }
.ss-item { display: grid; grid-template-columns: 84px 1fr 40px; gap: 10px; align-items: center; font-size: 12.5px; }
.ss-item .ss-rel { color: var(--text-2); }
.ss-item .ss-bar { height: 7px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.ss-item .ss-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.ss-item .ss-num { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 11.5px; }

/* 解读 */
#personality .p-title, #yongshen .p-title { font-family: var(--serif); font-size: 18px; margin-bottom: 6px; }
#personality .p-body, #yongshen .p-body { font-size: 13.5px; color: var(--text-2); line-height: 1.85; }
#personality .p-season, #yongshen .p-season { margin-top: 10px; font-size: 12.5px; color: var(--text-3); border-left: 2px solid var(--gold-2); padding-left: 10px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.chip {
  font-size: 12px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line-2);
  color: var(--text-2); background: #fff;
}
.chip.good { border-color: rgba(47, 125, 91, 0.4); color: var(--green); background: rgba(47, 125, 91, 0.06); }
.chip.bad { border-color: rgba(176, 58, 46, 0.35); color: var(--red); background: rgba(176, 58, 46, 0.05); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.grid-2 > .card { height: 100%; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.mini-grid h4 { font-size: 12px; color: var(--text-3); letter-spacing: 0.12em; margin-bottom: 10px; font-family: var(--sans); }
.cs-list, .kv-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 12.5px; }
.cs-list li { display: block; line-height: 1.5; }
.cs-list li b { font-family: var(--serif); font-size: 13px; color: var(--text); margin-right: 6px; }
.cs-list li .cs-state { color: var(--gold); font-size: 11.5px; }
.cs-list li .cs-desc { display: block; color: var(--text-3); font-size: 11px; margin-top: 1px; }
.kv-list li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--paper-3); padding-bottom: 6px; }
.kv-list li span:first-child { color: var(--text-3); }
.kv-list li span:last-child { font-weight: 600; text-align: right; }
.ss-badges { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.ss-badges li { font-size: 11.5px; padding: 4px 10px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); cursor: help; position: relative; }
.ss-badges li:hover::after {
  content: attr(data-desc); position: absolute; left: 0; bottom: calc(100% + 6px); width: 220px;
  background: var(--ink-2); color: #f3ead6; font-size: 11px; line-height: 1.6; padding: 8px 10px;
  border-radius: 8px; z-index: 10; box-shadow: var(--shadow); white-space: normal;
}

/* 大运 */
.dayun-scroll, .liunian-scroll { overflow-x: auto; padding-bottom: 6px; }
.dayun { display: flex; gap: 10px; min-width: max-content; padding: 4px 2px 10px; }
.dy {
  width: 104px; flex: none; border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px;
  text-align: center; background: #fffdf8; position: relative; transition: 0.2s;
}
.dy:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.dy.now { border-color: var(--red); background: rgba(176, 58, 46, 0.04); }
.dy.now::before { content: "当前"; position: absolute; top: -8px; left: 50%; transform: translateX(-50%); font-size: 9px; background: var(--red); color: #fff; padding: 0 7px; border-radius: 99px; }
.dy-jz { font-family: var(--serif); font-size: 24px; font-weight: 700; line-height: 1.1; }
.dy-ss { font-size: 10.5px; color: var(--gold); margin: 3px 0 6px; letter-spacing: 0.06em; }
.dy-age { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.dy-year { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.liunian { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; min-width: 640px; }
.ln { text-align: center; padding: 7px 2px; border-radius: 8px; border: 1px solid transparent; font-size: 11px; }
.ln:hover { background: var(--paper); }
.ln .ln-y { color: var(--text-3); font-size: 10px; }
.ln .ln-jz { font-family: var(--serif); font-size: 13px; font-weight: 700; }
.ln.now { border-color: var(--red); background: rgba(176, 58, 46, 0.05); }
.ln.now .ln-y { color: var(--red); }

.advice-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.advice { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fffdf8; }
.advice .a-k { font-size: 10.5px; letter-spacing: 0.1em; color: var(--text-3); }
.advice .a-v { font-family: var(--serif); font-size: 20px; font-weight: 700; margin: 4px 0 6px; color: var(--gold); }
.advice .a-d { font-size: 11.5px; color: var(--text-3); line-height: 1.65; }

/* ---------------- 区块 ---------------- */
.section { padding: 64px 0; scroll-margin-top: 64px; }
.section.alt { background: linear-gradient(180deg, var(--paper-2), var(--paper)); }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.sec-head h2 { font-size: clamp(26px, 3.2vw, 36px); }
.sec-sub { color: var(--text-2); font-size: 13.5px; margin: 10px 0 0; max-width: 62ch; line-height: 1.75; }
.sec-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.date-input { width: auto !important; min-width: 150px; }

/* 罗盘 */
.luopan-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.luopan-card { padding: 16px; }
.luopan-wrap { position: relative; width: 100%; aspect-ratio: 1; max-height: 560px; margin: 0 auto; }
.luopan-wrap canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.luopan-tools { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 11px; color: var(--text-3); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.shan-scroll { max-height: 560px; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { position: sticky; top: 0; background: var(--ink-2); color: #f4e8c8; font-weight: 600; padding: 9px 8px; text-align: left; font-size: 11px; letter-spacing: 0.06em; z-index: 2; }
.data-table td { padding: 8px; border-bottom: 1px solid var(--paper-3); vertical-align: top; }
.data-table tr:hover td { background: var(--paper); }
.data-table tr.active td { background: rgba(184, 145, 63, 0.12); }
.shan-name { font-family: var(--serif); font-size: 19px; font-weight: 700; }
.note-card { margin-top: 20px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 10px; }
.cols-3 h4 { font-size: 13px; color: var(--gold); margin-bottom: 6px; letter-spacing: 0.08em; }
.cols-3 p { font-size: 12.5px; color: var(--text-2); margin: 0; line-height: 1.75; }

/* 黄历 */
.almanac { display: grid; grid-template-columns: 300px 1fr; gap: 0; padding: 0; overflow: hidden; }
.al-left { background: var(--ink); color: #f4e8c8; padding: 26px 24px; }
.al-date { font-family: var(--serif); font-size: 15px; color: rgba(244, 232, 200, 0.7); }
.al-day { font-family: var(--serif); font-size: 44px; font-weight: 700; line-height: 1.1; margin: 8px 0 2px; color: #fbf5e6; }
.al-lunar { font-size: 13px; color: var(--gold-2); margin-bottom: 16px; }
.al-bazi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.al-bazi div { text-align: center; background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 7px 2px; }
.al-bazi .b-k { font-size: 9.5px; color: rgba(244, 232, 200, 0.55); }
.al-bazi .b-v { font-family: var(--serif); font-size: 15px; font-weight: 700; margin-top: 2px; }
.al-meta { font-size: 11.5px; color: rgba(244, 232, 200, 0.62); line-height: 1.8; }
.al-meta b { color: var(--gold-2); font-weight: 500; }
.al-right { padding: 24px; }
.yiji { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.yiji .yi, .yiji .ji { border-radius: 10px; padding: 14px; }
.yiji .yi { background: rgba(47, 125, 91, 0.07); border: 1px solid rgba(47, 125, 91, 0.18); }
.yiji .ji { background: rgba(176, 58, 46, 0.05); border: 1px solid rgba(176, 58, 46, 0.16); }
.yiji h4 { font-size: 12px; letter-spacing: 0.14em; margin-bottom: 8px; }
.yiji .yi h4 { color: var(--green); }
.yiji .ji h4 { color: var(--red); }
.yiji .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.yiji .tags span { font-size: 11.5px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.al-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.al-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fffdf8; }
.al-item .k { font-size: 10.5px; color: var(--text-3); letter-spacing: 0.08em; }
.al-item .v { font-size: 13px; font-weight: 600; margin-top: 2px; line-height: 1.5; }
.al-item .v.sm { font-size: 12px; font-weight: 500; }
.al-wide { grid-column: span 2; }

/* 我的今日运势 */
.my-day { margin-top: 16px; border: 1px dashed var(--line-2); border-radius: 12px; padding: 16px; background: var(--paper); }
.my-day h4 { font-size: 13px; margin-bottom: 6px; }
.my-day .score { font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--gold); line-height: 1; }

/* 合婚 */
.hehun-form { display: grid; grid-template-columns: 1fr 32px 1fr 150px; gap: 16px; align-items: end; }
.hh-col h4 { font-size: 12px; color: var(--text-3); letter-spacing: 0.1em; margin-bottom: 8px; }
.hh-col .row { margin-bottom: 8px; }
.hh-mid { font-family: var(--serif); font-size: 20px; color: var(--gold); text-align: center; padding-bottom: 40px; }
.hh-action .btn { width: auto; }
.hh-result { margin-top: 24px; padding-top: 24px; border-top: 1px dashed var(--line); }
.hh-score-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.hh-ring {
  width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--paper-2) 0);
  position: relative;
}
.hh-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #fffdf8; }
.hh-ring span { position: relative; font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--gold); }
.hh-level { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.hh-level-sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; max-width: 46ch; }
.hh-items { display: grid; gap: 10px; }
.hh-item { display: grid; grid-template-columns: 170px 130px 1fr; gap: 12px; align-items: baseline; border-bottom: 1px dashed var(--paper-3); padding-bottom: 10px; font-size: 12.5px; }
.hh-item .k { color: var(--text-3); }
.hh-item .v { font-weight: 700; font-family: var(--serif); font-size: 14px; }
.hh-item .d { color: var(--text-2); }

/* 择日 */
.zeri-form { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: end; }
.zeri-form label { font-size: 11.5px; color: var(--text-3); display: grid; gap: 6px; }
.zr-btn .btn { width: 100%; padding: 11px 12px; }
.zr-list { margin-top: 18px; display: grid; gap: 8px; max-height: 460px; overflow: auto; }
.zr-item { display: grid; grid-template-columns: 110px 84px 1fr 1fr; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; background: #fffdf8; }
.zr-item .z-date { font-weight: 700; }
.zr-item .z-date small { display: block; font-weight: 400; color: var(--text-3); font-size: 10.5px; }
.zr-item .z-bazi { font-family: var(--serif); letter-spacing: 0.06em; }
.zr-item .z-yi { color: var(--green); }
.zr-item .z-ji { color: var(--red); }

/* 六十甲子 */
.jz-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.jz-cell {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 6px; text-align: center;
  background: #fffdf8; cursor: pointer; transition: 0.18s;
}
.jz-cell:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.jz-cell .jz-jz { font-family: var(--serif); font-size: 17px; font-weight: 700; line-height: 1.2; }
.jz-cell .jz-ny { font-size: 9.5px; color: var(--text-3); margin-top: 3px; white-space: nowrap; }
.jz-cell.hl { border-color: var(--red); background: rgba(176, 58, 46, 0.05); }
.jz-detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.jz-detail-grid .k { font-size: 10.5px; color: var(--text-3); letter-spacing: 0.08em; }
.jz-detail-grid .v { font-family: var(--serif); font-size: 18px; font-weight: 700; }

/* 知识库 */
.kb-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.kb-nav { position: sticky; top: 84px; display: grid; gap: 4px; }
.kb-nav button {
  text-align: left; background: none; border: 1px solid transparent; border-radius: 9px;
  padding: 9px 12px; font-family: var(--sans); font-size: 12.5px; color: var(--text-2);
  cursor: pointer; display: flex; gap: 9px; align-items: center; transition: 0.18s; line-height: 1.4;
}
.kb-nav button:hover { background: #fffdf8; border-color: var(--line); }
.kb-nav button.on { background: var(--ink-2); color: var(--gold-2); border-color: var(--ink-2); }
.kb-nav .kb-icon { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--paper-2); font-family: var(--serif); font-size: 11px; flex: none; }
.kb-nav button.on .kb-icon { background: rgba(200, 164, 92, 0.18); color: var(--gold-2); }
.kb-body { min-height: 400px; }
.kb-body h2 { font-size: 25px; margin-bottom: 8px; }
.kb-lead { color: var(--text-2); font-size: 14px; border-left: 3px solid var(--gold-2); padding-left: 12px; margin: 12px 0 22px; }
.kb-body h3 { font-size: 16px; margin: 24px 0 10px; color: var(--text); }
.kb-body p { font-size: 13.5px; color: var(--text-2); line-height: 1.9; }
.kb-body ul { padding-left: 18px; margin: 8px 0 14px; }
.kb-body li { font-size: 13.5px; color: var(--text-2); line-height: 1.85; margin-bottom: 5px; }
.kb-body table { width: 100%; border-collapse: collapse; margin: 12px 0 18px; font-size: 12.5px; }
.kb-body th { background: var(--paper-2); color: var(--text); text-align: left; padding: 8px 10px; font-weight: 700; }
.kb-body td { padding: 8px 10px; border-bottom: 1px solid var(--paper-3); color: var(--text-2); vertical-align: top; }
.kb-body tr:hover td { background: var(--paper); }

/* 版权与授权 */
.copyright { background: linear-gradient(180deg, var(--paper-2), var(--paper)); padding: 64px 0; border-top: 1px solid var(--line); }
.copyright h2 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 22px; }
.cr-grid { display: grid; grid-template-columns: 1.35fr 0.9fr; gap: 22px; align-items: start; }
.cr-main, .cr-side { background: #fffdf8; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.cr-line { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.cr-line b { font-family: var(--serif); font-size: 18px; color: var(--gold); }
.cr-sub { font-size: 12.5px; color: var(--text-3); line-height: 1.8; margin-bottom: 14px; }
.cr-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.cr-list li { position: relative; padding-left: 16px; font-size: 12.8px; color: var(--text-2); line-height: 1.8; }
.cr-list li::before { content: "·"; position: absolute; left: 4px; top: 0; color: var(--gold); font-weight: 700; }
.cr-list b { color: var(--text); }
.cr-list span { color: var(--gold); font-weight: 600; }
.cr-badge { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px dashed var(--line); }
.cr-mark {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--ink); color: var(--gold-2); font-family: var(--serif); font-size: 24px;
  border: 1px solid rgba(200, 164, 92, 0.4);
}
.cr-name { font-family: var(--serif); font-size: 18px; font-weight: 700; }
.cr-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; letter-spacing: 0.06em; }
.cr-contact { margin-top: 16px; }
.cr-contact .k, .cr-third .k { font-size: 10.5px; letter-spacing: 0.12em; color: var(--gold); font-weight: 700; margin-bottom: 5px; }
.cr-contact .v { font-size: 12.5px; color: var(--text-2); line-height: 1.75; }
.cr-contact .v a, a.mail { color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(184, 145, 63, 0.35); padding-bottom: 1px; word-break: break-all; }
.cr-contact .v a:hover, a.mail:hover { color: var(--gold-2); border-bottom-color: var(--gold-2); }
.cr-third { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.cr-third p { font-size: 11.5px; color: var(--text-3); line-height: 1.75; margin: 0 0 6px; }

/* 免责 */
.disclaimer { background: var(--ink); color: rgba(243, 234, 214, 0.62); padding: 48px 0; }
.disclaimer h3 { font-size: 16px; color: var(--gold-2); margin-bottom: 12px; letter-spacing: 0.1em; }
.disclaimer p { font-size: 12.5px; line-height: 1.9; max-width: 90ch; }
.disclaimer strong { color: rgba(243, 234, 214, 0.9); }

/* 页脚 */
.foot { background: #0b0a08; color: rgba(243, 234, 214, 0.45); padding: 30px 0; border-top: 1px solid rgba(200, 164, 92, 0.14); }
.foot-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand.small .brand-mark { width: 28px; height: 28px; font-size: 15px; }
.brand.small .brand-text { font-size: 14px; }
.foot-note, .foot-copy { font-size: 11.5px; margin: 0; }
.foot-mail { font-size: 10.5px; opacity: 0.8; }
.foot-note a { color: rgba(216, 183, 106, 0.8); text-decoration: none; border-bottom: 1px solid rgba(216, 183, 106, 0.3); }
.foot-note a:hover { color: var(--gold-2); }

/* 五行配色 */
.wx-mu { color: #2f7d5b !important; }
.wx-huo { color: #b03a2e !important; }
.wx-tu { color: #96702c !important; }
.wx-jin { color: #6d7681 !important; }
.wx-shui { color: #2f5f9e !important; }
.bg-mu { background: #2f7d5b !important; }
.bg-huo { background: #c0503f !important; }
.bg-tu { background: #b8913f !important; }
.bg-jin { background: #8b95a1 !important; }
.bg-shui { background: #3d72b8 !important; }

/* 打印 */
@media print {
  .nav, .hero, .section, .disclaimer, .foot, .result-actions, .luopan-tools { display: none !important; }
  .result { display: block !important; padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; border-color: #ccc; }
}

/* 响应式 */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-compass { max-width: 320px; }
  .form { position: static; }
  .luopan-grid, .kb-layout { grid-template-columns: 1fr; }
  .kb-nav { position: static; grid-template-columns: repeat(2, 1fr); display: grid; }
  .advice-grid { grid-template-columns: repeat(3, 1fr); }
  .overview { grid-template-columns: 1fr 1fr; }
  .overview > div:nth-child(2) { border-right: none; }
  .overview > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .mini-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .almanac { grid-template-columns: 1fr; }
  .hehun-form { grid-template-columns: 1fr; }
  .hh-mid { display: none; }
  .zeri-form { grid-template-columns: repeat(2, 1fr); }
  .cr-grid { grid-template-columns: 1fr; }
  .jz-grid { grid-template-columns: repeat(6, 1fr); }
  .al-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: rgba(18, 16, 13, 0.98); padding: 10px; flex-direction: column;
    border-bottom: 1px solid rgba(200, 164, 92, 0.2);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .nav-user { margin-left: 4px; padding-left: 8px; }
  .nav-user-name { max-width: 64px; }
  .wrap { width: calc(100% - 32px); }
  .section { padding: 52px 0; }
  .hero { padding: 100px 0 52px; }
  .card { padding: 18px; border-radius: 14px; }
  .overview { grid-template-columns: 1fr; }
  .overview > div { border-right: none; border-bottom: 1px solid var(--line); }
  .overview > div:last-child { border-bottom: none; }
  .mini-grid, .advice-grid, .cols-3, .jz-detail-grid { grid-template-columns: 1fr 1fr; }
  .gan-row, .zhi-row { font-size: 32px; }
  .jz-grid { grid-template-columns: repeat(4, 1fr); }
  .yiji { grid-template-columns: 1fr; }
  .hh-item { grid-template-columns: 1fr; gap: 3px; }
  .zr-item { grid-template-columns: 1fr 1fr; }
  .liunian { grid-template-columns: repeat(5, 1fr); }
  .al-day { font-size: 36px; }
  .kb-nav { grid-template-columns: 1fr; }
  .foot-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
