/* --- Global Styles & Variables --- */
:root, .theme-default {
    --background-color: #0D0D0D;
    --card-background: #1A1A1A;
    --header-background: rgba(13, 13, 13, 0.8);
    --primary-text: #E0E0E0;
    --secondary-text: #a0a0a0;
    --highlight-color: #A259FF;
    --cta-color: #00C896;
    --danger-color: #FF4C61;
    --border-color: #333;
    --hover-background: #2C2C2E;
    --plyr-color-main: var(--highlight-color);
}

.theme-light {
    --background-color: #F5F5F7;
    --card-background: #FFFFFF;
    --header-background: rgba(255, 255, 255, 0.8);
    --primary-text: #1D1D1F;
    --secondary-text: #6e6e73;
    --highlight-color: #007AFF;
    --cta-color: #34C759;
    --danger-color: #FF3B30;
    --border-color: #D1D1D6;
    --hover-background: #E5E5EA;
}

.theme-rose {
    --background-color: #2c1b22;
    --card-background: #3d2c35;
    --header-background: rgba(44, 27, 34, 0.8);
    --primary-text: #f5e6e8;
    --secondary-text: #d1b7c0;
    --highlight-color: #ff8fab;
    --cta-color: #f7b2dd;
    --danger-color: #f77f98;
    --border-color: #5c444b;
    --hover-background: #503942;
}

.theme-ocean {
    --background-color: #0c1d2e;
    --card-background: #182c40;
    --header-background: rgba(12, 29, 46, 0.8);
    --primary-text: #e0f2ff;
    --secondary-text: #a4c8e0;
    --highlight-color: #3498db;
    --cta-color: #5dade2;
    --danger-color: #e74c3c;
    --border-color: #2a4a69;
    --hover-background: #203a52;
}

.theme-forest {
    --background-color: #1a251e;
    --card-background: #28382c;
    --header-background: rgba(26, 37, 30, 0.8);
    --primary-text: #e8f5e9;
    --secondary-text: #b0c9b2;
    --highlight-color: #4caf50;
    --cta-color: #81c784;
    --danger-color: #f44336;
    --border-color: #3a523f;
    --hover-background: #344838;
}

.theme-crimson {
    --background-color: #241417;
    --card-background: #3b2025;
    --header-background: rgba(36, 20, 23, 0.8);
    --primary-text: #ffebee;
    --secondary-text: #f4c7c7;
    --highlight-color: #d32f2f;
    --cta-color: #ef5350;
    --danger-color: #e53935;
    --border-color: #613b40;
    --hover-background: #522d32;
}

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

