:root {
  color-scheme: light;
  --bg: #f4f6f1;
  --bg-2: #e9eef0;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --ink: #1f2927;
  --muted: #68736f;
  --line: #d8dfd9;
  --accent: #2f6f61;
  --accent-2: #8e4f3f;
  --accent-3: #3e607d;
  --mark: #fff0b8;
  --panel: #ffffff;
  --gold: #d98508;
  --gold-weak: #fff8df;
  --green: #5aa316;
  --green-weak: #f2fbdf;
  --shadow: 0 18px 48px rgba(39, 50, 47, 0.12);
  --reader-width: 860px;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.km-app {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(47, 111, 97, 0.08), transparent 34rem),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--ink);
  font-family: "LXGW WenKai", "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "Microsoft YaHei", serif;
  line-height: 1.78;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.site-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 18px 0 14px;
  background: rgba(244, 246, 241, 0.9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(216, 223, 217, 0.72);
}

.site-topbar-inner,
.km-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-topbar-inner {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 420px);
  gap: 20px;
  align-items: end;
}

.brand h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: 0;
}

.doc-stats {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.header-actions {
  display: grid;
  gap: 10px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 24px rgba(39, 50, 47, 0.06);
}

.mode-tab {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.mode-tab.active {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(39, 50, 47, 0.08);
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.search-box {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(39, 50, 47, 0.07);
}

.search-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 97, 0.14);
}

.text-button {
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  padding: 7px 12px;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
}

.text-button:hover,
.text-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.text-button:disabled,
.text-button.disabled {
  pointer-events: none;
  opacity: 0.45;
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.km-shell {
  padding: 24px 0 56px;
}

.home-section {
  display: grid;
  gap: 18px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  color: var(--ink);
  font-weight: 900;
}

.section-title small {
  color: var(--muted);
  font-size: 13px;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card-tile {
  min-height: 168px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  text-align: left;
  border: 1px solid rgba(216, 223, 217, 0.96);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  padding: 18px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(39, 50, 47, 0.06);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  color: inherit;
  text-decoration: none;
}

.card-tile:hover,
.card-tile:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(47, 111, 97, 0.52);
  background: #ffffff;
  box-shadow: var(--shadow);
  outline: none;
}

.card-number {
  width: fit-content;
  min-width: 38px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #e8f1ed;
  color: var(--accent);
  font-family: "Iosevka", "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
}

.card-title {
  display: block;
  font-size: 20px;
  line-height: 1.42;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.empty-state {
  margin: 34px auto 0;
  width: min(520px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  text-align: center;
  color: var(--muted);
}

.reader-shell {
  width: min(var(--reader-width), 100%);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(216, 223, 217, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: clip;
}

.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 9;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 247, 0.96);
  backdrop-filter: blur(14px);
}

.reader-title {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}

.reader-body {
  background:
    linear-gradient(90deg, rgba(47, 111, 97, 0.06), transparent 12rem),
    var(--surface);
}

.reader-footer {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 34px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
}

.reader-footer .text-button {
  min-height: 48px;
  background: #f8faf7;
  font-weight: 800;
}

.reader-article {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 30px;
  font-size: 18px;
}

.reader-article h2 {
  margin: 0 0 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: clamp(26px, 5vw, 42px);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: 0;
}

.reader-article h3 {
  margin: 32px 0 14px;
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #eef5f1;
  color: #214d44;
  font-size: 22px;
  line-height: 1.35;
}

.section-toc {
  margin: 26px 0 28px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7faf6;
}

.section-toc-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.section-toc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.section-toc-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #dce4dd;
  border-radius: 999px;
  background: #ffffff;
  color: #284c44;
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}

.section-toc-links a:hover,
.section-toc-links a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.subsection-list {
  display: grid;
  gap: 12px;
  margin: 22px 0;
}

.subsection-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  overflow: clip;
  box-shadow: 0 8px 24px rgba(39, 50, 47, 0.06);
}

.subsection-card[open] {
  border-color: rgba(47, 111, 97, 0.46);
}

.subsection-card summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  background: #f8faf7;
}

