/* 八字排盘 —— 浅宣纸古风主题 */
:root {
  --paper: #f5efe0;
  --card: #fdfaf2;
  --ink: #2b2116;
  --muted: #7a6a55;
  --accent: #a12830;
  --gold: #b8860b;
  --line: #d9c9a8;
  --wood: #2e7d32;
  --fire: #c62828;
  --earth: #8d6e63;
  --metal: #b8860b;
  --water: #1565c0;
  --serif: 'Noto Serif SC', 'Songti SC', 'SimSun', 'STSong', serif;
  --kai: 'Ma Shan Zheng', 'Kaiti SC', 'KaiTi', 'STKaiti', cursive;
  --shadow: 0 2px 12px rgba(43, 33, 22, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--serif);
  background:
    radial-gradient(ellipse at top, rgba(184, 134, 11, 0.06), transparent 60%),
    var(--paper);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.7;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ---------- 页头 ---------- */
.app-header {
  text-align: center;
  padding: 34px 0 10px;
}
.app-header h1 {
  font-family: var(--kai);
  font-size: 46px;
  font-weight: 400;
  letter-spacing: 10px;
  color: var(--accent);
  text-shadow: 1px 1px 0 rgba(184, 134, 11, 0.25);
}
.app-header .subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 4px;
}
.header-line {
  width: 260px;
  height: 1px;
  margin: 18px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 24px 26px;
  margin-top: 22px;
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  top: -1px; left: 24px; right: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.card-title {
  font-family: var(--kai);
  font-size: 22px;
  color: var(--accent);
  letter-spacing: 3px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- 表单 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-row.full { grid-column: 1 / -1; }
.form-row label {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 1px;
}
.form-row label b { color: var(--accent); font-weight: 600; }

select, input[type="text"] {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  outline: none;
  transition: border-color 0.2s;
}
select:focus, input[type="text"]:focus {
  border-color: var(--accent);
}

/* 历法切换 */
.cal-toggle {
  display: flex;
  background: #f1e8d5;
  border-radius: 6px;
  padding: 3px;
  gap: 3px;
}
.cal-toggle button {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 5px;
  background: transparent;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 2px;
}
.cal-toggle button.active {
  background: var(--card);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(43, 33, 22, 0.12);
}

/* 性别 */
.sex-toggle {
  display: flex;
  gap: 10px;
}
.sex-toggle button {
  flex: 1;
  padding: 9px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf7;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: 2px;
}
.sex-toggle button.active {
  border-color: var(--accent);
  color: var(--accent);
  background: #fdf0ee;
}

/* 日期行 */
.date-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.date-line select { flex: 1; min-width: 90px; }
.leap-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.leap-wrap input { accent-color: var(--accent); width: 15px; height: 15px; }
.leap-wrap.disabled { opacity: 0.4; pointer-events: none; }

/* 真太阳时 */
.suntime-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #f6efdf;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.suntime-row .left { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.suntime-row input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.suntime-row .hint { color: var(--muted); font-size: 12px; }
.suntime-row select { padding: 6px 8px; font-size: 13px; }
.suntime-row.disabled { opacity: 0.5; }

/* 验证码 */
.captcha-box { display: flex; gap: 10px; align-items: stretch; }
.captcha-box input { flex: 1; min-width: 0; }
.captcha-box img {
  height: 42px;
  width: 110px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  background: #f5f1e8;
}
.captcha-hint { font-size: 12px; color: var(--muted); }

/* 提交按钮 */
.submit-wrap { text-align: center; margin-top: 20px; }
.btn-calc {
  font-family: var(--kai);
  font-size: 20px;
  letter-spacing: 6px;
  color: #fff;
  background: linear-gradient(180deg, #b63a3a, var(--accent));
  border: none;
  border-radius: 8px;
  padding: 12px 48px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(161, 40, 48, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-calc:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(161, 40, 48, 0.4); }
.btn-calc:active { transform: translateY(1px); }
.btn-calc:disabled { opacity: 0.6; cursor: not-allowed; }

/* 错误提示 */
.error-box {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fdf0ee;
  border: 1px solid #e5b4b0;
  border-radius: 8px;
  color: var(--accent);
  font-size: 14px;
  display: none;
}

/* ---------- 结果 ---------- */
#result { display: none; }
#result.show { display: block; }

/* 基本信息卡 */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 20px;
  font-size: 14px;
}
.info-grid .item { color: var(--muted); }
.info-grid .item b { color: var(--ink); font-weight: 600; margin-right: 6px; }
.time-change {
  margin-top: 12px;
  padding: 10px 14px;
  background: #f6efdf;
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  font-size: 14px;
}
.time-change b { color: var(--accent); }
.dst-note { color: var(--accent); font-size: 13px; margin-top: 4px; }

/* 四柱表 */
.pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.pillar {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf7;
  padding: 14px 8px 12px;
  text-align: center;
  position: relative;
}
.pillar.day {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(161, 40, 48, 0.2);
}
.pillar-label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.pillar .shi-shen-gan {
  font-size: 12px;
  color: var(--muted);
  height: 18px;
  margin-bottom: 2px;
}
.pillar .gan {
  font-family: var(--kai);
  font-size: 40px;
  line-height: 1.1;
}
.pillar .zhi {
  font-family: var(--kai);
  font-size: 40px;
  line-height: 1.1;
  margin-top: 4px;
}
.pillar .zhi-meta {
  margin-top: 8px;
  border-top: 1px dashed var(--line);
  padding-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.pillar .hide-row { margin-top: 4px; }
.pillar .hide-gan { font-size: 13px; color: var(--ink); }
.pillar .hide-ss { font-size: 11px; color: var(--muted); }
.pillar .nayin { margin-top: 5px; font-size: 12px; color: var(--gold); }
.pillar .dishi { font-size: 12px; color: var(--muted); }
.pillar .shichen { font-size: 11px; color: var(--gold); margin-top: 2px; }

.pillar-tags {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.pillar-tags b { color: var(--ink); font-weight: 600; }

/* 八字格局 */
.geju-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.geju-name {
  font-family: var(--kai);
  font-size: 30px;
  line-height: 1.2;
  border: 2px solid;
  border-radius: 8px;
  padding: 2px 18px;
  transform: rotate(-2deg);
}
.geju-meta { font-size: 13px; color: var(--muted); }
.geju-desc {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink);
  background: #f6efdf;
  border-radius: 8px;
  padding: 10px 14px;
}

/* 五行柱状条 */
.elem-bars { display: flex; flex-direction: column; gap: 12px; }
.elem-row { display: flex; align-items: center; gap: 12px; }
.elem-name {
  width: 34px;
  font-family: var(--kai);
  font-size: 18px;
  text-align: center;
  flex-shrink: 0;
}
.elem-track {
  flex: 1;
  height: 20px;
  background: #f1e8d5;
  border-radius: 10px;
  overflow: hidden;
}
.elem-fill {
  height: 100%;
  border-radius: 10px;
  width: 0;
  transition: width 0.8s ease;
  opacity: 0.85;
}
.elem-pct {
  width: 60px;
  font-size: 14px;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
}
.elem-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.elem-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }

/* 日主强弱 */
.strength-head {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.strength-head .day-master {
  font-family: var(--kai);
  font-size: 34px;
  line-height: 1.2;
}
.strength-head .day-master small {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--muted);
  margin-left: 4px;
}
.stamp {
  display: inline-block;
  padding: 4px 14px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-family: var(--kai);
  font-size: 20px;
  letter-spacing: 2px;
  transform: rotate(-3deg);
}
.stamp.gentle { border-color: var(--gold); color: var(--gold); }
.strength-factors {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.factor {
  text-align: center;
  padding: 12px 8px;
  background: #f6efdf;
  border-radius: 8px;
  font-size: 14px;
}
.factor .fk { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.factor .fv { font-size: 15px; font-weight: 600; }
.factor .fv.yes { color: var(--accent); }
.factor .fv.no { color: var(--muted); }
.yong-shen {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fdf0ee;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
}
.yong-shen b { color: var(--accent); }
.ys-use {
  display: inline-block;
  font-family: var(--kai);
  font-size: 26px;
  line-height: 1;
  margin: 0 4px;
  vertical-align: -3px;
}
.ys-use.gentle { font-size: 20px; color: var(--gold); }
.ys-pills {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.ys-pill {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ys-pill b { font-size: 13px; letter-spacing: 1px; }
.ys-pill.xi { background: #e9f5e9; border: 1px solid #a9d4a9; }
.ys-pill.xi b { color: #2e7d32; }
.ys-pill.ji { background: #f6efdf; border: 1px solid #d9c9a8; }
.ys-pill.ji b { color: var(--gold); }
.ys-pill .ys-el {
  font-family: var(--kai);
  font-size: 22px;
  line-height: 1;
}
.ys-pill em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
  margin-left: 4px;
}
.ys-note { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* 大运时间轴 */
.yun-head {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--muted);
}
.yun-head b { color: var(--ink); font-weight: 600; }
.yun-scroll { overflow-x: auto; padding-bottom: 8px; }
.yun-track {
  display: flex;
  gap: 0;
  min-width: max-content;
  position: relative;
}
.yun-node {
  width: 104px;
  text-align: center;
  position: relative;
  padding-top: 16px;
}
.yun-node::before {
  content: '';
  position: absolute;
  top: 4px; left: 50%;
  width: 10px; height: 10px;
  transform: translateX(-50%);
  border: 2px solid var(--gold);
  background: var(--card);
  border-radius: 50%;
}
.yun-node:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  width: 100%;
  height: 2px;
  background: var(--line);
}
.yun-node.current::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(161, 40, 48, 0.2);
}
.yun-node .gzi {
  font-family: var(--kai);
  font-size: 20px;
}
.yun-node.current .gzi {
  color: var(--accent);
}
.yun-node .ss { font-size: 11px; color: var(--muted); margin-top: 2px; }
.yun-node .ss-sep { color: #c9b89a; margin: 0 2px; }
.yun-node .nayin { font-size: 11px; color: var(--gold); margin-top: 1px; }
.yun-node .ages { font-size: 12px; color: var(--muted); margin-top: 2px; }
.yun-node .years { font-size: 11px; color: var(--gold); }
.yun-node.current .years { color: var(--accent); }
.yun-node .mark {
  font-size: 10px;
  color: #fff;
  background: var(--accent);
  border-radius: 3px;
  padding: 0 5px;
  margin-left: 4px;
}

/* 复制八字 */
.pillar-copy {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: #f6efdf;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.copy-chart {
  font-family: var(--kai);
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--ink);
}
.btn-copy {
  font-family: var(--serif);
  font-size: 14px;
  color: #fff;
  background: linear-gradient(180deg, #b63a3a, var(--accent));
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  cursor: pointer;
  letter-spacing: 2px;
  box-shadow: 0 2px 6px rgba(161, 40, 48, 0.3);
  transition: transform 0.15s;
}
.btn-copy:hover { transform: translateY(-1px); }
.btn-copy:active { transform: translateY(1px); }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(43, 33, 22, 0.92);
  color: #f5efe0;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 99;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 感情 & 财富 ---------- */
.lw-summary {
  padding: 10px 14px;
  background: #f6efdf;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 14px;
}
.lw-points { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.lw-point { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.lp-label {
  flex-shrink: 0;
  padding: 2px 8px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-size: 12px;
  margin-top: 2px;
  letter-spacing: 1px;
}
.lw-block-title {
  font-family: var(--kai);
  font-size: 16px;
  color: var(--accent);
  margin: 14px 0 8px;
  letter-spacing: 2px;
}
.lw-scroll { overflow-x: auto; padding-bottom: 4px; }
.lw-track { display: flex; gap: 10px; min-width: max-content; }
.lw-node {
  width: 116px;
  flex-shrink: 0;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 6px;
  background: #fffdf7;
}
.lw-node.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(161, 40, 48, 0.15); }
.lw-gz { font-family: var(--kai); font-size: 19px; }
.lw-years { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.lw-reason { font-size: 11px; color: var(--gold); margin-top: 4px; line-height: 1.4; }
.lw-node.current .lw-reason { color: var(--accent); }
.lw-window {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fdf0ee;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
}
.lw-window b { color: var(--accent); }
.wealth-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.wealth-level {
  font-family: var(--kai);
  font-size: 30px;
  border: 2px solid;
  border-radius: 8px;
  padding: 2px 16px;
  transform: rotate(-2deg);
  line-height: 1.2;
}
.wealth-tag { font-size: 14px; color: var(--muted); }
.wealth-source {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--ink);
  background: #f6efdf;
  border-radius: 8px;
  padding: 10px 14px;
}

/* 分析 */
.analysis-item { margin-bottom: 16px; }
.analysis-item .a-title {
  font-family: var(--kai);
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.analysis-item .a-text {
  font-size: 14.5px;
  color: var(--ink);
  text-align: justify;
}

/* 页脚 */
footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 34px;
  letter-spacing: 1px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .app-header h1 { font-size: 36px; letter-spacing: 6px; }
  .form-grid { grid-template-columns: 1fr; }
  .pillars { grid-template-columns: repeat(2, 1fr); }
  .strength-factors { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
  .copy-chart { font-size: 21px; letter-spacing: 2px; }
}
