:root {
    --bg-main: #090a10;
    --bg-card: #121522;
    --bg-card-hover: #181d2f;
    --bg-glass: rgba(18, 21, 34, 0.75);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.4);
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --accent: #00e575; /* Webtoon Green */
    --accent-glow: rgba(0, 229, 117, 0.35);
    --secondary: #ec4899;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    --header-height: 70px;
    --bottom-nav-height: 65px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(0, 0, 0, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #94a3b8;
}

[data-theme="oled"] {
    --bg-main: #000000;
    --bg-card: #080808;
    --bg-card-hover: #101010;
    --bg-glass: rgba(0, 0, 0, 0.85);
    --border-glass: rgba(255, 255, 255, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #252b42;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Glassmorphic Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.brand-badge {
    background: linear-gradient(135deg, #00e575 0%, #6366f1 100%);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    box-shadow: 0 4px 12px var(--accent-glow);
}

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

.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
    background: var(--border-glass);
}

/* Search Bar */
.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 100px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-glass);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid var(--border-glass);
    z-index: 60;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 100%;
    align-items: center;
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    height: 100%;
    transition: all 0.2s ease;
}

.bottom-nav-link.active, .bottom-nav-link:hover {
    color: var(--accent);
}

/* Hero Carousel */
.hero-banner {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin: 10px auto 32px;
    max-width: 1380px;
    background: #0f121d;
    border: 1px solid var(--border-glass);
    min-height: 420px;
    display: flex;
    align-items: center;
}

.hero-bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.45;
    filter: blur(4px);
    transform: scale(1.08);
}

.hero-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #090a10 0%, rgba(9,10,16,0.9) 50%, rgba(9,10,16,0.3) 100%),
                linear-gradient(0deg, #090a10 0%, transparent 65%);
}

.hero-content {
    position: relative;
    z-index: 10;
    padding: 36px;
    max-width: 680px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(0, 229, 117, 0.15);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-title {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-synopsis {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent);
    color: #000000;
    font-weight: 700;
    font-size: 14px;
    border-radius: 100px;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px var(--accent-glow);
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
    filter: brightness(1.1);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-glass);
    font-weight: 600;
    font-size: 14px;
    border-radius: 100px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

/* Comic Grid */
.comic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 22px;
    margin-bottom: 40px;
}

.comic-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.comic-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: 0 16px 32px -10px rgba(0, 0, 0, 0.6), 0 0 15px var(--primary-glow);
}

.card-thumb-wrapper {
    position: relative;
    width: 100%;
    padding-top: 135%; /* 3:4 aspect ratio */
    overflow: hidden;
    background: #141724;
}

.card-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.comic-card:hover .card-thumb {
    transform: scale(1.06);
}

.card-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.card-rating {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: #fbbf24;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-info {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-dim);
}

.card-ch {
    color: var(--accent);
    font-weight: 600;
}

/* Daily Schedule Pills */
.schedule-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 24px;
    scrollbar-width: none;
}
.schedule-tabs::-webkit-scrollbar { display: none; }

.schedule-pill {
    padding: 8px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.schedule-pill.active, .schedule-pill:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 4px 14px var(--primary-glow);
}

/* Webtoon Continuous Vertical Reader Frame */
.reader-container {
    width: 100%;
    min-height: 100vh;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.reader-strip-wrapper {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #000000;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

.reader-page-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    margin: 0;
    padding: 0;
    border: none;
    vertical-align: middle;
}

/* Floating Reader HUD Overlays */
.reader-hud {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 90;
    background: rgba(10, 11, 16, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    border: 1px solid var(--border-glass);
}

.reader-hud-top {
    top: 0;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-top: none;
}

.reader-hud-bottom {
    bottom: 0;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom);
}

.reader-hud.hidden {
    pointer-events: none;
    opacity: 0;
}
.reader-hud-top.hidden { transform: translateY(-100%); }
.reader-hud-bottom.hidden { transform: translateY(100%); }

.progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: 100;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    width: 0%;
    transition: width 0.1s linear;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
    .comic-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }
    .hero-title {
        font-size: 26px;
    }
    .hero-banner {
        min-height: 340px;
        margin: 10px auto 20px;
    }
    .hero-content {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: calc(var(--bottom-nav-height) + 15px);
    }
    .nav-links {
        display: none;
    }
    .mobile-bottom-nav {
        display: block;
    }
    .search-wrapper {
        max-width: 100%;
    }
    .comic-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .card-title {
        font-size: 13px;
    }
    .card-body {
        padding: 10px;
    }
}
