/* ==================================================
   抖音教学视频组件
   适用于 MkDocs Material
   横屏 16:9
   ================================================== */


/* ---------- 1. 整体容器 ---------- */

.douyin-course {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    box-sizing: border-box;
}

.douyin-course * {
    box-sizing: border-box;
}


/* ==================================================
   2. 桌面端播放器
   ================================================== */

.douyin-desktop {
    display: block;
}

/* 16:9 自适应播放器：实际考虑工具栏，16:9.76最合适 */
.douyin-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9.76;
    overflow: hidden;

    background: #000;
    border: 1px solid var(--md-default-fg-color--light, #ddd);
    border-radius: 8px;

    margin-bottom: 12px;
}

/* iframe 完全填充播放器 */
.douyin-player iframe {
    position: absolute;
    top: 0;
    left: 0;

    display: block;
    width: 100%;
    height: 100%;

    border: none;
}


/* ==================================================
   3. 桌面端选集按钮
   ================================================== */

.douyin-video-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.video-select-btn {
    display: flex;
    align-items: center;
    gap: 12px;

    width: 100%;
    min-height: 43px;

    padding: 10px 15px;

    border: 1px solid var(--md-default-fg-color--light, #ddd);
    border-radius: 6px;

    background: var(--md-default-bg-color, #fff);
    color: var(--md-default-fg-color, #333);

    text-align: left;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;

    cursor: pointer;

    transition:
        background-color .18s ease,
        color .18s ease,
        border-color .18s ease;
}

/* 鼠标悬停 */
.video-select-btn:hover {
    border-color: var(--md-accent-fg-color, #526cfe);
    background: var(--md-accent-fg-color--transparent,
                    rgba(82,108,254,.08));
}

/* 当前选中 */
.video-select-btn.is-active {
    background: var(--md-accent-fg-color, #526cfe);
    border-color: var(--md-accent-fg-color, #526cfe);
    color: #fff;
}

/* 播放图标 */
.video-play-icon {
    flex-shrink: 0;
    width: 15px;
    text-align: center;
    font-size: 11px;
    opacity: .7;
}

.video-select-btn.is-active .video-play-icon {
    opacity: 1;
}

/* 键盘焦点 */
.video-select-btn:focus-visible {
    outline: 2px solid var(--md-accent-fg-color, #526cfe);
    outline-offset: 2px;
}


/* ==================================================
   4. 手机端视频链接
   ================================================== */

.douyin-mobile {
    display: none;
}

/* 提示栏 */
.mobile-video-tip {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 9px;
    padding: 0 2px;

    color: var(--md-default-fg-color--light, #888);
    font-size: 12px;
}

/* 视频卡片 */
.douyin-mobile a {
    display: flex;
    align-items: center;
    gap: 12px;

    width: 100%;
    min-height: 49px;

    padding: 11px 14px;
    margin-bottom: 8px;

    border: 1px solid var(--md-default-fg-color--light, #ddd);
    border-radius: 7px;

    background: var(--md-default-bg-color, #fff);
    color: var(--md-default-fg-color, #333);

    font-size: 14px;
    line-height: 1.5;
    text-decoration: none !important;

    transition:
        background-color .18s ease,
        border-color .18s ease;
}

/* 点击反馈 */
.douyin-mobile a:active {
    background: var(--md-accent-fg-color--transparent,
                    rgba(82,108,254,.08));
    border-color: var(--md-accent-fg-color, #526cfe);
}

/* 圆形播放图标 */
.mobile-video-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    width: 25px;
    height: 25px;

    border-radius: 50%;

    background: var(--md-accent-fg-color, #526cfe);
    color: #fff;

    font-size: 10px;
}

/* 视频标题 */
.mobile-video-title {
    flex: 1;
    min-width: 0;
}

/* 跳转箭头 */
.mobile-video-arrow {
    flex-shrink: 0;

    color: var(--md-accent-fg-color, #526cfe);
    font-size: 15px;
}


/* ==================================================
   5. 响应式切换
   ================================================== */

@media screen and (max-width: 768px) {

    .douyin-desktop {
        display: none !important;
    }

    .douyin-mobile {
        display: block !important;
    }

}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {

    .video-select-btn,
    .douyin-mobile a {
        transition: none;
    }

}