:root {
    --bg-color: #000;
    --text-color: #fff;
    --primary-color: #4CAF50;
    --primary-color-hover: #45a049;
    --secondary-color: #f44336;
    --secondary-color-hover: #da190b;
    --font-size: 16px;
    --font-family: Arial, sans-serif;
}

/* 通用样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    position: relative;
}

body {
    background: var(--bg-color);
    font-family: var(--font-family);
    overflow-y: auto;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* 背景 */

#background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: url('https://pic.wodefaa.com/giphy.gif') center center no-repeat;
    background-size: contain;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

#background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    max-width: 100%;
    max-height: 100%;
}

/* 弹幕 */

#danmaku-container {
    position: absolute; /* 修改为绝对定位 */
    top: 10%; /* 距离顶部 10% */
    left: 0; /* 宽度为 100% */
    width: 100%; /* 宽度为 100% */
    height: 80%; /* 高度为 80% */
    overflow: hidden;
    pointer-events: none;
    z-index: 2;
}



.danmaku {
    position: absolute;
    white-space: nowrap;
    font-size: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: danmaku-move linear;
}

@keyframes danmaku-move {
    from {
        transform: translateX(100vw);
    }

    to {
        transform: translateX(-100%);
    }
}

/* 播放器控制 */

.controls {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 20px) + 5vh);
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.music-player {
    display: flex;
    align-items: center;
}

.music-player button {
    background: none;
    border: none;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.music-player button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.music-player button i {
    transition: all 0.3s;
}

.music-player button.playing i {
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 音乐列表 */

.music-list {
    position: fixed;
    right: 0;
    top: 80%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    color: var(--text-color);
    width: auto;
    max-width: 300px;
    backdrop-filter: blur(5px);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow: hidden;
    padding-right: 20px;
    /* 保持与右侧的间距 */
}

/*  移除 .music-list.collapsed 的样式 */
/*.music-list.collapsed {
    max-width: 100px;
}*/

.music-list.collapsed ul,
.music-list.collapsed .add-music-form {
    display: none;
}


.music-list h3 {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* max-width: 80px; */
    /* 限制标题的最大宽度 */
}

.music-list ul {
    list-style: none;
}

.music-list li {
    padding: 6px 10px;
    margin: 4px 0;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    transition: all 0.3s;
    box-sizing: border-box;
    width: 100%;
}

.music-list li span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* max-width: 80px; */
    /* 和标题宽度保持一致 */
    display: inline-block;
}

.delete-btn {
    color: #ff4444;
    margin-left: 8px;
    font-size: 16px;
    opacity: 0.7;
    cursor: pointer;
}

.delete-btn:hover {
    opacity: 1;
}

/* 版权信息 */

.copyright {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 20px) + 5vh);
    left: 0;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    z-index: 100;
    padding: 0 20vh;
}

/* 导航栏 */

.nav {
    position: fixed;
    top: 10px;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 0;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 20px;
}

.nav-menu {
    display: flex;
    gap: 25px;
    list-style: none;
}

.nav-menu a {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: var(--font-size);
    font-weight: 500;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.nav-menu a.active {
    background: var(--primary-color);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

/* 添加音乐表单 */

.add-music-form {
    display: none;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    backdrop-filter: blur(5px);
}

.add-music-form input {
    width: 100%;
    padding: 6px;
    margin: 5px 0;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.add-music-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.add-music-form button {
    width: 48%;
    padding: 6px;
    margin-top: 5px;
    border: none;
    border-radius: 4px;
    background: var(--primary-color);
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.3s;
}

.add-music-form button:hover {
    background: var(--primary-color-hover);
}

.cancel-btn {
    background: var(--secondary-color) !important;
}

.cancel-btn:hover {
    background: var(--secondary-color-hover) !important;
}

/* 显示添加音乐按钮 */

#showAddMusic {
    display: block;
    width: 100%;
    padding: 6px;
    margin-top: 5px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.3s;
}

#showAddMusic:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 针对小屏幕设备（例如手机）的样式 */

@media (max-width: 768px) {
    .controls {
        bottom: calc(env(safe-area-inset-bottom, 15vh) + 20vh);
    }

    .copyright {
        bottom: calc(env(safe-area-inset-bottom, 15vh) + 20vh);
    }

    .nav-container {
        justify-content: center;
        padding: 0 15px;
    }

    .nav-menu {
        gap: 15px;
    }

    .nav-menu a {
        padding: 6px 12px;
        font-size: 15px;
    }

    .controls {
        bottom: 15px;
        right: 15px;
        padding: 8px;
    }

    .music-player button {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .music-list {
        right: 0;
        top: 80%;
        transform: translateY(-50%);
        padding: 6px;
        min-width: 150px;
        max-width: 250px;
    }

    .music-list li {
        padding: 4px 8px;
        font-size: 12px;
    }

    .add-music-form {
        padding: 8px;
    }

    .add-music-form input,
    .add-music-form button,
    #showAddMusic {
        padding: 4px;
        font-size: 12px;
    }

    .copyright {
        font-size: 10px;
        bottom: 3px;
    }
}
