/* ==========================================================================
   网页版免费对话（Awei AI Chat）—— 仅作用于 #page-webaichat
   ========================================================================== */

#page-webaichat {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: 104px;
    background: #fff;
    z-index: 42;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    color: #1a1a1a;
}
#page-webaichat.hidden { display: none; }
#page-webaichat .hidden { display: none !important; }

/* 独立页没有全局 reset，必须自己兜住盒模型，否则输入框在手机上会溢出屏幕 */
#page-webaichat,
#page-webaichat *,
#page-webaichat *::before,
#page-webaichat *::after { box-sizing: border-box; }
#page-webaichat .wc-scroll { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#page-webaichat .wc-list { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#page-webaichat .wc-input,
#page-webaichat .wc-search input { -webkit-appearance: none; appearance: none; border-radius: 0; }

/* ---------------- 顶部浮动工具条 ---------------- */
#page-webaichat .wc-topbar {
    position: absolute;
    left: 18px;
    top: 16px;
    display: flex;
    align-items: center;
    gap: 2px;
    background: #fff;
    border: 1px solid #f0f1f4;
    border-radius: 16px;
    padding: 5px;
    box-shadow: 0 4px 18px rgba(17, 24, 39, .07);
    z-index: 6;
}
#page-webaichat .wc-ico {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    border-radius: 11px;
    color: #6b7280;
    font-size: 14.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .14s, color .14s;
}
#page-webaichat .wc-ico:hover { background: #f4f5f7; color: #111827; }

/* ---------------- 侧栏（历史对话） ---------------- */
#page-webaichat .wc-side {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 288px;
    background: #fafafa;
    border-right: 1px solid #f0f1f4;
    transform: translateX(-102%);
    transition: transform .26s cubic-bezier(.22, .61, .36, 1);
    z-index: 8;
    display: flex;
    flex-direction: column;
}
#page-webaichat .wc-side.open { transform: translateX(0); }
#page-webaichat .wc-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 10px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}
#page-webaichat .wc-side-head button {
    width: 28px;
    height: 28px;
    border: 0;
    background: #fff;
    border: 1px solid #ececf1;
    border-radius: 9px;
    color: #4b5563;
    cursor: pointer;
    font-size: 13px;
}
#page-webaichat .wc-side-head button:hover { background: #f2f3f5; }
#page-webaichat .wc-search {
    margin: 0 12px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #ececf1;
    border-radius: 10px;
    padding: 8px 11px;
}
#page-webaichat .wc-search i { color: #b9bfc9; font-size: 13px; }
#page-webaichat .wc-search input {
    border: 0;
    outline: none;
    background: transparent;
    font-size: 13px;
    width: 100%;
    color: #111827;
}
#page-webaichat .wc-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0 8px 8px;
}
#page-webaichat .wc-group-t {
    font-size: 11.5px;
    color: #a2a8b3;
    padding: 10px 10px 5px;
    letter-spacing: .2px;
}
#page-webaichat .wc-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 10px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: background .12s;
}
#page-webaichat .wc-item:hover { background: #f0f1f4; }
#page-webaichat .wc-item.on { background: #e9ebef; color: #111827; font-weight: 600; }
#page-webaichat .wc-item-t {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#page-webaichat .wc-item-del {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #b9bfc9;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 3px;
    border-radius: 5px;
    opacity: 0;
    transition: opacity .12s, color .12s;
}
#page-webaichat .wc-item:hover .wc-item-del { opacity: 1; }
#page-webaichat .wc-item-act {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #b9bfc9;
    cursor: pointer;
    padding: 2px 3px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity .12s, color .12s;
}
#page-webaichat .wc-item-act svg { width: 13px; height: 13px; }
#page-webaichat .wc-item:hover .wc-item-act { opacity: 1; }
#page-webaichat .wc-item-act:hover { color: #4f5bd5; }
/* 触屏设备：分享/删除常显，否则手机上没有 hover 无法操作 */
@media (hover: none) {
    #page-webaichat .wc-item-act, #page-webaichat .wc-item-del { opacity: .5; }
}
#page-webaichat .wc-item-del:hover { color: #dc2626; }
#page-webaichat .wc-empty {
    padding: 26px 12px;
    text-align: center;
    color: #b9bfc9;
    font-size: 12.5px;
    line-height: 1.7;
}
#page-webaichat .wc-side-foot {
    padding: 10px 12px 16px;
    border-top: 1px solid #f0f1f4;
    display: flex;
    gap: 8px;
}
#page-webaichat .wc-side-foot button {
    flex: 1 1 auto;
    border: 1px solid #ececf1;
    background: #fff;
    border-radius: 9px;
    padding: 8px 10px;
    font-size: 12.5px;
    color: #4b5563;
    cursor: pointer;
    transition: background .12s, color .12s;
}
#page-webaichat .wc-side-foot button:hover { background: #f2f3f5; color: #111827; }

#page-webaichat .wc-scrim {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, .18);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s;
    z-index: 7;
}
#page-webaichat .wc-scrim.on { opacity: 1; pointer-events: auto; }

