html {
    scroll-behavior: smooth;
}
body {
    font-family: 'Inter', sans-serif;
    background-color: #1a1a1a;
    color: #f1f5f9;
    /* user-select: none;  Tinggalkan ini karena tidak memblokir scroll */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}
.theme-bg { background-color: #1a1a1a; }
/* [BARU] Darker BG untuk drawer */
.theme-bg-dark { background-color: #111; } 
.theme-text { color: #f0e68c; }
.card-bg { background-color: #2b2b2b; }
.nav-bg { background-color: #222222; }
.break-words { word-break: break-word; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #2b2b2b; }
::-webkit-scrollbar-thumb { background: #ffd700; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #ffc700; }

/* [MODIFIKASI] UI Kartu (Anime & Manga) */
.anime-grid-card {
    background-color: #2b2b2b;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #3f3f46;
}
.anime-grid-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 0 2px #ffd700;
}
.anime-grid-card-image-container {
    position: relative;
    aspect-ratio: 2 / 3;
    background-color: #333;
}
.anime-grid-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* [MODIFIKASI] Badge Episode Anime (kiri atas) */
.episode-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffd700;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: bold;
    backdrop-filter: blur(4px);
    max-width: calc(100% - 1.5rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* [BARU] Badge Tipe Manga (kanan atas) */
.manga-type-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(29, 78, 216, 0.8); /* Biru */
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: bold;
    backdrop-filter: blur(4px);
}
/* [BARU] Badge Warna Manga (kiri atas) */
.manga-color-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: bold;
    backdrop-filter: blur(4px);
}
.manga-color-badge.color {
    background-color: rgba(217, 119, 6, 0.8); /* Oranye */
}
.manga-color-badge.black {
    background-color: rgba(51, 65, 85, 0.8); /* Abu-abu */
}


.anime-grid-card-content {
    padding: 0.6rem;
    height: 3.75rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.anime-grid-card-title {
    font-weight: 600;
    color: #f1f5f9;
    font-size: 0.875rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    width: 100%;
    background-color: #000;
}
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
}
.episode-button.playing, .quality-btn.active {
    background-color: #ffd700;
    color: #1a1a1a;
    font-weight: bold;
}

.watched-episode {
    background-color: #3f3f46 !important;
    color: #a1a1aa !important;
}

/* [BARU] Watched Chapter (untuk manga) */
.watched-chapter {
    background-color: #374151 !important; /* lebih gelap */
    color: #9ca3af !important;
    border-color: #4b5563 !important;
}

/* Skeleton Loader Styles */
.skeleton {
    background-color: #333;
    border-radius: 0.5rem;
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}
/* Placeholder untuk konten di List Anime */
.content-placeholder {
    min-height: 50vh; /* Memberi tinggi minimum agar skeleton terlihat */
}

#search-input { padding-left: 2.75rem; }

/* Tombol Bookmark di Detail (di bawah poster) */
.bookmark-btn-container {
     display: flex;
     justify-content: center;
     margin-top: 1rem;
}
.bookmark-btn-detail { /* [MODIFIKASI] ganti ID ke class */
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: 1px solid #4b5563;
}
 .bookmark-btn-detail svg {
     width: 1.25rem;
     height: 1.25rem;
 }
.bookmark-btn-detail.bookmarked {
    background-color: #ffd700;
    color: #1a1a1a;
    border-color: #ffd700;
}
.bookmark-btn-detail:not(.bookmarked) {
    background-color: transparent;
    color: #d1d5db;
}
.bookmark-btn-detail:hover:not(.bookmarked) {
     background-color: rgba(255, 215, 0, 0.1);
     border-color: #ffd700;
     color: #ffd700;
}
 .bookmark-btn-detail:hover.bookmarked {
     background-color: #e6c300;
     border-color: #e6c300;
}

/* [FIX] Navigasi Kamus (All Anime) */
/* [FIX] Navigasi Kamus (All Anime) - Improved Mobile Support */
/* === [FIX PERBAIKAN LENGKAP] Navigasi Kamus (All Anime) - Mobile Friendly dengan Scroll === */
.kamus-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    right: 8px;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    padding: 12px 8px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid #374151;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    scrollbar-width: thin;
    scrollbar-color: #ffd700 #2b2b2b;
}

.kamus-nav::-webkit-scrollbar {
    width: 4px;
}

.kamus-nav::-webkit-scrollbar-track {
    background: #2b2b2b;
    border-radius: 2px;
}

.kamus-nav::-webkit-scrollbar-thumb {
    background: #ffd700;
    border-radius: 2px;
}

.kamus-nav::-webkit-scrollbar-thumb:hover {
    background: #ffc700;
}

.kamus-nav a {
    font-size: 0.875rem;
    font-weight: bold;
    color: #f1f5f9;
    padding: 8px 10px;
    text-decoration: none;
    text-align: center;
    min-width: 32px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kamus-nav a:hover {
    background-color: #ffd700;
    color: #1a1a1a;
    transform: scale(1.05);
}

/* === [FIX PERBAIKAN LENGKAP] Konten All Anime dengan scroll yang benar === */
#content-area.pr-10 {
    padding-right: 3.5rem !important;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    -webkit-overflow-scrolling: touch; /* Smooth scroll untuk iOS */
}

/* === [FIX PERBAIKAN LENGKAP] Perbaikan tampilan mobile untuk All Anime === */
@media (max-width: 768px) {
    .kamus-nav {
        right: 6px;
        padding: 10px 6px;
        max-height: 80vh;
    }
    
    .kamus-nav a {
        font-size: 0.8rem;
        padding: 6px 8px;
        min-width: 28px;
    }
    
    #content-area.pr-10 {
        padding-right: 3rem !important;
        max-height: calc(100vh - 160px);
    }
}

@media (max-width: 480px) {
    .kamus-nav {
        right: 4px;
        padding: 8px 4px;
        max-height: 75vh;
    }
    
    .kamus-nav a {
        font-size: 0.75rem;
        padding: 5px 6px;
        min-width: 24px;
    }
    
    #content-area.pr-10 {
        padding-right: 2.5rem !important;
        max-height: calc(100vh - 140px);
    }
}

/* === [FIX PERBAIKAN LENGKAP] Pastikan konten list bisa discroll dengan baik === */
#content-area {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar untuk content area */
#content-area::-webkit-scrollbar {
    width: 6px;
}

#content-area::-webkit-scrollbar-track {
    background: #2b2b2b;
}

