/* 官网 / 对外在线客服（游客 + 已登录会员） */

.support-fab {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 9000;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(145deg, var(--ds-brand-light, #2d5a9e), var(--ds-brand, #1e3c72));
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.support-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.34);
}
.support-fab-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #ff4757;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-deep);
    box-sizing: border-box;
}

.support-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9100;
    background: rgba(4, 10, 20, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.support-overlay.is-open {
    display: flex;
}
@media (min-width: 560px) {
    .support-overlay {
        align-items: center;
        padding: 20px;
    }
}

.support-panel {
    width: 100%;
    max-width: 440px;
    max-height: min(92dvh, 640px);
    background: var(--bg-mid);
    border: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: support-slide-up 0.28s ease;
}
@media (min-width: 560px) {
    .support-panel {
        border-radius: 20px;
        animation: support-pop 0.25s ease;
    }
}
@keyframes support-slide-up {
    from { transform: translateY(100%); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes support-pop {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.support-panel-head {
    padding: 18px 48px 14px 18px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent) 22%, var(--bg-mid)),
        color-mix(in srgb, var(--accent-2) 18%, var(--bg-mid)));
    border-bottom: 1px solid var(--line);
    position: relative;
    flex-shrink: 0;
}
.support-panel-head h3 {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.support-panel-head p {
    margin: 6px 0 0;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.45;
}
.support-panel-close {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.support-panel-close:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.support-panel-body {
    padding: 16px 16px 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.support-field {
    margin-bottom: 14px;
}
.support-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.support-field label span.req { color: var(--accent); }
.support-field input,
.support-field textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.support-field input:focus,
.support-field textarea:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.support-field textarea { resize: vertical; min-height: 88px; }

.support-messages {
    min-height: 200px;
    max-height: min(42dvh, 320px);
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 12px;
    scroll-behavior: smooth;
}
.support-msg {
    margin-bottom: 12px;
    max-width: 88%;
}
.support-msg.mine { margin-left: auto; text-align: right; }
.support-msg-meta {
    font-size: 0.68rem;
    color: var(--muted);
    margin-bottom: 4px;
}
.support-msg-body {
    display: inline-block;
    padding: 9px 12px;
    border-radius: 12px 12px 4px 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: left;
    word-break: break-word;
}
.support-msg.mine .support-msg-body {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent) 35%, var(--bg-card)),
        color-mix(in srgb, var(--accent-2) 25%, var(--bg-card)));
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: 12px 12px 12px 4px;
}
.support-msg-read {
    font-size: 11px;
}
.support-msg-read.is-read {
    color: #16a34a;
}
.support-msg-read.is-unread {
    color: #94a3b8;
}
.support-msg.theirs .support-msg-body {
    background: var(--bg-card-hover);
    border: 1px solid var(--line);
}
.support-msg.is-streaming .support-msg-body {
    min-height: 1.4em;
}
.support-stream-cursor {
    display: inline-block;
    color: #1a7f37;
    animation: support-stream-blink 0.85s step-end infinite;
    margin-left: 1px;
    font-weight: 400;
}
@keyframes support-stream-blink {
    50% { opacity: 0; }
}
.support-chat-empty {
    text-align: center;
    color: var(--muted);
    padding: 28px 12px;
    font-size: 0.86rem;
    line-height: 1.5;
}

.support-panel-foot {
    padding: 12px 16px max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.support-panel-error {
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 71, 87, 0.12);
    border: 1px solid rgba(255, 71, 87, 0.35);
    color: #ff6b6b;
    font-size: 0.82rem;
    line-height: 1.45;
}
[data-theme="light"] .support-panel-error {
    color: #c62828;
    background: rgba(198, 40, 40, 0.08);
}
.support-btn-primary {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dim));
    color: #04120e;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
}
[data-theme="light"] .support-btn-primary { color: #fff; }
.support-btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.support-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.support-btn-ghost {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    cursor: pointer;
}
.support-btn-ghost:hover { background: var(--bg-card); color: var(--text); }

/* 官网「在线客服」区块 */
.support-landing {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 22px 56px;
}
.support-landing-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: center;
    padding: 32px 36px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: linear-gradient(145deg,
        color-mix(in srgb, var(--accent) 8%, var(--bg-card)),
        var(--bg-card));
    box-shadow: var(--shadow);
}
@media (max-width: 768px) {
    .support-landing-card {
        grid-template-columns: 1fr;
        padding: 24px 20px;
    }
}
.support-landing-card h2 {
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}
.support-landing-card p {
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 18px;
    line-height: 1.65;
}
.support-landing-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
}
.support-landing-list li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    padding: 6px 0 6px 22px;
    position: relative;
}
.support-landing-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}
.support-landing-preview {
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--bg-mid);
    padding: 16px;
    min-height: 200px;
}
.support-landing-preview .preview-line {
    height: 10px;
    border-radius: 6px;
    background: var(--line);
    margin-bottom: 10px;
    opacity: 0.7;
}
.support-landing-preview .preview-line.short { width: 55%; }
.support-landing-preview .preview-bubble {
    display: inline-block;
    max-width: 75%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    margin-bottom: 8px;
    background: color-mix(in srgb, var(--accent) 20%, var(--bg-card));
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.support-landing-preview .preview-bubble.reply {
    margin-left: auto;
    display: block;
    text-align: right;
    background: var(--bg-card-hover);
    border-color: var(--line);
    max-width: 70%;
}

.nav-mid a.nav-support-link {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}