/* ---------------- 主区 ---------------- */
#page-webaichat .wc-main {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
}
/* 欢迎态：输入框紧跟欢迎语，整体垂直居中（与 DeepSeek 网页端一致） */
#page-webaichat .wc-main.hero-mode { justify-content: center; }
#page-webaichat .wc-main.hero-mode .wc-scroll { flex: 0 0 auto; overflow: visible; }
#page-webaichat .wc-main.hero-mode .wc-hero { flex: 0 0 auto; padding-bottom: 26px; }
#page-webaichat .wc-main.hero-mode .wc-composer-wrap { background: none; padding-bottom: 0; }
#page-webaichat .wc-scroll {
    flex: 1 1 auto;
    width: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 16px;
}

/* 欢迎态 */
#page-webaichat .wc-hero {
    flex: 1 1 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 90px;
}
#page-webaichat .wc-hero-line {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 760px;
    padding: 0 10px;
}
#page-webaichat .wc-hero-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    object-fit: contain;
    flex: 0 0 40px;
}
#page-webaichat .wc-hero-text {
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -.5px;
    color: #111827;
    line-height: 1.32;
}

/* 消息线程 */
#page-webaichat .wc-thread {
    width: 100%;
    max-width: 760px;
    padding: 74px 0 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
#page-webaichat .wc-msg {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
#page-webaichat .wc-msg.me { flex-direction: row-reverse; }
#page-webaichat .wc-ava {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    flex: 0 0 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    overflow: hidden;
}
#page-webaichat .wc-msg.me .wc-ava {
    background: #eef0f4;
    color: #4b5563;
    font-weight: 600;
}
#page-webaichat .wc-ava img { width: 100%; height: 100%; object-fit: contain; }
#page-webaichat .wc-body {
    min-width: 0;
    max-width: calc(100% - 60px);
    font-size: 15px;
    line-height: 1.75;
    color: #1f2328;
    word-break: break-word;
}
#page-webaichat .wc-msg.me .wc-body {
    background: #f4f5f7;
    border-radius: 14px;
    padding: 10px 14px;
    white-space: pre-wrap;
}
#page-webaichat .wc-body .md-code { margin: 10px 0; }
#page-webaichat .wc-reason {
    margin: 2px 0 10px;
    border: 1px solid #ececf1;
    border-radius: 12px;
    background: #f8f9fb;
    overflow: hidden;
}
#page-webaichat .wc-reason-hd {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    color: #6b7280;
    text-align: left;
    font-family: inherit;
    transition: background .16s;
}
#page-webaichat .wc-reason-hd:hover { background: rgba(17, 24, 39, .035); color: #374151; }
#page-webaichat .wc-reason-caret {
    font-size: 13px;
    transition: transform .18s ease;
    transform: rotate(0deg);
    color: #9aa1ac;
}
#page-webaichat .wc-reason.open .wc-reason-caret { transform: rotate(90deg); }
#page-webaichat .wc-reason-st i { font-size: 11px; margin-right: 2px; }
#page-webaichat .wc-reason-bd {
    display: none;
    padding: 0 12px 10px 32px;
    max-height: 320px;
    overflow-y: auto;
}
#page-webaichat .wc-reason.open .wc-reason-bd { display: block; }
#page-webaichat .wc-reason-tx {
    font-size: 13px;
    line-height: 1.78;
    color: #8b93a1;
    white-space: pre-wrap;
    word-break: break-word;
    border-left: 2px solid #e5e7eb;
    padding-left: 10px;
}
#page-webaichat .wc-reason.open { background: #fff; }
html.dark #page-webaichat .wc-reason { background: rgba(255, 255, 255, .035); border-color: rgba(255, 255, 255, .09); }
html.dark #page-webaichat .wc-reason.open { background: rgba(255, 255, 255, .05); }
html.dark #page-webaichat .wc-reason-hd { color: #9aa1ac; }
html.dark #page-webaichat .wc-reason-hd:hover { background: rgba(255, 255, 255, .06); color: #e5e7eb; }
html.dark #page-webaichat .wc-reason-caret { color: #6b7280; }
html.dark #page-webaichat .wc-reason-tx { color: #8b93a1; border-left-color: rgba(255, 255, 255, .14); }
#page-webaichat .wc-files-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
#page-webaichat .wc-file-chip {
    font-size: 11.5px;
    color: #6b7280;
    background: #f0f1f4;
    border-radius: 6px;
    padding: 3px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
#page-webaichat .wc-file-chip img { width: 16px; height: 16px; border-radius: 3px; object-fit: cover; }

#page-webaichat .wc-typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c1c7d0;
    margin-right: 4px;
    animation: wcBounce 1s infinite ease-in-out;
}
#page-webaichat .wc-typing span:nth-child(2) { animation-delay: .15s; }
#page-webaichat .wc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes wcBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: .5; }
    40% { transform: translateY(-4px); opacity: 1; }
}

/* ---------------- 输入区 ---------------- */
#page-webaichat .wc-composer-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 24%);
}
#page-webaichat .wc-composer {
    width: 100%;
    max-width: 760px;
    background: #fff;
    border: 1px solid #ececf1;
    border-radius: 20px;
    padding: 14px 16px 11px;
    box-shadow: 0 6px 24px rgba(17, 24, 39, .07);
    transition: border-color .16s, box-shadow .16s;
}
#page-webaichat .wc-composer:focus-within {
    border-color: #d9dde4;
    box-shadow: 0 8px 28px rgba(17, 24, 39, .1);
}
#page-webaichat .wc-input {
    width: 100%;
    border: 0;
    outline: none;
    resize: none;
    font-size: 15px;
    line-height: 1.6;
    color: #111827;
    background: transparent;
    max-height: 168px;
    min-height: 52px;
    padding: 4px 2px 8px;
    font-family: inherit;
}
#page-webaichat .wc-input::placeholder { color: #b9bfc9; }

