/* 小 C 主按钮：右下角；层级高于对话面板与留言球 */
.ai-assistant-fab-wrap {
    position: fixed;
    right: 22px;
    left: auto;
    bottom: 22px;
    z-index: 11001;
}

/* 主按钮在右缘时，悬停标签在按钮左侧（竖直居中，避免与上方留言球叠字） */
.ai-assistant-fab-tooltip {
    position: absolute;
    right: calc(100% + 12px);
    left: auto;
    top: 50%;
    bottom: auto;
    width: max-content;
    max-width: min(260px, calc(100vw - 100px));
    padding: 7px 11px;
    border-radius: 10px;
    border: 1px solid rgba(140, 209, 255, 0.45);
    background: rgba(10, 22, 42, 0.96);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    color: #dce8ff;
    opacity: 0;
    visibility: hidden;
    z-index: 3;
    transform: translateY(-50%) translateX(8px);
    transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
    pointer-events: none;
}

.ai-assistant-fab-tooltip-text {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.2;
}

.ai-assistant-fab-tooltip-role {
    font-weight: 600;
    color: rgba(200, 224, 255, 0.92);
}

.ai-assistant-fab-tooltip-text strong {
    font-size: 15px;
    font-weight: 700;
    color: #f2f7ff;
}

.ai-assistant-fab-wrap:hover .ai-assistant-fab-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.ai-assistant-fab-wrap:has(.ai-assistant-fab-open) .ai-assistant-fab-tooltip,
.ai-assistant-fab-wrap:has(.ai-assistant-fab-open):hover .ai-assistant-fab-tooltip {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(8px);
}

@keyframes ai-fab-aurora-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ai-fab-halo-spin {
    to {
        transform: rotate(-360deg);
    }
}

@keyframes ai-fab-orb-slow {
    to {
        transform: rotate(-360deg);
    }
}

@keyframes ai-fab-disk3-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ai-fab-gleam-drift {
    0%,
    100% {
        transform: translate(-10%, -8%) scale(1);
        opacity: 0.55;
    }
    35% {
        transform: translate(12%, 6%) scale(1.06);
        opacity: 0.78;
    }
    70% {
        transform: translate(4%, 14%) scale(1.02);
        opacity: 0.62;
    }
}

@keyframes ai-fab-bloom-pulse {
    0% {
        opacity: 0.34;
        transform: scale(0.84);
        filter: blur(18px) saturate(1.2);
    }
    100% {
        opacity: 0.92;
        transform: scale(1.22);
        filter: blur(11px) saturate(1.58);
    }
}

@keyframes ai-fab-outer-breathe {
    0%,
    100% {
        opacity: 0.46;
        filter: blur(0.45px) brightness(1);
        box-shadow:
            0 0 12px rgba(56, 189, 248, 0.28),
            0 0 22px rgba(99, 102, 241, 0.18);
    }
    50% {
        opacity: 0.74;
        filter: blur(0.7px) brightness(1.08) saturate(1.18);
        box-shadow:
            0 0 26px rgba(56, 189, 248, 0.48),
            0 0 40px rgba(99, 102, 241, 0.34);
    }
}

.ai-assistant-fab {
    position: relative;
    z-index: 1;
    display: block;
    width: 56px;
    height: 56px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    transition: transform 220ms ease, filter 220ms ease;
}

/* 外圈氛围光：仅青蓝紫，呼吸保留 */
.ai-assistant-fab-bloom {
    position: absolute;
    inset: -32px;
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 34% 28%, rgba(99, 102, 241, 0.58) 0%, transparent 40%),
        radial-gradient(circle at 76% 74%, rgba(2, 132, 199, 0.52) 0%, transparent 44%);
    animation: ai-fab-bloom-pulse 2.9s ease-in-out infinite alternate;
}

.ai-assistant-fab-bloom--delayed {
    inset: -24px;
    animation: ai-fab-bloom-pulse 3.8s ease-in-out infinite alternate;
    animation-delay: -1.9s;
    background:
        radial-gradient(circle at 70% 24%, rgba(79, 70, 229, 0.52) 0%, transparent 42%),
        radial-gradient(circle at 26% 76%, rgba(8, 145, 178, 0.48) 0%, transparent 48%);
}