body {
    background-color: var(--background-color);
    color: var(--primary-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; }
.content-wrapper { min-height: calc(100vh - 250px); }

.loader {
    border: 4px solid var(--secondary-text);
    border-top: 4px solid var(--highlight-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.material-symbols-outlined { font-size: inherit; vertical-align: middle; }

/* --- Flash Messages --- */
.flash-messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.alert-success { background-color: var(--cta-color); }
.alert-danger { background-color: var(--danger-color); }
.alert-info { background-color: var(--highlight-color); }
.alert-warning { background-color: #f39c12; }

/* --- Header --- */
.main-header {
    position: sticky; top: 0; left: 0; width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 3%; background-color: var(--header-background);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 1000; border-bottom: 1px solid var(--border-color);
}
.header-left { display: flex; align-items: center; gap: 2rem; }
.logo img { height: 40px; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { font-weight: 500; transition: color 0.2s ease; }
.nav-links a:hover, .nav-links a.active { color: var(--highlight-color); }

.header-right { display: flex; align-items: center; gap: 1rem; }
.search-container { position: relative; }
/* Mobile search toggle button */
.mobile-search-toggle {
    display: none; /* Hidden by default */
    background: none;
    border: none;
    color: var(--primary-text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.mobile-search-toggle:hover {
    background-color: var(--hover-background);
}

/* Mobile search modal */
.mobile-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20vh;
    z-index: 2000;
}

.mobile-search-modal.active {
    display: flex;
}

.mobile-search-content {
    background: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.close-search-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--primary-text);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
}

.close-search-modal:hover {
    background-color: var(--hover-background);
}

.mobile-search-bar {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary-text);
    padding: 1rem;
    width: 100%;
    font-size: 1.1rem;
    font-family: inherit;
}

.mobile-search-bar:focus {
    outline: none;
    border-color: var(--highlight-color);
}

#mobile-search-suggestions {
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.search-bar {
    background: var(--card-background); border: 1px solid var(--border-color);
    border-radius: 20px; color: var(--primary-text); padding: 0.5rem 1rem;
    width: 250px; transition: all 0.3s ease; font-family: inherit;
}
.search-bar:focus { outline: none; border-color: var(--highlight-color); width: 300px; }

/* Show mobile search toggle and hide desktop search on mobile */
@media (max-width: 768px) {
    .mobile-search-toggle {
        display: block;
    }
    
    .desktop-search {
        display: none;
    }
    
    .search-bar { width: 150px; }
    .search-bar:focus { width: 180px; }

    .details-genres {
        margin-bottom: 1.5rem;
    }
    .anime-category.episodes {
        margin-top: 1.5rem;
    }
}
#search-suggestions {
    position: absolute; top: 110%; right: 0; width: 350px;
    background: var(--card-background); border-radius: 8px; max-height: 400px;
    overflow-y: auto; display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.suggestion-item {
    display: flex; align-items: center; padding: 0.5rem;
    cursor: pointer; transition: background-color 0.2s;
}
.suggestion-item:hover { background-color: var(--hover-background); }
.suggestion-item img { width: 40px; height: 60px; object-fit: cover; border-radius: 4px; margin-right: 1rem; }
.suggestion-info h4 { font-size: 0.9rem; margin-bottom: 2px; }
.suggestion-info p { font-size: 0.8rem; color: var(--secondary-text); }

.profile-icon img { height: 35px; width: 35px; border-radius: 50%; cursor: pointer; }
.nav-link-login { font-weight: 500; transition: color 0.2s ease; }
.nav-link-login:hover { color: var(--highlight-color); }

/* --- Buttons --- */
.btn {
    padding: 0.7rem 1.2rem; border-radius: 8px; font-weight: 600;
    font-size: 0.9rem; cursor: pointer; transition: all 0.2s ease; border: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.btn-primary { background-color: var(--cta-color); color: #000; }
.btn-primary:hover { transform: scale(1.05); filter: brightness(1.1); }
.btn-secondary { background-color: var(--hover-background); color: var(--primary-text); }
.btn-secondary:hover { filter: brightness(1.2); }
.btn-secondary-outline { background-color: transparent; border: 1px solid var(--border-color); color: var(--primary-text); }
.btn-secondary-outline:hover { background-color: var(--hover-background); border-color: var(--hover-background); }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-danger-outline { background-color: transparent; border: 1px solid var(--danger-color); color: var(--danger-color); }
.btn-danger-outline:hover { background-color: var(--danger-color); color: white; }

/* --- Hero Spotlight Slider --- */
.spotlight-slider {
    position: relative; width: 100%; height: 75vh;
    overflow: hidden; 
}
.slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    overflow: hidden;
}

/* blurred background image */
.slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--bg);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    filter: blur(4px);
    transform: scale(1.05);
    z-index: 0;
}

.slide.active {
    opacity: 1;
}

/* gradient overlay */
.slide::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        var(--background-color) 0%,
        rgba(13,13,13,0.8) 15%,
        rgba(13,13,13,0.4) 30%,
        rgba(13,13,13,0) 50%
    );
    z-index: 1;
}

/* content stays sharp */
.slide-content {
    position: absolute;
    bottom: 15%;
    left: 5%;
    max-width: 50%;
    z-index: 2;
}

.slide-rank {
    background-color: var(--danger-color);
    color: var(--primary-text);
    padding: 0.2rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 1rem;
}

.slide-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.slide-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    color: var(--secondary-text);
    margin-bottom: 1rem;
}