#page-webaichat .wc-composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
}
#page-webaichat .wc-think {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e6e8ec;
    background: #fff;
    border-radius: 999px;
    padding: 7px 13px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    transition: all .16s;
    font-family: inherit;
}
#page-webaichat .wc-think i { font-size: 13px; color: #9aa1ac; transition: color .16s; }
#page-webaichat .wc-think:hover { border-color: #d5d9e0; background: #fafbfc; }
#page-webaichat .wc-think.on {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3b5bdb;
}
#page-webaichat .wc-think.on i { color: #3b5bdb; }

#page-webaichat .wc-right { display: flex; align-items: center; gap: 6px; }
#page-webaichat .wc-attach {
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    border-radius: 50%;
    color: #6b7280;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .14s, color .14s;
}
#page-webaichat .wc-attach:hover { background: #f4f5f7; color: #111827; }
#page-webaichat .wc-send {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #4d6bfe;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .14s, transform .12s;
}
#page-webaichat .wc-send:hover { background: #3f5be8; }
#page-webaichat .wc-send:active { transform: scale(.94); }
#page-webaichat .wc-send.off { background: #e3e6eb; color: #fff; cursor: default; }
#page-webaichat .wc-send.stop { background: #111827; }
#page-webaichat .wc-send.stop i::before { content: "\f04d"; }

#page-webaichat .wc-files {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 2px 0 8px;
}
#page-webaichat .wc-files:empty { display: none; }
#page-webaichat .wc-file {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f4f5f7;
    border-radius: 9px;
    padding: 6px 9px;
    font-size: 12px;
    color: #4b5563;
    max-width: 220px;
}
#page-webaichat .wc-file img { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; }
#page-webaichat .wc-file b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#page-webaichat .wc-file .x {
    border: 0;
    background: transparent;
    color: #9aa1ac;
    cursor: pointer;
    font-size: 11px;
    padding: 0 1px;
}
#page-webaichat .wc-file .x:hover { color: #dc2626; }

#page-webaichat .wc-tip {
    font-size: 11.5px;
    color: #b9bfc9;
    margin-top: 9px;
    text-align: center;
}

/* ---------------- 深色 ---------------- */
html.dark #page-webaichat,
body.dark #page-webaichat { background: #14161b; color: #e5e7eb; }
html.dark #page-webaichat .wc-topbar,
html.dark #page-webaichat .wc-composer { background: #1b1e24; border-color: #2a2e36; }
html.dark #page-webaichat .wc-ico { color: #9aa1ac; }
html.dark #page-webaichat .wc-ico:hover { background: #23262d; color: #f3f4f6; }
html.dark #page-webaichat .wc-hero-text { color: #f3f4f6; }
html.dark #page-webaichat .wc-side { background: #171a20; border-right-color: #262931; }
html.dark #page-webaichat .wc-side-head { color: #f3f4f6; }
html.dark #page-webaichat .wc-side-head button,
html.dark #page-webaichat .wc-search { background: #1f2229; border-color: #2a2e36; color: #cbd2da; }
html.dark #page-webaichat .wc-search input { color: #e5e7eb; }
html.dark #page-webaichat .wc-item { color: #cbd2da; }
html.dark #page-webaichat .wc-item:hover { background: #23262d; }
html.dark #page-webaichat .wc-item.on { background: #2a2e36; color: #fff; }
html.dark #page-webaichat .wc-side-foot { border-top-color: #262931; }
html.dark #page-webaichat .wc-side-foot button { background: #1f2229; border-color: #2a2e36; color: #cbd2da; }
html.dark #page-webaichat .wc-composer-wrap { background: linear-gradient(180deg, rgba(20, 22, 27, 0), #14161b 24%); }
html.dark #page-webaichat .wc-input { color: #f3f4f6; }
html.dark #page-webaichat .wc-think { background: #1f2229; border-color: #2f333b; color: #cbd2da; }
html.dark #page-webaichat .wc-think.on { background: #1e2740; border-color: #33477e; color: #93a7ff; }
html.dark #page-webaichat .wc-body { color: #e5e7eb; }
html.dark #page-webaichat .wc-msg.me .wc-body { background: #23262d; }
html.dark #page-webaichat .wc-msg.me .wc-ava { background: #23262d; color: #cbd2da; }
html.dark #page-webaichat .wc-file,
html.dark #page-webaichat .wc-file-chip { background: #23262d; color: #cbd2da; }
html.dark #page-webaichat .wc-send.off { background: #33373f; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
    #page-webaichat .wc-hero-text { font-size: 21px; }
    #page-webaichat .wc-thread { padding-top: 66px; }
    #page-webaichat .wc-body { font-size: 14.5px; }
}

