:root {
  --bg: #f5efe6;
  --card: #fffdf8;
  --ink: #2e2620;
  --muted: #8a7a68;
  --brand: #7a5c3e;
  --brand-strong: #5f452b;
  --line: #e4d9c8;
  --warn: #a33;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
.hidden { display: none !important; }
.view { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(90, 70, 45, .06);
}
h1 { text-align: center; margin: 48px 0 4px; color: var(--brand-strong); letter-spacing: .2em; }
.subtitle { text-align: center; color: var(--muted); margin: 0 0 24px; letter-spacing: .1em; }
.auth-card { max-width: 380px; margin: 0 auto; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1; padding: 8px; border: 1px solid var(--line); background: transparent;
  border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 14px;
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
form label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
input, select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 15px; color: var(--ink);
}
button.primary {
  width: 100%; padding: 11px; border: 0; border-radius: 9px;
  background: var(--brand); color: #fff; font-size: 15px; cursor: pointer;
}
button.primary:hover { background: var(--brand-strong); }
button.ghost { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 6px 12px; color: var(--muted); cursor: pointer; }
.error { color: var(--warn); font-size: 13px; margin-top: 10px; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.brand { font-weight: 700; color: var(--brand-strong); letter-spacing: .2em; }
.chip { margin-left: auto; color: var(--muted); font-size: 13px; }
.nav { display: flex; gap: 8px; margin-bottom: 16px; }
.nav-item {
  flex: 1; padding: 10px; border: 1px solid var(--line); background: transparent;
  border-radius: 10px; cursor: pointer; font-size: 15px; color: var(--muted);
}
.nav-item.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page { display: none; }
.page.active { display: block; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.grid label { margin-bottom: 0; }
.output { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.output .hint { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; margin-top: 8px; }
.profile-pick { margin-bottom: 10px; }
.archive-item { border-bottom: 1px solid var(--line); padding: 8px 0; }
.archive-item .kind { font-weight: 600; color: var(--brand-strong); }
.archive-item .row { display: flex; align-items: center; gap: 8px; }
.archive-item .row .spacer { flex: 1; }
.archive-item button { border: 1px solid var(--line); background: transparent; border-radius: 6px; padding: 3px 10px; color: var(--muted); cursor: pointer; font-size: 12px; }
.archive-item button.danger:hover { border-color: var(--warn); color: var(--warn); }
.archive-item .report-detail { margin-top: 8px; padding: 10px 12px; background: #faf5ea; border: 1px solid var(--line); border-radius: 8px; }
.archive-item .report-detail .hint { margin-top: 8px; }
.archive-item .report-detail .chart { margin-top: 12px; }
#out-archive .archive-item .row { cursor: pointer; }
input[readonly] { background: #f3ecdf; color: var(--muted); }
.auth-card.auth-wide { max-width: 440px; }
fieldset.birth { border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px 4px; margin: 0 0 14px; }
fieldset.birth legend { color: var(--brand-strong); font-size: 12px; padding: 0 6px; }
.inline3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.inline3 input { margin-top: 4px; }
.shichen-row { display: flex; gap: 6px; align-items: start; }
.shichen-row select { margin-top: 0; }
.custom-time { display: flex; gap: 6px; }
.custom-time .mini { width: 64px; margin-top: 0; }
select:disabled { background: #f3ecdf; color: var(--muted); }
.inline-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.inline-form label { margin-bottom: 0; }
.profile-editor { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 12px 0; background: var(--bg); }
.profile-editor h3 { margin: 0 0 10px; font-size: 15px; color: var(--brand-strong); }
.editor-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.editor-actions button.primary { margin-top: 0; }
/* ---------- 排盘明细 ---------- */
details.chart { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card); }
details.chart summary { cursor: pointer; font-weight: 600; color: var(--brand); font-size: 13px; }
.chart-chips { margin: 8px 0 6px; font-size: 13px; color: var(--ink); }
.chart-row { margin: 4px 0; font-size: 13px; color: var(--ink); }
.chart-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.chart-table th, .chart-table td { text-align: left; padding: 5px 6px; border-top: 1px solid var(--line); }
.chart-table th { color: var(--muted); font-weight: 600; border-top: none; }
.chart-table tr.cur td { background: #f3e9d6; }
.chart-table .bx { color: var(--warn); font-size: 11px; margin-left: 2px; }
.chart-table .m4 { font-size: 11px; margin-left: 3px; }
.m-禄 { color: #b0822f; } .m-权 { color: #7a5c3e; } .m-科 { color: #4a7a4a; } .m-忌 { color: var(--warn); }
.chart-table .dim { color: var(--muted); font-weight: 400; }
/* ---------- 排盘圆盘（4×4 地支方位 + 中宫） ---------- */
.board { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(88px, auto); gap: 5px; margin: 10px auto 0; max-width: 460px; }
.board .c { background: rgba(21, 24, 33, .95); border: 1px solid var(--line); border-radius: 8px; padding: 6px; overflow: hidden; }
.board .c .pn { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.board .c .pb { color: #98a0ac; font-size: 12px; }
.board .c .ps { font-size: 12px; margin-top: 3px; line-height: 1.4; }
.board .c .ps.dim { color: #c9c3b8; font-size: 11px; }
.board .tag { font-size: 10px; border-radius: 4px; padding: 0 4px; margin-left: 3px; vertical-align: 1px; }
.board .c.soul, .gcard.soul { border-color: var(--gold, #d9b877); }
.board .c.body, .gcard.body { border-color: var(--jade, #82c9a0); }
.board .c.flow { border-color: var(--red, #d97d7d); }
.board .c.cur { border-color: var(--blue, #82a8ee); box-shadow: 0 0 8px rgba(130, 168, 238, .35); }
.tag.soul { background: rgba(217, 184, 119, .18); color: var(--gold, #d9b877); }
.tag.body { background: rgba(130, 201, 160, .18); color: var(--jade, #82c9a0); }
.tag.flow { background: rgba(217, 125, 125, .18); color: var(--red, #d97d7d); }
.board .center { grid-column: 2/4; grid-row: 2/4; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: radial-gradient(circle at 50% 50%, #1a1e29, #10131a); border: 1px solid var(--line); border-radius: 8px; }
.board .center .c1 { color: var(--gold, #d9b877); font-size: 14px; font-weight: 700; }
.board .center .c2 { color: #98a0ac; font-size: 11px; margin-top: 4px; line-height: 1.7; }
/* ---------- 宫卡（含杂耀） ---------- */
.gcards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.gcard { background: rgba(21, 24, 33, .9); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.gcard .gh { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.gcard .gh .eb { color: #98a0ac; font-size: 12px; font-weight: 400; }
.gcard .stars { font-size: 13px; line-height: 1.5; }
.gcard .minor { font-size: 11px; color: #8f9787; margin-top: 3px; line-height: 1.5; }
/* ---------- 大限时间线 ---------- */
.tl { margin-top: 10px; }
.tl-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.tl-age { width: 74px; font-size: 12px; color: #98a0ac; text-align: right; }
.tl-bar { flex: 1; position: relative; height: 22px; background: rgba(21, 24, 33, .9); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: flex; align-items: center; }
.tl-row.cur .tl-bar { border-color: var(--blue, #82a8ee); }
.tl-name { position: relative; padding-left: 8px; font-size: 12px; }
.tl-row.cur .tl-name { color: var(--blue, #82a8ee); font-weight: 600; }