/* 视频容器 */
#videoContainer {
    position: relative;
    margin: auto;
}

video {
    width: 100%;
}

/* 悬浮控制按钮样式 */
.video-control-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
}

/* 桌面端悬停效果 */
/* @media (min-width: 768px) {
    #videoContainer:hover .video-control-btn {
        opacity: 1;
    }
} */
/* 桌面端悬停效果 - 只在非触摸设备生效 */
@media (hover: hover) and (pointer: fine) {
    #videoContainer:hover .video-control-btn {
        opacity: 1;
    }
}

/* 移动端激活状态 */
#videoContainer.active .video-control-btn {
    opacity: 1;
}

/* 音频容器 */
#audioContainer {
    position: relative;
    margin: auto;
    height: 10rem;
    background-color: #000;
}

audio {
    filter: invert(1);
    /* invert(1) 让白色变黑，黑色变白，使 <audio> 播放器的样式翻转。 */
    position: absolute;
    left: 0.5em;
    top: 100%;
    width: calc(100% - 1em);
    height: 1em;
    transform: translateY(-40px);
}

audio::-webkit-media-controls-panel {
    background-color: transparent;
    /* 设置背景颜色为半透明 */
}

audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-mute-button {
    background-color: transparent;
    /* 设置按钮颜色为半透明 */
}

/* 桌面端悬停效果 */
/* @media (min-width: 768px) {
    #audioContainer:hover .video-control-btn {
        opacity: 1;
    }
} */
@media (hover: hover) and (pointer: fine) {
    #audioContainer:hover .video-control-btn {
        opacity: 1;
    }
}

/* 移动端激活状态 */
#audioContainer.active .video-control-btn {
    opacity: 1;
}

#audioContainer .audio-wave-parent {
    display: flex;
    position: absolute;
    left: 0%;
    top: 0%;
    width: 100%;
    height: 100%;
    transform: scale(0.5);
}

#audioContainer .audio-wave {
    display: flex;
    width: 100%;
    margin: auto;
    position: relative;
    overflow: hidden;
    align-items: center;
    justify-content: space-around
}

#audioContainer .audio-wave::after {
    content: "";
    position: absolute;
    background-image: linear-gradient(90deg, black 0%, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 0) 90%, black 100%);
    left: 0;
    top: 0;
    height: 100%;
    width: 100%
}

#audioContainer input:not(:checked)~.audio-wave {
    background: linear-gradient(rgba(255, 215, 0, 0) 47%, #ffd700 48%, #ffd700 52%, rgba(255, 215, 0, 0) 53%)
}

#audioContainer input:not(:checked)~.audio-wave s {
    animation-play-state: paused;
    -webkit-animation-play-state: paused;
    max-height: 10px;
    opacity: 0
}

#audioContainer input:not(:checked)~.audio-wave s u {
    animation-play-state: paused;
    padding: 0 100px
}

#audioContainer s {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    overflow: hidden;
    transition: opacity 1s, max-height 1s;
    animation: move-left 6s linear infinite
}

@keyframes move-left {
    0% {
        transform: translateX(0%)
    }

    100% {
        transform: translateX(-100%)
    }
}

#audioContainer .audio-wave u {
    display: block;
    background: gold;
    height: 100px;
    max-height: 100px;
    padding: 0 2px;
    border-radius: 2px;
    animation: sound 0ms -800ms linear infinite alternate;
    transition: all 1s
}

@keyframes sound {
    0% {
        opacity: .35;
        max-height: 20px
    }

    100% {
        opacity: 1;
        max-height: 100px
    }
}

#audioContainer .audio-wave u:nth-of-type(1) {
    animation-duration: 948ms
}

#audioContainer .audio-wave u:nth-of-type(2) {
    animation-duration: 866ms
}

#audioContainer .audio-wave u:nth-of-type(3) {
    animation-duration: 814ms
}