#content-area::-webkit-scrollbar-thumb {
    background: #ffd700;
    border-radius: 3px;
}

#content-area::-webkit-scrollbar-thumb:hover {
    background: #ffc700;
}

/* Tab untuk Halaman List (Ongoing/Tamat/Genre) */
.tab-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    color: #a1a1aa;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    text-align: center;
}
.tab-btn.active {
    color: #ffd700;
    border-bottom-color: #ffd700;
}

/* Navigasi Bawah (6 tombol) */
.nav-btn { width: 16.666%; }
.nav-btn span { font-size: 0.65rem; }

/* Style untuk nomor episode */
.episode-number {
     min-width: 2.5rem;
     text-align: right;
     font-weight: bold;
     color: #a1a1aa;
     margin-right: 0.75rem;
}
.episode-title {
     flex: 1;
     min-width: 0;
     overflow: hidden;
     text-overflow: ellipsis;
     white-space: nowrap;
}
.episode-list-item {
     display: flex;
     align-items: center;
     justify-content: space-between;
     width: 100%;
}

/* [BARU] Style untuk Hamburger Drawer */
.drawer-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: #d1d5db;
    transition: all 0.2s ease;
}
.drawer-btn:hover {
    background-color: #374151; /* gray-700 */
    color: #fff;
}
.drawer-btn.active {
    background-color: #ffd700;
    color: #1a1a1a;
}
.drawer-btn.active svg {
    stroke: #1a1a1a;
}

/* [BARU] Style untuk Manga Reader */
#manga-reader-container {
    position: fixed;
    inset: 0;
    background-color: #111; /* Latar belakang reader */
    z-index: 100;
    overflow-y: auto;
}
#manga-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    /* Padding untuk memberi ruang bagi header/footer */
    padding-top: 80px; 
    padding-bottom: 80px;
}
#manga-image-container img {
    width: 100%;
    max-width: 800px; /* Lebar maks gambar */
    height: auto;
    display: block;
    background-color: #333; /* fallback jika gambar lambat load */
}

/* === PERBAIKAN BUG FLICKER/KEDUT === */
#manga-image-container img.loading {
    background-color: #333;
    min-height: 300px; /* fallback tinggi saat loading */
}

