* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    --dy-primary: #ff4500;
    --dy-primary-dark: #e03a00;
    --dy-gray-100: #f8f8f8;
    --dy-gray-200: #f0f0f0;
    --dy-gray-300: #e5e5e5;
    --dy-gray-400: #d9d9d9;
    --dy-gray-500: #999;
    --dy-gray-600: #666;
    --dy-gray-700: #333;
    --dy-gray-800: #222;
    --dy-gray-900: #111;
    --dy-white: #ffffff;
    --dy-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --dy-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --dy-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --dy-radius-sm: 4px;
    --dy-radius-md: 8px;
    --dy-radius-lg: 12px;
    --dy-radius-xl: 16px;
    --dy-radius-full: 50%;
    --dy-transition: all 0.25s ease;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #000;
    color: #fff;
}

/* 搜索标题栏 - 提升层级，确保在评论区上方 */
.search-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 44px;
    z-index: 25; /* 高于评论区的z-index:20 */
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: #fff;
    display: none;
}
.back-btn {
    font-size: 20px;
    cursor: pointer;
    margin-right: 12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}
.search-tip-text {
    font-size: 16px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.douyin-search-btn {
    padding: 8px 24px;
    border-radius: 20px;
    border: none;
    background: var(--dy-primary);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: var(--dy-transition);
    display: inline-block;
    margin-left: 12px;
}
.douyin-search-btn:hover {
    background: var(--dy-primary-dark);
    transform: scale(1.05);
}
#douyin-search-btn {
    display: none;
}
.error-btn-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.search-modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
}
.search-modal {
    width: 90%;
    max-width: 400px;
    background: var(--dy-gray-800);
    border-radius: var(--dy-radius-lg);
    padding: 24px;
    color: #fff;
    box-shadow: var(--dy-shadow-lg);
}
.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.search-modal-title {
    font-size: 18px;
    font-weight: 500;
}
.search-modal-close {
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    transition: var(--dy-transition);
}
.search-modal-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}
.search-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.search-type-tab {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    border-radius: var(--dy-radius-sm);
    background: var(--dy-gray-700);
    cursor: pointer;
    opacity: 0.7;
    transition: var(--dy-transition);
}
.search-type-tab.active {
    background: var(--dy-primary);
    opacity: 1;
}
.search-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
#search-input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 20px;
    border: none;
    background: var(--dy-gray-700);
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: var(--dy-transition);
}
#search-input::placeholder {
    color: var(--dy-gray-500);
}
#search-input:focus {
    background: var(--dy-gray-600);
    box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.5);
}
#search-submit {
    padding: 0 16px;
    border-radius: 20px;
    border: none;
    background: var(--dy-primary);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: var(--dy-transition);
}
#search-submit:hover {
    background: var(--dy-primary-dark);
}

.at-user {
    color: var(--dy-white);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    margin: 0 2px;
    transition: color 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.at-user:hover {
    color: var(--dy-gray-400);
}
.video-tag {
    color: #face15;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    margin: 0 2px;
    transition: color 0.3s ease;
}
.video-tag:hover {
    color: var(--dy-primary);
}

/* 加载/错误容器 */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}
.error-container {
    position: fixed;
    top: 50%;
    left: 50%;
    /*transform: translate(-50%, -50%);*/
    z-index: 20;
    background: rgba(0, 0, 0, 0.9);
    padding: 24px 32px;
    border-radius: var(--dy-radius-lg);
    text-align: center;
    display: none;
    min-width: 280px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.error-title {
    font-size: 18px;
    margin-bottom: 12px;
    color: #ff4444;
}
.error-desc {
    font-size: 14px;
    opacity: 0.8;
    line-height: 1.6;
    margin-bottom: 16px;
}
.retry-btn {
    padding: 8px 24px;
    border-radius: 20px;
    border: none;
    background: #007bff;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.retry-btn:hover {
    background: #0056b3;
    transform: scale(1.05);
}


.fullscreen-video-container {
    width: 100vw;
    height: 100vh;
}
#video-player {
    width: 100%;
    height: 100%;
}
.right-function-bar {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    flex-direction: column;
    gap: 20px;
    z-index: 10;
}
.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
}
.bottom-desc-area {
    position: fixed;
    bottom: 40px;
    left: 16px;
    right: 80px;
    display: none;
    color: #fff;
    z-index: 10;
}
.video-progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 3px;
    background: rgba(255,255,255,0.2);
    z-index: 15;
    cursor: pointer;
}
.progress-fill {
    height: 100%;
    background: var(--dy-primary);
    width: 0%;
}
.interactive-tip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    padding: 8px 16px;
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 20;
}