/* 单圈外缘：细流光 + 外散柔光 + 与旋转独立的呼吸 */
.ai-assistant-fab-outer-ring {
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    background: conic-gradient(
        from 0deg,
        #0284c7,
        #0ea5e9,
        #2563eb,
        #4f46e5,
        #6366f1,
        #06b6d4,
        #0891b2,
        #0284c7
    );
    animation:
        ai-fab-aurora-spin 14s linear infinite,
        ai-fab-outer-breathe 3.2s ease-in-out infinite;
    filter: blur(0.5px) saturate(1.35);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 0px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 0px));
}

.ai-assistant-fab-stack {
    position: relative;
    z-index: 1;
    display: block;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    isolation: isolate;
    box-shadow:
        0 10px 30px rgba(56, 189, 248, 0.32),
        0 10px 26px rgba(99, 102, 241, 0.22),
        0 0 0 1px rgba(125, 180, 255, 0.55);
    transition: box-shadow 220ms ease, transform 220ms ease;
}

/* 球内弥散：仅青蓝靛紫（暖色只在 --warm 层） */
.ai-assistant-fab-halo {
    position: absolute;
    inset: -55%;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(56, 189, 248, 0.88),
        rgba(34, 211, 238, 0.9),
        rgba(14, 165, 233, 0.86),
        rgba(59, 130, 246, 0.88),
        rgba(99, 102, 241, 0.9),
        rgba(129, 140, 248, 0.86),
        rgba(96, 165, 250, 0.88),
        rgba(125, 211, 252, 0.9),
        rgba(56, 189, 248, 0.88)
    );
    animation: ai-fab-halo-spin 14s linear infinite;
    filter: blur(14px) saturate(1.48);
    opacity: 0.62;
    pointer-events: none;
}

/* 球体裁剪区：六层冷色 + 一层暖色（红橙玫独立，避免多 conic 共心） */
.ai-assistant-fab-orb-mix {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    box-shadow:
        inset 0 2px 12px rgba(255, 255, 255, 0.18),
        inset 0 -10px 22px rgba(23, 37, 84, 0.32);
}

.ai-assistant-fab-orb-disk {
    position: absolute;
    border-radius: 50%;
    width: 185%;
    height: 185%;
}

/* 旋转轴在圆盘自身上的偏心点 → 裁成圆后看不出「绕球心辐条」 */
.ai-assistant-fab-orb-disk--1 {
    left: -56%;
    top: -24%;
    transform-origin: 64% 46%;
    background: conic-gradient(
        from 25deg,
        #2563eb,
        #0284c7,
        #0ea5e9,
        #06b6d4,
        #0891b2,
        #1d4ed8,
        #4338ca,
        #6366f1,
        #0ea5e9,
        #2563eb
    );
    animation: ai-fab-aurora-spin 4.1s linear infinite;
    opacity: 0.9;
    filter: saturate(1.32);
}

.ai-assistant-fab-orb-disk--2 {
    left: -20%;
    top: -54%;
    width: 168%;
    height: 168%;
    transform-origin: 34% 70%;
    background: conic-gradient(
        from 190deg,
        #818cf8,
        #6366f1,
        #4f46e5,
        #2563eb,
        #0284c7,
        #0891b2,
        #22d3ee,
        #38bdf8,
        #818cf8
    );
    animation: ai-fab-orb-slow 7.4s linear infinite reverse;
    mix-blend-mode: soft-light;
    opacity: 0.5;
    filter: saturate(1.35);
}

.ai-assistant-fab-orb-disk--3 {
    left: -48%;
    top: -36%;
    width: 205%;
    height: 205%;
    transform-origin: 72% 36%;
    background: conic-gradient(
        from 305deg,
        #22d3ee,
        #14b8a6,
        #0d9488,
        #0369a1,
        #1d4ed8,
        #4338ca,
        #4f46e5,
        #22d3ee
    );
    animation: ai-fab-disk3-spin 5.6s linear infinite;
    mix-blend-mode: soft-light;
    opacity: 0.46;
    filter: saturate(1.28);
}

