@charset "UTF-8";

/* AI 对话页：独立工作区视觉，避免与旧版通用卡片样式互相影响。 */
#chat-page {
    --chat-page-bg: var(--bg-body);
    --chat-surface: var(--bg-surface);
    --chat-sidebar: color-mix(in srgb, var(--bg-surface) 84%, var(--bg-body));
    --chat-surface-muted: var(--bg-element);
    --chat-surface-hover: var(--bg-surface-hover);
    --chat-border: var(--border-subtle);
    --chat-border-strong: var(--border-strong);
    --chat-text: var(--text-title);
    --chat-text-body: var(--text-body);
    --chat-text-muted: var(--text-muted);
    --chat-accent: var(--brand-accent);
    --chat-accent-strong: color-mix(in srgb, var(--brand-accent) 82%, var(--text-title));
    --chat-accent-soft: color-mix(in srgb, var(--brand-accent) 15%, transparent);
    --chat-green: #46c98b;
    --chat-user-bubble: var(--brand-accent);
    --chat-shadow: var(--shadow-subtle);
    --chat-ease: cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 0;
    overflow: hidden;
}

body.light-mode #chat-page,
html[data-theme="light"] #chat-page {
    --chat-sidebar: color-mix(in srgb, var(--bg-surface) 90%, var(--bg-body));
    --chat-green: #16875f;
    --chat-shadow: 0 20px 55px color-mix(in srgb, var(--text-title) 8%, transparent);
}

body[data-active-page="chat"] {
    background-color: var(--bg-body);
    background-image: none;
}

body[data-active-page="chat"] #main-container {
    padding: 12px 18px 18px;
    background: var(--bg-body);
}

#chat-page.active-page {
    gap: 0;
}

#chat-page .chat-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    background: var(--chat-surface);
    box-shadow: var(--chat-shadow);
}

#chat-page .chat-layout {
    position: relative;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    width: 100%;
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

#chat-page button,
#chat-page textarea,
#chat-page label {
    font-family: inherit;
}

#chat-page button:focus-visible,
#chat-page textarea:focus-visible,
#chat-page label:has(+ input:focus-visible) {
    outline: 2px solid color-mix(in srgb, var(--chat-accent) 65%, transparent);
    outline-offset: 2px;
}

/* 左侧会话栏 */
#chat-page .chat-sidebar {
    position: relative;
    z-index: 3;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 20px 16px 16px;
    overflow: hidden;
    border: 0;
    border-right: 1px solid var(--chat-border);
    background: var(--chat-sidebar);
}

.chat-sidebar-brand {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 18px;
    padding: 0;
}

.chat-sidebar-brand-icon,
.chat-assistant-avatar,
.chat-message-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: #ffffff;
    background: linear-gradient(145deg, var(--chat-accent), color-mix(in srgb, var(--chat-accent) 72%, var(--chat-text)));
    box-shadow: 0 9px 22px color-mix(in srgb, var(--chat-accent) 22%, transparent);
}

.chat-sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
}

.chat-sidebar-brand-icon svg,
.chat-assistant-avatar svg,
.chat-message-avatar svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
}

.chat-sidebar-brand-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.chat-sidebar-brand-copy strong {
    color: var(--chat-text);
    font-size: 16px;
    line-height: 1.2;
}

.chat-sidebar-brand-copy small {
    display: flex;
    align-items: center;
    color: var(--chat-text-muted);
    font-size: 12px;
    line-height: 1.2;
}

.chat-sidebar-brand-copy small i,
.chat-hero-kicker i {
    width: 6px;
    height: 6px;
    display: inline-block;
    flex: 0 0 6px;
    border-radius: 50%;
    background: var(--chat-green);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--chat-green) 14%, transparent);
}

.chat-sidebar-close,
.chat-history-toggle {
    display: none;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--chat-text-body);
    cursor: pointer;
}

.chat-sidebar-close {
    width: 32px;
    height: 32px;
    margin-left: auto;
    border-radius: 9px;
}

