:root {
  --bg: #15100b;
  --bg2: #1e160e;
  --gold: #c9a227;
  --gold-soft: #e7c96b;
  --text: #ece0c6;
  --text-dim: #a99873;
  --panel-bg: #1b140d;
  --dial-bg: #241a10;
  --dial-edge: #6b4f2a;
  --accent: #d6412a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(circle at 50% 30%, var(--bg2), var(--bg));
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(201,162,39,0.25);
  backdrop-filter: blur(6px);
}
.title { display: flex; flex-direction: column; line-height: 1.2; }
.title .zh { font-size: 17px; font-weight: 600; color: var(--gold-soft); letter-spacing: 1px; }
.title .en { font-size: 10px; color: var(--text-dim); letter-spacing: 0.5px; }

.icon-btn {
  background: transparent; border: 1px solid rgba(201,162,39,0.4);
  color: var(--gold-soft); font-size: 18px; width: 38px; height: 38px;
  border-radius: 10px; cursor: pointer;
}
.icon-btn:active { background: rgba(201,162,39,0.15); }

/* 罗盘视图内的浮动设置按钮（只在风水罗盘 Tab 显示） */
.fab-settings {
  position: absolute; top: 12px; right: 12px; z-index: 6;
  background: rgba(10,7,4,0.75); border: 1px solid rgba(201,162,39,0.5);
  color: var(--gold-soft); font-size: 14px; padding: 8px 14px;
  border-radius: 20px; cursor: pointer; font-family: inherit; backdrop-filter: blur(6px);
}
.fab-settings:active { background: rgba(201,162,39,0.2); }

/* Stage */
.stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.floorplan { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; touch-action: none; }

.luopan-wrap {
  position: relative; z-index: 2;
  width: min(92vw, 70vh); aspect-ratio: 1; pointer-events: none;
  filter: drop-shadow(0 8px 30px rgba(0,0,0,0.6));
}
.luopan { width: 100%; height: 100%; pointer-events: auto; }
.luopan #dial text, .luopan #dial circle, .luopan #dial line { pointer-events: none; }
.luopan #dial {
  /* 指南针更新经 rAF 节流+低通平滑后呈小步进，这里用极短过渡把步进补成连续转动，消除抖动观感 */
  transition: transform 0.12s linear;
  transform-box: view-box;
  transform-origin: center;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) { .luopan #dial { transition: none; } }
.luopan #dial path { pointer-events: none; }
.luopan #dial path.jg-sector { pointer-events: auto; }

/* fixed facing needle at top */
.facing-needle {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 11px solid transparent; border-right: 11px solid transparent;
  border-top: 22px solid var(--accent); z-index: 3;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}
.center-crosshair {
  position: absolute; z-index: 3; width: 14px; height: 14px;
  border: 2px solid var(--accent); border-radius: 50%; background: rgba(214,65,42,0.3);
}

/* HUD */
.hud {
  position: absolute; left: 12px; bottom: 12px; z-index: 5;
  background: rgba(10,7,4,0.7); border: 1px solid rgba(201,162,39,0.3);
  border-radius: 12px; padding: 10px 14px; min-width: 210px; backdrop-filter: blur(8px);
}
.hud-row { display: flex; justify-content: space-between; gap: 14px; font-size: 13px; padding: 2px 0; }
.hud-label { color: var(--text-dim); }
.hud-value { color: var(--gold-soft); font-weight: 600; text-align: right; }

/* Panel */
.panel {
  position: fixed; top: 0; right: 0; height: 100%; width: min(90vw, 360px);
  background: var(--panel-bg); border-left: 1px solid rgba(201,162,39,0.3);
  transform: translateX(100%); transition: transform 0.28s ease;
  z-index: 20; overflow-y: auto; padding-bottom: 40px;
}
.panel.open { transform: translateX(0); }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; position: sticky; top: 0; background: var(--panel-bg);
  border-bottom: 1px solid rgba(201,162,39,0.2); font-weight: 600; color: var(--gold-soft);
}
.panel-section { padding: 14px 16px; border-bottom: 1px solid rgba(201,162,39,0.12); }
.panel-section h3 { margin: 0 0 10px; font-size: 14px; color: var(--gold); font-weight: 600; }

