* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 主内容区 */
.main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* 页面 */
.page {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: #f5f5f5;
}

.page.active {
    display: block;
}

/* 首页 - 全屏视频 */
#home-page {
    background: #000;
    position: relative;
}

/* 顶部栏 */
.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), transparent);
}

.top-bar.simple {
    justify-content: flex-start;
    background: none;
}

.menu-btn {
    background: rgba(0,0,0,0.3);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

/* 视频播放器 */
.video-player-fullscreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-player-fullscreen video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    /* 隐藏默认播放按钮 */
    &::-webkit-media-controls-play-button,
    &::-webkit-media-controls-start-playback-button,
    &::-webkit-media-controls-enclosure {
        display: none !important;
    }
}

/* 视频进度条 */
.video-progress-container {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    z-index: 10;
}

.video-progress-bar {
    height: 100%;
    background: #ff0050;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.video-progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 12px;
    height: 12px;
    background: #ff0050;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s, left 0.1s linear;
}

.video-progress-container:hover .video-progress-handle,
.video-progress-container:active .video-progress-handle {
    opacity: 1;
}



/* 滑动提示 */
.swipe-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.6);
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 20;
    animation: fadeOut 3s forwards;
    animation-delay: 2s;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #333;
    z-index: 1000;
}

.nav-item {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    padding: 5px 20px;
}

.nav-item.active {
    color: #fff;
}

.nav-icon {
    font-size: 22px;
}

.nav-text {
    font-size: 11px;
}

/* 左侧分类菜单 */
.side-menu {
    position: fixed;
    top: 0;
    left: -85%;
    width: 85%;
    height: 100%;
    background: #1a1a2e;
    z-index: 2000;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.side-menu.active {
    left: 0;
}

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

.menu-header h3 {
    font-size: 20px;
}

.close-menu-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

.menu-section {
    margin-bottom: 25px;
}

.menu-section h4 {
    font-size: 14px;
    color: #888;
    margin-bottom: 15px;
}

.default-category {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #252632;
    border-radius: 12px;
    cursor: pointer;
}

.default-category.active {
    background: #fe2c55;
}

.default-category .icon {
    font-size: 20px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 5px;
    background: #252632;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.category-item .icon {
    font-size: 28px;
}

.category-item span:last-child {
    font-size: 12px;
    color: #ccc;
}

.custom-api-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.custom-api-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: #252632;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.custom-api-item:hover {
    background: #2f303e;
}

.custom-api-item.active {
    background: #ff0050;
}

.custom-api-item .icon {
    font-size: 28px;
}

.custom-api-item .name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.custom-api-item .type-tag {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    color: #aaa;
}

/* 遮罩层 */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
}

.overlay.active {
    display: block;
}

/* 页面头部 */
.page-header {
    background: #fff;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-header h2 {
    font-size: 18px;
    color: #333;
    flex: 1;
    text-align: center;
}

.back-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #333;
    cursor: pointer;
    padding: 0 10px;
}

/* 内容网格 */
.content-grid {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

/* 我的页面 */
#profile-page {
    background: #f5f5f5;
    padding-bottom: 80px;
}

.profile-header {
    background: #fff;
    padding: 30px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.user-info-text h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 5px;
}

.user-info-text p {
    font-size: 14px;
    color: #999;
}