.chat-sidebar-close:hover,
.chat-history-toggle:hover {
    background: var(--chat-surface-hover);
    color: var(--chat-text);
}

#chat-page .chat-new-btn {
    width: 100%;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: var(--chat-accent);
    color: #ffffff;
    box-shadow: 0 9px 22px color-mix(in srgb, var(--chat-accent) 22%, transparent);
    font-size: 14px;
    cursor: pointer;
    transition: transform 170ms var(--chat-ease), background-color 170ms ease, box-shadow 170ms ease;
}

#chat-page .chat-new-btn:hover {
    transform: translateY(-1px);
    background: var(--chat-accent-strong);
    box-shadow: 0 12px 26px color-mix(in srgb, var(--chat-accent) 28%, transparent);
}

#chat-page .chat-new-btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
}

.chat-sidebar-section-title {
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding: 0 5px 7px;
    color: var(--chat-text-muted);
    font-size: 13px;
    letter-spacing: 0.04em;
}

.chat-sidebar-section-title em {
    min-width: 23px;
    height: 21px;
    display: inline-grid;
    place-items: center;
    padding: 0 6px;
    border-radius: 7px;
    background: var(--chat-surface-muted);
    color: var(--chat-text-body);
    font-size: 12px;
    font-style: normal;
    letter-spacing: 0;
}

#chat-page .chat-conversations {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 2px 1px 8px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--chat-border-strong) transparent;
}

#chat-page .chat-conversations::-webkit-scrollbar {
    width: 4px;
}

#chat-page .chat-conversations::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: var(--chat-border-strong);
}

#chat-page .chat-conversation-item {
    position: relative;
    width: 100%;
    min-height: 56px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--chat-text);
    text-align: left;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, transform 150ms var(--chat-ease);
}

#chat-page .chat-conversation-item:hover {
    transform: translateX(1px);
    border-color: var(--chat-border);
    background: var(--chat-surface-hover);
}

#chat-page .chat-conversation-item.active {
    border-color: color-mix(in srgb, var(--chat-accent) 24%, var(--chat-border));
    background: var(--chat-accent-soft);
    box-shadow: none;
}

.chat-conversation-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--chat-surface-muted);
    color: var(--chat-text-body);
}

.chat-conversation-item.active .chat-conversation-icon {
    background: color-mix(in srgb, var(--chat-accent) 16%, var(--chat-surface));
    color: var(--chat-accent);
}

.chat-conversation-icon svg,
.chat-conversation-arrow {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.chat-conversation-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

#chat-page .chat-conversation-title {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--chat-text);
    font-size: 14px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chat-page .chat-conversation-time {
    color: var(--chat-text-muted);
    font-size: 11px;
    line-height: 1.3;
}

.chat-conversation-arrow {
    color: var(--chat-text-muted);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 150ms ease, transform 150ms ease;
}

.chat-conversation-item:hover .chat-conversation-arrow,
.chat-conversation-item.active .chat-conversation-arrow {
    opacity: 1;
    transform: translateX(0);
}

#chat-page .chat-list-empty {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 18px 12px;
    border: 1px dashed var(--chat-border-strong);
    border-radius: 12px;
    background: transparent;
    color: var(--chat-text-muted);
    text-align: center;
}

.chat-list-empty-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    margin-bottom: 2px;
    border-radius: 10px;
    background: var(--chat-surface-muted);
    color: var(--chat-text-body);
}

.chat-list-empty-icon svg {
    width: 17px;
    height: 17px;
}

#chat-page .chat-list-empty strong {
    color: var(--chat-text-body);
    font-size: 14px;
    line-height: 1.45;
}

#chat-page .chat-list-empty small {
    max-width: 180px;
    color: var(--chat-text-muted);
    font-size: 12px;
    line-height: 1.55;
}