/* ========== 核心优化：评论区样式 ========== */
/* 评论遮罩 - 保持原有 */
.comment-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    z-index: 19; /* 低于搜索栏，高于视频 */
    display: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.comment-mask.active {
    display: block;
}

/* 评论面板 - 从底部滑入，非全屏，适配电脑/手机 */
.comment-panel {
    position: fixed;
    bottom: 0;    /* 从底部展开 */
    left: 0;      /* 占满宽度，适配所有屏幕 */
    width: 100%;  /* 宽度100%，兼容PC/手机 */
    max-width: 100%;
    /* 高度：手机端80vh，PC端最大600px，最小400px，自适应 */
    max-height: 80vh;
    min-height: 400px;
    height: auto; /* 取消100vh，改为自适应 */
    background: var(--dy-gray-900);
    z-index: 20;  /* 低于搜索栏的25，高于视频 */
    /* 从底部滑入（替代原来的右侧滑入） */
    transform: translateY(100%);
    transition: transform 0.3s ease-out, box-shadow 0.3s ease;
    overflow-y: auto; /* 内部滚动，不超出高度 */
    border-top-left-radius: var(--dy-radius-xl);
    border-top-right-radius: var(--dy-radius-xl);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5); /* 顶部阴影，区分视频层 */
}
.comment-panel.active {
    transform: translateY(0); /* 展开时滑到可视区域 */
    box-shadow: 0 -4px 20px rgba(0,0,0,0.6);
}

/* 评论内容容器 - 优化内边距和间距 */
.comment-container {
    padding: 16px;
    padding-top: 20px; /* 顶部留空，避免内容贴边 */
    max-width: 100%;
}
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background: var(--dy-gray-900);
    padding: 8px 0;
    z-index: 1;
    border-bottom: 1px solid var(--dy-gray-800);
    padding-bottom: 12px;
}
.comment-header h2 {
    font-size: 18px;
    font-weight: 500;
    color: var(--dy-white);
}
.close-comment {
    font-size: 24px;
    cursor: pointer;
    color: var(--dy-gray-400);
    transition: color 0.2s ease;
}
.close-comment:hover {
    color: var(--dy-primary);
}
.loading-comment {
    text-align: center;
    padding: 30px 0;
    color: var(--dy-gray-500);
    font-size: 14px;
}
.error-comment {
    text-align: center;
    padding: 30px 0;
    color: var(--dy-primary);
    font-size: 14px;
}
.comment-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px; /* 增加评论项之间的间距，更美观 */
}
.comment-item {
    display: flex;
    gap: 12px; /* 增大头像和内容的间距 */
    padding: 12px 0;
    border-bottom: 1px solid var(--dy-gray-800);
    transition: background-color 0.2s ease;
    padding: 8px 0;
}
/* 电脑端评论项hover效果 */
@media (min-width: 768px) {
    .comment-item:hover {
        background-color: rgba(255,255,255,0.03);
        border-radius: var(--dy-radius-sm);
        padding: 8px 12px;
        margin: 0 -12px;
    }
}
.comment-item .avatar {
    width: 44px; /* 稍大一点，更协调 */
    height: 44px;
    border-radius: var(--dy-radius-full);
    flex-shrink: 0;
    border: 1px solid var(--dy-gray-800);
}
.comment-content {
    flex: 1;
    min-width: 0; /* 防止内容溢出 */
}
.user-info {
    display: flex;
    align-items: center;
    gap: 8px; /* 增大用户信息项间距 */
    font-size: 13px;
    margin-bottom: 6px;
    flex-wrap: wrap; /* 防止小屏幕溢出 */
}
.nickname {
    color: var(--dy-white);
    font-weight: 500;
    font-size: 14px;
}
.author-reply-tag {
    background: var(--dy-primary);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: var(--dy-radius-sm);
    line-height: 1;
}
.ip-label {
    color: var(--dy-gray-500);
    font-size: 11px;
}
.hot-tag {
    background: #ffd700;
    color: #000;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: var(--dy-radius-sm);
    line-height: 1;
    font-weight: 500;
}
.comment-text {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
    color: var(--dy-gray-200);
    word-wrap: break-word;
    word-break: break-all;
}

