/* ============ 拾遗小筑 样式 ============ */
:root {
  --bg: #1a1625;
  --bg-2: #241e35;
  --bg-3: #2f2745;
  --border: #3d3458;
  --text: #f0eaff;
  --text-2: #a99ec7;
  --accent: #9b59b6;
  --accent-2: #b370cc;
  --gold: #d4af37;
  --gold-2: #e6c760;
  --danger: #e5534b;
  --ok: #3fb950;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  --code-bg: #0b0d12;
  --body-bg-1: #2a1f45;
  --body-bg-2: #1a1625;
  --body-bg-3: #120e1c;
  --sidebar-w: 300px;
}
html, body { height: 100%; margin: 0; }
* { box-sizing: border-box; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: radial-gradient(ellipse at top, var(--body-bg-1) 0%, var(--body-bg-2) 50%, var(--body-bg-3) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  position: relative;
  transition: background-color .25s, color .25s;
}

/* 星空背景装饰 */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(155, 89, 182, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app { display: flex; height: 100vh; overflow: hidden; position: relative; z-index: 1; }

/* ============ Logo 与状态点 ============ */
.logo {
  width: 46px; height: 46px; border-radius: 14px; flex: 0 0 46px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 22px; color: #fff;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}
/* 状态点 / 关系图例色点：仍被「八字刑冲合害」图例使用，勿删 */
.dot { width: 8px; height: 8px; border-radius: 50%; background: #666; display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: var(--danger); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none; border-radius: var(--radius);
  padding: 11px 16px; font-size: 14px; cursor: pointer; font-weight: 600;
  box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3);
  transition: all 0.2s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(155, 89, 182, 0.4); }
.btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 14px; cursor: pointer; font-size: 13px;
  transition: all 0.2s;
}
.btn-ghost:hover { background: var(--bg-3); border-color: var(--accent); }
.btn-block { width: 100%; }
.btn-ok { background: var(--ok); color: #fff; border: none; border-radius: var(--radius); padding: 9px 20px; cursor: pointer; font-weight: 600; box-shadow: 0 4px 15px rgba(63, 185, 80, 0.3); transition: all 0.2s; }
.btn-ok:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(63, 185, 80, 0.4); }

.side-section { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.side-section.grow { flex: 1; }
.side-title { font-size: 12px; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; }
.mini-btn { background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 12px; cursor: pointer; }
.mini-btn:hover { color: var(--text); }

.conv-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; max-height: 180px; }
.conv-item {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; color: var(--text-2); font-size: 13px; border: 1px solid transparent;
}
.conv-item:hover { background: var(--bg-3); color: var(--text); }
.conv-item.active { background: var(--bg-3); color: var(--text); border-color: var(--accent); }
.conv-item .c-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .c-del { visibility: hidden; background: none; border: none; color: var(--text-2); cursor: pointer; font-size: 12px; }
.conv-item:hover .c-del { visibility: visible; }
.conv-item .c-del:hover { color: var(--danger); }

/* 触屏设备（手机/平板）：删除按钮常显，不依赖 hover */
@media (hover: none) {
  .conv-item .c-del { visibility: visible; opacity: 0.6; }
}

.upload-btn {
  display: block; border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 10px; text-align: center; color: var(--text-2); font-size: 13px;
  cursor: pointer; transition: all .15s;
}
.upload-btn:hover { border-color: var(--accent); color: var(--accent); }

.kb-readonly-note {
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text-2); font-size: 12px; line-height: 1.7;
  padding: 8px 10px; margin-bottom: 8px;
}
.kb-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; max-height: 42vh; }
.kb-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px;
  background: var(--bg-3); font-size: 12px; color: var(--text-2);
}
.kb-item.kb-builtin { background: color-mix(in srgb, var(--accent) 8%, var(--bg-3)); }
.kb-item .k-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-item .k-info { font-size: 11px; }
.kb-item .k-badge {
  flex: none; font-size: 10px; line-height: 1; padding: 3px 6px; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--accent); white-space: nowrap;
}
.kb-item .k-del { background: none; border: none; color: var(--text-2); cursor: pointer; font-size: 12px; }
.kb-item .k-del:hover { color: var(--danger); }
.muted { color: var(--text-2); font-size: 12px; }
#kbHint { padding: 2px 2px; }

.side-foot { display: flex; flex-direction: column; gap: 8px; }
.model-row { display: flex; gap: 6px; }
.model-row select {
  flex: 1; background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; min-width: 0;
  transition: all 0.2s;
}
.model-row select:hover { border-color: var(--accent); }
.model-row select:focus { border-color: var(--gold); outline: none; }

/* ============ 主区域 ============ */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
#chatHeader {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.btn-menu {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-right: 10px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--gold);
  border-radius: 10px; font-size: 18px; line-height: 1; cursor: pointer; flex: 0 0 auto;
}
.btn-menu:hover { background: var(--accent); color: #fff; }
/* 工具栏入口按钮（微信企微式） */
.btn-toolbar {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; margin-right: 8px; padding: 0 14px;
  background: linear-gradient(135deg, rgba(212,175,55,.18), rgba(155,89,182,.16));
  border: 1px solid rgba(212, 175, 55, 0.35); color: var(--gold-2);
  border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; flex: 0 0 auto;
}
.btn-toolbar:hover { background: linear-gradient(135deg, rgba(212,175,55,.3), rgba(155,89,182,.28)); color: #fff; }

/* 工具栏面板：全屏功能入口（类似主页卡片网格） */
.tool-panel {
  position: absolute; inset: 0; z-index: 60;
  background: var(--bg);
  display: flex; flex-direction: column;
  animation: fadeIn .18s ease;
}
.tool-panel.hidden { display: none; }
.tool-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  font-size: 16px; font-weight: 600; color: var(--gold-2);
}
.tool-panel-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; max-width: 860px; margin: 0 auto; width: 100%; }
.tool-sec { margin-bottom: 22px; text-align: left; }
/* 分类模块卡（首页与工具栏面板共用） */
.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px; margin-top: 10px; text-align: left;
}
.cat-card {
  background: linear-gradient(160deg, rgba(155,89,182,.16), rgba(212,175,55,.08));
  border: 1px solid rgba(212,175,55,.3); border-radius: 16px;
  padding: 20px 18px; cursor: pointer; position: relative;
  transition: transform .15s ease, box-shadow .15s ease;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(212,175,55,.14); }
.cat-icon { font-size: 34px; line-height: 1; margin-bottom: 12px; }
.cat-name { font-size: 18px; font-weight: 700; color: var(--gold-2); margin-bottom: 6px; }
.cat-desc { font-size: 12.5px; color: #a99ec7; line-height: 1.6; }
.cat-count {
  display: inline-block; margin-top: 12px; font-size: 11.5px;
  color: #c9a9e8; background: rgba(155,89,182,.18);
  padding: 3px 10px; border-radius: 999px;
}
/* 欢迎页操作按钮：历史对话 / 新建对话 */
.welcome-ops {
  display: flex; justify-content: center; gap: 14px; margin: 18px 0 6px; flex-wrap: wrap;
}
.welcome-op {
  padding: 10px 26px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  background: #2a2440; border: 1px solid rgba(212,175,55,.35); color: var(--gold-2);
  cursor: pointer; transition: all .15s ease;
}
.welcome-op:hover { background: rgba(212,175,55,.2); color: #fff; }
.welcome-op.primary {
  background: linear-gradient(135deg, #9b59b6, #d4af37);
  border-color: transparent; color: #fff;
}
.welcome-op.primary:hover { filter: brightness(1.12); }
/* 我的弹窗底部扩展入口 */
.acct-extra {
  display: flex; gap: 10px; justify-content: center;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border);
}
/* 聊天卡片删除按钮 */
.chat-result-card .card-del-btn {
  padding: 6px 12px; font-size: 12.5px;
  background: rgba(255,107,107,.1); border: 1px solid rgba(255,107,107,.3);
  color: #ff8a8a; border-radius: 999px; cursor: pointer; margin-left: auto;
}
.chat-result-card .card-del-btn:hover { background: rgba(255,107,107,.25); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 聊天对话中的结果卡片消息 */
.msg .bubble .result-card.chat-result-card { margin: 4px 0; }
.chat-result-card .card-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.chat-result-card .term-send-btn {
  padding: 6px 14px; font-size: 12.5px;
  background: rgba(212,175,55,.12); border: 1px solid rgba(212,175,55,.35);
  color: var(--gold-2); border-radius: 999px; cursor: pointer;
}
.chat-result-card .term-send-btn:hover { background: rgba(212,175,55,.25); }
.chat-result-card .card-interpret-btn {
  padding: 6px 14px; font-size: 12.5px;
  background: rgba(155,89,182,.14); border: 1px solid rgba(155,89,182,.4);
  color: #c9a9e8; border-radius: 999px; cursor: pointer;
}
.chat-result-card .card-interpret-btn:hover { background: rgba(155,89,182,.28); }
.chat-result-card .card-interpret-btn:disabled { opacity: .6; cursor: wait; }
.chat-result-card .card-note { font-size: 12px; }
.result-card-body { font-size: 13.5px; line-height: 1.8; color: var(--text); }
.result-card-body p { margin: 8px 0; }
#convTitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 移动端侧边栏遮罩 */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.5);
}
body.sidebar-open .sidebar-overlay { display: block; }
#messages { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 18px; }

/* 欢迎页 */
.welcome { text-align: center; margin: auto; max-width: 720px; padding: 30px 20px; }
.welcome-taiji {
  font-size: 56px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  width: 90px; height: 90px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(155, 89, 182, 0.2), rgba(212, 175, 55, 0.2));
  border: 2px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 40px rgba(212, 175, 55, 0.2);
  animation: taiji-spin 14s linear infinite;
  transform-origin: center center;
}
@keyframes taiji-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-taiji { animation: none; }
}
.welcome-title {
  font-size: 34px; font-weight: 700; margin: 0 0 8px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 4px;
}
.welcome-subtitle {
  font-size: 15px; color: var(--gold-2); margin: 0 0 16px;
  letter-spacing: 2px; opacity: 0.85;
}
.welcome-desc { font-size: 14px; color: var(--text-2); line-height: 1.7; margin: 0 0 28px; }

.welcome-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin-bottom: 28px;
}
.feature-card {
  background: rgba(155, 89, 182, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 14px; padding: 20px 12px;
  cursor: pointer; transition: all 0.25s;
  text-align: center;
}
.feature-card:hover {
  background: rgba(155, 89, 182, 0.18);
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.15);
}
.feature-icon { font-size: 32px; margin-bottom: 10px; }
.feature-name { font-size: 15px; font-weight: 600; color: var(--gold-2); margin-bottom: 4px; }
.feature-desc { font-size: 12px; color: var(--text-2); }
.welcome-tip {
  font-size: 12px; color: var(--text-2); opacity: 0.7;
  margin-top: 10px; letter-spacing: 1px;
}