/* ===== 平板 / 手机：竖屏单栏布局 ===== */
@media (max-width: 720px) {
    #page-webaichat { top: 64px; }

    /* 顶部工具条：加大点按面积，跟随安全区 */
    #page-webaichat .wc-topbar {
        left: 10px;
        top: calc(8px + env(safe-area-inset-top));
        padding: 4px;
        gap: 0;
        border-radius: 14px;
    }
    #page-webaichat .wc-ico { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; }
    #page-webaichat .wc-ico svg { width: 17px; height: 17px; }

    /* 侧栏：抽屉化 */
    #page-webaichat .wc-side {
        width: 86%;
        max-width: 320px;
        padding-top: calc(6px + env(safe-area-inset-top));
    }
    #page-webaichat .wc-side-head { padding: 16px 14px 10px; font-size: 15px; }
    #page-webaichat .wc-item { padding: 11px 10px; font-size: 13.5px; border-radius: 10px; }
    #page-webaichat .wc-item-del { opacity: .6; }
    #page-webaichat .wc-side-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
    #page-webaichat .wc-side-foot button { padding: 10px; font-size: 13px; }
    #page-webaichat .wc-search { padding: 9px 11px; }
    #page-webaichat .wc-search input { font-size: 15px; }

    /* 消息区 */
    #page-webaichat .wc-scroll { padding: 0 12px; }
    /* 手机欢迎态：问候语落在上三分之一，输入框沉到底部（更接近手机聊天 App 手感） */
    #page-webaichat .wc-main.hero-mode { justify-content: flex-start; }
    #page-webaichat .wc-main.hero-mode .wc-scroll { flex: 0 0 auto; width: 100%; padding-top: 30vh; }
    #page-webaichat .wc-main.hero-mode .wc-composer-wrap { margin-top: auto; }
    #page-webaichat .wc-thread { padding: 62px 0 14px; gap: 18px; }
    #page-webaichat .wc-hero { padding-bottom: 46px; padding-left: 4px; padding-right: 4px; }
    #page-webaichat .wc-main.hero-mode .wc-hero { padding-bottom: 18px; }
    #page-webaichat .wc-hero-line { gap: 10px; padding: 0 6px; align-items: flex-start; }
    #page-webaichat .wc-hero-icon { width: 32px; height: 32px; flex-basis: 32px; border-radius: 10px; }
    #page-webaichat .wc-hero-text { font-size: 19px; line-height: 1.45; letter-spacing: -.3px; }
    #page-webaichat .wc-msg { gap: 8px; }
    #page-webaichat .wc-ava { width: 26px; height: 26px; flex-basis: 26px; border-radius: 8px; font-size: 11px; }
    #page-webaichat .wc-body { font-size: 15px; line-height: 1.72; max-width: calc(100% - 34px); }
    #page-webaichat .wc-msg.me .wc-body { padding: 9px 12px; border-radius: 13px; }
    #page-webaichat .wc-reason { border-radius: 11px; margin-bottom: 8px; }
    #page-webaichat .wc-reason-hd { padding: 8px 10px; font-size: 12px; gap: 6px; }
    #page-webaichat .wc-reason-bd { padding: 0 10px 10px 10px; max-height: 46vh; }
    #page-webaichat .wc-reason-tx { font-size: 12.5px; line-height: 1.72; padding-left: 8px; }

    /* 输入区 */
    #page-webaichat .wc-composer-wrap {
        padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
        background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 20%);
    }
    #page-webaichat .wc-main.hero-mode .wc-composer-wrap { background: none; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
    #page-webaichat .wc-composer { border-radius: 18px; padding: 10px 12px 8px; }
    /* iOS 输入框字号 < 16px 会触发自动放大，必须 16 */
    #page-webaichat .wc-input { font-size: 16px; min-height: 42px; max-height: 132px; padding: 6px 2px 6px; line-height: 1.55; }
    #page-webaichat .wc-composer-bar { gap: 8px; margin-top: 2px; }
    #page-webaichat .wc-think { padding: 7px 11px; font-size: 12.5px; }
    #page-webaichat .wc-attach, #page-webaichat .wc-send { width: 36px; height: 36px; }
    #page-webaichat .wc-attach { color: #6b7280; }
    #page-webaichat .wc-tip { font-size: 10px; line-height: 1.55; margin-top: 8px; padding: 0 6px; }
    #page-webaichat .wc-files { gap: 6px; }
    #page-webaichat .wc-file { max-width: 100%; padding: 5px 8px; }

    /* 代码块 / 表格：手机上不撑破屏宽 */
    #page-webaichat .wc-body .md-code { border-radius: .6rem; margin: .6rem 0; }
    #page-webaichat .wc-body .md-code pre { padding: .6rem .7rem; }
    #page-webaichat .wc-body .md-code pre code { font-size: .73rem; line-height: 1.62; }
    #page-webaichat .wc-body .md-code-bar { padding: .28rem .45rem .28rem .7rem; }
    #page-webaichat .wc-body .md-h2 { font-size: 1.08rem; }
    #page-webaichat .wc-body .md-h3 { font-size: 1rem; }
    #page-webaichat .wc-body .md-table th,
    #page-webaichat .wc-body .md-table td { padding: .4rem .5rem; font-size: .78rem; }
    #page-webaichat .wc-body .md-list { padding-left: 1.05rem; }
}