.subsection-card summary::-webkit-details-marker {
  display: none;
}

.subsection-card summary::after {
  content: "+";
  grid-column: 3;
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.subsection-card[open] summary::after {
  content: "-";
}

.subsection-index {
  width: 36px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #e8f1ed;
  color: var(--accent);
  font-family: "Iosevka", "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
}

.subsection-title {
  min-width: 0;
  color: #214d44;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.subsection-title strong {
  background: none;
  color: inherit;
}

.subsection-body {
  padding: 4px 18px 18px;
  border-top: 1px solid #e4eae5;
}

.subsection-body > :first-child {
  margin-top: 14px;
}

.reader-article h4 {
  margin: 28px 0 10px;
  color: var(--accent-3);
  font-size: 19px;
  line-height: 1.42;
}

.reader-article p {
  margin: 14px 0;
}

.reader-article strong {
  color: #243d38;
  background: linear-gradient(transparent 58%, var(--mark) 58%);
  font-weight: 800;
}

.reader-article em {
  color: var(--accent-2);
  font-style: normal;
}

.reader-article ul,
.reader-article ol {
  margin: 16px 0;
  padding-left: 1.45em;
}

.reader-article li {
  margin: 8px 0;
  padding-left: 2px;
}

.reader-article li::marker {
  color: var(--accent);
  font-weight: 700;
}

.reader-article blockquote {
  margin: 18px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--accent-2);
  background: #fff7eb;
  color: #4a3932;
}

.reader-article code {
  border: 1px solid #dce3df;
  border-radius: 6px;
  background: #f3f6f4;
  padding: 0.12em 0.36em;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.reader-article pre {
  overflow: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: #17211f;
  color: #edf4f0;
}

.reader-article pre code {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
}

.reader-article img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px auto;
  border-radius: var(--radius);
  border: 1px solid rgba(216, 223, 217, 0.96);
  box-shadow: 0 12px 30px rgba(39, 50, 47, 0.12);
  cursor: zoom-in;
}

.reader-article p:has(img) {
  margin: 22px 0;
}

.reader-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  overflow: hidden;
  border-radius: var(--radius);
  font-size: 0.95em;
}

.reader-article th,
.reader-article td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  vertical-align: top;
}

.reader-article th {
  background: #edf3f0;
  color: #214d44;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(18, 24, 23, 0.82);
}

.image-viewer.is-open {
  display: grid;
}

.image-viewer img {
  max-width: min(1180px, 100%);
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
}

.viewer-close {
  position: fixed;
  top: 14px;
  right: 14px;
}

body.image-open {
  overflow: hidden;
}

.tool-home {
  width: min(760px, 100%);
  margin: 0 auto;
}

.tool-module-list {
  margin-top: 14px;
}

.tool-detail {
  width: min(760px, 100%);
  margin: 0 auto;
}

.tool-detail .detail-hero {
  padding-top: 0;
}

.liuren-calendar-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 16px;
  padding: 5px;
  border: 1px solid #f1df9f;
  border-radius: var(--radius);
  background: #fff8df;
}

.liuren-calendar-tabs a {
  display: grid;
  min-height: 40px;
  place-items: center;
  border-radius: 6px;
  color: #806232;
  text-decoration: none;
  font-weight: 900;
}

.liuren-calendar-tabs a.active {
  color: #7a3e18;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(217, 133, 8, 0.12);
}

.liuren-conversion span {
  color: #5f4125;
  font-weight: 900;
}

.caiku-tool {
  display: grid;
  gap: 20px;
  margin-top: 22px;
}

.caiku-input-panel {
  background: #ffffff;
}

.caiku-date-card {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #eadbf4;
  border-radius: 8px;
  background: #faf4ff;
}

.caiku-date-card div {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #4d5861;
  font-size: 16px;
}