#audioContainer .audio-wave u:nth-of-type(4) {
    animation-duration: 916ms
}

#audioContainer .audio-wave u:nth-of-type(5) {
    animation-duration: 800ms
}

#audioContainer .audio-wave u:nth-of-type(6) {
    animation-duration: 854ms
}

#audioContainer .audio-wave u:nth-of-type(7) {
    animation-duration: 882ms
}

#audioContainer u:nth-of-type(8) {
    animation-duration: 838ms
}

#audioContainer .audio-wave u:nth-of-type(9) {
    animation-duration: 974ms
}

#audioContainer .audio-wave u:nth-of-type(10) {
    animation-duration: 884ms
}

/* 位置调整 */
#fastForwardBtn,
#rewindBtn,
#fastForwardBtnAudio,
#rewindBtnAudio {
    font-size: 1.25rem;
    padding: .25rem;
}

#fastForwardBtn,
#fastForwardBtnAudio {
    left: 60%;
}

#rewindBtn,
#rewindBtnAudio {
    left: 40%;
}

@media (max-width: 767px) {

    #fastForwardBtn,
    #fastForwardBtnAudio {
        left: 80%;
        font-size: .75rem;
        padding: .15rem;
    }

    #rewindBtn,
    #rewindBtnAudio {
        left: 20%;
        font-size: .75rem;
        padding: .15rem;
    }
}

/* 设置按钮样式，居中显示在视频顶部 */
#settingsButton,
#settingsButtonAudio {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 5px 5px;
    border: none;
    font-size: 16px;
    cursor: auto;
    border-radius: 5px;
}

#settingsPanel .select-regular {
    background-color: rgb(245, 245, 246);
}

#settingsPanel .select-regular {
    cursor: pointer;
    padding-right: 1em;
    max-width: 100%;
    color: #000;
    background-image: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScyMDAnIGhlaWdodD0nMjAwJz48cGF0aCBkPSdNNzIxLjc5NCAzODQuMTE2bC02MC45NDMgNjAuOTQ0LTIxMS4xOS0yMTEuMTkgNjAuOTQ0LTYwLjk0M3onIGZpbGw9JyMwMDAnLz48cGF0aCBkPSdNMjk5LjMxNyAzODMuOTg4bDYwLjk0MyA2MC45NDMgMjExLjE5LTIxMS4xOS02MC45NDQtNjAuOTQyek0zMDEuOSA2MzkuNTk0bDYwLjk0NC02MC45NDQgMjExLjE4OSAyMTEuMTktNjAuOTQzIDYwLjk0M3onIGZpbGw9JyMwMDAnLz48cGF0aCBkPSdNNzI0LjM5MSA2MzkuNzNsLTYwLjk0My02MC45NDMtMjExLjE5IDIxMS4xODkgNjAuOTQ0IDYwLjk0M3onIGZpbGw9JyMwMDAnLz48L3N2Zz4=);
    background-repeat: no-repeat;
    background-position: center right;
    background-size: 1em;
}

#settingsPanel .select-regular:hover,
#settingsPanel .select-regular:focus {
    font-weight: bolder;
}

/* 隐藏和显示的设置面板 */
#settingsPanel {
    margin: auto;
    background-color: rgb(245, 245, 246);
    padding: .5rem;
    display: none;
    /* 初始隐藏 */
    opacity: 0;
    /* 初始透明 */
    transform: translateY(-100%);
    /* 初始位置在上方 */
    transition: max-height 1s, opacity 1.5s, padding-top 1s, padding-bottom 1s;
    animation: showPanel 1s ease-in-out forwards, fadeInText 1s 0.3s forwards;
    /* 应用动画 */
}

/* 设置面板中的文字动画 */
#settingsPanel h3,
#settingsPanel p {
    opacity: 0;
    /* 初始状态为透明 */
    animation: fadeInText 1s forwards;
    /* 文字淡入 */
}