/* ========== 核心优化：表情图片样式 ========== */
.dy-emoji {
    width: 20px !important;    /* 限制表情宽度 */
    height: 20px !important;   /* 限制表情高度 */
    vertical-align: middle;    /* 垂直居中对齐文字 */
    margin: 0 2px;             /* 增加左右间距，避免挤在一起 */
    border-radius: 2px;
    display: inline-block;     /* 确保对齐生效 */
}

.comment-image-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.comment-image-item {
    width: 60px;
    height: 60px;
    border-radius: var(--dy-radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 1px solid var(--dy-gray-800);
}
.comment-image-item:hover {
    transform: scale(1.02);
}
.comment-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.comment-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--dy-gray-500);
}
.create-time {
    font-size: 11px;
}
.like-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--dy-gray-500);
    transition: color 0.2s ease;
}
.like-btn:hover {
    color: var(--dy-primary);
}
.like-btn.liked {
    color: var(--dy-primary);
}
.like-icon {
    font-size: 14px;
}
.like-count {
    font-size: 11px;
}

/* 图片预览样式 */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.95);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
}
.image-preview-modal.active {
    display: flex;
}
.close-preview {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 32px;
    color: #fff;
    cursor: pointer;
    z-index: 51;
    transition: color 0.2s ease;
}
.close-preview:hover {
    color: var(--dy-primary);
}
.preview-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--dy-radius-sm);
}

/* 加载动画 */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    opacity: 0.8;
}

/* 全屏视频容器 */
.fullscreen-video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

#video-player {
    /* width: 100%; */
    /* height: 100%; */
    /* display: block; */
    /* object-position: center; */
}

/* 播放/暂停图标 */
.video-play-icon {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    z-index: 4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.video-play-icon.visible {
    opacity: 1;
}

/* 右侧功能栏 */
.right-function-bar {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    z-index: 5;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.control-btn:hover {
    opacity: 1;
    transform: scale(1.08);
    background: rgba(0, 0, 0, 0.9);
}

/* 底部视频信息 */
.bottom-desc-area {
    position: fixed;
    left: 16px;
    bottom: 20px;
    right: 16px;
    z-index: 5;
}

.author-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.author-nickname {
    font-size: 20px;
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.video-desc {
    font-size: 16px;
    line-height: 1.4;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.video-tag {
    color: #face15!important;
    text-decoration: none;
    font-weight: 700;
    margin: 0 2px;
}

.at-user {
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    margin: 0 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.video-meta {
    font-size: 12px;
    opacity: 0.7;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* 进度条 */
.video-progress-bar {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100vw;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 6;
    cursor: pointer;
    transition: height 0.2s ease;
}

.video-progress-bar:hover {
    height: 5px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #ff0000;
    transition: width 0.1s linear;
}

/* ========== PC端评论区美化 ========== */
@media (min-width: 768px) {
    .comment-panel {
        max-width: 680px; /* 增大PC端宽度，更舒适 */
        left: 50%; /* 居中 */
        transform: translate(-50%, 100%); /* 居中+底部隐藏 */
        border-radius: var(--dy-radius-xl); /* 全圆角 */
        box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
    }
    .comment-panel.active {
        transform: translate(-50%, 0); /* 居中展开 */
        box-shadow: 0 -6px 30px rgba(0,0,0,0.5);
    }
    .comment-container {
        padding: 24px; /* PC端增大内边距 */
    }
    .comment-header {
        margin-bottom: 24px;
    }
    .comment-list {
        gap: 20px; /* PC端增大评论间距 */
    }
    .comment-item {
        padding: 12px 0;
    }
    .comment-text {
        font-size: 15px; /* PC端稍大一点，更易读 */
        line-height: 1.6;
    }
    .user-info {
        font-size: 14px;
    }
    .nickname {
        font-size: 15px;
    }
}

/* 隐藏原生视频控制栏 */
#video-player::-webkit-media-controls {
    display: none !important;
}
#video-player {
}

/* 强制隐藏播放图标，优先级最高 */
.video-play-icon {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}
/* 即使有visible类也无效 */
.video-play-icon.visible {
    display: none !important;
}

/* 滚动条美化（仅PC端） */
@media (min-width: 768px) {
    .comment-panel::-webkit-scrollbar {
        width: 6px;
        background-color: var(--dy-gray-900);
    }
    .comment-panel::-webkit-scrollbar-thumb {
        border-radius: 3px;
        background-color: var(--dy-gray-700);
    }
    .comment-panel::-webkit-scrollbar-thumb:hover {
        background-color: var(--dy-gray-600);
    }
}