/* ===== 小屏手机 ===== */
@media (max-width: 400px) {
    #page-webaichat .wc-hero-text { font-size: 17px; }
    #page-webaichat .wc-hero-icon { width: 28px; height: 28px; flex-basis: 28px; }
    #page-webaichat .wc-think { padding: 7px 9px; font-size: 12px; }
    #page-webaichat .wc-attach, #page-webaichat .wc-send { width: 34px; height: 34px; }
    #page-webaichat .wc-composer-wrap { padding-left: 10px; padding-right: 10px; }
}

/* 横屏手机：高度紧张，收紧留白 */
@media (max-height: 520px) and (max-width: 900px) {
    #page-webaichat .wc-main.hero-mode .wc-scroll { padding-top: 12vh; }
    #page-webaichat .wc-main.hero-mode .wc-composer-wrap { margin-top: auto; }
    #page-webaichat .wc-hero { padding-bottom: 14px; }
    #page-webaichat .wc-main.hero-mode .wc-hero { padding-bottom: 8px; }
    #page-webaichat .wc-hero-text { font-size: 17px; }
    #page-webaichat .wc-tip { display: none; }
    #page-webaichat .wc-thread { padding-top: 58px; }
    #page-webaichat .wc-input { min-height: 34px; max-height: 74px; }
}

/* ---------------- 对话内 Markdown 排版 ---------------- */
#page-webaichat .wc-body > *:first-child { margin-top: 0 !important; }
#page-webaichat .wc-body > *:last-child { margin-bottom: 0 !important; }
#page-webaichat .wc-body .md-p { margin: .55rem 0; }
#page-webaichat .wc-body .md-h { margin: 1.1rem 0 .5rem; font-weight: 700; line-height: 1.45; letter-spacing: -.01em; color: #111827; }
#page-webaichat .wc-body .md-h2 { font-size: 1.14rem; }
#page-webaichat .wc-body .md-h3 { font-size: 1.04rem; }
#page-webaichat .wc-body .md-h4 { font-size: .96rem; }
#page-webaichat .wc-body .md-h5 { font-size: .9rem; color: #374151; }
#page-webaichat .wc-body .md-list { margin: .5rem 0 .6rem; padding-left: 1.2rem; }
#page-webaichat .wc-body .md-list li { margin: .25rem 0; }
#page-webaichat .wc-body ul.md-list { list-style: disc; }
#page-webaichat .wc-body ol.md-list { list-style: decimal; }
#page-webaichat .wc-body .md-quote { margin: .65rem 0; padding: .1rem 0 .1rem .9rem; border-left: 3px solid rgba(17, 24, 39, .16); color: #5b6472; }
#page-webaichat .wc-body .md-hr { margin: 1rem 0; border: 0; border-top: 1px solid rgba(17, 24, 39, .1); }
#page-webaichat .wc-body .md-a { color: #2563eb; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
#page-webaichat .wc-body .md-a:hover { color: #1d4ed8; }
#page-webaichat .wc-body .md-img { max-width: 100%; border-radius: .6rem; margin: .45rem 0; border: 1px solid rgba(17, 24, 39, .08); }
#page-webaichat .wc-body .md-ic {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .84em; padding: .05rem .32rem; border-radius: .33rem;
    background: rgba(17, 24, 39, .06); border: 1px solid rgba(17, 24, 39, .05);
    color: #be123c; word-break: break-word;
}
#page-webaichat .wc-body .md-code {
    margin: .75rem 0; border-radius: .8rem; overflow: hidden;
    background: #0f141d; border: 1px solid rgba(17, 24, 39, .12);
    max-width: 100%;
}
#page-webaichat .wc-body .md-code-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: .34rem .55rem .34rem .85rem;
    background: rgba(255, 255, 255, .05);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
#page-webaichat .wc-body .md-code-lang { font-size: .67rem; letter-spacing: .1em; font-weight: 600; color: #8b93a1; }
#page-webaichat .wc-body .md-code-copy {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .71rem; color: #9aa2af; background: transparent; border: 0;
    padding: .16rem .45rem; border-radius: .35rem; cursor: pointer;
}
#page-webaichat .wc-body .md-code-copy:hover { color: #fff; background: rgba(255, 255, 255, .09); }
#page-webaichat .wc-body .md-code pre { margin: 0; padding: .78rem .9rem; overflow-x: auto; }
#page-webaichat .wc-body .md-code pre code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .81rem; line-height: 1.68; color: #e2e8f0; white-space: pre;
}
#page-webaichat .wc-body .md-table-wrap { margin: .75rem 0; overflow-x: auto; border-radius: .6rem; border: 1px solid rgba(17, 24, 39, .1); }
#page-webaichat .wc-body .md-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
#page-webaichat .wc-body .md-table th,
#page-webaichat .wc-body .md-table td { padding: .48rem .68rem; border-bottom: 1px solid rgba(17, 24, 39, .07); text-align: left; vertical-align: top; }
#page-webaichat .wc-body .md-table thead th { background: rgba(17, 24, 39, .03); font-weight: 600; }

html.dark #page-webaichat .wc-body .md-h,
html.dark #page-webaichat .wc-body .md-h5 { color: #f3f4f6; }
html.dark #page-webaichat .wc-body .md-quote { border-left-color: rgba(255, 255, 255, .18); color: #9aa1ac; }
html.dark #page-webaichat .wc-body .md-hr { border-top-color: rgba(255, 255, 255, .12); }
html.dark #page-webaichat .wc-body .md-a { color: #7aa2ff; }
html.dark #page-webaichat .wc-body .md-ic { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .07); color: #fda4af; }
html.dark #page-webaichat .wc-body .md-table-wrap { border-color: rgba(255, 255, 255, .1); }
html.dark #page-webaichat .wc-body .md-table th,
html.dark #page-webaichat .wc-body .md-table td { border-bottom-color: rgba(255, 255, 255, .08); }
html.dark #page-webaichat .wc-body .md-table thead th { background: rgba(255, 255, 255, .04); }

