/* 聊天窗口基础样式 */
.chat-container {
    margin-top: 20px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: 300px;
    /* 可根据需要调整高度 */
    overflow: hidden;
}
.chat-container.hide-controls{
    display: none;
}

.chat-header {
    background: #222;
    padding: 10px 15px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #eee;
}

.chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 消息样式 */
.msg-item {
    margin-bottom: 4px;
    line-height: 1.4;
}

.msg-user {
    color: #007bff;
    font-weight: bold;
    margin-right: 5px;
}

.msg-text {
    color: #ccc;
    word-break: break-all;
}

.msg-system {
    color: #888;
    text-align: center;
    font-size: 0.75rem;
    margin: 5px 0;
}

/* 聊天气泡通用容器 */
.msg-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    max-width: 80%;
}

/* 自己的消息：向右对齐 */
.msg-me {
    align-self: flex-end;
    align-items: flex-end;
}

/* 他人的消息：向左对齐 */
.msg-others {
    align-self: flex-start;
    align-items: flex-start;
}

/* 气泡美化 */
.msg-content {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    word-break: break-all;
    position: relative;
}

.msg-me .msg-content {
    background-color: #007bff;
    color: white;
    border-bottom-right-radius: 2px;
}

.msg-others .msg-content {
    background-color: #333;
    color: #eee;
    border-bottom-left-radius: 2px;
}

.msg-info {
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 4px;
}

.chat-input-area {
    padding: 10px;
    display: flex;
    gap: 8px;
    background: #222;
}

#chat-input {
    flex: 1;
    background: #111;
    border: 1px solid #444;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    outline: none;
}

#send-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0 15px;
    border-radius: 4px;
    cursor: pointer;
}

#send-btn:hover {
    background: #0056b3;
}



@keyframes danmaku-move {
    from {
        transform: translateX(100vw);
    }

    /* 从视口右侧开始 */
    to {
        transform: translateX(-100%);
    }

    /* 移动到自身宽度的负值，完全移出左侧 */
}

/* 弹幕单个元素的样式 */
.danmaku-item {
    position: absolute;
    white-space: nowrap;
    /* 不换行 */
    font-size: 24px;
    /* 默认字号 */
    color: #ffffff;
    /* 默认颜色 */
    text-shadow: 1px 1px 2px #000;
    /* 黑色描边，增加可读性 */
    animation: danmaku-move var(--danmaku-duration, 8s) linear forwards;
    /* 动画属性，duration 会动态设置 */
    will-change: transform;
    /* 浏览器优化动画性能 */
    pointer-events: none;
    /* 确保弹幕本身也不能被点击，只是显示 */
}


/* 播放器内弹幕输入组样式 */
.player-danmaku-input-group {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 2px 10px;
    /* margin: 0 15px; */
    margin-left: 10vw;
    margin-right: auto;
    /* flex: 1; */
    /* 自动填充剩余空间 */
    width: clamp(60px, 50vw, 1000000px);
    transition: all 0.3s;
}

.player-danmaku-input-group:focus-within {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.player-danmaku-input-group input {
    background: transparent;
    border: none;
    color: white;
    font-size: 13px;
    padding: 5px;
    width: 100%;
    outline: none;
}

.player-danmaku-input-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.player-danmaku-input-group button {
    background: var(--primary, #007bff);
    color: white;
    border: none;
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 5px;
}

/* 移动端适配：如果屏幕太窄，隐藏此输入框以防重叠 */
@media (max-width: 600px) {
    .player-danmaku-input-group {
        display: none;
    }
}

.player-danmaku-input-group.hide-controls {
    display: none;
}