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

:root {
    --primary-color: #6a0dad;
    /* Purple */
    --secondary-color: #9b59b6;
    --bg-color: #121212;
    --card-bg: rgba(30, 30, 30, 0.7);
    --text-color: #e0e0e0;
    --text-muted: #aaaaaa;
    --accent-color: #ff0055;
    /* Hot pink/red for accents */
    --nav-bg: rgba(18, 18, 18, 0.6);
    --border-color: #333;
    --text-outline: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 -1px 0 #fff, 0 1px 0 #fff, -1px 0 0 #fff, 1px 0 0 #fff, 0 0 2px #fff;
}

html {
    background-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: transparent;
}

/* Toggleable white text outline (profile setting) */
body.text-outline-enabled,
body.text-outline-enabled * {
    text-shadow: var(--text-outline);
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
}
body.text-outline-enabled .hero-card h1,
body.text-outline-enabled .anime-title {
    background: none !important;
    background-clip: unset;
}
body.text-outline-enabled video::cue {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Poppins', sans-serif;
    color: #fff;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-color);
}

/* Global Header & Nav */
.global-header {
    background: var(--nav-bg);
    height: 60px; /* Thinner top bar */
    padding: 0 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    position: relative; /* Changed to relative for absolute positioning of logo */
    z-index: 1000;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
}

.navbar {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: flex-end; /* Push items to the right */
    align-items: center;
}

.logo {
    position: absolute;
    top: 0;
    left: 20px;
    z-index: 1001; /* Above header */
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05); /* Slight zoom on hover */
}

/* Base style for logo text if used, though we are using img now */
.logo a {
    display: block; /* Ensure anchor wraps image correctly */
}

.logo-img {
    height: 80px; /* ~50% of original 160px */
    width: auto;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Home sidebar: horizontal wrapping pills (direct <a> children, no <ul><li>) */
.category-list--pills {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 10px;
    align-items: center;
    align-content: flex-start;
    justify-content: flex-start;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: #fff;
}

/* Navbar search - icon only on non-discover pages, full form on discover */
.nav-search-wrap {
    flex-shrink: 0;
    align-self: center;
}
.navbar-search-icon-link {
    flex-shrink: 0;
}
.navbar-search-icon-link:hover img {
    opacity: 1 !important;
}
.navbar-search-form {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    background: rgba(42, 44, 48, 0.95);
    border: none;
    border-radius: 9999px;
    max-width: 200px;
    height: 36px;
    flex-shrink: 0;
    padding: 0 4px 0 18px;
}
.navbar-search-form .navbar-search-input,
.navbar-search-form .navbar-search-btn {
    height: 100%;
}
.navbar-search-form .navbar-search-input {
    width: auto;
}
.navbar-search-input {
    flex: 1 1 auto;
    min-width: 60px;
    padding: 0 10px 0 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    line-height: 1;
}
.navbar-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
.navbar-search-btn {
    flex-shrink: 0;
    padding: 0 14px 0 0;
    margin: 0;
    background: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}
.navbar-search-btn:hover {
    opacity: 1;
}
.mobile-search-form {
    max-width: none;
    height: 32px;
    padding: 0 4px 0 14px;
}

/* Buttons */
.btn-order,
.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white !important;
    padding: 0.7rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 15px rgba(106, 13, 173, 0.3);
}

.btn-order:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(106, 13, 173, 0.5);
}

.btn-login {
    color: var(--text-color) !important;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    font-weight: 500;
}

.btn-login:hover {
    background: var(--border-color);
    color: #fff !important;
}

.btn-register {
    background: var(--primary-color);
    color: white !important;
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    font-weight: 600;
}

.btn-register:hover {
    background: var(--secondary-color);
}

/* Main Content */
.content-wrapper {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    max-width: 1400px;
}