.ai-assistant-fab-orb-disk--4 {
    left: -34%;
    top: -58%;
    width: 172%;
    height: 172%;
    transform-origin: 50% 80%;
    background: conic-gradient(
        from 140deg,
        #38bdf8,
        #0ea5e9,
        #22d3ee,
        #60a5fa,
        #818cf8,
        #6366f1,
        #38bdf8
    );
    animation: ai-fab-disk3-spin 8.9s linear infinite reverse;
    mix-blend-mode: screen;
    opacity: 0.4;
    filter: saturate(1.28);
}

.ai-assistant-fab-orb-disk--5 {
    left: -64%;
    top: -26%;
    width: 198%;
    height: 198%;
    transform-origin: 24% 48%;
    background: conic-gradient(
        from 60deg,
        #93c5fd,
        #7dd3fc,
        #60a5fa,
        #3b82f6,
        #2563eb,
        #38bdf8,
        #93c5fd
    );
    animation: ai-fab-aurora-spin 6.7s linear infinite;
    mix-blend-mode: screen;
    opacity: 0.32;
    filter: saturate(1.32);
}

.ai-assistant-fab-orb-disk--6 {
    left: -12%;
    top: -50%;
    width: 208%;
    height: 208%;
    transform-origin: 58% 64%;
    background: conic-gradient(
        from 280deg,
        #7dd3fc,
        #38bdf8,
        #0284c7,
        #06b6d4,
        #6366f1,
        #4f46e5,
        #7dd3fc
    );
    animation: ai-fab-orb-slow 11.2s linear infinite;
    mix-blend-mode: soft-light;
    opacity: 0.38;
    filter: saturate(1.28);
}

/* 红橙玫黄：仅此一层，偏心旋转，不掺进冷色 conic */
.ai-assistant-fab-orb-disk--warm {
    left: -40%;
    top: -44%;
    width: 192%;
    height: 192%;
    transform-origin: 36% 58%;
    background: conic-gradient(
        from 15deg,
        #ea580c,
        #f97316,
        #fb2c36,
        #e11d48,
        #dc2626,
        #fb7185,
        #fbbf24,
        #f97316,
        #ea580c
    );
    animation: ai-fab-disk3-spin 9.2s linear infinite reverse;
    mix-blend-mode: screen;
    opacity: 0.56;
    filter: saturate(1.62) brightness(1.04);
}

/* 表面高光：略减死白，偏天蓝 */
.ai-assistant-fab-gleam {
    position: absolute;
    inset: -12%;
    border-radius: 50%;
    background: radial-gradient(
        ellipse 56% 52% at 42% 32%,
        rgba(224, 242, 254, 0.32) 0%,
        rgba(56, 189, 248, 0.26) 28%,
        rgba(37, 99, 235, 0.12) 48%,
        transparent 66%
    );
    animation: ai-fab-gleam-drift 5.6s ease-in-out infinite;
    mix-blend-mode: soft-light;
    pointer-events: none;
    opacity: 0.46;
    filter: saturate(1.25);
}

.ai-assistant-fab:hover {
    transform: translateY(-3px) scale(1.04);
    filter: brightness(1.06);
}

.ai-assistant-fab:hover .ai-assistant-fab-stack {
    box-shadow:
        0 14px 36px rgba(56, 189, 248, 0.4),
        0 14px 30px rgba(99, 102, 241, 0.28),
        0 0 0 1px rgba(186, 220, 255, 0.58),
        0 0 28px rgba(59, 130, 246, 0.3);
}

.ai-assistant-fab:hover .ai-assistant-fab-halo {
    opacity: 0.88;
}

.ai-assistant-fab:hover .ai-assistant-fab-outer-ring {
    animation:
        ai-fab-aurora-spin 14s linear infinite,
        ai-fab-outer-breathe 2.6s ease-in-out infinite;
}

.ai-assistant-fab:active {
    transform: translateY(-1px) scale(0.98);
}

.ai-assistant-fab.ai-assistant-fab-open {
    transform: rotate(12deg) scale(0.95);
}

