/* Kunlun Myst — client DOM theme overlay (keep Display HTML as-is) */
:root {
  --km-bg: #0b1220;
  --km-panel: #121a2a;
  --km-ink: #f0e6d4;
  --km-mute: rgba(200,194,184,.78);
  --km-gold: #d4af37;
  --km-gold-soft: #f0d78c;
  --km-line: rgba(212,175,55,.28);
  --km-paper: #f7f3ec;
  --km-paper-ink: #1c1a17;
}
html, body { max-width: 100%; overflow-x: hidden; }
body.km-client-theme {
  background: linear-gradient(180deg, #10182a 0%, #0b1220 55%, #080e18 100%) !important;
  color: var(--km-ink);
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.km-shell-header {
  background: rgba(8,12,20,.92); border-bottom: 1px solid var(--km-line);
  padding: .55rem 0; margin-bottom: 1rem;
}
.km-shell-header a { color: var(--km-gold-soft); text-decoration: none; letter-spacing: .12em; font-weight: 700; }
.km-shell-header .nav a { color: rgba(240,230,210,.7); margin-left: .9rem; font-size: .85rem; font-weight: 500; letter-spacing: 0; }
.km-shell-header .nav a:hover { color: var(--km-gold-soft); }
.km-shell-foot {
  text-align: center; color: #d9d2c8; font-size: .8rem; padding: 1.4rem;
  border-top: 1px solid var(--km-line); margin-top: 2rem;
}
.km-shell-foot a { color: #e0c878; }
.km-note {
  max-width: 720px; margin: 0 auto 1rem; padding: .65rem .9rem;
  border: 1px dashed var(--km-line); border-radius: 10px;
  color: var(--km-mute); font-size: .82rem; line-height: 1.5;
}
.km-note code { color: var(--km-gold-soft); }

/* 防越界（挂在客户结果容器上） */
.bz-info, .bazi-table, .card, .calendar-table, .custom-box, .container, .table-responsive {
  max-width: 100%;
}
.bz-info th, .bz-info td, .bazi-table th, .bazi-table td,
.bazi-cell, .bazi-field, .bazi-normal, .bazi-ganzhi, .bazi-canggan, .bazi-shensha,
.badge-yi, .badge-ji, .date-lunar, .date-festival, .poem-text {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
}
.bazi-table { table-layout: fixed; width: 100%; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 客户表单卡 → 黑金面板 */
body.km-client-theme .card.shadow-sm {
  background: rgba(255,255,255,.045) !important;
  border: 1px solid var(--km-line) !important;
  color: var(--km-ink);
  box-shadow: 0 12px 36px rgba(0,0,0,.35) !important;
}
body.km-client-theme .card h5,
body.km-client-theme .card .fw-bold {
  color: var(--km-gold-soft) !important;
  border-color: rgba(212,175,55,.25) !important;
}
body.km-client-theme .bazi-field { color: rgba(240,215,140,.92) !important; }
body.km-client-theme .form-control,
body.km-client-theme .form-select {
  background: rgba(255,255,255,.06) !important;
  border-color: rgba(212,175,55,.25) !important;
  color: var(--km-ink) !important;
}
body.km-client-theme .form-control:focus,
body.km-client-theme .form-select:focus {
  border-color: rgba(240,215,140,.7) !important;
  box-shadow: 0 0 0 .2rem rgba(212,175,55,.15) !important;
  color: #fff !important;
}
body.km-client-theme .btn-outline-primary {
  color: var(--km-gold-soft) !important;
  border-color: rgba(212,175,55,.45) !important;
  background: transparent !important;
}
body.km-client-theme .btn-check:checked + .btn-outline-primary,
body.km-client-theme .btn-check:checked + .btn {
  background: linear-gradient(180deg,#f0d78c,#d4af37) !important;
  color: #1a1408 !important;
  border-color: transparent !important;
}
body.km-client-theme .btn-primary {
  background: linear-gradient(180deg,#f0d78c,#d4af37 55%,#b8922a) !important;
  border: none !important;
  color: #1a1408 !important;
  font-weight: 700;
}
body.km-client-theme hr { border-color: rgba(212,175,55,.18) !important; opacity: 1; }

/* 客户结果区：米纸阅读底 + 海外清晰层级（仍用客户 table/class） */
body.km-client-theme .km-result-wrap {
  background: var(--km-paper);
  color: var(--km-paper-ink);
  border-radius: 16px;
  border: 1px solid rgba(212,175,55,.35);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
  padding: clamp(1rem, 3vw, 1.5rem);
  margin: 0 auto 1.5rem;
  max-width: 920px;
  overflow: hidden;
}
body.km-client-theme .km-result-wrap h1,
body.km-client-theme .km-result-wrap h4,
body.km-client-theme .km-result-wrap .display-5 {
  color: #141210 !important;
  letter-spacing: .04em;
  overflow-wrap: anywhere;
}
body.km-client-theme .km-result-wrap .bz-info th {
  background: rgba(28,26,23,.05) !important;
  color: #3a3530;
  width: 30%;
}
body.km-client-theme .km-result-wrap .bz-info td { background: #fffdf9 !important; }
body.km-client-theme .km-result-wrap .bazi-field { color: #2c2824 !important; }
body.km-client-theme .km-result-wrap .bazi-normal { color: #333 !important; }
body.km-client-theme .km-result-wrap .table-dark {
  --bs-table-bg: #1c1a17;
  --bs-table-color: #f7f3ec;
}
body.km-client-theme .km-result-wrap .bazi-title { color: #f7f3ec !important; }
body.km-client-theme .km-result-wrap .table-bordered { border-color: rgba(28,26,23,.12) !important; }
body.km-client-theme .km-result-wrap .btn-primary {
  background: #141210 !important;
  color: #f7f3ec !important;
}

/* 五行色保持客户语义，略提对比 */
.c-jin  { color: #c9972e !important; }
.c-mu   { color: #2f9e44 !important; }
.c-shui { color: #1c7ed6 !important; }
.c-huo  { color: #e03131 !important; }
.c-tu   { color: #e8590c !important; }

/* 梅花爻 / 起名分 / 八宅竖线 / 灵签 — 客户 blade 内联迁入后，仅微调 */
body.km-client-theme .yao-line .line-yang,
body.km-client-theme .yao-line .line-yin .yin-block { background: #2a221c; }
body.km-client-theme .yao-line.line-dong .line-yang,
body.km-client-theme .yao-line.line-dong .line-yin .yin-block { background: #c0392b !important; }
body.km-client-theme .score-bg {
  background: radial-gradient(circle at 30% 30%, #fff3, transparent 55%), #1c1a17;
  color: #f0d78c;
  text-shadow: none;
  border-radius: 50%;
  width: 50px; height: 50px;
  display: inline-flex; align-items: center; justify-content: center;
}
body.km-client-theme .mycontent {
  background: transparent !important;
  font-family: inherit !important;
}
body.km-client-theme .card-ancient {
  background: rgba(255,255,255,.05) !important;
  border: 1px solid var(--km-line) !important;
  color: var(--km-ink);
}
body.km-client-theme .title-font { color: var(--km-gold-soft) !important; }
body.km-client-theme .btn-step {
  background: linear-gradient(180deg,#f0d78c,#d4af37) !important;
  color: #1a1408 !important;
}
body.km-client-theme .state-tip { color: var(--km-mute); }
body.km-client-theme .poem-text { color: #2c2824; line-height: 1.85; letter-spacing: .04em; }

@media (max-width: 576px) {
  body.km-client-theme .card .col-2 { flex: 0 0 28%; max-width: 28%; }
  body.km-client-theme .card .col-10 { flex: 0 0 72%; max-width: 72%; }
  body.km-client-theme .btn-group { flex-wrap: wrap; }
}