/* ─────────────────────────────────────────────────────────────────────
   天机 — SPA 容器 app.css
   合并 index / chat / dashboard 为单一 app.html，悬浮玻璃 tab bar。
   ───────────────────────────────────────────────────────────────────── */

/* 视图切换 */
.view {
    animation: fadeView 0.45s var(--ease);
}
.view.hidden { display: none !important; }
.hidden { display: none !important; }

@keyframes fadeView {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 留出 tab bar 空间 */
body:not(.chat-page) { padding-bottom: 96px; }

/* chat 页因为 100vh + flex，输入栏需要内部留白 */
body.chat-page .chat-input { padding-bottom: 96px; }

/* ─── 悬浮 tab bar ───────────────────────────────────────── */

.locale-switch {
    position: fixed;
    right: 18px;
    bottom: 20px;
    z-index: 140;
    min-height: 34px;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 999px;
    color: var(--text-muted, #929aaf);
    background: rgba(10, 14, 26, 0.86);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    font: 500 12px/1.2 var(--font-sans, sans-serif);
    letter-spacing: 0.04em;
    cursor: pointer;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.locale-switch:hover,
.locale-switch:focus-visible {
    border-color: rgba(212, 175, 55, 0.6);
    color: var(--gold-bright, #f4d03f);
}

.tab-bar {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 4px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(15, 18, 30, 0.85);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255,255,255,0.02) inset,
        0 0 30px rgba(0, 212, 255, 0.06);
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 13px;
    font-family: var(--font-zh-display);
    letter-spacing: 0.2em;
    transition: all 0.25s var(--ease);
    cursor: pointer;
    white-space: nowrap;
}
.tab svg { width: 16px; height: 16px; opacity: 0.7; transition: opacity 0.2s; }
.tab:hover { color: var(--text); }
.tab:hover svg { opacity: 1; }

.tab.active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(212, 175, 55, 0.12) 100%);
    color: var(--gold-bright);
    box-shadow:
        0 0 16px rgba(212, 175, 55, 0.25),
        0 0 0 1px rgba(212, 175, 55, 0.3) inset;
}
.tab.active svg { opacity: 1; }

/* tab bar 的色调随当前视图主调微调 */
body.chat-page .tab.active {
    background: linear-gradient(135deg, rgba(92, 184, 138, 0.25) 0%, rgba(92, 184, 138, 0.12) 100%);
    color: var(--jade-bright);
    box-shadow: 0 0 16px rgba(92,184,138,0.25), 0 0 0 1px rgba(92,184,138,0.3) inset;
}
body.dashboard-page .tab.active {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.22) 0%, rgba(212, 175, 55, 0.18) 100%);
    color: var(--gold-bright);
    box-shadow: 0 0 16px rgba(231,76,60,0.2), 0 0 0 1px rgba(212,175,55,0.3) inset;
}

@media (max-width: 480px) {
    .locale-switch { right: 12px; bottom: 78px; }
    .tab-bar { gap: 2px; padding: 5px; }
    .tab { padding: 9px 14px; font-size: 12px; letter-spacing: 0.15em; gap: 6px; }
    .tab svg { width: 14px; height: 14px; }
}

/* ─── 取消原 chat / dashboard 顶部「← 返回」（tab bar 接管导航）─ */
.view-chat .chat-back,
.view-dashboard .dash-back { display: none; }

/* chat / dashboard 顶部 nav 在 SPA 中减薄但保留内边距（padding:0 会让
   左右两端的品牌与状态文字贴边被裁切 —— ai/report/pay 页均受影响） */
body.chat-page .chat-nav,
body.dashboard-page .dash-nav { padding: 10px 18px; }
body.chat-page .chat-nav .nav-back-spacer,
body.dashboard-page .dash-nav .nav-back-spacer { display: block; width: 0; }

/* ─── 普通版命盘概览 / 专业版 AI 闸门 ───────────────────── */

.report-shell {
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 20px 120px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.view-report { flex: 1; min-height: 0; overflow-y: auto; }
.view-report .chat-nav { position: sticky; top: 0; z-index: 8; }
@media (max-width: 900px) { .view-report { overflow: visible; } }

.report-hint {
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.8;
    margin: 4px 0 16px;
}
.report-hint strong { color: var(--gold-bright); }

.report-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.report-fields label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
}
.report-fields input,
.report-fields select {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(10, 14, 26, 0.7);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.report-fields input:focus,
.report-fields select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-glow);
}

.report-status { margin-left: 12px; color: var(--text-muted); }

/* 排盘文本 —— 等宽以保持脚本的列对齐；横向可滚 */
.report-output {
    margin: 4px 0 0;
    padding: 16px;
    border-radius: 12px;
    background: rgba(6, 8, 16, 0.85);
    border: 1px solid rgba(255,255,255,0.08);
    color: #d3dae8;
    font-family: "SFMono-Regular", "Menlo", "Consolas", "Noto Sans Mono CJK SC", monospace;
    font-size: 12.5px;
    line-height: 1.6;
    white-space: pre;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.report-upsell {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--text-muted);
    font-size: 13px;
}

/* 专业版 AI 闸门卡片 —— 居中 */
.gate-card {
    max-width: 560px;
    margin: 8vh auto 0;
    text-align: center;
    padding: 0 20px;
}
.gate-card .taichi-large { margin: 0 auto 24px; }

/* 导航账号区 */
.nav-account {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
    margin-right: 18px;
}
.nav-account .acct-link {
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 0.06em;
    transition: color 0.2s;
}
.nav-account .acct-link:hover { color: var(--gold); }
.acct-logout { display: inline; margin: 0; }
.acct-logout .acct-link {
    border: 0;
    padding: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}
.acct-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 13px;
}
.acct-tier {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    background: rgba(139,147,167,0.18);
    color: var(--text-muted);
}
.acct-tier.paid {
    background: rgba(212,175,55,0.18);
    color: var(--gold-bright);
}

@media (max-width: 640px) {
    .nav-account { margin-right: 8px; gap: 10px; }
}

