:root {
    --assistant-blue: #0878d1;
    --assistant-cyan: #00a8e8;
    --assistant-ink: #133b59;
    --assistant-muted: #647d92;
    --assistant-line: #d8e8f3;
    --assistant-bg: #eef7fc;
}

* { box-sizing: border-box; }

html,
body.assistant-page {
    min-height: 100%;
    margin: 0;
    color-scheme: light only;
    background: var(--assistant-bg);
}

body.assistant-page {
    color: var(--assistant-ink);
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

.assistant-navbar {
    background: rgba(255, 255, 255, 0.96) !important;
    border-bottom: 1px solid rgba(25, 91, 145, 0.12) !important;
    box-shadow: 0 8px 30px rgba(31, 88, 130, 0.08) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
}

/* 与网站其他内页统一为清晰的浅色导航，覆盖首页样式末尾的深色导航规则。 */
#navbar.assistant-navbar,
#navbar.assistant-navbar.scrolled {
    background: rgba(255, 255, 255, 0.97) !important;
}

.assistant-navbar .logo-img,
.assistant-navbar.scrolled .logo-img {
    filter: none !important;
    opacity: 1 !important;
}

.assistant-navbar .nav-links .nav-link,
.assistant-navbar.scrolled .nav-links .nav-link {
    color: #203f5a !important;
    opacity: 1 !important;
    font-weight: 650 !important;
    text-shadow: none !important;
}

.assistant-navbar .nav-links .nav-link:hover,
.assistant-navbar .nav-links .nav-link.active,
.assistant-navbar.scrolled .nav-links .nav-link:hover,
.assistant-navbar.scrolled .nav-links .nav-link.active {
    color: #0074c8 !important;
}

.assistant-navbar .nav-link::before {
    background: linear-gradient(135deg, rgba(191, 235, 255, 0.94), rgba(219, 245, 255, 0.76)) !important;
    border-color: rgba(0, 168, 232, 0.20) !important;
    box-shadow: 0 10px 28px rgba(0, 168, 232, 0.16) !important;
}