/* [MODIFIKASI] Styling Navigasi Bawah Manga Reader */
.manga-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #374151;
    color: #d1d5db;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    transition: all 0.2s ease;
    flex-grow: 1; /* Biar rata kiri/kanan */
    justify-content: center;
    max-width: 40%;
}
.manga-nav-btn:hover {
    background-color: #4b5563;
}
.manga-nav-btn:disabled {
    background-color: #1f2937;
    color: #4b5563;
    cursor: not-allowed;
}

/* [BARU] Tombol Refresh di tengah */
.manga-refresh-btn {
    background-color: #ffd700;
    color: #111;
    width: 56px; /* Ukuran bulat */
    height: 56px; /* Ukuran bulat */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
    transition: all 0.2s ease;
    flex-shrink: 0; /* Pastikan ukurannya tetap */
    
}
.manga-refresh-btn:hover {
    background-color: #e6c300;
    transform: scale(1.05);
}
.manga-refresh-btn svg {
    width: 28px;
    height: 28px;
    stroke-width: 3;
}
.manga-refresh-btn.rotating svg {
    animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* [BARU] Efek Sembunyi/Tampil Bar di Manga Reader */
#manga-reader-header.bars-hidden {
    transform: translateY(-100%);
}
#manga-reader-footer.bars-hidden {
    transform: translateY(100%);
}

/* [BARU] Tombol pagination */
.pagination-btn {
    background-color: #374151; /* gray-700 */
    color: #f1f5f9;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.pagination-btn:hover {
    background-color: #4b5563; /* gray-600 */
}
.pagination-btn:disabled {
    background-color: #1f2937; /* gray-800 */
    color: #4b5563; /* gray-600 */
    cursor: not-allowed;
}
.pagination-text {
    font-weight: 600;
    color: #9ca3af; /* gray-400 */
    padding: 0.5rem;
}

/* [BARU] Style untuk Auth Pages */
.auth-container {
    background-color: #2b2b2b;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.auth-label {
    display: block;
    color: #f1f5f9;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.auth-input {
    width: 100%;
    background-color: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.auth-input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.auth-button {
    width: 100%;
    background-color: #ffd700;
    color: #1a1a1a;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.auth-button:hover {
    background-color: #e6c300;
}

.auth-button-secondary {
    width: 100%;
    background-color: transparent;
    color: #ffd700;
    border: 1px solid #ffd700;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.auth-button-secondary:hover {
    background-color: rgba(255, 215, 0, 0.1);
}

.auth-button-danger {
    width: 100%;
    background-color: #dc2626;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.auth-button-danger:hover {
    background-color: #b91c1c;
}

.auth-checkbox {
    width: 1rem;
    height: 1rem;
    border-radius: 4px;
    border: 1px solid #4b5563;
    background-color: #374151;
    cursor: pointer;
}

.auth-checkbox:checked {
    background-color: #ffd700;
    border-color: #ffd700;
}

.auth-error-message {
    background-color: #7f1d1d;
    color: #fecaca;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    border: 1px solid #ef4444;
}

.auth-success-message {
    background-color: #14532d;
    color: #bbf7d0;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    border: 1px solid #22c55e;
}

/* [BARU] Perbaikan orientasi video fullscreen */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    width: 100%;
    background-color: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
}

/* [BARU] Force landscape untuk mobile fullscreen */
@media screen and (max-width: 768px) and (orientation: portrait) {
    .video-container:fullscreen {
        transform: rotate(90deg);
        transform-origin: center center;
        width: 100vh;
        height: 100vw;
        position: fixed;
        top: 50%;
        left: 50%;
        margin-top: -50vw;
        margin-left: -50vh;
    }
    
    .video-container:-webkit-full-screen {
        transform: rotate(90deg);
        transform-origin: center center;
        width: 100vh;
        height: 100vw;
        position: fixed;
        top: 50%;
        left: 50%;
        margin-top: -50vw;
        margin-left: -50vh;
    }
}

/* [BARU] Tombol putar landscape */
#rotate-screen-btn {
    transition: all 0.3s ease;
}

#rotate-screen-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

/* [BARU] Perbaikan untuk video container di fullscreen */
:-webkit-full-screen .video-container {
    width: 100% !important;
    height: 100% !important;
    padding-bottom: 0 !important;
}

:fullscreen .video-container {
    width: 100% !important;
    height: 100% !important;
    padding-bottom: 0 !important;
}