.caiku-date-card b {
  min-width: 48px;
  color: #9a4bc1;
}

.caiku-form label {
  color: #8b3db0;
}

.caiku-form select {
  border-color: #eadbf4;
  color: #71418a;
  background: #fffaff;
}

.caiku-now-button,
.caiku-submit {
  min-height: 54px;
}

.caiku-submit {
  background: #9a4bc1;
  box-shadow: 0 12px 24px rgba(154, 75, 193, 0.24);
}

.caiku-bazi-card,
.caiku-analysis-card,
.caiku-reading-card,
.caiku-summary-card {
  border: 1px solid rgba(233, 229, 218, 0.9);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(38, 56, 70, 0.08);
}

.caiku-bazi-card,
.caiku-reading-card,
.caiku-summary-card {
  padding: 20px;
}

.caiku-bazi-card h2,
.caiku-reading-card h2,
.caiku-summary-card h2 {
  margin: 0 0 14px;
  color: #17212b;
  font-size: 22px;
}

.caiku-pillars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #fbf5ff;
}

.caiku-pillar {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 10px 4px;
  border-radius: 8px;
}

.caiku-pillar span {
  color: #8a6f97;
  font-size: 14px;
  font-weight: 800;
}

.caiku-pillar strong {
  color: #17212b;
  font-size: clamp(22px, 6vw, 30px);
  line-height: 1.1;
}

.caiku-pillar.active strong {
  color: #9a4bc1;
}

.caiku-bazi-card p {
  margin: 14px 0 0;
  color: #8b959c;
  text-align: center;
}

.caiku-analysis-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 18px;
  background: #fffaff;
}

.caiku-vault-mark {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: #ffc566;
  box-shadow: 0 12px 24px rgba(255, 197, 102, 0.34);
}

.caiku-vault-mark span,
.caiku-vault-mark strong {
  line-height: 1;
}

.caiku-vault-mark span {
  font-size: 22px;
  font-weight: 900;
}

.caiku-vault-mark strong {
  font-size: 18px;
}

.caiku-analysis-lines {
  display: grid;
  gap: 8px;
}

.caiku-analysis-lines div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  color: #263846;
  font-size: 18px;
}

.caiku-analysis-lines b {
  color: #6a596f;
  font-weight: 800;
}

.caiku-analysis-lines .positive {
  color: #188f75;
  font-weight: 900;
}

.caiku-analysis-lines .negative {
  color: #d92d20;
  font-weight: 900;
}

.caiku-reading-card p {
  margin: 0;
  color: #4c5964;
  font-size: 17px;
  line-height: 1.85;
}

.caiku-summary-card {
  display: grid;
  gap: 10px;
}

.caiku-summary-card div {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 12px;
  border-left: 3px solid #a64dcc;
  border-radius: 8px;
  background: #fbf5ff;
}

.caiku-summary-card span {
  color: #a64dcc;
  font-weight: 900;
}

.caiku-summary-card p {
  margin: 0;
  color: #4c5964;
}