#settingsPanel p {
    animation-delay: 0.5s;
    /* 第二段文字的淡入延时 */
}

#settingsPanel h3 {
    animation-delay: 0.3s;
    /* 第一段文字的淡入延时 */
}

#settingsPanel i {
    font-style: normal;
}

#closeSettings {
    position: absolute;
    /* 绝对定位 */
    top: -.5rem;
    right: .1rem;
    font-size: 1.5rem;
    /* 字体大小 */
    background: none;
    border: none;
    cursor: pointer;
}

#settingsPanel .setting-item .switch {
    cursor: pointer;
}

/* 切换按钮和循环开关 */
.controls-group {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.control-item {
    display: flex;
    align-items: center;
}

/* 下载按钮 */
#download {
    position: relative;
    display: inline-block;
    background-color: var(--btn-color);
    color: white;
    padding: .25rem .5rem;
    cursor: pointer;
    font-size: .75rem;
    border-radius: 0;
}

#downloadBtn {
    cursor: pointer;
}

#downloadOptions {
    background-color: var(--btn-color);
}

/* 下载选项悬浮块 */
.download-options {
    position: absolute;
    top: 110%;
    left: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: .25rem;
    width: 300%;
    display: none;
    transition: all 0.3s;
}

.download-setting {
    position: absolute;
    top: 3em;
    left: 0;
    transition: all .75s;
    overflow: auto;
    height: auto;
    width: 15rem;
    max-width: calc(100vw - 1em);
    padding: .5em .5em;
    border-radius: .25em;
    z-index: 999;
    font-size: 80%;
    color: #fff;
    background-color: rgba(36, 9, 107, .9);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    display: none;
}

.download-setting-content {
    display: flex;
    flex-direction: column;
    padding: .5rem;
}

.download-setting-content .form-label {
    font-size: 1rem;
    margin-bottom: 0;
}

.download-setting-content .form-select {
    width: 50%;
    margin-left: .5rem;
}

#videoQualityOption {
    display: flex;
}

.right-btn-container {
    display: flex;
    flex-direction: column;
}

#changeVideoAudioButton {
    position: relative;
    display: inline-block;
    background-color: var(--btn-color);
    color: white;
    padding: .25rem .5rem;
    cursor: pointer;
    font-size: .75rem;
    border-radius: 0;
    width: 50%;
    margin-top: .25rem;
}

/* 分享按钮 */
@media (min-width: 768px) {
    #shareButton {
        position: relative;
        display: inline-block;
        background-color: var(--btn-color);
        color: white;
        padding: .25rem .5rem;
        cursor: pointer;
        font-size: .75rem;
        margin-top: .25rem;
        border-radius: 0;
        width: 50%;
    }
}

@media (max-width: 767px) {
    .right-btn-container {
        display: flex;
        flex-direction: row;
    }

    #shareButton {
        position: relative;
        display: inline-block;
        background-color: var(--btn-color);
        color: white;
        padding: .25rem .5rem;
        cursor: pointer;
        font-size: .75rem;
        margin-top: .25rem;
        border-radius: 0;
        margin-left: 0;
        width: 50%;
    }
}

/* 复制完成消息 */
#copySuccessMessage {
    position: absolute;
    top: 110%;
    left: 0;
    background-color: green;
    color: white;
    padding: .25rem;
    width: 100%;
    text-align: center;
    display: none;
    font-size: 12px;
}

.group-video {
    display: block;
    padding: 1rem;
    color: var(--btn-color);
    border-radius: .5rem;
    cursor: pointer;
}

.group-video-playing {
    color: #fff;
    background-color: var(--btn-color);
}

.group-video:hover {
    color: var(--btn-color);
    background-color: rgb(225, 226, 225);
}

.group-video a {
    display: block;
    color: var(--btn-color);
}

.group-video img {
    width: 100%;
}

/* 添加字幕样式 */

@media (min-width: 768px) {
    .subtitles-main {
        margin-top: 1.5rem !important;
    }
}

