/* ============================================================
   匿名聊天室 · 访客端样式
   ============================================================ */

:root {
    --mint: #14b8a6;
    --sky: #0ea5e9;
    --ink: #1e293b;
    --muted: #64748b;
    --line: rgba(148, 163, 184, 0.28);
    --card: rgba(255, 255, 255, 0.72);
    --danger: #ef4444;
    --radius: 18px;
    --shadow: 0 18px 50px rgba(15, 118, 110, 0.14);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(1200px 800px at 8% 0%, #d8f6ef 0%, rgba(216, 246, 239, 0) 55%),
        radial-gradient(900px 700px at 100% 10%, #dceeff 0%, rgba(220, 238, 255, 0) 55%),
        linear-gradient(160deg, #f5fbfa 0%, #eef5fb 50%, #f3f9f7 100%);
    overflow: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    filter: blur(10px);
    pointer-events: none;
}

body::before {
    width: 280px;
    height: 280px;
    left: -90px;
    bottom: -80px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.16), rgba(20, 184, 166, 0));
    animation: floatA 14s ease-in-out infinite;
}

body::after {
    width: 320px;
    height: 320px;
    right: -110px;
    top: 12%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.14), rgba(14, 165, 233, 0));
    animation: floatB 18s ease-in-out infinite;
}

@keyframes floatA {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(18px, -22px, 0); }
}

@keyframes floatB {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-24px, 18px, 0); }
}

/* ------------------------------------------------------------
   聊天主框架
   ------------------------------------------------------------ */

.chat-app {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 780px;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.52);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
}

@media (min-width: 860px) {
    body {
        padding: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body::before,
    body::after {
        position: fixed;
    }

    .chat-app {
        height: calc(100vh - 48px);
        height: calc(100dvh - 48px);
        border: 1px solid rgba(255, 255, 255, 0.85);
        border-radius: 28px;
        box-shadow: var(--shadow);
        overflow: hidden;
    }
}

/* 顶部栏 */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.62));
    border-bottom: 1px solid var(--line);
    flex: 0 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #2dd4bf, #0ea5e9);
    box-shadow: 0 8px 20px rgba(20, 184, 166, 0.28);
    flex: 0 0 42px;
}

.brand-logo svg {
    width: 24px;
    height: 24px;
}

.brand-text {
    min-width: 0;
}

.brand-text h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #0f172a;
}

.brand-text p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.header-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(240, 253, 250, 0.9);
    border: 1px solid rgba(45, 212, 191, 0.22);
    font-size: 12px;
    color: #0f766e;
    white-space: nowrap;
    flex: 0 0 auto;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.exit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 30px;
    padding: 0 9px;
    border-radius: 9px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.62);
    color: #64748b;
    font-family: inherit;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.exit-btn svg {
    width: 14px;
    height: 14px;
}

.exit-btn:hover {
    color: #be123c;
    border-color: rgba(225, 29, 72, 0.28);
    background: rgba(255, 241, 242, 0.9);
}

.exit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
    animation: pulse 2s ease-in-out infinite;
}

.header-status.is-offline {
    background: rgba(254, 242, 242, 0.9);
    border-color: rgba(248, 113, 113, 0.25);
    color: #b91c1c;
}

.header-status.is-offline .status-dot {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.86); }
}

/* 消息滚动区 */
.chat-main {
    position: relative;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.chat-main::-webkit-scrollbar {
    width: 6px;
}

.chat-main::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 99px;
}

.msg-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px 18px 26px;
    min-height: 100%;
}