/* ==========================================================================
   侧栏用户信息栏（与阿威云试炼账号互通）
   ========================================================================== */
#page-webaichat .wc-user {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    width: auto;
    margin: 0 12px 8px;
    padding: 9px 10px;
    border: 1px solid #ececf1;
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background .14s, border-color .14s;
}
#page-webaichat .wc-user:hover { background: #f4f5f7; border-color: #e2e4ea; }
#page-webaichat .wc-user-ava {
    flex: 0 0 auto;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f5bd5, #7b61ff);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#page-webaichat .wc-user-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#page-webaichat .wc-user-nm {
    font-size: 13px; font-weight: 600; color: #111827;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-webaichat .wc-user-sub {
    font-size: 11px; color: #9aa1ac;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-webaichat .wc-user-badge {
    display: inline-block; margin-left: 4px; padding: 0 5px;
    font-size: 9.5px; font-weight: 700; line-height: 15px;
    border-radius: 4px; background: #eef0ff; color: #4f5bd5; vertical-align: 1px;
}
#page-webaichat .wc-user-gear { flex: 0 0 auto; color: #c0c5cf; display: flex; }
#page-webaichat .wc-user-gear svg { width: 15px; height: 15px; }
#page-webaichat .wc-user:hover .wc-user-gear { color: #6b7280; }

html.dark #page-webaichat .wc-user { background: #1f2229; border-color: #2a2e36; }
html.dark #page-webaichat .wc-user:hover { background: #24272f; border-color: #343943; }
html.dark #page-webaichat .wc-user-nm { color: #f3f4f6; }
html.dark #page-webaichat .wc-user-sub { color: #868e9c; }
html.dark #page-webaichat .wc-user-badge { background: #1e2740; color: #93a7ff; }

/* ==========================================================================
   分享查看提示条
   ========================================================================== */
#page-webaichat .wc-sharebar {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 16px;
    background: #f4f6ff;
    border-bottom: 1px solid #e6eaff;
    color: #3b4664;
    font-size: 12.5px;
    z-index: 5;
}
#page-webaichat .wc-sharebar.hidden { display: none; }
#page-webaichat .wc-sharebar-t { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#page-webaichat .wc-sharebar-btns { flex: 0 0 auto; display: flex; gap: 8px; }
#page-webaichat .wc-sharebar button {
    border: 1px solid #cfd7f7; background: #fff; color: #4049c8;
    font-size: 12px; font-family: inherit; padding: 5px 11px;
    border-radius: 8px; cursor: pointer; white-space: nowrap;
}
#page-webaichat .wc-sharebar button:hover { background: #eef1ff; }
#page-webaichat .wc-sharebar button.ghost { border-color: #e2e4ea; color: #6b7280; background: transparent; }
/* 分享查看时隐藏浮动工具条，避免压住提示条 */
body.wc-shared #page-webaichat .wc-topbar { display: none; }
body.wc-shared #page-webaichat .wc-sharebar { padding-top: max(9px, env(safe-area-inset-top)); }
html.dark #page-webaichat .wc-sharebar { background: #1a1f30; border-bottom-color: #232a40; color: #c3cbe4; }
html.dark #page-webaichat .wc-sharebar button { background: #232a40; border-color: #33405f; color: #a9b6ff; }
html.dark #page-webaichat .wc-sharebar button.ghost { background: transparent; border-color: #2a2e36; color: #9aa1ac; }

/* ==========================================================================
   弹窗：免费对话设置 / 分享对话
   ========================================================================== */
.wc-modal { position: fixed; inset: 0; z-index: 950; display: flex; align-items: center; justify-content: center; }
.wc-modal.hidden { display: none !important; }
.wc-mask { position: absolute; inset: 0; background: rgba(17, 24, 39, .34); backdrop-filter: blur(2px); }

