:root {
    --bg-color: #0f0f13;
    --surface-color: #1c1c23;
    --surface-hover: #2a2a35;
    --primary-color: #8e2de2;
    --primary-hover: #4a00e0;
    --text-main: #f0f0f0;
    --text-muted: #9e9e9e;
    --danger: #ef5350;
    --warning: #ffb300;
    --success: #66bb6a;
    --header-height: 64px;
    --border-radius: 8px;
    --border-radius-lg: 16px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    padding-top: var(--header-height);
}

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

ul {
    list-style: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.text-primary { color: var(--primary-color); }
.text-muted { color: var(--text-muted); }
.text-warning { color: var(--warning); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-size: 0.9rem;
    gap: 6px;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(142, 45, 226, 0.4);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: rgba(142, 45, 226, 0.1);
}

/* Header */
header {
    height: var(--header-height);
    background-color: rgba(28, 28, 35, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.logo span {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a:hover, .nav-links a.text-primary {
    color: var(--primary-color);
}

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

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar input {
    background: var(--surface-hover);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    outline: none;
    font-size: 0.9rem;
    width: 200px;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--primary-color);
    width: 240px;
}

/* Layout */
main {
    margin-top: 0 !important;
    padding-top: 40px !important;
    min-height: calc(100vh - var(--header-height) - 200px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    border-left: 4px solid var(--primary-color);
    padding-left: 12px;
}

/* Comic Grid */
.comic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 24px;
}

@media (min-width: 1024px) {
    .comic-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

.comic-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.comic-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.comic-cover {
    width: 100%;
    aspect-ratio: 2/3;
    background-size: cover;
    background-position: center;
    position: relative;
}

.comic-status {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}

.comic-premium-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(255, 179, 0, 0.9);
    color: #000;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.comic-status.ongoing { color: var(--success); }
.comic-status.completed { color: var(--warning); }

.comic-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.comic-title {
    font-size: 1rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comic-chapter {
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-weight: 500;
}

.comic-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Home Bottom Layout (Ranking & Download) */
.home-bottom-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
    align-items: start;
}

.home-download-card {
    background: linear-gradient(135deg, #2a0845 0%, #08080d 100%);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.download-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.home-download-card h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: #fff;
}

.home-download-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.download-btn {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 8px;
}

/* Banner Slider */
.banner-slider {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    position: relative;
    overflow: hidden;
    background: #050507;
    margin-top: 0;
    margin-bottom: 44px;
    height: 480px;
}

.banner-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 0.7s ease-in-out, transform 0.7s ease-in-out;
    display: flex;
    align-items: center;
    z-index: 0;
}

.banner-slide.active {
    opacity: 1;
    transform: scale(1);
    z-index: 1;
}

.banner-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    background: #050507;
    display: block;
    z-index: 0;
}

.banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0,0,0,.88) 0%, rgba(0,0,0,.65) 38%, rgba(0,0,0,.2) 100%);
    z-index: 1;
}

.featured-content {
    position: absolute;
    left: 48px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    max-width: 460px;
}

.featured-content.no-text {
    top: auto;
    bottom: 30px;
    transform: none;
    left: 48px;
}