.profile-stats {
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 20px;
    margin-bottom: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-num {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.stat-label {
    font-size: 13px;
    color: #999;
}

.profile-actions {
    background: #fff;
    padding: 20px;
    margin-bottom: 10px;
}

.action-row {
    display: flex;
    justify-content: space-around;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.action-item .icon {
    font-size: 28px;
}

.action-item span:last-child {
    font-size: 13px;
    color: #666;
}

/* 设置列表 */
.settings-list {
    background: #fff;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-title {
    font-size: 15px;
    color: #333;
}

.setting-desc {
    font-size: 12px;
    color: #999;
}

.arrow {
    font-size: 20px;
    color: #ccc;
}

/* 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #fe2c55;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* 接口管理页面 */
#api-manage-page {
    background: #f5f5f5;
}

.api-status-bar {
    background: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.api-count {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.api-count strong {
    color: #333;
}

.status-text {
    font-size: 12px;
    color: #666;
}

.api-actions {
    display: flex;
    gap: 10px;
}

.btn-add, .btn-refresh {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
}

.btn-add {
    background: #fe2c55;
    color: #fff;
}

.btn-refresh {
    background: #f0f0f0;
    color: #666;
}

.api-list {
    padding: 0 15px 80px 15px;
}

.api-item {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.api-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 12px;
}

.api-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.api-name {
    font-size: 15px;
    color: #333;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    gap: 8px;
}

.api-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #52c41a;
}

.api-status.invalid {
    background: #ff4d4f;
}

.api-url {
    font-size: 12px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-item-actions {
    display: flex;
    gap: 10px;
}

.api-item-actions button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    color: #666;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    align-items: flex-end;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    margin-bottom: 60px;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 18px;
    color: #333;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
}

/* 表单 */
.form-group {
    padding: 15px 20px;
    border-bottom: 1px solid #f5f5f5;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    background: #f9f9f9;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #fe2c55;
}

.icon-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.icon-option {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: #f5f5f5;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
}

.icon-option.selected {
    border-color: #fe2c55;
    background: #fff0f3;
}

.form-actions {
    display: flex;
    gap: 15px;
    padding: 20px;
}

.form-actions button {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    cursor: pointer;
}

.btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.btn-save {
    background: #fe2c55;
    color: #fff;
}

/* ========== 短剧页面样式 ========== */
.shorts-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: #f5f5f5;
}

.shorts-search {
    display: flex;
    padding: 10px 15px;
    background: #fff;
    gap: 10px;
}

.shorts-search input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    background: #f5f5f5;
}

.shorts-search button {
    padding: 10px 15px;
    background: #fe2c55;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 16px;
    cursor: pointer;
}

.shorts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 15px;
}

.shorts-item {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

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

.shorts-item .cover {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    background: #ddd;
}

.shorts-item .info {
    padding: 8px;
}

.shorts-item .title {
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shorts-item .episodes {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* 短剧详情页 */
.shorts-detail {
    width: 100%;
    height: 100%;
    background: #000;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
}

.shorts-detail.hidden {
    display: none;
}

.detail-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: transparent;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 101;
}

.detail-header .back-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    padding: 0 10px;
    cursor: pointer;
}

.detail-header h3 {
    flex: 1;
    text-align: center;
    font-size: 16px;
    color: #fff;
    margin-right: 40px;
}

.detail-player {
    width: 100%;
    height: 100%;
    background: #000;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.detail-player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.detail-info {
    display: flex;
    padding: 15px;
    background: #1a1a1a;
    gap: 15px;
}

.detail-info img {
    width: 80px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    background: #333;
}

.detail-meta {
    flex: 1;
}

.detail-meta h4 {
    font-size: 16px;
    color: #fff;
    margin-bottom: 8px;
}

.detail-meta p {
    font-size: 13px;
    color: #999;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.episodes-list {
    flex: 1;
    padding: 15px;
    background: #1a1a1a;
    overflow-y: auto;
}

.episodes-list h4 {
    font-size: 14px;
    color: #fff;
    margin-bottom: 12px;
}

.episodes-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.episode-btn {
    padding: 12px 8px;
    background: #333;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.episode-btn:hover,
.episode-btn.active {
    background: #fe2c55;
}

.episode-btn.played {
    background: #555;
    color: #aaa;
}

/* 喜欢看页面 */
#aikan-page {
    background: #f5f5f5;
    padding-bottom: 80px;
}

#aikan-page .page-header {
    background: #fff;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

#aikan-page .page-header h2 {
    font-size: 18px;
    color: #333;
}

.search-bar {
    display: flex;
    padding: 10px 15px;
    background: #fff;
    gap: 10px;
    border-bottom: 1px solid #eee;
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

.search-bar button {
    padding: 10px 20px;
    background: #fe2c55;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
}

.video-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.video-item:hover {
    transform: scale(1.02);
}

.video-item .thumbnail {
    width: 100%;
    aspect-ratio: 9/16;
    object-fit: cover;
    background: #ddd;
}

.video-item .video-info {
    padding: 8px;
}

.video-item .video-title {
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-item .video-duration {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.load-more {
    text-align: center;
    padding: 20px;
}

.load-more button {
    padding: 10px 30px;
    background: #fe2c55;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

/* 视频播放弹窗 */
.video-player-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.video-player-modal.active {
    display: flex;
}

.video-player-modal video {
    max-width: 100%;
    max-height: 80vh;
}

.video-player-modal .close-player {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 30px;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
}

/* 响应式 */
@media (max-width: 380px) {
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .right-actions {
        right: 10px;
    }
    
    .action-btn .icon {
        font-size: 28px;
    }
    
    .shorts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .episodes-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