#subtitles-container {
    /* max-height: 300px; */
    /* overflow-y: auto; */
    /* margin-top: 20px; */
    min-height: 20vh;
    height: 30vh;
    padding: 10px;
    border-radius: 5px;
    position: relative;
}

@media (max-width: 767px) {
    #subtitles-container {
        min-height: 20vh;
        height: 40vh;
        padding: 10px;
        border-radius: 5px;
        position: relative;
    }
}

/* .subtitle-item {
    margin: 5px 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
} */

/* 换行文字对齐 */
.subtitle-item {
    display: grid;
    margin: 5px 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    grid-template-columns: auto 1fr;
}

.subtitle-item:hover {
    background-color: #e9ecef;
}

.subtitle-item.active {
    /* background-color: #d1ecff; */
    background-color: color-mix(in srgb, var(--btn-color) 50%, transparent);
    /* 设置透明度 */
    font-weight: bold;
}

.subtitle-time {
    font-size: 0.8em;
    color: #6c757d;
    margin-right: 10px;
}

/* 添加隐藏字幕时的样式 */
.subtitles-hidden #subtitles-container {
    display: none;
}

#toggleSubtitlesButton {
    position: relative;
    display: inline-block;
    background-color: var(--btn-color);
    color: white;
    padding: .25rem .5rem;
    cursor: pointer;
    font-size: .75rem;
    border-radius: 0;
    width: 50%;
    margin-top: .25rem;
}

#subtitles-container .subtitles-container-close-btn {
    position: sticky;
    top: 15px;
    right: 15px;
    float: right;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ccc;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    margin-bottom: 10px;
    margin-left: 10px;
}

#subtitles-container .subtitles-container-close-btn:hover {
    background: rgba(255, 50, 50, 0.7);
    color: white;
    transform: rotate(90deg);
}

/* 评论 */
#comment-form{
    position: relative;
}

#showCommentButton {
    position: relative;
    display: inline-block;
    background-color: var(--btn-color);
    color: white;
    padding: .25rem .5rem;
    cursor: pointer;
    font-size: .75rem;
    border-radius: 0;
    width: 50%;
    margin-top: .25rem;
}

.emoji-panel {
    display: none;
    position: absolute;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
    z-index: 100;
    width: 320px;
    max-height: 280px;
    overflow-y: auto;
    /* bottom: 50px; */
    left: 0;
    top: 100%;
}

.emoji-panel.active {
    display: block;
}

.emoji-category {
    margin-bottom: 15px;
}

.emoji-category-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #61666d;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f0f0f0;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.emoji-item {
    font-size: 22px;
    cursor: pointer;
    text-align: center;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
    line-height: 1;
}

.emoji-item:hover {
    background: var(--hover-bg);
    transform: scale(1.1);
}

.emoji-panel-tabs {
    display: flex;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--btn-color);
    padding-bottom: 10px;
}

.emoji-tab {
    padding: 6px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 0.9rem;
    color: #61666d;
    transition: all 0.2s;
}

.emoji-tab.active {
    border-bottom: 2px solid var(--btn-color);
    color: var(--btn-color);
    font-weight: 500;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9499a0;
    background: transparent;
    border: none;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--hover-bg);
    color: var(--btn-color);
}

.tool-btn.active {
    background: var(--btn-color);
    color: white;
}

/* 新增样式：回复表单在评论下方的样式 */
.reply-form-container {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #0d6efd;
}

/* 移动表单时隐藏原始表单 */
.comment-form-container.hidden {
    display: none;
}

#comment-container .comment-container-close-btn {
    position: sticky;
    top: 15px;
    right: 15px;
    float: right;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ccc;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    margin-bottom: 10px;
    margin-left: 10px;
}

#comment-container .comment-container-close-btn:hover {
    background: rgba(255, 50, 50, 0.7);
    color: white;
    transform: rotate(90deg);
}