.zhishi-assistant {
    --za-ink: #173246;
    --za-blue: #3c87c4;
    --za-blue-deep: #1f5f93;
    --za-paper: #f7f4ee;
    --za-line: rgba(23, 50, 70, 0.12);
    --za-seal: #9c3b32;
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;
    font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
    color: var(--za-ink);
}

.za-launcher {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 16px 0 8px;
    border: 0;
    border-radius: 999px;
    background: var(--za-ink);
    color: #f7f4ee;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(23, 50, 70, 0.22);
}

.za-launcher:hover {
    background: var(--za-blue-deep);
}

.za-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--za-seal);
    font-family: "Songti SC", "Noto Serif SC", serif;
    font-size: 16px;
}

.za-launcher-label {
    font-size: 15px;
    letter-spacing: 0.08em;
}

.za-panel {
    position: absolute;
    right: 0;
    bottom: 64px;
    display: flex;
    flex-direction: column;
    width: min(400px, calc(100vw - 28px));
    height: min(620px, calc(100vh - 110px));
    overflow: hidden;
    background: var(--za-paper);
    border: 1px solid var(--za-line);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(23, 50, 70, 0.2);
}

.za-panel[hidden] {
    display: none;
}

.za-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 14px;
    background:
        linear-gradient(180deg, rgba(60, 135, 196, 0.16), transparent 70%),
        #fffdf9;
    border-bottom: 1px solid var(--za-line);
}

.za-kicker {
    margin: 0 0 4px;
    color: var(--za-seal);
    font-size: 12px;
    letter-spacing: 0.18em;
}

.za-title {
    margin: 0;
    font-family: "Songti SC", "Noto Serif SC", serif;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}

.za-sub {
    margin: 6px 0 0;
    color: rgba(23, 50, 70, 0.68);
    font-size: 13px;
}

.za-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.za-reset,
.za-close {
    border: 0;
    background: transparent;
    color: var(--za-ink);
    cursor: pointer;
}

.za-reset {
    height: 32px;
    padding: 0 8px;
    border-radius: 999px;
    font: inherit;
    font-size: 13px;
    letter-spacing: 0.04em;
}

.za-reset:hover,
.za-close:hover {
    background: rgba(23, 50, 70, 0.06);
}

.za-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
}

.za-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}

.za-starters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.za-starter {
    text-align: left;
    padding: 10px 12px;
    border: 1px solid var(--za-line);
    border-radius: 12px;
    background: #fff;
    color: var(--za-ink);
    cursor: pointer;
}

.za-starter:hover {
    border-color: var(--za-blue);
}

.za-msg {
    max-width: 92%;
    margin-bottom: 12px;
}

.za-msg-user {
    margin-left: auto;
}

.za-bubble {
    padding: 10px 12px;
    border-radius: 14px;
    line-height: 1.7;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.za-msg-user .za-bubble {
    background: var(--za-blue);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.za-msg-assistant .za-bubble {
    background: #fff;
    border: 1px solid var(--za-line);
    border-bottom-left-radius: 4px;
    white-space: normal;
}

.za-msg-assistant .za-bubble p,
.za-msg-assistant .za-bubble ul,
.za-msg-assistant .za-bubble ol,
.za-msg-assistant .za-bubble pre {
    margin: 0 0 8px;
}

.za-msg-assistant .za-bubble p:last-child,
.za-msg-assistant .za-bubble ul:last-child,
.za-msg-assistant .za-bubble ol:last-child,
.za-msg-assistant .za-bubble pre:last-child {
    margin-bottom: 0;
}

.za-msg-assistant .za-bubble h3,
.za-msg-assistant .za-bubble h4,
.za-msg-assistant .za-bubble h5 {
    margin: 10px 0 6px;
    font-size: 15px;
    line-height: 1.4;
}

.za-msg-assistant .za-bubble ul,
.za-msg-assistant .za-bubble ol {
    padding-left: 1.25em;
}

.za-msg-assistant .za-bubble li {
    margin: 3px 0;
}

.za-msg-assistant .za-bubble strong {
    font-weight: 650;
}

.za-msg-assistant .za-bubble code {
    padding: 0 4px;
    border-radius: 4px;
    background: rgba(23, 50, 70, 0.06);
    font-size: 13px;
}

.za-msg-assistant .za-bubble pre {
    overflow-x: auto;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(23, 50, 70, 0.06);
}

.za-msg-assistant .za-bubble pre code {
    padding: 0;
    background: transparent;
}

.za-ref {
    margin: 0 1px;
    padding: 0 4px;
    border: 0;
    border-radius: 4px;
    background: rgba(60, 135, 196, 0.14);
    color: var(--za-blue-deep);
    font: inherit;
    font-size: 11px;
    line-height: 1.4;
    vertical-align: super;
    cursor: pointer;
}

.za-ref:hover {
    background: rgba(60, 135, 196, 0.28);
}

.za-source-hit {
    background: rgba(60, 135, 196, 0.12);
    border-radius: 6px;
}

.za-caret::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 1em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background: var(--za-blue);
    animation: za-blink 1s steps(1) infinite;
}

@keyframes za-blink {
    50% { opacity: 0; }
}

.za-sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--za-line);
}

.za-sources h4 {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--za-blue-deep);
}

.za-sources ol {
    margin: 0;
    padding-left: 18px;
}

.za-sources li {
    margin: 6px 0;
    font-size: 12px;
    line-height: 1.5;
}

.za-sources p {
    margin: 2px 0 0;
    color: rgba(23, 50, 70, 0.62);
}

.za-sources a {
    color: var(--za-blue-deep);
}

.za-form {
    display: flex;
    flex-shrink: 0;
    gap: 8px;
    padding: 12px;
    background: #fffdf9;
    border-top: 1px solid var(--za-line);
}

.za-form textarea {
    flex: 1;
    min-height: 44px;
    max-height: 96px;
    resize: none;
    padding: 10px 12px;
    border: 1px solid var(--za-line);
    border-radius: 12px;
    background: #fff;
    color: var(--za-ink);
    font: inherit;
    font-size: 14px;
}

.za-form button {
    align-self: flex-end;
    height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: var(--za-ink);
    color: #f7f4ee;
    cursor: pointer;
}

.za-form button:disabled {
    opacity: 0.45;
    cursor: default;
}

@media (max-width: 640px) {
    .zhishi-assistant {
        right: 12px;
        bottom: 12px;
    }

    .za-panel {
        width: calc(100vw - 24px);
        height: min(70vh, 620px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .za-caret::after {
        animation: none;
    }
}
