/* 底部评论输入条 */
.comment-section {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 70px;
    padding: 0 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1300;
    pointer-events: none;
    transition: all 0.3s ease;
    gap: 8px;
    overflow: visible;
}

.comment-bell-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    position: relative;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: auto;
    flex-shrink: 0;
    margin-right: 10px;
}

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

.comment-bell-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.25);
}

.comment-form-container {
    width: 100%;
    max-width: 420px;
    background: rgba(12, 16, 29, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 4px 8px;
    box-shadow: 0 16px 32px rgba(5, 8, 20, 0.4);
    pointer-events: auto;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
}

.comment-form-container-inner {
    display: contents;
}

.comment-form {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 42px;
}

.comment-form textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    height: 38px;
    min-height: 38px;
    max-height: 38px;
    font-size: 13px;
    line-height: 38px;
    padding: 0 8px;
    color: #fff;
    font-family: "b", "a", sans-serif;
    vertical-align: middle;
    overflow: hidden;
}

.comment-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
}

.comment-form textarea:focus {
    outline: none;
}

.comment-submit-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 0;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    position: relative;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.comment-submit-btn::before,
.comment-submit-btn::after {
    content: "";
    width: 16px;
    height: 16px;
    background: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.comment-submit-btn::before {
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E") center/contain no-repeat;
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.comment-submit-btn::after {
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='22' y1='2' x2='11' y2='13'/%3E%3Cpolygon points='22 2 15 22 11 13 2 9 22 2'/%3E%3C/svg%3E") center/contain no-repeat;
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-180deg) scale(0.45);
}

.comment-submit-btn.has-text::before {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(180deg) scale(0.45);
}

.comment-submit-btn.has-text::after {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.comment-submit-btn.has-text {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.comment-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.comment-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.25);
}

.comment-status {
    padding-top: 4px;
    font-size: 12px;
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
}

/* 评论成功气泡动画 - 简洁无背景，向上漂浮并淡出 */
.comment-success-bubble {
    position: fixed;
    left: 50%;
    bottom: 100px;
    transform: translateX(-50%);
    z-index: 10000;
    padding: 10px 20px;
    background: transparent;
    color: #fff;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
}

.comment-success-bubble.show {
    animation: bubble-rise 3s ease-out forwards;
}

@keyframes bubble-rise {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    85% {
        opacity: 1;
        transform: translateX(-50%) translateY(-30px);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-50px);
    }
}

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

/* 弹幕区域 */
.danmaku-stream {
    position: fixed;
    left: 0;
    right: 0;
    top: 120px;
    bottom: 190px;
    pointer-events: none;
    overflow: hidden;
    z-index: 200;
}

.danmaku-item {
    position: absolute;
    left: 100%;
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: danmaku-move linear;
}

/* 最新10条弹幕使用淡绿色 */
.danmaku-item.danmaku-newest {
    color: rgba(144, 238, 144, 0.95);
    border-color: rgba(144, 238, 144, 0.3);
}

@keyframes danmaku-move {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-130vw);
    }
}

@media (max-width: 768px) {
    .comment-section {
        bottom: 20px;
        padding: 0 12px;
        flex-direction: row;
        align-items: center;
    }

    .comment-bell-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        margin-bottom: 0;
        pointer-events: auto;
    }

    .comment-form-container {
        max-width: 90%;
        width: 90%;
        border-radius: 999px;
        padding: 4px 6px 4px 14px;
        display: flex;
        align-items: center;
    }

    .comment-form {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .comment-form textarea {
        min-height: 32px;
        max-height: 32px;
        line-height: 32px;
        padding: 0;
        font-size: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        vertical-align: middle;
        text-align: center;
    }

    .comment-submit-btn {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
        background: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .danmaku-stream {
        top: 100px;
        bottom: 150px;
    }
}

/* 移除浮动按钮（如有遗留，不显示） */
.mobile-comment-btn { display: none !important; }

/* 手机端弹幕发送条改进 */
@media (max-width: 768px) {
    .comment-section {
        bottom: 20px;
        padding: 0 12px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        pointer-events: none;
        gap: 8px;
    }
    .comment-form-container {
        width: 100%;
        max-width: 100%;
        display: flex;
        padding: 4px 8px;
        pointer-events: auto;
    }
    .comment-form {
        gap: 8px;
        height: 40px;
        width: 100%;
    }
    .comment-bell-btn {
        width: 36px;
        height: 36px;
        margin-bottom: 0;
    }
    .comment-submit-btn {
        width: 36px;
        height: 36px;
    }
    .comment-form textarea {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
        line-height: 36px;
        padding: 0 8px;
        text-align: left;
    }
}

/* 独立AI消息显示层 - 解决文本混乱问题 */
.ai-message-display {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 176px;
    transform: translateX(-50%);
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    width: min(480px, calc(100vw - 32px));
    max-height: min(58vh, 560px);
    overflow-y: auto;
    padding: 44px 6px 8px 6px;
    z-index: 1301;
    pointer-events: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.26) transparent;
    overscroll-behavior: contain;
}

