/* 八字排盘 H5。特效结构按 docs/特效预留规范.md：内容色与装饰色分开，装饰只在 .fx-backdrop 与 .fx-frame__art 中。 */
:root {
  /* 内容色（不随特效变化，保证可读） */
  --bg: #120f16; --bg2: #231b2b; --surface: rgba(255,255,255,0.06); --surface2: rgba(255,255,255,0.1);
  --text: #f3ecdf; --muted: #b3aab8; --accent: #e0b25a; --accent2: #c9563c; --ok: #7fbf8e; --warn: #e2a24a; --line: rgba(255,255,255,0.14);
  --font: 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif; --radius: 14px;
  /* 装饰色与光效 */
  --fx-glow: rgba(224,178,90,0.55); --fx-glow-strength: 0.6;
  --fx-frame-color: rgba(224,178,90,0.55); --fx-frame-width: 1px;
  --fx-particle-color: 224,178,90;
  --fx-speed: 1;
}
:root[data-fx="off"], :root[data-fx="lite"] { --fx-speed: 0; }
@media (prefers-reduced-motion: reduce) { :root { --fx-speed: 0; } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); color: var(--text); background: radial-gradient(120% 70% at 50% 0%, var(--bg2), var(--bg) 70%); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }
.fx-backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.fx-backdrop canvas { width: 100%; height: 100%; display: block; }
:root[data-fx="off"] .fx-backdrop { display: none; }
.app { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.screen { padding-top: env(safe-area-inset-top); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; gap: 8px; }
.topbar h1, .topbar h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: 2px; }
.brand-glyph { color: var(--accent); }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn { background: var(--surface); border: 1px solid var(--line); color: var(--text); width: 38px; height: 38px; border-radius: 12px; font-size: 17px; cursor: pointer; }
.eyebrow { margin: 16px 0 6px; font-size: 12px; letter-spacing: 3px; color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: 12px; line-height: 1.6; }
.fineprint { color: var(--muted); font-size: 12px; margin-top: 22px; text-align: center; line-height: 1.6; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 13px; color: var(--muted); flex: 1; min-width: 0; }
.field input, .field select { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 15px; width: 100%; }
.field select option { color: #111; }
.field-label { font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.row2, .row3 { display: flex; gap: 10px; }
.seg { display: flex; gap: 6px; margin: 6px 0; } .seg.wrap { flex-wrap: wrap; }
.chip { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 14px; cursor: pointer; }
.chip.active { background: var(--accent); color: #241807; border-color: var(--accent); font-weight: 600; }
.switch { display: flex; gap: 8px; align-items: center; margin: 8px 0; font-size: 14px; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: 999px; font-size: 14px; cursor: pointer; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #f3d28a); color: #241807; border: none; font-weight: 600; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; margin-top: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.form-error { color: #ff9b85; font-size: 13px; min-height: 1em; margin: 6px 0 0; }
.place-results { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; max-height: 220px; overflow: auto; }
.place-results button { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); padding: 8px 10px; cursor: pointer; font-size: 13px; }
/* 面板与框槽 */
.panel { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; }
.panel h3 { margin: 0 0 8px; font-size: 15px; letter-spacing: 1px; color: var(--accent); font-weight: 600; }
.fx-frame { isolation: isolate; }
.fx-frame__art { position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; z-index: -1; }
:root[data-fx="on"] .fx-frame__art { border: var(--fx-frame-width) solid var(--fx-frame-color); box-shadow: 0 0 calc(18px * var(--fx-glow-strength)) -4px var(--fx-glow); }
:root[data-fx="on"] .fx-frame[data-frame="pillar"] .fx-frame__art { background: radial-gradient(80% 60% at 50% 0%, rgba(224,178,90,0.12), transparent 70%); }
@media (prefers-reduced-motion: no-preference) {
  :root[data-fx="on"] .fx-frame.reveal { animation: reveal calc(0.7s / max(var(--fx-speed), 0.001)) ease both; }
}
@keyframes reveal { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
/* 四柱表 */
.pillars { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.pillars th, .pillars td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: center; vertical-align: top; word-break: break-all; }
.pillars th { color: var(--muted); font-weight: 400; font-size: 12px; }
.pillars td.rowname { color: var(--muted); font-size: 12px; text-align: left; width: 3.6em; }
.pillars .gz { font-size: 26px; letter-spacing: 2px; line-height: 1.25; }
.el-木 { color: #7fc48b; } .el-火 { color: #ef7a5d; } .el-土 { color: #d4a85a; } .el-金 { color: #e8e1c9; } .el-水 { color: #6fb0e8; }
.tag { display: inline-block; font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; margin: 1px; }
.tag.pending { border-color: var(--warn); color: var(--warn); }
.tag.variant { opacity: .8; border-style: dashed; }
.vm { color: var(--accent); font-size: .75em; margin-left: 1px; cursor: help; }
.kv { display: grid; grid-template-columns: 7em 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.list { margin: 0; padding-left: 1.1em; font-size: 13px; line-height: 1.7; }
.cond-met { color: var(--ok); } .cond-fail { color: #ff9b85; } .cond-unk { color: var(--warn); }
.dayun { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.dayun button { flex: 0 0 auto; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 6px 8px; cursor: pointer; font-size: 13px; min-width: 64px; }
.dayun button.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.dayun .gz { font-size: 18px; display: block; }
.years { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 8px; }
.years button { background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 5px; font-size: 12px; cursor: pointer; }
.src-text { white-space: pre-wrap; font-size: 14px; line-height: 1.8; background: rgba(0,0,0,0.2); border-radius: 10px; padding: 10px; }
.src-item { border-top: 1px solid var(--line); padding: 8px 0; }
details > summary { cursor: pointer; color: var(--accent); font-size: 13px; margin: 4px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.hist-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.notice { font-size: 12px; color: var(--warn); }
@media (max-width: 520px) { .pillars .gz { font-size: 21px; } .pillars { font-size: 12px; } .kv { grid-template-columns: 6em 1fr; } }

/* 岁运加盘 */
.dayun .tg, .years .tg { display: block; font-size: 11px; color: var(--muted); min-height: 1em; }
.years .tg { display: inline; }
.years button.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.sub-title { font-size: 15px; margin: 14px 0 6px; color: var(--accent); }
.table-scroll { overflow-x: auto; }
.suiyun-table th.extra, .suiyun-table td.extra { background: rgba(212, 175, 95, .08); }

/* 断事笔记与记录 */
.note-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.field.inline { flex: 1 1 140px; margin: 0; }
.field textarea { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 15px; width: 100%; resize: vertical; }
.note-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 10px; }
.note-ev { display: flex; gap: 6px; margin: 6px 0; }
.note-ev input { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 14px; }
.note-ev .ev-year { width: 72px; flex: none; } .note-ev .ev-text { flex: 1; min-width: 0; }
.star-btn { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 2px; }
.star-btn.on { color: var(--accent); }

/* 四柱反查、此刻 */
.row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ghost-chip { margin-left: auto; background: transparent; }
#reverse-box { margin: 6px 0 10px; } #reverse-box summary { cursor: pointer; color: var(--muted); }

/* 关系图示 */
.rel-diagram { display: block; margin: 6px auto 4px; overflow: visible; }
.rel-diagram text { text-anchor: middle; fill: var(--muted); font-size: 11px; }
.rel-diagram .col-name { font-size: 11px; }
.rel-diagram .gz-ch { font-size: 26px; fill: var(--text); }
.rel-diagram .gz-ch.el-木 { fill: #7fc48b; } .rel-diagram .gz-ch.el-火 { fill: #ef7a5d; } .rel-diagram .gz-ch.el-土 { fill: #d4a85a; }
.rel-diagram .gz-ch.el-金 { fill: #e8e1c9; } .rel-diagram .gz-ch.el-水 { fill: #6fb0e8; }
.rel-diagram .rel line { stroke: var(--muted); stroke-width: 1.4; }
.rel-diagram .rel.he line { stroke: var(--accent); } .rel-diagram .rel.he text { fill: var(--accent); }
.rel-diagram .rel.chong line { stroke: var(--accent2); } .rel-diagram .rel.chong text { fill: var(--accent2); }
.rel-diagram .rel.weak line { stroke-dasharray: 3 3; }