.wuxing-tool {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.wuxing-today-card,
.wuxing-form-panel,
.wuxing-recommend-card,
.wuxing-principle-card {
  border: 1px solid rgba(216, 223, 217, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(39, 50, 47, 0.09);
}

.wuxing-today-card {
  padding: 22px;
  border-color: rgba(255, 142, 142, 0.5);
  background: linear-gradient(135deg, #fff7f7, #ffffff);
}

.wuxing-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(216, 223, 217, 0.72);
}

.wuxing-card-heading h2,
.wuxing-form-panel h2,
.wuxing-principle-card h2 {
  margin: 0;
  color: #1f2927;
  font-size: 22px;
  line-height: 1.25;
}

.wuxing-card-heading time {
  color: #c24c49;
  font-weight: 900;
  white-space: nowrap;
}

.wuxing-today-body {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding-top: 18px;
}

.wuxing-branch-orb {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border-radius: 999px;
  font-size: 40px;
  font-weight: 1000;
  line-height: 1;
  box-shadow: 0 12px 26px rgba(39, 50, 47, 0.13);
}

.wuxing-today-lines {
  display: grid;
  gap: 8px;
}

.wuxing-today-lines p {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 0;
  color: #4c5964;
  font-size: 17px;
}

.wuxing-today-lines span {
  color: #7a8580;
  font-weight: 800;
}

.wuxing-today-lines strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.wuxing-element-text {
  font-size: 24px;
}

.wuxing-color-pill {
  display: inline-grid;
  width: max-content;
  min-height: 30px;
  place-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 16px;
}

.wuxing-form-panel {
  padding: 22px;
  background: linear-gradient(135deg, #fbfdff, #ffffff);
}

.wuxing-date-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
}

.wuxing-date-form label {
  display: grid;
  gap: 8px;
  color: #263846;
  font-weight: 900;
}

.wuxing-date-form input[type="date"] {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid #b9dff1;
  border-radius: 8px;
  color: #1870a7;
  background: #edf8ff;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
}

.wuxing-submit {
  min-width: 168px;
  min-height: 54px;
  background: #08a9c6;
  box-shadow: 0 12px 24px rgba(8, 169, 198, 0.22);
}

.wuxing-reset {
  min-height: 54px;
  padding-inline: 24px;
}

.wuxing-recommend-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border-color: rgba(247, 212, 80, 0.85);
  background: linear-gradient(180deg, #fffdf1 0%, #ffffff 72%);
}

.wuxing-selected-date {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.wuxing-selected-date strong {
  color: #1f2927;
  font-size: 20px;
}

.wuxing-selected-date span {
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  color: #59656e;
  background: #eef2f4;
  font-weight: 800;
}

.wuxing-selected-date .wuxing-ganzhi-pill {
  color: #7a4b12;
  background: #fff2cf;
}

.wuxing-selected-date b {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  color: #5c6470;
  background: #e4e7eb;
  font-size: 22px;
}

.wuxing-best-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff8a8, #fff2d0);
  box-shadow: inset 0 0 0 1px rgba(235, 184, 30, 0.28);
}

.wuxing-swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: 0 12px 24px rgba(39, 50, 47, 0.2);
}

.wuxing-luck-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 3px solid #e45d3d;
  border-radius: 3px;
  color: #d83822;
  background: rgba(255, 248, 211, 0.78);
  box-shadow: 0 8px 16px rgba(39, 50, 47, 0.16);
  font-size: 24px;
  font-weight: 1000;
  line-height: 1;
}

.wuxing-best-card small {
  color: #a05f00;
  font-weight: 1000;
}

.wuxing-best-card strong {
  display: block;
  margin-top: 4px;
  color: #1f2927;
  font-size: clamp(34px, 8vw, 46px);
  line-height: 1.1;
}

.wuxing-best-card p,
.wuxing-relation-card p {
  margin: 8px 0 0;
  color: #8a5a20;
  line-height: 1.65;
}

.wuxing-relation-card {
  padding: 18px;
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
  box-shadow: 0 10px 24px rgba(39, 50, 47, 0.06);
}

.wuxing-relation-card span {
  color: #8b959c;
  font-weight: 900;
}

.wuxing-relation-card strong {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  color: #1f2927;
  font-size: 24px;
}

.wuxing-best-badge {
  display: inline-grid;
  min-height: 28px;
  place-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  color: #ffffff;
  background: #20b86a;
  box-shadow: 0 8px 16px rgba(32, 184, 106, 0.18);
  font-size: 16px;
  font-style: normal;
  font-weight: 1000;
  line-height: 1;
}

.wuxing-color-recs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.wuxing-color-card {
  display: grid;
  min-height: 130px;
  gap: 5px;
  align-content: center;
  justify-items: center;
  padding: 12px 6px;
  border: 1px solid #e2e8e2;
  border-radius: 8px;
  background: #f8faf8;
  text-align: center;
}