.chat-sidebar-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 10px;
    padding: 11px;
    border: 1px solid var(--chat-border);
    border-radius: 11px;
    background: var(--chat-surface-muted);
}

.chat-sidebar-note > span {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    flex: 0 0 25px;
    border-radius: 8px;
    background: var(--chat-accent-soft);
    color: var(--chat-accent);
}

.chat-sidebar-note svg {
    width: 14px;
    height: 14px;
}

.chat-sidebar-note p {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.chat-sidebar-note strong {
    color: var(--chat-text-body);
    font-size: 14px;
    line-height: 1.4;
}

.chat-sidebar-note small {
    color: var(--chat-text-muted);
    font-size: 12px;
    line-height: 1.55;
}

.chat-sidebar-backdrop {
    display: none;
}

/* 主对话区域 */
#chat-page .chat-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: var(--chat-surface);
}

#chat-page .chat-hero {
    position: relative;
    isolation: isolate;
    min-height: 80px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex: 0 0 auto;
    padding: 12px 14px 12px 18px;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid var(--chat-border);
    background: linear-gradient(105deg, color-mix(in srgb, var(--chat-accent) 9%, var(--chat-surface)) 0%, var(--chat-surface) 46%, color-mix(in srgb, var(--chat-accent) 4%, var(--chat-surface)) 100%);
}

#chat-page .chat-hero::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--chat-accent) 70%, var(--chat-text)) 0%, var(--chat-accent) 52%, color-mix(in srgb, var(--chat-accent) 74%, var(--bg-body)) 100%);
}

#chat-page .chat-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    top: 50%;
    right: 90px;
    width: 240px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--chat-accent) 12%, transparent) 0%, transparent 70%);
    transform: translateY(-50%);
    pointer-events: none;
}

.chat-hero-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
}

.chat-history-toggle {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
}

.chat-assistant-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--chat-accent) 72%, var(--chat-text)) 0%, var(--chat-accent) 48%, color-mix(in srgb, var(--chat-accent) 78%, var(--bg-body)) 100%);
    box-shadow: 0 10px 26px color-mix(in srgb, var(--chat-accent) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.chat-assistant-avatar::after {
    content: "";
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 11px;
    height: 11px;
    border: 3px solid var(--chat-surface);
    border-radius: 50%;
    background: var(--chat-green);
    box-sizing: content-box;
}

.chat-assistant-avatar svg {
    width: 22px;
    height: 22px;
}

.chat-hero-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.chat-hero-kicker {
    width: max-content;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 8px;
    border: 1px solid color-mix(in srgb, var(--chat-green) 24%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--chat-green) 9%, transparent);
    color: color-mix(in srgb, var(--chat-green) 78%, var(--chat-text));
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

#chat-page .chat-hero h2 {
    max-width: min(56vw, 720px);
    margin: 0;
    overflow: hidden;
    color: var(--chat-text);
    font-size: 19px;
    font-weight: 760;
    line-height: 1.25;
    letter-spacing: -0.015em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-hero-copy p {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
    color: var(--chat-text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.chat-hero-copy p span + span::before {
    content: "";
    width: 3px;
    height: 3px;
    display: inline-block;
    margin: 0 7px 2px;
    border-radius: 50%;
    background: var(--chat-border-strong);
}

#chat-page .chat-hero-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
}

#chat-page .chat-hero-capability,
#chat-page .chat-hero-new-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 11px;
    white-space: nowrap;
}

#chat-page .chat-hero-capability {
    padding: 0 12px;
    border: 1px solid var(--chat-border);
    background: color-mix(in srgb, var(--chat-surface-muted) 86%, transparent);
    color: var(--chat-text-body);
    font-size: 12px;
    font-weight: 650;
}

#chat-page .chat-hero-capability svg,
#chat-page .chat-hero-new-btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#chat-page .chat-hero-capability svg {
    color: var(--chat-accent);
}