/* ═══ 命盘专业版：输入表单 · 四柱表 · 大运流年 · 分方面解读 ═══════════ */

/* 五行配色（文字/填充）—— 与站点通用约定一致 */
.c-wood  { color: #5cb88a; }
.c-fire  { color: #e74c3c; }
.c-earth { color: #d4af37; }
.c-metal { color: #c0c8d4; }
.c-water { color: #4dd0e1; }
.f-wood  { background: #5cb88a; }
.f-fire  { background: #e74c3c; }
.f-earth { background: #d4af37; }
.f-metal { background: #c0c8d4; }
.f-water { background: #4dd0e1; }

/* ── 输入表单 ── */
.rpt-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.grow { flex: 1 1 220px; }
.field-label { font-size: 12px; color: var(--text-muted); letter-spacing: 0.08em; }
.field-label i {
    margin-left: 5px; padding: 1px 6px; border-radius: 999px;
    color: var(--text-dim); background: rgba(255,255,255,.05);
    font-size: 9px; font-style: normal; letter-spacing: .04em;
}
.case-name-field {
    display: flex; flex-direction: column; gap: 7px;
    margin-top: 15px; padding: 14px; border-radius: 13px;
    border: 1px solid rgba(212,175,55,.14);
    background: linear-gradient(135deg, rgba(212,175,55,.055), rgba(92,184,138,.025));
}
.case-name-field input {
    width: 100%; padding: 11px 13px; border-radius: 10px;
    border: 1px solid rgba(255,255,255,.11);
    color: var(--text); background: rgba(10,14,26,.72);
    font-size: 14px; font-family: inherit;
}
.case-name-field input:disabled { opacity: .58; cursor: not-allowed; }
.case-name-field small { color: var(--text-dim); font-size: 10.5px; line-height: 1.5; }
.case-name-field small a { color: var(--gold-bright); }
.report-form-card input[type="date"],
.report-form-card select {
    padding: 10px 12px; border-radius: 10px;
    background: rgba(10,14,26,0.7); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text); font-size: 14px; font-family: inherit;
}
.report-form-card input:focus, .report-form-card select:focus {
    outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-glow);
}
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: rgba(10,14,26,0.7); border: 1px solid rgba(255,255,255,0.1); }
.seg-btn { padding: 8px 16px; border-radius: 8px; color: var(--text-muted); font-size: 13px; font-family: inherit; cursor: pointer; transition: all .2s; white-space: nowrap; }
.seg-btn.active { background: linear-gradient(135deg, rgba(212,175,55,0.28), rgba(212,175,55,0.14)); color: var(--gold-bright); }
.leap-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); align-self: flex-end; padding-bottom: 10px; }
.rpt-actions { margin-top: 20px; display: flex; align-items: center; gap: 12px; }
.report-note { margin-top: 12px; color: var(--text-dim); }

/* 登录用户的命例收藏 */
.saved-cases-card { overflow: hidden; }
.saved-cases-head { align-items: center; }
.saved-cases-count {
    margin-left: auto; padding: 3px 9px; border-radius: 999px;
    border: 1px solid rgba(92,184,138,.2);
    color: var(--jade-bright); background: rgba(92,184,138,.07);
    font-size: 10.5px;
}
.saved-cases-list {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.saved-case-row {
    min-width: 0; display: flex; align-items: stretch; border-radius: 13px;
    border: 1px solid rgba(255,255,255,.075);
    background: rgba(255,255,255,.025);
    transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.saved-case-row:hover {
    border-color: rgba(212,175,55,.25);
    background: rgba(212,175,55,.045); transform: translateY(-1px);
}
.saved-case-open {
    min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px;
    padding: 13px 10px 13px 14px; text-align: left;
}
.saved-case-heading { display: flex; align-items: center; gap: 7px; min-width: 0; }
.saved-case-heading strong {
    min-width: 0; overflow: hidden; color: var(--text);
    font-family: var(--font-zh-display); font-size: 14px; font-weight: 600;
    text-overflow: ellipsis; white-space: nowrap;
}
.saved-case-gender {
    flex: 0 0 auto; padding: 1px 6px; border-radius: 999px;
    color: var(--text-muted); background: rgba(255,255,255,.055); font-size: 9px;
}
.saved-case-pillars {
    overflow: hidden; color: var(--gold-bright);
    font-family: var(--font-zh-display); font-size: 13px; letter-spacing: .12em;
    text-overflow: ellipsis; white-space: nowrap;
}
.saved-case-meta {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-dim); font-size: 9.5px;
}
.saved-case-meta time { margin-left: auto; }
.saved-case-delete {
    align-self: center; flex: 0 0 auto; margin-right: 8px; padding: 6px;
    border-radius: 7px; color: var(--text-dim); font-size: 10px; opacity: 0;
    transition: opacity .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.saved-case-row:hover .saved-case-delete,
.saved-case-row:focus-within .saved-case-delete { opacity: 1; }
.saved-case-delete:hover { color: #f0a094; background: rgba(192,57,43,.12); }
.saved-cases-empty {
    grid-column: 1 / -1; min-height: 120px;
    display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px;
    padding: 24px; border: 1px dashed rgba(255,255,255,.09); border-radius: 13px;
    color: var(--text-dim); text-align: center; font-size: 11.5px;
}
.saved-cases-empty strong {
    color: var(--text-muted); font-family: var(--font-zh-display); font-size: 14px;
}
.saved-cases-empty a { margin-top: 4px; color: var(--gold-bright); }
@media (max-width: 640px) {
    .saved-cases-list { grid-template-columns: 1fr; }
    .saved-case-delete { opacity: 1; }
    .case-name-field { padding: 12px; }
}

/* 四柱反查 */
.sizhu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0; }
.sizhu-col { display: flex; flex-direction: column; gap: 8px; text-align: center; }
.sizhu-col .field-label { text-align: center; }
.sizhu-col select {
    padding: 10px 8px; border-radius: 10px; text-align: center; text-align-last: center;
    background: rgba(10,14,26,0.7); border: 1px solid rgba(255,255,255,0.1);
    color: var(--gold-bright); font-family: var(--font-zh-display, serif); font-size: 18px;
}
.sizhu-col select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-glow); }
.sizhu-candidates { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.sizhu-candidates .cand {
    padding: 9px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; font-family: inherit;
    background: rgba(212,175,55,0.1); border: 1px solid rgba(212,175,55,0.3); color: var(--gold-bright); transition: all .2s;
}
.sizhu-candidates .cand:hover { background: rgba(212,175,55,0.2); box-shadow: 0 0 16px var(--gold-glow); }
@media (max-width: 480px) { .sizhu-grid { gap: 8px; } .sizhu-col select { font-size: 16px; padding: 8px 4px; } }

/* 出生地可搜索下拉 */
.city-combo { position: relative; }
.city-combo input {
    padding: 10px 12px; border-radius: 10px; width: 100%;
    background: rgba(10,14,26,0.7); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text); font-size: 14px; font-family: inherit;
}
.city-combo input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-glow); }
.city-list {
    position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
    max-height: 260px; overflow-y: auto; padding: 6px;
    background: rgba(15,18,30,0.98); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.55); -webkit-overflow-scrolling: touch;
}
.city-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--text); cursor: pointer;
}
.city-item:hover { background: rgba(212,175,55,0.14); }
.city-item .city-lng { color: var(--text-dim); font-size: 12px; flex: 0 0 auto; }
.city-empty { padding: 12px; color: var(--text-dim); font-size: 13px; text-align: center; }