.primary-btn, .ghost-btn {
  font-size: 14px; padding: 10px 14px; border-radius: 10px; cursor: pointer; width: 100%;
  font-family: inherit;
}
.primary-btn { background: linear-gradient(180deg, #caa236, #9c7c1f); color: #1a140a; border: none; font-weight: 600; }
.primary-btn:active { filter: brightness(0.9); }
.primary-btn.on { background: linear-gradient(180deg,#3fae6a,#2e8450); color:#fff; }
.ghost-btn { background: transparent; border: 1px solid rgba(201,162,39,0.4); color: var(--gold-soft); }
.ghost-btn:active { background: rgba(201,162,39,0.12); }

.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

.hint { font-size: 11.5px; color: var(--text-dim); margin: 8px 0 0; line-height: 1.5; }

.slider-row { display: block; margin-top: 12px; font-size: 13px; color: var(--text); }
.slider-row span { display: flex; justify-content: space-between; margin-bottom: 6px; }
.slider-row b { color: var(--gold-soft); }
.slider-row input[type=range] { width: 100%; accent-color: var(--gold); }
.slider-row input[type=datetime-local] {
  width: 100%; padding: 8px; border-radius: 8px; background: #120d08;
  border: 1px solid rgba(201,162,39,0.4); color: var(--text); font-family: inherit;
}
.check-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; cursor: pointer; }
.check-row input { accent-color: var(--gold); width: 16px; height: 16px; }

.qm-summary { margin-top: 10px; font-size: 12.5px; line-height: 1.7; color: var(--text); }
.qm-line b { color: var(--gold-soft); }
.qm-summary .err { color: var(--accent); }

.scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 15;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.scrim.show { opacity: 1; pointer-events: auto; }

@media (max-width: 480px) {
  .title .en { display: none; }
  .hud { font-size: 12px; min-width: 180px; }
}

/* ===== Tabs & Views ===== */
.tabbar { display: flex; gap: 4px; padding: 8px 10px 0; background: rgba(0,0,0,0.2); border-bottom: 1px solid rgba(201,162,39,0.2); }
.tab {
  flex: 1; background: transparent; border: none; color: var(--text-dim);
  font-size: 14px; padding: 10px 6px; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab.active { color: var(--gold-soft); border-bottom-color: var(--gold); font-weight: 600; }
.tab:active { background: rgba(201,162,39,0.08); }

.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; flex-direction: column; }
#view-luopan.active { position: relative; }

.scroll-view { flex: 1; overflow-y: auto; padding: 14px; -webkit-overflow-scrolling: touch; }
.card {
  background: var(--panel-bg); border: 1px solid rgba(201,162,39,0.2);
  border-radius: 14px; padding: 16px; margin-bottom: 14px; max-width: 760px; margin-left: auto; margin-right: auto;
}
.card h2 { margin: 0 0 14px; font-size: 17px; color: var(--gold-soft); }
.card h3.sub { font-size: 14px; color: var(--gold); margin: 18px 0 8px; }

.field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--text); }
.field span { display: block; margin-bottom: 6px; color: var(--text-dim); }
.field input {
  width: 100%; padding: 10px; border-radius: 9px; background: #120d08;
  border: 1px solid rgba(201,162,39,0.4); color: var(--text); font-family: inherit; font-size: 14px;
}
.primary-btn.full { width: 100%; margin-top: 6px; }

.seg { display: flex; gap: 0; border: 1px solid rgba(201,162,39,0.4); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.seg-btn { flex: 1; background: transparent; border: none; color: var(--text-dim); padding: 9px 4px; font-size: 13px; cursor: pointer; font-family: inherit; }
.seg-btn.active { background: linear-gradient(180deg,#caa236,#9c7c1f); color: #1a140a; font-weight: 600; }

/* ---- Meihua hexagram ---- */
.mh-meta { font-size: 13px; color: var(--gold-soft); margin-bottom: 14px; }
.hex-row { display: flex; justify-content: space-around; gap: 10px; flex-wrap: wrap; }
.hex-col { text-align: center; flex: 1; min-width: 90px; }
.hex-title { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.yao-stack { display: flex; flex-direction: column; gap: 5px; align-items: center; margin-bottom: 8px; }
.yao { display: flex; align-items: center; gap: 4px; height: 12px; }
.yao .bar { display: inline-block; width: 46px; height: 10px; background: currentColor; border-radius: 2px; }
.yao .bar.half { width: 20px; }
.yao em { font-style: normal; font-size: 12px; width: 14px; text-align: left; }
.hex-name { font-size: 15px; color: var(--gold-soft); font-weight: 600; }
.hex-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.ty-row { display: flex; gap: 10px; margin: 16px 0; }
.ty-cell { flex: 1; background: rgba(0,0,0,0.25); border: 1px solid rgba(201,162,39,0.25); border-radius: 10px; padding: 10px; text-align: center; }
.ty-cell span { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.ty-cell b { color: var(--gold-soft); font-size: 15px; }

.judge { border-radius: 10px; padding: 12px 14px; margin-top: 8px; }
.judge-head { font-size: 14px; margin-bottom: 4px; }
.judge-text { font-size: 12.5px; line-height: 1.6; color: var(--text); }
.judge-good { background: rgba(63,174,106,0.15); border: 1px solid rgba(63,174,106,0.4); }
.judge-good b { color: #6fd79a; }
.judge-bad { background: rgba(214,65,42,0.14); border: 1px solid rgba(214,65,42,0.4); }
.judge-bad b { color: #ff8a73; }
.judge-mid { background: rgba(201,162,39,0.12); border: 1px solid rgba(201,162,39,0.35); }
.judge-mid b { color: var(--gold-soft); }

/* ---- Bazi ---- */
.bz-meta { font-size: 12.5px; line-height: 1.8; color: var(--text); margin-bottom: 14px; }
.bz-meta b { color: var(--gold-soft); }
.bz-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bz-col { background: rgba(0,0,0,0.3); border: 1px solid rgba(201,162,39,0.25); border-radius: 10px; padding: 10px 6px; text-align: center; }
.bz-label { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.bz-ss { font-size: 12px; color: #d9b3ff; margin-bottom: 4px; min-height: 16px; }
.bz-gz { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.bz-gan { font-size: 26px; color: var(--gold-soft); font-weight: 700; line-height: 1; }
.bz-zhi { font-size: 26px; color: var(--gold-soft); font-weight: 700; line-height: 1; }
.bz-hide { font-size: 10px; color: var(--text-dim); line-height: 1.4; min-height: 14px; }
.bz-nayin { font-size: 11px; color: #9fd6b0; margin-top: 4px; }

.wx-wrap { display: flex; flex-direction: column; gap: 6px; }
.wx-bar { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.wx-k { width: 20px; text-align: center; font-weight: 600; }
.wx-track { flex: 1; height: 10px; background: rgba(255,255,255,0.06); border-radius: 5px; overflow: hidden; }
.wx-track i { display: block; height: 100%; background: linear-gradient(90deg,#caa236,#e7c96b); }
.wx-v { width: 16px; text-align: right; color: var(--text-dim); }
.wx-木 { color: #4caf6a; } .wx-火 { color: #e05a3e; } .wx-土 { color: #c9952a; }
.wx-金 { color: #d8c98a; } .wx-水 { color: #4a90d9; }

.dy-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.dy-cell { flex: 0 0 auto; min-width: 54px; text-align: center; background: rgba(0,0,0,0.25); border: 1px solid rgba(201,162,39,0.25); border-radius: 9px; padding: 8px 6px; }
.dy-cell b { display: block; color: var(--gold-soft); font-size: 15px; }
.dy-cell span { display: block; font-size: 10px; color: var(--text-dim); }
.dy-cell.cur { border-color: var(--accent); background: rgba(214,65,42,0.18); }
.dy-cell.cur b { color: #ff8a73; }

.err { color: var(--accent); }

@media (max-width: 480px) {
  .bz-gan, .bz-zhi { font-size: 22px; }
  .hex-col { min-width: 80px; }
}

/* ===== Fengshui modal & annotations ===== */
.seg.wrap { flex-wrap: wrap; }
.seg.wrap .seg-btn { flex: 1 0 30%; border-right: 1px solid rgba(201,162,39,0.2); }

.fs-modal {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55); opacity: 0; pointer-events: none; transition: opacity 0.2s; padding: 20px;
}
.fs-modal.show { opacity: 1; pointer-events: auto; }
.fs-modal-card {
  position: relative; background: var(--panel-bg); border: 1px solid rgba(201,162,39,0.4);
  border-radius: 16px; padding: 20px; max-width: 420px; width: 100%; max-height: 80vh; overflow-y: auto;
}
.fs-modal-x { position: absolute; top: 12px; right: 12px; background: transparent; border: none; color: var(--gold-soft); font-size: 18px; cursor: pointer; }
.fs-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.fs-sym { font-size: 40px; color: var(--gold-soft); }
.fs-dir { font-size: 18px; color: var(--gold-soft); font-weight: 600; }
.fs-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.fs-star, .fs-conflict { border-radius: 9px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; line-height: 1.5; }
.fs-star.good, .fs-conflict.good { background: rgba(63,174,106,0.15); border: 1px solid rgba(63,174,106,0.4); }
.fs-star.bad, .fs-conflict.bad { background: rgba(214,65,42,0.16); border: 1px solid rgba(214,65,42,0.45); }
.fs-conflict.warn { background: rgba(201,120,39,0.16); border: 1px solid rgba(201,120,39,0.45); }
.fs-conflict b, .fs-star b { color: var(--gold-soft); }
.fs-cols { display: flex; gap: 12px; margin: 8px 0; }
.fs-good, .fs-bad { flex: 1; border-radius: 10px; padding: 10px 12px; }
.fs-good { background: rgba(63,174,106,0.12); border: 1px solid rgba(63,174,106,0.3); }
.fs-bad { background: rgba(214,65,42,0.12); border: 1px solid rgba(214,65,42,0.3); }
.fs-good h4, .fs-bad h4 { margin: 0 0 6px; font-size: 13px; }
.fs-good h4 { color: #6fd79a; } .fs-bad h4 { color: #ff8a73; }
.fs-cols ul { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.7; color: var(--text); }

.anno-line { font-size: 12.5px; padding: 5px 8px; border-radius: 7px; margin-top: 5px; display: flex; justify-content: space-between; }
.anno-line.bad { background: rgba(214,65,42,0.16); color: #ff8a73; }
.anno-line.warn { background: rgba(201,120,39,0.16); color: #e0a94a; }
.anno-line.good { background: rgba(63,174,106,0.14); color: #6fd79a; }
.anno-line b { color: var(--gold-soft); }
.ghost-btn.on { background: rgba(214,65,42,0.25); border-color: var(--accent); color: #ff8a73; }

/* ===== Bazi interpretation ===== */
.interp { background: rgba(0,0,0,0.25); border: 1px solid rgba(201,162,39,0.25); border-radius: 12px; padding: 14px; }
.interp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13.5px; }
.interp-k { width: 54px; color: var(--text-dim); flex: 0 0 auto; }
.interp-v { color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.interp-v em { font-style: normal; color: var(--text-dim); font-size: 12px; }
.badge { padding: 2px 10px; border-radius: 20px; font-size: 13px; }
.badge.good { background: rgba(63,174,106,0.2); color: #6fd79a; }
.badge.warn { background: rgba(201,120,39,0.2); color: #e0a94a; }
.wx-chip { display: inline-block; min-width: 24px; text-align: center; padding: 2px 8px; border-radius: 7px; font-weight: 600; font-size: 13px; background: rgba(255,255,255,0.06); }
.interp-note { font-size: 12.5px; line-height: 1.7; color: var(--text); margin: 8px 0; }
.interp-note.dim { color: var(--text-dim); }
.interp-sub { font-size: 13px; color: var(--gold); margin: 14px 0 6px; font-weight: 600; }
.interp-persona { font-size: 13px; color: var(--gold-soft); margin-bottom: 6px; }
.interp-traits { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.8; color: var(--text); }

/* clickable glossary terms */
.term { cursor: help; border-bottom: 1px dashed rgba(201,162,39,0.6); }
.term:active { color: var(--gold-soft); }
.interp-note.warn-note { background: rgba(201,120,39,0.14); border: 1px solid rgba(201,120,39,0.4); border-radius: 8px; padding: 8px 10px; color: #e0a94a; }

/* glossary popup */
.gl-pop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55); opacity: 0; pointer-events: none; transition: opacity 0.18s; padding: 24px; }
.gl-pop.show { opacity: 1; pointer-events: auto; }
.gl-pop-card { position: relative; background: var(--panel-bg); border: 1px solid rgba(201,162,39,0.45);
  border-radius: 14px; padding: 18px 20px; max-width: 360px; width: 100%; }
.gl-pop-x { position: absolute; top: 10px; right: 12px; background: transparent; border: none; color: var(--gold-soft); font-size: 16px; cursor: pointer; }
.gl-pop-title { font-size: 16px; color: var(--gold-soft); font-weight: 600; margin-bottom: 10px; }
.gl-pop-text { font-size: 13px; line-height: 1.75; color: var(--text); }

/* meihua plain-language summary */
.mh-summary { margin-top: 16px; background: rgba(201,162,39,0.08); border: 1px solid rgba(201,162,39,0.3); border-radius: 12px; padding: 14px; }
.mh-sum-title { font-size: 14px; color: var(--gold-soft); font-weight: 600; margin-bottom: 8px; }
.mh-summary p { font-size: 13px; line-height: 1.75; color: var(--text); margin: 6px 0; }
.mh-summary b { color: var(--gold-soft); }
.mh-sum-tip { background: rgba(0,0,0,0.25); border-radius: 8px; padding: 8px 10px; }

/* expandable reasoning */
.reason { margin: -2px 0 10px 64px; font-size: 12px; }
.reason summary { cursor: pointer; color: var(--gold); list-style: none; padding: 4px 0; }
.reason summary::-webkit-details-marker { display: none; }
.reason summary::before { content: '▸ '; }
.reason[open] summary::before { content: '▾ '; }
.reason-steps { margin: 4px 0 0; padding-left: 20px; color: var(--text-dim); line-height: 1.7; }
.reason-steps li { margin-bottom: 3px; }

/* qimen palace analysis in modal */
.qm-analysis { background: rgba(0,0,0,0.3); border: 1px solid rgba(201,162,39,0.3); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.qm-a-head { font-size: 14px; color: var(--gold-soft); margin-bottom: 10px; }
.qm-a-grid { display: flex; flex-direction: column; gap: 6px; }
.qm-a-item { border-radius: 8px; padding: 7px 9px; font-size: 12px; border: 1px solid transparent; }
.qm-a-item.good { background: rgba(63,174,106,0.12); border-color: rgba(63,174,106,0.3); }
.qm-a-item.bad { background: rgba(214,65,42,0.12); border-color: rgba(214,65,42,0.3); }
.qm-a-item.mid { background: rgba(201,162,39,0.1); border-color: rgba(201,162,39,0.25); }
.qm-a-tag { color: var(--gold-soft); font-weight: 600; }
.qm-a-jx { float: right; font-size: 11px; color: var(--text-dim); }
.qm-a-text { color: var(--text); margin-top: 3px; line-height: 1.5; }
.qm-a-sum { font-size: 12.5px; color: var(--text); margin-top: 10px; line-height: 1.6; padding-top: 8px; border-top: 1px solid rgba(201,162,39,0.2); }

/* liunian grid */
.ln-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 6px 0 4px; }
.ln-cell { border-radius: 8px; padding: 7px 4px; text-align: center; border: 1px solid transparent; }
.ln-cell.good { background: rgba(63,174,106,0.14); border-color: rgba(63,174,106,0.3); }
.ln-cell.bad { background: rgba(214,65,42,0.14); border-color: rgba(214,65,42,0.3); }
.ln-cell.mid { background: rgba(201,162,39,0.1); border-color: rgba(201,162,39,0.22); }
.ln-cell.cur { outline: 2px solid var(--gold-soft); }
.ln-year { font-size: 12px; color: var(--text-dim); }
.ln-gz { font-size: 15px; color: var(--gold-soft); font-weight: 600; margin: 2px 0; }
.ln-age { font-size: 10px; color: var(--text-dim); }
.ln-lv { font-size: 11px; margin-top: 2px; }
.ln-cell.good .ln-lv { color: #6fd79a; } .ln-cell.bad .ln-lv { color: #ff8a73; } .ln-cell.mid .ln-lv { color: var(--gold-soft); }
@media (max-width: 480px) { .ln-grid { grid-template-columns: repeat(3, 1fr); } }

/* sanming: shensha & changsheng */
.ss-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ss-cell { border-radius: 9px; padding: 9px 11px; border: 1px solid transparent; }
.ss-cell.good { background: rgba(63,174,106,0.12); border-color: rgba(63,174,106,0.3); }
.ss-cell.bad { background: rgba(214,65,42,0.12); border-color: rgba(214,65,42,0.3); }
.ss-cell.mid { background: rgba(201,162,39,0.1); border-color: rgba(201,162,39,0.25); }
.ss-name { font-size: 14px; color: var(--gold-soft); font-weight: 600; }
.ss-where { font-size: 11px; color: var(--text-dim); margin-left: 6px; font-weight: 400; }
.ss-mean { font-size: 12px; color: var(--text); margin-top: 4px; line-height: 1.5; }
.cs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cs-cell { background: rgba(0,0,0,0.25); border: 1px solid rgba(201,162,39,0.25); border-radius: 9px; padding: 9px 4px; text-align: center; }
.cs-pos { font-size: 11px; color: var(--text-dim); }
.cs-zhi { font-size: 18px; color: var(--gold-soft); font-weight: 600; margin: 2px 0; }
.cs-stage { font-size: 13px; color: #9fd6b0; }
@media (max-width: 480px) { .ss-grid { grid-template-columns: 1fr; } }

.trace-box { margin-top: 10px; padding: 10px; border: 1px dashed rgba(201,162,39,0.35); border-radius: 10px; }
.trace-box #trace-status { margin-top: 8px; color: var(--gold-soft); }

/* ===================== 合冲刑害会 ===================== */
.rel-wrap { display:flex; flex-direction:column; gap:6px; margin:4px 0; }
.rel-line { display:flex; gap:8px; align-items:flex-start; }
.rel-k { flex:0 0 68px; color:var(--text-dim); font-size:13px; padding-top:3px; }
.rel-v { flex:1; display:flex; flex-wrap:wrap; gap:5px; }
.rel-chip { font-size:12px; padding:2px 8px; border-radius:11px; border:1px solid rgba(201,162,39,0.22); background:var(--panel-bg); }
.rel-chip.good { color:#7fd08b; border-color:rgba(127,208,139,.4); }
.rel-chip.bad  { color:#e59a9a; border-color:rgba(229,154,154,.4); }
.rel-chip.mid  { color:var(--gold-soft); border-color:rgba(200,170,110,.4); }
.rel-hints li { font-size:12.5px; }

/* ===================== 六爻 ===================== */
.ly-manual-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:6px 0; }
.ly-mrow { display:flex; flex-direction:column; gap:3px; font-size:12px; color:var(--text-dim); }
.ly-mrow select { background:var(--panel-bg); color:var(--text); border:1px solid rgba(201,162,39,0.22); border-radius:7px; padding:5px; }
.ly-row { display:flex; gap:10px; flex-wrap:wrap; }
.ly-col { flex:1; min-width:250px; background:var(--panel-bg); border:1px solid rgba(201,162,39,0.22); border-radius:12px; padding:10px; }
.ly-col.ly-static { display:flex; flex-direction:column; justify-content:center; }
.ly-coltitle { font-weight:700; color:var(--gold); margin-bottom:4px; }
.ly-name { font-size:16px; color:var(--text); }
.ly-palace { font-size:12px; color:var(--text-dim); margin-bottom:8px; }
.ly-yaos { display:flex; flex-direction:column; gap:3px; }
.ly-yao { display:grid; grid-template-columns:42px 34px 58px 1fr 34px; align-items:center; gap:4px; font-size:12px; padding:2px 0; border-bottom:1px dashed rgba(201,162,39,0.22); }
.ly-yao.moving { background:rgba(200,160,90,.08); border-radius:5px; }
.ly-ls { color:var(--text-dim); }
.ly-lq { color:var(--gold-soft); font-weight:600; }
.ly-gz { color:var(--text); }
.ly-gz i { color:var(--text-dim); font-style:normal; font-size:11px; margin-left:1px; }
.ly-xiang { display:flex; align-items:center; gap:3px; justify-content:center; }
.ly-bar { display:inline-block; width:46px; height:7px; background:var(--gold-soft); border-radius:2px; }
.ly-bar.half { width:20px; }
.ly-move { color:var(--accent); font-style:normal; font-size:13px; }
.ly-tag { text-align:right; }
.ly-ws { color:var(--accent); font-size:11px; }
.ly-ws.resp { color:#6fb3e0; }

/* ===================== 小六壬 ===================== */
.xlr-meta { color:var(--text-dim); font-size:13px; margin-bottom:8px; }
.xlr-row { display:flex; gap:8px; }
.xlr-cell { flex:1; text-align:center; border:1px solid rgba(201,162,39,0.22); border-radius:12px; padding:12px 6px; background:var(--panel-bg); }
.xlr-cell.good { border-color:rgba(127,208,139,.45); }
.xlr-cell.bad  { border-color:rgba(229,154,154,.45); }
.xlr-cell.final { box-shadow:0 0 0 2px var(--gold) inset; }
.xlr-role { font-size:11px; color:var(--text-dim); min-height:28px; }
.xlr-name { font-size:20px; font-weight:800; color:var(--text); margin:4px 0; }
.xlr-cell.good .xlr-name { color:#7fd08b; }
.xlr-cell.bad  .xlr-name { color:#e59a9a; }
.xlr-wx { font-size:11px; color:var(--text-dim); }

/* ===================== 黄历 ===================== */
.hl-head { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:10px; }
.hl-date-big { font-size:17px; font-weight:700; color:var(--text); }
.hl-lunar { font-size:13px; color:var(--text-dim); flex:1; min-width:140px; }
.hl-grade { font-size:14px; }
.hl-yiji { display:flex; gap:10px; margin:8px 0; }
.hl-yi, .hl-ji { flex:1; }
.hl-yiji-h { font-weight:700; margin-bottom:4px; padding:2px 10px; border-radius:7px; display:inline-block; }
.hl-yiji-h.good { color:#7fd08b; background:rgba(127,208,139,.12); }
.hl-yiji-h.bad  { color:#e59a9a; background:rgba(229,154,154,.12); }
.hl-yiji-b { display:flex; flex-wrap:wrap; gap:4px; }
.hl-tag { font-size:12px; padding:2px 7px; border-radius:9px; border:1px solid rgba(201,162,39,0.22); background:var(--panel-bg); color:var(--text); }
.hl-tag.good { color:#7fd08b; } .hl-tag.bad { color:#e59a9a; } .hl-tag.dim { color:var(--text-dim); }
.hl-meta-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin:8px 0; }
.hl-mi { background:var(--panel-bg); border:1px solid rgba(201,162,39,0.22); border-radius:9px; padding:6px 8px; font-size:12px; }
.hl-mi span { color:var(--text-dim); display:block; font-size:11px; }
.hl-mi b { color:var(--text); font-size:13px; }
.hl-shen { display:flex; flex-direction:column; gap:6px; margin:8px 0; font-size:12.5px; }
.hl-shen-k { font-weight:700; margin-right:6px; }
.hl-shen-k.good { color:#7fd08b; } .hl-shen-k.bad { color:#e59a9a; }
.hl-pengzu { font-size:12.5px; color:var(--text-dim); margin:6px 0; }
.hl-pengzu b { color:var(--gold-soft); }
.hl-pick-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); gap:6px; margin-top:6px; }
.hl-pick-cell { background:var(--panel-bg); border:1px solid rgba(201,162,39,0.22); border-radius:9px; padding:7px; text-align:center; font-size:11px; display:flex; flex-direction:column; gap:1px; }
.hl-pick-cell.good { border-color:rgba(127,208,139,.45); }
.hl-pick-cell b { font-size:14px; color:var(--text); }
.hl-pick-cell span { color:var(--text-dim); }
.hl-pick-grade { color:var(--gold) !important; font-weight:600; }
.xlr-nums { display:flex; gap:8px; }
.xlr-nums .field { flex:1; }

/* ===================== 指南针校准 ===================== */
.cal-modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); opacity: 0; pointer-events: none; transition: opacity 0.2s; padding: 20px;
}
.cal-modal.show { opacity: 1; pointer-events: auto; }
.cal-card {
  position: relative; width: min(360px, 92vw); max-height: 88vh; overflow-y: auto;
  background: var(--panel-bg); border: 1px solid rgba(201,162,39,0.25); border-radius: 16px;
  padding: 20px 18px; color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.cal-title { font-size: 17px; font-weight: 700; color: var(--gold); text-align: center; margin-bottom: 8px; }
.cal-fig { display: flex; justify-content: center; margin: 6px 0; }
.cal-path { opacity: 0.55; }
.cal-steps p { font-size: 13.5px; line-height: 1.6; color: var(--text); margin: 6px 0; }
.cal-meter { background: rgba(0,0,0,0.2); border: 1px solid rgba(201,162,39,0.18); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.cal-meter-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-dim); margin: 2px 0; }
.cal-meter-row b { font-size: 14px; }
.cal-meter-row b.good { color: #7fd08b; }
.cal-meter-row b.mid  { color: var(--gold-soft); }
.cal-meter-row b.bad  { color: #e59a9a; }
.cal-bar { height: 8px; border-radius: 5px; background: rgba(255,255,255,0.08); overflow: hidden; margin: 6px 0; }
.cal-bar i { display: block; height: 100%; width: 0; border-radius: 5px; transition: width 0.25s ease, background 0.25s; background: var(--gold-soft); }
.cal-bar i.good { background: #7fd08b; }
.cal-bar i.mid  { background: var(--gold-soft); }
.cal-bar i.bad  { background: #e59a9a; }
.cal-note { font-size: 12px; color: var(--text-dim); line-height: 1.55; margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .cal-dot animateMotion { display: none; } }