.slide-meta .material-symbols-outlined {
    font-size: 8px;
}

.slide-description {
    font-size: 1rem;
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 2rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.slider-nav {
    position: absolute;
    bottom: 5%;
    right: 5%;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
    /* Define default colors using variables */
    --dot-color: rgba(255, 255, 255, 0.5);
    --active-dot-color: #FFFFFF;
}
.nav-dot {
    width: 10px;
    height: 10px;
    background-color: var(--dot-color); /* Use the variable */
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease, width 0.3s ease;
}
.nav-dot.active {
    background-color: var(--active-dot-color); /* Use the variable */
    width: 25px;
    border-radius: 5px;
}
/* --- Main Content & Carousels --- */
main { padding: 2rem 3%; }
.anime-category { margin-bottom: 3rem; }
.category-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.category-title { font-size: 1.8rem; font-weight: 700; }
.view-all { color: var(--secondary-text); font-weight: 500; }
.view-all:hover { color: var(--highlight-color); }
.anime-carousel { position: relative; }
.carousel-track {
    display: flex;
    gap: 1.25rem;
    padding-bottom: 1rem;
    /* Remove overflow-x and scrollbar hiding here */
}
.anime-card {
    flex: 0 0 14%; min-width: 180px; aspect-ratio: 2 / 3;
    background-color: var(--card-background); border-radius: 8px; overflow: hidden;
    position: relative; cursor: pointer; transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.anime-card:hover { transform: translateY(-8px); z-index: 20; box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.anime-card:hover .card-overlay { opacity: 1; }
.card-image { width: 100%; height: 100%; object-fit: cover; }
.card-overlay {
    position: absolute; bottom: 0; left: 0; width: 100%; padding: 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 100%);
    opacity: 0; transition: opacity 0.3s ease; display: flex; flex-direction: column;
    justify-content: flex-end; height: 100%; color: white;
}
.card-title { font-size: 1rem; font-weight: 600; line-height: 1.2; }
.card-meta { display: flex; gap: 0.5rem; font-size: 0.8rem; color: #ccc; align-items: center; margin-top: 0.5rem; }
.card-meta span { background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; }
.card-meta .sub, .card-meta .dub { font-weight: 500; }

/* --- Search & Details Pages --- */
.search-results-main, .details-page-main { padding-top: 1rem; }
.search-results-header h1 { font-size: 2rem; margin-bottom: 2rem; }
.search-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.25rem; }
.no-results { font-size: 1.2rem; color: var(--secondary-text); }
.details-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 60vh; background-size: cover; background-position: center; z-index: -1; }
.details-backdrop::after { content:''; position: absolute; inset: 0; background: linear-gradient(to top, var(--background-color) 0%, transparent 100%); }
.details-container {
    display: flex;
    flex-wrap: wrap; /* allow wrapping on smaller screens */
    gap: 2.5rem;
    margin-top: 2rem;
}

.details-poster {
    flex: 0 0 250px;
}

.details-info {
    flex: 1; /* fill remaining space */
    min-width: 200px; /* prevent collapsing too small */
}
.details-poster img { width: 100%; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.details-title { font-size: 2.8rem; font-weight: 700; }
.details-japanese-title { font-size: 1.1rem; color: var(--secondary-text); margin-bottom: 1rem; }
.details-meta { display: flex; align-items: center; gap: 0.5rem; color: var(--secondary-text); margin-bottom: 1.5rem; }
.details-meta .dot { font-size: 1rem; }
.details-actions { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.continue-watching-ep { color: var(--secondary-text); }
.details-description h3, .details-genres h3 { font-size: 1.2rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem;}
/* --- Description Section --- */
.details-description {
    position: relative;
    margin-bottom: 1.5rem;
}

/* Heading inside description */
.details-description h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Paragraph collapsed by default */
.details-description p {
    color: var(--secondary-text);
    line-height: 1.7;
    overflow: hidden;
    transition: height 0.4s ease;
    cursor: pointer;
    display: block;
}

/* Expanded paragraph */
.details-description p.expanded {
    max-height: 1000px; /* large enough for full content */
    overflow: visible;
    -webkit-line-clamp: unset; /* remove line clamp */
    display: block;
}

/* "Read more" button */
.read-more {
    display: block;
    color: var(--highlight-color);
    font-weight: 500;
    margin-top: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Desktop: hide the button and expand on hover */
@media (min-width: 769px) {

    .details-description:hover p {
        max-height: 1000px; /* fully expand on hover */
        -webkit-line-clamp: unset;
    }
}

/* Mobile: show "Read more" button and allow toggle */
@media (max-width: 768px) {
    .read-more {
        display: block;
        color: var(--highlight-color);
        font-weight: 500;
        margin-top: 0.5rem;
        cursor: pointer;
        font-size: 0.9rem;
    }

    /* Expanded state when clicking "Read more" */
    .details-description p.expanded {
        max-height: 1000px; /* smooth expand */
        -webkit-line-clamp: unset;
    }
}
.details-genres {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}
.genre-tag { background-color: var(--hover-background); padding: 5px 10px; border-radius: 15px; font-size: 0.85rem; }
.recommendations { margin-top: 4rem; }

/* --- Watch Page --- */
body.watch-page { background: var(--card-background); }
body.watch-page .main-header { position: sticky; }
.watch-container { display: grid; grid-template-columns: 1fr 400px; gap: 2rem; padding: 2rem 3%; max-width: 1920px; margin: 0 auto; }
.main-content { display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar { background-color: var(--background-color); border-radius: 8px; padding: 1.5rem; height: fit-content; }
.player-wrapper { position: relative; width: 100%; aspect-ratio: 16 / 9; background-color: #000; border-radius: 8px; overflow: hidden; }
.player-wrapper .plyr { width: 100%; height: 100%; }
.episode-info-bar, .anime-details-box { padding: 1.25rem; background-color: var(--background-color); border-radius: 8px; }
.episode-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
.anime-breadcrumb { color: var(--secondary-text); font-size: 0.9rem; }
.anime-breadcrumb a:hover { color: var(--highlight-color); }
.anime-details-box h3 { font-size: 1.2rem; margin-bottom: 0.75rem; }
.anime-details-box p { color: var(--secondary-text); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border-color); padding-bottom: 0.75rem; }
.sidebar h3 { font-size: 1.3rem; border: none; padding: 0; margin: 0; }
.stream-type-toggle .toggle-btn { background: transparent; border: 1px solid var(--secondary-text); color: var(--secondary-text); padding: 5px 12px; border-radius: 20px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.stream-type-toggle .toggle-btn.active { background: var(--highlight-color); color: var(--primary-text); border-color: var(--highlight-color); }
.episode-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 70vh; overflow-y: auto; padding-right: 10px; }
.episode-item { display: flex; gap: 1rem; padding: 0.75rem; border-radius: 8px; background-color: var(--hover-background); cursor: pointer; transition: background-color 0.2s ease; border-left: 4px solid transparent; align-items: center; }
.episode-item.hidden { display: none; }
.episode-item:hover { background-color: #3f3f41; }
.episode-item.active { background-color: color-mix(in srgb, var(--highlight-color) 20%, transparent); border-left-color: var(--highlight-color); }
.episode-number { font-size: 1rem; font-weight: 600; color: var(--secondary-text); width: 30px; text-align: center; }
.episode-number-robotica {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 1rem;
    flex-shrink: 0; /* Prevent shrinking */
}

.episode-number-robotica img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(5px) brightness(0.7);
    z-index: 1;
}

.episode-number-robotica span {
    position: relative;
    z-index: 2;
    font-family: 'Roboto Mono', monospace;
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);

    width: 100%;       /* Force same width */
    text-align: center; /* Center text */
    line-height: 48px;  /* Match container height */
}
.episode-number-robotica:hover { background-color: var(--highlight-color); }
.episode-details h4 { font-size: 0.95rem; font-weight: 500; margin-bottom: 4px; }
.episode-details p { font-size: 0.8rem; color: var(--secondary-text); }

/* --- Auth & Settings Pages --- */
.auth-page, .settings-page { display: flex; justify-content: center; padding: 4rem 1rem; }
.auth-container, .settings-container { width: 100%; max-width: 480px; }
.auth-container h2, .settings-page h1 { font-size: 2rem; text-align: center; margin-bottom: 0.5rem; }
.auth-container p { text-align: center; color: var(--secondary-text); margin-bottom: 2rem; }
.auth-form, .settings-card { background: var(--card-background); padding: 2rem; border-radius: 8px; border: 1px solid var(--border-color); }
.settings-container { max-width: 700px; display: flex; flex-direction: column; gap: 2rem; }
.settings-card h2 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.5rem; }
.form-group input, .form-group select { width: 100%; padding: 0.8rem 1rem; border-radius: 8px; border: 1px solid var(--border-color); background: var(--background-color); color: var(--primary-text); font-size: 1rem; }
.btn-full-width { width: 100%; padding: 1rem; }
.auth-switch { text-align: center; margin-top: 1.5rem; color: var(--secondary-text); }
.auth-switch a { color: var(--highlight-color); font-weight: 500; }
.danger-zone { border-color: var(--danger-color); }
.danger-actions { display: flex; gap: 1rem; justify-content: flex-end; }
.profile-info { display: flex; align-items: center; gap: 1.5rem; }
.profile-avatar { width: 120px; height: 120px; border-radius: 50%; }
.profile-details p { margin-bottom: 0.5rem; }

/* --- Footer --- */
.main-footer { margin-top: 3rem; padding: 2rem 5%; border-top: 1px solid var(--border-color); text-align: center; color: var(--secondary-text); }
.footer-logo img { height: 50px; opacity: 0.7; margin-bottom: 1rem; }
.footer-text { max-width: 600px; margin: 0 auto 1.5rem auto; line-height: 1.7; }
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1.5rem; }
.footer-links a:hover { color: var(--primary-text); }

/* --- Responsive Design --- */
@media (max-width: 1200px) { .watch-container { grid-template-columns: 1fr; } }
@media (max-width: 992px) { .nav-links { display: none; } .slide-content { max-width: 65%; } .slide-title { font-size: 2.5rem; } }
@media (max-width: 768px) {
    .header-right { gap: 0.5rem; }
    .search-bar { width: 150px; }
    .search-bar:focus { width: 180px; }
    #search-suggestions { width: 300px; }
    .spotlight-slider { height: 70vh; }
    .slide-content { max-width: 80%; }
    .slide-title { font-size: 2.2rem; }
    .slide-description { -webkit-line-clamp: 2; }
    .anime-card { flex: 0 0 22%; min-width: 160px; }
    .search-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .watch-container { padding: 1rem 5%; }
    .details-container { flex-direction: column; margin-top: 5vh; }
    .details-poster { width: 200px; margin: 0 auto; }
}
@media (max-width: 480px) {
    .main-header { padding: 0.75rem 5%; }
    .logo img { height: 30px; }
    .search-bar { position: fixed; top: -100px; }
    .header-right .btn, .nav-link-login { font-size: 0.8rem; padding: 0.5rem 0.8rem; }
    #search-suggestions { width: 90vw; left: 5vw; right: 5vw; top: 120%; }
    .spotlight-slider { height: 60vh; }
    .slide-content { max-width: 90%; left: 5%; bottom: 10%; }
    .slide-title { font-size: 1.8rem; }
    .slide-meta { font-size: 0.8rem; gap: 0.5rem; }
    .slide-description { display: none; }
    .btn { padding: 0.6rem 1rem; font-size: 0.9rem; }
    main { padding: 1.5rem 5%; }
    .category-title { font-size: 1.4rem; }
    .anime-card { flex: 0 0 45%; min-width: 150px; }
    .search-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .carousel-track { gap: 0.75rem; }
    .episode-title { font-size: 1.2rem; }
    .watch-container { grid-template-columns: 1fr; padding: 1rem 3%; }
    .details-title { font-size: 2rem; }
}

/* For iPhone X/11/12/13/14 (375px width) */
@media (max-width: 375px) {
    .anime-card { flex: 0 0 42%; min-width: 130px; }
    .search-grid { grid-template-columns: repeat(2, 1fr); }
    .header-right .btn, .nav-link-login { display: none; }
    .header-right .profile-icon { display: block; } /* Ensure profile icon is visible */
}

/* --- Custom Scrollbar for Anime Carousel --- */
.anime-carousel {
    overflow-x: auto;
    max-width: 100vw;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #888 #222; /* Firefox */
}

/* Chrome, Edge, Safari */
.anime-carousel::-webkit-scrollbar {
    height: 10px;
    background: #222;
    border-radius: 6px;
}
.anime-carousel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}
.anime-carousel::-webkit-scrollbar-track {
    background: #222;
    border-radius: 6px;
}
html {
    scrollbar-color: var(--secondary-text) var(--card-background); /* Firefox */
    scrollbar-width: thin; /* Unified Firefox thin style */
}

/* WebKit (Chrome/Safari/Edge) */
::-webkit-scrollbar {
    width: 6px;  /* Reduced from 10px */
    height: 6px; /* Reduced from 10px */
}

::-webkit-scrollbar-track {
    background: var(--card-background);
    border-radius: 3px; /* Smaller radius to match thin style */
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-text);
    border-radius: 3px; /* Smaller radius */
    border: 1px solid var(--card-background); /* Thinner border */
}

