/* 立向参考 · 三元三合理气 —— 主题与子午斜流/玉辇经一致（浅色玻璃风） */
:root {
  color-scheme: light;
  --ink: #2c3e5d;
  --ink-soft: #6b7a99;
  --title: #1e3a6e;
  --accent: #2f6fed;
  --accent-2: #8d7cf9;
  --accent-rgb: 47, 111, 237;
  --good: #2e8b57;
  --good-bg: rgba(46, 139, 87, 0.12);
  --warn: #c45c4a;
  --card-border: rgba(148, 178, 225, 0.45);
  --radius: 14px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html { background: #d7e9fb; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.6;
  background: linear-gradient(180deg, #d7e9fb 0%, #f0f7fe 45%, #d8e9fb 100%);
  -webkit-font-smoothing: antialiased;
}

/* ── 顶栏（参考子午斜流：无底线切割，返回+标题同行，介绍按钮右侧） ── */
.top-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 10px;
}
.top-intro {
  flex-shrink: 0;
}
.link-back {
  display: inline-flex;
  align-items: center;
  color: rgba(44, 62, 93, .8);
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
}
.link-back:hover { color: var(--accent); }
.logo-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--title);
  text-align: center;
}
.top-bar-space { width: 72px; }
@media (max-width: 600px) {
  .top-bar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .logo-title { font-size: 13px; letter-spacing: 0; }
  .top-intro { padding: 5px 10px; font-size: 12px; }
  .link-back { font-size: 13.5px; padding: 0 4px; }
}

/* ── 主体 ── */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 14px calc(24px + env(safe-area-inset-bottom));
}
.intro-row { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.intro-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.intro-btn:active { transform: scale(0.97); }
.intro-btn-icon { font-size: 14px; }

.card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 18px rgba(96, 130, 180, 0.14);
  padding: 16px 16px 18px;
  margin-top: 12px;
}

/* ── 表单 ── */
.field-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.label-hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}
.field-select {
  width: 100%;
  padding: 10px 38px 10px 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232f6fed' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: #1f5fd6;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
  font-family: var(--font);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}
.field-select:invalid, .field-select option[value=""] { color: var(--ink-soft); font-size: 14px; font-weight: 500; letter-spacing: 0; }
.field-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18); }
.field-gap { margin-top: 14px; }

/* 勾选框（参考罗盘理气页） */
.checkbox-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  line-height: 1.5;
}
.checkbox-label input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
}
.jian-fields { margin-top: 10px; }
.jian-fields.hidden { display: none; }

.xiang-wrap { margin-top: 14px; }
.xiang-box {
  border: 1.5px dashed rgba(var(--accent-rgb), 0.45);
  border-radius: 10px;
  padding: 9px 12px;
  text-align: left;
  background: rgba(var(--accent-rgb), 0.05);
}
.xiang-value {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #1f5fd6;
}

.btn-main {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 11px 0;
  border: none;
  border-radius: 999px;
  background: linear-gradient(90deg, #3fb9f9, #5c8cf8, #8d7cf9);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(92, 140, 248, 0.35);
}
.btn-main:disabled {
  background: linear-gradient(90deg, #b9cbe4, #c6cfe6);
  box-shadow: none;
  cursor: not-allowed;
}

/* ── 信息条 ── */
.info-card { padding: 12px 14px; }
.info-line { display: flex; flex-wrap: wrap; gap: 8px; }
.info-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.09);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  color: var(--title);
  font-size: 14px;
  font-weight: 600;
}

/* ── 吉项分区块（纵向排列） ── */
.sections-card { padding: 14px 14px 16px; }
.tabs-panels { display: block; }
.sec-block {
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  padding: 12px 12px 13px;
  margin-bottom: 12px;
}
.sec-block:last-child { margin-bottom: 0; }
.sec-head {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 800;
  color: var(--title);
  border-left: 3px solid #3fb9f9;
  padding-left: 9px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sec-head::after {
  content: "▾";
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  transition: transform 0.2s;
}
.sec-block.collapsed .sec-head::after { transform: rotate(-90deg); }
.sec-block.collapsed .sec-body { display: none; }
.sec-body { padding-top: 6px; }
.tab-sub {
  margin: 4px 6px 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.rule-item {
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-left: 3px solid #3fb9f9;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.rule-head {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--good);
  margin-bottom: 5px;
}
.rule-line {
  margin: 3px 0 0;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink);
}
.rule-line .mtn, .rule-head .mtn, .info-chip .mtn {
  color: #c2551e;
  font-weight: 700;
  padding: 0 1px;
}
.rule-empty {
  padding: 14px 8px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
}

/* 九宫旺运格 */
.grid-note { margin: 12px 6px 8px; font-size: 14px; line-height: 1.7; color: var(--ink-soft); }
.yun-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.yun-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 0 4px;
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.06);
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.yun-cell i {
  font-style: normal;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.yun-cell.is-new {
  background: var(--good-bg);
  border-color: rgba(46, 139, 87, 0.4);
}
.yun-cell.is-new i { color: var(--good); }

/* ── 页脚 ── */
.foot-tip {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
  color: #8a99b8;
}

/* ── 介绍弹窗 ── */
.tip-modal { position: fixed; inset: 0; z-index: 1000; }
.tip-modal.hidden { display: none; }
.tip-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 46, 74, 0.45);
  backdrop-filter: blur(2px);
}
.tip-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 620px);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #fdfbf5;
  box-shadow: 0 18px 44px rgba(30, 46, 74, 0.3);
  overflow: hidden;
}
.tip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(148, 178, 225, 0.35);
  background: linear-gradient(90deg, rgba(63, 185, 249, 0.12), rgba(141, 124, 249, 0.12));
}
.tip-head h2 { margin: 0; font-size: 16px; font-weight: 800; color: var(--title); }
.tip-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background: rgba(148, 178, 225, 0.25);
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.tip-close:hover { background: var(--warn); color: #fff; }
.tip-body { overflow-y: auto; padding: 14px 18px 20px; }
.intro-block { margin-bottom: 16px; }
.intro-block h3 {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--title);
  border-left: 3px solid #3fb9f9;
  padding-left: 8px;
}
.intro-block h4 { margin: 10px 0 4px; font-size: 13.5px; color: var(--title); }
.intro-block p { margin: 4px 0; font-size: 13.5px; }
.intro-block b { color: var(--title); }
.intro-verse {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--title);
  font-weight: 600;
}
