@charset "utf-8";
/* ═══════════ 玄鉴 · 轻潮国风样式 ═══════════ */
:root {
  /* 墨色 → 现代靛紫体系 */
  --ink: #241f3d;
  --ink-soft: #4c4766;
  --ink-mute: #8b87a8;

  --brand: #6c5ce7;
  --brand-2: #9a6cf0;
  --brand-soft: #efeafe;
  --accent: #ff7a59;
  --accent-2: #ffa06b;
  --gold: #d4a548;
  --jade: #23b294;

  --paper: #ffffff;
  --paper-2: #faf9ff;
  --paper-3: #f4f2fb;

  --line: rgba(108, 92, 231, .14);
  --line-2: rgba(108, 92, 231, .26);
  --line-gold: rgba(212, 165, 72, .3);

  --shadow-sm: 0 2px 8px rgba(64, 52, 120, .07);
  --shadow: 0 10px 30px rgba(64, 52, 120, .10);
  --shadow-lg: 0 18px 48px rgba(64, 52, 120, .18);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;

  /* 兼容旧变量名 */
  --zhu: var(--brand);
  --zhu-soft: var(--brand-2);
  --jin: var(--gold);
  --qing: var(--jade);
  --xuan: #241f3d;
  --xuan-2: #322c52;
  --xuan-3: #3d3663;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* hidden 属性必须优先于任何 display 声明 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei",
    "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(154, 108, 240, .16), transparent 62%),
    radial-gradient(760px 460px at 92% 6%, rgba(255, 122, 89, .13), transparent 60%),
    radial-gradient(680px 520px at 68% 108%, rgba(35, 178, 148, .10), transparent 62%),
    linear-gradient(168deg, #f8f7ff 0%, #f2f0fb 46%, #eaeefa 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 柔光颗粒 */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  opacity: .5; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}

/* ═══ 顶栏 ═══ */
.topbar {
  height: 66px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 18px rgba(64, 52, 120, .06);
  position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 13px; }
.seal {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  color: #fff;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 24px; line-height: 1; font-weight: 600;
  border-radius: 13px;
  box-shadow: 0 6px 16px rgba(108, 92, 231, .38);
  letter-spacing: 0;
}
.brand-txt h1 {
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 22px; color: var(--ink); letter-spacing: 5px; font-weight: 700;
  line-height: 1.2;
}
.brand-txt .sub {
  font-size: 11px; color: var(--ink-mute); letter-spacing: 2.5px;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-right .badge {
  font-size: 12px; color: var(--brand);
  border: 1px solid var(--line-2);
  padding: 6px 14px; border-radius: 999px;
  letter-spacing: 1.5px;
  background: var(--brand-soft);
  font-weight: 600;
}

/* ═══ 布局 ═══ */
.layout {
  height: calc(100vh - 66px);
  display: grid;
  grid-template-columns: 330px minmax(420px, 1fr) 400px;
  gap: 16px; padding: 16px;
  transition: grid-template-columns .26s cubic-bezier(.4, 0, .2, 1);
}
@media (max-width: 1300px) {
  .layout { grid-template-columns: 290px 1fr; grid-template-rows: 1fr auto; }
  .panel-chat { grid-column: 1 / -1; max-height: 340px; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto auto auto; height: auto; overflow: auto; }
  body { overflow: auto; }
  .panel { max-height: none; }
}

/* ═══ 子页路由：主页 / 命盘 / 详批 ═══ */
body.in-home .layout,
body.in-paipan .layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
body.in-home .panel-chart,
body.in-home .panel-chat,
body.in-home .panel-form { display: none; }
body.in-home .panel-home {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}
/* 排盘页：只留表单 */
body.in-paipan .panel-home,
body.in-paipan .panel-chart,
body.in-paipan .panel-chat { display: none; }
body.in-paipan .panel-form {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
/* 详批 / 命盘页不显示主页 */
body.in-chat .panel-home,
body.in-chart .panel-home { display: none; }
@media (max-width: 900px) {
  body.in-home .layout { grid-template-columns: 1fr; }
}

/* 详批子页：整屏只留对话 */
body.in-chat .layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
body.in-chat .panel-form { display: none; }
body.in-chat .panel-chat {
  max-width: 1000px;
  max-height: none;
  width: 100%;
  margin: 0 auto;
}

/* 命盘抽屉：在详批页下方弹出，命盘盖住对话大半屏 */
body.in-chat .panel-chart { display: none; }
body.in-chat.show-chart .panel-chart {
  display: flex;
  position: fixed;
  left: 16px; right: 16px; bottom: 0;
  z-index: 60;
  height: 78vh;
  max-height: none;
  margin: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-bottom: 0;
  box-shadow: var(--shadow-lg);
  animation: chartUp .28s cubic-bezier(.22, 1, .36, 1);
}
@keyframes chartUp {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
/* 抽屉上方的遮罩（真实元素，点击可收起） */
.chart-overlay { display: none; }
body.in-chat.show-chart .chart-overlay {
  display: block;
  position: fixed; inset: 0;
  background: rgba(36, 31, 61, .34);
  backdrop-filter: blur(3px);
  z-index: 55;
  animation: fadeIn .22s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 命盘子页（独立路由）：整屏只留命盘 */
body.in-chart .layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
body.in-chart .panel-form,
body.in-chart .panel-chat { display: none; }
body.in-chart .panel-chart {
  max-width: 1080px;
  max-height: none;
  width: 100%;
  margin: 0 auto;
}

/* ═══ 面板 ═══ */
.panel {
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px 13px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(108, 92, 231, .07), rgba(108, 92, 231, 0));
  flex: none;
}
.panel-head h2 {
  font-size: 15px; letter-spacing: 3px; color: var(--ink); font-weight: 700;
  white-space: nowrap;
}
.ornament {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-2), transparent);
}

/* ═══ 胶囊按钮（返回 / 切换子页） ═══ */
.pill-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px 7px 12px;
  font-family: inherit; font-size: 13px; letter-spacing: 2px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line-2); border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: color .18s, border-color .18s, background .18s, box-shadow .18s, transform .14s;
  white-space: nowrap;
}
.pill-btn svg { flex: none; opacity: .75; transition: opacity .18s; }
.pill-btn:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 6px 18px rgba(108, 92, 231, .22);
  transform: translateY(-1px);
}
.pill-btn:hover svg { opacity: 1; }
.pill-btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

