:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e2e5eb;
  --text: #1f2430;
  --muted: #8a919d;
  --soft: #9aa1ad;
  --accent: #8b5a2b;
  --accent-2: #2f6fed;
  --chip: #f0f2f5;
  --verse-bg: #faf8f5;
  --wx-mu: #2e8b57;
  --wx-huo: #d64545;
  --wx-tu: #b8860b;
  --wx-jin: #c9a020;
  --wx-shui: #2b6cb0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.8;
  font-size: 16px;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: max(0.7rem, env(safe-area-inset-top)) 1.1rem 0.7rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.link-back {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  height: 2rem;
  padding: 0 0.7rem 0 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(47, 111, 237, 0.28);
  background: #fff;
  color: var(--accent-2);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.link-back:hover { background: #f5f8fd; border-color: rgba(47, 111, 237, 0.45); }

.logo-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

.hero {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.15rem 1.2rem 1.05rem;
  margin-bottom: 0.9rem;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.04);
}
.hero h1 {
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.hero p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.65;
}

.live-panel {
  margin-bottom: 0.95rem;
  padding: 0.95rem 1rem 1rem;
  border-radius: 14px;
  border: 1px solid #e0d2c2;
  background:
    radial-gradient(110% 90% at 0% 0%, rgba(139, 90, 43, 0.1), transparent 52%),
    linear-gradient(165deg, #fffaf4 0%, #f7f2ea 55%, #f4f6fa 100%);
  box-shadow: 0 2px 10px rgba(20, 30, 50, 0.05);
}
.live-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}
.live-head h2 {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.live-clock {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pillar-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}
.pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 3.4rem;
  padding: 0.45rem 0.25rem;
  border-radius: 12px;
  border: 1px solid rgba(139, 90, 43, 0.18);
  background: linear-gradient(180deg, #ffffff 0%, #f8efe4 100%);
}
.pillar em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--soft);
  letter-spacing: 0.08em;
}
.pillar b {
  font-size: 1.12rem;
  font-weight: 750;
  color: #2a303c;
  letter-spacing: 0.06em;
}
.pillar b .wx-木,
.wx-木 { color: var(--wx-mu) !important; }
.pillar b .wx-火,
.wx-火 { color: var(--wx-huo) !important; }
.pillar b .wx-土,
.wx-土 { color: var(--wx-tu) !important; }
.pillar b .wx-金,
.wx-金 { color: var(--wx-jin) !important; }
.pillar b .wx-水,
.wx-水 { color: var(--wx-shui) !important; }