/* 空状态 */
.empty-state {
    margin: auto;
    padding: 28px 18px;
    text-align: center;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.empty-icon {
    width: 68px;
    height: 68px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    color: #0d9488;
    background: linear-gradient(145deg, rgba(204, 251, 241, 0.9), rgba(224, 242, 254, 0.9));
    margin-bottom: 8px;
}

.empty-icon svg {
    width: 32px;
    height: 32px;
}

.empty-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.empty-sub {
    margin: 0;
    font-size: 12px;
}

/* 消息气泡 */
.msg {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    max-width: 100%;
    animation: msgIn 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.msg.mine {
    flex-direction: row-reverse;
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    flex: 0 0 34px;
    margin-top: 2px;
    user-select: none;
    background: #94a3b8;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.msg-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: min(76%, 560px);
    min-width: 0;
}

.msg.mine .msg-body {
    align-items: flex-end;
}

.bubble {
    position: relative;
    padding: 10px 14px;
    border-radius: 16px;
    border-top-left-radius: 5px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 3px 14px rgba(15, 23, 42, 0.06);
    font-size: 15px;
    line-height: 1.55;
    color: #1f2937;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.msg.mine .bubble {
    border-top-left-radius: 16px;
    border-top-right-radius: 5px;
    background: linear-gradient(135deg, #2dd4bf, #0ea5e9);
    color: #fff;
    box-shadow: 0 5px 18px rgba(14, 165, 233, 0.26);
}

.msg-time {
    font-size: 11px;
    color: #94a3b8;
    padding: 0 3px;
    line-height: 1;
}

/* 图片消息 */
.bubble.image-bubble {
    padding: 5px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 16px;
    border-top-left-radius: 5px;
    line-height: 0;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.msg.mine .bubble.image-bubble {
    border-radius: 16px;
    border-top-right-radius: 5px;
    background: rgba(255, 255, 255, 0.96);
}

.bubble.image-bubble img {
    display: block;
    max-width: 250px;
    max-height: 300px;
    border-radius: 12px;
    cursor: zoom-in;
    object-fit: cover;
    background: #e2e8f0;
}

.image-caption {
    padding: 4px 5px 8px;
    font-size: 14px;
    line-height: 1.55;
    color: #1f2937;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.admin-msg .bubble.image-bubble .image-caption {
    color: #134e4a;
}

/* 位置消息 */
.bubble.location-bubble {
    padding: 12px 14px;
    min-width: 210px;
}

.loc-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.loc-head svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.loc-coords {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.82;
    font-variant-numeric: tabular-nums;
}

.loc-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #0f766e;
    text-decoration: none;
    border-bottom: 1px dashed rgba(15, 118, 110, 0.4);
    width: fit-content;
}

.msg.mine .loc-link {
    color: #ecfeff;
    border-bottom-color: rgba(236, 254, 255, 0.6);
}

.loc-link svg {
    width: 13px;
    height: 13px;
}

/* 管理员消息 */
.admin-avatar {
    background: linear-gradient(135deg, #0f766e, #0369a1);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.28);
}

.sender-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 3px;
    font-size: 11px;
    font-weight: 700;
    color: #0f766e;
    letter-spacing: 0.3px;
}

.sender-tag::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #14b8a6;
}

.admin-msg .bubble {
    background: rgba(240, 253, 250, 0.97);
    border: 1px solid rgba(20, 184, 166, 0.28);
    color: #134e4a;
    box-shadow: 0 4px 16px rgba(15, 118, 110, 0.08);
}

.admin-msg .bubble.image-bubble,
.admin-msg .bubble.file-bubble {
    background: rgba(240, 253, 250, 0.97);
}

/* 文档消息 */
.bubble.file-bubble {
    padding: 10px;
    min-width: 230px;
    max-width: 100%;
}

.file-caption {
    padding: 2px 4px 9px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    color: #1f2937;
}

.admin-msg .file-caption {
    color: #134e4a;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(20, 184, 166, 0.18);
    min-width: 0;
}

.file-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    color: #ffffff;
    background: linear-gradient(135deg, #0f766e, #0ea5e9);
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.18);
}

.file-icon svg {
    width: 20px;
    height: 20px;
}

.file-info {
    flex: 1 1 auto;
    min-width: 0;
}

.file-name {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.file-meta {
    margin-top: 2px;
    font-size: 10.5px;
    color: #64748b;
}

.file-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 30px;
    padding: 0 10px;
    border-radius: 8px;
    background: linear-gradient(135deg, #14b8a6, #0ea5e9);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    flex: 0 0 auto;
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.2);
}

.file-download:hover {
    filter: brightness(1.05);
}

.file-download svg {
    width: 13px;
    height: 13px;
}

button.file-download {
    border: 0;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
}

.file-download.is-disabled {
    background: #e2e8f0;
    color: #64748b;
    box-shadow: none;
    cursor: default;
    font-size: 11px;
    font-weight: 500;
}

/* 文档查看弹层 */
.doc-preview {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(6, 15, 26, 0.72);
    backdrop-filter: blur(4px);
}

.doc-preview-panel {
    width: min(980px, 100%);
    height: min(86vh, 860px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(2, 12, 27, 0.35);
}

.doc-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.doc-preview-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.doc-preview-close {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #e2e8f0;
    color: #334155;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.doc-preview-body {
    flex: 1 1 auto;
    min-height: 0;
    background: #f1f5f9;
}

.doc-preview-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}

.doc-preview-pdf {
    height: 100%;
    overflow: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    background: #e2e8f0;
    -webkit-overflow-scrolling: touch;
}

.doc-preview-loading,
.doc-preview-error {
    margin: auto;
    padding: 16px;
    font-size: 13px;
    color: #475569;
    text-align: center;
    line-height: 1.6;
}

.doc-preview-error {
    color: #b91c1c;
}

.pdf-page-wrap {
    position: relative;
    width: 100%;
    height: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.pdf-page {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: auto;
}

.doc-preview-note {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    line-height: 1.5;
}

/* Word (docx) 预览 */
.doc-preview-docx {
    height: 100%;
    overflow: auto;
    padding: 20px 18px 40px;
    background: #f1f5f9;
    -webkit-overflow-scrolling: touch;
    font-size: 14px;
    line-height: 1.75;
    color: #0f172a;
    word-break: break-word;
}

.doc-preview-docx > * {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.doc-preview-docx p {
    margin: 0 0 0.8em;
}

.doc-preview-docx h1,
.doc-preview-docx h2,
.doc-preview-docx h3 {
    margin: 1em 0 0.5em;
    line-height: 1.35;
}

.doc-preview-docx img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.doc-preview-docx table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.8em 0;
    display: block;
    overflow-x: auto;
}

.doc-preview-docx th,
.doc-preview-docx td {
    border: 1px solid #cbd5e1;
    padding: 6px 8px;
    text-align: left;
}

.doc-preview-docx ul,
.doc-preview-docx ol {
    padding-left: 1.4em;
    margin: 0 0 0.8em;
}

.doc-preview-docx a {
    color: #0e7490;
}

@media (max-width: 720px) {
    .doc-preview-docx {
        padding: 14px 12px 32px;
        font-size: 13.5px;
    }
}

.doc-preview-text {
    margin: 0;
    padding: 16px;
    height: 100%;
    overflow: auto;
    font-size: 12.5px;
    line-height: 1.6;
    color: #0f172a;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (max-width: 720px) {
    .doc-preview {
        padding: 8px;
    }

    .doc-preview-panel {
        height: 92vh;
        border-radius: 12px;
    }
}

/* 新消息提示 */
.new-tip {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(6px);
    animation: msgIn 0.2s ease;
    z-index: 3;
}

.new-tip svg {
    width: 13px;
    height: 13px;
}

/* ------------------------------------------------------------
   输入区
   ------------------------------------------------------------ */

.composer {
    flex: 0 0 auto;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.84);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.composer-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 11px;
    border-radius: 10px;
    border: 1px solid rgba(20, 184, 166, 0.18);
    background: rgba(240, 253, 250, 0.9);
    color: #0f766e;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
}

.tool-btn svg {
    width: 16px;
    height: 16px;
}

.tool-btn:hover {
    background: rgba(204, 251, 241, 0.9);
    border-color: rgba(20, 184, 166, 0.35);
    transform: translateY(-1px);
}

.tool-btn:active {
    transform: translateY(0) scale(0.97);
}

.tool-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.composer-note {
    margin-left: auto;
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}

.composer-row {
    display: flex;
    align-items: flex-end;
    gap: 9px;
}

#input {
    flex: 1 1 auto;
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    padding: 11px 14px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink);
    resize: none;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#input::placeholder {
    color: #9aa9bb;
}