.msg { display: flex; gap: 10px; max-width: 860px; }
.msg .avatar {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #fff;
}
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.user .avatar { background: #5b6472; }
.msg.assistant .avatar { background: linear-gradient(135deg, var(--accent), #7a5cff); }
.msg .bubble {
  position: relative;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; line-height: 1.65; overflow-wrap: break-word; min-width: 0;
}
.msg-copy {
  position: absolute; top: 6px; right: 8px;
  font-size: 11px; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-2); cursor: pointer; opacity: 0; transition: opacity .15s;
}
.msg .bubble:hover .msg-copy { opacity: 1; }
.msg-copy:hover { background: var(--bg-3); color: var(--text); }
.msg.user .bubble { background: var(--accent); border-color: var(--accent); color: #fff; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin-bottom: 0; }
.bubble pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; overflow-x: auto; font-size: 12.5px; line-height: 1.5;
}
.bubble code { font-family: Consolas, "Courier New", monospace; }
.bubble :not(pre) > code {
  background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 4px; font-size: 12.5px;
}
.bubble ul, .bubble ol { margin: 6px 0; padding-left: 22px; }
.bubble blockquote { margin: 6px 0; padding: 2px 12px; border-left: 3px solid var(--accent); color: var(--text-2); }
.bubble table { border-collapse: collapse; margin: 8px 0; }
.bubble th, .bubble td { border: 1px solid var(--border); padding: 6px 10px; }
.bubble a { color: var(--accent-2); }
.bubble h1, .bubble h2, .bubble h3 { margin: 10px 0 6px; }
.code-head {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--code-bg); border: 1px solid var(--border); border-bottom: none;
  border-radius: 8px 8px 0 0; padding: 4px 10px; font-size: 11px; color: var(--text-2);
}
.code-head button { background: none; border: none; color: var(--accent-2); cursor: pointer; font-size: 11px; }

/* 工具卡片 */
.tool-card {
  background: var(--bg-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 8px 12px; font-size: 12.5px; color: var(--text-2); max-width: 860px;
}
.tool-card .t-name { color: var(--text); font-weight: 600; }
.tool-card .t-result { margin-top: 6px; white-space: pre-wrap; max-height: 200px; overflow-y: auto;
  background: var(--code-bg); border-radius: 6px; padding: 8px; font-size: 12px; }
.tool-card .t-wait { color: #e5c07b; }
.tool-card .t-err { color: var(--danger); }

/* 太极加载动画 */
.typing { display: inline-flex; align-items: center; gap: 8px; padding: 4px 2px; }
.taiji-spin {
  width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(from 0deg, #f0eaff 0%, #f0eaff 50%, #2a2340 50%, #2a2340 100%);
  border: 2px solid var(--gold);
  position: relative;
  animation: taiji-rotate 1.5s linear infinite;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}
.taiji-spin::before, .taiji-spin::after {
  content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%;
}
.taiji-spin::before { top: 0; left: 50%; transform: translateX(-50%); background: #f0eaff; }
.taiji-spin::after { bottom: 0; left: 50%; transform: translateX(-50%); background: #2a2340; }
@keyframes taiji-rotate { to { transform: rotate(360deg); } }
.typing-text { font-size: 13px; color: var(--gold-2); }
.inline-typing { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: rgba(155, 89, 182, 0.08); }
.inline-typing .typing-text { font-size: 13px; }

/* ============ 输入区 ============ */
#inputArea { border-top: 1px solid rgba(212, 175, 55, 0.15); padding: 12px 24px 16px; background: linear-gradient(to top, rgba(18,14,28,.98) 0%, rgba(26,22,37,.94) 78%, rgba(26,22,37,.86) 100%); position: relative; z-index: 2; }
.toolbar { display: flex; align-items: center; gap: 18px; margin-bottom: 10px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; cursor: pointer; }
.hint { font-size: 12px; }
.input-row { display: flex; gap: 10px; align-items: flex-end; }
#input {
  flex: 1; background: var(--bg-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; font-size: 14px; resize: none; outline: none;
  font-family: inherit; line-height: 1.5; max-height: 160px;
}
#input:focus { border-color: var(--accent); }
.btn-send {
  background: var(--accent); color: #fff; border: none; border-radius: 12px;
  padding: 12px 22px; font-size: 14px; font-weight: 600; cursor: pointer; height: 46px;
}
.btn-send:hover { background: var(--accent-2); }
.btn-send:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 弹窗 ============ */
/* 拖拽上传提示层 */
.drop-overlay {
  position: fixed; inset: 0; z-index: 200; pointer-events: none;
  display: none; align-items: center; justify-content: center;
}
body.drag-over .drop-overlay { display: flex; }
.drop-overlay .drop-box {
  background: var(--bg-2); border: 2px dashed var(--accent); border-radius: 16px;
  padding: 34px 48px; font-size: 16px; color: var(--accent); font-weight: 600;
  box-shadow: var(--shadow); text-align: center; line-height: 1.8;
}
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.hidden { display: none !important; }
.modal {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 24px; width: 520px; max-width: 92vw; max-height: 84vh;
  overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
}
.modal h3 { margin: 0; font-size: 17px; font-weight: 600; }
.modal input[type=text], .modal input:not([type=range]):not([type=checkbox]) {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 14px; font-size: 13px; width: 100%; outline: none;
  transition: all 0.2s;
}
.modal input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15); }
/* 意见反馈等弹窗里的多行输入框：与单行输入框保持同一套观感 */
.modal textarea {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 14px; font-size: 13px; width: 100%;
  outline: none; resize: vertical; line-height: 1.6;
  transition: all 0.2s;
}
.modal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.approval-text { color: var(--text); }
.approval-cmd {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; margin: 0;
  font-family: Consolas, "Courier New", monospace; color: #e5c07b; max-height: 160px; overflow-y: auto;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.pull-log {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; height: 140px; overflow-y: auto; font-size: 12px; color: var(--text-2);
  font-family: Consolas, monospace; white-space: pre-wrap;
}
.setting-row { display: flex; align-items: center; gap: 12px; }
.setting-row .grow { flex: 1; }
.modal select {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; outline: none;
}

/* 账户 / 登录注册 */
.acct-tabs { display: flex; gap: 8px; }
.acct-tab {
  flex: 1; background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 0; font-size: 14px; cursor: pointer;
}
.acct-tab.active {
  background: linear-gradient(135deg, rgba(155, 89, 182, 0.45), rgba(212, 175, 55, 0.35));
  color: #ffe9a8; border-color: var(--accent); font-weight: 600;
}
.acct-info { min-height: 18px; color: #e09090; font-size: 13px; }
.danger-btn { color: #e09090 !important; border-color: rgba(224, 90, 90, 0.5) !important; }
.danger-btn:hover { background: rgba(224, 90, 90, 0.12) !important; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 4px; }

/* ============ 功能面板 ============ */
.panel-row { display: flex; gap: 8px; }
.panel-btn {
  flex: 1; background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 0; cursor: pointer; font-size: 13px; font-weight: 600;
}
.panel-btn:hover { border-color: var(--accent); color: var(--accent); }

.dao-modal, .stock-modal { width: 860px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab {
  background: transparent; border: 1px solid var(--border); color: var(--text-2);
  border-radius: 20px; padding: 6px 14px; font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: all 0.2s;
}
.tab:hover { border-color: var(--accent); color: var(--text); background: rgba(155, 89, 182, 0.1); }

/* 道学弹窗：顶部按分类分组的 tabs + 下方内容 */
.dao-body { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.dao-body .tabs {
  flex-direction: row; flex-wrap: wrap; gap: 10px;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.dao-body .tab {
  border-radius: 10px; padding: 6px 12px;
  white-space: nowrap; font-size: 12.5px;
}
/* 分类块：命盘/占卜/相术/经典查询 */
.tab-cat {
  flex: 0 0 100%;
  display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 11px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.tab-cat-label {
  flex: 0 0 auto;
  font-size: 11px; letter-spacing: 1px; color: var(--gold-2);
  white-space: nowrap; font-weight: 600;
  padding: 5px 9px 5px 0; border-right: 1px solid var(--border);
  line-height: 1.4; min-width: 52px;
}
.tab-cat-btns { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.dao-content { flex: 1; min-width: 0; }
.tab-divider {
  font-size: 11px; color: var(--text-2); cursor: pointer;
  padding: 4px 10px; border: 1px dashed var(--border); border-radius: 8px;
  user-select: none; align-self: center;
}
.tab-divider:hover { color: var(--gold); border-color: var(--gold); }
.tab-group { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; }
.tab-group.hidden { display: none; }
.drop-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 20px; text-align: center; transition: all 0.2s;
  background: rgba(255,255,255,0.02);
}
.drop-zone.dragover { border-color: var(--gold); background: rgba(212,175,55,0.1); }
.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--gold));
  border-color: var(--gold); color: #fff; font-weight: 600;
}
.tab-pane { display: flex; flex-direction: column; gap: 10px; }
.dao-methods { display: flex; gap: 14px; color: var(--text-2); font-size: 13px; flex-wrap: wrap; }
.dao-methods label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.row2 { display: flex; gap: 10px; }
.row2 input { flex: 1; }
.coins-row { display: flex; gap: 8px; }

/* 专业术语解释：横滑标签 + 点击弹解释（手机端友好） */
.term-chips {
  margin-top: 18px;
  background: linear-gradient(180deg, rgba(212,175,55,.07), rgba(155,89,182,.05));
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 14px;
  padding: 13px 14px 14px;
}
.term-chips-head {
  font-size: 14px; color: var(--gold); font-weight: 600;
  display: flex; align-items: baseline; gap: 8px;
}
.term-chips-head small { font-size: 11.5px; color: var(--text-2); font-weight: 400; }
.term-intro { padding: 8px 2px 0; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.term-chips-scroll {
  display: flex; gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.term-chip {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--gold-2);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.term-chip:hover, .term-chip:active {
  background: rgba(212,175,55,.18);
  border-color: var(--gold);
}
.term-pop {
  margin-top: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
  animation: fadeIn .2s ease;
}
.term-pop-name { color: var(--gold-2); font-size: 13px; font-weight: 600; }
.term-pop-desc { color: var(--text-2); font-size: 12.5px; line-height: 1.7; }
.coins-row select {
  flex: 1; background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px; font-size: 13px;
}
.bazi-inputs { display: flex; gap: 8px; }
.bazi-inputs input { flex: 1; }
.pillar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pillar {
  background: linear-gradient(160deg, rgba(155, 89, 182, 0.12), rgba(212, 175, 55, 0.06));
  border: 1px solid rgba(212, 175, 55, 0.2); border-radius: 12px;
  padding: 12px 8px; text-align: center; transition: all 0.2s;
}
.pillar:hover { border-color: var(--gold); transform: translateY(-2px); }
.pillar .p-label { font-size: 11px; color: var(--text-2); margin-bottom: 4px; }
.pillar .p-text { font-size: 19px; font-weight: 700; letter-spacing: 2px; color: var(--gold-2); }
.pillar .p-nayin { font-size: 11px; color: var(--text-2); margin-top: 4px; }
.result-card {
  background: rgba(47, 39, 69, 0.6); border: 1px solid rgba(212, 175, 55, 0.2);
  border-left: 3px solid var(--gold);
  border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px;
  backdrop-filter: blur(6px);
}
.result-card h4 { margin: 0; font-size: 16px; color: var(--gold-2); }
.result-card .muted { font-size: 12.5px; line-height: 1.6; }
.gua-art {
  font-family: Consolas, "Courier New", monospace; font-size: 15px; line-height: 1.25;
  background: var(--code-bg); border: 1px solid rgba(212, 175, 55, 0.15); border-radius: 10px;
  padding: 14px 16px; color: var(--text); text-align: center;
}
.gua-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--text-2); }
.dong-yao { color: #e5c07b; }
.liuren-big { font-size: 20px; font-weight: 700; }
.ji-ji { color: var(--ok); }
.ji-xiong { color: var(--danger); }
.interpret-box {
  background: linear-gradient(160deg, rgba(212, 175, 55, 0.06), rgba(155, 89, 182, 0.06));
  border: 1px solid rgba(212, 175, 55, 0.3); border-radius: 12px;
  padding: 14px 16px; font-size: 13.5px; line-height: 1.8; min-height: 40px;
  white-space: normal; color: var(--text);
}

/* 聊天框：本地硬算完成后的「按需解读」按钮卡 */
.interpret-bar {
  border: 1px solid rgba(212, 175, 55, 0.25); border-radius: 12px;
  background: linear-gradient(160deg, rgba(212,175,55,0.05), rgba(155,89,182,0.04));
  padding: 12px 14px; margin: 2px 0 12px;
}
.interpret-bar-tip { font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.interpret-bar-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.interpret-bar .ip-btn { padding: 8px 22px; border-radius: 10px; }
.interpret-bar .ip-pro { background: linear-gradient(135deg, var(--accent), var(--gold)); box-shadow: 0 4px 15px rgba(212,175,55,0.25); }
.interpret-bar .ip-plain { background: linear-gradient(135deg, #3b4a6b, #4a6f8f); box-shadow: 0 4px 15px rgba(74,111,143,0.25); }
.interpret-bar .ip-btn:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }
/* 聊天框解读结果用 Markdown 渲染（与弹窗 .interpret-box 共用排版） */
.ip-box { white-space: normal; margin-top: 12px; }
.ip-box p, .interpret-box p { margin: 0 0 8px; }
.ip-box p:last-child, .interpret-box p:last-child { margin-bottom: 0; }
.ip-box table, .interpret-box table { border-collapse: collapse; margin: 8px 0; }
.ip-box th, .ip-box td, .interpret-box th, .interpret-box td { border: 1px solid var(--border); padding: 6px 10px; }
.ip-box ul, .ip-box ol, .interpret-box ul, .interpret-box ol { margin: 6px 0; padding-left: 22px; }
.ip-box h1, .ip-box h2, .ip-box h3, .interpret-box h1, .interpret-box h2, .interpret-box h3 { margin: 10px 0 6px; }
.ip-box pre, .interpret-box pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 12.5px; }
.ip-box :not(pre) > code, .interpret-box :not(pre) > code { background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

/* 五行力量条形图 */
.wuxing-bars { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.wx-bar-row { display: flex; align-items: center; gap: 10px; }
.wx-bar-label { width: 36px; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.wx-bar-track { flex: 1; height: 18px; background: var(--code-bg); border-radius: 9px; overflow: hidden; border: 1px solid rgba(255,255,255,0.05); }
.wx-bar-fill { height: 100%; border-radius: 9px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 11px; font-weight: 700; color: #fff; transition: width 0.6s ease; }
.wx-mu { background: linear-gradient(90deg, #2d7a3e, #4caf50); }
.wx-huo { background: linear-gradient(90deg, #c0392b, #e74c3c); }
.wx-tu { background: linear-gradient(90deg, #b8860b, #d4a017); }
.wx-jin { background: linear-gradient(90deg, #95a5a6, #ecf0f1); color: #333; }
.wx-shui { background: linear-gradient(90deg, #1a5276, #2980b9); }
.base-pre {
  background: var(--code-bg); border: 1px solid rgba(212, 175, 55, 0.15); border-radius: 10px;
  padding: 12px 14px; font-size: 12px; line-height: 1.6; white-space: pre-wrap;
  color: var(--text-2); max-height: 240px; overflow-y: auto; margin: 0;
}

/* 摇签组件 */
.qian-zone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--code-bg); border: 1px dashed var(--border); border-radius: 10px;
  padding: 12px; user-select: none;
}
.qian-tube {
  position: relative; width: 64px; height: 150px; cursor: grab; touch-action: none;
  background: linear-gradient(180deg, #7a4a1f 0%, #9c5f28 18%, #7a4a1f 100%);
  border-radius: 14px 14px 22px 22px; border: 2px solid #5e3a17;
  box-shadow: inset 0 0 12px rgba(0,0,0,.5), 0 3px 8px rgba(0,0,0,.4);
  overflow: hidden;
}
.qian-tube:active { cursor: grabbing; }
.qian-tube::before {
  content: ""; position: absolute; left: 8px; right: 8px; top: 22px; bottom: 14px;
  background: radial-gradient(ellipse at 50% 30%, #c98d4a 0%, #8a5520 75%);
  border-radius: 8px; border: 1px solid #5e3a17;
}
.qian-sticks {
  position: absolute; left: 0; right: 0; top: 26px; bottom: 16px;
  text-align: center; transform-origin: 50% 100%;
}
.qian-stick {
  display: inline-block; width: 7px; height: 92px; margin: 0 1px;
  background: linear-gradient(180deg, #f0d9a8 0%, #d9b877 100%);
  border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.qian-stick.fly { animation: qianfly .5s ease-out forwards; }
@keyframes qianfly {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(-46px) rotate(-16deg); opacity: 1; }
}
.qian-power {
  width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.qian-power-fill {
  height: 100%; width: 0; background: linear-gradient(90deg, #61afef, #98c379);
  border-radius: 3px; transition: width .05s linear;
}
.qian-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 16px;
  padding: 6px 18px; font-size: 12.5px; cursor: pointer;
}
.qian-btn:active { transform: scale(.97); }
.qian-result {
  font-size: 13px; color: var(--text); background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  min-height: 20px; width: 100%; box-sizing: border-box;
}
.qian-result .qian-no { color: #e5c07b; font-weight: 700; }
.qian-tip { font-size: 11px; color: var(--text-2); }

.stock-search { display: flex; gap: 8px; }
.stock-search input { flex: 1; }
.market-board-section {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 12px;
}
.market-board-section h4 { margin: 0 0 10px 0; font-size: 15px; }
.market-board-section details summary { padding: 4px 0; }
.market-board-section .muted { font-size: 13px; line-height: 1.7; }
.dao-divider {
  text-align: center; color: var(--text-2); font-size: 12px; margin: 6px 0 2px;
  letter-spacing: 1px;
}
.stock-dao-quote {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; margin-bottom: 6px;
}
.stock-dao-quote .q-price { font-size: 18px; font-weight: 700; }
.stock-quote-block, .stock-ind-block { display: flex; flex-direction: column; gap: 10px; }
.quote-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; font-size: 13px; }
.q-price { font-size: 24px; font-weight: 700; }
.up { color: #f4554a; }
.down { color: #2eb85c; }
.ind-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.ind-table th, .ind-table td { border: 1px solid var(--border); padding: 5px 8px; text-align: center; }
.ind-table th { color: var(--text-2); font-weight: 600; background: var(--bg-3); }
.kline-wrap { overflow-x: auto; }
.kline-table { border-collapse: collapse; font-size: 11.5px; min-width: 100%; }
.kline-table th, .kline-table td { border: 1px solid var(--border); padding: 4px 7px; text-align: right; white-space: nowrap; }
.kline-table th { color: var(--text-2); background: var(--bg-3); }

/* ============ 道学观市：热点 / 观察笔记 / 决策清单 ============ */
.stock-modal-head { margin-bottom: 12px; }
.stock-modal-head h3 { margin: 0; font-size: 19px; }
.stock-subtitle { color: var(--text-2); font-size: 12px; margin-top: 4px; letter-spacing: .5px; }
.market-board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.market-board-head h4 { margin: 0; font-size: 15px; }
.hot-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.hot-tab {
  background: var(--bg-2); color: var(--text-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; transition: all .18s;
}
.hot-tab:hover { color: var(--text); border-color: var(--accent); }
.hot-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--gold)); color: #fff; border-color: transparent;
}
.hot-meta { font-size: 11.5px; color: var(--text-2); margin-bottom: 8px; }
.hot-row {
  display: grid; grid-template-columns: 28px 1.7fr 72px 1.3fr; align-items: center; gap: 10px;
  padding: 9px 6px; border-bottom: 1px dashed var(--border); font-size: 13px;
}
.hot-row:last-of-type { border-bottom: none; }
.hot-rank {
  width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 6px;
  background: var(--bg-2); color: var(--text-2); font-size: 12px; font-weight: 700;
}
.hot-rank.rank-1 { background: linear-gradient(135deg, #e8a33d, #c0791c); color: #fff; }
.hot-rank.rank-2 { background: linear-gradient(135deg, #b8c0cc, #8a93a3); color: #fff; }
.hot-rank.rank-3 { background: linear-gradient(135deg, #c78a5a, #9c6136); color: #fff; }
.hot-name { font-weight: 600; display: flex; align-items: baseline; gap: 6px; }
.hot-kind { font-size: 11px; color: var(--text-2); font-weight: 400; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.hot-chg { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.hot-leader { font-size: 12px; color: var(--text-2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-leader em { font-style: normal; margin-left: 4px; font-weight: 700; }
.market-note { font-size: 12.5px; color: var(--text-2); line-height: 1.7; margin-top: 10px; background: var(--bg-2); border-radius: 8px; padding: 8px 10px; }
.market-disc { font-size: 11px; color: var(--text-2); margin-top: 8px; opacity: .8; }
.link-refresh { background: none; border: none; color: var(--gold-2); font-size: 12px; cursor: pointer; padding: 0; }

/* 观察笔记 */
.wl-card { border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; margin-bottom: 10px; background: var(--bg-2); }
.wl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.wl-dir { font-weight: 700; font-size: 14px; }
.wl-avg { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--bg-3); white-space: nowrap; }
.wl-boards { font-size: 12px; color: var(--text-2); margin-bottom: 7px; }
.wl-board { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; background: var(--bg-3); border-radius: 6px; }
.wl-board em { font-style: normal; margin-left: 5px; font-weight: 700; }
.wl-stocks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wl-stock {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px;
}
.wl-stock b { font-weight: 700; font-variant-numeric: tabular-nums; }
.wl-stock em { font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; }
.wl-why { font-size: 12px; line-height: 1.65; margin-top: 3px; }
.wl-risk { font-size: 12px; line-height: 1.65; margin-top: 5px; color: #d8a96a; }

/* 决策清单 */
.decision-card { border-color: var(--gold); }
.decision-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.decision-summary span { font-size: 12.5px; padding: 4px 11px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--border); }
.decision-summary .sig-good { color: #4ec98b; border-color: rgba(78,201,139,.4); }
.decision-summary .sig-warn { color: #e0b34a; border-color: rgba(224,179,74,.4); }
.decision-summary .sig-bad { color: #f4726a; border-color: rgba(244,114,106,.4); }
.decision-summary .sig-todo { color: var(--text-2); }
.dec-step { margin: 12px 0; }
.dec-step-title { font-weight: 700; font-size: 13.5px; color: var(--gold-2); padding-left: 8px; border-left: 3px solid var(--gold); margin-bottom: 6px; }
.dec-item { display: flex; gap: 9px; padding: 7px 6px; border-radius: 8px; font-size: 12.5px; line-height: 1.6; }
.dec-item:nth-child(odd) { background: rgba(255,255,255,.02); }
.dec-icon { flex: 0 0 20px; text-align: center; }
.dec-body { flex: 1; }
.dec-text { font-weight: 600; }
.dec-note { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.dec-item.sig-good .dec-note { color: #7fd3a6; }
.dec-item.sig-warn .dec-note { color: #d8b96a; }
.dec-item.sig-bad .dec-note { color: #ee938d; }

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  padding: 10px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 200; font-size: 13px;
}
.toast.err { border-color: var(--danger); color: #ffb3ae; }

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #333a47; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
  :root { --sidebar-w: 260px; }
  .dao-modal, .stock-modal { width: 96vw; }
}
@media (max-width: 860px) {
  .btn-menu { display: inline-flex; }
  .btn-toolbar { font-size: 13px; padding: 0 11px; height: 36px; }
  .tool-panel-head { padding: 12px 14px; }
  .tool-panel-body { padding: 14px 12px 32px; }
  .welcome-cards { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 18px; }
}
@media (max-width: 560px) {
  .welcome-cards { grid-template-columns: 1fr; }
  .bazi-inputs { flex-wrap: wrap; }
  .bazi-inputs input, .bazi-inputs select { flex: 1 1 40%; }
  .row2 { flex-direction: column; }
  .coins-row { flex-wrap: wrap; }
  .stock-search { flex-wrap: wrap; }
  .stock-search input { flex: 1 1 100%; }
  #inputArea { padding: 10px 12px 12px; }
  .toolbar { gap: 10px; font-size: 12px; margin-bottom: 8px; }
  .toolbar .hint { display: none; }
  #messages { padding: 14px 12px; }
  .welcome { padding: 20px 6px; }
  /* 功能页窄屏适配 */
  .feature-page { padding: 16px 12px 32px; }
  .feature-page-header { flex-wrap: wrap; gap: 10px; margin-bottom: 16px; padding-bottom: 14px; }
  .feature-page-header h3 { font-size: 18px; }
  .feature-input, .feature-chat { padding: 16px; }
  .bazi-input-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .feature-chat-input { flex-direction: column; }
  .feature-chat-input .btn-primary { width: 100%; }
  /* 道学观市热点榜窄屏 */
  .hot-row { grid-template-columns: 22px 1.5fr 56px 1fr; gap: 6px; font-size: 12px; }
  .hot-leader { font-size: 11px; }
  .hot-tab { padding: 3px 9px; font-size: 12px; }
  .market-board-head { align-items: flex-start; }
}
@media (max-width: 380px) {
  .bazi-input-grid { grid-template-columns: 1fr; }
  .hot-row { grid-template-columns: 20px 1.4fr 52px; }
  .hot-leader { display: none; }
}

/* 道学弹窗内容区滚动优化 */
.dao-content { max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.dao-content .tab-pane { min-height: 200px; }

/* 表单网格对齐 */
.bazi-inputs, .dao-methods { align-items: center; }
.bazi-inputs input, .bazi-inputs select { height: 38px; }
.dao-methods select {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; outline: none;
}
.dao-methods select:focus { border-color: var(--accent); }

/* 结果卡片间距 */
#baziResult, #meihuaResult, #guaResult, #liurenResult, #daliurenResult,
#ziweiResult, #qimenResult, #huangjiResult, #summaryResult, #zhouyiResult,
#faceResult, #palmResult, #stockResult, #stockDaoResult { margin-top: 12px; }

/* 侧栏列表区优化 */
.conv-list { max-height: 220px; }

/* ============ 功能独立页面 ============ */
.feature-page {
  flex: 1;                 /* 占满 chatHeader 以下剩余高度 */
  min-height: 0;           /* flex 子项允许收缩，才能产生纵向滚动 */
  overflow-y: auto;        /* 功能页自身成为纵向滚动容器，修复起卦后无法下拉 */
  overflow-x: hidden;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  animation: fadeIn 0.3s ease;
  -webkit-overflow-scrolling: touch;
}
/* 功能页模式下：#messages / #inputArea 加 .hidden 即 display:none（全局 .hidden 规则生效），
   由 openFeature / backHome / newConversation 统一切换。 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.feature-page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.feature-page-header h3 {
  margin: 0;
  font-size: 22px;
  color: var(--gold);
  font-weight: 600;
}
.feature-page-header .btn-ghost {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.feature-page-header .btn-ghost:hover {
  background: var(--border);
  color: var(--text);
}
.feature-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.feature-input {
  background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.feature-input h4 {
  margin: 0 0 20px 0;
  color: var(--gold);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.feature-input h4::before {
  content: "✦";
  color: var(--accent);
}
.feature-result {
  min-height: 50px;
}
.feature-chat {
  background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.feature-chat h4 {
  margin: 0 0 16px 0;
  color: var(--accent-2);
  font-size: 15px;
  font-weight: 600;
}
.feature-chat-input {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.feature-chat-input input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.feature-chat-input input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}
.feature-chat-input .btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.feature-chat-input .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}
.feature-chat-result {
  min-height: 30px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-2);
}

/* 功能页追问区：微信式气泡流 */
.feature-chat-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 44vh;
  overflow-y: auto;
  padding: 4px 2px 4px 0;
  -webkit-overflow-scrolling: touch;
}
.fchat-msg { display: flex; }
.fchat-msg.user { justify-content: flex-end; }
.fchat-msg.bot { justify-content: flex-start; }
.fchat-bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: normal;
  word-break: break-word;
}
.fchat-msg.user .fchat-bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-bottom-right-radius: 3px;
}
.fchat-msg.bot .fchat-bubble {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 3px;
}
.fchat-thinking { opacity: .6; font-style: italic; }
#welcome.hidden, #featurePage.hidden {
  display: none;
}

/* ============ 首页功能分类 ============ */
.home-section {
  max-width: 960px;
  margin: 28px auto 0;
  text-align: left;
}
.home-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 14px;
}
.home-section-title small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-2);
}
.home-section-bar {
  display: inline-block;
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--gold), var(--accent));
  border-radius: 2px;
}
.home-section .welcome-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .home-section .welcome-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .home-section .welcome-cards { grid-template-columns: 1fr; }
}
.home-section .feature-card {
  padding: 18px 16px;
}
.home-section .feature-name {
  font-size: 15px;
}
.home-section .feature-desc {
  font-size: 12px;
}

/* 功能输入框美化 */
.feature-input .dao-methods {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feature-input .dao-methods label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
}
.feature-input .dao-methods input,
.feature-input .dao-methods select,
.feature-input .dao-methods textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.feature-input .dao-methods input:focus,
.feature-input .dao-methods select:focus,
.feature-input .dao-methods textarea:focus {
  border-color: var(--accent);
}
.feature-input .modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
}
.feature-input .modal-actions .btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.feature-input .modal-actions .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

/* 结果卡片美化 */
.result-card {
  position: relative;
  background: linear-gradient(165deg, var(--bg-2), rgba(212,175,55,.03));
  border: 1px solid rgba(212,175,55,.22);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
}
.result-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .55;
}
.result-card h4 {
  margin: -20px -20px 16px -20px;
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
  padding: 14px 20px;
  background: linear-gradient(90deg, rgba(212,175,55,.16), rgba(212,175,55,.03) 55%, transparent);
  border-bottom: 1px solid rgba(212,175,55,.18);
  display: flex; align-items: center; gap: 8px;
  letter-spacing: .5px;
}
.result-card h4::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(212,175,55,.35), transparent);
}
.result-card pre {
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
}

/* 结果卡片右上角操作按钮（复制 / 重算） */
.result-card .rc-actions {
  position: absolute; top: 10px; right: 12px;
  display: flex; gap: 6px; opacity: 0; transition: opacity .2s;
  z-index: 2;
}
.result-card:hover .rc-actions { opacity: 1; }
.rc-act-btn {
  background: rgba(0,0,0,.35); border: 1px solid var(--border);
  color: var(--text-2); font-size: 12px; padding: 4px 10px;
  border-radius: 7px; cursor: pointer; transition: all .15s;
  line-height: 1.4;
}
.rc-act-btn:hover { color: var(--gold); border-color: var(--gold); background: rgba(212,175,55,.12); }
.rc-act-btn.active { color: var(--gold); border-color: var(--gold); background: rgba(212,175,55,.18); }

/* 加载骨架屏 */
.sk-wrap { padding: 10px 4px; }
.sk-bar {
  height: 14px; border-radius: 7px; margin: 10px 0;
  background: linear-gradient(90deg, var(--bg-3) 25%, rgba(212,175,55,.12) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.3s infinite;
}
.sk-bar.w40 { width: 40%; } .sk-bar.w60 { width: 60%; } .sk-bar.w80 { width: 80%; }
@keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-text { margin-top: 14px; font-size: 13px; color: var(--gold-2); display: flex; align-items: center; gap: 8px; }
.sk-text::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--gold); border-top-color: transparent; animation: taiji-spin 0.8s linear infinite; }

/* 阶段提示（AI详批等待） */
.stage-tip { font-size: 13px; color: var(--gold-2); padding: 6px 0; display: flex; align-items: center; gap: 8px; }
.stage-tip::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--gold); border-top-color: transparent; animation: taiji-spin 0.8s linear infinite; }

/* 术语区"全部展开/收起"工具条 */
.terms-toolbar { display: flex; gap: 8px; justify-content: flex-end; margin: 10px 14px -4px; }
.terms-toolbar button {
  background: transparent; border: 1px solid var(--border); color: var(--text-2);
  font-size: 12px; padding: 3px 10px; border-radius: 6px; cursor: pointer;
}
.terms-toolbar button:hover { color: var(--gold); border-color: var(--gold); }

/* 首页"最近使用" */
.recent-strip { max-width: 960px; margin: 18px auto 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.recent-strip .rs-label { font-size: 12px; color: var(--text-2); margin-right: 4px; }
.recent-chip {
  font-size: 12.5px; padding: 5px 12px; border-radius: 14px; cursor: pointer;
  background: rgba(212,175,55,.1); border: 1px solid rgba(212,175,55,.3); color: var(--gold-2);
  transition: all .15s;
}
.recent-chip:hover { background: rgba(212,175,55,.22); transform: translateY(-1px); }

/* 功能页追问区 sticky 底部（布局改造后启用）：微信式——消息区在上滚动，输入条固定底部 */
.feature-page.has-sticky-chat { padding-bottom: 0; display: flex; flex-direction: column; }
.feature-page.has-sticky-chat .feature-body { flex: 1; padding-bottom: 200px; }
.feature-page.has-sticky-chat .feature-chat {
  position: sticky; bottom: 0; z-index: 3;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, rgba(36,30,53,.97), rgba(26,22,37,.99));
  backdrop-filter: blur(8px);
  border-left: none; border-right: none; border-bottom: none;
  box-shadow: 0 -6px 20px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  max-height: 60vh;
}
.feature-page.has-sticky-chat .feature-chat h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--gold);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212,175,55,.15);
}
.feature-page.has-sticky-chat .feature-chat-result {
  order: 2;
  flex: 1;
  min-height: 90px;
  max-height: 38vh;
  overflow-y: auto;
  padding: 6px 2px 8px 0;
  -webkit-overflow-scrolling: touch;
}
.feature-page.has-sticky-chat .feature-chat-input {
  order: 3;
  flex: 0 0 auto;
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(212,175,55,.12);
}
.feature-page.has-sticky-chat .feature-chat-input input { padding: 10px 14px; }
.feature-page.has-sticky-chat .feature-chat-input .btn-primary { padding: 10px 20px; }

/* 底部"再算一个"快捷条 */
.bottom-more {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin: 0 0 8px 0;
  background: rgba(30,25,45,.6); border-radius: 10px;
  flex-wrap: nowrap; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.bottom-more .bm-label {
  flex-shrink: 0; font-size: 13px; color: var(--gold); font-weight: 600;
}
.bottom-more .bm-row {
  display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.bottom-more .bm-row::-webkit-scrollbar { display: none; }
.bottom-more .mf-chip {
  flex-shrink: 0; white-space: nowrap;
}

/* 反馈按钮 & 弹窗 */
.feedback-fab {
  position: fixed; right: 22px; bottom: 90px; z-index: 95;
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #1a1d29; font-size: 20px; border: none; cursor: pointer;
  box-shadow: 0 6px 18px rgba(212,175,55,.4);
  transition: transform .15s;
}
.feedback-fab:hover { transform: scale(1.08); }
#feedbackModal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 101;
}
.brand-name-row { display: flex; align-items: center; gap: 16px; }
.brand-icon-btn {
  background: rgba(212,175,55,.12); border: 1px solid rgba(212,175,55,.3);
  color: var(--gold); width: 24px; height: 24px; border-radius: 6px;
  font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.brand-icon-btn:hover { background: rgba(212,175,55,.25); transform: scale(1.08); }

/* "再算一个" 区醒目化 */
.more-features {
  margin-top: 24px; padding: 16px;
  background: linear-gradient(135deg, rgba(212,175,55,.1), rgba(155,89,182,.08));
  border: 1px solid rgba(212,175,55,.3); border-radius: 14px;
}
.more-features.top-more {
  position: sticky; top: 0; z-index: 4;
  margin: 0 0 20px; border-radius: 0 0 14px 14px;
  background: linear-gradient(180deg, rgba(36,30,53,.97), rgba(26,22,37,.95));
  backdrop-filter: blur(8px);
  border-left: none; border-right: none;
}
.more-features .mf-title {
  font-size: 14px; font-weight: 600; color: var(--gold); margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.more-features .mf-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mf-chip {
  font-size: 13px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
  background: rgba(212,175,55,.15); border: 1px solid rgba(212,175,55,.4); color: var(--gold-2);
  transition: all .15s; font-weight: 500;
}
.mf-chip:hover { background: var(--gold); color: #1a1d29; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(212,175,55,.3); }

/* 再算一个：折叠/展开 */
.more-features .mf-title.mf-toggle {
  margin-bottom: 0; cursor: pointer; user-select: none;
  justify-content: space-between; padding: 2px 0;
}
.more-features .mf-toggle-text { flex: 1; }
.more-features .mf-toggle-arrow { font-size: 14px; color: var(--gold); transition: transform .2s; }
.more-features .mf-row.mf-collapsed { display: none; }
.more-features.top-more:has(.mf-row.mf-collapsed) { padding: 10px 16px; margin-bottom: 12px; }
@media (max-width: 640px) {
  .more-features.top-more { padding: 10px 14px; }
  .more-features.top-more:has(.mf-row.mf-collapsed) { padding: 8px 14px; margin-bottom: 10px; }
}

/* 历史会话顶部"继续测算"条（独立固定在 messages 上方） */
.chat-quick-strip {
  flex-shrink: 0; z-index: 5;
  margin: 0; padding: 10px 22px;
  border-radius: 0; border-left: none; border-right: none; border-top: none;
  background: linear-gradient(180deg, rgba(36,30,53,.97), rgba(26,22,37,.95));
  backdrop-filter: blur(8px);
}

/* 隐私打码 */
.blurred { filter: blur(5px); user-select: none; cursor: pointer; }

/* 命盘档案下拉 */
.saved-pans-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.saved-pan-chip {
  font-size: 12px; padding: 4px 10px; border-radius: 12px; cursor: pointer;
  background: rgba(63,185,80,.12); border: 1px solid rgba(63,185,80,.35); color: var(--ok);
}
.saved-pan-chip:hover { background: rgba(63,185,80,.22); }

/* 五行能量条形图 */
.wx-energy { margin: 14px 0; display: flex; flex-direction: column; gap: 8px; }
.wx-row { display: grid; grid-template-columns: 48px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; }
.wx-row .wx-name { color: var(--text-2); }
.wx-bar-track { height: 12px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.wx-bar-fill { height: 100%; border-radius: 6px; transition: width .6s ease; }
.wx-row .wx-val { text-align: right; color: var(--gold); font-weight: 600; }

/* 四柱刑冲合害高亮 */
.zhu.has-chong, .pillar.has-chong { border-color: var(--danger) !important; box-shadow: 0 0 0 1px var(--danger) inset; }
.zhu.has-he, .pillar.has-he { border-color: var(--ok) !important; box-shadow: 0 0 0 1px var(--ok) inset; }

/* 紫微斗数 4×3 宫格盘 */
.zw-chart {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin: 14px 0; max-width: 420px;
}
.zw-cell {
  position: relative; aspect-ratio: 1.2;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.zw-zhi { font-size: 18px; font-weight: 700; color: var(--text-2); }
.zw-ming { border-color: var(--gold); background: rgba(212,175,55,.15); box-shadow: 0 0 14px rgba(212,175,55,.3); }
.zw-ming .zw-zhi { color: var(--gold); }
.zw-shen { border-color: var(--accent-2); }
.zw-badge {
  position: absolute; top: 2px; font-size: 10px; padding: 1px 6px; border-radius: 8px;
}
.zw-badge-ming { background: var(--gold); color: #1a1d29; right: 2px; }
.zw-badge-shen { background: var(--accent-2); color: #fff; left: 2px; }
.zw-badge-zi { background: var(--ok); color: #1a1d29; left: 50%; transform: translateX(-50%); bottom: 2px; }

/* ===== 紫微完整排盘（zwf-*） ===== */
.zwf-warn {
  margin: 10px 0; padding: 9px 12px; font-size: 12.5px; line-height: 1.8;
  background: rgba(245,158,11,.12); border-left: 3px solid #f59e0b; border-radius: 0 6px 6px 0;
}
.zwf-ms { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 2px; }
.zwf-ms-cell { padding: 11px 12px; background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px; }
.zwf-ms-k { font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.zwf-ms-v { font-size: 14px; font-weight: 700; color: var(--gold-2); line-height: 1.5; }
.zwf-board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px;
}
.zwf-palace {
  border: 1px solid var(--border); border-radius: 9px; padding: 7px 7px 8px;
  background: rgba(255,255,255,.025); min-height: 118px;
  display: flex; flex-direction: column;
}
.zwf-palace.is-ming { border-color: var(--gold); background: rgba(212,175,55,.13); box-shadow: 0 0 12px rgba(212,175,55,.22); }
.zwf-palace.is-shen { border-color: var(--accent-2); }
.zwf-p-top { display: flex; align-items: baseline; justify-content: space-between; }
.zwf-p-zhi { font-size: 16px; font-weight: 700; color: var(--text-1); }
.zwf-p-name { font-size: 11px; color: var(--text-2); }
.zwf-p-gz { font-size: 10px; color: var(--text-2); opacity: .8; margin-top: 1px; }
.zwf-p-stars { font-size: 13.5px; font-weight: 700; color: var(--gold-2); margin: 5px 0 3px; line-height: 1.4; min-height: 18px; }
.zwf-empty { color: var(--text-2); font-weight: 400; font-size: 11px; opacity: .7; }
.zwf-p-hua { display: flex; gap: 4px; margin-bottom: 3px; }
.zwf-hua {
  font-size: 10px; font-weight: 700; width: 17px; height: 17px; line-height: 17px;
  text-align: center; border-radius: 50%; color: #1a1d29;
}
.zwf-hua-lu { background: #6fd47f; } .zwf-hua-quan { background: #6aa8ff; }
.zwf-hua-ke { background: #d49fd8; } .zwf-hua-ji { background: #e8786b; color: #fff; }
.zwf-p-fu { font-size: 10px; color: #9fc6e8; line-height: 1.5; }
.zwf-p-za { font-size: 10px; color: var(--text-2); line-height: 1.5; opacity: .85; }
.zwf-p-sha { font-size: 10px; color: #e8908a; line-height: 1.5; }
.zwf-center {
  border: 1px solid var(--border); border-radius: 9px; background: radial-gradient(circle at center, rgba(212,175,55,.12), rgba(0,0,0,.15));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  grid-column: span 2; grid-row: span 2;
}
.zwf-center-tai { font-size: 30px; color: var(--gold); opacity: .85; }
.zwf-center-jv { font-size: 13px; font-weight: 700; color: var(--gold-2); }
.zwf-sihua { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.zwf-sihua-cell { border-radius: 11px; padding: 12px 8px; text-align: center; border: 1px solid var(--border); }
.zwf-sihua-h { font-size: 17px; font-weight: 800; margin-bottom: 5px; }
.zwf-sihua-s { font-size: 14px; font-weight: 700; color: var(--text-1); }
.zwf-sihua-z { font-size: 11px; color: var(--text-2); margin-top: 3px; }
.zwf-sihua-lu { background: rgba(111,212,127,.12); } .zwf-sihua-lu .zwf-sihua-h { color: #6fd47f; }
.zwf-sihua-quan { background: rgba(106,168,255,.12); } .zwf-sihua-quan .zwf-sihua-h { color: #6aa8ff; }
.zwf-sihua-ke { background: rgba(212,159,216,.12); } .zwf-sihua-ke .zwf-sihua-h { color: #d49fd8; }
.zwf-sihua-ji { background: rgba(232,120,107,.12); } .zwf-sihua-ji .zwf-sihua-h { color: #e8786b; }
.zwf-dayun { display: flex; gap: 9px; overflow-x: auto; padding: 10px 2px 6px; }
.zwf-dayun-cell {
  flex: 0 0 auto; min-width: 92px; padding: 10px 9px; text-align: center;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-3);
}
.zwf-dayun-age { font-size: 13px; font-weight: 700; color: var(--gold-2); }
.zwf-dayun-gong { font-size: 13px; color: var(--text-1); margin: 4px 0 1px; }
.zwf-dayun-zhi { font-size: 11px; color: var(--text-2); }
.zwf-luo-t { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 11px 0 6px; }
.zwf-luo-box { display: flex; flex-wrap: wrap; gap: 7px; }
.zwf-luo { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-3); color: var(--text-2); }
.zwf-luo b { color: var(--text-1); }
.zwf-luo.is-fu b { color: #9fc6e8; }
.zwf-luo.is-sha b { color: #e8908a; }
.zwf-luo.is-za b { color: var(--gold-2); }
@media (max-width: 560px) {
  .zwf-sihua { grid-template-columns: repeat(2, 1fr); }
  .zwf-board { gap: 4px; }
  .zwf-palace { padding: 5px; min-height: 104px; }
  .zwf-p-stars { font-size: 12px; }
}

.relation-legend { display: flex; gap: 14px; font-size: 12px; margin: 8px 0; color: var(--text-2); }
.relation-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* 通用统计格子 / 段落小标题（各模块统一复用） */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 10px; margin: 12px 0; }
.stat-cell {
  text-align: center; padding: 12px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: transform .15s, border-color .15s;
}
.stat-cell:hover { transform: translateY(-2px); border-color: rgba(212,175,55,.5); }
.stat-cell .k { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.stat-cell .v { display: block; font-size: 18px; font-weight: 700; color: var(--gold); }
.sub-title { font-weight: 700; font-size: 14px; color: var(--gold-2); margin: 18px 0 8px; padding-left: 10px; border-left: 3px solid var(--gold); }
.hero-result { text-align: center; padding: 20px 0 14px; }
.hero-result .hero-main { font-size: 42px; font-weight: 800; color: var(--gold); line-height: 1.2; text-shadow: 0 0 24px rgba(212,175,55,.35); }
.hero-result .hero-sub { font-size: 13px; color: var(--text-2); margin-top: 8px; }

/* 小六壬六神轮盘 */
.lr-wheel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.lr-cell {
  position: relative; text-align: center; padding: 12px 6px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg);
  opacity: .55; transition: all .2s;
}
.lr-cell .n { font-size: 16px; font-weight: 700; }
.lr-cell .j { font-size: 11px; margin-top: 3px; color: var(--text-2); }
.lr-cell.ji .n { color: var(--ok); }
.lr-cell.xiong .n { color: var(--danger); }
.lr-cell.active {
  opacity: 1; transform: scale(1.06);
  background: linear-gradient(160deg, rgba(212,175,55,.28), rgba(212,175,55,.08));
  border-color: var(--gold);
  box-shadow: 0 0 22px rgba(212,175,55,.45);
}
.lr-cell.active .n { color: var(--gold); text-shadow: 0 0 12px rgba(212,175,55,.5); }
.lr-cell .lr-tag {
  position: absolute; top: -9px; right: -6px;
  background: var(--gold); color: #1a1d29;
  font-size: 10px; font-weight: 700; border-radius: 10px; padding: 2px 7px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* 四柱八字布局 */
.bazi-input-grid {
  display: grid;
  gap: 16px;
}
@media (min-width: 561px) {
  .bazi-input-grid { grid-template-columns: repeat(3, 1fr); }
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.input-group label {
  font-size: 13px;
  color: var(--text-2);
}
.input-group input,
.input-group select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.input-group input:focus,
.input-group select:focus {
  border-color: var(--accent);
}
.bazi-sizhu {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.zhu {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.zhu-label {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.zhu-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--gold);
}
.zhu-value.highlight {
  color: var(--accent-2);
  font-size: 24px;
}

/* 九宫格布局（奇门遁甲） */
.qimen-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.qimen-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  min-height: 80px;
}
.qimen-cell .gong-name {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.qimen-cell .men-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}
.qimen-cell.ji { border-color: var(--ok); }
.qimen-cell.xiong { border-color: var(--danger); }

/* 奇门九宫格内容 */
.qimen-cell .qm-shen { font-size: 11px; margin-bottom: 4px; }
.qimen-cell .qm-star { font-size: 13px; color: var(--text-2); margin-bottom: 2px; }
.qimen-cell .qm-men { font-size: 16px; font-weight: 600; color: var(--gold); }
.qimen-cell.ji .qm-men { color: var(--ok); }
.qimen-cell.xiong .qm-men { color: var(--danger); }
.qimen-cell .qm-gan { font-size: 11px; color: var(--text-2); margin-top: 4px; line-height:1.5; }
.qimen-cell .qm-gan b { color: var(--gold); }
.qimen-cell.qm-kong-cell { opacity: .58; }
.qimen-cell .qm-kongflag { font-size: 10px; color: var(--danger); border:1px solid var(--danger); border-radius:999px; padding:0 5px; margin-left:4px; }
.qm-meta { font-size: 12.5px; line-height: 2; color: var(--text-2); }
.qm-meta b { color: var(--gold); }

/* 六爻纳甲装卦表 */
.liuyao-box {
  margin: 10px 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg);
}
.ly-head { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.ly-jianchen { font-size: 12px; line-height: 1.9; margin-bottom: 8px; }
.ly-kong { color: var(--danger); }
.ly-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ly-table th, .ly-table td {
  border: 1px solid var(--border); padding: 5px 7px; text-align: center; white-space: nowrap;
}
.ly-table th { background: var(--bg-3); color: var(--text-2); font-weight: 600; }
.ly-table .ly-pos { text-align: left; font-weight: 600; }
.ly-table .ly-gz { font-weight: 600; }
.ly-table .ly-gz small { color: var(--text-2); font-weight: 400; margin-left: 2px; }
.ly-row.ly-dong { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.ly-shi, .ly-ying, .ly-tag {
  display: inline-block; font-size: 10.5px; line-height: 1.4; padding: 0 6px;
  border-radius: 999px; margin: 0 2px;
}
.ly-shi { background: var(--gold); color: #1a1d29; }
.ly-ying { border: 1px solid var(--gold); color: var(--gold); }
.ly-tag { border: 1px solid var(--danger); color: var(--danger); }
.ly-mark { font-size: 10.5px; padding: 0 5px; border-radius: 4px; margin-left: 4px; }
.ly-mark.ly-yang { background: var(--ok); color: #10241a; }
.ly-mark.ly-yin { background: var(--danger); color: #fff; }
.ly-bian-title { margin: 10px 0 4px; font-size: 13px; }
.ly-note { font-size: 11px; line-height: 1.7; margin-top: 8px; }

/* 黄历通书 */
.almanac-box { display: flex; flex-direction: column; gap: 10px; }
.al-title { font-size: 15px; font-weight: 700; }
.al-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; font-size: 12.5px; line-height: 1.9; }
.al-grid .al-k { color: var(--text-2); }
.al-yi { color: var(--ok); font-weight: 600; }
.al-ji { color: var(--danger); font-weight: 600; }
.al-sec { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--bg); }
.al-sec h5 { margin: 0 0 6px; font-size: 13px; }
.al-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.al-table th, .al-table td { border: 1px solid var(--border); padding: 4px 6px; text-align: center; }
.al-table th { background: var(--bg-3); color: var(--text-2); }
.al-tags { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; line-height: 1.9; }

/* 二十四山罗盘 */
.luopan-groups { display: flex; flex-direction: column; gap: 8px; }
.luopan-group { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--bg); }
.luopan-group h5 { margin: 0 0 6px; font-size: 13px; }
.shan-row { display: flex; flex-wrap: wrap; gap: 6px; }
.shan-chip {
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font-size: 12px;
  line-height: 1.5; background: var(--bg-3);
}
.shan-chip b { font-size: 14px; color: var(--gold); }

/* 梅花卦爻 */
.gua-yao { display: flex; flex-direction: column; align-items: center; gap: 3px; justify-content: center; }
.yao { width: 34px; height: 4px; border-radius: 2px; display: block; }
.yao.yang { background: var(--gold); }
.yao.yin {
  width: 34px; height: 4px; background: transparent;
  border-top: 4px solid var(--gold);
  border-image: none;
}
.yao.yin { background: repeating-linear-gradient(90deg, var(--gold) 0 13px, transparent 13px 18px, var(--gold) 18px 31px); height: 4px; }

/* 六法对比布局 */
.liufa-compare {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.liufa-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.liufa-name {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.liufa-result {
  font-size: 18px;
  font-weight: 600;
}
.liufa-result.ji { color: var(--ok); }
.liufa-result.xiong { color: var(--danger); }
.liufa-result.zhong { color: var(--text-2); }

/* 六法并列断语行 */
.liufa-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  gap: 12px;
}
.liufa-row > span {
  flex-shrink: 0;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}
.liufa-text {
  font-size: 12px;
  line-height: 1.7;
  margin: 4px 0 8px;
  white-space: pre-wrap;
}
.ji-zhong { color: var(--text-2); }

/* 五格数理标签 */
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
}
.tag-ji { color: var(--ok); background: rgba(52, 199, 89, 0.12); }
.tag-xiong { color: var(--danger); background: rgba(255, 69, 58, 0.12); }
.tag-mid { color: var(--gold); background: rgba(245, 158, 11, 0.12); }

/* 五行四柱三柱时自适应 */
@media (max-width: 560px) {
  .bazi-sizhu { grid-template-columns: repeat(3, 1fr); }
  .liufa-compare { grid-template-columns: repeat(2, 1fr); }
}



.kb-list { max-height: 200px; }

/* 内联样式清理后的辅助类 */
.grow { flex: 1; }
.settings-tip { margin-bottom: 10px; line-height: 1.6; }
.kb-hint { font-size: 11.5px; margin: 6px 0 0; line-height: 1.6; }
.drop-hint { margin: 0; line-height: 1.6; }
.drop-input { margin-top: 8px; }

/* ============ 暗色主题滚动条（功能页 / 消息区 / 弹窗统一） ============ */
#messages::-webkit-scrollbar,
.feature-page::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.kb-list::-webkit-scrollbar,
.conv-list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
#messages::-webkit-scrollbar-track,
.feature-page::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track,
.kb-list::-webkit-scrollbar-track,
.conv-list::-webkit-scrollbar-track {
  background: transparent;
}
#messages::-webkit-scrollbar-thumb,
.feature-page::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb,
.kb-list::-webkit-scrollbar-thumb,
.conv-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(212,175,55,.35), rgba(155,89,182,.35));
  border-radius: 8px;
}
#messages::-webkit-scrollbar-thumb:hover,
.feature-page::-webkit-scrollbar-thumb:hover,
.modal::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(212,175,55,.6), rgba(155,89,182,.6));
}
/* Firefox */
#messages, .feature-page, .modal, .kb-list, .conv-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(212,175,55,.4) transparent;
}

/* ============ 手机窄屏（≤560px）UI 修复 ============ */
@media (max-width: 560px) {
  /* 命主信息弹窗：出生行 年/月/日 同行、时辰独占一行，杜绝横向溢出 */
  #profileModal .setting-row { flex-wrap: wrap; }
  #profileModal .setting-row > span { flex: 0 0 auto; }
  #pfYear, #pfMonth, #pfDay { width: auto !important; flex: 1 1 0; min-width: 0; }
  #pfHour { width: auto !important; flex: 1 1 100%; min-width: 0; }

  /* 弹窗底部按钮区允许换行，避免多按钮挤压 */
  .modal-actions { flex-wrap: wrap; row-gap: 10px; }
  .modal-actions > button { min-height: 40px; }

  /* 功能页输入网格内的输入框不被内容撑破 */
  .bazi-input-grid .input-group { min-width: 0; }
  .bazi-input-grid input, .bazi-input-grid select { min-width: 0; width: 100%; box-sizing: border-box; }

  /* 弹窗内固定宽度的数字输入框统一弹性化（兜底） */
  .modal input[type="number"] { max-width: 100%; }

  /* 聊天气泡：不撑破窄屏，宽表格/代码块横向滚动 */
  .msg { max-width: 100%; }
  .bubble { max-width: 100%; }
  .bubble pre { max-width: 100%; overflow-x: auto; }
  .bubble table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 顶部模型名过长时省略，避免挤压标题 */
  #modelBadge { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ============================================================
   命盘视觉工具包 VKit —— 国风暗色金线（结果页精美化）
   ============================================================ */
/* 命盘横幅 */
.vk-banner {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  margin: -2px -2px 14px; padding: 16px 18px;
  border-radius: 14px 14px 6px 6px;
  background: linear-gradient(120deg, rgba(212,175,55,.16), rgba(155,89,182,.12) 55%, rgba(212,175,55,.06));
  border: 1px solid rgba(212,175,55,.32);
}
.vk-banner-deco {
  position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background-image: radial-gradient(circle at 88% 20%, rgba(230,199,96,.5) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 70%, rgba(230,199,96,.4) 0 2px, transparent 3px);
  background-size: 60px 60px, 44px 44px;
}
.vk-banner-ic {
  font-size: 30px; width: 52px; height: 52px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid rgba(212,175,55,.5);
  background: radial-gradient(circle at 50% 35%, rgba(212,175,55,.28), rgba(155,89,182,.1));
  box-shadow: 0 0 18px rgba(212,175,55,.25);
}
.vk-banner-title { font-size: 18px; font-weight: 700; letter-spacing: 2px; color: var(--gold-2); }
.vk-banner-sub { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* 区块小标题 */
.vk-section-title { font-size: 14px; font-weight: 700; color: var(--gold-2); letter-spacing: 1px;
  margin: 16px 0 4px; padding-left: 10px; border-left: 3px solid var(--gold); }

/* 四柱卡片 */
.vk-pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.vk-pillar {
  position: relative; text-align: center; padding: 12px 6px 10px;
  border-radius: 12px; border: 1px solid rgba(212,175,55,.22);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.vk-pillar:hover { transform: translateY(-3px); border-color: rgba(212,175,55,.55); box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.vk-pillar.is-day { border-color: rgba(230,199,96,.7); background: linear-gradient(180deg, rgba(212,175,55,.16), rgba(155,89,182,.08)); box-shadow: 0 0 16px rgba(212,175,55,.18); }
.vk-p-label { font-size: 11px; letter-spacing: 2px; color: var(--text-2); margin-bottom: 6px; }
.vk-p-ganzhi { display: flex; justify-content: center; gap: 4px; }
.vk-char { font-size: 26px; font-weight: 800; line-height: 1.1; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.vk-nayin { font-size: 10.5px; color: var(--text-2); margin-top: 6px; }
.vk-cang { font-size: 10.5px; color: var(--text-3, #8a80a6); margin-top: 2px; }
.vk-dayflag { position: absolute; top: 6px; right: 6px; font-size: 10px; color: #2a1f45; background: linear-gradient(135deg,var(--gold),var(--gold-2)); padding: 1px 6px; border-radius: 999px; font-weight: 700; }
.vk-mark { position: absolute; top: 6px; left: 6px; font-size: 10px; width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; color: #fff; font-weight: 700; }
.vk-mark.mk-chong { background: #e5534b; }
.vk-mark.mk-he { background: #3fb950; }

/* 五行计数珠 */
.vk-wcounts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 10px 0; }
.vk-wc { text-align: center; padding: 8px 4px; border-radius: 10px; background: var(--bg-3); border-top: 3px solid var(--wc); }
.vk-wc.is-zero { opacity: .42; }
.vk-wc-k { color: var(--wc); font-weight: 700; font-size: 14px; }
.vk-wc-n { font-size: 20px; font-weight: 800; margin-top: 2px; }

/* 五行力量环 */
.vk-wring { display: flex; align-items: center; gap: 18px; margin: 12px 0; flex-wrap: wrap; }
.vk-wring-disc { width: 132px; height: 132px; border-radius: 50%; flex-shrink: 0; position: relative;
  box-shadow: 0 0 22px rgba(212,175,55,.15); }
.vk-wring-core { position: absolute; inset: 16px; border-radius: 50%; background: var(--bg-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid rgba(212,175,55,.25); color: var(--text-2); font-size: 11px; }
.vk-wring-core b { color: var(--gold-2); font-size: 14px; letter-spacing: 2px; }
.vk-wring-leg { flex: 1; min-width: 180px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.vk-wr-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 8px; background: rgba(255,255,255,.03); }
.vk-wr-dot { width: 10px; height: 10px; border-radius: 50%; }
.vk-wr-name { font-size: 13px; }
.vk-wr-val { font-size: 14px; font-weight: 700; color: var(--gold-2); }

/* 紫微十二宫 */
.vk-zw-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.vk-zw-cell { border: 1px solid var(--border); border-radius: 10px; padding: 8px 8px; background: rgba(255,255,255,.025); min-height: 60px; }
.vk-zw-cell.is-hot { border-color: rgba(212,175,55,.6); background: linear-gradient(180deg, rgba(212,175,55,.14), rgba(155,89,182,.06)); }
.vk-zw-name { font-size: 12px; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; }
.vk-zw-mark { font-size: 10px; color: #2a1f45; background: linear-gradient(135deg,var(--gold),var(--gold-2)); border-radius: 999px; padding: 0 6px; font-weight: 700; }
.vk-zw-stars { font-size: 13px; font-weight: 600; color: var(--gold-2); margin-top: 4px; line-height: 1.4; }

/* 卦象 */
.vk-guas { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin: 14px 0; }
.vk-gua-box { text-align: center; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid rgba(212,175,55,.2); }
.vk-gua-name { font-size: 14px; font-weight: 700; color: var(--gold-2); margin-bottom: 4px; }
.vk-gua { display: block; margin: 0 auto; }
.vk-gua-tag { font-size: 11px; color: var(--text-2); margin-top: 4px; letter-spacing: 2px; }

/* 大运时间轴 */
.vk-dayun { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 12px; margin: 8px 0; }
.vk-dy { flex: 0 0 auto; min-width: 78px; text-align: center; padding: 10px 8px; border-radius: 10px;
  background: var(--bg-3); border: 1px solid var(--border); position: relative; }
.vk-dy.is-active { border-color: var(--gold); background: linear-gradient(180deg, rgba(212,175,55,.18), rgba(155,89,182,.08)); box-shadow: 0 0 14px rgba(212,175,55,.2); }
.vk-dy-age { font-size: 11px; color: var(--text-2); }
.vk-dy-gz { font-size: 15px; font-weight: 700; color: var(--gold-2); margin: 4px 0 2px; letter-spacing: 1px; }
.vk-dy-now { font-size: 10px; color: #2a1f45; background: linear-gradient(135deg,var(--gold),var(--gold-2)); border-radius: 999px; padding: 1px 7px; display: inline-block; font-weight: 700; }

/* 运势仪表盘 + 卡 */
.vk-ring { width: 76px; height: 76px; border-radius: 50%; flex-shrink: 0; position: relative; }
.vk-ring-inner { position: absolute; inset: 7px; border-radius: 50%; background: var(--bg-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid rgba(212,175,55,.2); }
.vk-ring-inner b { font-size: 18px; font-weight: 800; line-height: 1; }
.vk-ring-inner span { font-size: 10px; color: var(--text-2); margin-top: 2px; }
.vk-ys-card { margin: 12px 0; padding: 14px; border-radius: 12px; background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015)); border: 1px solid rgba(212,175,55,.2); }
.vk-ys-head { display: flex; align-items: center; gap: 14px; }
.vk-ys-title { flex: 1; }
.vk-ys-title b { font-size: 16px; color: var(--gold-2); letter-spacing: 1px; }
.vk-ys-tag { display: inline-block; margin-left: 8px; font-size: 12px; padding: 1px 10px; border-radius: 999px; border: 1px solid rgba(212,175,55,.4); color: var(--gold-2); }
.vk-ys-sum { font-size: 13.5px; line-height: 1.85; margin: 10px 0 6px; }
.vk-ys-adv { font-size: 12.5px; line-height: 1.9; color: var(--text-2); }

/* 结果卡片整体增强（精致描边/质感） */
.result-card {
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
  border: 1px solid rgba(212,175,55,.22);
  box-shadow: 0 10px 32px rgba(0,0,0,.35);
}
.result-card h4 { letter-spacing: 1px; }

/* 窄屏 */
@media (max-width: 560px) {
  .vk-pillars { gap: 6px; }
  .vk-char { font-size: 21px; }
  .vk-nayin, .vk-cang { font-size: 9.5px; }
  .vk-wring-disc { width: 110px; height: 110px; }
  .vk-wring-leg { min-width: 0; grid-template-columns: repeat(5, 1fr); }
  .vk-banner-title { font-size: 16px; letter-spacing: 1px; }
  .vk-guas { gap: 12px; }
  .vk-zw-grid { grid-template-columns: repeat(3, 1fr); }
  .vk-wring { gap: 12px; }
}
@media (max-width: 380px) {
  .vk-pillars { gap: 4px; }
  .vk-char { font-size: 18px; }
  .vk-pillar { padding: 9px 3px 8px; }
}

/* ============ 姓名卦（三才×八卦五行） ============ */
.vk-nb { margin-top: 14px; border: 1px solid rgba(212,175,55,.22); border-radius: 14px; padding: 14px;
  background: linear-gradient(180deg, rgba(155,89,182,.06), rgba(255,255,255,.02)); }
.vk-nb-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 12px 0; }
.vk-nb-tris { display: flex; align-items: center; gap: 12px; }
.vk-nb-tri { text-align: center; min-width: 64px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(212,175,55,.2); }
.vk-nb-role { font-size: 11px; color: var(--text-2); letter-spacing: 2px; }
.vk-nb-gua { font-size: 30px; font-weight: 800; line-height: 1.15; }
.vk-nb-wx { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.vk-nb-ar { font-size: 20px; color: var(--gold-2); }
.vk-nb-ti { flex: 1; min-width: 200px; font-size: 14px; line-height: 2; }
.vk-nb-sk { font-size: 12.5px; line-height: 1.7; margin-top: 4px; }
.vk-nb-rels { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.vk-nb-rel { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border-radius: 10px; font-size: 12.5px; line-height: 1.6; }
.vk-nb-rel b { font-size: 12px; letter-spacing: 1px; }
.vk-nb-rel.is-good { background: rgba(63,185,80,.1); border: 1px solid rgba(63,185,80,.3); }
.vk-nb-rel.is-good b { color: #6fd47f; }
.vk-nb-rel.is-bad { background: rgba(229,83,75,.08); border: 1px solid rgba(229,83,75,.28); }
.vk-nb-rel.is-bad b { color: #ef8a84; }
.vk-nb-mid { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 12px 0; }
.vk-nb-scorebox { display: flex; align-items: center; gap: 14px; }
.vk-nb-dom { font-size: 13px; line-height: 1.9; }
.vk-nb-dom b { color: var(--gold-2); }
.vk-nb-xi { font-size: 13px; line-height: 1.8; padding: 10px 12px; border-radius: 10px;
  background: rgba(212,175,55,.08); border-left: 3px solid var(--gold); margin: 8px 0; }
.vk-nb-verdict { font-size: 13.5px; line-height: 2; color: var(--text-1); margin: 10px 0; }
.vk-nb-method { font-size: 11px; color: var(--text-3, #8a80a6); margin-top: 8px; }

/* 典籍出处折叠 */
.vk-src { margin-top: 10px; border: 1px dashed rgba(212,175,55,.35); border-radius: 10px; padding: 8px 12px; background: rgba(0,0,0,.15); }
.vk-src summary { cursor: pointer; font-size: 13px; color: var(--gold-2); font-weight: 600; }
.vk-src-item { margin-top: 8px; font-size: 12.5px; line-height: 1.9; }
.vk-src-item b { color: var(--gold-2); }
.vk-src-item p { margin: 2px 0 0; color: var(--text-2); }

/* 保存为图片按钮 */
.vk-save-img { font-size: 12px; padding: 4px 10px; }
.vk-save-img.is-busy { opacity: .6; pointer-events: none; }
@media (max-width: 560px) {
  .vk-nb-rel { grid-template-columns: 1fr; }
  .vk-nb-gua { font-size: 26px; }
}

/* ============ 风水堪舆 ============ */
.fs-root { margin: 4px 0; }
.fs-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px; border-radius: 16px; margin-bottom: 14px;
  border: 1px solid rgba(212,175,55,.3); position: relative; overflow: hidden;
  box-shadow: 0 12px 34px rgba(0,0,0,.4);
}
.fs-hero.fs-east { background: linear-gradient(135deg, rgba(46,120,90,.55), rgba(212,175,55,.18)); }
.fs-hero.fs-west { background: linear-gradient(135deg, rgba(120,74,150,.55), rgba(212,175,55,.18)); }
.fs-hero-tag { font-size: 12px; color: #ffe9b3; letter-spacing: 2px; border: 1px solid rgba(255,233,179,.5); display: inline-block; padding: 2px 10px; border-radius: 999px; }
.fs-hero-title { font-size: 24px; font-weight: 800; letter-spacing: 3px; margin: 8px 0 4px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.4); }
.fs-hero-sub { font-size: 12.5px; color: rgba(255,255,255,.85); }
.fs-hero-gua { width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.25), rgba(255,255,255,.06));
  border: 2px solid rgba(255,233,179,.6); display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 0 18px rgba(212,175,55,.25); }
.fs-hero-big { font-size: 30px; font-weight: 800; color: #ffe9b3; line-height: 1; }
.fs-hero-bigwx { font-size: 11px; color: rgba(255,255,255,.85); margin-top: 2px; }

.fs-card { margin: 12px 0; }
.fs-mg-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0; }
.fs-mg-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid rgba(212,175,55,.15); }
.fs-mg-item span { font-size: 11.5px; color: var(--text-2); }
.fs-mg-item b { font-size: 16px; color: var(--gold-2); }
.fs-zhai-tip { font-size: 13px; line-height: 1.9; margin-top: 6px; }
.fs-zhai-ok { border-left: 3px solid #3fb950; }
.fs-zhai-bad { border-left: 3px solid #e5534b; }

.fs-dir-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0; }
.fs-dir { border-radius: 12px; padding: 10px 12px; border: 1px solid; }
.fs-dir.fs-g { background: rgba(63,185,80,.09); border-color: rgba(63,185,80,.3); }
.fs-dir.fs-b { background: rgba(229,83,75,.08); border-color: rgba(229,83,75,.28); }
.fs-dir-head { display: flex; align-items: center; justify-content: space-between; }
.fs-star { font-size: 15px; font-weight: 800; }
.fs-g .fs-star { color: #6fd47f; }
.fs-b .fs-star { color: #ef8a84; }
.fs-shen { font-size: 11.5px; color: var(--text-2); }
.fs-dir-fang { font-size: 16px; font-weight: 700; margin: 4px 0 2px; color: var(--gold-2); }
.fs-dir-desc { font-size: 11.5px; line-height: 1.6; color: var(--text-2); }

.fs-star-tip { font-size: 12.5px; color: var(--text-2); margin: 8px 0; }
.fs-g-text { color: #6fd47f; }
.fs-b-text { color: #ef8a84; }
.fs-m-text { color: #e6c760; }
.fs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.fs-cell { border-radius: 12px; padding: 10px 8px; text-align: center; border: 1px solid; min-height: 92px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.fs-cell.fs-g { background: linear-gradient(180deg, rgba(63,185,80,.14), rgba(63,185,80,.05)); border-color: rgba(63,185,80,.4); }
.fs-cell.fs-b { background: linear-gradient(180deg, rgba(229,83,75,.12), rgba(229,83,75,.04)); border-color: rgba(229,83,75,.35); }
.fs-cell.fs-m { background: linear-gradient(180deg, rgba(212,175,55,.14), rgba(212,175,55,.05)); border-color: rgba(212,175,55,.4); }
.fs-cell-fang { font-size: 12px; color: var(--text-2); }
.fs-cell-num { font-size: 26px; font-weight: 800; line-height: 1.05; }
.fs-g .fs-cell-num { color: #7fe08f; }
.fs-b .fs-cell-num { color: #f2948e; }
.fs-m .fs-cell-num { color: #ecd079; }
.fs-cell-name { font-size: 12.5px; font-weight: 700; color: var(--gold-2); }
.fs-cell-theme { font-size: 10.5px; color: var(--text-2); }
.fs-dongtu { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.8;
  background: rgba(229,83,75,.08); border: 1px solid rgba(229,83,75,.28); border-left: 3px solid #e5534b; }

.fs-pos-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 8px 0; }
.fs-pos-row:last-child { grid-template-columns: repeat(4, 1fr); }
.fs-pos { border-radius: 10px; padding: 8px 4px; text-align: center; border: 1px solid; display: flex; flex-direction: column; gap: 3px; }
.fs-pos.fs-g { background: rgba(63,185,80,.09); border-color: rgba(63,185,80,.3); }
.fs-pos.fs-b { background: rgba(229,83,75,.08); border-color: rgba(229,83,75,.28); }
.fs-pos-name { font-size: 11.5px; color: var(--text-2); }
.fs-pos-fang { font-size: 14px; font-weight: 700; }
.fs-g .fs-pos-fang { color: #7fe08f; }
.fs-b .fs-pos-fang { color: #f2948e; }

.fs-rooms { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.fs-room { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; background: rgba(255,255,255,.025); }
.fs-room summary { cursor: pointer; font-size: 14px; color: var(--gold-2); }
.fs-room-good { font-size: 12.5px; line-height: 1.85; margin-top: 6px; color: #9fe0ad; }
.fs-room-bad { font-size: 12.5px; line-height: 1.85; color: #ef9a95; }

@media (max-width: 560px) {
  .fs-mg-grid { grid-template-columns: repeat(2, 1fr); }
  .fs-dir-grid { grid-template-columns: 1fr; }
  .fs-pos-row, .fs-pos-row:last-child { grid-template-columns: repeat(2, 1fr); }
  .fs-cell { min-height: 80px; }
  .fs-cell-num { font-size: 22px; }
  .fs-hero-title { font-size: 20px; }
}

/* ============ 五层差异化引擎（四段式） ============ */
.d5-wrap { display: flex; flex-direction: column; gap: 14px; margin: 6px 0; }
.d5-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 4px; }
.d5-actions button { flex: 1; min-width: 120px; padding: 10px 14px; font-size: 13.5px; }
.d5-sec {
  border: 1px solid rgba(212,175,55,.22); border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
  padding: 14px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.22);
}
.d5-sec-h {
  display: flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 700; letter-spacing: 1px; color: var(--gold-2);
  margin-bottom: 10px;
}
.d5-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 23px; height: 23px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #b8862b); color: #1a1430;
  font-size: 13px; font-weight: 800;
}
.d5-gua { background: rgba(0,0,0,.18); border: 1px solid rgba(212,175,55,.25); border-radius: 12px; padding: 14px; }
.d5-gua h4 { margin: 0 0 4px; text-align: center; font-size: 19px; letter-spacing: 1px; color: var(--gold-2); }

/* ② 个人命局 */
.d5-pf-head { font-size: 13.5px; color: var(--text-2); margin-bottom: 8px; }
.d5-pf-head b { color: var(--gold-2); font-size: 15px; }
.d5-lines p { margin: 5px 0; font-size: 13.5px; line-height: 1.9; color: var(--text-1); }

/* ③ 今日气场 */
.d5-sk-tone { font-size: 13.5px; line-height: 1.9; color: var(--text-1); margin-bottom: 9px; }
.d5-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.d5-chips span {
  font-size: 12.5px; padding: 4px 11px; border-radius: 999px;
  background: rgba(212,175,55,.1); border: 1px solid rgba(212,175,55,.28); color: var(--gold-2);
}

/* ④ 结论 + 概率环 */
.d5-conc { display: flex; align-items: center; gap: 16px; margin: 6px 0 10px; }
.d5-conc-body { flex: 1; min-width: 0; }
.d5-level { font-size: 16px; font-weight: 700; color: var(--gold-2); margin-bottom: 3px; }
.d5-conc-body p { margin: 3px 0; font-size: 13px; line-height: 1.8; }
.d5-conc-body p b { color: var(--gold-2); }
.d5-improved { color: #6fd47f !important; }
.d5-xiang { font-size: 13px; line-height: 1.9; color: var(--text-2); margin: 6px 0; }
.d5-advice { margin: 8px 0 2px; padding-left: 2px; list-style: none; }
.d5-advice li {
  position: relative; padding-left: 18px; margin: 5px 0; font-size: 13.5px; line-height: 1.7; color: var(--text-1);
}
.d5-advice li::before {
  content: "☞"; position: absolute; left: 0; top: 0; color: var(--gold); font-size: 12px;
}

/* 概率环 */
.dprob { position: relative; width: 72px; height: 72px; flex: none; }
.dprob svg { transform: rotate(-90deg); }
.dprob-bg { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 6; }
.dprob-fg { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .6s; }
.dprob-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800; color: var(--gold-2);
}
.dprob-num i { font-size: 11px; font-style: normal; margin-left: 1px; }
.dprob-good .dprob-fg { stroke: #46c46a; }
.dprob-good .dprob-num { color: #6fd47f; }
.dprob-ok .dprob-fg { stroke: var(--gold); }
.dprob-mid .dprob-fg { stroke: #c9a85a; }
.dprob-mid .dprob-num { color: #d8c07a; }
.dprob-bad .dprob-fg { stroke: #e07a72; }
.dprob-bad .dprob-num { color: #ef8a84; }

@media (max-width: 560px) {
  .d5-sec { padding: 12px; }
  .d5-conc { gap: 12px; }
  .d5-level { font-size: 15px; }
}

/* ============ 多流派命理并列 + 旺衰三因子 ============ */
.ws-factors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 4px; }
.ws-factor { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg-2); }
.ws-factor-h { font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: 1px; margin-bottom: 6px; }
.ws-factor-big { font-size: 22px; font-weight: 800; letter-spacing: 1px; margin: 2px 0; }
.ws-factor-big.is-ok { color: #6fd47f; text-shadow: 0 0 14px rgba(63,185,80,.3); }
.ws-factor-big.is-warn { color: #e6b85c; }
.ws-factor-sub { font-size: 12.5px; color: var(--gold-2); margin-bottom: 6px; }
.ws-factor-base { font-size: 11.5px; line-height: 1.6; color: var(--text-2); }
.ws-root-list { max-height: 96px; overflow-y: auto; }
.ws-root-item { padding: 1px 0; }
.ws-party-fu { color: #6fd47f; }
.ws-party-xie { color: #ef8a84; }

.schools-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
.school-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg-2);
  transition: border-color .2s, transform .2s; }
.school-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.school-head { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.school-icon { font-size: 16px; }
.school-head b { font-size: 14px; color: var(--gold-2); letter-spacing: 1px; }
.school-book { margin-left: auto; font-size: 10.5px; color: var(--text-2); }
.school-line { font-size: 12.5px; line-height: 1.8; color: var(--text); }
.school-line .is-ok { color: #6fd47f; font-weight: 600; }
.school-line .is-bad { color: #ef8a84; font-weight: 600; }
.school-base { font-size: 11.5px; line-height: 1.65; color: var(--text-2); margin-top: 5px; padding-top: 6px; border-top: 1px dashed var(--border); }

.school-synthesis { border: 1px solid rgba(212,175,55,.4); border-radius: 12px; padding: 11px 14px;
  background: linear-gradient(135deg, rgba(212,175,55,.12), rgba(155,89,182,.06)); }
.school-syn-h { font-size: 13.5px; font-weight: 700; color: var(--gold-2); margin-bottom: 8px; }
.school-syn-xi { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 7px; }
.syn-xi-chip { font-size: 13px; font-weight: 700; color: var(--gold-2); border: 1px solid rgba(212,175,55,.45);
  border-radius: 999px; padding: 3px 13px; background: rgba(212,175,55,.1); }
.syn-xi-chip:first-child { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #241c38; border-color: transparent; }

@media (max-width: 720px) {
  .ws-factors { grid-template-columns: 1fr; }
  .schools-grid { grid-template-columns: 1fr; }
}

/* ============ 分段切换 Tab（姓名页等） ============ */
.seg-tabs { display: flex; gap: 6px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 5px; margin-bottom: 18px; }
.seg-tab { flex: 1; padding: 9px 6px; border: none; border-radius: 9px; background: transparent;
  color: var(--text-dim); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .18s; }
.seg-tab:hover { color: var(--text); }
.seg-tab.active { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #241c38;
  box-shadow: 0 3px 12px rgba(212,175,55,.3); }

/* 五行多选 chips */
.wx-pick { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.wx-chip { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2);
  font-size: 16px; font-weight: 700; color: var(--text-dim); cursor: pointer; transition: all .15s; }
.wx-chip:hover { border-color: var(--gold); }
.wx-chip.on { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #241c38;
  border-color: transparent; box-shadow: 0 2px 10px rgba(212,175,55,.35); }