.assistant-navbar .nav-link::after {
    background: linear-gradient(90deg, transparent, #0078d4, transparent) !important;
    box-shadow: 0 0 14px rgba(0, 120, 212, 0.45) !important;
}

.assistant-main {
    min-height: 100vh;
    padding: 96px 20px 22px;
    background:
        radial-gradient(circle at 8% 8%, rgba(0, 168, 232, 0.13), transparent 27%),
        radial-gradient(circle at 93% 90%, rgba(52, 211, 153, 0.10), transparent 28%),
        linear-gradient(145deg, #f5fbff, #eaf5fb 58%, #f4fbf8);
}

.assistant-shell {
    width: min(100%, 980px);
    height: min(790px, calc(100vh - 118px));
    min-height: 570px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(127, 187, 221, 0.45);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 28px 80px rgba(28, 93, 132, 0.18);
}

.chat-header {
    flex: none;
    min-height: 82px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--assistant-line);
    background: linear-gradient(135deg, #fff 0%, #f0faff 62%, #effbf7 100%);
}

.chat-back { display: none; }

.chat-avatar {
    position: relative;
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    display: grid;
    place-items: center;
    padding: 6px;
    border: 1px solid #d5e9f5;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(29, 126, 183, 0.12);
}

.chat-avatar img { width: 100%; height: 100%; object-fit: contain; }

.chat-avatar i {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 13px;
    height: 13px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #2ecf91;
}

.chat-title { min-width: 0; flex: 1; }
.chat-title h1 { margin: 0 0 5px; color: var(--assistant-ink); font-size: 1.18rem; line-height: 1.2; }
.chat-title p { margin: 0; color: var(--assistant-muted); font-size: 0.76rem; }
.chat-title p span { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #2ecf91; }

.new-chat {
    min-height: 38px;
    padding: 0 16px;
    color: #17628f;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid #bcddea;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    cursor: pointer;
}

.service-alert {
    flex: none;
    padding: 10px 16px;
    color: #8a4c00;
    font-size: 0.82rem;
    line-height: 1.5;
    text-align: center;
    border-bottom: 1px solid #f2d59f;
    background: #fff8e9;
}
.service-alert.is-hidden { display: none; }

.chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 22px clamp(14px, 3vw, 30px);
    background:
        linear-gradient(rgba(255,255,255,0.78), rgba(247,252,255,0.88)),
        linear-gradient(90deg, rgba(38,148,207,0.045) 1px, transparent 1px),
        linear-gradient(rgba(38,148,207,0.045) 1px, transparent 1px);
    background-size: auto, 40px 40px, 40px 40px;
}

.message-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px; }
.message-row.user-message { flex-direction: row-reverse; }

.message-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--assistant-blue), var(--assistant-cyan));
    box-shadow: 0 7px 18px rgba(8, 120, 209, 0.18);
}
.user-message .message-avatar { background: linear-gradient(135deg, #2c6d92, #53a8bd); }
.message-content { max-width: min(78%, 690px); }

.message-bubble {
    padding: 13px 16px;
    color: #24465f;
    font-size: 0.94rem;
    line-height: 1.78;
    border: 1px solid #dbeaf3;
    border-radius: 7px 18px 18px 18px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(34, 92, 126, 0.07);
    overflow-wrap: anywhere;
}
.user-message .message-bubble { color: #fff; border: 0; border-radius: 18px 7px 18px 18px; background: linear-gradient(135deg, #0878d1, #079cdd); }
.message-bubble p { margin: 0 0 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble strong { color: #0b5e95; }
.user-message .message-bubble strong { color: #fff; }
.answer-heading { margin: 12px 0 5px !important; color: #113f60; font-weight: 800; }
.answer-list-item { position: relative; padding-left: 20px; }
.answer-list-item::before { content: "•"; position: absolute; left: 4px; color: #078bd5; font-weight: 900; }

.citation-link {
    display: inline-grid;
    min-width: 20px;
    height: 20px;
    place-items: center;
    margin: 0 2px;
    padding: 0 5px;
    color: #0878d1;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    border-radius: 8px;
    background: #e7f5fd;
}

.quick-questions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-questions button {
    padding: 9px 12px;
    color: #17628f;
    font: inherit;
    font-size: 0.78rem;
    line-height: 1.35;
    text-align: left;
    border: 1px solid #c5e2f0;
    border-radius: 12px;
    background: #f5fbff;
    cursor: pointer;
}

.answer-actions { display: flex; gap: 8px; margin-top: 8px; }
.answer-actions button { padding: 5px 9px; color: #5b768a; font: inherit; font-size: 0.72rem; border: 1px solid #d6e6ef; border-radius: 8px; background: #fff; cursor: pointer; }
.answer-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.answer-images a { display: block; overflow: hidden; border: 1px solid #d7e7f0; border-radius: 12px; background: #f1f7fb; }
.answer-images img { display: block; width: 100%; max-height: 230px; object-fit: contain; }
.answer-sources { margin-top: 10px; padding: 10px 12px; color: #5f778a; font-size: 0.76rem; line-height: 1.5; border: 1px solid #dceaf2; border-radius: 12px; background: #f7fbfe; }
.answer-sources strong { color: #214e6c; }
.answer-sources a { color: #0878d1; text-decoration: none; }

.typing-bubble { display: flex; gap: 5px; padding: 16px 18px; }
.typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: #75a6c3; animation: typingDot 1.1s infinite ease-in-out; }
.typing-bubble i:nth-child(2) { animation-delay: 0.15s; }
.typing-bubble i:nth-child(3) { animation-delay: 0.3s; }

.chat-composer {
    flex: none;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 48px;
    gap: 9px;
    padding: 13px 16px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--assistant-line);
    background: rgba(255, 255, 255, 0.98);
}

.chat-composer textarea {
    width: 100%;
    min-height: 48px;
    max-height: 128px;
    resize: none;
    padding: 12px 14px;
    color: #173f5e;
    font: inherit;
    font-size: 0.92rem;
    line-height: 1.5;
    border: 1px solid #cddfea;
    border-radius: 14px;
    outline: none;
    background: #f8fbfd;
}
.chat-composer textarea:focus { border-color: #54b8e7; box-shadow: 0 0 0 3px rgba(8, 152, 216, 0.1); }

.send-button {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #fff;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--assistant-blue), var(--assistant-cyan));
    box-shadow: 0 9px 22px rgba(8, 120, 209, 0.25);
    cursor: pointer;
}
.send-button svg { width: 22px; fill: currentColor; }
.send-button:disabled { opacity: 0.48; cursor: not-allowed; box-shadow: none; }
.composer-tip { grid-column: 1 / -1; margin: -2px 2px 0; color: #8799a7; font-size: 0.68rem; line-height: 1.35; text-align: center; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
    30% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 820px) {
    html,
    body.assistant-page { width: 100%; height: 100%; min-height: 100%; overflow: hidden; background: #f5faff; }
    .assistant-navbar { display: none !important; }
    .assistant-main { width: 100%; height: 100vh; height: 100dvh; min-height: 0; padding: 0; overflow: hidden; background: #f5faff; }
    .assistant-shell { width: 100%; height: 100%; min-height: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
    .chat-header { min-height: 68px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 10px; }
    .chat-back { width: 28px; height: 42px; flex: 0 0 28px; display: grid; place-items: center; color: #275b79; font-size: 2rem; line-height: 1; text-decoration: none; }
    .chat-avatar { width: 43px; height: 43px; flex-basis: 43px; padding: 5px; border-radius: 13px; }
    .chat-title h1 { font-size: 1rem; }
    .chat-title p { font-size: 0.67rem; white-space: nowrap; }
    .new-chat { min-height: 35px; padding: 0 11px; font-size: 0.75rem; }
    .chat-messages { padding: 16px 12px 10px; }
    .message-row { gap: 8px; margin-bottom: 16px; }
    .message-avatar { width: 33px; height: 33px; flex-basis: 33px; border-radius: 10px; font-size: 0.6rem; }
    .message-content { max-width: calc(100% - 43px); }
    .message-bubble { padding: 11px 13px; font-size: 0.88rem; line-height: 1.7; }
    .quick-questions { flex-direction: column; align-items: flex-start; }
    .quick-questions button { width: 100%; }
    .answer-images { grid-template-columns: 1fr; }
    .chat-composer { grid-template-columns: 1fr 46px; padding: 9px 10px calc(7px + env(safe-area-inset-bottom)); }
    .chat-composer textarea { min-height: 46px; font-size: 16px; }
    .send-button { width: 46px; height: 46px; }
    .composer-tip { font-size: 0.62rem; }
}

@media (max-width: 360px) {
    .chat-title p { display: none; }
    .new-chat { padding: 0 9px; }
}

@media (prefers-reduced-motion: reduce) {
    .typing-bubble i { animation: none; }
}
