.shell[data-page=chat] {
  --chat-paper:#fcfbf8;
  --chat-ink:#302a38;
  --chat-muted:#686371;
  --chat-rule:#e4e0da;
  --chat-purple:#514991;
  background:var(--chat-paper);
}
.shell[data-page=chat] .topbar {background:var(--chat-paper);border-bottom-color:var(--chat-rule)}
.shell[data-page=chat] .topbar h1 {font-size:19px;letter-spacing:-.02em}
.shell[data-page=chat] #main-content {padding:0 clamp(16px,5vw,24px) calc(61px + env(safe-area-inset-bottom))}
.shell[data-page=chat] .header-name {display:none}
.chat-page {
  display:flex;flex-direction:column;min-height:calc(100dvh - 57px - 61px - env(safe-area-inset-bottom));
  color:var(--chat-ink);font-size:15px;line-height:1.65;overflow-wrap:anywhere;
}
.chat-page p,.chat-page small {margin:0}
.chat-page button:focus-visible,.chat-page summary:focus-visible {outline:2px solid var(--chat-purple);outline-offset:2px}
.chat-page summary {list-style:none;cursor:pointer}
.chat-page summary::-webkit-details-marker {display:none}
.chat-icon {width:17px;height:17px;display:inline-block;flex:none;vertical-align:middle}
.chat-birth {border-bottom:1px solid var(--chat-rule)}
.chat-birth-head,.chat-source-title {display:flex;align-items:center;gap:8px;min-height:47px}
.chat-disclosure-icon {display:flex;align-items:center;justify-content:center;margin-left:auto;color:var(--chat-muted)}
.chat-disclosure-icon .chat-icon {width:14px;height:14px}
.chat-page details[open]>summary .chat-disclosure-icon {transform:rotate(180deg)}
.chat-birth-name {display:flex;align-items:baseline;flex:none;max-width:52%;white-space:nowrap;font-size:13px;font-weight:600}
.chat-birth-name>span:last-child {flex:none}
.chat-birth-owner,.chat-source-topic {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-birth-overview {font:500 13px/1.6 "Songti SC","STSong","Noto Serif CJK SC",serif;color:var(--chat-muted);margin-left:auto;white-space:nowrap}
.chat-birth-head .chat-disclosure-icon {margin-left:0}
.chat-birth-body {padding:3px 0 16px}
.chat-birth-date,.chat-birth-lunar,.chat-birth-missing,.chat-tag {font-size:13px;color:var(--chat-muted)}
.chat-tag {display:block;margin-top:10px;font-size:12px}
.chat-pillars {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));margin:12px 0 0}
.chat-pillars>div+div {border-left:1px solid var(--chat-rule);padding-left:12px}
.chat-pillars dt {font-size:11px;color:var(--chat-muted)}
.chat-pillars dd {margin:2px 0 0;font:600 18px/1.4 "Songti SC","STSong","Noto Serif CJK SC",serif;color:#453854}
.chat-birth-missing,.chat-status,.chat-error {display:flex;align-items:center;justify-content:space-between;gap:8px}
.chat-birth-edit,.chat-back,.chat-text-action,.chat-shuffle {color:var(--chat-purple);background:transparent}
.chat-birth-edit,.chat-text-action {flex:none;padding:8px 0}
.chat-source {margin-top:10px;background:#f0edf6;border-radius:9px;color:var(--chat-purple)}
.chat-source-title {padding:0 12px;min-height:40px;font-size:13px}
.chat-source-label,.chat-back,.chat-shuffle {display:inline-flex;align-items:center;gap:5px}
.chat-source-label {flex:none;font-size:12px;font-weight:600}
.chat-source-label .chat-icon {width:14px;height:14px}
.chat-source-heading {display:grid;min-width:0;gap:1px;padding-block:6px}
.chat-source-topic {font-weight:550}
.chat-source-preview {color:var(--chat-muted);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-source[open] .chat-source-preview {display:none}
.chat-source-principle {margin:8px 13px 0}
.chat-source-principle strong {font-size:12px;font-weight:600}
.chat-source .chat-source-principle p {margin:1px 0 0}
.chat-source p {margin:2px 13px 0;color:#494350;font-size:14px;line-height:1.65;white-space:pre-line}
.chat-source .reading-lead,.chat-source .reading-detail {font-size:inherit;line-height:inherit}
button.chat-back {font-size:12px;padding:7px 13px 10px}
.chat-back .chat-icon {width:12px;height:12px}
.chat-status,.chat-error,.chat-hint {font-size:12px;color:var(--chat-muted)}
.chat-status {padding:8px 0}
.chat-log {display:flex;flex-direction:column;gap:18px;margin:22px 0}
section.chat-discovery {margin:clamp(22px,5.5dvh,52px) 0 0}
.chat-question-heading {display:flex;align-items:center;justify-content:space-between;gap:8px}
.chat-question-heading {margin-bottom:8px}
h2.chat-prompt-title {color:var(--chat-ink);font-size:clamp(19px,5.15vw,23px);font-weight:650;letter-spacing:-.03em;line-height:1.5}
button.chat-shuffle {flex:none;min-height:36px;padding:4px 1px 4px 7px;font-size:12px}
.chat-shuffle .chat-icon {width:14px;height:14px}
.chat-suggestions {border-top:1px solid var(--chat-rule)}
.chat-suggestions button {display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:52px;padding:12px 2px;border-bottom:1px solid var(--chat-rule);background:transparent;color:#3e3747;text-align:left;font-size:15px;line-height:1.55}
.chat-suggestions button:hover,.chat-shuffle:hover {color:var(--chat-purple);background:#f4f1f7}
.chat-suggestions .chat-icon {width:14px;height:14px;color:#817987}
.chat-followups {margin:0 0 0 30px}
.chat-followup-title {margin:0 0 5px;font-size:13px;line-height:1.5;font-weight:600;color:var(--chat-muted)}
.chat-followups .chat-suggestions {border-top:0}
.chat-followups .chat-suggestions button {min-height:44px;padding:8px 1px;font-size:14px;color:var(--chat-purple)}
.chat-user {display:flex;flex-direction:column;align-items:flex-end;gap:3px;padding-left:28px}
.chat-user>.chat-bubble {background:#eeebf6;color:#3f3452;padding:8px 13px;border-radius:14px 14px 4px 14px;white-space:pre-wrap}
.chat-user small,.chat-message-footer small,.chat-wait {color:var(--chat-muted);font-size:11px}
.chat-assistant {display:flex;align-items:flex-start;gap:8px}
.chat-avatar {display:grid;place-items:center;width:22px;height:25px;color:var(--chat-purple);flex:none}
.chat-avatar .chat-icon {width:16px;height:16px}
.chat-response {flex:1;min-width:0}
.chat-answer {white-space:pre-wrap;line-height:1.8}
.chat-report {white-space:normal;overflow-wrap:anywhere}
.chat-report h3 {margin:1.45em 0 .35em;color:var(--chat-ink);font-size:1.06em;line-height:1.5;font-weight:650}
.chat-report p {margin:.5em 0}
.chat-report .chat-report-note {color:var(--chat-muted);font-size:.86em;line-height:1.65}
.chat-report .chat-report-note:last-child {margin-top:1.3em}
.chat-streaming .chat-answer::after {content:"";display:inline-block;width:2px;height:.85em;margin-left:3px;background:var(--chat-purple);vertical-align:-.05em}
.chat-message-footer,.chat-actions {display:flex;align-items:center}
.chat-message-footer {justify-content:space-between;gap:8px;margin-top:4px}
.chat-message-footer small,.chat-tag {min-width:0;overflow-wrap:anywhere}
.chat-icon-button {display:inline-grid;place-items:center;color:var(--chat-muted);background:transparent;width:32px;height:32px;border-radius:6px}
.chat-icon-button:hover,.chat-icon-button[aria-pressed=true] {color:var(--chat-purple);background:#f0edf6}
.chat-error {padding:9px 12px;border-radius:8px;background:#f7eee7;color:#754c40}
.chat-dock {position:sticky;z-index:3;bottom:calc(61px + env(safe-area-inset-bottom));margin-top:auto;padding:8px 0 10px;background:var(--chat-paper)}
.chat-compose {display:flex;align-items:center;gap:8px;padding:5px 7px 5px 14px;border:1px solid #d7d2da;border-radius:28px;background:#fff}
.chat-compose:focus-within {border-color:var(--chat-purple);outline:1px solid var(--chat-purple)}
.chat-input {flex:1;min-width:0;padding:4px 0;border:0;outline:0;background:transparent;font-size:16px;color:var(--chat-ink);caret-color:var(--chat-purple)}
.chat-input::placeholder {color:#716b75}
.chat-hint:not(:empty) {padding:0 0 5px 10px}
.chat-send {display:grid;place-items:center;width:34px;height:34px;flex:none;padding:0;background:var(--chat-purple);color:#fff;border-radius:50%}
.chat-send:disabled {background:#d9d6e7;color:#625b80}
@media(max-width:360px) {
  .chat-birth-head {gap:5px}
  .chat-birth-name {max-width:45%}
  .chat-birth-overview {font-size:12px}
}

.chat-birth-identity {display:grid;min-width:0;flex:1;padding:5px 0}
.chat-birth-identity .chat-birth-name {max-width:100%}
.chat-birth-meta,.chat-page .chat-birth-time-basis {color:var(--chat-muted);font-size:12px}
.chat-page .chat-birth-time-basis {margin-top:3px}
.chat-pillars dd.chat-pillar-gods {font-family:inherit;font-size:12px;line-height:1.6;font-weight:400;color:var(--chat-muted)}
.chat-fact-section {border-top:1px solid var(--chat-rule)}
.chat-fact-section>summary {display:flex;align-items:center;justify-content:space-between;min-height:40px;font-size:14px;font-weight:600}
.chat-fact-section>summary::after {content:"";width:6px;height:6px;margin-right:3px;border-right:1px solid currentColor;border-bottom:1px solid currentColor;transform:rotate(45deg)}
.chat-fact-section[open]>summary::after {transform:rotate(225deg)}
.chat-fact-rows {display:grid;gap:7px;margin:0 0 13px;font-size:13px}
.chat-fact-rows>div {display:grid;grid-template-columns:minmax(70px,29%) minmax(0,1fr);gap:8px}
.chat-fact-rows dt {color:var(--chat-muted)}
.chat-fact-rows dd {margin:0;white-space:pre-line}