::-webkit-scrollbar-thumb:hover {
    background: var(--highlight-color);
    border-color: var(--hover-background);
}

/* Theme adjustments now inherit the thinner style */
.theme-light ::-webkit-scrollbar-thumb {
    border-color: var(--background-color);
}

.theme-rose ::-webkit-scrollbar-thumb {
    background: var(--highlight-color);
}

.theme-ocean ::-webkit-scrollbar-track {
    background: var(--header-background);
}

.episode-title-row {
  display: flex;
  align-items: center;
  gap: 18px;
}
.episode-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}
.like-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 1rem;
  cursor: pointer;
  margin: 0 0 0 8px;
  transition: background 0.2s;
}
.like-btn .material-icons {
  font-size: 1.3em;
  vertical-align: middle;
  transition: color 0.2s;
}
.like-btn.liked .material-icons {
  color: #e53935;
}
#like-count {
  font-size: 1em;
}
.custom-marker-range {
    border-radius: 2px;
    z-index: 2;
}
.skip-intro-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    padding: 8px 16px;
    background: #00bcd4;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    text-align: center;
    display: inline-block;
}

/* Make button smaller and less blocky on mobile */
@media (max-width: 480px) {
    .skip-intro-btn {
        padding: 5px 10px;
        font-size: 0.85em;
        border-radius: 6px;
        min-width: 0;
        min-height: 0;
        width: auto;
        height: auto;
        display: inline-block;
    }
}
.next-episode-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    flex-direction: column;
}
.next-episode-content {
    text-align: center;
}
.next-episode-content h3 {
    font-size: 2em;
    margin-bottom: 1em;
}
.next-episode-content button {
    margin: 0 10px;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    background: #A259FF;
    color: #fff;
    transition: background 0.2s;
}
.next-episode-content button#show-credits-btn {
    background: #333;
}
.next-episode-content button:hover {
    background: #00C896;
}
video::cue {
    display: none !important;
}

video::-webkit-media-text-track-container {
    display: none !important;
}