/* 渐变款：用于「详批 / 命盘」这类主切换 */
.pill-seal {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(108, 92, 231, .38);
  letter-spacing: 3px;
}
.pill-seal svg { opacity: .95; }
.pill-seal:hover {
  color: #fff;
  background: linear-gradient(135deg, #a87cf3, #7a68ee);
  border-color: transparent;
  box-shadow: 0 9px 22px rgba(108, 92, 231, .48);
}

.chart-tag {
  flex: none; max-width: 46%;
  font-size: 11.5px; color: var(--ink-mute); letter-spacing: .5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 5px 12px;
  background: rgba(212, 165, 72, .1);
  border: 1px solid var(--line-gold); border-radius: 999px;
}

/* ═══ 表单 ═══ */
.form-scroll { overflow-y: auto; padding: 20px 22px 24px; flex: 1; min-height: 0; }
.fgroup { margin-bottom: 18px; }
.flabel {
  display: block; font-size: 12px; color: var(--ink-mute);
  letter-spacing: 1.5px; margin-bottom: 8px; font-weight: 600;
}
.row3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 9px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 9px; }

input[type=text], input[type=number], select, textarea {
  width: 100%; padding: 10px 13px;
  font-family: inherit; font-size: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input::placeholder, textarea::placeholder { color: #b6b2cb; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(108, 92, 231, .12);
}
input:disabled { opacity: .45; cursor: not-allowed; }
select { cursor: pointer; }

.seg {
  display: flex; gap: 4px; padding: 4px;
  background: rgba(108, 92, 231, .07); border-radius: 999px;
}
.seg-btn {
  flex: 1; padding: 9px 6px; border: 0; cursor: pointer;
  font-family: inherit; font-size: 13px; letter-spacing: 1px; font-weight: 600;
  background: transparent; color: var(--ink-soft);
  border-radius: 999px;
  transition: all .2s;
}
.seg-btn:hover { background: rgba(255, 255, 255, .7); color: var(--brand); }
.seg-btn.active {
  background: #fff; color: var(--brand); font-weight: 700;
  box-shadow: 0 3px 10px rgba(108, 92, 231, .22);
}

.check {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; font-size: 13px; color: var(--ink-soft); cursor: pointer;
}
.check input { width: auto; accent-color: var(--brand); cursor: pointer; }
.check .hint { font-style: normal; font-size: 11px; color: var(--brand); }

.note {
  margin-top: 10px; font-size: 11.5px; line-height: 1.7; color: var(--ink-mute);
  padding: 9px 12px; border-radius: var(--r-sm);
  background: rgba(108, 92, 231, .05);
  border: 1px solid var(--line);
}

.btn-primary {
  width: 100%; padding: 14px; margin-top: 10px;
  font-family: inherit; font-size: 16px; letter-spacing: 8px; font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  border: 0; border-radius: 999px; cursor: pointer;
  box-shadow: 0 10px 24px rgba(108, 92, 231, .34);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .14s, box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(108, 92, 231, .44); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: wait; transform: none; }
.btn-spin {
  width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.err {
  margin-top: 12px; padding: 10px 13px; font-size: 12.5px; line-height: 1.6;
  color: #c2410c; background: rgba(255, 122, 89, .1);
  border: 1px solid rgba(255, 122, 89, .28); border-radius: var(--r-sm);
}

/* ═══ 中栏：命盘 ═══ */
.chart-scroll { overflow-y: auto; padding: 20px 22px 26px; flex: 1; min-height: 0; }
.empty {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px; color: var(--ink-mute);
}
.empty-seal {
  width: 84px; height: 84px; display: grid; place-items: center;
  border: 0; color: #fff;
  font-family: "Songti SC", "STSong", serif;
  font-size: 36px; border-radius: 26px;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  box-shadow: 0 14px 34px rgba(108, 92, 231, .32);
}
.empty p { letter-spacing: 3px; font-size: 14px; }

/* 基本信息条 */
.basic-bar {
  display: flex; flex-wrap: wrap; gap: 10px 24px;
  padding: 14px 18px; margin-bottom: 18px;
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.basic-bar .bi { font-size: 13px; color: var(--ink-soft); }
.basic-bar .bi b { color: var(--ink); font-weight: 700; }
.basic-bar .bi span { color: var(--ink-mute); margin-right: 5px; }
.tst-note {
  width: 100%; margin-top: 4px; padding: 10px 13px; font-size: 12px; line-height: 1.75;
  background: rgba(35, 178, 148, .08); border: 1px solid rgba(35, 178, 148, .22);
  color: #12695a; border-radius: var(--r-sm);
}
.tst-note.warn { background: rgba(255, 122, 89, .09); border-color: rgba(255, 122, 89, .28); color: #b7471f; }

/* 四柱 */
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.pillar {
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s;
}
.pillar:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pillar .p-head {
  background: linear-gradient(135deg, #3a3358, #2a2545); color: #d9cdf7;
  font-size: 12px; letter-spacing: 3px; padding: 8px 0; font-weight: 600;
}
.pillar .p-gan {
  font-size: 32px; line-height: 1.25; padding: 12px 0 2px; font-weight: 700;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
}
.pillar .p-zhi {
  font-size: 28px; line-height: 1.25; padding-bottom: 10px;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
}
.pillar .p-zhi small { font-size: 12px; color: var(--ink-mute); margin-left: 4px; }
.pillar .p-meta {
  border-top: 1px solid var(--line); padding: 10px 9px;
  font-size: 11px; line-height: 1.9; color: var(--ink-soft);
  text-align: left; background: rgba(108, 92, 231, .04);
}
.pillar .p-meta .m { display: flex; justify-content: space-between; gap: 6px; }
.pillar .p-meta .m span { color: var(--ink-mute); }
.pillar.day {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(108, 92, 231, .28), var(--shadow);
}

/* 五行色 */
.wx-jin { color: #b08d3f; } .wx-mu { color: #3f9d6b; } .wx-shui { color: #3d8bd4; }
.wx-huo { color: #e2603c; } .wx-tu { color: #9a6b4a; }

/* 通用区块 */
.block { margin-bottom: 20px; }
.block-title {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  font-size: 13.5px; letter-spacing: 2px; color: var(--ink); font-weight: 700;
}
.block-title::before {
  content: ''; width: 4px; height: 15px; border-radius: 3px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
}
.block-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line-2), transparent);
}

.card {
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 15px 17px; font-size: 13px; line-height: 1.95;
}
.card + .card { margin-top: 10px; }
.kv { display: flex; gap: 10px; flex-wrap: wrap; }
.kv .k { color: var(--ink-mute); }
.kv .v { color: var(--ink); font-weight: 600; }

/* 五行条 */
.wx-bars { display: flex; flex-direction: column; gap: 8px; }
.wx-row { display: grid; grid-template-columns: 34px 1fr 78px; align-items: center; gap: 10px; }
.wx-row .wx-name { font-size: 14px; font-weight: 700; }
.wx-track { height: 10px; background: rgba(108, 92, 231, .1); border-radius: 6px; overflow: hidden; }
.wx-fill { height: 100%; border-radius: 6px; transition: width .7s cubic-bezier(.2,.8,.3,1); }
.wx-row .wx-val { font-size: 11px; color: var(--ink-mute); text-align: right; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th {
  color: var(--ink-soft); font-weight: 700; letter-spacing: 1px;
  background: rgba(108, 92, 231, .07); font-size: 11.5px;
}
.tbl tr:hover td { background: rgba(108, 92, 231, .05); }
.tbl .now { color: var(--brand); font-weight: 700; }

.tag {
  display: inline-block; padding: 2px 9px; margin: 2px 4px 2px 0;
  font-size: 11px; border-radius: 999px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .85); color: var(--ink-soft);
}
.tag.ji { border-color: rgba(255, 122, 89, .45); color: #d1521f; background: rgba(255, 122, 89, .08); }
.tag.xi { border-color: rgba(35, 178, 148, .45); color: #12836c; background: rgba(35, 178, 148, .08); }

/* ═══ 详批 · 当下时间基准条 ═══ */
.now-bar {
  flex: none;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 18px;
  font-size: 11.5px; color: var(--ink-mute); letter-spacing: .5px;
  background: rgba(212, 165, 72, .09);
  border-bottom: 1px solid var(--line);
}
.now-seal {
  flex: none;
  width: 21px; height: 21px;
  display: grid; place-items: center;
  font-size: 11px; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-radius: 7px;
  box-shadow: 0 3px 8px rgba(255, 122, 89, .35);
}
.now-text { flex: 1; min-width: 0; }

/* ═══ 右栏：聊天 ═══ */
.panel-chat { background: rgba(255, 255, 255, .8); }
.chat-log {
  flex: 1; overflow-y: auto; padding: 18px 20px; min-height: 0;
  display: flex; flex-direction: column; gap: 16px;
}
.msg { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.chat-log > .msg,
.chat-input,
.quick { max-width: 860px; width: 100%; margin-left: auto; margin-right: auto; }
.msg-role {
  font-size: 11px; letter-spacing: 1.5px; color: var(--ink-mute); font-weight: 600;
  padding-left: 4px;
}
.msg-body {
  font-size: 13.5px; line-height: 1.95; color: var(--ink);
  padding: 13px 16px; border-radius: 18px 18px 18px 6px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  white-space: pre-wrap; word-break: break-word;
}
.msg-body.md { white-space: normal; }
.msg-ai .msg-role { color: var(--brand); }
.msg-user { align-items: flex-end; }
.msg-user .msg-body {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff; border-color: transparent;
  border-radius: 18px 18px 6px 18px;
  box-shadow: 0 8px 20px rgba(108, 92, 231, .28);
  max-width: 88%;
}
.msg-user .msg-role { color: var(--ink-mute); }
.msg-body .cursor {
  display: inline-block; width: 7px; height: 15px; background: var(--brand);
  vertical-align: -2px; animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* 首字到达前的等待提示 */
.msg-body .msg-waiting {
  display: inline-block; margin-right: 8px;
  font-size: 13px; color: var(--ink-mute); letter-spacing: 2px;
  animation: breathe 1.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}
.msg-body.streaming .cursor {
  animation: blink 1s steps(2) infinite;
  vertical-align: -2px;
}
.msg-body .err-line { color: #d1521f; }

/* ═══ 详批正文 · Markdown 排版 ═══ */
.msg-body.md > *:first-child { margin-top: 0; }
.msg-body.md > *:last-child { margin-bottom: 0; }

/* 标题：品牌色竖条 */
.msg-body.md .md-h {
  font-weight: 700; color: var(--ink); letter-spacing: .5px;
  margin: 20px 0 10px; padding-left: 11px;
  border-left: 3px solid var(--brand);
  line-height: 1.5;
}
.msg-body.md .md-h1 {
  font-size: 17px; letter-spacing: 2px;
  border-left-width: 4px; border-left-color: var(--accent);
  color: var(--brand);
}
.msg-body.md .md-h2 { font-size: 15.5px; }
.msg-body.md .md-h3 {
  font-size: 14px; color: var(--ink-soft);
  border-left-color: var(--brand-2);
}
.msg-body.md .md-h4,
.msg-body.md .md-h5,
.msg-body.md .md-h6 {
  font-size: 13.5px; color: var(--ink-soft);
  border-left-color: var(--line-2);
}

/* 段落 */
.msg-body.md .md-p { margin: 0 0 12px; text-align: justify; }

/* 列表 */
.msg-body.md .md-list { margin: 0 0 13px; padding-left: 22px; }
.msg-body.md ul.md-list { list-style: none; }
.msg-body.md ul.md-list > li {
  position: relative; margin-bottom: 7px; padding-left: 4px;
}
.msg-body.md ul.md-list > li::before {
  content: ''; position: absolute; left: -13px; top: .74em;
  width: 6px; height: 6px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
}
.msg-body.md ol.md-list > li { margin-bottom: 7px; padding-left: 2px; }
.msg-body.md ol.md-list > li::marker {
  color: var(--brand); font-weight: 700; font-size: 12.5px;
}

/* 强调 */
.msg-body.md strong { color: var(--brand); font-weight: 700; }
.msg-body.md em {
  color: var(--ink-soft); font-style: normal;
  border-bottom: 1px dotted var(--gold);
}

/* 引用 */
.msg-body.md .md-quote {
  margin: 0 0 13px; padding: 10px 14px;
  background: rgba(212, 165, 72, .09);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--ink-soft); font-size: 13px;
}

/* 分隔线 */
.msg-body.md .md-hr {
  border: 0; height: 1px; margin: 18px 0;
  background: linear-gradient(90deg, transparent, var(--line-2) 20%, var(--line-2) 80%, transparent);
}

/* 行内代码 / 代码块 */
.msg-body.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; padding: 2px 6px; border-radius: 6px;
  background: rgba(108, 92, 231, .1); color: var(--brand);
}
.msg-body.md .md-pre {
  margin: 0 0 13px; padding: 13px 15px;
  background: #2a2545; color: #e6e0f7;
  border-radius: var(--r-md);
  overflow-x: auto; font-size: 12px; line-height: 1.7;
}
.msg-body.md .md-pre code {
  background: transparent; color: inherit; padding: 0; font-size: inherit;
}

/* 表格 */
.msg-body.md .md-table {
  width: 100%; margin: 0 0 14px;
  border-collapse: collapse; font-size: 12.5px;
  border-radius: var(--r-sm); overflow: hidden;
}
.msg-body.md .md-table th,
.msg-body.md .md-table td {
  padding: 8px 11px; text-align: left;
  border: 1px solid var(--line);
}
.msg-body.md .md-table th {
  background: rgba(108, 92, 231, .09); color: var(--brand);
  font-weight: 700; letter-spacing: .5px;
}
.msg-body.md .md-table tr:nth-child(even) td {
  background: rgba(108, 92, 231, .035);
}

.chat-input {
  display: flex; gap: 10px; padding: 12px 16px 6px;
  border-top: 1px solid var(--line); flex: none; align-items: flex-end;
}
.chat-input textarea { resize: none; max-height: 130px; line-height: 1.65; border-radius: var(--r-md); }
.btn-send {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff; border: 0; border-radius: 50%;
  box-shadow: 0 6px 16px rgba(108, 92, 231, .34);
  transition: transform .14s, box-shadow .18s;
}
.btn-send:hover { transform: scale(1.06); box-shadow: 0 9px 22px rgba(108, 92, 231, .46); }
.btn-send:disabled { opacity: .5; cursor: wait; transform: none; }

.depth-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  max-width: 860px; width: 100%; margin: 0 auto; padding: 10px 16px 0; flex: none;
  border-top: 1px solid var(--line);
}
.depth-label { font-size: 12px; color: var(--ink-mute); letter-spacing: 1px; font-weight: 600; flex: none; }
.depth-seg { flex: 1 1 260px; min-width: 0; }
.depth-seg .seg-btn { padding: 7px 8px; font-size: 12.5px; letter-spacing: 0; min-width: 0; }
.depth-bar + .chat-input { border-top: 0; }
.quick {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 16px; flex: none;
}
.quick button {
  padding: 7px 14px; font-family: inherit; font-size: 12.5px; cursor: pointer;
  color: var(--ink-soft); background: rgba(255, 255, 255, .85);
  border: 1px solid var(--line-2); border-radius: 999px;
  transition: all .18s;
}
.quick button:hover {
  border-color: var(--brand); color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 4px 12px rgba(108, 92, 231, .16);
}
.quick button:disabled { opacity: .45; cursor: not-allowed; }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(108, 92, 231, .26); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(108, 92, 231, .45); }

@media (max-width: 900px) {
  .pillars { grid-template-columns: repeat(2, 1fr); }
}

/* ═══ 历史排盘记录 ═══ */
.history {
  margin-top: 18px; padding: 16px 16px 10px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.history-head { display: flex; align-items: center; justify-content: space-between; }
.history-head .block-title { margin-bottom: 10px; flex: 1; }
.history-clear {
  margin: 0 0 10px 10px; padding: 3px 11px; cursor: pointer;
  font-family: inherit; font-size: 11.5px; color: var(--ink-mute);
  background: transparent; border: 1px solid var(--line-2); border-radius: 999px;
  transition: all .18s;
}
.history-clear:hover { color: #d1521f; border-color: rgba(255, 122, 89, .5); }
.history-list { list-style: none; max-height: 260px; overflow-y: auto; }
.history-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
  background: var(--paper-2);
  border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color .18s, box-shadow .18s, transform .14s;
}
.history-item:hover {
  border-color: var(--brand); transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(108, 92, 231, .16);
}
.hi-main { min-width: 0; }
.hi-gz {
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 15px; font-weight: 700; letter-spacing: 2px; color: var(--ink);
}
.hi-sub {
  margin-top: 2px; font-size: 11.5px; color: var(--ink-mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hi-side { flex: none; display: flex; align-items: center; gap: 8px; }
.hi-time { font-size: 11px; color: var(--ink-mute); }
.hi-del {
  width: 22px; height: 22px; line-height: 1; cursor: pointer;
  font-size: 15px; color: var(--ink-mute);
  background: transparent; border: 0; border-radius: 50%;
  transition: all .18s;
}
.hi-del:hover { color: #fff; background: #d1521f; }
.history-empty { padding: 6px 0 12px; font-size: 12px; color: var(--ink-mute); text-align: center; }

/* ═══ 主页 · 功能卡片 ═══ */
.home-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 24px 28px; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.home-card {
  display: flex; align-items: center; gap: 15px; width: 100%;
  padding: 20px 20px; text-align: left; cursor: pointer;
  font-family: inherit; color: var(--ink);
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .2s, border-color .2s;
}
.home-card:hover {
  transform: translateY(-3px); border-color: var(--brand);
  box-shadow: 0 14px 32px rgba(108, 92, 231, .22);
}
.home-card:active { transform: translateY(0); }
.home-card-seal {
  flex: none; width: 54px; height: 54px; display: grid; place-items: center;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 18px; font-weight: 700; letter-spacing: 1px; color: #fff;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  border-radius: 16px; box-shadow: 0 8px 20px rgba(108, 92, 231, .36);
}
.home-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.home-card-title { font-size: 16px; font-weight: 700; letter-spacing: 3px; }
.home-card-desc { font-size: 12px; line-height: 1.6; color: var(--ink-mute); }
.home-card-arrow { flex: none; color: var(--brand); opacity: .6; transition: transform .16s, opacity .16s; }
.home-card:hover .home-card-arrow { transform: translateX(3px); opacity: 1; }
/* 待开放卡片 */
.home-card.is-soon { cursor: not-allowed; opacity: .72; box-shadow: none; }
.home-card.is-soon:hover { transform: none; border-color: var(--line-2); box-shadow: none; }
.home-card.is-soon .home-card-seal { box-shadow: none; filter: saturate(.85); }
.seal-qimen { background: linear-gradient(140deg, #f0a35a, var(--accent)); }
.seal-liuren { background: linear-gradient(140deg, #4cc6aa, var(--jade)); }
.seal-ziwei { background: linear-gradient(140deg, #e0b95f, var(--gold)); }
.soon-tag {
  margin-left: 8px; padding: 2px 8px; vertical-align: 2px;
  font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: 1px;
  color: var(--ink-mute); background: rgba(139, 135, 168, .14);
  border: 1px solid var(--line-2); border-radius: 999px;
}

/* ═══ AI 提问选项卡（先问关心哪些方面，再展开详批） ═══ */
.ask-card {
  margin-top: 12px; padding: 14px 14px 12px;
  background: linear-gradient(180deg, rgba(108, 92, 231, .06), rgba(108, 92, 231, .02));
  border: 1px solid var(--line-2); border-radius: var(--r-md);
}
.ask-q { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.6; margin-bottom: 10px; }
.ask-hint {
  margin-left: 8px; padding: 1px 8px; font-size: 11px; font-weight: 600; letter-spacing: 1px;
  color: var(--brand); background: var(--brand-soft); border-radius: 999px; vertical-align: 1px;
}
.ask-opts { display: flex; flex-direction: column; gap: 8px; }
.ask-opt {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; font-family: inherit; font-size: 13px; line-height: 1.6; cursor: pointer;
  color: var(--ink); background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  transition: all .16s;
}
.ask-opt:hover:not(:disabled) {
  border-color: var(--brand); background: #fff;
  box-shadow: 0 4px 12px rgba(108, 92, 231, .16);
}
.ask-key {
  flex: none; width: 22px; height: 22px; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); border-radius: 6px;
}
.ask-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ask-txt b { font-weight: 600; }
.ask-txt small { font-size: 12px; color: var(--ink-mute); }
.ask-opt.picked { border-color: var(--brand); background: var(--brand-soft); }
.ask-opt.picked .ask-key { color: #fff; background: var(--brand); }
.ask-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.ask-submit { padding: 7px 22px; }
.ask-submit:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.ask-card.done .ask-opt { cursor: default; opacity: .6; }
.ask-card.done .ask-opt.picked { opacity: 1; }

/* 最后一项：用户自己输入 */
.ask-other {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; background: rgba(255, 255, 255, .92);
  border: 1px dashed var(--line-2); border-radius: var(--r-sm);
  transition: all .16s;
}
.ask-other:focus-within, .ask-other.picked {
  border-style: solid; border-color: var(--brand); background: #fff;
}
.ask-other .ask-key { margin-top: 0; }
.ask-other.picked .ask-key { color: #fff; background: var(--brand); }
.ask-input {
  flex: 1; min-width: 0; padding: 4px 0; font-family: inherit; font-size: 13px;
  color: var(--ink); background: transparent; border: 0; outline: none;
}
.ask-input::placeholder { color: var(--ink-mute); }
.ask-input:disabled { color: var(--ink); }
.ask-card.done .ask-other { opacity: .6; }
.ask-card.done .ask-other.picked { opacity: 1; }