@media (prefers-reduced-motion: reduce) {
    .ai-assistant-fab-bloom,
    .ai-assistant-fab-bloom--delayed,
    .ai-assistant-fab-outer-ring,
    .ai-assistant-fab-halo,
    .ai-assistant-fab-orb-disk--1,
    .ai-assistant-fab-orb-disk--2,
    .ai-assistant-fab-orb-disk--3,
    .ai-assistant-fab-orb-disk--4,
    .ai-assistant-fab-orb-disk--5,
    .ai-assistant-fab-orb-disk--6,
    .ai-assistant-fab-orb-disk--warm,
    .ai-assistant-fab-gleam {
        animation: none !important;
    }

    .ai-assistant-fab-halo {
        opacity: 0.4;
    }

    .ai-assistant-fab-bloom,
    .ai-assistant-fab-bloom--delayed {
        opacity: 0.5;
        transform: none;
    }

    .ai-assistant-fab-gleam {
        opacity: 0.45;
        transform: none;
    }
}

/* 面板右缘落在两颗球左侧，底边贴近视口，整体在右下角一列的左边 */
.ai-assistant-panel {
    position: fixed;
    --gweb-fab-col: calc(22px + 56px + 12px);
    right: var(--gweb-fab-col);
    left: auto;
    bottom: 24px;
    width: min(380px, calc(100vw - var(--gweb-fab-col) - 16px));
    height: min(560px, calc(100vh - 48px));
    border-radius: 16px;
    border: 1px solid rgba(128, 190, 255, 0.35);
    background: rgba(8, 18, 35, 0.9);
    backdrop-filter: blur(12px);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 11000;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 240ms ease, transform 260ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.ai-assistant-panel.ai-assistant-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ai-assistant-header {
    min-height: 50px;
    padding: 8px 12px 8px 14px;
    border-bottom: 1px solid rgba(128, 190, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #dce8ff;
    font-weight: 600;
}

.ai-assistant-title-wrap {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.ai-assistant-brand {
    font-size: 14px;
    font-weight: 700;
    color: #eef6ff;
    letter-spacing: 0.02em;
    margin-right: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 0 1 auto;
    max-width: 38%;
}

.ai-assistant-clear-chat {
    flex: 0 0 auto;
    border: 1px solid rgba(128, 190, 255, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(200, 228, 255, 0.95);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.ai-assistant-clear-chat:hover {
    background: rgba(88, 166, 255, 0.2);
    border-color: rgba(162, 227, 255, 0.55);
    color: #fff;
}

.ai-assistant-clear-chat:active {
    transform: scale(0.97);
}

/* 当日 Token 圆环（助手顶栏小号 + 个人资料大号共用） */
.gweb-daily-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.gweb-daily-ring svg {
    display: block;
    transform: rotate(-90deg);
}

.gweb-daily-ring--sm svg {
    width: 34px;
    height: 34px;
}

.gweb-daily-ring--lg svg {
    width: 88px;
    height: 88px;
}

.gweb-daily-ring--lg .gweb-daily-ring-track,
.gweb-daily-ring--lg .gweb-daily-ring-value {
    stroke-width: 4;
}

.gweb-daily-ring-track {
    stroke: rgba(120, 180, 240, 0.22);
}

.gweb-daily-ring-value {
    stroke: #58a6ff;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.35s ease, stroke 0.25s ease;
}

.gweb-daily-ring--warn .gweb-daily-ring-value {
    stroke: #ff9f6e;
}

.gweb-daily-ring--full .gweb-daily-ring-value {
    stroke: #ff7a7a;
}

.gweb-daily-ring-pct {
    font-size: 11px;
    font-weight: 700;
    color: rgba(220, 238, 255, 0.98);
    min-width: 2.5rem;
    letter-spacing: 0.02em;
}

.gweb-daily-ring--lg .gweb-daily-ring-pct {
    font-size: 1.35rem;
    min-width: 4rem;
}

.ai-assistant-daily-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    min-width: 0;
}

.ai-assistant-close {
    flex-shrink: 0;
    align-self: center;
    border: 0;
    background: transparent;
    color: #b8d8ff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.ai-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(144, 200, 255, 0.55) rgba(255, 255, 255, 0.05);
}

.ai-assistant-messages::-webkit-scrollbar {
    width: 8px;
}

.ai-assistant-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
}

.ai-assistant-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(162, 227, 255, 0.85), rgba(88, 166, 255, 0.7));
    border-radius: 999px;
    border: 1px solid rgba(5, 12, 24, 0.5);
}

.ai-assistant-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(184, 236, 255, 0.95), rgba(112, 183, 255, 0.82));
}

