/* ========== Reset & Base ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #161822;
    --bg-card: #1a1d2b;
    --bg-card-hover: #222636;
    --bg-header: #0d0f15;
    --text-primary: #e8e8ec;
    --text-secondary: #a0a4b4;
    --text-muted: #6b7084;
    --accent: #e8903c;
    --accent-hover: #f0a050;
    --accent-light: rgba(232, 144, 60, 0.15);
    --border-color: #262a3a;
    --border-light: #323750;
    --tag-bg: #252838;
    --tag-text: #b0b8d0;
    --badge-bg: #e8903c;
    --badge-text: #fff;
    --status-color: #4ecb71;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.5);
    --transition: 0.25s ease;
    --max-width: 1280px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
}

input {
    font-family: inherit;
    outline: none;
    border: none;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========== Header ========== */
.header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), #d4782e);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo-icon::after {
    content: '';
    width: 14px;
    height: 14px;
    background: white;
    clip-path: polygon(30% 20%, 30% 80%, 75% 50%);
    margin-left: 3px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-item {
    padding: 8px 16px;
    font-size: 15px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition);
    white-space: nowrap;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent);
    background: var(--accent-light);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    transition: border-color var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent);
}

.search-input {
    width: 200px;
    padding: 8px 14px;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 8px 12px;
    background: transparent;
    color: var(--text-secondary);
    transition: color var(--transition);
    display: flex;
    align-items: center;
}

.search-btn:hover {
    color: var(--accent);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    padding: 4px;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========== Hot Search ========== */
.hot-search-section {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 0;
}

.hot-search-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.hot-tag-label {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
}

.hot-tag {
    font-size: 13px;
    padding: 4px 12px;
    background: var(--tag-bg);
    border-radius: 14px;
    color: var(--tag-text);
    transition: all var(--transition);
    white-space: nowrap;
}

.hot-tag:hover {
    background: var(--accent);
    color: #fff;
}

/* ========== Sections ========== */
.section {
    margin: 28px 0;
}

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

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon {
    display: inline-block;
    width: 4px;
    height: 22px;
    border-radius: 2px;
    background: var(--accent);
}

.more-link {
    font-size: 14px;
    color: var(--text-muted);
    transition: color var(--transition);
}

.more-link:hover {
    color: var(--accent);
}

/* ========== Video Grid ========== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}

.video-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.video-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.video-card-thumb {
    position: relative;
    width: 100%;
    padding-top: 140%;
    overflow: hidden;
    background: var(--bg-secondary);
}

.video-card-thumb img,
.video-card-thumb-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s ease;
}

.video-card:hover .video-card-thumb-bg,
.video-card:hover .video-card-thumb img {
    transform: scale(1.08);
}

.video-card-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    color: var(--badge-text);
    background: var(--badge-bg);
    z-index: 2;
}

.video-card-badge.status {
    background: var(--status-color);
}

.video-card-score {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(0,0,0,0.7);
    z-index: 2;
}

.video-card-info {
    padding: 10px 12px 12px;
}

.video-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.video-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-card-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== Ranking Grid ========== */
.ranking-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.ranking-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all var(--transition);
}

.ranking-card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-hover);
}

.ranking-thumb {
    width: 100px;
    height: 140px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-secondary);
    position: relative;
}

.ranking-thumb img,
.ranking-thumb-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-size: cover;
    background-position: center;
}

.ranking-rank {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 var(--radius-sm) 0;
}

.ranking-rank.top1 { background: #e74c3c; }
.ranking-rank.top2 { background: #e8903c; }
.ranking-rank.top3 { background: #f0a050; }

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ranking-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.8;
}

.ranking-desc span {
    display: block;
}

.ranking-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: var(--accent-light);
    color: var(--accent);
    margin-bottom: 6px;
}

/* ========== List Page ========== */
.list-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-tab {
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
}

.filter-tab:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.filter-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.list-count {
    font-size: 13px;
    color: var(--text-muted);
}

.list-count span {
    color: var(--accent);
    font-weight: 600;
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 30px;
    padding: 20px 0;
}

.page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.page-btn.active {
    background: var(--accent);
    color: #fff;
}

.page-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.page-ellipsis {
    padding: 0 6px;
    color: var(--text-muted);
}

/* ========== Play Page ========== */
.play-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    margin-bottom: 24px;
}

.player-container {
    position: relative;
}

.player-placeholder {
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.player-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1d2b 0%, #0d0f15 50%, #1a1d2b 100%);
}

.player-placeholder::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(232,144,60,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.player-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.player-placeholder video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
}

.play-btn-big {
    background: transparent;
    transition: transform var(--transition);
    margin-bottom: 20px;
}

.play-btn-big:hover {
    transform: scale(1.1);
}

.player-info-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.player-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.player-controls-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.control-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-color);
    animation: pulse 2s infinite;
}

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