#chat-page .chat-hero-new-btn {
    padding: 0 14px;
    border: 1px solid color-mix(in srgb, var(--chat-accent) 70%, transparent);
    background: var(--chat-accent);
    color: #ffffff;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--chat-accent) 23%, transparent);
    font-size: 13px;
    font-weight: 720;
    cursor: pointer;
    transition: transform 170ms var(--chat-ease), background-color 170ms ease, box-shadow 170ms ease;
}

#chat-page .chat-hero-new-btn:hover {
    transform: translateY(-1px);
    background: var(--chat-accent-strong);
    box-shadow: 0 11px 24px color-mix(in srgb, var(--chat-accent) 30%, transparent);
}

#chat-page .chat-messages {
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px clamp(18px, 4.4vw, 64px) 24px;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--chat-border-strong) transparent;
}

#chat-page .chat-messages::-webkit-scrollbar {
    width: 5px;
}

#chat-page .chat-messages::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: var(--chat-border-strong);
}

/* 空白欢迎状态 */
#chat-page .chat-empty {
    width: min(100%, 760px);
    max-width: none;
    min-height: max-content;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: auto;
    padding: 28px 0 18px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--chat-text-body);
    text-align: center;
}

.chat-empty-mark {
    position: relative;
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    margin-bottom: 15px;
    border: 1px solid color-mix(in srgb, var(--chat-accent) 18%, var(--chat-border));
    border-radius: 22px;
    background: var(--chat-accent-soft);
    box-shadow: 0 17px 36px color-mix(in srgb, var(--chat-accent) 15%, transparent);
}

.chat-empty-mark::before,
.chat-empty-mark::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: var(--chat-accent);
    opacity: 0.3;
}

.chat-empty-mark::before {
    width: 7px;
    height: 7px;
    top: 5px;
    right: 2px;
}

.chat-empty-mark::after {
    width: 4px;
    height: 4px;
    bottom: 9px;
    left: 0;
}

.chat-empty-mark span {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(145deg, var(--chat-accent), color-mix(in srgb, var(--chat-accent) 74%, var(--chat-text)));
    color: #ffffff;
}

.chat-empty-mark svg {
    width: 25px;
    height: 25px;
    stroke: currentColor;
    stroke-width: 1.7;
}

.chat-empty-kicker {
    margin-bottom: 8px;
    color: var(--chat-accent);
    font-size: 11px;
    letter-spacing: 0.13em;
}

#chat-page .chat-empty h3 {
    margin: 0;
    color: var(--chat-text);
    font-size: clamp(30px, 2.5vw, 38px);
    line-height: 1.18;
    letter-spacing: -0.035em;
}

#chat-page .chat-empty > p {
    max-width: 580px;
    margin: 12px auto 0;
    color: var(--chat-text-body);
    font-size: 14px;
    line-height: 1.7;
}

.chat-starters {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 25px;
}

.chat-starters > button {
    min-width: 0;
    min-height: 66px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 17px;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border: 1px solid var(--chat-border);
    border-radius: 13px;
    background: var(--chat-surface-muted);
    color: var(--chat-text);
    text-align: left;
    cursor: pointer;
    transition: transform 170ms var(--chat-ease), border-color 170ms ease, background-color 170ms ease, box-shadow 170ms ease;
}

.chat-starters > button:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--chat-accent) 32%, var(--chat-border));
    background: var(--chat-surface-hover);
    box-shadow: 0 11px 24px rgba(15, 23, 42, 0.06);
}

.chat-starter-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--chat-accent-soft);
    color: var(--chat-accent);
}