/* ── 信息条 ── */
.chart-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 16px 20px; margin-bottom: 4px;
    border-radius: 14px; background: rgba(20,26,46,0.55); border: 1px solid rgba(255,255,255,0.07); }
.case-result-name {
    max-width: 180px; overflow: hidden; padding: 4px 10px; border-radius: 999px;
    border: 1px solid rgba(92,184,138,.23);
    color: var(--jade-bright); background: rgba(92,184,138,.08);
    font-family: var(--font-zh-display); font-size: 12px;
    text-overflow: ellipsis; white-space: nowrap;
}
.meta-title { font-family: var(--font-zh-display, serif); font-size: 18px; color: var(--gold-bright); letter-spacing: 0.1em; margin-right: 6px; }
.meta-cell { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; }
.meta-cell .mk { color: var(--text-dim); }
.meta-cell .mv { color: var(--text); }

.chart-card { margin-top: 4px; }

/* ── 六柱表（流年·大运·年·月·日·时）── */
.pillar-table-wrap { overflow-x: auto; }
.pillar-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 560px; text-align: center; }
.pillar-table th, .pillar-table td { padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.pillar-table tr td:first-child, .pillar-table tr th:first-child { }
.pillar-table thead th { color: var(--text-muted); font-size: 13px; letter-spacing: 0.06em; font-weight: 600; padding-bottom: 10px; }
.pillar-table th .colsub { display: block; font-size: 10px; color: var(--text-dim); font-weight: 400; letter-spacing: 0; margin-top: 3px; }
.pillar-table .rowlab { width: 46px; color: var(--text-dim); font-size: 12px; font-weight: 500; text-align: right; padding-right: 12px; white-space: nowrap; }
/* 流年 / 大运 两列：淡金底 + 与本命四柱分隔 */
.pillar-table th.dyn, .pillar-table td.dyn { background: rgba(212,175,55,0.055); }
.pillar-table th.dyn { color: var(--gold); }
.pillar-table td:nth-child(4), .pillar-table th:nth-child(4) { border-left: 1px solid rgba(255,255,255,0.13); }
.pillar-table td.tg { color: var(--gold); font-size: 13.5px; }
.pillar-table td.dyn.tg .tg, .pillar-table td.dyn .tg { color: var(--gold-bright); }
.pillar-table .ch { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 11px;
    font-family: var(--font-zh-display, serif); font-size: 27px; line-height: 1; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); }
.pillar-table .hidden-cell { line-height: 1.45; }
.pillar-table .hd { display: block; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.pillar-table .hd i { font-style: normal; margin-right: 3px; font-size: 12.5px; }
.pillar-table td.sm { font-size: 12px; color: var(--text-muted); }
.pillar-table .kong { color: var(--cinnabar-bright); font-size: 12px; }

/* ── 五行条 ── */
.wuxing-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.06); }
.wx-item { display: flex; align-items: center; gap: 8px; }
.wx-name { font-family: var(--font-zh-display, serif); font-size: 17px; }
.wx-track { flex: 1; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.wx-fill { height: 100%; border-radius: 999px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.wx-num { font-size: 13px; color: var(--text-muted); min-width: 14px; text-align: right; }
@media (max-width: 560px) { .wuxing-bar { grid-template-columns: repeat(2, 1fr); } }

/* ── 大运/流年时间轴 ── */
.timeline-label { font-size: 12px; color: var(--text-muted); letter-spacing: 0.06em; margin: 14px 0 8px; }
.timeline { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.tl-chip { flex: 0 0 auto; min-width: 68px; padding: 8px 10px; border-radius: 12px; text-align: center; cursor: pointer;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); transition: all .2s; font-family: inherit; }
.tl-chip.ln { cursor: default; }
.tl-chip:hover { border-color: rgba(212,175,55,0.4); }
.tl-chip.active { background: linear-gradient(135deg, rgba(212,175,55,0.22), rgba(212,175,55,0.1)); border-color: rgba(212,175,55,0.5); }
.tl-chip.current { box-shadow: 0 0 0 1px var(--jade-bright) inset; }
.tl-age { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.tl-gz { font-family: var(--font-zh-display, serif); font-size: 22px; line-height: 1.15; margin: 3px 0; letter-spacing: 2px; }
.tl-god { font-size: 11px; color: var(--text-muted); }
.tl-chip.xiaoyun .tl-gz { font-size: 16px; color: var(--text-muted); letter-spacing: 1px; }

/* ── 分方面解读（装饰卡片，充满右栏）── */
.reading-tabs { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 16px; flex: 0 0 auto; }
.rtab { padding: 9px 16px; border-radius: 999px; font-size: 14.5px; color: var(--text-muted); cursor: pointer; font-family: inherit;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); transition: all .2s; }
.rtab.active { background: linear-gradient(135deg, rgba(92,184,138,0.22), rgba(92,184,138,0.1)); color: var(--jade-bright); border-color: rgba(92,184,138,0.4); }
.rtab-ic { margin-right: 6px; }
.rtab-n { margin-left: 7px; font-size: 12px; opacity: 0.7; }
.reading-body { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; flex: 1 1 auto; min-height: 0; padding-right: 6px; }
.reading-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.08); flex: 0 0 auto; }
.reading-ic { font-size: 22px; }
.reading-title { font-family: var(--font-zh-display, serif); font-size: 20px; color: var(--gold-bright); letter-spacing: 0.06em; }
.reading-count { margin-left: auto; font-size: 13px; color: var(--text-dim); }
.reading-item { display: flex; gap: 13px; align-items: flex-start; padding: 16px 18px; border-radius: 14px;
    background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.07); }