.ai-quick-actions {
    display: none !important;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%);
    z-index: 1302;
    width: min(420px, calc(100vw - 32px));
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.ai-quick-actions button {
    flex: 1;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(14, 18, 24, 0.88);
    color: rgba(255, 255, 255, 0.94);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

.ai-quick-actions button:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.36);
    background: rgba(24, 28, 42, 0.94);
}

.ai-message-display::-webkit-scrollbar {
    width: 6px;
}

.ai-message-display::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.24);
    border-radius: 999px;
}

.ai-message-display.active {
    display: flex;
}

.ai-message-close {
    position: sticky;
    top: 0;
    align-self: flex-end;
    width: 32px;
    height: 32px;
    margin-bottom: -34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(18, 20, 26, 0.92);
    color: rgba(255, 255, 255, 0.92);
    font-size: 22px;
    line-height: 28px;
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.ai-message-close:hover {
    background: rgba(34, 36, 44, 0.96);
}

.ai-message-row {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    width: 100%;
    opacity: 0;
    animation: aiBubbleIn 0.42s ease forwards;
    pointer-events: auto;
}

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

.ai-message-row.assistant {
    justify-content: flex-start;
}

.ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex: 0 0 32px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.ai-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-message-avatar.user-avatar {
    background: rgba(255, 255, 255, 0.1);
}

.ai-message-bubble {
    max-width: min(360px, calc(100vw - 112px));
    padding: 12px 14px;
    border-radius: 18px;
    color: rgba(255, 255, 255, 0.96);
    font-size: 13px;
    line-height: 1.65;
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    pointer-events: auto;
}

.ai-message-content {
    max-height: none;
    overflow: visible;
}

.ai-message-item {
    margin-bottom: 12px;
}

.ai-message-item:last-child {
    margin-bottom: 0;
}

.ai-message-bubble.is-long {
    width: min(360px, calc(100vw - 112px));
}

.ai-message-bubble.is-long.is-collapsed .ai-message-content {
    max-height: 168px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent);
    mask-image: linear-gradient(to bottom, #000 72%, transparent);
}

.ai-message-expand {
    display: block;
    margin: 10px auto 0;
    height: 28px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.ai-message-link {
    color: #8ec5ff;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    word-break: break-all;
    pointer-events: auto;
}

.ai-message-image {
    display: block;
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: 12px;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
}

.ai-message-row.user .ai-message-bubble {
    order: 1;
    background: rgba(14, 18, 32, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-bottom-right-radius: 6px;
}

.ai-message-row.user .ai-message-avatar {
    order: 2;
}

.ai-message-row.assistant .ai-message-bubble {
    order: 2;
    background: rgba(14, 18, 32, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-bottom-left-radius: 6px;
}

.ai-message-row.assistant .ai-message-avatar {
    order: 1;
    background: rgba(255, 255, 255, 0.12);
}

.ai-message-display.fading .ai-message-row {
    animation: aiBubbleOut 1.8s ease forwards;
}

@keyframes aiBubbleIn {
    from {
        opacity: 0;
        transform: translate(18px, 10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
}

@keyframes aiBubbleOut {
    to {
        opacity: 0;
        transform: translate(12px, -14px) scale(0.98);
        filter: blur(2px);
    }
}

.ai-message-indicator {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 16px;
    flex-shrink: 0;
}

.ai-message-indicator .spectrum-bar {
    width: 2px;
    background: linear-gradient(to top, #ffd93d, #ff9f43);
    border-radius: 1px;
    animation: spectrumBarPulse 0.8s ease-in-out infinite;
}

.ai-message-indicator .spectrum-bar:nth-child(1) { animation-delay: 0s; height: 8px; }
.ai-message-indicator .spectrum-bar:nth-child(2) { animation-delay: 0.15s; height: 12px; }
.ai-message-indicator .spectrum-bar:nth-child(3) { animation-delay: 0.3s; height: 16px; }
.ai-message-indicator .spectrum-bar:nth-child(4) { animation-delay: 0.45s; height: 12px; }
.ai-message-indicator .spectrum-bar:nth-child(5) { animation-delay: 0.6s; height: 8px; }

@keyframes spectrumBarPulse {
    0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

.ai-message-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    line-height: 1.4;
}

.kanban-girl-image.thinking {
    position: relative;
    overflow: visible;
    animation: kanbanThinkingFloat 1.3s ease-in-out infinite;
}

.kanban-girl-image.thinking::before {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 28px;
    background: radial-gradient(circle at 50% 18%, rgba(255, 217, 61, 0.5), transparent 58%);
    filter: blur(8px);
    opacity: 0.9;
    z-index: -1;
}

.kanban-girl-image.thinking::after {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 42px;
    height: 18px;
    transform: translateX(-50%);
    border-radius: 999px;
    background:
        radial-gradient(circle at 10px 9px, #ffd93d 0 3px, transparent 4px),
        radial-gradient(circle at 21px 9px, #ffd93d 0 3px, transparent 4px),
        radial-gradient(circle at 32px 9px, #ffd93d 0 3px, transparent 4px),
        rgba(10, 12, 22, 0.62);
    border: 1px solid rgba(255, 217, 61, 0.35);
    box-shadow: 0 8px 20px rgba(255, 217, 61, 0.25);
    animation: kanbanThinkingDots 0.9s ease-in-out infinite;
}

@keyframes kanbanThinkingFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes kanbanThinkingDots {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}

@media (max-width: 768px) {
    .ai-message-display {
        left: 50%;
        right: auto;
        bottom: 142px;
        width: calc(100vw - 20px);
        max-height: 46vh;
        gap: 10px;
    }

    .ai-quick-actions {
        bottom: calc(100% + 10px);
        width: calc(100vw - 24px);
        gap: 8px;
    }

    .ai-quick-actions button {
        height: 32px;
        font-size: 11px;
    }

    .ai-message-bubble {
        max-width: calc(100vw - 84px);
        padding: 10px 12px;
        font-size: 12px;
        line-height: 1.6;
        border-radius: 16px;
    }

    .ai-message-avatar {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }
}

.ai-message-display.thinking .ai-message-text {
    color: #ffd93d;
}

.ai-message-display.answer .ai-message-text {
    color: #ff9fbf;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: 240px;
    text-align: center;
}

/* 思考中指示器容器 - 已废弃，使用ai-message-display */
.thinking-indicator {
    display: none !important;
}

/* 思考中状态下的textarea - 保持简单，不改变颜色 */
.comment-form textarea.thinking-active {
    /* 不再改变颜色，保持输入框清晰 */
}

/* 回答显示状态下的textarea */
.comment-form textarea.answer-showing {
    /* 不再改变颜色，保持输入框清晰 */
}

/* 用户正在输入时恢复默认样式 */
.comment-form textarea.user-typing {
    color: #fff !important;
}

/* 文本淡出动画 - 用于消息显示层 */
.ai-message-text.fade-out {
    animation: textFadeOut 0.4s ease-in forwards;
}

@keyframes textFadeOut {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-5px); }
}

.ai-message-text.fade-in {
    animation: textFadeIn 0.4s ease-out forwards;
}

@keyframes textFadeIn {
    0% { opacity: 0; transform: translateY(5px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* 看板娘消息样式 */
.kanban-girl-message {
    color: #ff6b9d !important;
    animation: kanbanGirlFadeIn 0.6s ease-out forwards;
}

@keyframes kanbanGirlFadeIn {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}