.chat-starter-icon svg,
.chat-starter-arrow {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.chat-starters > button > span:nth-child(2) {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.chat-starters strong {
    overflow: hidden;
    color: var(--chat-text);
    font-size: 14px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-starters small {
    overflow: hidden;
    color: var(--chat-text-muted);
    font-size: 12px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-starter-arrow {
    color: var(--chat-text-muted);
    transition: color 150ms ease, transform 170ms var(--chat-ease);
}

.chat-starters > button:hover .chat-starter-arrow {
    color: var(--chat-accent);
    transform: translateX(2px);
}

/* 消息 */
#chat-page .chat-message {
    width: min(100%, 920px);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 auto;
}

#chat-page .chat-message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    margin-top: 17px;
    border-radius: 10px;
}

.chat-message.user .chat-message-avatar {
    background: var(--chat-surface-hover);
    color: var(--chat-text-body);
    box-shadow: none;
}

.chat-message-avatar svg {
    width: 16px;
    height: 16px;
}

.chat-message-copy {
    min-width: 0;
    max-width: min(78%, 720px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.chat-message.user .chat-message-copy {
    align-items: flex-end;
}

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 3px;
    color: var(--chat-text-muted);
    font-size: 11px;
    line-height: 1.3;
}

.chat-message-meta i {
    width: 3px;
    height: 3px;
    display: inline-block;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

#chat-page .chat-bubble {
    max-width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--chat-border);
    border-radius: 6px 16px 16px 16px;
    background: var(--chat-surface-muted);
    color: var(--chat-text);
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
    box-shadow: 0 5px 13px rgba(15, 23, 42, 0.025);
}

#chat-page .chat-message.user .chat-bubble {
    border-color: transparent;
    border-radius: 16px 6px 16px 16px;
    background: var(--chat-user-bubble);
    color: #ffffff;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--chat-user-bubble) 19%, transparent);
}

.chat-message-image {
    display: block;
    width: auto;
    max-width: min(100%, 320px);
    max-height: 320px;
    margin-top: 9px;
    object-fit: cover;
    border: 1px solid color-mix(in srgb, #ffffff 18%, transparent);
    border-radius: 11px;
    cursor: zoom-in;
}

.chat-message.is-loading .chat-bubble {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--chat-text-body);
}

.chat-thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.chat-thinking-dots i {
    width: 5px;
    height: 5px;
    display: block;
    border-radius: 50%;
    background: var(--chat-accent);
    animation: chat-thinking 1.15s ease-in-out infinite;
}

.chat-thinking-dots i:nth-child(2) { animation-delay: 0.14s; }
.chat-thinking-dots i:nth-child(3) { animation-delay: 0.28s; }

@keyframes chat-thinking {
    0%, 70%, 100% { opacity: 0.32; transform: translateY(0); }
    35% { opacity: 1; transform: translateY(-3px); }
}

/* 输入区 */
.chat-composer-area {
    flex: 0 0 auto;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--chat-border);
    background: color-mix(in srgb, var(--chat-surface) 96%, transparent);
}

#chat-page .chat-composer {
    width: 100%;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
}

.chat-image-previews {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    background: var(--chat-surface-muted);
}

.chat-image-previews:empty {
    display: none !important;
}

.chat-image-preview {
    position: relative;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
}

.chat-image-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border: 1px solid var(--chat-border-strong);
    border-radius: 10px;
}

.chat-image-preview button {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 19px;
    height: 19px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 2px solid var(--chat-surface-muted);
    border-radius: 50%;
    background: #ef4444;
    color: #ffffff;
    cursor: pointer;
}

.chat-image-preview button svg {
    width: 9px;
    height: 9px;
    stroke: currentColor;
    stroke-width: 2.3;
}

.chat-composer-box {
    overflow: hidden;
    border: 1px solid var(--chat-border-strong);
    border-radius: 16px;
    background: var(--chat-surface-muted);
    box-shadow: 0 9px 28px rgba(15, 23, 42, 0.055);
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.chat-composer-box:focus-within {
    border-color: color-mix(in srgb, var(--chat-accent) 55%, var(--chat-border));
    background: var(--chat-surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--chat-accent) 10%, transparent), 0 11px 30px rgba(15, 23, 42, 0.07);
}