.reading-item .ri-num { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; margin-top: 1px;
    background: rgba(212,175,55,0.16); color: var(--gold-bright); font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; }
.reading-item p { margin: 0; flex: 1; color: var(--text); font-size: 16px; line-height: 1.95; letter-spacing: 0.02em; }
.ri-weight { flex: 0 0 auto; align-self: flex-start; margin-top: 2px; font-size: 11px; color: var(--jade-bright);
    background: rgba(92,184,138,0.12); border: 1px solid rgba(92,184,138,0.25); border-radius: 999px; padding: 1px 8px; }
.reading-empty { color: var(--text-dim); font-size: 14px; padding: 4px 2px; }
/* 术语 / 古籍：折叠、降权，保留不删 */
.reading-terms { margin-top: 12px; border-top: 1px dashed rgba(255,255,255,0.1); padding-top: 10px; }
.reading-terms summary { cursor: pointer; color: var(--text-muted); font-size: 13px; padding: 4px 0; }
.reading-terms summary:hover { color: var(--gold); }
.reading-terms[open] summary { margin-bottom: 8px; }
.reading-terms .reading-item { margin-bottom: 8px; background: rgba(255,255,255,0.02); }
.reading-item.term p { font-size: 14px; color: var(--text-muted); }
.reading-item.term .ri-num { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.report-fulltext { margin-top: 18px; padding-top: 14px; border-top: 1px dashed rgba(255,255,255,0.1); }
.report-fulltext summary { cursor: pointer; color: var(--text-muted); font-size: 13px; }
.report-fulltext summary:hover { color: var(--gold); }
.report-fulltext .report-output { margin-top: 12px; }

/* ═══ 命盘结果页：左盘右解 · 两栏 · 右下 AI 入口 ═══════════════════════ */
body.result-page { padding-bottom: 0; }

/* 固定占满视口：保证两栏被限定在一屏内、卡片撑满、内部再滚动 */
.view-result { position: fixed; inset: 0; height: 100vh; display: flex; flex-direction: column; animation: none; z-index: 5; }
/* 结果页为沉浸阅读页：隐藏悬浮 tab bar（顶部「重新排盘」返回），把整屏留给盘面与解读 */
body.result-page .tab-bar { display: none; }
.view-result .chat-nav {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 12px 22px; border-bottom: 1px solid rgba(255,255,255,0.06); flex: 0 0 auto;
}
.result-back {
    display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
    padding: 8px 14px; border-radius: 999px; font-size: 13px; color: var(--text-muted);
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); transition: all .2s;
}
.result-back:hover { color: var(--gold); border-color: rgba(212,175,55,0.4); }

/* 顶栏信息条：水平紧凑 */
.view-result .chart-meta {
    flex: 1 1 auto; margin: 0; padding: 8px 14px; gap: 6px 16px;
    background: transparent; border: none;
}
.view-result .meta-cell { font-size: 12.5px; }

/* 两栏主体，各自独立滚动；窄屏堆叠 */
.chart-layout {
    flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 18px; padding: 16px 22px 0; overflow: hidden;
}
.readings-card .card-title { font-size: 20px; }
/* 左栏：卡片不被压缩（避免藏干与大运重叠）；末卡撑满剩余高度；整体滚动 */
.chart-left { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding-right: 6px; padding-bottom: 20px; }
.chart-left > .chart-card { flex: 0 0 auto; }
.chart-left > .chart-card:last-child { flex: 1 0 auto; }
/* 右栏：解读卡尽量撑高（少滚动）；AI 面板做成底部紧凑条 */
.chart-right { min-height: 0; display: flex; flex-direction: column; gap: 12px; padding-bottom: 20px; overflow: hidden; }
.readings-card { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }

