#xiaoshu {
    --xs-ink: #243633;
    --xs-teal: #2c5951;
    --xs-paper: #fffaf0;
    --xs-edge: #d7d9c8;
    --xs-inset: 16px;
    --xs-right: max(var(--xs-inset), env(safe-area-inset-right));
    --xs-bottom: max(var(--xs-inset), env(safe-area-inset-bottom));
    position: fixed;
    z-index: 28;
    inset-inline-end: var(--xs-right);
    bottom: var(--xs-bottom);
    color: var(--xs-ink);
    font: 15px/1.55 "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
    color-scheme: light;
    text-align: start;
}
#xiaoshu [hidden] { display: none !important; }
#xiaoshu button, #xiaoshu textarea { font: inherit; }
#xiaoshu button { cursor: pointer; }
#xiaoshu :is(button, a, textarea):focus-visible { outline: 3px solid #338777; outline-offset: 2px; }
#xiaoshu .xs-portrait { position: relative; display: block; flex: none; overflow: hidden; background: #fff6e5; }
#xiaoshu .xs-portrait :is(img, canvas) {
    position: absolute; left: -40%; top: -12%; display: block;
    width: 180%; height: auto; max-width: none; aspect-ratio: 2 / 3;
}
#xiaoshu canvas { pointer-events: none; visibility: hidden; }
#xiaoshu .xs-animated > canvas { visibility: visible; }
#xiaoshu .xs-animated > img { visibility: hidden; }
#xiaoshu .xs-launch {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 68px;
    padding: 0 0 4px;
    overflow: hidden;
    border: 1px solid #fff6d8;
    border-radius: 33px 33px 14px 14px;
    color: var(--xs-ink);
    background: var(--xs-paper);
    box-shadow: 0 4px 22px #050d1566;
    font-weight: 680;
    font-size: 13px;
}
#xiaoshu .xs-launch .xs-portrait { width: 100%; height: 66px; margin-bottom: 3px; }
#xiaoshu .xs-launch:hover { box-shadow: 0 4px 24px #050d15aa, 0 0 0 2px #e8b789; }
#xs-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(500px, calc(100vw - var(--xs-right) - max(var(--xs-inset), env(safe-area-inset-left))));
    height: min(640px, calc(100vh - var(--xs-bottom) - max(var(--xs-inset), env(safe-area-inset-top))));
    max-height: calc(100dvh - var(--xs-bottom) - max(var(--xs-inset), env(safe-area-inset-top)));
    overflow: hidden;
    border: 1px solid var(--xs-edge);
    border-radius: 22px;
    background: var(--xs-paper);
    box-shadow: 0 15px 60px #07122166;
    font-size: 1.125rem;
}
#xiaoshu .xs-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--xs-edge);
    background: #eef0e2;
}
#xiaoshu .xs-head .xs-portrait {
    width: 3.1em; height: 3.1em; border: 1px solid #d4d4bf; border-radius: 50%;
}
#xiaoshu .xs-head h2 { margin: 0; color: var(--xs-ink); font: 700 1.4em/1.25 "Songti SC", Georgia, serif; }
#xiaoshu .xs-head p { margin: 2px 0 0; color: #53665f; font-size: .85em; }
#xiaoshu .xs-head button {
    min-height: 44px; padding: 4px 8px; border: 0; border-radius: 8px; color: var(--xs-teal); background: transparent;
}
#xiaoshu .xs-reset { margin-left: auto; font-size: .9em; }
#xiaoshu .xs-close { width: 44px; margin-left: auto; font-size: 1.7em; line-height: 1; }
#xiaoshu .xs-reset:not([hidden]) + .xs-close { margin-left: 0; }
#xiaoshu .xs-head button:hover { background: #dbe5d5; }
#xiaoshu .xs-scroll { overflow: auto; overscroll-behavior: contain; padding: 22px; scrollbar-color: #bdcabe transparent; }
#xiaoshu .xs-welcome {
    display: grid; grid-template-columns: minmax(0, 1fr) 42%; align-items: center;
    gap: 18px 12px; padding-top: 4px;
}
#xiaoshu .xs-illustration {
    position: relative; grid-column: 2; grid-row: 1 / 3; width: 100%; aspect-ratio: 2 / 3;
    overflow: hidden; border-radius: 0 0 12px 12px;
}
#xiaoshu .xs-illustration :is(img, canvas) { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#xiaoshu .xs-welcome p { grid-column: 1; margin: 0; align-self: end; line-height: 1.7; text-wrap: balance; }
#xiaoshu .xs-prompts { grid-column: 1; align-self: start; }
#xiaoshu .xs-prompts, #xiaoshu .xs-sources { display: flex; flex-direction: column; align-items: start; gap: 9px; }
#xiaoshu .xs-prompts button {
    border: 1px solid #bed0c0; border-radius: 11px; padding: 8px 13px; color: var(--xs-teal); background: #f4f6eb;
    min-height: 44px; text-align: start; text-wrap: balance; font-size: .95em;
}
#xiaoshu .xs-prompts button:hover { background: #e5efdf; }
#xiaoshu .xs-log { display: flex; flex-direction: column; gap: 17px; }
#xiaoshu .xs-question, #xiaoshu .xs-reply { white-space: pre-wrap; overflow-wrap: anywhere; }
#xiaoshu .xs-question {
    align-self: flex-end; max-width: 91%; padding: 10px 15px; border-radius: 15px 15px 4px 15px;
    background: #dfeadb; color: #1d3b31;
}
#xiaoshu .xs-reply { line-height: 1.75; }
#xiaoshu .xs-reply .katex-display { overflow-x: auto; overflow-y: hidden; }
#xiaoshu .xs-sources { margin-top: 9px; gap: 4px; white-space: normal; }
#xiaoshu .xs-sources a { color: var(--xs-teal); font-size: .9em; text-decoration: underline; text-underline-offset: .17em; }
#xiaoshu .xs-status { margin: 14px 0 0; font-size: .9em; color: #54675f; }
#xiaoshu .xs-status:empty { display: none; }
#xiaoshu .xs-form { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 16px; border-top: 1px solid var(--xs-edge); background: #f6f4e8; }
#xiaoshu textarea {
    flex: 1; min-width: 0; resize: none; margin: 0; padding: 8px 10px;
    border: 1px solid transparent; border-radius: 8px; color: var(--xs-ink); background: transparent;
}
#xiaoshu textarea::placeholder { color: #617369; opacity: 1; }
#xiaoshu .xs-send {
    width: 48px; height: 48px; flex: 0 0 auto; border: 0; border-radius: 14px;
    color: white; background: var(--xs-teal); font: 600 1.5em/1 system-ui, sans-serif;
}
#xiaoshu .xs-send:disabled { background: #d4dbce; color: #5f6e63; cursor: default; }
@media (max-width: 540px) {
    #xiaoshu { --xs-inset: 10px; }
    #xs-panel { font-size: 1.0625rem; }
    #xiaoshu .xs-head { padding: 12px 14px; gap: 8px; }
    #xiaoshu .xs-scroll { padding: 16px; }
    #xiaoshu .xs-form { padding: 9px 12px; }
    #xiaoshu .xs-launch { width: 52px; font-size: 12px; border-radius: 25px 25px 11px 11px; }
    #xiaoshu .xs-launch .xs-portrait { height: 47px; }
}

@media (max-width: 420px) {
    #xiaoshu .xs-illustration { grid-row: 1; }
    #xiaoshu .xs-welcome p { align-self: center; }
    #xiaoshu .xs-prompts { grid-column: 1 / -1; flex-flow: row wrap; }
}