.ai-assistant-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.ai-assistant-msg-row-user {
    justify-content: flex-end;
}

.ai-assistant-msg-row-assistant {
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: row;
    gap: 8px;
}

.ai-assistant-avatar {
    position: relative;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    overflow: visible;
    border-radius: 50%;
}

/* 与 FAB 同套流光，整体缩放到头像尺寸 */
.ai-assistant-avatar-orb-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 56px;
    height: 56px;
    transform: translate(-50%, -50%) scale(0.464);
    transform-origin: center center;
    pointer-events: none;
}

/* 对话框头像：不要外侧呼吸光与外圈环，只保留内球（halo / 多层 disk / gleam）自转 */
.ai-assistant-avatar .ai-assistant-fab-bloom,
.ai-assistant-avatar .ai-assistant-fab-bloom--delayed,
.ai-assistant-avatar .ai-assistant-fab-outer-ring {
    display: none !important;
}

.ai-assistant-bubble {
    max-width: 88%;
    padding: 9px 11px;
    border-radius: 11px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.ai-assistant-bubble-user {
    color: #eaf4ff;
    background: rgba(88, 166, 255, 0.35);
}

.ai-assistant-bubble-assistant {
    color: #d9edff;
    background: rgba(255, 255, 255, 0.08);
    border-top-left-radius: 4px;
}

.ai-assistant-bubble-assistant ul {
    margin: 8px 0 0 18px;
    padding: 0;
}

.ai-assistant-bubble-assistant li {
    margin: 3px 0;
}

.ai-assistant-bubble-assistant code {
    padding: 1px 5px;
    border-radius: 6px;
    background: rgba(156, 210, 255, 0.14);
    border: 1px solid rgba(156, 210, 255, 0.3);
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

.ai-assistant-thinking-bubble {
    width: fit-content;
    max-width: none;
    white-space: normal;
    padding: 7px 10px;
}

.ai-assistant-thinking {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.ai-assistant-thinking-text {
    opacity: 0.95;
}

.ai-assistant-thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ai-assistant-thinking-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(206, 235, 255, 0.92);
    animation: ai-assistant-dot-bounce 1s ease-in-out infinite;
}

.ai-assistant-thinking-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.ai-assistant-thinking-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes ai-assistant-dot-bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.ai-assistant-input-wrap {
    border-top: 1px solid rgba(128, 190, 255, 0.2);
    padding: 10px;
    display: flex;
    gap: 8px;
}

.ai-assistant-input {
    flex: 1;
    border: 1px solid rgba(128, 190, 255, 0.3);
    border-radius: 9px;
    background: rgba(11, 22, 44, 0.9);
    color: #dce8ff;
    padding: 8px 10px;
    outline: none;
}

.ai-assistant-send {
    border: 1px solid rgba(128, 190, 255, 0.45);
    border-radius: 9px;
    background: rgba(88, 166, 255, 0.22);
    color: #e9f5ff;
    padding: 8px 12px;
    cursor: pointer;
}

.ai-assistant-disclaimer {
    padding: 0 10px 10px;
    color: rgba(170, 206, 240, 0.78);
    font-size: 11.5px;
    line-height: 1.5;
    border-top: 0;
}

@media (max-width: 640px) {
    .ai-assistant-panel {
        --gweb-fab-col: calc(14px + 56px + 10px);
        right: var(--gweb-fab-col);
        left: auto;
        bottom: 16px;
        width: calc(100vw - var(--gweb-fab-col) - 12px);
        max-width: 380px;
        height: min(560px, calc(100vh - 36px));
        transform-origin: bottom right;
    }

    .ai-assistant-fab-wrap {
        right: 14px;
        left: auto;
        bottom: 14px;
    }
}
