/* ============ 灵运阁 东方美学样式 ============ */
:root {
  --primary: #8c2f1f;      /* 暗红（主色） */
  --primary-dark: #6e2013;
  --gold: #b08d3e;         /* 金 */
  --gold-light: #d4b978;
  --accent: #2b2118;       /* 深棕墨 */
  --bg: #f7f1e3;           /* 宣纸米 */
  --bg-card: #fffdf7;
  --text: #2b2118;
  --text-dim: #7a6a58;
  --border: #e4d9c3;
  --success: #5a7d4e;
  --warn: #b7791f;
  --shadow: 0 4px 20px rgba(139, 115, 85, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(180deg, #fffdf7 0%, #f7f1e3 100%);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(139,115,85,.06);
}
.topbar-inner {
  max-width: 1040px; margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); }
.brand-seal {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #f5e6c8; font-size: 22px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.25), 0 2px 6px rgba(140,47,31,.35);
}
.brand-name { font-size: 21px; font-weight: 700; letter-spacing: 2px; }
.nav-desktop { display: flex; gap: 4px; }
.nav-desktop a {
  color: var(--text-dim); text-decoration: none; font-size: 14.5px;
  padding: 6px 13px; border-radius: 8px; transition: all .2s;
}
.nav-desktop a:hover { color: var(--primary); background: rgba(140,47,31,.06); }
.nav-desktop a.active { color: var(--primary); font-weight: 600; background: rgba(140,47,31,.08); }
.hamburger {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: 8px; font-size: 20px; padding: 4px 12px; cursor: pointer; color: var(--accent);
}
.nav-mobile {
  display: none; border-top: 1px solid var(--border); background: #fffdf7;
  padding: 6px 14px 14px; max-width: 1040px; margin: 0 auto;
}
.nav-mobile.open { display: block; }
.nav-mobile a {
  display: block; padding: 10px 8px; color: var(--text); text-decoration: none;
  border-bottom: 1px dashed var(--border); font-size: 15px;
}
.nav-mobile a:last-child { border-bottom: none; }
.nav-mobile a.active { color: var(--primary); font-weight: 600; }

/* ---------- 主内容 ---------- */
.main-content {
  flex: 1; width: 100%; max-width: 1040px; margin: 0 auto;
  padding: 26px 18px 50px;
  animation: fadeIn .45s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 页面头部 */
.page-head { text-align: center; margin-bottom: 26px; }
.page-kicker {
  display: inline-block; font-size: 12.5px; color: var(--gold);
  border: 1px solid var(--gold-light); border-radius: 20px; padding: 2px 14px;
  letter-spacing: 2px; background: rgba(176,141,62,.06); margin-bottom: 10px;
}
.page-title { font-size: 30px; font-weight: 700; color: var(--accent); }
.page-desc { color: var(--text-dim); font-size: 14.5px; margin-top: 6px; }

/* 卡片 */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card h3 { font-size: 17px; color: var(--accent); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h3::before { content: ""; width: 4px; height: 17px; background: linear-gradient(var(--gold), var(--primary)); border-radius: 2px; }

/* 日期条 */
.date-line { text-align: center; color: var(--text-dim); font-size: 14px; margin: 10px 0 20px; }
.date-line b { color: var(--primary); font-weight: 600; }
.lunar-badge {
  display: inline-block; background: linear-gradient(135deg,#8c2f1f,#a03c28);
  color: #f7e9cc; font-size: 13px; padding: 4px 16px; border-radius: 20px; margin-top: 6px;
}

/* 栅格 */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.sign-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 10px; text-align: center; cursor: pointer; text-decoration: none; color: var(--text);
  transition: all .25s;
}
.sign-card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(139,115,85,.18); border-color: var(--gold); }
.sign-card .sym { font-size: 30px; }
.sign-card .nm { font-weight: 600; margin-top: 4px; color: var(--accent); }
.sign-card .dt { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.sign-card .ele { font-size: 11px; color: var(--gold); margin-top: 2px; }
.sign-card.selected { border-color: var(--primary); background: #fdf5ec; box-shadow: 0 0 0 2px rgba(140,47,31,.15); }

/* 五维评分条 */
.radar-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.radar-label { width: 52px; font-size: 14px; color: var(--text-dim); flex-shrink: 0; }
.radar-track { flex: 1; height: 10px; background: #efe6d2; border-radius: 6px; overflow: hidden; }
.radar-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--gold-light), var(--gold), var(--primary));
  width: 0; transition: width 1s cubic-bezier(.22,.61,.36,1);
}
.radar-val { width: 34px; text-align: right; font-size: 13px; color: var(--primary); font-weight: 600; }

/* 运势文字 */
.fortune-text {
  background: #fdf7ea; border: 1px solid var(--border); border-left: 4px solid var(--gold);
  border-radius: 10px; padding: 16px 18px; font-size: 15px; color: #4a3d2c; margin: 14px 0;
}

/* 宜/忌 双栏 */
.yiji-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.yi-col, .ji-col { border-radius: 14px; padding: 18px; }
.yi-col { background: rgba(90,125,78,.07); border: 1px solid rgba(90,125,78,.25); }
.ji-col { background: rgba(140,47,31,.05); border: 1px solid rgba(140,47,31,.18); }
.yi-col h4 { color: var(--success); margin-bottom: 10px; font-size: 16px; }
.ji-col h4 { color: var(--primary); margin-bottom: 10px; font-size: 16px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list span {
  font-size: 13px; padding: 4px 12px; border-radius: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
}

/* 幸运信息格 */
.luck-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.luck-item { text-align: center; padding: 14px 8px; background: #fbf5e8; border-radius: 12px; border: 1px solid var(--border); }
.luck-item .k { font-size: 12px; color: var(--text-dim); }
.luck-item .v { font-size: 18px; margin-top: 4px; font-weight: 600; color: var(--accent); }
.color-swatch { display: inline-block; width: 18px; height: 18px; border-radius: 50%; vertical-align: -3px; margin-right: 6px; border: 1px solid rgba(0,0,0,.12); }

/* 按钮 */
.btn {
  display: inline-block; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #f7e9cc; border: none; border-radius: 24px; padding: 9px 26px; font-size: 14.5px;
  font-family: inherit; cursor: pointer; transition: all .2s; text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(140,47,31,.3); }
.btn-ghost {
  background: transparent; color: var(--primary); border: 1px solid var(--primary);
}
.btn-ghost:hover { background: rgba(140,47,31,.06); }

/* 模块导航宫格 */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 6px; }
.module-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; text-decoration: none; color: var(--text); transition: all .25s;
  display: block;
}
.module-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(139,115,85,.15); border-color: var(--gold); }
.module-card .m-ico { font-size: 26px; }
.module-card .m-name { font-weight: 600; margin-top: 6px; color: var(--accent); }
.module-card .m-desc { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }
.module-card .m-badge {
  display: inline-block; font-size: 11px; color: var(--gold); border: 1px solid var(--gold-light);
  border-radius: 10px; padding: 0 8px; margin-top: 6px;
}

/* 页脚 */
.footer {
  text-align: center; padding: 26px 16px 30px; color: var(--text-dim); font-size: 12.5px;
  border-top: 1px solid var(--border); background: #fbf5e8;
}
.footer-links { margin: 6px 0; }
.footer-links a { color: var(--text-dim); text-decoration: none; margin: 0 8px; }
.footer-links a:hover { color: var(--primary); }

/* 摇签区 */
.qian-box {
  text-align: center; padding: 30px 20px; border: 2px solid var(--border);
  border-radius: 16px; background: radial-gradient(ellipse at center, #fffdf7, #f3e9d2);
}
.qian-stick {
  display: inline-block; font-size: 15px; color: var(--primary); background: #f5e6c8;
  padding: 14px 20px; border-radius: 6px; border: 1px solid var(--gold-light);
  transform: rotate(-3deg); margin: 10px;
  animation: shake .5s ease;
}
@keyframes shake { 0%,100%{transform:rotate(-3deg)} 25%{transform:rotate(3deg)} 50%{transform:rotate(-5deg)} 75%{transform:rotate(4deg)} }

/* 进度条（测试页通用） */
.progress { height: 8px; background: #efe6d2; border-radius: 6px; overflow: hidden; margin: 14px 0; }
.progress-fill {
  height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--gold), var(--primary));
  transition: width .5s ease;
}

/* 测试题卡 */
.quiz-opt {
  display: block; width: 100%; text-align: left; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px;
  font-size: 14.5px; cursor: pointer; margin: 8px 0; font-family: inherit; color: var(--text);
  transition: all .2s;
}
.quiz-opt:hover { border-color: var(--gold); background: #fdf7ea; }
.quiz-opt:disabled { opacity: .6; cursor: default; }

/* 万年历网格 */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  text-align: center; padding: 8px 2px; border-radius: 8px; font-size: 13px;
  background: var(--bg-card); border: 1px solid var(--border); cursor: pointer;
}
.cal-cell.weekhead { background: none; border: none; color: var(--text-dim); font-size: 12px; cursor: default; }
.cal-cell.other { opacity: .35; }
.cal-cell.today { background: linear-gradient(135deg,var(--primary),var(--primary-dark)); color: #f7e9cc; font-weight: 600; }
.cal-cell .lunar-d { font-size: 10px; color: var(--text-dim); }
.cal-cell.today .lunar-d { color: #e8cfa0; }

/* 响应式 */
@media (max-width: 640px) {
  .nav-desktop { display: none; }
  .hamburger { display: block; }
  .grid-cards { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .yiji-wrap { grid-template-columns: 1fr; }
  .luck-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .page-title { font-size: 24px; }
  .module-grid { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 18px 12px 40px; }
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfc2a8; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ========== P1 新增样式：分段切换 / 星座页 / 签筒 / 万年历 ========== */
.seg-tabs { display: flex; gap: 6px; justify-content: center; margin: 4px 0 16px; }
.seg-tab {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-dim);
  padding: 6px 20px; border-radius: 20px; font-size: 14px; cursor: pointer;
  font-family: inherit; transition: all .2s;
}
.seg-tab:hover { border-color: var(--gold); color: var(--accent); }
.seg-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #f7e9cc; border-color: var(--primary); font-weight: 600;
}
.sign-sel-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 6px; }
.sign-chip {
  border: 1px solid var(--border); background: var(--bg-card); border-radius: 10px;
  padding: 6px 10px; font-size: 14px; cursor: pointer; transition: all .2s; color: var(--text);
  display: inline-flex; align-items: center; gap: 5px; font-family: inherit;
}
.sign-chip:hover { border-color: var(--gold); transform: translateY(-1px); }
.sign-chip.active { border-color: var(--primary); background: #fdf5ec; box-shadow: 0 0 0 1.5px rgba(140,47,31,.2); font-weight: 600; }

/* 签筒 */
.qian-area { text-align: center; padding: 26px 16px; }
.qian-jar {
  width: 74px; height: 108px; margin: 0 auto 14px; position: relative;
  background: linear-gradient(160deg, #a03c28, #7a2416);
  border-radius: 14px 14px 22px 22px;
  box-shadow: inset 0 -12px 18px rgba(0,0,0,.22), 0 6px 16px rgba(90,30,15,.35);
}
.qian-jar::before { /* 签筒中的签 */
  content: ""; position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 40px; background: #e8cfa0; border-radius: 4px;
  box-shadow: -14px 4px 0 #d9b877, 14px 4px 0 #f0dcb4, -7px -3px 0 #ddc08a, 7px -3px 0 #e5cb99;
}
.qian-jar::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 16px;
  background: rgba(0,0,0,.16); border-radius: 0 0 22px 22px;
}
.qian-jar.shaking { animation: qianShake .55s ease; }
@keyframes qianShake {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-7deg) translateY(-3px); }
  45% { transform: rotate(6deg) translateY(-6px); }
  70% { transform: rotate(-4deg) translateY(-2px); }
}
.qian-result { margin-top: 18px; animation: fadeIn .5s ease; }
.qian-no {
  display: inline-block; background: linear-gradient(135deg, var(--gold), #8a6a2a);
  color: #fff8e8; font-size: 13px; padding: 3px 16px; border-radius: 14px; letter-spacing: 1px;
}
.qian-level { font-size: 13px; margin: 6px 0 2px; }
.qian-level.up { color: var(--primary); font-weight: 700; }
.qian-level.mid { color: var(--gold); font-weight: 700; }
.qian-level.down { color: #7a7a7a; font-weight: 700; }
.qian-poem {
  font-size: 17px; line-height: 2; color: var(--accent); background: #fdf7ea;
  border: 1px solid var(--border); border-left: 4px solid var(--gold);
  border-radius: 10px; padding: 14px 16px; margin: 12px auto; max-width: 520px;
}
.qian-luck { font-size: 14px; color: #5a4a38; max-width: 560px; margin: 0 auto; }

/* 万年历 */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head .cal-ym { font-size: 18px; font-weight: 700; color: var(--accent); }
.cal-nav-btn {
  border: 1px solid var(--border); background: var(--bg-card); border-radius: 8px;
  padding: 4px 14px; cursor: pointer; font-size: 15px; color: var(--accent);
  font-family: inherit; transition: all .2s;
}
.cal-nav-btn:hover { border-color: var(--gold); }
.cal-cell.selected { border-color: var(--gold); background: #fbf3e0; box-shadow: 0 0 0 1.5px rgba(176,141,62,.35); }
.cal-detail { margin-top: 16px; }
.cal-detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cal-detail-grid .item { background: #fbf5e8; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }
.cal-detail-grid .item b { color: var(--primary); }
.cal-detail-grid .item .lg { font-size: 16px; color: var(--accent); font-weight: 600; }

/* ===== P2：MBTI / 心理测试 ===== */
.quiz-prog {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; background: #fdf6e6; border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 14px;
  font-size: 13.5px; color: var(--text-dim);
}
.quiz-prog b { color: var(--primary); font-size: 16px; }
.q-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(60,40,10,.05);
}
.q-no { font-size: 11.5px; color: #b08d3e; font-weight: 600; letter-spacing: .5px; margin-bottom: 5px; }
.q-text { font-size: 15px; line-height: 1.75; color: #3c3125; margin-bottom: 10px; font-weight: 500; }
.opt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-btn {
  border: 1px solid var(--border); background: #fffdf7; color: #5a4a38;
  border-radius: 999px; padding: 7px 14px; font-size: 13.5px; cursor: pointer;
  font-family: inherit; transition: all .18s; line-height: 1.4;
}
.opt-btn:hover { border-color: var(--gold); }
.opt-btn.active {
  border-color: var(--primary); background: #fdf0e6; color: var(--primary);
  box-shadow: 0 0 0 1.5px rgba(140,47,31,.18); font-weight: 600;
}
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* 结果条 */
.dim-bar-row { margin-bottom: 11px; }
.dim-label { font-size: 13.5px; color: #3c3125; margin-bottom: 4px; }
.dim-label b { color: var(--primary); font-size: 15px; }
.dim-bar {
  height: 10px; background: #f0e6d2; border-radius: 999px; overflow: hidden;
  border: 1px solid #e5d9bd;
}
.dim-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), #c05f2c);
  border-radius: 999px; transition: width .5s ease;
}
.dim-pct { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; text-align: right; }

/* 类型结果 hero */
.type-hero {
  text-align: center; padding: 22px 16px 18px;
  background: linear-gradient(160deg, #fdf6e6, #fbf0d8);
  border: 1px solid var(--border); border-radius: 16px; margin-bottom: 14px;
}
.type-badge {
  display: inline-block; font-size: 34px; font-weight: 800; letter-spacing: 3px;
  color: var(--primary); border: 2px solid var(--gold); border-radius: 14px;
  padding: 6px 18px; background: #fffdf7;
}
.type-name { font-size: 24px; font-weight: 700; color: #2b2118; margin-top: 10px; }
.type-tag { font-size: 14px; color: var(--accent); margin-top: 4px; }
