/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: #fff;
}

#app {
    height: 100vh;
    overflow: hidden;
}

.app-container {
    height: 100vh;
    overflow-y: auto;
}

/* 首页布局 */
.home-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
}

/* 顶部导航标签 */
.top-tabs {
    background: rgba(0, 0, 0, 0.2);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tabs-container {
    display: flex;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

.tab-item {
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.tab-item:first-child {
    padding-left: 15px;
}

.tab-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.tab-item.active {
    color: #fff;
    border-bottom-color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
}

.tab-item.active:hover {
    color: #fff;
    border-bottom-color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
}

/* 搜索区域 */
.search-section {
    padding: 8px 15px 12px 15px;
    background: rgba(0, 0, 0, 0.1);
}

.search-container {
    display: flex;
    gap: 12px;
    align-items: center;
    max-width: 100%;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    min-width: 0; /* 防止flex子项溢出 */
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 28px;
    padding: 15px 24px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-input:focus {
    border-color: #ff4757;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 16px rgba(255, 71, 87, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* 按钮组容器 */
.search-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
    height: 100%;
}

/* 按钮基础样式 */
.search-btn,
.recommend-btn {
    border: none;
    border-radius: 28px;
    padding: 15px 24px;
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    box-sizing: border-box;
}

.search-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    min-width: 100px;
    flex: 1;
}

.search-btn:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.search-btn:active {
    transform: translateY(-1px);
}

/* 推荐按钮样式 */
.recommend-btn {
    background: linear-gradient(135deg, #ff4757, #ff6b7a);
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.2);
    min-width: 100px;
    flex: 1;
}

.recommend-btn:hover {
    background: linear-gradient(135deg, #ff3742, #ff5722);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.35);
}

.recommend-btn:active {
    transform: translateY(-1px);
}

/* Banner轮播区域 */
.banner-section {
    margin: 5px 15px;
}

.banner-container {
    position: relative;
    width: 100%;
    height: 180px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.1);
}

.banner-slider {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.banner-slide {
    position: relative;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    cursor: pointer;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.banner-slide:hover img {
    transform: scale(1.05);
}

.banner-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 20px;
    color: #fff;
    z-index: 2;
}

.banner-title {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* 轮播指示器 */
.banner-indicators {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 3;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: #fff;
    transform: scale(1.2);
}

.indicator:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* 轮播导航按钮 */
.banner-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.banner-container:hover .banner-nav {
    opacity: 1;
    pointer-events: auto;
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-btn.prev {
    transform: translateX(-50%);
}

.nav-btn.next {
    transform: translateX(50%);
}

.banner-container:hover .nav-btn.prev {
    transform: translateX(0);
}

.banner-container:hover .nav-btn.next {
    transform: translateX(0);
}

/* 应用图标网格 */
.apps-grid-section {
    padding: 0 15px 5px 15px;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 2px 1px;
}

.app-item:active {
    transform: scale(0.95);
}

.app-icon {
    width: 46px;
    height: 46px;
    margin-bottom: 4px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.app-item:hover .app-icon {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-title {
    font-size: 10px;
    color: #fff;
    text-align: center;
    line-height: 1.1;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
}

/* 友情链接板块 */
.friend-links-section {
    padding: 5px 15px 10px 15px;
}

.section-title {
    font-size: 16px;
    color: #ff4757;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: left;
}

.friend-links-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.friend-link-item {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 8px;
    border-radius: 8px;
    text-align: center;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.friend-link-item:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.friend-link-item:active {
    transform: translateY(0);
}

/* 视频列表区域 */
.video-list-section {
    padding: 5px 15px 10px 15px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.more-link {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    cursor: pointer;
}

.more-link:hover {
    color: #fff;
}

.video-group {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.video-group:last-child {
    margin-bottom: 0;
}

/* 左侧主视频容器 */
.main-video {
    display: flex;
    flex-direction: column;
}

/* 右侧小视频容器 */
.side-videos {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 视频项通用样式 */
.video-item {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.video-item:hover {
    transform: translateY(-2px);
}

.video-thumbnail {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.1);
}

.video-item.large .video-thumbnail {
    aspect-ratio: 16/9;
}

.video-item.small .video-thumbnail {
    aspect-ratio: 16/9;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.play-count {
    color: #fff;
    font-size: 11px;
    opacity: 0.9;
}

.video-duration {
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 4px;
}

.video-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff4757;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.video-title {
    color: #fff;
    font-size: 13px;
    line-height: 1.3;
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

/* 大视频标题（4行） */
.video-item.large .video-title {
    -webkit-line-clamp: 4;
}

.video-item.small .video-title {
    font-size: 11px;
    -webkit-line-clamp: 2;
}

/* 广告区域 */
.ad-section {
    padding: 10px 15px;
}

.ad-banner {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    height: 80px; /* 调整高度为原来的2/3左右 */
}

.ad-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 更多推荐按钮 */
.more-recommend-section {
    padding: 10px 15px 8px 15px;
    text-align: center;
}

.more-recommend-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 10px 25px;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.more-recommend-btn::before {
    content: '>';
    font-size: 12px;
    opacity: 0.8;
}

.more-recommend-btn:hover {
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.more-recommend-btn:active {
    transform: scale(0.98);
}

/* 加载状态 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #ff4757;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式适配 */
@media (max-width: 480px) {
    .search-section {
        padding: 10px 12px 14px 12px;
    }
    
    .search-container {
        gap: 8px;
    }
    
    .search-input {
        padding: 14px 18px;
        font-size: 14px;
        border-radius: 25px;
    }
    
    .search-buttons {
        gap: 6px;
        min-width: auto;
    }
    
    .search-btn,
    .recommend-btn {
        padding: 12px 16px;
        font-size: 13px;
        border-radius: 25px;
        min-width: 80px;
        height: 44px;
        flex: 1;
    }
    
    .banner-section {
        margin: 12px;
        margin-bottom: 15px;
    }
    
    .banner-container {
        height: 180px;
    }
    
    .apps-grid {
        gap: 15px 10px;
        padding: 12px;
    }
    
    .app-icon {
        width: 45px;
        height: 45px;
    }
    
    .app-title {
        font-size: 10px;
        max-width: 50px;
    }
    
    .tab-item {
        padding: 10px 15px;
        font-size: 14px;
    }
}

@media (max-width: 375px) {
    .search-section {
        padding: 8px 10px 12px 10px;
    }
    
    .search-container {
        gap: 6px;
    }
    
    .search-input {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .search-buttons {
        gap: 4px;
        min-width: auto;
    }
    
    .search-btn,
    .recommend-btn {
        padding: 10px 12px;
        font-size: 12px;
        min-width: 70px;
        height: 40px;
        flex: 1;
    }
}

/* 超小屏幕优化 */
@media (max-width: 320px) {
    .search-container {
        gap: 4px;
    }
    
    .search-input {
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .search-buttons {
        gap: 3px;
    }
    
    .search-btn,
    .recommend-btn {
        padding: 8px 10px;
        font-size: 11px;
        min-width: 60px;
        height: 36px;
        flex: 1;
    }
}

@media (min-width: 768px) {
    .home-page {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .apps-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* 弹窗广告样式 */
.popup-ad-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.popup-ad-overlay.show {
    opacity: 1;
    visibility: visible;
}

.popup-ad-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.popup-ad-overlay.show .popup-ad-content {
    transform: scale(1);
}

.popup-ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.popup-ad-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10002; /* 确保关闭按钮始终在最上层 */
    line-height: 1;
    user-select: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.popup-ad-close:hover {
    background: rgba(255, 255, 255, 1);
    color: #ff4757;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(255, 71, 87, 0.3);
}

.popup-ad-close:active {
    transform: scale(0.95);
}

/* 确保关闭按钮始终可见 */
.popup-ad-content .popup-ad-close {
    position: absolute !important;
    z-index: 10002 !important;
    pointer-events: auto !important;
}

/* 公告弹窗样式 */
.announcement-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.announcement-overlay.show {
    opacity: 1;
    visibility: visible;
}

.announcement-content {
    position: relative;
    width: 90vw;
    max-width: 500px;
    max-height: 90vh;
    background: #1a1a1a;
    color: #ffffff;
    border-radius: 15px;
    padding: 30px 25px 25px;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    transform: scale(0.8) translateY(30px);
    transition: transform 0.3s ease;
}

.announcement-overlay.show .announcement-content {
    transform: scale(1) translateY(0);
}

.announcement-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.announcement-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.announcement-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
}

.announcement-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: bold;
    color: #ffffff;
}

.announcement-body {
    line-height: 1.6;
}

.announcement-section {
    margin-bottom: 20px;
}

.announcement-section h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: normal;
    color: #cccccc;
    line-height: 1.4;
}

.announcement-link {
    background: rgba(255, 68, 87, 0.1);
    color: #ff4457;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 5px 0;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    font-size: 13px;
    border: 1px solid rgba(255, 68, 87, 0.3);
}

.announcement-email {
    background: rgba(255, 68, 87, 0.1);
    color: #ff4457;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 5px 0;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    border: 1px solid rgba(255, 68, 87, 0.3);
    text-align: center;
}

.announcement-telegram {
    color: #4facfe;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 5px 0;
    font-size: 13px;
    word-break: break-all;
}

.announcement-section p {
    margin: 8px 0;
    font-size: 12px;
    color: #aaaaaa;
    line-height: 1.5;
}

.announcement-note {
    font-size: 13px;
    color: #888888;
    font-style: italic;
    text-align: center;
    padding: 10px;
}

.save-image-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.save-image-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.save-image-btn:active {
    transform: translateY(0);
}

/* 公告加载状态样式 */
.loading-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #888888;
}

.loading-placeholder p {
    margin: 0;
    font-size: 14px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* 弹窗响应式样式 */
@media (max-width: 768px) {
    .popup-ad-content {
        max-width: 95vw;
        max-height: 80vh;
        border-radius: 10px;
    }
    
    .popup-ad-close {
        width: 30px;
        height: 30px;
        top: 10px;
        right: 10px;
        font-size: 16px;
    }

    .announcement-content {
        width: 95vw;
        padding: 25px 20px 20px;
        max-height: 85vh;
    }

    .announcement-header h2 {
        font-size: 20px;
    }

    .announcement-section h3 {
        font-size: 13px;
    }

    .announcement-link,
    .announcement-email {
        font-size: 12px;
        padding: 6px 10px;
    }
}