.wc-set {
    position: relative;
    width: min(880px, calc(100vw - 40px));
    height: min(560px, calc(100vh - 60px));
    max-height: min(640px, calc(100vh - 60px));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(17, 24, 39, .24);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #111827;
    animation: wcPop .18s ease-out;
}
@keyframes wcPop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.wc-set-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    font-size: 15.5px;
}
.wc-set-head b { font-weight: 600; letter-spacing: .2px; }
.wc-x {
    width: 28px; height: 28px; border: 0; background: transparent; border-radius: 8px;
    color: #9aa1ac; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.wc-x:hover { background: #f2f3f5; color: #111827; }
.wc-set-body { flex: 1 1 auto; display: flex; min-height: 0; }
.wc-set-nav { flex: 0 0 190px; padding: 0 12px 18px 16px; display: flex; flex-direction: column; gap: 2px; }
.wc-set-nav button {
    display: flex; align-items: center; gap: 9px;
    width: 100%; padding: 10px 12px;
    border: 0; background: transparent; border-radius: 9px;
    font-size: 13.5px; color: #3f4652; font-family: inherit;
    cursor: pointer; text-align: left; transition: background .12s, color .12s;
}
.wc-set-nav button svg { width: 16px; height: 16px; color: #8b93a1; flex: none; }
.wc-set-nav button:hover { background: #f5f6f8; }
.wc-set-nav button.on { background: #eceef2; color: #111827; font-weight: 600; }
.wc-set-nav button.on svg { color: #111827; }

.wc-set-main { flex: 1 1 auto; min-width: 0; padding: 6px 26px 26px 26px; overflow-y: auto; }
.wc-pane { display: none; }
.wc-pane.on { display: block; }
.wc-label { font-size: 13.5px; color: #4b5563; margin: 0 0 12px; }
.wc-themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.wc-themes button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
    padding: 26px 6px;
    border: 1px solid #e4e6eb; background: #fff; border-radius: 12px;
    font-size: 13px; color: #374151; font-family: inherit; cursor: pointer;
    transition: border-color .14s, background .14s, box-shadow .14s;
}
.wc-themes button svg { width: 20px; height: 20px; color: #4b5563; }
.wc-themes button:hover { border-color: #cfd3da; }
.wc-themes button.on { background: #f4f5f7; border-color: #d6d9df; box-shadow: inset 0 0 0 1px #e2e4ea; }
.wc-line { height: 1px; background: #eef0f3; margin: 22px 0 18px; }
.wc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wc-select { position: relative; display: inline-flex; align-items: center; }
.wc-select select {
    appearance: none; -webkit-appearance: none;
    border: 0; background: #f4f5f7; border-radius: 9px;
    padding: 9px 34px 9px 14px; font-size: 13px; color: #374151;
    font-family: inherit; cursor: pointer; outline: none;
}
.wc-select svg { position: absolute; right: 12px; color: #6b7280; pointer-events: none; }

/* 账号管理 */
.wc-acc { display: flex; flex-direction: column; gap: 14px; padding-top: 6px; }
.wc-acc-top { display: flex; align-items: center; gap: 14px; }
.wc-acc-ava {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, #4f5bd5, #7b61ff); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 21px; font-weight: 700; flex: none;
}
.wc-acc-nm { font-size: 16px; font-weight: 600; }
.wc-acc-id { font-size: 12.5px; color: #9aa1ac; margin-top: 3px; }
.wc-acc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.wc-acc-cell { background: #f7f8fa; border-radius: 11px; padding: 12px 14px; }
.wc-acc-cell b { display: block; font-size: 12px; color: #8b93a1; font-weight: 500; margin-bottom: 5px; }
.wc-acc-cell span { font-size: 15px; font-weight: 600; color: #111827; }
.wc-acc-tip { font-size: 12.5px; color: #9aa1ac; line-height: 1.8; }
.wc-acc-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.wc-acc-btns button, .wc-btn-primary {
    border: 1px solid #e4e6eb; background: #fff; border-radius: 9px;
    padding: 9px 16px; font-size: 13px; color: #374151; font-family: inherit; cursor: pointer;
}
.wc-acc-btns button.primary { background: #111827; border-color: #111827; color: #fff; }
.wc-acc-btns button:hover { background: #f4f5f7; }
.wc-acc-btns button.primary:hover { background: #23262d; }

/* 数据管理 */
.wc-data-stat { font-size: 13px; color: #4b5563; background: #f7f8fa; border-radius: 11px; padding: 13px 15px; }
.wc-data-btns { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.wc-data-btns button {
    display: flex; align-items: center; gap: 9px;
    border: 1px solid #e4e6eb; background: #fff; border-radius: 10px;
    padding: 11px 14px; font-size: 13px; color: #374151; font-family: inherit;
    cursor: pointer; text-align: left;
}
.wc-data-btns button svg { width: 16px; height: 16px; color: #6b7280; flex: none; }
.wc-data-btns button:hover { background: #f7f8fa; }
.wc-data-btns button.danger { color: #dc2626; border-color: #f3d6d6; }
.wc-data-btns button.danger svg { color: #dc2626; }
.wc-data-btns button.danger:hover { background: #fdf3f3; }
.wc-data-note { font-size: 12px; color: #a2a8b3; line-height: 1.8; margin-top: 12px; }

/* 服务协议 */
.wc-terms { font-size: 13px; color: #4b5563; line-height: 1.95; }
.wc-terms b { display: block; font-size: 14.5px; color: #111827; margin-bottom: 10px; }
.wc-terms p { margin: 0 0 10px; }

/* 分享弹窗 */
.wc-sharebox {
    position: relative;
    width: min(560px, calc(100vw - 36px));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(17, 24, 39, .24);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #111827;
    animation: wcPop .18s ease-out;
}
.wc-share-body { padding: 2px 22px 20px; }
.wc-share-meta { font-size: 12.5px; color: #6b7280; margin-bottom: 10px; }
.wc-share-meta b { color: #111827; }
.wc-share-link {
    width: 100%; resize: none;
    border: 1px solid #e4e6eb; border-radius: 10px;
    background: #f7f8fa; padding: 11px 13px;
    font-size: 12px; line-height: 1.6; color: #374151;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    outline: none; word-break: break-all;
}
.wc-share-actions { display: flex; gap: 10px; margin-top: 14px; }
.wc-share-actions button {
    flex: 1 1 auto; padding: 10px 14px; border-radius: 10px;
    font-size: 13.5px; font-family: inherit; cursor: pointer;
    border: 1px solid #e4e6eb; background: #fff; color: #374151;
}
.wc-share-actions button.primary { background: #111827; border-color: #111827; color: #fff; }
.wc-share-actions button.primary:hover { background: #23262d; }
.wc-share-actions button.ghost:hover { background: #f4f5f7; }
.wc-share-note { font-size: 12px; color: #a2a8b3; line-height: 1.75; margin-top: 12px; }

/* 深色 */
html.dark .wc-set, html.dark .wc-sharebox { background: #1b1e24; color: #e5e7eb; }
html.dark .wc-x:hover { background: #262a32; color: #f3f4f6; }
html.dark .wc-set-nav button { color: #cbd2da; }
html.dark .wc-set-nav button svg { color: #868e9c; }
html.dark .wc-set-nav button:hover { background: #23262d; }
html.dark .wc-set-nav button.on { background: #2a2e36; color: #fff; }
html.dark .wc-set-nav button.on svg { color: #fff; }
html.dark .wc-label { color: #9aa1ac; }
html.dark .wc-themes button { background: #20242b; border-color: #2e333c; color: #cbd2da; }
html.dark .wc-themes button svg { color: #cbd2da; }
html.dark .wc-themes button.on { background: #2a2e36; border-color: #3a4049; box-shadow: inset 0 0 0 1px #3a4049; }
html.dark .wc-line { background: #262a32; }
html.dark .wc-select select { background: #262a32; color: #e5e7eb; }
html.dark .wc-acc-nm { color: #f3f4f6; }
html.dark .wc-acc-cell { background: #20242b; }
html.dark .wc-acc-cell span { color: #f3f4f6; }
html.dark .wc-acc-btns button { background: #20242b; border-color: #2e333c; color: #cbd2da; }
html.dark .wc-acc-btns button.primary { background: #f3f4f6; border-color: #f3f4f6; color: #111827; }
html.dark .wc-data-stat { background: #20242b; color: #cbd2da; }
html.dark .wc-data-btns button { background: #20242b; border-color: #2e333c; color: #cbd2da; }
html.dark .wc-data-btns button:hover { background: #262a32; }
html.dark .wc-data-btns button.danger { color: #f87171; border-color: #4a2a2e; }
html.dark .wc-terms { color: #a9b0bc; }
html.dark .wc-terms b { color: #f3f4f6; }
html.dark .wc-share-meta { color: #9aa1ac; }
html.dark .wc-share-meta b { color: #f3f4f6; }
html.dark .wc-share-note { color: #7b828e; }
html.dark .wc-share-link { background: #20242b; border-color: #2e333c; color: #cbd2da; }
html.dark .wc-share-actions button { background: #20242b; border-color: #2e333c; color: #cbd2da; }
html.dark .wc-share-actions button.primary { background: #f3f4f6; border-color: #f3f4f6; color: #111827; }

/* 手机端 */
@media (max-width: 720px) {
    .wc-set {
        width: 100vw; height: 100dvh; min-height: 0; max-height: 100dvh;
        border-radius: 0;
        padding-top: env(safe-area-inset-top);
    }
    .wc-set-head { padding: 16px 16px 10px; }
    .wc-set-head b { font-size: 15px; }
    .wc-set-body { flex-direction: column; }
    .wc-set-nav {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 6px;
        padding: 0 12px 8px;
        overflow-x: auto;
        border-bottom: 1px solid #eef0f3;
    }
    .wc-set-nav { scrollbar-width: none; }
    .wc-set-nav::-webkit-scrollbar { display: none; }
    .wc-set-nav button {
        width: auto; flex: 0 0 auto; padding: 8px 11px;
        font-size: 12.5px; white-space: nowrap; border-radius: 8px;
        gap: 6px;
    }
    /* 手机上不显示导航图标，四项正好排满一行，不用横向滑动 */
    .wc-set-nav button svg { display: none; }
    .wc-set-main { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
    .wc-themes { gap: 8px; }
    .wc-themes button { padding: 15px 4px; font-size: 12.5px; }
    .wc-themes button svg { width: 18px; height: 18px; }
    .wc-acc-grid { grid-template-columns: 1fr; }
    html.dark .wc-set-nav { border-bottom-color: #262a32; }

    .wc-sharebox {
        width: 100%;
        position: absolute;
        left: 0; right: 0; bottom: 0;
        border-radius: 18px 18px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .wc-modal:has(.wc-sharebox) { align-items: flex-end; }
    .wc-share-link { font-size: 11.5px; }

    #page-webaichat .wc-sharebar {
        flex-direction: column;
        align-items: stretch;
        gap: 7px;
        padding: 8px 12px;
    }
    #page-webaichat .wc-sharebar-t { white-space: normal; text-align: center; }
    #page-webaichat .wc-sharebar-btns { justify-content: center; }

    /* 手机端没有 hover，列表项的分享/删除直接常显 */
    #page-webaichat .wc-item-act,
    #page-webaichat .wc-item-del { opacity: .5; padding: 3px 4px; }
    #page-webaichat .wc-item-act svg,
    #page-webaichat .wc-item-del svg { width: 14px; height: 14px; }
}