.wuxing-color-card.is-best {
  border-color: #b7eccb;
  background: #ecfff3;
}

.wuxing-color-card.is-balanced {
  background: #ffffff;
}

.wuxing-color-card.is-drain {
  border-color: #f0dfaa;
  background: #fffaf0;
}

.wuxing-color-card.is-avoid {
  border-color: #ffc3c3;
  background: #fff1f1;
}

.wuxing-mini-swatch {
  display: block;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(39, 50, 47, 0.16);
  border-radius: 999px;
  background: var(--swatch);
}

.wuxing-color-card strong {
  color: #1f2927;
  font-size: 18px;
  line-height: 1.2;
}

.wuxing-color-card small {
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  color: #66747c;
  background: #eef2f4;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

.wuxing-color-card.is-best small {
  color: #ffffff;
  background: #20b86a;
}

.wuxing-color-card.is-drain small {
  color: #8b5a00;
  background: #ffe7a3;
}

.wuxing-color-card.is-avoid small {
  color: #d93636;
  background: #ffdede;
}

.wuxing-color-card em {
  color: #7c8783;
  font-size: 12px;
  font-style: normal;
  line-height: 1.25;
}

.wuxing-alert {
  padding: 14px 16px;
  border-radius: 8px;
  color: #8a5a00;
  background: #fff0a8;
  text-align: center;
  font-weight: 900;
}

.wuxing-principle-card {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.wuxing-rule-block {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(216, 223, 217, 0.72);
}

.wuxing-rule-block h3 {
  margin: 0;
  padding-left: 10px;
  border-left: 4px solid #08a9c6;
  color: #263846;
  font-size: 18px;
}

.wuxing-branch-tags,
.wuxing-relation-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wuxing-branch-tag,
.wuxing-relation-tags span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 900;
}

.wuxing-verse-list {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 8px;
  background: #fbfbf8;
}

.wuxing-verse-list p {
  margin: 0;
  color: #68736f;
  font-size: 17px;
  line-height: 1.65;
}

.wuxing-relation-tags.good span {
  color: #15945a;
  background: #e5faef;
}

.wuxing-relation-tags.bad span {
  color: #d93636;
  background: #ffe8e8;
}

.wuxing-source-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 16px 16px 16px 34px;
  border-radius: 8px;
  color: #5f6a66;
  background: #ffffff;
}

.wuxing-source-list li {
  line-height: 1.75;
}

.wuxing-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wuxing-color-water {
  color: #ffffff;
  background: #101214;
}

.wuxing-color-earth {
  color: #6f4700;
  background: #fff0a8;
}

.wuxing-color-metal {
  color: #58636d;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(88, 99, 109, 0.2);
}

.wuxing-color-wood {
  color: #077a47;
  background: #ddfaeb;
}

.wuxing-color-fire {
  color: #c52323;
  background: #ffe3e3;
}

.jixiu-tool {
  display: grid;
  gap: 16px;
  margin-top: 22px;
  scroll-margin-top: 18px;
  transition: opacity 160ms ease;
}

.jixiu-tool.is-loading {
  opacity: 0.62;
  pointer-events: none;
}

.jixiu-month-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(216, 223, 217, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(39, 50, 47, 0.06);
}

.jixiu-month-title {
  margin: 0;
  color: #263846;
  text-align: center;
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.2;
}

.jixiu-calendar {
  overflow: hidden;
  border: 1px solid rgba(141, 151, 183, 0.22);
  border-radius: 8px;
  background: #1f2741;
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.18);
}

.jixiu-weekdays,
.jixiu-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.jixiu-weekdays {
  background: #30364f;
}

.jixiu-weekdays span {
  display: grid;
  min-height: 42px;
  place-items: center;
  color: #f8fafc;
  font-weight: 900;
}

.jixiu-grid {
  gap: 0;
  padding: 8px 8px 12px;
}

