/* 璇玑阁 (XuanJiGe) v2.1 — Official Tabler 1.7.5 Token & Domain CSS (<= 200 lines) */
:root {
  --tblr-body-bg: #f6f2e9;
  --tblr-bg-surface: #fbf8f1;
  --tblr-bg-surface-secondary: #efe9dc;
  --tblr-bg-surface-tertiary: #e6dfd0;
  --tblr-body-color: #241f1c;
  --tblr-secondary-color: #5e554d;
  --tblr-muted: #766c63;
  --tblr-border-color: #ddd4c3;
  --tblr-border-color-translucent: rgba(36, 31, 28, 0.12);
  --tblr-primary: #a62c2b;
  --tblr-primary-rgb: 166, 44, 43;
  --tblr-primary-fg: #fbf8f1;
  --tblr-link-color: #a62c2b;
  --tblr-link-hover-color: #872120;
  --xj-serif-font: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --xj-yao-ink: #241f1c;
  --xj-yao-move: #a62c2b;
  --xj-seal-color: #a62c2b;
  --xj-wx-wood: #287544;
  --xj-wx-fire: #b83227;
  --xj-wx-earth: #94631e;
  --xj-wx-metal: #665f52;
  --xj-wx-water: #1d5ca3;
}
:root[data-bs-theme="dark"], [data-bs-theme="dark"] {
  --tblr-body-bg: #0e0d14;
  --tblr-bg-surface: #171622;
  --tblr-bg-surface-secondary: #1e1c2b;
  --tblr-bg-surface-tertiary: #262336;
  --tblr-body-color: #ede6d6;
  --tblr-secondary-color: #b8af9e;
  --tblr-muted: #928a7b;
  --tblr-border-color: #2e2b3f;
  --tblr-border-color-translucent: rgba(237, 230, 214, 0.14);
  --tblr-primary: #d4af6a;
  --tblr-primary-rgb: 212, 175, 106;
  --tblr-primary-fg: #141218;
  --tblr-link-color: #d4af6a;
  --tblr-link-hover-color: #e4c588;
  --xj-yao-ink: #ede6d6;
  --xj-yao-move: #e06d53;
  --xj-seal-color: #f24c3d;
  --xj-wx-wood: #68cb88;
  --xj-wx-fire: #f27566;
  --xj-wx-earth: #e2b562;
  --xj-wx-metal: #dad1bd;
  --xj-wx-water: #70b5f6;
}
.xj-serif { font-family: var(--xj-serif-font); letter-spacing: 0.03em; }
.xj-brand-seal {
  display: inline-block; width: 24px; height: 24px; aspect-ratio: 1 / 1; flex-shrink: 0;
  background-color: var(--xj-seal-color);
  -webkit-mask: url("/static/brand/svgs/seal_xuanjige_jiudie.svg") center / contain no-repeat;
  mask: url("/static/brand/svgs/seal_xuanjige_jiudie.svg") center / contain no-repeat;
}
.xj-icon-img { width: 18px; height: 18px; vertical-align: -3px; flex-shrink: 0; }
:root[data-bs-theme="dark"] .xj-icon-img { filter: invert(0.92); }
.xj-empty-img { max-height: 180px; width: auto; }
.xj-uncast-illus { width: 100%; max-height: 220px; object-fit: contain; display: block; margin: 0 auto; border-radius: 6px; }
.xj-triptych-illus { width: 100%; max-width: 540px; max-height: 240px; object-fit: contain; display: block; margin: 0 auto; border-radius: 8px; }
.xj-reading-prose { font-size: 0.98rem; line-height: 1.82; }
.xj-reading-prose p { margin-bottom: 0.85rem; }
/* Always 100% Equal-Height Workbench (>=992px) + Native Tabler chat.html Scroll Window */
.page { min-height: 100vh; }
.xj-workbench-flow { padding-bottom: 1.25rem; }
.xj-wb-anchor { position: relative; }
.xj-wb-pane { display: flex; flex-direction: column; overflow: hidden; }
@media (max-width: 991.98px) {
  #wbRightCard:not(.has-active-cast) { overflow: visible; }
  #wbRightCard:not(.has-active-cast) .xj-chat-scroll { flex: 1 1 auto; overflow: visible; }
  #wbRightCard.has-active-cast { height: calc(100vh - 3.75rem); height: calc(100dvh - 3.75rem); }
  #wbRightCard.has-active-cast .xj-chat-scroll { flex: 1 1 0; min-height: 0; }
}
@media (min-width: 992px) {
  .xj-wb-anchor { min-height: 560px; }
  .xj-wb-pane { position: absolute; inset: 0; }
  .xj-chat-scroll { flex: 1 1 0; min-height: 0; }
}
.xj-paywall-blur { filter: blur(4.5px); user-select: none; pointer-events: none; }
.xj-paywall-fade { position: relative; overflow: hidden; }
.xj-pw-meter { height: 6px; border-radius: 999px; overflow: hidden; }
.xj-scroll-bottom-bar { position: relative; height: 0; overflow: visible; z-index: 4; }
.xj-scroll-bottom-btn { position: absolute; right: 1rem; bottom: 0.5rem; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); }
.xj-composer-action {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; padding: 0.2rem 0.35rem; cursor: pointer;
}
.xj-composer-action:hover { opacity: 0.82; }
#chatQuestionInput { font-size: 1rem; }
@media (pointer: coarse) {
  .form-control, .form-select { font-size: 1rem; }
}
.xj-clickable { cursor: pointer; touch-action: manipulation; }
.xj-quote-active { border-color: var(--tblr-primary); box-shadow: 0 0 0 1px var(--tblr-primary); }
/* Searchable 502-City Combobox & BaZi Five-Element / DaYun Helpers */
.xj-city-picker { position: relative; min-width: 160px; }
.xj-city-menu { position: absolute; top: 100%; left: 0; right: 0; z-index: 1060; max-height: 260px; overflow-y: auto; }
.xj-wx-wood { color: var(--xj-wx-wood); }
.xj-wx-fire { color: var(--xj-wx-fire); }
.xj-wx-earth { color: var(--xj-wx-earth); }
.xj-wx-metal { color: var(--xj-wx-metal); }
.xj-wx-water { color: var(--xj-wx-water); }
.xj-bazi-gz { font-size: 1.45rem; line-height: 1.25; font-weight: 700; letter-spacing: 0.08em; }
.xj-dayun-strip { display: flex; gap: 0.45rem; overflow-x: auto; padding-bottom: 0.35rem; -webkit-overflow-scrolling: touch; }
.xj-dayun-pill { min-width: 78px; flex: 0 0 auto; }
/* Pure CSS 6-line Yijing Hexagram Bars (Zero U+4DC0..U+4DFF glyphs) */
.xj-hexagram { display: flex; flex-direction: column; gap: 5px; width: 78px; }
.xj-hexagram-lg { width: 112px; gap: 7px; }
.xj-yao-row { display: flex; align-items: center; gap: 6px; height: 8px; }
.xj-yao-bar { display: flex; flex: 1 1 auto; height: 6px; gap: 16%; }
.xj-yao-seg { flex: 1 1 0; height: 100%; border-radius: 2px; background-color: var(--xj-yao-ink); }
.xj-yao-row.is-moving .xj-yao-seg { background-color: var(--xj-yao-move); }
.xj-yao-mark { width: 12px; font-size: 0.72rem; font-weight: 700; line-height: 1; text-align: center; color: var(--xj-yao-move); }
.xj-yao-inline { width: 56px; display: inline-flex; align-items: center; gap: 4px; }
/* Daozang Vertical Talisman Stage (460 x 1340) + Single-SVG Zero-Offset Five-Section Inspector */
.xj-talisman-frame, .xj-talisman-stage {
  position: relative; box-sizing: content-box; width: auto; max-width: 100%; aspect-ratio: 460 / 1340;
  margin: 0 auto; border: 1px solid var(--tblr-border-color); background-color: #ecc86e; overflow: hidden;
}
.xj-talisman-frame { height: min(56vh, 520px); border-radius: 8px; }
.xj-talisman-stage { height: calc(100vh - 185px); border-radius: 10px; transition: width 0.18s ease; }
.xj-talisman-stage.is-zoom-100 { height: auto; width: 460px; max-width: 100%; }
.xj-talisman-stage.is-zoom-200 { height: auto; width: 920px; max-width: none; }
.xj-talisman-thumb, .xj-talisman-box-thumb, .xj-zodiac-coin-thumb, .xj-talisman-pick-thumb {
  aspect-ratio: 460 / 1340; background-color: #ecc86e; border: 1px solid var(--tblr-border-color); overflow: hidden;
}
.xj-talisman-thumb { width: 100%; max-width: 96px; margin: 0 auto; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.xj-talisman-box-thumb { width: 100%; max-width: 72px; margin: 0 auto; border-radius: 6px; }
.xj-zodiac-coin-thumb { width: 44px; flex-shrink: 0; border-radius: 6px; }
.xj-talisman-pick-thumb { width: 34px; flex-shrink: 0; border-radius: 5px; }
.xj-talisman-frame.is-night-paper, .xj-talisman-stage.is-night-paper, .xj-talisman-thumb.is-night-paper,
.xj-talisman-box-thumb.is-night-paper, .xj-zodiac-coin-thumb.is-night-paper, .xj-talisman-pick-thumb.is-night-paper {
  background-color: #111a2d; border-color: #c89b4f;
}
.xj-talisman-pick-card { cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.xj-talisman-pick-card.is-selected { border-color: var(--tblr-primary); box-shadow: 0 0 0 1px var(--tblr-primary); }
.xj-talisman-img, .xj-talisman-svg-canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.xj-hotspot-rect { fill: transparent; stroke: transparent; stroke-width: 5; cursor: pointer; }
.xj-hotspot-rect.is-active, .xj-hotspot-rect:hover, .xj-hotspot-rect:focus-visible {
  fill: rgba(200, 155, 79, 0.16); stroke: #c89b4f; outline: none;
}
.xj-captcha-svg-box svg { width: 100%; height: auto; display: block; border-radius: 6px; }
.xj-admin-shelf { max-height: 360px; overflow-y: auto; }
/* Superuser Ziwei 4x4 Zhongzhou 12-Palace Grid & Qimen 3x3 LoShu 9-Palace Grid */
.xj-zw-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem; }
.xj-zw-center { grid-column: 2 / 4; grid-row: 2 / 4; }
.xj-zw-cell { min-height: 92px; padding: 0.35rem; font-size: 0.76rem; line-height: 1.3; }
.xj-zw-cell.is-sanfang { border-color: var(--tblr-primary); background-color: var(--tblr-bg-surface-secondary); }
.xj-qm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
.xj-qm-cell { min-height: 96px; padding: 0.4rem; font-size: 0.78rem; line-height: 1.35; }
.xj-qm-cell.is-zhifu { border-color: var(--tblr-primary); box-shadow: inset 0 0 0 1px var(--tblr-primary); }
.xj-qm-cell.is-zhishi { border-color: var(--xj-wx-earth); }
/* V2.2 Vermilion-Sealed Talisman Preview (`朱印封缄`) & Chifeng Certificate Stage */
.xj-sealed-thumb {
  position: relative; width: 34px; flex-shrink: 0; aspect-ratio: 460 / 1340; border-radius: 5px;
  background: linear-gradient(180deg, #f5dc93 0%, #e2bc66 100%);
  border: 1px solid #b43c32; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.xj-seal-strip {
  writing-mode: vertical-rl; font-family: "Songti SC", "STSong", serif; font-size: 10px;
  font-weight: 700; letter-spacing: 2px; color: #fff8ec; background-color: #a61c17;
  padding: 4px 2px; border-radius: 2px; box-shadow: 0 1px 4px rgba(166, 28, 23, 0.35);
}
.xj-cert-stage {
  max-height: 70vh; overflow-y: auto; border-radius: 8px;
  border: 1px solid var(--tblr-border-color); background: #f5e9cc; text-align: center;
}
.xj-cert-stage img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
/* V2.3 Mobile Dropdown Anti-Overflow & Compact Single-Row Scrollable Followup Strip */
.xj-user-menu { max-width: min(260px, calc(100vw - 24px)); }
.xj-user-menu .dropdown-item { white-space: normal; word-break: break-word; line-height: 1.35; }
.xj-chip-strip {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 0.35rem;
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.xj-chip-strip::-webkit-scrollbar { display: none; }
/* V2.3.1 Inline Tab-1 Frosted Teaser Mask */
.xj-teaser-blur-wrap { position: relative; overflow: hidden; }
.xj-teaser-blur-wrap::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.2rem;
  background: linear-gradient(180deg, transparent 0%, var(--tblr-bg-surface) 92%); pointer-events: none;
}
/* V2.4 Song-Woodblock Avatars, Dual-Box Cross-Jump & Compact 3-Number Row Anti-Truncation */
.xj-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.xj-avatar-tile { cursor: pointer; border: 1px solid var(--tblr-border-color); border-radius: 8px; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.xj-avatar-tile.is-active { border-color: var(--tblr-primary); box-shadow: 0 0 0 2px rgba(var(--tblr-primary-rgb), 0.25); background-color: var(--tblr-bg-surface-secondary); }
.xj-box-highlight { border-color: var(--tblr-primary); box-shadow: 0 0 0 2px rgba(var(--tblr-primary-rgb), 0.35); }
#mhNumbersWrap .number-input .btn-icon { min-width: 1.65rem; padding-left: 0.25rem; padding-right: 0.25rem; }
#mhNumbersWrap .number-input .form-control { min-width: 0; padding-left: 0.2rem; padding-right: 0.2rem; text-align: center; }
/* V2.8.1 Song-Woodblock BaZi 10-Step 100-Year Fortune Scroll SVG */
.xj-fortune-scroll-wrap { width: 100%; overflow: hidden; border-radius: 6px; border: 1px solid var(--tblr-border-color); }
.xj-fortune-scroll-svg { width: 100%; height: auto; display: block; }
.xj-fortune-node { cursor: pointer; touch-action: manipulation; }
.xj-fortune-node:focus-visible .xj-fortune-ring { stroke: var(--tblr-primary); stroke-width: 2.5; }