/* Episode Panel */
.episode-panel {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    max-height: calc(56.25vw * 0.5625 + 20px);
    overflow: hidden;
}

.episode-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.episode-panel-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.episode-sort {
    display: flex;
    gap: 4px;
}

.sort-btn {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    transition: all var(--transition);
}

.sort-btn.active {
    background: var(--accent);
    color: #fff;
}

.episode-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.episode-item {
    display: block;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    transition: all var(--transition);
    margin-bottom: 4px;
}

.episode-item:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.episode-item.active {
    background: var(--accent);
    color: #fff;
}

/* Detail Section */
.detail-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.detail-header {
    margin-bottom: 14px;
}

.detail-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-tag {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    background: var(--tag-bg);
    color: var(--tag-text);
}

.detail-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.8;
}

.detail-plot {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.8;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* ========== Breadcrumb ========== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 0;
    margin-bottom: 8px;
    font-size: 13px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-muted);
    transition: color var(--transition);
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb-sep {
    color: var(--text-muted);
    opacity: 0.5;
}

.breadcrumb-current {
    color: var(--accent);
    font-weight: 500;
}

/* ========== Footer ========== */
.footer {
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    text-align: center;
    margin-top: 40px;
}

.footer-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.footer-disclaimer {
    font-size: 12px;
    color: var(--text-muted);
}

.friend-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
}

.friend-links-label {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.friend-link {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 3px 10px;
    border-radius: 12px;
    transition: all var(--transition);
    white-space: nowrap;
}

.friend-link:hover {
    color: var(--accent);
    background: var(--accent-light);
}

/* ========== Empty State ========== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ========== Responsive ========== */

/* Tablet: 768px - 1024px */
@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .ranking-grid {
        grid-template-columns: 1fr;
    }

    .play-wrapper {
        grid-template-columns: 1fr;
    }

    .episode-panel {
        max-height: none;
        flex-direction: row;
        overflow-x: auto;
    }

    .episode-panel-header {
        flex-shrink: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        border-bottom: none;
        border-right: 1px solid var(--border-color);
    }

    .episode-list {
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        overflow-x: auto;
        padding: 10px 6px;
    }

    .episode-item {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .search-input {
        width: 150px;
    }

    .nav-item {
        padding: 6px 12px;
        font-size: 14px;
    }

    .logo-text {
        font-size: 18px;
    }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .header-inner {
        height: 52px;
    }

    .logo-text {
        font-size: 16px;
    }

    .logo-icon {
        width: 30px;
        height: 30px;
    }

    .nav {
        position: fixed;
        top: 52px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-header);
        flex-direction: column;
        padding: 20px;
        gap: 2px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
        overflow-y: auto;
    }

    .nav.open {
        transform: translateX(0);
    }

    .nav-item {
        padding: 14px 16px;
        font-size: 16px;
        border-radius: var(--radius-md);
        width: 100%;
    }

    .menu-toggle {
        display: flex;
    }

    .header-actions {
        margin-left: auto;
        margin-right: 12px;
    }

    .search-box {
        display: none;
    }

    .ranking-grid {
        grid-template-columns: 1fr;
    }

    .play-wrapper {
        grid-template-columns: 1fr;
    }

    .episode-panel {
        max-height: none;
    }

    .episode-panel-header {
        flex-direction: row;
        border-bottom: 1px solid var(--border-color);
        border-right: none;
    }

    .episode-list {
        flex-direction: column;
        display: block;
        max-height: 280px;
        overflow-y: auto;
    }

    .episode-item {
        white-space: normal;
    }

    .filter-tabs {
        gap: 4px;
    }

    .filter-tab {
        padding: 5px 10px;
        font-size: 12px;
    }

    .detail-section {
        padding: 14px 16px;
    }

    .detail-title {
        font-size: 18px;
    }

    .hot-search-tags {
        gap: 5px;
    }

    .hot-tag {
        font-size: 12px;
        padding: 3px 10px;
    }

    .section-title {
        font-size: 17px;
    }

    .player-placeholder {
        border-radius: 0;
    }

    .player-container {
        margin: 0 -20px;
    }

    .play-wrapper {
        gap: 10px;
    }

    .container {
        padding: 0 12px;
    }
}

/* Small Mobile: < 480px */
@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .video-card-title {
        font-size: 13px;
    }

    .video-card-info {
        padding: 8px 10px 10px;
    }

    .ranking-card {
        padding: 10px;
        gap: 10px;
    }

    .ranking-thumb {
        width: 80px;
        height: 112px;
    }

    .ranking-title {
        font-size: 14px;
    }

    .filter-tab {
        padding: 4px 8px;
        font-size: 11px;
    }

    .detail-title {
        font-size: 16px;
    }

    .play-btn-big svg {
        width: 56px;
        height: 56px;
    }

    .player-title {
        font-size: 15px;
    }
}