.jixiu-day,
.jixiu-blank {
  min-height: 82px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 8px;
}

.jixiu-day {
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(203, 213, 225, 0.08);
}

.jixiu-day.is-good {
  background: rgba(255, 230, 0, 0.09);
  box-shadow: inset 0 0 0 1px rgba(255, 230, 0, 0.24);
}

.jixiu-day.is-steal {
  background: rgba(184, 50, 32, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255, 230, 0, 0.3);
}

.jixiu-day-number {
  color: #ffffff;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 900;
  line-height: 1;
}

.jixiu-lunar {
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.1;
}

.jixiu-badge {
  min-height: 20px;
  display: inline-grid;
  place-items: center;
  color: #ffe600;
  font-size: 20px;
  font-weight: 1000;
  line-height: 1;
}

.jixiu-day.is-good .jixiu-day-number,
.jixiu-day.is-good .jixiu-badge {
  color: #ffe600;
}

.jixiu-day.is-steal .jixiu-badge {
  letter-spacing: -1px;
}

.jixiu-year-panel {
  border: 1px solid rgba(233, 229, 218, 0.9);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(38, 56, 70, 0.08);
  overflow: hidden;
}

.jixiu-year-panel h2 {
  margin: 0;
  padding: 14px 16px;
  color: #263846;
  background: #fff8df;
  font-size: 20px;
}

.jixiu-year-list {
  display: grid;
}

.jixiu-year-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 14px;
  border-top: 1px solid #ece7db;
}

.jixiu-year-row strong {
  color: #7a3e18;
}

.jixiu-year-row span {
  color: #42505b;
  overflow-wrap: anywhere;
}

.jixiu-year-row em {
  color: #b83220;
  font-style: normal;
  font-weight: 900;
}

.site-backline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.stats-shell {
  width: min(1060px, calc(100% - 32px));
}

.stats-login-card,
.stats-panel,
.stats-kpis > div {
  border: 1px solid rgba(216, 223, 217, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(39, 50, 47, 0.08);
}

.stats-login-card {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px;
}

.stats-login-card h2,
.stats-panel h2 {
  margin: 0;
  color: #1f2927;
  font-size: 22px;
  line-height: 1.25;
}

.stats-login-card p {
  margin: 12px 0 0;
  color: #68736f;
  line-height: 1.75;
}

.stats-login-card code,
.stats-footnote {
  overflow-wrap: anywhere;
}

.stats-login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.stats-login-form label {
  display: grid;
  gap: 8px;
  color: #263846;
  font-weight: 900;
}

.stats-login-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid #d8dfd9;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2927;
  font: inherit;
}

.stats-notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 900;
}

.stats-notice.error {
  color: #b42318;
  background: #fff0ec;
}

.stats-notice.warning {
  color: #7a4b12;
  background: #fff2cf;
}