#chat-page .chat-composer textarea {
    width: 100%;
    min-height: 52px;
    max-height: 150px;
    display: block;
    margin: 0;
    padding: 14px 15px 7px;
    resize: none;
    overflow-y: auto;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--chat-text);
    box-shadow: none;
    font-size: 15px;
    line-height: 1.6;
}

#chat-page .chat-composer textarea::placeholder {
    color: var(--chat-text-muted);
    opacity: 1;
}

.chat-composer-toolbar {
    min-height: 43px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 7px 7px 8px;
}

.chat-composer-leading {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

#chat-image-input {
    display: none;
}

.chat-upload-btn {
    min-height: 31px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 0 9px;
    border: 1px solid var(--chat-border);
    border-radius: 9px;
    background: var(--chat-surface);
    color: var(--chat-text-body);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.chat-upload-btn:hover {
    border-color: var(--chat-border-strong);
    background: var(--chat-surface-hover);
    color: var(--chat-text);
}

.chat-upload-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.chat-image-limit {
    overflow: hidden;
    color: var(--chat-text-muted);
    font-size: 12px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chat-page .chat-send-btn {
    min-width: 76px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: var(--chat-accent);
    color: #ffffff;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
    transition: transform 160ms var(--chat-ease), background-color 150ms ease, opacity 150ms ease;
}

#chat-page .chat-send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--chat-accent-strong);
}

#chat-page .chat-send-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.chat-send-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

#chat-page .chat-hint {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 7px 0 0;
    padding: 0 4px;
    color: var(--chat-text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.chat-hint kbd {
    padding: 1px 4px;
    border: 1px solid var(--chat-border);
    border-bottom-color: var(--chat-border-strong);
    border-radius: 4px;
    background: var(--chat-surface-muted);
    color: var(--chat-text-body);
    font-family: inherit;
    font-size: 11px;
}

@media (max-width: 1100px) {
    #chat-page .chat-layout {
        grid-template-columns: 250px minmax(0, 1fr);
    }

    #chat-page .chat-sidebar {
        padding-inline: 13px;
    }

    #chat-page .chat-messages,
    .chat-composer-area {
        padding-inline: 24px;
    }
}

@media (max-width: 820px) {
    body[data-active-page="chat"] #main-container {
        padding: 9px 12px 13px;
    }

    #chat-page .chat-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    #chat-page .chat-sidebar {
        position: absolute;
        inset: 0 auto 0 0;
        z-index: 12;
        width: min(84vw, 310px);
        border-right: 1px solid var(--chat-border);
        box-shadow: 18px 0 44px rgba(0, 0, 0, 0.18);
        opacity: 0;
        visibility: hidden;
        transform: translateX(-102%);
        transition: transform 210ms var(--chat-ease), opacity 170ms ease, visibility 0s linear 210ms;
    }

    #chat-page .chat-layout.is-sidebar-open .chat-sidebar {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
        transition-delay: 0s;
    }

    #chat-page .chat-sidebar-close,
    #chat-page .chat-history-toggle {
        display: grid;
    }

    #chat-page .chat-sidebar-backdrop {
        position: absolute;
        z-index: 10;
        inset: 0;
        display: block;
        padding: 0;
        border: 0;
        background: rgba(10, 12, 18, 0.44);
        opacity: 0;
        visibility: hidden;
        cursor: default;
        transition: opacity 170ms ease, visibility 0s linear 170ms;
    }

    #chat-page .chat-layout.is-sidebar-open .chat-sidebar-backdrop {
        opacity: 1;
        visibility: visible;
        transition-delay: 0s;
    }

    #chat-page .chat-hero {
        min-height: 76px;
        padding-inline: 15px;
    }

    #chat-page .chat-hero h2 {
        max-width: 54vw;
    }

    #chat-page .chat-hero-capability {
        display: none;
    }

    #chat-page .chat-messages {
        padding: 24px 18px 20px;
    }

    .chat-composer-area {
        padding: 11px 15px 13px;
    }
}