/* Cards */
.content-card,
.hero-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.hero-card h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #fff, #aaa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-tagline {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-control,
input[type="text"]:not(.navbar-search-input),
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 0.8rem;
    background: rgba(42, 42, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: #fff;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Footer */
.global-footer {
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-muted);
    text-align: center;
    padding: 0.75rem 2rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

/* Mobile Responsive */
.menu-toggle {
    display: none;
    cursor: pointer;
}

.menu-toggle .bar {
    width: 25px;
    height: 2px;
    background-color: #fff;
    margin: 5px 0;
}

.mobile-sub-bar {
    background: var(--nav-bg);
    padding: 0.6rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.mobile-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Authenticated mobile: action bar only; logo floats inside main (see .mobile-content-logo-float) */
.mobile-top-stack {
    display: none;
}

.mobile-content-logo-float {
    display: none;
}

@media (min-width: 769px) {
    .mobile-top-stack {
        display: none !important;
    }

    .mobile-content-logo-float {
        display: none !important;
    }

    /* Ensure logged-in desktop header nav is never affected by mobile-only hide rules */
    .user-authenticated .nav-links {
        display: flex !important;
        visibility: visible !important;
        pointer-events: auto !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        clip: auto !important;
    }
}

.mobile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-username {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

@media (max-width: 768px) {
    .logo {
        left: 50%;
        transform: translateX(-50%);
    }
    .logo:hover {
        transform: translateX(-50%) scale(1.05);
    }
    .logo-img {
        height: 36px;
        max-height: 36px;
    }

    .user-authenticated .mobile-top-stack {
        display: block;
        position: sticky;
        top: 0;
        z-index: 1000;
        background: var(--nav-bg);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .user-authenticated .mobile-sub-bar {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        width: 100%;
        padding: 0.55rem 0.75rem 0.55rem 1rem;
        border-bottom: 1px solid var(--border-color);
        box-sizing: border-box;
    }

    .user-authenticated .mobile-sub-bar .mobile-profile {
        flex: 1;
        min-width: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    /* Logged-in mobile: primary nav is the action bar only; hide duplicate ul.nav-links panel */
    .user-authenticated .nav-links {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
        position: absolute !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
    }

    body.user-authenticated .content-wrapper {
        position: relative;
    }

    body.user-authenticated .mobile-content-logo-float {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 8;
        margin: 0;
        padding: 0;
        background: none;
        border: none;
        box-shadow: none;
        line-height: 0;
        pointer-events: none;
    }

    body.user-authenticated .mobile-content-logo-link {
        pointer-events: auto;
        display: inline-block;
    }

    body.user-authenticated .mobile-content-logo-img {
        height: 34px;
        width: auto;
        max-width: min(240px, 62.4vw);
        display: block;
        filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.85));
    }

    .user-authenticated .global-header {
        height: 0;
        min-height: 0;
        padding: 0;
        border: none;
        box-shadow: none;
        overflow: visible;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .user-authenticated .global-header .navbar {
        min-height: 0;
        height: 0;
        padding: 0;
        overflow: visible;
        justify-content: flex-end;
    }

    .user-authenticated .global-header .logo {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--card-bg);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links.active {
        display: flex;
    }

    .hero-card h1 {
        font-size: 2rem;
    }
}

/* Account Sidebar */
.account-container {
    display: flex;
    gap: 2rem;
}

.account-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.account-sidebar .card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.account-sidebar a {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.account-sidebar a:hover,
.account-sidebar a.active-link {
    background: rgba(106, 13, 173, 0.1);
    color: var(--primary-color) !important;
}

.account-content {
    flex-grow: 1;
}

/* Utilities */
.bg-overlay {
    display: none;
    /* Removed background image overlay */
}
/* Home Page Layout */
.home-container {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    gap: 2rem;
    min-height: 80vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    height: calc(100vh - 100px);
    overflow-y: auto;
    /* user-themed-card handles background/border */
}

/* Category pills (home sidebar) */
.category-link {
    color: inherit;
}

.category-list--pills .category-link {
    flex: 0 0 auto;
    max-width: 100%;
    display: inline-block;
    padding: 8px 14px;
    border-radius: 9999px;
    --category-pill-accent: var(--user-primary, var(--primary-color));
    border: 1px solid color-mix(in srgb, var(--category-pill-accent) 45%, transparent);
    background: color-mix(in srgb, var(--category-pill-accent) 10%, transparent);
    color: var(--category-pill-accent) !important;
    -webkit-text-fill-color: var(--category-pill-accent) !important;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
    opacity: 1;
    box-shadow: none;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.category-list--pills .category-link:hover {
    background: color-mix(in srgb, var(--category-pill-accent) 18%, transparent);
    border-color: color-mix(in srgb, var(--category-pill-accent) 55%, transparent);
    box-shadow: 0 1px 6px color-mix(in srgb, var(--category-pill-accent) 25%, transparent);
    opacity: 1;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    width: 100%;
    min-width: 0;  /* Allow shrinking within flex to prevent overflow */
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    padding-left: 1rem;
    border-left: 4px solid var(--primary-color);
}

/* Library: expanded — top row: poster | tab buttons; full-width row: tab content (shell uses display:contents) */
.library-title-cell:not(.ost-expanded) .library-options-shell {
    display: none !important;
}
/* Solo expanded: outer grid becomes a flex column so the card can grow to viewport */
.library-anime-grid.library-grid--solo-expanded {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 260px);
}
.library-anime-grid.library-grid--solo-expanded > .library-title-cell.ost-expanded {
    flex: 1 1 auto;
    min-height: 0;
    align-self: stretch;
}
.library-anime-grid > .library-title-cell.ost-expanded {
    display: grid !important;
    grid-template-columns: var(--library-expanded-poster-w, 160px) minmax(0, 1fr);
    grid-template-rows: auto minmax(180px, 1fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
    box-sizing: border-box;
}
.library-anime-grid > .library-title-cell.ost-expanded > .library-options-shell {
    display: contents !important;
}
.library-anime-grid > .library-title-cell.ost-expanded > .library-thumb-col {
    grid-column: 1;
    grid-row: 1;
    width: var(--library-expanded-poster-w, 160px) !important;
    max-width: var(--library-expanded-poster-w, 160px) !important;
    min-width: 0;
    box-sizing: border-box;
}
.library-anime-grid > .library-title-cell.ost-expanded .library-options-head {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    align-self: start;
}
.library-anime-grid > .library-title-cell.ost-expanded .library-options-body {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}
.library-anime-grid > .library-title-cell.ost-expanded .library-options-tab-panes {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.library-anime-grid > .library-title-cell.ost-expanded > .library-thumb-col .anime-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    cursor: default;
}
.library-anime-grid > .library-title-cell.ost-expanded > .library-thumb-col .anime-card:hover {
    transform: none;
}
.library-anime-grid > .library-title-cell.ost-expanded > .library-thumb-col .anime-cover-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 2 / 3;
    max-height: none;
    margin-bottom: 0.5rem;
    box-sizing: border-box;
}
.library-anime-grid > .library-title-cell.ost-expanded > .library-thumb-col .anime-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.library-anime-grid > .library-title-cell.ost-expanded > .library-thumb-col .anime-card:hover .anime-cover {
    transform: none;
    filter: brightness(0.9);
}
.library-anime-grid > .library-title-cell.ost-expanded > .library-thumb-col .anime-cover-placeholder {
    font-size: 1.35rem;
}
.library-options-head {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.library-options-head-title {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}
.library-option-tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.library-option-tab-btn {
    flex: 1;
    min-width: 72px;
    padding: 8px 10px;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    color: #333;
    font-size: 0.9rem;
    font-family: inherit;
}
@media (max-width: 768px) {
    .library-anime-grid > .library-title-cell.ost-expanded {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(160px, 1fr);
    }
    .library-anime-grid > .library-title-cell.ost-expanded > .library-thumb-col {
        grid-column: 1;
        grid-row: 1;
        justify-self: center;
        max-width: 200px;
    }
    .library-anime-grid > .library-title-cell.ost-expanded .library-options-head {
        grid-column: 1;
        grid-row: 2;
    }
    .library-anime-grid > .library-title-cell.ost-expanded .library-options-body {
        grid-column: 1;
        grid-row: 3;
    }
}

/* Anime Grid - Adjusted for ~6 columns */
.anime-grid {
    display: grid;
    /* 150px * 6 = 900px, matches typical container width */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 1.5rem;
    min-width: 0;  /* Allow grid to shrink within flex parent */
}

/* Anime Card */
.anime-card {
    background: transparent;
    transition: transform 0.3s ease;
    cursor: pointer;
    width: 100%;
    min-width: 0;  /* Prevent grid blowout / overflow */
    overflow: hidden;
}

.anime-card:hover {
    transform: translateY(-5px);
}

.anime-cover-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 2/3; /* Standard poster ratio */
    width: 100%;
    max-width: 100%;
    background: #2a2a2a;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    margin-bottom: 0.8rem;
    display: block;
}

/* Playlist cover: 3 thumbnails stacked vertically, same size as title cover */
.playlist-cover-wrapper {
    display: block;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
}
.playlist-cover-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    box-sizing: border-box;
}
.playlist-cover-cell {
    overflow: hidden;
    background: #333;
    min-height: 0;
}
.playlist-cover-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    vertical-align: bottom;
}
.playlist-cover-empty {
    background: #2a2a2a;
}

/* Playlist overlay: ensure play button is centered */
.playlist-card .anime-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.anime-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    filter: brightness(0.9);
}

.anime-cover.anime-cover--yt-letterbox {
    object-fit: contain;
    object-position: center;
    background: #1a1a1a;
}

.anime-card:hover .anime-cover {
    transform: scale(1.05); /* Zoom effect */
    filter: brightness(1.1);
}

.anime-card:hover .anime-cover.anime-cover--yt-letterbox {
    transform: none;
}

.anime-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted);
    background: #333;
}