.luohou-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin-bottom: 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid #e7ebf0;
  background: #fff;
  font-size: 0.86rem;
  color: #4b5565;
}
.luohou-status strong {
  font-weight: 750;
  letter-spacing: 0.04em;
}
.luohou-status.is-ok {
  border-color: rgba(46, 125, 70, 0.22);
  background: #f4faf6;
  color: #2f6b44;
}
.luohou-status.is-ok strong { color: #1f7a3a; }
.luohou-status.is-hit {
  border-color: rgba(190, 40, 40, 0.3);
  background: #fff5f5;
  color: #b42318;
}
.luohou-status.is-hit strong { color: #a11010; }
.luohou-status.is-err {
  border-color: rgba(190, 40, 40, 0.2);
  background: #fff8f8;
  color: #9b3a3a;
}
.hit-tag {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(180, 35, 24, 0.1);
  border: 1px solid rgba(180, 35, 24, 0.22);
  font-size: 0.78rem;
  font-weight: 650;
}

.luohou-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}
.luohou-item {
  padding: 0.55rem 0.5rem 0.6rem;
  border-radius: 11px;
  border: 1px solid #e8ebf0;
  background: #fff;
}
.luohou-item h3 {
  font-size: 0.86rem;
  font-weight: 750;
  color: var(--accent);
  margin-bottom: 0.12rem;
  letter-spacing: 0.04em;
}
.luohou-sub {
  font-size: 0.72rem !important;
  color: var(--soft) !important;
  margin-bottom: 0.28rem;
  line-height: 1.3 !important;
}
.luohou-val {
  font-size: 0.82rem;
  line-height: 1.4;
  color: #3a4250;
}
.luohou-item p {
  font-size: 0.82rem;
  line-height: 1.4;
  color: #3a4250;
}
.luohou-item.is-hit {
  border-color: rgba(180, 35, 24, 0.35);
  background: #fff6f6;
}
.luohou-item.is-hit h3,
.luohou-item.is-hit .luohou-val,
.luohou-item.is-hit p {
  color: #b42318;
}
.luohou-item.is-hit .luohou-sub {
  color: rgba(180, 35, 24, 0.72) !important;
}

@media (max-width: 640px) {
  .luohou-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pillar b {
    font-size: 1rem;
  }
}

.toc {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 1.05rem;
  padding: 0.85rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(20, 30, 50, 0.04);
}
.toc a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  min-height: 3.7rem;
  padding: 0.6rem 0.35rem 0.55rem;
  border-radius: 12px;
  border: 1px solid #e5e8ee;
  background: #f7f8fa;
  color: #2f3642;
  text-decoration: none;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.toc a i {
  font-style: normal;
  display: inline-grid;
  place-items: center;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 0.32rem;
  border-radius: 999px;
  background: #e8ebf0;
  color: #4b5565;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}
.toc a span {
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.toc a:hover {
  border-color: #cfd5de;
  background: #eef1f5;
  box-shadow: 0 2px 8px rgba(20, 30, 50, 0.06);
  transform: translateY(-1px);
}
.toc a:hover i {
  background: #dde2ea;
  color: #2f3642;
}
.toc a:active {
  transform: translateY(0);
}

@media (max-width: 560px) {
  .toc {
    gap: 0.42rem;
    padding: 0.7rem;
  }
  .toc a {
    min-height: 3.55rem;
    padding: 0.5rem 0.15rem 0.48rem;
    border-radius: 10px;
    gap: 0.28rem;
  }
  .toc a i {
    font-size: 0.86rem;
    min-width: 1.4rem;
    height: 1.4rem;
  }
  .toc a span {
    font-size: 1rem;
  }
}

.article {
  display: grid;
  gap: 0.85rem;
}

.section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.05rem 1.1rem 1.15rem;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.04);
  scroll-margin-top: 4.2rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #eef0f3;
}
.section-num {
  flex: 0 0 auto;
  min-width: 1.6rem;
  height: 1.6rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #f3ebe2;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}
.section-head h2 {
  font-size: 1.22rem;
  font-weight: 700;
  color: #2a3140;
  letter-spacing: 0.04em;
}

.block { margin-top: 0.85rem; }
.block:first-of-type { margin-top: 0; }

.block-title {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.45rem;
  padding: 0.14rem 0.55rem;
  border-radius: 6px;
  background: var(--chip);
  color: #4a5568;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.prose {
  font-size: 1.12rem;
  color: var(--text);
  line-height: 2;
}
.prose p { margin: 0 0 0.7rem; }
.prose p:last-child { margin-bottom: 0; }

.prose .soft,
.soft {
  color: var(--soft);
  font-weight: 400;
  font-size: 0.95em;
}

.note {
  margin-top: 0.55rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #e8ebf0;
  background: #f7f8fa;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.85;
}
.note-label {
  display: inline-block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #7b8494;
  letter-spacing: 0.08em;
}

.verse {
  margin: 0.35rem 0 0;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid #eee6da;
  background: var(--verse-bg);
}
.verse p {
  margin: 0;
  text-align: center;
  font-size: 1.08rem;
  line-height: 1.95;
  color: #5c4a32;
  letter-spacing: 0.03em;
}

.grid-days {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.7rem;
  margin-top: 0.35rem;
  padding: 0.8rem 0.9rem;
  border-radius: 10px;
  background: #f7f8fa;
  border: 1px solid #e8ebf0;
  font-size: 1.05rem;
  color: #3a4354;
  line-height: 1.7;
}
@media (min-width: 640px) {
  .grid-days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.qa {
  margin: 0.5rem 0;
  font-size: 1.08rem;
  line-height: 1.9;
  color: var(--text);
}
.qa .ask { color: var(--text); }
.qa .ans {
  color: var(--soft);
  margin-left: 0.15rem;
}

@media (max-width: 640px) {
  .hero { padding: 1rem; }
  .section { padding: 0.95rem; border-radius: 12px; }
  .prose { font-size: 1.08rem; }
  .verse p { font-size: 1.04rem; }
  .grid-days {
    grid-template-columns: 1fr;
    font-size: 1.02rem;
  }
  .qa { font-size: 1.05rem; }
}