@media (max-width: 600px) {
    body[data-active-page="chat"] #main-container {
        padding: 6px 8px 9px;
    }

    #chat-page .chat-shell {
        border-radius: 15px;
    }

    #chat-page .chat-hero {
        min-height: 68px;
        gap: 9px;
        padding: 9px 10px;
    }

    .chat-hero-main {
        gap: 8px;
    }

    .chat-history-toggle {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .chat-assistant-avatar {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }

    .chat-assistant-avatar::after {
        width: 8px;
        height: 8px;
        border-width: 2px;
    }

    .chat-assistant-avatar svg {
        width: 18px;
        height: 18px;
    }

    .chat-hero-kicker {
        gap: 5px;
        padding: 2px 6px;
        font-size: 10px;
    }

    #chat-page .chat-hero h2 {
        max-width: 43vw;
        font-size: 15px;
    }

    .chat-hero-copy p {
        display: none;
    }

    #chat-page .chat-hero-new-btn {
        width: 38px;
        min-width: 38px;
        min-height: 38px;
        padding: 0;
        border-radius: 11px;
    }

    #chat-page .chat-hero-new-btn > span {
        display: none;
    }

    #chat-page .chat-messages {
        gap: 16px;
        padding: 21px 11px 17px;
    }

    #chat-page .chat-empty {
        padding: 18px 2px 14px;
    }

    .chat-empty-mark {
        width: 58px;
        height: 58px;
        margin-bottom: 13px;
        border-radius: 19px;
    }

    .chat-empty-mark span {
        width: 40px;
        height: 40px;
        border-radius: 13px;
    }

    #chat-page .chat-empty h3 {
        font-size: 28px;
    }

    #chat-page .chat-empty > p {
        max-width: 390px;
        margin-top: 9px;
        font-size: 13px;
        line-height: 1.6;
    }

    .chat-starters {
        grid-template-columns: 1fr;
        gap: 7px;
        margin-top: 18px;
    }

    .chat-starters > button {
        min-height: 57px;
        grid-template-columns: 31px minmax(0, 1fr) 16px;
        padding: 8px 9px;
        border-radius: 11px;
    }

    .chat-starter-icon {
        width: 31px;
        height: 31px;
        border-radius: 9px;
    }

    .chat-message-avatar {
        width: 28px;
        height: 28px;
        margin-top: 16px;
        border-radius: 9px;
    }

    .chat-message-copy {
        max-width: calc(100% - 38px);
    }

    #chat-page .chat-bubble {
        padding: 10px 12px;
        font-size: 14px;
        line-height: 1.65;
    }

    .chat-composer-area {
        padding: 8px 9px 9px;
    }

    .chat-composer-box {
        border-radius: 14px;
    }

    #chat-page .chat-composer textarea {
        min-height: 49px;
        padding: 12px 12px 5px;
        font-size: 14px;
    }

    .chat-composer-toolbar {
        min-height: 40px;
        padding: 4px 5px 6px 6px;
    }

    .chat-image-limit {
        display: none;
    }

    #chat-page .chat-send-btn {
        min-width: 66px;
        min-height: 32px;
        padding-inline: 10px;
    }

    #chat-page .chat-hint {
        justify-content: flex-start;
        margin-top: 6px;
    }

    #chat-page .chat-hint > span:last-child {
        display: none;
    }
}

@media (max-width: 390px) {
    body[data-active-page="chat"] #main-container {
        padding: 0;
    }

    #chat-page .chat-shell {
        border-width: 0;
        border-radius: 0;
    }

    #chat-page .chat-hero h2 {
        max-width: 40vw;
    }

    .chat-upload-btn span,
    #chat-page .chat-send-btn > span {
        display: none;
    }

    .chat-upload-btn {
        width: 32px;
        justify-content: center;
        padding: 0;
    }

    #chat-page .chat-send-btn {
        min-width: 34px;
        width: 34px;
        padding: 0;
    }

    #chat-page .chat-hint {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    #chat-page *,
    #chat-page *::before,
    #chat-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