/* AI 入口：明亮紧凑横条，落在右栏底部（未开发亦占位）*/
.ai-cta-panel {
    flex: 0 0 auto; border-radius: 16px; padding: 14px 20px;
    background: linear-gradient(135deg, #f6f1e5 0%, #efe6cf 100%);
    box-shadow: 0 8px 28px rgba(0,0,0,0.38);
    display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 16px;
}
.ai-cta-copy { min-width: 0; }
.ai-cta-title { font-family: var(--font-zh-display, serif); font-size: 17px; color: #6b4e0e; letter-spacing: 0.06em; }
.ai-cta-copy p { margin-top: 3px; font-size: 12.5px; line-height: 1.55; color: #6f6552; }
.ai-cta-btn {
    flex: 0 0 auto; padding: 11px 20px; border-radius: 999px; font-size: 13.5px; white-space: nowrap;
    background: linear-gradient(135deg, #1a1410 0%, #2c2417 100%); color: var(--gold-bright);
    border: 1px solid rgba(107,78,14,0.4);
}
.ai-cta-btn:hover { box-shadow: 0 0 24px rgba(212,175,55,0.35); }

@media (max-width: 900px) {
    /* 手机：解锁 chat-page 的整屏锁定（height:100vh + overflow:hidden 会裁掉命盘下方内容），
       让页面随内容正常滚动 */
    body.chat-page { height: auto; min-height: 100vh; overflow: visible; display: block; }

    /* 结果页回到正常文档流并随页面滚动（桌面是 fixed 一屏两栏，手机会裁切/重叠）*/
    .view-result { position: static; inset: auto; height: auto; min-height: 0; display: block; animation: none; }
    /* 顶栏信息条吸顶，「重新排盘」始终可点 */
    .view-result .chat-nav { position: sticky; top: 0; z-index: 6; background: var(--bg-deep, #0a0e1a); padding: 10px 14px; }

    /* 两栏 → 单列堆叠，各卡片自然高度 */
    .chart-layout { display: block; padding: 12px 14px 100px; overflow: visible; }
    .chart-left, .chart-right { display: block; overflow: visible; min-height: 0; padding: 0; }
    .chart-left > .chart-card, .chart-left > .chart-card:last-child { flex: none; }
    .chart-left > .chart-card { margin-bottom: 14px; }
    .readings-card { flex: none; min-height: 0; margin-top: 14px; }
    .reading-body { overflow: visible; flex: none; min-height: 0; }
    .ai-cta-panel { margin-top: 14px; }

    /* 结果页始终隐藏悬浮 tab bar（用顶部「重新排盘」返回），避免与 AI 面板重叠 */
    body.result-page { padding-bottom: 0; }

    /* 六柱表在窄屏压缩以完整显示六列（不再横向裁切）*/
    .pillar-table-wrap { -webkit-overflow-scrolling: touch; }
    .pillar-table { min-width: 0; width: 100%; }
    .pillar-table th, .pillar-table td { padding: 5px 2px; }
    .pillar-table .rowlab { width: 30px; padding-right: 5px; font-size: 10.5px; }
    .pillar-table thead th { font-size: 12px; letter-spacing: 0; }
    .pillar-table th .colsub { font-size: 8.5px; }
    .pillar-table .ch { width: 29px; height: 29px; font-size: 20px; border-radius: 8px; }
    .pillar-table td.tg { font-size: 11.5px; }
    .pillar-table .hd { font-size: 10px; }
    .pillar-table .hd i { font-size: 11px; margin-right: 2px; }
    .pillar-table td.sm { font-size: 10.5px; }
    .pillar-table .kong { font-size: 10.5px; }
    .pillar-table td:nth-child(4), .pillar-table th:nth-child(4) { border-left-width: 1px; }

    /* AI 面板窄屏竖排更稳 */
    .ai-cta-panel { flex-direction: column; align-items: stretch; }
    .ai-cta-btn { align-self: flex-start; }
}

/* ═══ 专业版 AI 解读（追问式对话） ════════════════════════════════════ */

/* 桌面：AI 视图占满视口高度，形成 顶栏 / 滚动对话区 / 钉底输入栏 三段式。
   否则 chat-shell 的 flex:1 无高度可撑，输入栏会塌到内容高度、悬在页面中部。
   手机端由下方 @media(max-width:900px) 覆盖为文档流 + sticky 输入。 */
.view-ai { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* 对话中的 AI 头像（太极）保持静止，不旋转 */
.taichi-small svg .yin-yang { animation: none; }

.ai-gate { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.ai-gate .gate-card { max-width: 480px; }

/* 追问 / 结论 徽标 */
.probe-badge {
    display: inline-block; margin-bottom: 8px; padding: 2px 10px; border-radius: 999px;
    font-size: 11.5px; letter-spacing: 0.08em; color: var(--gold-bright);
    background: rgba(212,175,55,0.14); border: 1px solid rgba(212,175,55,0.3);
}
.probe-badge.final { color: var(--jade-bright); background: rgba(92,184,138,0.14); border-color: rgba(92,184,138,0.35); }

.probe-response { margin-bottom: 10px; }
.probe-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.probe-answer {
    min-height: 44px; border: 1px solid rgba(212,175,55,0.35); border-radius: 12px;
    background: rgba(255,255,255,0.04); color: var(--text-primary, #f4f0e6);
    font-size: 16px; font-weight: 600; cursor: pointer;
}
.probe-answer:hover:not(:disabled) { border-color: var(--gold-bright); background: rgba(212,175,55,0.12); }
.probe-answer.yes { border-color: rgba(92,184,138,0.5); }
.probe-answer.yes:hover:not(:disabled) { background: rgba(92,184,138,0.14); }
.probe-answer:disabled { opacity: 0.45; cursor: default; }
.probe-detail-label { margin: 10px 2px 6px; font-size: 12px; color: var(--text-muted, rgba(255,255,255,0.58)); }
.msg-ai .msg-text { line-height: 1.9; letter-spacing: 0.02em; }

/* ═══ 开通专业版（#/pay · Stripe Checkout）══════════════════════════ */
.view-pay { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pay-shell { flex: 1; overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 24px 20px 120px; }
.pay-stage { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 560px; }
/* translateZ(0)：Safari 在模糊光晕（filter/blur 图层）附近会漏画文字与按钮，
   悬停才被迫重绘（「按钮只有指上去才出现」）。提升为独立合成层根治。 */
.pay-stage .gate-card { margin: 0; width: 100%; transform: translateZ(0); }
.view-pay { animation: none; }  /* fadeView 动画在 Safari 上会遗留掉画状态 */
/* 首页罗盘缩小版 */
.pay-compass { width: 200px; height: 200px; flex-shrink: 0; margin-bottom: 6px; }
.pay-compass .luopan { max-width: 200px; max-height: 200px; }
.pay-title {
    font-family: var(--font-zh-display);
    font-size: 27px; color: var(--text); letter-spacing: 0.16em;
    margin: 10px 0 10px;
}
.pay-sub { color: var(--text-muted); font-size: 14.5px; line-height: 1.8; margin: 0 auto 10px; max-width: 460px; }
.pay-price { margin: 14px 0 6px; font-size: 20px; color: var(--gold-bright); }
.pay-price b { font-size: 44px; font-weight: 700; letter-spacing: 0.02em; }
.pay-once { display: block; margin-top: 4px; font-size: 12.5px; color: var(--text-muted); letter-spacing: 0.1em; }
.pay-features { margin: 16px auto 0; padding: 0; max-width: 340px; list-style: none; text-align: left; }
.pay-features li { position: relative; padding-left: 20px; margin-bottom: 9px; font-size: 14px; line-height: 1.7; color: var(--text); }
.pay-features li::before { content: "◆"; position: absolute; left: 2px; top: 3px; font-size: 10px; color: var(--jade-bright); }

/* 普通版 vs 专业版对比 —— 促成转化 */
.pay-compare { margin: 18px auto 0; max-width: 420px; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.pay-tier { border: 1px solid var(--stroke); border-radius: 14px; padding: 12px 14px; }
.pay-tier.free { opacity: 0.72; }
.pay-tier.paid { border-color: rgba(212,175,55,0.45); background: rgba(212,175,55,0.06); box-shadow: 0 0 24px rgba(212,175,55,0.08); }
.pay-tier-label { font-family: var(--font-zh-display); font-size: 12.5px; letter-spacing: 0.12em; margin-bottom: 8px; }
.pay-tier.free .pay-tier-label { color: var(--text-muted); }
.pay-tier.paid .pay-tier-label { color: var(--gold-bright); }
.pay-tier ul { margin: 0; padding: 0; list-style: none; }
.pay-tier li { position: relative; padding-left: 20px; margin-bottom: 7px; font-size: 13.5px; line-height: 1.65; color: var(--text); }
.pay-tier li:last-child { margin-bottom: 0; }
.pay-tier li b { color: var(--gold-bright); font-weight: 600; }
.pay-tier.free li::before { content: "·"; position: absolute; left: 6px; top: 0; color: var(--text-muted); }
.pay-tier.paid li::before { content: "✦"; position: absolute; left: 2px; top: 2px; font-size: 10px; color: var(--jade-bright); }
.pay-note { margin-top: 16px; font-size: 12px; color: var(--text-muted); }
.pay-note a { color: var(--text-muted); text-decoration: underline; }
.pay-note a:hover { color: var(--gold); }
.pay-msg { margin-top: 12px; font-size: 13px; color: #e0b46a; }
@media (max-width: 900px) {
    .pay-shell { align-items: flex-start; padding-top: 4vh; }
    .pay-compass { width: 150px; height: 150px; }
    .pay-compass .luopan { max-width: 150px; max-height: 150px; }
    .pay-title { font-size: 23px; }
}

/* 断语体解读：加粗结论 + 淡色推理引用 + 维度小标题 */
.msg-text.reading { line-height: 1.9; }
.rd-dim { margin: 18px 0 9px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.14em; color: var(--gold-bright); }
.rd-dim:first-child { margin-top: 0; }
.rd-item { position: relative; padding-left: 17px; margin: 0 0 11px; line-height: 1.85; }
.rd-item::before { content: "◆"; position: absolute; left: 0; top: 3px; font-size: 9px; color: var(--jade-bright); }
.rd-item strong, .msg-text.reading strong { color: var(--text); font-weight: 700; }
.rd-ref { color: var(--text-muted); font-size: 0.85em; letter-spacing: 0; }
.rd-p { margin: 0 0 11px; line-height: 1.85; }
.rd-p:last-child, .rd-item:last-child { margin-bottom: 0; }

/* 建议列表 */
.advice-title { margin: 14px 0 6px; font-size: 13px; color: var(--gold-bright); letter-spacing: 0.06em; }
ul.advice { margin: 0; padding-left: 4px; list-style: none; }
ul.advice li { position: relative; padding-left: 18px; margin-bottom: 6px; line-height: 1.75; font-size: 14px; }
ul.advice li::before { content: "◆"; position: absolute; left: 0; top: 1px; font-size: 10px; color: var(--jade-bright); }

/* 命盘 chip 上的「换盘」 */
.pin-change { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.pin-change:hover { color: var(--gold); }
#aiPin { display: flex; align-items: center; gap: 10px; }

/* ═══ AI 工作区：历史 · 命盘 · 对话 ═════════════════════════════════ */
.ai-layout { flex: 1; min-height: 0; display: flex; position: relative; }
.ai-body   { flex: 1; min-height: 0; display: flex; position: relative; }

.ai-history-toggle {
    display: none;
    padding: 7px 12px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.05em;
    transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.ai-history-toggle:hover {
    color: var(--text);
    border-color: rgba(92,184,138,0.4);
    background: rgba(92,184,138,0.08);
}

.ai-history-col {
    flex: 0 0 270px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.07);
    background:
        linear-gradient(180deg, rgba(18,27,31,0.92), rgba(9,14,24,0.94)),
        radial-gradient(circle at 20% 0%, rgba(92,184,138,0.11), transparent 48%);
    box-shadow: 18px 0 44px rgba(0,0,0,0.12);
    position: relative;
    z-index: 4;
}
.ai-history-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 16px 15px;
}
.ai-history-eyebrow {
    display: block;
    margin-bottom: 1px;
    color: var(--jade-bright);
    font-size: 9px;
    letter-spacing: .2em;
    text-transform: uppercase;
}
.ai-history-head h2 {
    font-family: var(--font-zh-display);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .08em;
}
.ai-new-chat {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 10px;
    color: var(--gold-bright);
    background: rgba(212,175,55,0.08);
    font-size: 12px;
    transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.ai-new-chat:hover {
    background: rgba(212,175,55,0.15);
    border-color: rgba(212,175,55,0.55);
    transform: translateY(-1px);
}
.ai-history-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 9px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}
.ai-history-group {
    padding: 13px 9px 6px;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .12em;
}
.ai-history-row {
    position: relative;
    display: flex;
    align-items: stretch;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: background .18s var(--ease), border-color .18s var(--ease);
}
.ai-history-row:hover { background: rgba(255,255,255,0.045); }
.ai-history-row.active {
    background: linear-gradient(135deg, rgba(92,184,138,0.13), rgba(212,175,55,0.055));
    border-color: rgba(92,184,138,0.2);
}
.ai-history-open {
    flex: 1;
    min-width: 0;
    padding: 10px 6px 10px 10px;
    text-align: left;
}
.ai-history-title {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-family: var(--font-zh-display);
    font-size: 13px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-history-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    color: var(--text-dim);
    font-size: 9.5px;
}
.ai-history-meta i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-dim);
}
.ai-history-meta i.status-answered { background: var(--jade-bright); }
.ai-history-meta i.status-probing { background: var(--gold-bright); }
.ai-history-meta i.status-processing { background: var(--cyan-soft); }
.ai-history-meta i.status-error { background: var(--cinnabar-bright); }
.ai-history-meta time { margin-left: auto; }
.ai-history-delete {
    align-self: center;
    width: 28px;
    height: 28px;
    margin-right: 5px;
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 18px;
    opacity: 0;
    transition: opacity .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.ai-history-row:hover .ai-history-delete,
.ai-history-row:focus-within .ai-history-delete { opacity: 1; }
.ai-history-delete:hover { color: #f0a094; background: rgba(192,57,43,0.12); }
.ai-history-empty {
    display: flex;
    min-height: 180px;
    padding: 30px 20px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--text-dim);
    text-align: center;
    font-size: 12px;
}
.ai-history-empty span { color: var(--text-muted); margin-bottom: 3px; }
.ai-history-empty small { max-width: 170px; font-size: 10.5px; line-height: 1.6; }
.ai-history-note {
    flex: 0 0 auto;
    margin: 0 16px;
    padding: 12px 0 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    color: var(--text-dim);
    font-size: 9.5px;
    text-align: center;
}
.ai-history-scrim { display: none; }

.ai-chart-col {
    flex: 0 0 34%; max-width: 470px; min-width: 320px;
    display: flex; flex-direction: column; gap: 10px;
    overflow-y: auto;
    border-right: 1px solid var(--stroke);
    padding: 14px 16px 40px;
}
.ai-chart-head {
    position: sticky; top: 0; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    padding: 2px 2px 8px;
    background: linear-gradient(180deg, var(--bg-deep, #0a0e1a) 72%, transparent);
}
.ai-chart-title { font-family: var(--font-zh-display); font-size: 13px; letter-spacing: 0.18em; color: var(--text-muted); }
.ai-chart-col .chart-card { margin: 0; }
.ai-chart-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0 2px 4px; }
.ai-chart-meta .meta-title { width: 100%; font-family: var(--font-zh-display); font-size: 13px; color: var(--gold-bright); letter-spacing: 0.1em; margin-bottom: 2px; }
.ai-chart-meta .meta-cell { font-size: 11.5px; }

.ai-chat-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-conversation-bar {
    flex: 0 0 auto;
    min-height: 61px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.065);
    background: rgba(7,10,17,0.54);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    position: relative;
    z-index: 7;
}
.ai-conversation-heading {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.ai-conversation-kicker {
    color: var(--jade-bright);
    font-size: 9px;
    letter-spacing: .16em;
}
.ai-conversation-heading strong {
    max-width: 390px;
    overflow: hidden;
    color: var(--text);
    font-family: var(--font-zh-display);
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-conversation-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}
.ai-action-btn {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    padding: 6px 9px;
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 9px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.025);
    font-size: 11px;
    list-style: none;
    transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.ai-action-btn::-webkit-details-marker { display: none; }
.ai-action-btn:hover:not(:disabled) {
    color: var(--text);
    border-color: rgba(92,184,138,0.32);
    background: rgba(92,184,138,0.075);
}
.ai-action-btn.danger:hover:not(:disabled) {
    color: #f0a094;
    border-color: rgba(231,76,60,0.32);
    background: rgba(192,57,43,0.09);
}
.ai-action-btn:disabled,
.ai-download-menu.disabled { opacity: .38; cursor: default; pointer-events: none; }
.ai-download-menu { position: relative; }
.ai-download-popover {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    width: 152px;
    padding: 6px;
    border: 1px solid rgba(255,255,255,0.11);
    border-radius: 12px;
    background: rgba(14,20,31,0.98);
    box-shadow: 0 18px 55px rgba(0,0,0,.48);
}
.ai-download-popover button {
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 11.5px;
    text-align: left;
}
.ai-download-popover button:hover { color: var(--text); background: rgba(92,184,138,.1); }
.ai-download-menu:not([open]) .ai-download-popover { display: none; }
.ai-chat-col .chat-thread { padding-top: 24px; }
.thread-inner.is-loading { opacity: .45; pointer-events: none; }

.ai-chart-empty {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 28px;
    border: 1px dashed rgba(212,175,55,.2);
    border-radius: 16px;
    color: var(--text-muted);
    text-align: center;
}
.ai-chart-empty-mark {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border: 1px solid rgba(212,175,55,.35);
    border-radius: 50%;
    color: var(--gold-bright);
    font-family: var(--font-zh-calli);
    font-size: 25px;
    background: radial-gradient(circle, rgba(212,175,55,.12), transparent 70%);
}
.ai-chart-empty strong { color: var(--text); font-family: var(--font-zh-display); font-size: 15px; }
.ai-chart-empty p { max-width: 220px; margin: 5px 0 12px; font-size: 11px; }
.ai-chart-empty a { color: var(--gold-bright); font-size: 12px; }
.ai-no-chart-note,
.ai-conversation-note {
    margin: 16px auto;
    max-width: 560px;
    padding: 12px 15px;
    border: 1px solid rgba(212,175,55,.18);
    border-radius: 12px;
    background: rgba(212,175,55,.055);
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}
.ai-no-chart-note {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}
.ai-no-chart-note strong { color: var(--text); }
.ai-no-chart-note span { flex: 1; min-width: 210px; }
.ai-no-chart-note a { color: var(--gold-bright); }
.ai-error-text { color: #e07b6a; }

/* 桌面：左栏已展示完整命盘 → 隐藏聊天顶部冗余的命盘 chip */
#aiPin { display: none; }

/* 迷你命盘六柱表压缩以适配窄栏 */
.ai-chart-col .pillar-table { min-width: 0; width: 100%; }
.ai-chart-col .pillar-table th,
.ai-chart-col .pillar-table td { padding: 5px 2px; }
.ai-chart-col .pillar-table .rowlab { width: 30px; padding-right: 5px; font-size: 10.5px; }
.ai-chart-col .pillar-table thead th { font-size: 12px; letter-spacing: 0; }
.ai-chart-col .pillar-table th .colsub { font-size: 8.5px; display: block; }
.ai-chart-col .pillar-table .ch { width: 28px; height: 28px; font-size: 19px; border-radius: 8px; }
.ai-chart-col .pillar-table td.tg { font-size: 11px; }
.ai-chart-col .pillar-table .hd { font-size: 10px; }
.ai-chart-col .pillar-table .hd i { font-size: 11px; margin-right: 2px; }
.ai-chart-col .pillar-table td.sm,
.ai-chart-col .pillar-table .kong { font-size: 10.5px; }

/* 删除确认与轻提示 */
.ai-delete-dialog {
    width: min(420px, calc(100vw - 32px));
    margin: auto;
    padding: 0;
    border: 1px solid rgba(212,175,55,.22);
    border-radius: 20px;
    color: var(--text);
    background: linear-gradient(160deg, #151c26, #0b111c);
    box-shadow: 0 30px 100px rgba(0,0,0,.7);
}
.ai-delete-dialog::backdrop {
    background: rgba(3,5,10,.7);
    backdrop-filter: blur(6px);
}
.ai-delete-dialog form { padding: 27px; text-align: center; }
.ai-dialog-mark {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(231,76,60,.3);
    border-radius: 50%;
    color: #f0a094;
    background: rgba(192,57,43,.1);
    font-family: var(--font-zh-display);
}
.ai-delete-dialog h2 {
    margin: 14px 0 7px;
    font-family: var(--font-zh-display);
    font-size: 20px;
}
.ai-delete-dialog p { color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.ai-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 22px; }
.ai-dialog-actions button { min-height: 42px; border-radius: 11px; font-size: 13px; }
.ai-dialog-cancel { border: 1px solid rgba(255,255,255,.11); color: var(--text-muted); }
.ai-dialog-confirm { border: 1px solid rgba(231,76,60,.35); color: #f5c0b8; background: rgba(192,57,43,.15); }
.ai-dialog-confirm:hover { background: rgba(192,57,43,.24); }
.ai-toast {
    position: fixed;
    left: 50%;
    bottom: 92px;
    z-index: 120;
    max-width: min(420px, calc(100vw - 32px));
    padding: 10px 15px;
    border: 1px solid rgba(92,184,138,.3);
    border-radius: 999px;
    color: #dff5e9;
    background: rgba(18,45,35,.96);
    box-shadow: 0 12px 40px rgba(0,0,0,.45);
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.ai-toast.visible { opacity: 1; transform: translate(-50%, 0); }
.ai-toast.error { color: #ffe1dc; border-color: rgba(231,76,60,.35); background: rgba(73,25,24,.96); }

/* 中等屏：历史变抽屉，给命盘与正文留出阅读宽度 */
@media (max-width: 1280px) {
    .ai-history-toggle { display: inline-flex; }
    .ai-history-col {
        position: absolute;
        inset: 0 auto 0 0;
        width: 284px;
        transform: translateX(-102%);
        transition: transform .26s var(--ease);
        box-shadow: 22px 0 70px rgba(0,0,0,.52);
    }
    .ai-history-scrim {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 3;
        background: rgba(4,6,11,.62);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s var(--ease);
    }
    .ai-body.history-open .ai-history-col { transform: translateX(0); }
    .ai-body.history-open .ai-history-scrim { opacity: 1; pointer-events: auto; }
}

@media (max-width: 1080px) and (min-width: 901px) {
    .ai-chart-col { display: none; }
    #aiPin { display: flex; }
}

/* 手机：chat-page 整体可滚（app.css 的 900px 覆盖），输入条吸底 */
@media (max-width: 900px) {
    /* 一屏放不下两栏 → 隐藏左命盘，聊天占满，命盘 chip 回归顶部 */
    .ai-chart-col { display: none; }
    #aiPin { display: flex; }

    .view-ai .chat-nav { position: sticky; top: 0; z-index: 30; background: rgba(7,7,13,.94); }
    .view-ai .ai-status { display: none; }
    .ai-history-col {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(88vw, 330px);
        z-index: 61;
    }
    .ai-history-scrim { position: fixed; z-index: 60; }
    .ai-conversation-bar { padding: 9px 12px; gap: 8px; }
    .ai-conversation-heading strong { max-width: 46vw; font-size: 12.5px; }
    .ai-conversation-kicker { font-size: 8px; }
    .ai-action-btn { min-height: 30px; padding: 5px 7px; font-size: 10px; }

    .view-ai .chat-thread { overflow: visible; flex: none; padding-top: 16px; }
    .view-ai .chat-input {
        position: sticky; bottom: 0;
        background: linear-gradient(180deg, transparent 0%, var(--bg-deep, #0a0e1a) 26%);
        padding-bottom: 88px;   /* 悬浮 tab bar 让位 */
    }
    .view-ai .ai-gate { min-height: 60vh; }
    .ai-toast { bottom: 86px; }
}

@media (max-width: 560px) {
    .ai-conversation-heading strong { max-width: 34vw; }
    .ai-action-btn { padding-inline: 6px; }
    .ai-history-delete { opacity: 1; }
    .ai-no-chart-note { margin-inline: 16px; justify-content: center; }
}