#input:focus {
    border-color: rgba(20, 184, 166, 0.75);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.13);
}

.send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #14b8a6, #0ea5e9);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.26);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    flex: 0 0 auto;
}

.send-btn svg {
    width: 16px;
    height: 16px;
}

.send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 20px rgba(14, 165, 233, 0.3);
}

.send-btn:active {
    transform: translateY(0) scale(0.98);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 上传/发送中 */
.busy-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 7px 11px;
    border-radius: 10px;
    background: rgba(240, 253, 250, 0.95);
    border: 1px solid rgba(20, 184, 166, 0.2);
    color: #0f766e;
    font-size: 12px;
}

.spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(20, 184, 166, 0.25);
    border-top-color: #14b8a6;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex: 0 0 13px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------
   图片预览 / 提示 / 拦截
   ------------------------------------------------------------ */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(8, 15, 26, 0.86);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.16s ease;
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: min(92vw, 900px);
    max-height: 86vh;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.toast-wrap {
    position: fixed;
    left: 50%;
    bottom: calc(92px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: max-content;
    max-width: 90vw;
}

.toast {
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    font-size: 13px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.26);
    animation: toastIn 0.24s ease;
    text-align: center;
    max-width: 90vw;
}

.toast.error {
    background: rgba(190, 18, 60, 0.94);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 拦截页 */
.block-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(900px 600px at 20% 0%, #e0f7f2 0%, rgba(224, 247, 242, 0) 60%),
        radial-gradient(800px 600px at 100% 100%, #e3eefc 0%, rgba(227, 238, 252, 0) 60%),
        linear-gradient(160deg, #f6fbfa, #eff5fb);
}

.block-screen[hidden] {
    display: none;
}

.block-card {
    width: 100%;
    max-width: 420px;
    padding: 38px 28px 32px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 24px 60px rgba(15, 118, 110, 0.14);
    text-align: center;
    backdrop-filter: blur(16px);
}

.block-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    color: #e11d48;
    background: linear-gradient(145deg, #ffe4e6, #fff1f2);
    box-shadow: 0 8px 20px rgba(225, 29, 72, 0.12);
}

.block-icon svg {
    width: 32px;
    height: 32px;
}

.exit-icon {
    color: #0f766e;
    background: linear-gradient(145deg, #ccfbf1, #e0f2fe);
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.12);
}

.exit-reenter {
    margin-top: 18px;
    height: 42px;
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #14b8a6, #0ea5e9);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.24);
}

.exit-reenter:hover {
    filter: brightness(1.04);
}

.block-card h1 {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.block-message {
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.7;
    color: #be123c;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.block-sub {
    margin: 0;
    font-size: 12px;
    line-height: 1.7;
    color: #94a3b8;
}

.page-blocked {
    overflow: hidden;
}

.noscript-tip {
    position: fixed;
    inset: auto 0 0;
    padding: 14px;
    text-align: center;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    z-index: 110;
}

/* ------------------------------------------------------------
   移动端
   ------------------------------------------------------------ */

@media (max-width: 560px) {
    .chat-header {
        padding: 13px 14px;
    }

    .brand-logo {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        border-radius: 12px;
    }

    .brand-logo svg {
        width: 21px;
        height: 21px;
    }

    .brand-text h1 {
        font-size: 16px;
    }

    .brand-text p {
        font-size: 11px;
    }

    .header-status {
        padding: 5px 8px;
        font-size: 11px;
    }

    .exit-btn {
        width: 32px;
        padding: 0;
    }

    .exit-btn span {
        display: none;
    }

    .msg-list {
        padding: 16px 12px 20px;
        gap: 14px;
    }

    .msg-body {
        max-width: 82%;
    }

    .bubble {
        font-size: 14.5px;
        padding: 9px 12px;
    }

    .avatar {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        font-size: 11px;
    }

    .composer {
        padding: 9px 12px calc(10px + env(safe-area-inset-bottom));
    }

    #input {
        font-size: 16px; /* 避免 iOS 聚焦时自动放大页面 */
    }

    .composer-note {
        display: none;
    }

    .tool-btn {
        height: 30px;
        padding: 0 10px;
    }

    .send-btn {
        padding: 0 14px;
    }

    .bubble.image-bubble img {
        max-width: 200px;
        max-height: 240px;
    }

    .bubble.file-bubble {
        min-width: 0;
        width: 100%;
    }

    .file-download {
        height: 34px;
        padding: 0 9px;
    }

    .new-tip {
        bottom: 10px;
    }
}

@media (max-width: 380px) {
    .send-btn span {
        display: none;
    }

    .send-btn {
        width: 44px;
        padding: 0;
    }

    .send-btn svg {
        width: 18px;
        height: 18px;
    }

    .header-status {
        display: none;
    }
}

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