﻿* { box-sizing: border-box; }

:root {
  --paper: #f6f1e8;
  --paper-soft: rgba(255, 252, 244, 0.86);
  --ink: #252928;
  --muted: #73706b;
  --line: rgba(55, 49, 39, 0.13);
  --teal: #0d5050;
  --teal-soft: rgba(13, 80, 80, 0.1);
  --red: #9b382f;
  --red-bright: #c42f2d;
  --gold: #b99a66;
  --shadow: 0 16px 42px rgba(61, 49, 31, 0.12);
  --card-bg: #fffdf8;
}

html { min-height: 100%; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  padding-bottom: 82px;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  background: url("page-bg.webp") center bottom / cover no-repeat fixed;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

/* ====== Header ====== */
#app { display: none; }
#app.show { display: block; }
.header {
  position: relative;
  z-index: 2;
  background: transparent;
  padding: 22px 18px 18px;
  text-align: center;
}
.header::before {
  content: "";
  position: absolute;
  inset: -12px 0 -18px;
  background: linear-gradient(
    to bottom,
    rgba(120, 20, 10, 0.55),
    rgba(120, 20, 10, 0.18),
    rgba(120, 20, 10, 0)
  );
  border-radius: 0 0 28px 28px;
  z-index: -1;
}
.header,
.header * {
  position: relative;
  z-index: 3;
}
.header-content { max-width: 540px; margin: 0 auto; }
.brand-row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.title { font-size: 34px; font-weight: normal; margin: 0; color: #FFE8B8; letter-spacing: 2px; text-shadow: 0 2px 4px rgba(80, 20, 10, 0.65), 0 0 10px rgba(255, 220, 160, 0.35); display: flex; align-items: baseline; justify-content: center; }
.taiji-mark { font-size: 28px; margin: 0 6px; }
.seal { font-size: 28px; color: #FFE8B8; font-weight: bold; margin-left: 4px; text-shadow: 0 2px 4px rgba(80, 20, 10, 0.65), 0 0 10px rgba(255, 220, 160, 0.35); }
.back-link {
  font-size: 15px;
  color: #FFE8B8;
  text-decoration: none;
  border: 1px solid rgba(255, 232, 184, 0.75);
  background: rgba(120, 30, 20, 0.28);
  backdrop-filter: blur(4px);
  border-radius: 18px;
  padding: 3px 14px;
  transition: all 0.2s;
}
.back-link:hover { color: #fff; border-color: #FFE8B8; }
.subtitle { font-size: 15px; color: #FFE7C2; font-weight: 600; margin: 8px 0 0; letter-spacing: 2px; text-shadow: 0 1px 4px rgba(80, 20, 10, 0.8), 0 2px 4px rgba(80, 20, 10, 0.65), 0 0 10px rgba(255, 220, 160, 0.35); }

/* ====== Main Content ====== */
.main-content { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* ====== Cards ====== */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 20px 18px;
  margin-bottom: 14px;
  box-shadow: 0 2px 12px rgba(61, 49, 31, 0.07);
  border: 1px solid var(--line);
}
.card-section-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--ink);
  margin-bottom: 14px;
  text-align: center;
  letter-spacing: 2px;
}

/* ====== Form ====== */
.male-card .form-group.compact,
.female-card .form-group.compact {
  margin-bottom: 10px;
  padding-left: 12px;
}
.label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fffef8; font-size: 15px; }
.male-card .input,
.female-card .input {
  max-width: 260px;
}
.input:focus { outline: none; border-color: var(--gold); }

.time-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr 1fr;
  gap: 5px;
}
.time-select {
  padding: 9px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
  font-size: 14px;
  text-align: center;
  color: var(--ink);
}
.time-select:focus { outline: none; border-color: var(--gold); }

/* ====== Button ====== */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 15px;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 4px;
  transition: all 0.3s;
}
.btn-primary {
  background: linear-gradient(180deg, #d94b3f, #b32a1f);
  color: #fff;
  box-shadow: 0 10px 30px rgba(180, 40, 20, 0.28);
  transform: translateY(-1px);
  font-size: 22px;
  font-weight: 700;
  margin: 18px 0;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(155, 56, 47, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ====== Result Area ====== */
.result-hidden { display: none; }
.result-show { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity:0;transform:translateY(8px) } to { opacity:1;transform:none } }

/* Segmented 鍘嗘硶閫夋嫨 */
.segmented { display:inline-flex; border-radius:8px; overflow:hidden; border:1px solid var(--line); }
.segmented .seg { padding:7px 18px; font-size:14px; color:var(--muted); background:transparent; border:none; cursor:pointer; transition:all .2s; }
.segmented .seg.active { background:var(--red); color:#fff; }
.segmented .seg:first-child { border-right:1px solid var(--line); }

/* 鏃ユ湡淇℃伅鎻愮ず */
.date-info { font-size:.82em; color:var(--muted); margin-top:8px; text-align:center; line-height:1.5; display:none; }
.date-info.show { display:block; }

/* ====== Layer 1: 涔濇槦缁撹 ====== */
.layer1-card {
  text-align: center;
  padding: 28px 18px;
}
.layer1-card .star-icon { font-size: 3em; margin-bottom: 8px; }
.layer1-card .star-name { font-size: 2em; font-weight: bold; letter-spacing: 3px; }
.layer1-card .star-level { font-size: 0.9em; margin: 6px 0; }
.layer1-card .star-desc { font-size: 0.95em; margin: 10px 0; line-height: 1.8; }
.layer1-card .koujue-box {
  background: rgba(0,0,0,0.04);
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0;
  font-family: "KaiTi","STKaiti",serif;
  line-height: 2;
  font-size: 0.9em;
  white-space: pre-line;
}
.layer1-card .dongxi-info { font-size: 0.82em; margin-top: 8px; }
.layer1-icon-bg-ji { background: linear-gradient(135deg, #9b382f, #b74a3f) !important; color: #fff; }
.layer1-icon-bg-ji .star-name { color: #ffd700; }
.layer1-icon-bg-ji .star-desc { color: #fff7f0; }
.layer1-icon-bg-ji .koujue-box { background: rgba(255,255,255,0.12); color: #fff7f0; }
.layer1-icon-bg-ji .dongxi-info { color: rgba(255,255,255,0.75); }

.layer1-icon-bg-zhong { background: linear-gradient(135deg, #8b6914, #b8860b) !important; color: #fff; }
.layer1-icon-bg-zhong .star-name { color: #ffe8a0; }
.layer1-icon-bg-zhong .star-desc { color: #fff7ed; }
.layer1-icon-bg-zhong .koujue-box { background: rgba(255,255,255,0.12); color: #fff7ed; }

.layer1-icon-bg-xiong { background: linear-gradient(135deg, #444, #333) !important; color: #ccc; }
.layer1-icon-bg-xiong .star-name { color: #ff6b6b; }
.layer1-icon-bg-xiong .star-desc { color: #bbb; }
.layer1-icon-bg-xiong .koujue-box { background: rgba(255,255,255,0.08); color: #bbb; }

/* ====== Layer 2: 鍏瓧鍒嗘瀽 ====== */
.detail-card { padding: 22px 18px; }
.detail-card h3 {
  font-size: 1.1em;
  color: var(--red);
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.detail-card h3:first-child { margin-top: 0; }

/* 鎺掔洏琛?*/
.bazi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.bazi-table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
.bazi-table th { background: var(--red); color: #fff; padding: 5px; font-size: 0.78em; text-align: center; font-weight: normal; }
.bazi-table td { text-align: center; padding: 7px 3px; border: 1px solid var(--line); }
.bazi-table .gz { font-size: 1.2em; font-weight: bold; }
.bazi-table .ss { font-size: 0.78em; color: var(--muted); }
.bazi-table .ny { font-size: 0.72em; color: #aaa; }

/* 鍑虹敓淇℃伅 */
.birth-info-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:10px; }
.birth-info-box { background:#fdfaf5; border-radius:10px; padding:12px; border:1px solid var(--line); }
.birth-info-box .birth-label { display:block; font-size:.8em; color:var(--red); font-weight:bold; margin-bottom:4px; }
.birth-info-box .birth-text { display:block; font-size:.85em; color:var(--ink); margin-bottom:2px; }
.birth-info-box .birth-lunar { display:block; font-size:.78em; color:var(--muted); }

.result-row { margin: 10px 0; line-height: 1.7; }
.result-row .rl { font-size: 0.85em; color: var(--muted); display: inline-block; min-width: 70px; }
.result-row .rv { font-size: 0.92em; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.78em; margin: 2px 3px; }
.tag-ji { background: #fff0e0; color: var(--red); border: 1px solid #e8c5b0; }
.tag-xiong { background: #fff0f0; color: var(--red-bright); border: 1px solid #f0c0c0; }
.tag-zhong { background: #f5f0eb; color: var(--muted); border: 1px solid #ddd; }

.stats-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0; }
.stat-item { text-align: center; min-width: 56px; }
.stat-item .num { font-size: 1.3em; font-weight: bold; display: block; }
.stat-item .lbl { font-size: 0.72em; color: var(--muted); }
.stat-item.good .num { color: var(--red); }
.stat-item.bad .num { color: var(--red-bright); }

.shensha-list { margin: 6px 0; }
.shensha-list .tag { margin: 2px 4px; }

/* ====== Layer 3: 缁煎悎璇勫畾 ====== */
.final-card { padding: 22px 18px; border: 2px solid var(--red); background: linear-gradient(180deg, var(--card-bg), rgba(246, 241, 232, 0.7)); }
.final-card h3 { font-size: 1.15em; color: var(--red); text-align: center; margin: 0 0 16px; }
.grade-display { text-align: center; padding: 12px; }
.grade-display .stars { font-size: 2.2em; letter-spacing: 3px; }
.grade-display .grade-text { font-size: 1.4em; color: var(--red); font-weight: bold; margin: 6px 0; }
.grade-display .score { font-size: 1em; color: var(--muted); }

.weight-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.85em; }
.weight-table th { background: #f0e8d8; padding: 7px; text-align: center; font-weight: bold; }
.weight-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.weight-table tr:last-child td { border-bottom: none; }

.info-box {
  background: #fffdf8;
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  border-left: 3px solid var(--gold);
  font-size: 0.88em;
  line-height: 1.7;
}
.info-box .ib-label { font-size: 0.82em; color: var(--muted); }
.info-box .ib-value { margin-top: 4px; }
.info-box .disclaimer { font-size: 0.78em; color: var(--gold); font-style: italic; margin-top: 4px; }

.verdict-box {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
  text-align: center;
  font-size: 1.05em;
  line-height: 1.8;
  border: 1px solid var(--line);
}
.verdict-box.good { border-color: var(--red); }
.verdict-box.caution { border-color: var(--red-bright); background: #fff9f8; }

/* ====== Responsive ====== */
@media (max-width: 500px) {
  .bazi-grid { grid-template-columns: 1fr; }
  .time-grid { grid-template-columns: 3fr 2fr 2fr 2fr 1.5fr; gap: 3px; }
  .time-select { padding: 8px 2px; font-size: 13px; }
  .title { font-size: 28px; }
}

.site-footer { text-align:center; padding:0 0 100px; color:rgba(255,230,210,.85); font-size:13px; text-shadow: 0 1px 3px rgba(80,20,10,.5); }

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100vw, 430px);
  height: 82px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255,250,243,.9);
  border-top: 1px solid rgba(120,93,58,.16);
  backdrop-filter: blur(12px);
  padding-bottom: 10px;
}
.nav-btn {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: #9b7b58;
  font-size: 14px;
  opacity: .58;
  text-decoration: none;
}
.nav-btn.active {
  color: var(--red);
  font-weight: 700;
  opacity: 1;
}
.nav-ico {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  position: relative;
  color: currentColor;
}
.nav-ico svg { width: 30px; height: 30px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-ico .soft-fill { fill: currentColor; stroke: none; opacity: .12; }
.nav-ico .deep-fill { fill: currentColor; stroke: none; opacity: .24; }
.nav-ico .sun-fill { fill: currentColor; stroke: none; opacity: .78; }

/* 鐢锋柟鍗＄墖鑳屾櫙 */
#maleCard {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  padding: 36px 32px 48px;
  min-height: 680px;
  background-image: url("card-bg-male.webp");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
#maleCard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 250, 245, 0.65);
  backdrop-filter: blur(2px);
  z-index: 1;
  border-radius: 32px;
}
#maleCard > * { position: relative; z-index: 2; }

/* 濂虫柟鍗＄墖鑳屾櫙 */
#femaleCard {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  padding: 36px 32px 48px;
  min-height: 680px;
  background-image: url("card-bg-female.webp");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
#femaleCard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 250, 245, 0.65);
  backdrop-filter: blur(2px);
  z-index: 1;
  border-radius: 32px;
}
#femaleCard > * { position: relative; z-index: 2; }

/* 男方卡片背景 */
.male-card {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  padding: 16px 18px 22px;
}
.male-card .male-card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 1;
  background-image: url('card-bg-male.webp');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 32px;
}
.male-card > * {
  position: relative;
  z-index: 2;
}


/* 女方卡片背景 */
.female-card {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  padding: 16px 18px 22px;
}
.female-card .female-card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 1;
  background-image: url('card-bg-female.webp');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 32px;
}
.female-card > * {
  position: relative;
  z-index: 2;
}


/* 按钮下方统计文案 */
.calc-subtitle {
  text-align: center;
  font-size: 13px;
  color: rgba(255, 230, 210, 0.78);
  margin: -8px 0 14px;
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(80, 20, 10, 0.5);
}
