/* dmooji.css */
.ran-dmooji-player {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #000;
    overflow: hidden;
    font-family: sans-serif;
    aspect-ratio: 16 / 9;
    /* Default ratio */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ran-dmooji-player:fullscreen {
    border-radius: 0;
}

.ran-dmooji-player video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* 弹幕层 */
.dmooji-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* 让点击穿透到视频/控制栏 */
    overflow: hidden;
    z-index: 10;
}

.dmooji-item {
    position: absolute;
    white-space: nowrap;
    user-select: none;
    font-size: 20px;
    /* 默认字号 */
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 1px rgba(0, 0, 0, 0.8);
    opacity: 0.9;
    will-change: transform;
    line-height: 1.2;
}

/* 控制栏 */
.dmooji-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s;
}

.ran-dmooji-player:hover .dmooji-controls,
.ran-dmooji-player.is-paused .dmooji-controls {
    opacity: 1;
}

.dmooji-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.dmooji-btn:hover {
    opacity: 1;
}

/* 进度条 */
.dmooji-timeline {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
}

.dmooji-timeline-played {
    height: 100%;
    background: #2563eb;
    /* Accent Color */
    border-radius: 2px;
    width: 0;
    position: relative;
}

.dmooji-timeline-thumb {
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    transition: transform 0.2s;
}

.dmooji-timeline:hover .dmooji-timeline-thumb {
    transform: translateY(-50%) scale(1);
}

/* 输入框区域 */
.dmooji-send-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    height: 32px;
    transition: background 0.2s;
}

.dmooji-send-box:focus-within {
    background: rgba(255, 255, 255, 0.9);
}

.dmooji-input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 12px;
    width: 120px;
    padding: 0 5px;
}

.dmooji-send-box:focus-within .dmooji-input {
    color: #000;
}

.dmooji-send-btn {
    font-size: 12px;
    color: #fff;
    WIDTH: 45PX;
    height: 32px;
    background: #2563eb;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

/* VIP 颜色选择器 */
.dmooji-color-picker {
    position: relative;
    margin-left: 5px;
}

.dmooji-color-trigger {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    cursor: pointer;
    background: #fff;
}

.dmooji-color-menu {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 8px;
    border-radius: 8px;
    display: none;
    /* Hidden by default */
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    z-index: 50;
    /* Ensure visibility */
}

.dmooji-color-picker.active .dmooji-color-menu {
    display: grid;
    /* Show as grid when active */
}

/* Removed hover trigger */

.dmooji-color-option {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .dmooji-mobile-toggle {
        display: block;
    }

    .dmooji-controls #dmooji-list-toggle {
        display: none;
    }

    .dmooji-send-box {
        flex: 1;
        min-width: 0;
        padding: 0 4px;
    }

    .dmooji-input {
        width: 100%;
        min-width: 50px;
    }

    .dmooji-send-btn {
        padding: 2px 6px;
        white-space: nowrap;
    }

    .dmooji-timeline {
        display: none;
    }

    #dmooji-time-display {
        display: none;
    }
}

/* VIP Limit Overlay */
.dmooji-vip-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 50;
    backdrop-filter: blur(5px);
}

.dmooji-vip-overlay h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

.dmooji-vip-btn {
    background: linear-gradient(45deg, #FFFFFF, #FFFFFF);
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: bold;
    color: #5a3a00;
    text-decoration: none;
    margin-top: 20px;
    transition: transform 0.2s;
}

.dmooji-vip-btn:hover {
    transform: scale(1.05);
}

.dmooji-hidden {
    display: none !important;
}

/* Playlist Drawer */
.dmooji-playlist-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 48px;
    /* Above controls */
    width: 240px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 40;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

.dmooji-playlist-title {
    padding: 15px;
    font-size: 14px;
    color: #fff;
    font-weight: bold;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dmooji-playlist-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.dmooji-playlist-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.dmooji-playlist-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.dmooji-playlist-item.active {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
}

.dmooji-playlist-item.active .dmooji-ep-tag {
    color: #2563eb;
    border-color: #2563eb;
}

.dmooji-ep-tag {
    font-size: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    width: 20px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dmooji-ep-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dmooji-free-tag {
    font-size: 10px;
    background: #10b981;
    color: white;
    padding: 1px 4px;
    border-radius: 4px;
}

/* Scrollbar for playlist */
.dmooji-playlist-content::-webkit-scrollbar {
    width: 4px;
}

.dmooji-playlist-content::-webkit-scrollbar-track {
    background: transparent;
}

.dmooji-playlist-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* Mobile List Toggle */
.dmooji-mobile-toggle {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 35;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
    .dmooji-mobile-toggle {
        display: block;
    }

    .dmooji-controls #dmooji-list-toggle {
        display: none;
    }
}