    @keyframes grdientanimation {
        0% {
            background-position: 0% 50%;
        }

        50% {
            background-position: 100% 50%;
        }

        100% {
            background-position: 0% 50%;
        }
    }

    @font-face {
        font-family: 'AnimeAce';
        src: url('/fonts/animeace2_reg.ttf') format('truetype');
    }

    html {
        background-color: #020002;
        /* Fixes mobile overscroll white gap */
        height: 100%;
    }

    body {
        margin: 0;
        padding: 0;
        min-height: 100vh;
        background: linear-gradient(to bottom, rgba(52, 51, 52, 0.745), rgb(2, 0, 2));
        background-size: 400% 400%;
        background-attachment: fixed;
        /* Fixes scrolling issues */
        animation: grdientanimation 15s ease infinite;
        font-family: 'Poppins', sans-serif;
        color: white;
        overflow-x: hidden;
    }

    .container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2.05rem;

        width: 100%;
    }

    .main-content-wrapper {
        flex-grow: 1;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding-bottom: 2.05rem;
        gap: 2rem;
    }

    .nav {
        display: flex;
        width: 100%;
        background-color: rgba(52, 51, 52, 0.745);
    }

    .nav p {
        -webkit-text-stroke: 1px rgba(9, 9, 9, 0.923);
        text-shadow: 0 0 5px rgba(52, 51, 52, 0.745), 0 0 10px rgba(25, 0, 25, 0.745);
        font-family: 'AnimeAce', sans-serif;
        font-size: 2rem;
        letter-spacing: 2px;
        margin: 1rem;
    }

    .nav-name {
        flex: 1;
        margin-left: 2%;
    }

    .nav-menu {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: space-around;
    }

    .nav-menu ul {
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding: 0;
    }

    ul {
        list-style: none;
        display: flex;
        justify-content: space-around;
    }

    .nav-menu ul li a {
        color: white;
        text-decoration: none;
        font-size: 1.1rem;
        font-weight: 600;
        letter-spacing: 1px;
        padding: 0.5rem 0.8rem;
        transition:
            color 0.3s ease,
            text-shadow 0.3s ease,
            background-color 0.3s ease;
        border-radius: 4px;
        text-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
    }

    .nav-menu ul li a:hover {
        color: #fff;
        text-shadow:
            0 0 5px #fff,
            0 0 10px #ffffff,
            0 0 20px rgba(255, 255, 255, 0.8);
    }

    .nav-menu ul li a:active {
        transform: translateY(1px);
    }

    .nav-menu ul li {
        list-style: none;
    }

    .nav-menu ul li a {
        display: inline-block;
    }

    .nav-menu ul {
        gap: 3rem;
    }

    .content {
        display: flex;
        flex-wrap: wrap;
        gap: 3rem;
        justify-content: space-around;
        width: 90%;
        padding: 0 2rem;
        max-width: 1200px;
        position: static;
        overflow: visible;
    }

    .home-title {
        font-size: 3rem;
        position: relative;
        width: 95%;
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
        overflow: auto;
        padding-top: 5px;
        padding-bottom: 5px;
    }

    .home-title h1 {
        text-align: center;
        width: 100%;
        margin: 0;
    }


    .category-sidebar {
        width: 80%;
        padding: 1.5rem 0.5rem;
        background-color: #0d0d0d;
        border-right: 2px solid rgba(52, 51, 52, 0.745);
        min-height: 100%;
    }

    .sidebar-heading {
        font-size: 1.5rem;
        font-weight: 700;
        margin-bottom: 1.5rem;
        color: white;
        text-align: center;
    }

    .category-list {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }

    .category-list form {
        width: 100%;
    }

    .category-tab {
        all: unset;
        cursor: pointer;
        box-sizing: border-box;

        display: block;
        width: 100%;
        padding: 0.8rem 1.2rem;
        text-align: left;
        font-size: 1.1rem;
        font-weight: 500;
        letter-spacing: 1px;

        color: #e0e0e0;
        background-color: #1a1a1a;
        border: 1px solid #333;
        border-radius: 8px;

        transition: all 0.3s ease;
    }

    .category-tab.active-tab {
        color: white;
        font-weight: 600;
        background-color: #383838;
        border-color: #555;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    }

    .category-tab:hover {
        background-color: #2a2a2a;
        color: #fff;
        border-color: #e0e0e0;
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
        transform: translateX(4px);
    }

    .footer {
        width: 100%;
        background-color: #1c212a;
        color: #d4d4d4;
        padding: 3rem 0;
        margin-top: auto;
        border-top: 3px solid rgba(52, 51, 52, 0.745);
        position: relative;
        top: 24vh;

    }

    .footer-container {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 3rem;
    }

    .footer-section {
        display: flex;
        flex-direction: column;
    }

    .footer-heading {
        font-size: 1.2rem;
        font-weight: 700;
        margin-bottom: 1rem;
        color: white;
    }

    .footer-links {
        display: flex;
        flex-direction: column;
    }

    .footer-links a {
        color: #e0e0e0;
        text-decoration: none;
        margin-bottom: 0.7rem;
        transition: color 0.3s ease-in-out;
        font-size: 1rem;
        padding: 2px 0;
    }

    .footer-links a:hover {
        color: #fff;
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
        text-decoration: underline;
    }

    .footer-bottom {
        width: 100%;
        margin-top: 3rem;
        padding-top: 1.5rem;
        border-top: 1px solid #333940;
        text-align: center;
        font-size: 0.9rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
    }

    .social-icons {
        margin-top: 1.5rem;
        display: flex;
        gap: 1.8rem;
    }

    .social-icons a {
        font-size: 1.6rem;
        color: #e0e0e0;
        transition: color 0.3s;
    }

    .social-icons a:hover {
        color: #ff9800;
    }

    .getStarted {
        background-color: #0d0d0d;
        color: white;
        padding: 1rem 3rem;
        font-size: 1.15rem;
        font-weight: 600;

        border: 3px solid #000000;
        border-radius: 50px;
        cursor: pointer;
        text-transform: uppercase;
        letter-spacing: 2px;
        transition: all 0.4s ease-in-out;

        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    }

    .getStarted:hover {
        background-color: #1a1a1a;
        color: #fff;
        border-color: #ffffff;

        box-shadow:
            0 0 5px #cbc5cc,
            0 0 20px rgb(203, 197, 204),
            0 0 40px rgba(203, 197, 204, 0.7);

        transform: scale(1.05);
    }

    .getStarted:active {
        transform: scale(0.98);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
        border-color: #ffffff;
    }

    .content form {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 1rem;
        width: 100%;
        max-width: 900px;
        margin: 0 auto;
        background-color: rgba(0, 0, 0, 0.2);
        border-radius: 12px;
    }

    .content form input[type="text"] {
        flex-grow: 1;
        background-color: #1a1a1a;
        color: #e0e0e0;
        border: 2px solid #333;
        padding: 0.75rem 1rem;
        border-radius: 8px;
        font-size: 1rem;
        transition: all 0.3s ease;
    }

    .content form input[type="text"]:focus {
        outline: none;
        border-color: #000000;
        box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
    }

    .content form button[type="submit"] {
        background-color: #3e3e3e;
        color: white;
        font-size: 1.25rem;
        font-weight: bold;
        border: none;
        padding: 0.5rem 1rem;
        cursor: pointer;
        border-radius: 8px;
        transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    }

    .content form button[type="submit"]:hover {
        background-color: #363534;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
        transform: scale(1.05);
    }

    .content form button[type="submit"]:active {
        transform: scale(0.95);
    }

    .anime-card {
        position: relative;
        width: 200px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0.5rem;
        border-radius: 8px;
        background-color: rgba(0, 0, 0, 0.3);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
        transition: transform 0.3s ease;
        margin: 0 0 1.5rem 0;
    }

    .anime-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 6px 12px rgba(41, 41, 41, 0.4);
    }

    .anime-title {
        margin-top: 0.5rem;
        font-size: 0.95rem;
        font-weight: 500;
        line-height: 1.2;
        color: #e0e0e0;

        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        width: 100%;
    }

    .anime-title:hover {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        width: fit-content;
        position: absolute;
        z-index: 10;
        bottom: 0.5rem;

        background-color: #1a1a1a;
        border: 1px solid #000000;
        padding: 0.3rem 0.5rem;
        border-radius: 4px;
        box-shadow: 0 2px 5px rgba(34, 34, 34, 0.8);
    }

    .nav-menu {
        position: relative;
    }

    .menu-toggle-btn {
        display: none;
        font-size: 2rem;
        cursor: pointer;
        color: white;
        padding: 0 0.5rem;
    }

    .nav-menu ul {
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding: 0;
    }

    @media (max-width: 480px) {

        .footer {
            display: flex;
            flex-direction: column;
            justify-content: space-around;
        }

        .nav {
            flex-direction: column;
            align-items: center;
            padding-bottom: 0.5rem;
        }

        .nav p {
            margin: 0.5rem 0;
            font-size: 1.5rem;
        }

        .nav-menu {
            width: 100%;
            justify-content: center;
        }

        .nav-menu ul {
            gap: 0.75rem;
        }



        .category-list {
            gap: 0.5rem;
        }

        .category-tab {
            min-width: 100px;
            padding: 0.5rem 0.75rem;
            font-size: 0.9rem;
        }

        .content {
            padding: 0 0.5rem;
            gap: 1rem;
        }

        .anime-card {
            width: 140px;
        }
    }

    @media (max-width: 768px) {

        .menu-toggle-btn {
            display: block;
        }

        .footer {
            display: flex;
            flex-direction: column;
            justify-content: space-around;
        }

        .nav-menu ul {
            gap: 1rem;
            display: none;
            position: absolute;
            top: 100%;
            right: 1rem;

            width: 180px;
            flex-direction: column;
            background-color: #1c212a;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
            border-radius: 0 0 8px 8px;
            z-index: 999;
        }

        .nav-menu ul li {
            width: 100%;
            border-bottom: 1px solid #333;
        }

        .nav-menu ul li a {
            width: 100%;
            padding: 10px 15px;
            box-sizing: border-box;
            text-align: left;
        }

        .nav-menu ul.nav-open {
            display: flex;
        }

        .content {
            padding: 0 1.5rem;
            gap: 2rem;
        }

        .anime-card {
            width: 160px;
        }

        .home-title h1 {
            text-align: center;
        }
    }

    @media (min-width: 768px) and (max-width: 1200px) {

        .menu-toggle-btn {
            display: none;
        }

        .nav-menu ul {
            display: flex !important;
            position: static;
            flex-direction: row;
            width: auto;
            background: none;
            box-shadow: none;
            border-radius: 0;
            gap: 3rem;
        }

        .footer {
            display: flex;
            flex-direction: column;
            justify-content: space-around;
        }

        .home-title h1 {
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 2rem;
        }
    }


    /* ===============================
   ANIME DESCRIPTION PAGE
================================*/

    .anime-description-container {
        width: 90%;
        max-width: 1200px;
        margin: 2rem auto 4rem auto;
        padding: 1rem;
        display: flex;
        gap: 3rem;
        color: white;
    }

    .anime-description-poster img {
        width: 320px;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }

    .anime-description-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .anime-description-title {
        font-size: 3rem;
        font-weight: 700;
        letter-spacing: 1px;
        color: white;
    }

    .anime-description-meta {
        font-size: 1.1rem;
        line-height: 1.8rem;
        opacity: 0.9;
    }

    .anime-description-synopsis {
        font-size: 1.1rem;
        line-height: 1.6;
        opacity: 0.85;
        max-width: 90%;
    }

    /* RESPONSIVE */
    @media (max-width: 768px) {

        .anime-description-container {
            flex-direction: column;
            align-items: center;
            text-align: center;
            gap: 2rem;
        }

        .anime-description-poster img {
            width: 70%;
            max-width: 260px;
        }

        .anime-description-synopsis {
            max-width: 100%;
        }
    }

    @media (max-width: 480px) {
        .anime-description-title {
            font-size: 2rem;
        }

        .anime-description-meta {
            font-size: 1rem;
        }
    }

    /* =============================
   WATCH BUTTONS
==============================*/

    .watch-buttons {
        margin-top: 1.5rem;
        display: flex;
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .watch-btn {
        padding: 0.7rem 1.2rem;
        border-radius: 8px;
        color: white;
        text-decoration: none;
        font-weight: 600;
        transition: 0.3s;
    }

    .watch-btn:hover {
        transform: scale(1.05);
    }

    /* Colors */
    .crunchyroll {
        background-color: #f47521;
    }

    .netflix {
        background-color: #e50914;
    }

    .prime {
        background-color: #00a8e1;
    }

    /* =============================
   RELATED ANIME
==============================*/

    .related-title {
        font-size: 2rem;
        font-weight: 700;
        margin-top: 3rem;
        margin-bottom: 1rem;
        color: white;
        text-align: left;
        width: 100%;
        max-width: 85%;
        /* Match the carousel width constraint or container */
        border-left: 5px solid #555;
        /* Dark accent bar */
        padding-left: 1rem;
    }

    .carousel-wrapper {
        position: relative;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 1.5rem;
        /* Space between arrows and list */
        margin: 2rem 0;
    }

    .related-container {
        display: flex;
        gap: 1.5rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 1rem 0 2rem 0;
        /* adjust padding */
        width: 100%;
        max-width: 85%;
        /* Leave space for arrows on sides */
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;

        /* Mask/Fade effect for sides */
        -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
        mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    }

    /* Hide scrollbar for Chrome, Safari and Opera */
    .related-container::-webkit-scrollbar {
        display: none;
    }

    /* Hide scrollbar for IE, Edge and Firefox */
    .related-container {
        -ms-overflow-style: none;
        /* IE and Edge */
        scrollbar-width: none;
        /* Firefox */
    }

    .carousel-btn {
        position: relative;
        /* No longer absolute */
        top: auto;
        transform: none;
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(10px);
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        /* Slightly squarer for modern look, or keep 50% circle */
        width: 48px;
        height: 48px;
        flex-shrink: 0;
        /* Prevent buttons from shrinking */
        font-size: 1.2rem;
        cursor: pointer;
        z-index: 10;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        user-select: none;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    }

    .carousel-btn:hover {
        background: rgba(80, 80, 80, 0.6);
        border-color: rgba(255, 255, 255, 0.3);
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
        transform: scale(1.1);
    }

    .carousel-btn:active {
        transform: scale(0.95);
    }



    @media (max-width: 768px) {
        .related-container {
            width: 100%;
            padding: 1rem;
        }

        .carousel-wrapper {
            gap: 0.5rem;
            margin: 1rem 0;
        }
    }

    .related-card {
        flex: 0 0 auto;
        width: 150px;
        cursor: pointer;
        text-align: center;
        background: rgba(0, 0, 0, 0.3);
        padding: 0.6rem;
        border-radius: 8px;
        transition: 0.3s;
        scroll-snap-align: start;
    }

    .related-card:hover {
        transform: translateY(-6px);
    }

    .related-card img {
        width: 100%;
        border-radius: 6px;
    }

    .related-card p {
        margin-top: 0.5rem;
        font-size: 0.95rem;
    }

    /* =============================
       PAGINATION
    ==============================*/
    .pagination-container {
        display: flex;
        justify-content: center;
        gap: 2rem;
        margin-top: 2rem;
        width: 100%;
    }

    .pagination-btn {
        background-color: #0d0d0d;
        color: white;
        padding: 0.8rem 2rem;
        font-size: 1.1rem;
        font-weight: 600;
        text-decoration: none;
        border: 2px solid #333;
        border-radius: 50px;
        transition: all 0.3s ease;
    }

    .pagination-btn:hover {
        background-color: #333;
        border-color: #555;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
        transform: translateY(-2px);
    }

    /* ===============================
   CATEGORY PAGE REDESIGN
================================*/

    .category-page-header {
        width: 90%;
        max-width: 1200px;
        text-align: left;
        margin-top: 2rem;
        margin-bottom: 1.5rem;
    }

    .category-page-header h2 {
        font-size: 2.5rem;
        font-weight: 700;
        color: white;
        text-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
    }

    .category-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
        width: 90%;
        max-width: 1200px;
        margin-bottom: 4rem;
    }

    .category-form {
        display: block;
        width: 100%;
    }

    .category-card {
        all: unset;
        cursor: pointer;
        box-sizing: border-box;

        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;

        width: 100%;
        aspect-ratio: 16/9;
        /* Rectangular shape */
        padding: 1rem;

        background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;

        transition: all 0.3s ease;
        text-align: center;
    }

    .cat-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
    }

    .cat-name {
        font-size: 1.25rem;
        font-weight: 600;
        letter-spacing: 1px;
        color: #e0e0e0;
    }

    .category-card:hover {
        background: linear-gradient(135deg, rgba(80, 80, 80, 0.2), rgba(80, 80, 80, 0.1));
        border-color: rgba(255, 255, 255, 0.3);
        transform: translateY(-5px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 255, 255, 0.2);
    }

    .category-card:hover .cat-name {
        color: white;
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    }

    .trending-section {
        width: 90%;
        max-width: 1200px;
        margin-bottom: 3rem;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .section-title {
        font-size: 2rem;
        font-weight: 700;
        margin-bottom: 1rem;
        color: white;
        border-left: 5px solid #555;
        padding-left: 1rem;
    }

    /* User Icon */
    .user-icon {
        width: 35px;
        height: 35px;
        background-color: #333;
        color: white;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-weight: bold;
        font-size: 1.2rem;
        cursor: pointer;
        border: 2px solid rgba(255, 255, 255, 0.2);
        transition: transform 0.2s, background-color 0.2s;
        overflow: hidden;
        /* For SVG */
    }

    .guest-icon {
        background-color: transparent;
        border: 2px solid rgba(255, 255, 255, 0.5);
    }

    .user-icon:hover {
        background-color: #555;
        transform: scale(1.1);
    }

    /* Library Form on Description Page */
    .library-form {
        display: inline-flex;
        gap: 10px;
        /* margin-left: 15px; */
        align-items: center;
        vertical-align: middle;
        position: relative;
        /* Ensure z-index context */
    }

    .custom-select-wrapper {
        position: relative;
        user-select: none;
        width: 180px;
    }

    .custom-select-trigger {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 15px;
        font-size: 1rem;
        font-weight: 400;
        color: #fff;
        height: 2.6rem;
        cursor: pointer;
        background: #333;
        border-radius: 4px;
        transition: background 0.3s;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 5px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .custom-select-trigger:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .custom-options {
        position: absolute;
        display: block;
        top: 100%;
        left: 0;
        right: 0;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 5px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
        background: #1a1a1a;
        transition: all 0.3s ease;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        z-index: 100;
        margin-top: 5px;
        /* Slight gap */
    }

    .custom-select-wrapper.open .custom-options {
        opacity: 1;
        visibility: visible;
        pointer-events: all;
    }

    .custom-option {
        position: relative;
        display: block;
        padding: 10px;
        font-size: 0.95rem;
        font-weight: 400;
        color: white;
        cursor: pointer;
        transition: all 0.2s;
    }

    .custom-option:hover {
        background-color: #333;
    }

    .custom-option.selected {
        background-color: #444;
        font-weight: 600;
    }

    .arrow {
        position: relative;
        height: 10px;
        width: 10px;
    }

    .arrow::before,
    .arrow::after {
        content: "";
        position: absolute;
        bottom: 0px;
        width: 0.15rem;
        height: 100%;
        transition: all 0.2s;
    }

    .arrow::before {
        left: -3px;
        transform: rotate(-45deg);
        background-color: white;
    }

    .arrow::after {
        left: 3px;
        transform: rotate(45deg);
        background-color: white;
    }

    .custom-select-wrapper.open .arrow::before {
        left: -3px;
        transform: rotate(-135deg);
    }

    .custom-select-wrapper.open .arrow::after {
        left: 3px;
        transform: rotate(135deg);
    }

    .add-btn {
        padding: 10px 15px;
        background: #333;
        color: white;
        border: 2px solid #555;
        border-radius: 5px;
        cursor: pointer;
        font-weight: bold;
        font-size: 1.2rem;
        line-height: 1;
        transition: all 0.2s ease;
    }

    .add-btn:hover {
        background: #555;
        border-color: #fff;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }

    /* =============================
   AUTH PAGES
============================== */

    .auth-container {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 80vh;
        padding: 20px;
    }

    .auth-card {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        padding: 2rem;
        border-radius: 15px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        width: 100%;
        max-width: 400px;
        text-align: center;
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .auth-card h2 {
        margin-bottom: 2rem;
        font-size: 2rem;
    }

    .auth-error {
        background: rgba(229, 9, 20, 0.2);
        border: 1px solid rgba(229, 9, 20, 0.5);
        color: #ffcccc;
        padding: 12px;
        border-radius: 8px;
        margin-bottom: 1.5rem;
        text-align: center;
        font-size: 0.95rem;
        animation: fadeIn 0.3s ease;
    }

    .form-group {
        margin-bottom: 1.5rem;
        text-align: left;
    }

    .form-group label {
        display: block;
        margin-bottom: 0.5rem;
        color: #ccc;
    }

    .password-wrapper {
        position: relative;
    }

    .password-toggle {
        position: absolute;
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: #aaa;
        cursor: pointer;
        padding: 0;
        display: flex;
        align-items: center;
    }

    .password-toggle:hover {
        color: white;
    }

    .form-group input {
        width: 100%;
        padding: 10px;
        border-radius: 5px;
        border: 1px solid rgba(255, 255, 255, 0.3);
        background: rgba(0, 0, 0, 0.3);
        color: white;
        font-size: 1rem;
        box-sizing: border-box;
        /* Ensure padding doesn't overflow width */
    }

    .btn-auth {
        width: 100%;
        padding: 12px;
        background: #2a2a2a;
        color: #e0e0e0;
        border: 1px solid #444;
        border-radius: 5px;
        font-size: 1.1rem;
        cursor: pointer;
        transition: background 0.3s;
        margin-bottom: 1rem;
    }

    .btn-auth:hover {
        background: #333;
        border-color: #555;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    }

    .btn-google {
        background: #db4437;
        margin-bottom: 0px;
    }

    .btn-google:hover {
        background: #c53929;
    }

    .auth-link {
        display: block;
        margin-top: 1rem;
        color: #aaa;
        text-decoration: none;
    }

    .auth-link:hover {
        color: white;
        text-decoration: underline;
    }

    .divider {
        margin: 1.5rem 0;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        position: relative;
    }

    .divider span {
        position: absolute;
        top: -10px;
        left: 50%;
        transform: translateX(-50%);
        background: #1a1a1a;
        padding: 0 10px;
        color: #888;
        font-size: 0.9rem;
    }

    /* Auth Responsive */
    @media (max-width: 480px) {
        .auth-container {
            height: auto;
            min-height: 80vh;
            padding: 40px 20px;
        }

        .auth-card {
            padding: 1.5rem;
            max-width: 100%;
        }

        .auth-card h2 {
            font-size: 1.75rem;
        }

        .home-title h1 {
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 2rem;
            align-content: center;
            text-align: center;
        }
    }

    /* =============================
   PROFILE PAGE
============================== */

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

    .profile-header {
        display: flex;
        align-items: center;
        gap: 20px;
        margin-bottom: 40px;
        padding-bottom: 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .profile-avatar-large {
        width: 80px;
        height: 80px;
        background: #2a2a2a;
        border: 1px solid #444;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 2.5rem;
        font-weight: bold;
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
    }

    .profile-info h1 {
        margin: 0;
        font-size: 2.5rem;
    }

    .profile-info p {
        margin: 5px 0 0;
        color: #aaa;
    }

    .logout-btn {
        margin-left: auto;
        padding: 10px 20px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: white;
        text-decoration: none;
        border-radius: 5px;
        transition: all 0.3s;
    }

    .logout-btn:hover {
        background: rgba(255, 0, 0, 0.3);
        border-color: rgba(255, 0, 0, 0.5);
    }

    /* Tabs */
    .library-tabs {
        display: flex;
        gap: 15px;
        margin-bottom: 30px;
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 12px 24px;
        background: rgba(255, 255, 255, 0.05);
        border: none;
        border-radius: 30px;
        color: #aaa;
        cursor: pointer;
        font-size: 1rem;
        transition: all 0.3s;
    }

    .tab-btn.active,
    .tab-btn:hover {
        background: #333;
        color: white;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Grid */
    .library-grid {
        display: none;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 20px;
        animation: fadeIn 0.5s ease;
    }

    /* Fix grid blowout for high-res images */
    .library-grid a {
        min-width: 0;
    }

    /* ... existing active rule ... */
    .library-grid.active {
        display: grid;
    }

    /* ... keyframes ... */

    /* Card */
    .library-card {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 8px;
        overflow: hidden;
        position: relative;
        transition: transform 0.3s, box-shadow 0.3s;
        padding: 0.6rem;
        text-align: center;
        height: 100%;
        /* Ensure card fills grid cell height */
        display: flex;
        flex-direction: column;
    }

    /* ... hover ... */
    .library-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 6px 12px rgba(41, 41, 41, 0.4);
    }

    .library-card img {
        width: 100%;
        height: auto;
        aspect-ratio: 2/3;
        /* Enforce poster ratio */
        border-radius: 6px;
        object-fit: cover;
    }

    /* ... info ... */
    .library-info {
        padding: 0;
        margin-top: 0.5rem;
    }

    /* ... title ... */

    /* ... empty state ... */

    /* Library Card Wrapper */
    .library-card-wrapper {
        position: relative;
        height: 100%;
        transition: transform 0.3s;
    }

    .library-card-wrapper:hover {
        transform: translateY(-5px);
        z-index: 5;
    }

    .library-card-wrapper:hover .library-card {
        box-shadow: 0 6px 12px rgba(41, 41, 41, 0.4);
    }

    .remove-btn {
        position: absolute;
        top: -10px;
        right: -10px;
        background: rgba(255, 0, 0, 0.8);
        color: white;
        border: 2px solid #121212;
        border-radius: 50%;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        opacity: 0;
        transition: all 0.2s ease;
        z-index: 10;
        font-size: 1.2rem;
        padding-bottom: 2px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    }

    .remove-btn:hover {
        background: #ff0000;
        transform: scale(1.1);
    }

    .library-card-wrapper:hover .remove-btn {
        opacity: 1;
    }

    /* Custom Modal Styles */
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        backdrop-filter: blur(5px);
    }

    .modal-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .modal-box {
        background: #1a1a1a;
        padding: 30px;
        border-radius: 12px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
        text-align: center;
        max-width: 400px;
        width: 90%;
        border: 1px solid rgba(255, 255, 255, 0.1);
        transform: scale(0.9);
        transition: transform 0.3s ease;
    }

    .modal-overlay.show .modal-box {
        transform: scale(1);
    }

    .modal-box h3 {
        margin-top: 0;
        margin-bottom: 10px;
        color: white;
        font-size: 1.5rem;
    }

    .modal-box p {
        color: #aaa;
        margin-bottom: 25px;
    }

    .modal-actions {
        display: flex;
        justify-content: center;
        gap: 15px;
    }

    .modal-btn {
        padding: 10px 20px;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        font-size: 1rem;
        transition: all 0.2s;
    }

    .modal-btn.cancel {
        background: transparent;
        border: 1px solid #444;
        color: #ccc;
    }

    .modal-btn.cancel:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .modal-btn.remove {
        background: #e50914;
        /* Netflix Red-ish */
        color: white;
    }

    .modal-btn.remove:hover {
        background: #b20710;
        transform: translateY(-2px);
    }

    /* Profile Responsive */
    @media (max-width: 768px) {
        .profile-header {
            flex-direction: column;
            text-align: center;
            gap: 15px;
        }

        .logout-btn {
            margin-left: 0;
            margin-top: 10px;
        }

        /* Removed explicit 3-column override to allow auto-fill to handle it better */
    }

    @media (max-width: 480px) {
        .library-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
        }

        .library-tabs {
            gap: 10px;
            justify-content: center;
        }

        .tab-btn {
            padding: 8px 16px;
            font-size: 0.9rem;
            flex: 1 1 auto;
            /* Allow buttons to shrink/grow */
            text-align: center;
        }
    }