.featured-content h2 {
    font-size: 2.5rem;
    margin-bottom: 12px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.featured-content p {
    font-size: 1.1rem;
    margin-bottom: 24px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Indicators */
.banner-indicators {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 10;
}

.banner-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: var(--transition);
}

.banner-indicator.active {
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

/* Slider Nav Arrows */
.banner-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 44px;
    height: 64px;
    border: none;
    background: rgba(0,0,0,.18);
    color: white;
    font-size: 36px;
    cursor: pointer;
    transition: .25s;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-slider:hover .banner-nav {
    opacity: 1;
}

.banner-nav:hover {
    background: rgba(0,0,0,.45);
}

.banner-prev { left: 16px; }
.banner-next { right: 16px; }

/* Footer */
footer {
    background: var(--surface-color);
    padding: 40px 20px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 40px;
}

/* Detail Page */
.detail-header {
    display: flex;
    gap: 40px;
    background: var(--surface-color);
    padding: 40px;
    border-radius: var(--border-radius-lg);
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.detail-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.06;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(6px);
    transform: scale(1.06);
}

.detail-cover {
    width: 250px;
    aspect-ratio: 2/3;
    border-radius: var(--border-radius);
    z-index: 1;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.detail-info {
    z-index: 1;
    flex: 1;
}

.detail-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.detail-author {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.detail-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(0,0,0,0.2);
    border-radius: var(--border-radius);
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detail-genres {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.genre-tag {
    background: rgba(142, 45, 226, 0.2);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.detail-desc {
    margin-bottom: 30px;
    line-height: 1.8;
}

.detail-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* Chapter List */
.chapter-list {
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: var(--transition);
}

.chapter-item:hover {
    background: var(--surface-hover);
}

.chapter-item:last-child {
    border-bottom: none;
}

.chapter-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-free { background: var(--success); color: #fff; }
.badge-premium { background: var(--warning); color: #000; }

body.reader-page {
    padding-top: 0;
}

body.reader-page .reader-content {
    margin-top: var(--header-height);
}

/* Reader */
.reader-topbar {
    background: var(--surface-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.reader-title {
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none;
}
@media (min-width: 768px) {
    .reader-title { display: block; }
}

.reader-content {
    margin-top: var(--header-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #050505;
    min-height: 100vh;
}

.reader-image-placeholder {
    width: 100%;
    max-width: 800px;
    height: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: rgba(255,255,255,0.2);
    border-bottom: 1px solid #111;
}

.reader-premium-block {
    width: 100%;
    max-width: 800px;
    padding: 60px 20px;
    text-align: center;
    background: linear-gradient(to bottom, #000, var(--surface-color));
}

.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.scroll-top.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Genre Chips */
.genre-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.genre-chip {
    background: var(--surface-color);
    border: 1px solid rgba(142, 45, 226, 0.3);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: var(--transition);
    color: var(--text-main);
}

.genre-chip:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(142, 45, 226, 0.4);
}

/* Tabs & Ranking List */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    overflow-x: auto;
    white-space: nowrap;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 10px 20px;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--border-radius);
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}

.tab-btn.active {
    color: var(--primary-color);
    background: rgba(142, 45, 226, 0.1);
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ranking-row {
    display: flex;
    align-items: center;
    background: var(--surface-color);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    gap: 20px;
}

.ranking-row:hover {
    background: var(--surface-hover);
    transform: translateX(5px);
}

.ranking-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-muted);
    min-width: 40px;
}

.ranking-row:nth-child(1) .ranking-number { color: #ffb300; }
.ranking-row:nth-child(2) .ranking-number { color: #e0e0e0; }
.ranking-row:nth-child(3) .ranking-number { color: #ff7043; }

.ranking-cover {
    width: 60px;
    height: 80px;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
}

.ranking-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ranking-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.ranking-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 1200px) {
    .banner-slider {
        height: 420px;
    }
}

@media (max-width: 768px) {
    .nav-links, .search-bar { display: none; }
    
    .logo { font-size: 1.2rem; }
    
    .btn { padding: 6px 12px; font-size: 0.8rem; }
    
    .detail-header { flex-direction: column; padding: 20px; }
    .detail-cover { width: 100%; max-width: 300px; margin: 0 auto; }
    .detail-actions { flex-direction: column; }
    
    .banner-slider { 
        height: 260px;
        margin-bottom: 24px;
    }
    .banner-slide { padding: 20px 5%; }
    .featured-content h2 { font-size: 1.8rem; }
    
    .comic-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    
    .home-bottom-layout {
        grid-template-columns: 1fr;
    }
    
    .home-download-card {
        position: static;
        margin-top: 24px;
    }
    
    .ranking-row { padding: 10px; gap: 12px; }
    .ranking-cover { width: 50px; height: 70px; }
    .ranking-title { font-size: 0.95rem; }
    .ranking-stats { gap: 8px; font-size: 0.75rem; }
}

/* Image System */
.comic-cover-img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; border-radius: inherit; }
.detail-cover-img { width: 100%; height: 100%; object-fit: cover; object-position: center top; border-radius: inherit; display: block; }
.reader-page-img { width: 100%; height: auto; display: block; }
.image-fallback { display: flex; align-items: center; justify-content: center; background: #111; color: #666; font-size: 0.9rem; padding: 20px; text-align: center; width: 100%; }