.stats-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stats-kpis > div {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.stats-kpis span {
  color: #68736f;
  font-weight: 900;
}

.stats-kpis strong {
  color: #1f2927;
  font-size: clamp(30px, 6vw, 44px);
  line-height: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.stats-panel {
  padding: 18px;
}

.stats-table,
.stats-recent-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.stats-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px 62px;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 8px;
  color: inherit;
  background: #f8faf7;
  text-decoration: none;
}

.stats-table.compact .stats-row {
  grid-template-columns: minmax(0, 1fr) 78px;
}

.stats-row strong {
  min-width: 0;
  overflow: hidden;
  color: #1f2927;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-row span,
.stats-row small {
  color: #68736f;
  text-align: right;
  font-weight: 900;
}

.stats-recent {
  margin-top: 16px;
}

.stats-recent-row {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 120px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8faf7;
}

.stats-recent-row time,
.stats-recent-row span {
  color: #68736f;
  font-size: 13px;
  font-weight: 800;
}

.stats-recent-row strong {
  overflow: hidden;
  color: #1f2927;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-footnote {
  margin: 14px 0 0;
  color: #68736f;
  font-size: 13px;
}

@media (max-width: 920px) {
  .site-topbar-inner {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .site-topbar {
    position: static;
    padding-top: 16px;
  }

  .site-topbar-inner,
  .km-shell {
    width: min(100% - 24px, 1180px);
  }

  .catalog {
    grid-template-columns: 1fr;
  }

  .card-tile {
    min-height: 136px;
    padding: 16px;
  }

  .card-title {
    font-size: 19px;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .caiku-analysis-card {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .caiku-analysis-lines {
    width: 100%;
  }

  .caiku-analysis-lines div {
    grid-template-columns: 86px minmax(0, 1fr);
    font-size: 16px;
  }

  .wuxing-today-card,
  .wuxing-form-panel,
  .wuxing-recommend-card,
  .wuxing-principle-card {
    padding: 18px;
  }

  .wuxing-card-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .wuxing-today-body {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
  }

  .wuxing-branch-orb {
    width: 66px;
    height: 66px;
    font-size: 32px;
  }

  .wuxing-today-lines p {
    grid-template-columns: 62px minmax(0, 1fr);
    font-size: 15px;
  }

  .wuxing-date-form {
    grid-template-columns: 1fr;
  }

  .wuxing-submit,
  .wuxing-reset {
    width: 100%;
  }

  .wuxing-selected-date {
    align-items: flex-start;
    flex-direction: column;
  }

  .wuxing-best-card {
    grid-template-columns: 72px minmax(0, 1fr);
    padding: 18px;
  }

  .wuxing-swatch {
    width: 60px;
    height: 60px;
  }

  .wuxing-color-recs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wuxing-color-card {
    min-height: 122px;
  }

  .jixiu-month-nav {
    grid-template-columns: 1fr 1fr;
  }

  .jixiu-month-title {
    grid-column: 1 / -1;
    order: -1;
  }

  .jixiu-grid {
    padding: 6px;
  }

  .jixiu-day,
  .jixiu-blank {
    min-height: 68px;
    padding-inline: 2px;
  }

  .jixiu-lunar {
    font-size: 12px;
  }

  .jixiu-badge {
    font-size: 17px;
  }

  .jixiu-year-row {
    grid-template-columns: 54px minmax(0, 1fr);
    padding-inline: 12px;
  }

  .reader-shell {
    width: 100%;
    margin: 0;
    border-radius: 0;
    border: 0;
  }

  .reader-toolbar {
    grid-template-columns: auto 1fr auto auto;
    padding: max(10px, env(safe-area-inset-top)) 10px 10px;
  }

  .reader-toolbar .text-button {
    padding-inline: 9px;
    font-size: 14px;
  }

  .reader-article {
    width: min(100% - 28px, 760px);
    padding: 24px 0 26px;
    font-size: 17px;
    line-height: 1.86;
  }

  .reader-title {
    padding: 0 3px;
    font-size: 13px;
  }

  .reader-footer {
    width: min(100% - 28px, 760px);
    grid-template-columns: 1fr 1fr;
    padding-bottom: 26px;
  }

  .stats-shell {
    width: min(100% - 24px, 1180px);
  }

  .stats-kpis,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: minmax(0, 1fr) 64px 54px;
    padding-inline: 10px;
  }

  .stats-recent-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .stats-recent-row span {
    text-align: left;
  }

  .reader-footer .back-footer {
    grid-column: 1 / -1;
    order: -1;
  }

  .reader-article h2 {
    font-size: 28px;
  }

  .reader-article h3 {
    margin-top: 26px;
    font-size: 20px;
  }

  .section-toc {
    padding: 14px;
  }

  .section-toc-links {
    display: grid;
    grid-template-columns: 1fr;
  }

  .section-toc-links a {
    border-radius: var(--radius);
  }

  .subsection-card summary {
    padding: 13px 14px;
  }

  .subsection-title {
    font-size: 17px;
  }

  .subsection-body {
    padding: 2px 14px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
