/* ============================================================
   玄鉴 · 设计系统
   羊皮纸画布 / 墨色文字 / 朱砂点睛 / 衬线书卷气
   参考：Claude Design System（温暖编辑式）+ 东方典籍美学
   ============================================================ */
:root {
  /* 画布与纸面 */
  --paper: #f5f4ed;          /* 宣纸底 */
  --ivory: #faf9f5;          /* 卡片纸 */
  --white: #ffffff;
  --sand: #e8e6dc;           /* 交互面 */
  /* 墨色文字 */
  --ink: #141413;            /* 主文字 */
  --ink-2: #5e5d59;          /* 次级 */
  --ink-3: #87867f;          /* 三级/注释 */
  /* 品牌 · 朱砂 */
  --cinnabar: #c96442;
  --cinnabar-deep: #a94f31;
  --cinnabar-soft: #f3e3da;
  /* 边框 */
  --line: #e8e6dc;
  --line-soft: #f0eee6;
  /* 语义 */
  --ok: #4d7c5f;
  --err: #b53333;
  --radius: 14px;
  --shadow-1: 0 1px 2px rgba(20, 20, 19, 0.05), 0 1px 6px rgba(20, 20, 19, 0.04);
  --shadow-2: 0 2px 8px rgba(20, 20, 19, 0.06), 0 8px 28px rgba(20, 20, 19, 0.07);
  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --font-sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(1200px 500px at 50% -100px, rgba(201, 100, 66, 0.05), transparent 60%);
  min-height: 100vh;
  line-height: 1.6;
}
::selection { background: var(--cinnabar); color: #fff; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #d4d2c8; border-radius: 10px; border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

/* 版心与页头 */
.page { max-width: 1060px; margin: 0 auto; padding: 28px 24px 110px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; margin-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand .seal {
  width: 42px; height: 42px; border-radius: 8px;
  background: var(--cinnabar); color: #fdf6ec;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 17px; font-weight: 700; letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(169, 79, 49, 0.25);
}
.brand .name { font-family: var(--font-serif); font-size: 21px; font-weight: 600; letter-spacing: 0.32em; }
.brand .name em { font-style: normal; color: var(--cinnabar); }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.topbar .user b { font-weight: 600; color: var(--ink); }

/* 页面标题 */
.page-title { text-align: center; margin: 40px 0 34px; }
.page-title .gua { font-family: var(--font-serif); font-size: 26px; color: var(--cinnabar); margin-bottom: 6px; }
.page-title .cn { font-family: var(--font-serif); font-size: 38px; font-weight: 600; letter-spacing: 0.28em; }
.page-title .en { font-size: 11px; letter-spacing: 0.5em; color: var(--ink-3); margin-top: 10px; text-transform: uppercase; }

/* 卡片 */
.glass {
  background: var(--ivory);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-1);
}
.glass h2 { font-family: var(--font-serif); font-size: 18px; font-weight: 600; letter-spacing: 0.06em; margin-bottom: 3px; }
.glass .sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 18px; }