.anime-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.anime-card:hover .anime-overlay {
    opacity: 1;
}

/* Home (and any title card): entire poster submits play — not only the play icon */
.anime-cover-play-form {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    z-index: 3;
}
.anime-cover-play-hit {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
    display: block;
    text-align: center;
}
.anime-cover-play-hit:focus-visible {
    outline: 2px solid var(--user-primary, var(--primary-color));
    outline-offset: -2px;
}
.anime-cover-play-hit .anime-overlay {
    pointer-events: none;
}

.btn-play {
    font-size: 2rem;
    color: #fff;
    background: var(--primary-color);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(106, 13, 173, 0.6);
    transform: scale(0.8);
    transition: transform 0.2s ease;
}

.anime-card:hover .btn-play {
    transform: scale(1);
}

/* Library: options gear fills the circular hit target (inline styles had tiny centered icon) */
.library-title-cell .btn-play.library-options-btn {
    padding: 0;
    font-size: 1.9rem;
    line-height: 1;
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    cursor: pointer;
}

.anime-info {
    padding: 0 0.5rem;
}

.anime-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.anime-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Home library: title on poster (mobile only; desktop uses .anime-info below) */
.home-container .anime-cover-titlebar {
    display: none;
}

/* Mobile Responsiveness for Home */
@media (max-width: 768px) {
    .home-container {
        flex-direction: column;
        padding: 0.75rem 6px;
        gap: 0.75rem;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 1rem;
        margin-bottom: 1rem;
        display: none; /* Hide sidebar on mobile for now, or make it toggleable */
    }

    /* Exactly 3 columns, minimal gutter — library page uses .library-anime-grid, not affected */
    .home-container .anime-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
    }

    .home-container .section-title {
        font-size: 1.35rem;
        margin-bottom: 0.65rem;
        padding-left: 0.35rem;
    }

    .home-container .anime-card:hover {
        transform: none;
    }

    .home-container .anime-info {
        display: none !important;
    }

    .home-container .anime-cover-wrapper {
        margin-bottom: 0;
    }

    .home-container .anime-cover-titlebar {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 4;
        padding: 5px 6px;
        background: rgba(0, 0, 0, 0.78);
        color: #fff;
        font-size: 0.68rem;
        font-weight: 600;
        line-height: 1.2;
        pointer-events: none;
        text-align: left;
        border-radius: 0 0 8px 8px;
        box-sizing: border-box;
    }

    .home-container .anime-cover-wrapper .anime-overlay {
        z-index: 3;
    }
}

/* ── Fallback for browsers that do NOT support backdrop-filter ── */
@supports not (backdrop-filter: blur(1px)) {
    :root {
        --nav-bg: rgba(18, 18, 18, 0.92);
        --card-bg: rgba(30, 30, 30, 0.92);
    }
    .global-header {
        background: rgba(18, 18, 18, 0.95) !important;
    }
    .content-card,
    .hero-card {
        background: rgba(30, 30, 30, 0.92) !important;
    }
    .global-footer {
        background: rgba(10, 10, 10, 0.92) !important;
    }
}