/* 表单 */
label { display: block; font-size: 12.5px; color: var(--ink-2); margin: 14px 0 6px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 13px; border-radius: 10px;
  background: var(--white); border: 1px solid var(--line);
  color: var(--ink); font-size: 14.5px; outline: none; font-family: inherit;
  transition: border-color .18s, box-shadow .18s;
}
.input:focus { border-color: var(--cinnabar); box-shadow: 0 0 0 3px rgba(201, 100, 66, 0.12); }
textarea.input { min-height: 110px; resize: vertical; }
.input::placeholder { color: #b3b1a8; }
.row { display: grid; gap: 12px; }
.row.c2 { grid-template-columns: 1fr 1fr; }
.row.c3 { grid-template-columns: 1fr 1fr 1fr; }
.row.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .row.c2, .row.c3, .row.c4 { grid-template-columns: 1fr 1fr; } .row.c4 > *:last-child { grid-column: span 2; } }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 24px; border-radius: 11px; border: none; cursor: pointer;
  font-size: 14.5px; font-weight: 600; font-family: inherit; letter-spacing: 0.08em;
  background: var(--cinnabar); color: #fdf6ec;
  box-shadow: 0 1px 2px rgba(169, 79, 49, 0.3);
  transition: transform .15s, background .2s, box-shadow .2s;
}
.btn:hover { background: var(--cinnabar-deep); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(169, 79, 49, 0.3); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.ghost { background: var(--white); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--sand); border-color: #d6d4ca; }
.btn.sm { padding: 7px 14px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; margin-top: 18px; }

/* 结果 */
.result-box { margin-top: 6px; display: none; }
.result-box.show { display: block; animation: fadeUp .45s cubic-bezier(.2,.7,.3,1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.badge {
  display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px;
  border: 1px solid rgba(201, 100, 66, 0.3); color: var(--cinnabar-deep); margin: 2px 5px 2px 0;
  background: var(--cinnabar-soft);
}
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 640px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
.pillar {
  text-align: center; padding: 16px 8px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); box-shadow: var(--shadow-1);
}
.pillar .t { font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.3em; margin-bottom: 8px; }
.pillar .ganzhi { font-family: var(--font-serif); font-size: 21px; color: var(--ink); letter-spacing: 0.16em; font-weight: 600; }
.pillar .wuxing { font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.pillar .shishen { font-size: 11px; color: var(--cinnabar); margin-top: 4px; }
table.result-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }
.result-table th, .result-table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.result-table th { color: var(--ink-2); font-weight: 600; font-size: 12.5px; }
.result-table tr:hover td { background: #faf9f5; }
.note { font-size: 13px; color: var(--ink-2); line-height: 1.9; margin-top: 10px; }
.quote {
  border-left: 3px solid var(--cinnabar);
  padding: 13px 16px; background: var(--cinnabar-soft);
  border-radius: 0 10px 10px 0;
  color: #6b3a26; font-size: 14px; line-height: 1.9; margin-top: 14px;
}
.quote b { color: var(--cinnabar-deep); }

/* 首页 */
.hero { text-align: center; padding: 46px 10px 12px; }
.hero .seal-big {
  width: 88px; height: 88px; margin: 0 auto 22px;
  border-radius: 14px;
  background: var(--cinnabar);
  color: #fdf2e4;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 34px; font-weight: 700;
  box-shadow: 0 10px 30px rgba(169, 79, 49, 0.35);
  transform: rotate(-2deg);
}
.hero h1 { font-family: var(--font-serif); font-size: 52px; font-weight: 600; letter-spacing: 0.4em; text-indent: 0.4em; }
.hero h1 em { font-style: normal; color: var(--cinnabar); }
.hero p { font-size: 13px; letter-spacing: 0.42em; color: var(--ink-3); margin-top: 14px; text-indent: 0.42em; }
.func-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 46px; }
@media (max-width: 640px) { .func-grid { grid-template-columns: 1fr 1fr; } .hero h1 { font-size: 36px; } }
.func-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 26px 12px; border-radius: 16px; text-decoration: none; color: var(--ink);
  background: var(--ivory); border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition: transform .2s, box-shadow .25s, border-color .2s;
}
.func-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: rgba(201, 100, 66, 0.45); }
.func-card .icon {
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--cinnabar-soft); color: var(--cinnabar-deep);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 22px; font-weight: 600;
}
.func-card .t { font-family: var(--font-serif); font-size: 16px; font-weight: 600; letter-spacing: 0.18em; }
.func-card .d { font-size: 11.5px; color: var(--ink-3); text-align: center; line-height: 1.5; }

/* 消息 */
.alert { padding: 11px 15px; border-radius: 10px; font-size: 13.5px; margin: 14px 0; line-height: 1.7; display: none; }
.alert.show { display: block; animation: fadeUp .3s ease both; }
.alert.err { background: #faeae7; border: 1px solid #ecc9c1; color: var(--err); }
.alert.ok { background: #e9f2ec; border: 1px solid #c6dccb; color: var(--ok); }

/* 底导航（移动端） */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: center; gap: 2px; padding: 8px 8px 14px;
  background: linear-gradient(transparent, var(--paper) 40%);
  backdrop-filter: blur(6px);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 9.5px; color: var(--ink-3); text-decoration: none; padding: 6px 11px; border-radius: 10px;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--cinnabar-deep); background: var(--cinnabar-soft); }
.bottom-nav a .i { font-size: 16px; }
@media (min-width: 641px) { .bottom-nav { display: none; } }

/* 详情折叠 */
details { margin-top: 14px; }
details summary { cursor: pointer; color: var(--ink-3); font-size: 12.5px; list-style: none; }
details summary::before { content: "▸ "; color: var(--cinnabar); }
details[open] summary::before { content: "▾ "; }
pre.json { white-space: pre-wrap; font-size: 11.5px; line-height: 1.7; color: var(--ink-2); margin-top: 8px; font-family: ui-monospace, Consolas, monospace; }

/* ============ 旧色系兼容别名（历史页面自动映射到新色系） ============ */
:root {
  --gold-soft: var(--cinnabar);
  --gold: var(--cinnabar);
  --gold-deep: var(--cinnabar-deep);
  --gold-dim: rgba(201, 100, 66, 0.35);
  --gold-border: rgba(201, 100, 66, 0.25);
  --cream: var(--ink);
  --cream-dim: var(--ink-2);
  --cream-faint: var(--ink-3);
  --red: var(--err);
  --bg-0: var(--paper);
  --bg-1: var(--ivory);
  --bg-2: #f0ede2;
}
