/*
Theme Name: helloAnime
Theme URI: https://example.com/helloanime
Author: 237Coders
Author URI: https://237coders.site
Description: Advanced anime streaming and info WordPress theme with Jikan API integration.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: helloanime
Tags: dark, anime, streaming, custom-menu, featured-images, custom-post-types
*/

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
    /* Dark theme (default) */
    --bg-base:        #0a0a0f;
    --bg-surface:     #12121a;
    --bg-success:     #0b791c;
    --bg-elevated:    #1a1a28;
    --accent-primary: #7c3aed;
    --accent-glow:    #a78bfa;
    --accent-cyan:    #06b6d4;
    --text-primary:   #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted:     #64748b;
    --text-dim:       #334155;
    --border:         #1e1e30;
    --danger:         #ef4444;
    --success:        #22c55e;
    --rating-gold:    #f59e0b;
    --overlay-bg:     rgba(10,10,15,0.88);

    /* RGB channel triplets — used for rgba(var(--*-rgb), alpha) */
    --accent-rgb:      124,58,237;
    --accent-glow-rgb: 167,139,250;
    --danger-rgb:      239,68,68;
    --success-rgb:     34,197,94;
    --accent-cyan-rgb: 6,182,212;

    --radius-sm:   6px;
    --radius-md:   12px;
    --radius-lg:   20px;
    --radius-pill: 999px;

    --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px rgba(var(--accent-rgb),0.3);

    --sidebar-width: 260px;
    --topbar-height: 56px;
    --bottombar-height: 64px;

    --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ── Default scheme — light mode (toggled by JS on <html>) ──── */
/* Accent vars override injected via PHP for dark scheme;         */
/* Fix: Ensure countdown numbers are visible in light theme */
[data-theme="light"] .ha-cd-num {
    color: #0f172a !important;
}
/* these are CSS fallbacks (standard purple family).              */
[data-theme="light"] {
    --bg-base:        #f0f4f8;
    --bg-surface:     #ffffff;
    --bg-success:     #16a34a;
    --bg-elevated:    #e8edf2;
    --accent-primary: #6d28d9;
    --accent-glow:    #5b21b6;
    --accent-cyan:    #0891b2;
    --text-primary:   #0f172a;
    --text-secondary: #334155;
    --text-muted:     #64748b;
    --text-dim:       #94a3b8;
    --border:         #d1d5db;
    --danger:         #dc2626;
    --success:        #16a34a;
    --rating-gold:    #d97706;
    --overlay-bg:     rgba(15,23,42,0.7);
    --shadow-card:    0 4px 24px rgba(0,0,0,0.08);
    --shadow-glow:    0 0 16px rgba(var(--accent-rgb),0.12);
    --accent-rgb:      109,40,217;
    --accent-glow-rgb: 91,33,182;
    --danger-rgb:      220,38,38;
    --success-rgb:     22,163,74;
}

/* ============================================================
   APPEARANCE PRESETS — body class overrides
   Applied via Settings → Appearance Presets
   ============================================================ */

/* ── Color Schemes ─────────────────────────────────────── */

/* AMOLED — true black, same purple accent */
body.ha-scheme-amoled {
    --bg-base:        #000000;
    --bg-surface:     #0a0a0a;
    --bg-elevated:    #111111;
    --accent-primary: #7c3aed;
    --accent-glow:    #a78bfa;
    --accent-cyan:    #06b6d4;
    --text-primary:   #f8f8f8;
    --text-secondary: #d0d0d8;
    --text-muted:     #5a5a6e;
    --text-dim:       #2e2e3a;
    --border:         #1c1c1c;
    --danger:         #ef4444;
    --success:        #22c55e;
    --rating-gold:    #f59e0b;
    --overlay-bg:     rgba(0,0,0,0.92);
    --shadow-card:    0 4px 24px rgba(0,0,0,0.7);
    --shadow-glow:    0 0 20px rgba(var(--accent-rgb),0.3);
    --accent-rgb:      124,58,237;
    --accent-glow-rgb: 167,139,250;
    --danger-rgb:      239,68,68;
    --success-rgb:     34,197,94;
    --accent-cyan-rgb: 6,182,212;
}

/* Slate — AniList-style blue-grey + blue accent */
body.ha-scheme-slate {
    --bg-base:        #0b1622;
    --bg-surface:     #162032;
    --bg-success:     #16a34a;
    --bg-elevated:    #1f2e42;
    --accent-primary: #3b82f6;
    --accent-glow:    #93c5fd;
    --accent-cyan:    #22d3ee;
    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted:     #5e8ba0;
    --text-dim:       #2d4a5e;
    --border:         #1e3048;
    --danger:         #f87171;
    --success:        #4ade80;
    --rating-gold:    #fbbf24;
    --overlay-bg:     rgba(11,22,34,0.88);
    --shadow-card:    0 4px 24px rgba(0,0,0,0.4);
    --shadow-glow:    0 0 20px rgba(var(--accent-rgb),0.3);
    --accent-rgb:      59,130,246;
    --accent-glow-rgb: 147,197,253;
    --danger-rgb:      248,113,113;
    --accent-cyan-rgb: 34,211,238;
}

/* Light — white/grey surfaces, darkened accents for contrast */
body.ha-scheme-light {
    --bg-base:        #f0f4f8;
    --bg-surface:     #ffffff;
    --bg-success:     #16a34a;
    --bg-elevated:    #e8edf2;
    --accent-primary: #6d28d9;
    --accent-glow:    #5b21b6;
    --accent-cyan:    #0891b2;
    --text-primary:   #111827;
    --text-secondary: #374151;
    --text-muted:     #6b7280;
    --text-dim:       #9ca3af;
    --border:         #d1d5db;
    --danger:         #dc2626;
    --success:        #16a34a;
    --rating-gold:    #d97706;
    --overlay-bg:     rgba(15,23,42,0.7);
    --shadow-card:    0 4px 24px rgba(0,0,0,0.1);
    --shadow-glow:    0 0 20px rgba(var(--accent-rgb),0.15);
    --accent-rgb:      109,40,217;
    --accent-glow-rgb: 91,33,182;
    --danger-rgb:      220,38,38;
    --accent-cyan-rgb: 8,145,178;
}
/* Light scheme logo switching */
body.ha-scheme-light .logo-for-dark  { display: none;  }
body.ha-scheme-light .logo-for-light { display: block; }
/* Light scheme ignores the dark/light toggle — body-level vars win */

/* ── AMOLED — light mode (user toggles light while on AMOLED scheme) ── */
[data-theme="light"] body.ha-scheme-amoled {
    --bg-base:        #f8f8f8;
    --bg-surface:     #ffffff;
    --bg-elevated:    #f0f0f0;
    --accent-primary: #6d28d9;
    --accent-glow:    #5b21b6;
    --accent-cyan:    #0891b2;
    --text-primary:   #0a0a0a;
    --text-secondary: #1a1a1a;
    --text-muted:     #555555;
    --text-dim:       #999999;
    --border:         #e0e0e0;
    --danger:         #dc2626;
    --success:        #16a34a;
    --rating-gold:    #d97706;
    --overlay-bg:     rgba(0,0,0,0.7);
    --shadow-card:    0 4px 24px rgba(0,0,0,0.07);
    --shadow-glow:    0 0 16px rgba(var(--accent-rgb),0.1);
    --accent-rgb:      109,40,217;
    --accent-glow-rgb: 91,33,182;
    --danger-rgb:      220,38,38;
    --accent-cyan-rgb: 8,145,178;
}
[data-theme="light"] body.ha-scheme-amoled .logo-for-dark  { display: none;  }
[data-theme="light"] body.ha-scheme-amoled .logo-for-light { display: block; }

/* ── Slate — light mode (blue-tinted light surfaces) ── */
[data-theme="light"] body.ha-scheme-slate {
    --bg-base:        #eff6ff;
    --bg-surface:     #ffffff;
    --bg-elevated:    #dbeafe;
    --accent-primary: #1d4ed8;
    --accent-glow:    #1e40af;
    --accent-cyan:    #0369a1;
    --text-primary:   #0f1a2e;
    --text-secondary: #1e3a5f;
    --text-muted:     #4a7090;
    --text-dim:       #93b5c8;
    --border:         #bfdbfe;
    --danger:         #dc2626;
    --success:        #16a34a;
    --rating-gold:    #d97706;
    --overlay-bg:     rgba(11,22,34,0.7);
    --shadow-card:    0 4px 24px rgba(0,0,0,0.07);
    --shadow-glow:    0 0 16px rgba(var(--accent-rgb),0.12);
    --accent-rgb:      29,78,216;
    --accent-glow-rgb: 30,64,175;
    --danger-rgb:      220,38,38;
    --accent-cyan-rgb: 3,105,161;
}
[data-theme="light"] body.ha-scheme-slate .logo-for-dark  { display: none;  }
[data-theme="light"] body.ha-scheme-slate .logo-for-light { display: block; }

/* ── Layout: Wide — topbar replaces sidebar on desktop ── */
@media (min-width: 768px) {
    body.ha-layout-wide .site-sidebar        { transform: translateX(-100%); pointer-events: none; }
    body.ha-layout-wide .site-main           { margin-left: 0; padding-top: 56px; }
    body.ha-layout-wide .mobile-topbar       { display: flex !important; }
    body.ha-layout-wide .mobile-bottom-nav   { display: none !important; }
    body.ha-layout-wide .site-footer         { margin-left: 0; }

    body.ha-layout-wide .topbar-nav          { display: flex; }
    /* Wide layout: logo is fixed-width, nav fills remaining space, actions stay right */
    body.ha-layout-wide .sidebar-logo.topbar-logo  { flex: 0 0 auto; justify-content: flex-start; min-width: 0; }
    /* Hide the mobile drawer toggle — no sidebar needed on desktop wide layout */
    body.ha-layout-wide #mobile-menu-btn     { display: none; }

    /* Desktop sidebar layout: keep sidebar + add a horizontal top bar */
    body:not(.ha-layout-wide) .mobile-topbar {
        display: flex !important;
        left: var(--sidebar-width);
        right: 0;
        top: 0;
        height: var(--topbar-height);
        border-bottom: 1px solid var(--border);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 260;
    }
    body:not(.ha-layout-wide) .site-main {
        padding-top: var(--topbar-height);
    }
    body:not(.ha-layout-wide) #mobile-menu-btn {
        display: none;
    }
    body:not(.ha-layout-wide) .sidebar-logo.topbar-logo {
        display: none;
    }
    body:not(.ha-layout-wide) .topbar-nav--default {
        display: none;
    }
    body:not(.ha-layout-wide) .topbar-nav--desktop {
        display: flex;
        flex: 1;
        padding-left: 14px;
    }
    body:not(.ha-layout-wide) .topbar-actions {
        gap: 10px;
    }
    body:not(.ha-layout-wide) .topbar-watchlist-btn,
    body:not(.ha-layout-wide) .topbar-auth {
        display: inline-flex;
    }
    body:not(.ha-layout-wide) #mobile-theme-toggle {
        display: none;
    }

    /* Wide layout keeps original nav but gets polished watchlist/auth controls */
    body.ha-layout-wide .topbar-watchlist-btn,
    body.ha-layout-wide .topbar-auth {
        display: inline-flex;
    }
    body.ha-layout-wide .topbar-nav--desktop {
        display: none;
    }
}

/* ── Layout: Compact — denser grid, smaller cards ──────── */
body.ha-layout-compact .anime-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}
body.ha-layout-compact .anime-grid-lg {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
body.ha-layout-compact .anime-card {
    font-size: 0.9em;
}
body.ha-layout-compact .card-info  { padding: 8px; }
body.ha-layout-compact .card-title { font-size: 0.82rem; }
body.ha-layout-compact .card-meta  { font-size: 0.7rem; gap: 5px; }

/* ── Card Style: Overlay — info slides up on hover ──────── */
/* Title inside overlay (hidden in default mode) */
.card-overlay-title { display: none; }

body.ha-cards-overlay .card-info        { display: none; }
body.ha-cards-overlay .card-overlay-title {
    display: block;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
body.ha-cards-overlay .card-overlay {
    background: linear-gradient(to top, rgba(5,5,15,0.97) 0%, rgba(5,5,15,0.55) 55%, transparent 100%);
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    gap: 0;
}

/* ── Card Style: Minimal — poster + tiny title only ──────── */
body.ha-cards-minimal .card-info  { padding: 5px 6px 7px; }
body.ha-cards-minimal .card-title {
    font-size: 0.76rem;
    font-weight: 600;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.ha-cards-minimal .card-meta    { display: none; }
body.ha-cards-minimal .card-overlay { display: none; }
body.ha-cards-minimal .card-badges  { display: none; }
body.ha-cards-minimal .anime-grid   { gap: 6px; }

/* ── Font Style: Modern (system-ui sans) ────────────────── */
body.ha-font-modern {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
body.ha-font-modern .section-title,
body.ha-font-modern .card-title,
body.ha-font-modern .ep-page-title,
body.ha-font-modern h1,
body.ha-font-modern h2,
body.ha-font-modern h3 {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.02em;
}

/* ── Font Style: Editorial (Playfair Display + Source Sans 3) */
body.ha-font-editorial .section-title,
body.ha-font-editorial .card-title,
body.ha-font-editorial .ep-page-title,
body.ha-font-editorial h1,
body.ha-font-editorial h2,
body.ha-font-editorial h3 {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    letter-spacing: 0.01em;
    text-transform: none;
}
body.ha-font-editorial {
    font-family: 'Source Sans 3', 'Source Sans Pro', system-ui, sans-serif;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
}

a {
    color: var(--accent-glow);
    text-decoration: none;
    transition: var(--transition);
}

a:hover { color: var(--text-primary); }

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol { list-style: none; }

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    transition: var(--transition);
}

input, textarea, select {
    font-family: inherit;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.15);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: clamp(1.75rem, 4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.5rem); }
h4 { font-size: 1.125rem; }

code, .mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
}

.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-accent { color: var(--accent-glow); }
.text-cyan   { color: var(--accent-cyan); }
.text-gold, span.stat-value.text-gold   { color: var(--rating-gold); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }



/* ============================================================
   LAYOUT
   ============================================================ */
.site-wrapper {
    min-height: 100vh;
}

.site-main {
    margin-left: var(--sidebar-width);
    min-width: 0;
    padding-bottom: 48px;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.2em;
    background: var(--accent-primary);
    border-radius: var(--radius-pill);
}

.view-all {
    font-size: 0.85rem;
    color: var(--accent-glow);
    font-weight: 500;
}

.view-all:hover { color: var(--text-primary); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-glow);
    color: #fff;
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-surface);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    backdrop-filter: blur(4px);
}

.btn-ghost:hover {
    background: rgba(var(--accent-glow-rgb),0.12);
    border-color: var(--accent-glow);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm { padding: 1px 10px; font-size: 0.8rem; }
.btn-pill { border-radius: var(--radius-pill); border: 1px solid var(--accent-primary)}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-icon:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

/* ============================================================
   BADGES & PILLS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

.badge-type {
    background: linear-gradient(135deg, var(--accent-primary), #6d28d9);
    color: #fff;
    min-width: 52px;
    display: flex;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(124,58,237,0.35);
}
.badge-score   { background: var(--rating-gold); color: #000; padding: 3px 10px; box-shadow: 0 2px 8px rgba(234,179,8,0.3); }
.badge-airing  { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; padding: 3px 9px; box-shadow: 0 2px 8px rgba(34,197,94,0.3); }
.badge-filler  { background: rgba(156,163,175,0.15); color: #9ca3af; border: 1px solid rgba(156,163,175,0.25); }
.badge-recap   { background: rgba(34,211,238,0.15); color: #22d3ee; border: 1px solid rgba(34,211,238,0.25); }
.badge-new     { background: linear-gradient(135deg, var(--danger), #dc2626); color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,0.3); }
.badge.badge-finished {
    background: rgba(124,58,237,0.1);
    border: 1px solid rgba(124,58,237,0.3);
    color: var(--accent-primary);
    padding: 3px 9px;
}
.status-dot.finished{
    margin-right: 2px;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.airing   { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.finished { background: var(--text-muted); }
.status-dot.upcoming { background: var(--accent-cyan); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

/* ============================================================
   ANIME CARD
   ============================================================ */

.anime-card-link {
    display: flex;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.anime-card-link:hover .anime-card {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    border-color: var(--accent-primary);
}

.anime-card {
    position: relative;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

.anime-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    border-color: var(--accent-primary);
}

.card-poster {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: var(--bg-elevated);
}

.card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.anime-card:hover .card-poster img {
    transform: scale(1.05);
}

.anime-card-link:hover .card-poster img {
    transform: scale(1.05);
}

.card-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10,10,15,0.92) 0%, rgba(10,10,15,0.4) 60%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
    opacity: 0;
    transition: var(--transition);
}

.anime-card:hover .card-overlay {
    opacity: 1;
}

.overlay-actions {
    display: flex;
    gap: 6px;
}

/* Override btn-ghost colours when inside a dark card overlay */
.card-overlay .btn-ghost {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
}

.card-overlay .btn-ghost:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.6);
    color: #fff;
}

/* Inside scroll-row cards (narrow, 160px) — stack buttons vertically */
.scroll-row .card-overlay {
    padding: 8px 10px;
}

.scroll-row .overlay-actions {
    flex-direction: column;
    gap: 5px;
}

.scroll-row .overlay-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 5px 8px;
    font-size: 0.75rem;
}

/* =================================================================
   Anime Card — Status ribbon badge (top-right of poster)
================================================================= */

/* Revert the status-dot override from before — keep dots as-is */
.anime-card .card-info .card-meta .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: var(--text-muted);
    box-shadow: none;
}
.anime-card .card-info .card-meta .status-dot.airing   { background: var(--success); box-shadow: 0 0 6px var(--success); }
.anime-card .card-info .card-meta .status-dot.upcoming { background: var(--accent-cyan); }
.anime-card .card-info .card-meta .status-dot::after   { display: none; }

/* Ribbon container — anchored to .card-poster */
.card-poster {
    position: relative; /* already set globally, just confirming */
}

.card-status-ribbon {
    position: absolute;
    top: 10px;
    right: -1px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 10px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border-radius: 3px 0 0 3px;
    line-height: 1;
    white-space: nowrap;
    /* Folded-edge shadow */
    filter: drop-shadow(-1px 2px 3px rgba(0,0,0,0.35));
}

/* The folded corner tab at the bottom-right */
.card-status-ribbon::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
}

/* ── Completed ── */
.card-status-ribbon--finished {
    background: #f71303;
    color: #f1f5f9;
}
.card-status-ribbon--finished::after {
    border-width: 5px 5px 0 0;
    border-color: #f71303 transparent transparent transparent;
}

/* ── Airing ── */
.card-status-ribbon--airing {
    background: var(--success);
    color: #fff;
}
.card-status-ribbon--airing::after {
    border-width: 5px 5px 0 0;
    border-color: #14532d transparent transparent transparent;
}

/* Pulse dot inside airing ribbon */
.card-status-ribbon--airing .ribbon-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    animation: ribbon-pulse 1.6s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes ribbon-pulse {
    0%, 100% { opacity: 1;   transform: scale(1);    }
    50%       { opacity: 0.4; transform: scale(0.7);  }
}

/* ── Upcoming ── */
.card-status-ribbon--upcoming {
    background: var(--accent-cyan);
    color: #fff;
}
.card-status-ribbon--upcoming::after {
    border-width: 5px 5px 0 0;
    border-color: #0e4f5c transparent transparent transparent;
}

/* Light theme — slightly richer finished tone */
[data-theme="light"] .card-status-ribbon--finished {
    background: #ec0808;
    color: #fff;
}
[data-theme="light"] .card-status-ribbon--finished::after {
    border-color: #ec0808 transparent transparent transparent;
}

/* Browse / grid cards — side-by-side, no wrap */
#browse-grid .overlay-actions,
.anime-grid .card-overlay .overlay-actions,
.anime-grid-lg .card-overlay .overlay-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
}

#browse-grid .overlay-actions .btn,
.anime-grid .card-overlay .overlay-actions .btn,
.anime-grid-lg .card-overlay .overlay-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 5px 6px;
    font-size: 0.78rem;
    white-space: nowrap;
    min-width: 0;
}

/* ── Anime card hover popup (desktop only, rendered via JS) ── */
.anime-card-popup {
    position: fixed;
    z-index: 600;
    width: 270px;
    background: var(--bg-elevated);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 8px 48px rgba(0,0,0,0.65), 0 0 0 1px rgba(var(--accent-rgb),0.2), var(--shadow-glow);
    pointer-events: none;
    opacity: 0;
    transform: translateX(-6px) scale(0.97);
    transition: opacity 0.16s ease, transform 0.16s ease;
    will-change: opacity, transform;
}

.anime-card-popup.visible {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}

.popup-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popup-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.popup-synopsis {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 14px;
}

.popup-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.card-info {
    padding: 12px;
}

.card-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.card-rank {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    color: var(--rating-gold);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--rating-gold);
}

/* ============================================================
   ANIME GRID
   ============================================================ */
.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.anime-grid-lg {
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 18px;
}

/* Compact grid for Related / Sidebar sections (6 items, small cards) */
.anime-grid-related {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

/* ── Seasons & Relations section ── */
.relations-section {
    margin-top: 48px;
}

.relations-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.relation-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(50% - 6px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, background 0.15s;
}

.relation-card:hover {
    border-color: var(--accent);
    background: var(--bg-elevated, var(--bg-surface));
}

.relation-card-img {
    width: 48px;
    height: 68px;
    object-fit: cover;
    border-radius: calc(var(--radius) - 2px);
    flex-shrink: 0;
}

.relation-card-placeholder {
    background: var(--border);
}

.relation-card-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.relation-type {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
}

.relation-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.relation-ext-badge {
    font-size: 0.68rem;
    color: var(--text-dim);
    font-style: italic;
}

.relation-card--external .relation-type {
    color: var(--text-muted);
}

/* ============================================================
   HORIZONTAL SCROLL ROW
   ============================================================ */
.scroll-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.scroll-row::-webkit-scrollbar {
    height: 4px;
}

.scroll-row::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-row::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-pill);
}

.scroll-row .anime-card {
    flex: 0 0 160px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.scroll-row .card-poster {
    flex-shrink: 0;
}

.scroll-row .card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
}

.scroll-row .card-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.scroll-row .card-meta {
    margin-top: auto;
    font-size: 0.72rem;
}

/* ============================================================
   SKELETON LOADERS
   ============================================================ */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 0.8; }
}

.skeleton {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.skeleton-poster {
    aspect-ratio: 2/3;
    background: var(--bg-elevated);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-info { padding: 12px; }

.skeleton-line {
    height: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    margin-bottom: 8px;
}

.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }

/* ============================================================
   HERO BANNER
   ============================================================ */
.hero-banner {
    position: relative;
    height: 520px;
    overflow: hidden;
    background: var(--bg-surface);
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.hero-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    filter: blur(22px);
    transform: scale(1.12);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    /* Left-to-right dark band keeps text readable without killing image colour */
    background:
        linear-gradient(to right,  rgba(8,8,14,0.88) 0%,  rgba(8,8,14,0.55) 45%, transparent 75%),
        linear-gradient(to top,    rgba(8,8,14,0.80) 0%,  transparent 45%),
        linear-gradient(to bottom, rgba(8,8,14,0.35) 0%,  transparent 30%);
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 40px;
    padding: 40px 48px;
}

.hero-poster {
    flex: 0 0 180px;
    aspect-ratio: 2/3;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 12px 56px rgba(0,0,0,0.7), 0 0 0 2px rgba(var(--accent-glow-rgb),0.3);
    border: 2px solid rgba(var(--accent-glow-rgb),0.25);
}

.hero-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-info { flex: 1; min-width: 0; }

.hero-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.hero-genre-tag {
    background: rgba(var(--accent-rgb),0.2);
    border: 1px solid var(--accent-primary);
    color: white;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
}

.hero-title {
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 8px;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}

.hero-score {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--rating-gold);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.hero-synopsis {
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 540px;
    margin-bottom: 24px;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-indicators {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}

.hero-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    padding: 0;
}

.hero-dot.active {
    width: 24px;
    background: var(--accent-primary);
}

.hero-arrows {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 3;
    pointer-events: none;
}

.hero-arrow {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    font-size: 1.2rem;
}

.hero-arrow:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* ============================================================
   NAVIGATION (SIDEBAR)
   ============================================================ */
.site-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 300;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    padding-bottom: 8px;
}
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Sidebar header (logo + close btn) ─────────────────── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-close-btn {
    display: none; /* shown in mobile via mobile.css */
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
    line-height: 0;
}
.sidebar-close-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }

/* ── Logo ──────────────────────────────────────────────── */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}

.site-logo-img {
    height: 36px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

/* Dual-logo switching */
.logo-for-dark  { display: block; }
.logo-for-light { display: none;  }

[data-theme="light"] .logo-for-dark  { display: none;  }
[data-theme="light"] .logo-for-light { display: block; }

/* Hide fallback text when both logos are present */
.site-logo-img ~ .logo-text-fallback { display: none; }

.logo-icon-wrap {
    width: 34px;
    height: 34px;
    background: var(--accent-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
}
.sidebar-logo.topbar-logo .logo-icon-wrap {
    width: 28px;
    height: 28px;
}

.logo-favicon {
    border-radius: 4px;
    object-fit: contain;
}

.logo-svg-icon { color: #fff; }

.logo-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.logo-text .logo-accent {
    color: var(--accent-primary);
    font-style: normal;
}

/* ── Nav sections ──────────────────────────────────────── */
.sidebar-nav-wrap { padding: 12px 0 4px; }

.sidebar-nav { display: block; }

.nav-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    padding: 10px 18px 4px;
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 18px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: var(--transition);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-link svg { flex-shrink: 0; }

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
    border-left-color: var(--accent-glow);
}

.nav-link.active {
    color: var(--accent-glow);
    background: rgba(var(--accent-rgb),0.12);
    border-left-color: var(--accent-primary);
}

.sidebar-genres .nav-link {
    font-size: 0.82rem;
    padding: 7px 18px;
}

/* ── Search button in sidebar ──────────────────────────── */
.sidebar-search {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-search-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: var(--transition);
    text-align: left;
}
.sidebar-search-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--accent-primary);
    outline: none;
}
.sidebar-search-btn svg { flex-shrink: 0; }

/* ── Trending ──────────────────────────────────────────── */
.sidebar-trending {
    padding: 14px 14px 10px;
    border-top: 1px solid var(--border);
}

.trending-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 10px;
}

/* ── Sidebar footer row (theme toggle) ─────────────────── */
.sidebar-footer-row {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.theme-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}
.theme-toggle-btn:hover { color: var(--text-primary); }
.theme-toggle-btn svg { flex-shrink: 0; }

/* show/hide icon per theme */
.icon-for-light { display: none; }
[data-theme="light"] .icon-for-dark  { display: none; }
[data-theme="light"] .icon-for-light { display: flex; }

/* ── Drawer overlay (mobile backdrop) ──────────────────── */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 290;
    backdrop-filter: blur(2px);
    cursor: pointer;
}
.drawer-overlay.active { display: block; }

/* ─ Trending items ─────────────────────────────────────── */
.trending-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.trending-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}

.trending-item:last-child { border-bottom: none; }

.trending-rank {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 700;
    width: 16px;
    flex-shrink: 0;
}

.trending-poster {
    width: 36px;
    height: 48px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.trending-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trending-info { min-width: 0; }

.trending-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trending-views {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ============================================================
   MOBILE NAV
   ============================================================ */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    align-items: center;
    /* logo | nav (flex:1) | actions */
    justify-content: flex-start;
    padding: 0 12px;
    z-index: 200;
    gap: 0;
}

.topbar-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
    line-height: 0;
    padding: 0;
    flex-shrink: 0;
}
.topbar-icon-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }

.topbar-actions { display: flex; gap: 4px; align-items: center; margin-left: auto; flex-shrink: 0; }

.topbar-watchlist-btn,
.topbar-auth {
    display: none;
}

.topbar-watchlist-btn {
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.topbar-watchlist-btn:hover,
.topbar-watchlist-btn.active {
    color: var(--text-primary);
    border-color: rgba(var(--accent-rgb), 0.5);
    background: rgba(var(--accent-rgb), 0.12);
}

.topbar-auth {
    align-items: center;
    gap: 8px;
}

.topbar-auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid transparent;
}
.topbar-auth-btn--ghost {
    border-color: var(--border);
    color: var(--text-secondary);
    background: var(--bg-elevated);
}
.topbar-auth-btn--ghost:hover {
    color: var(--text-primary);
    border-color: rgba(var(--accent-rgb), 0.4);
}
.topbar-auth-btn--solid {
    color: #fff;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
}

.topbar-login-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid currentColor;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.topbar-auth-btn--login {
    gap: 7px;
}

.topbar-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 10px 0 4px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
    text-decoration: none;
    max-width: 200px;
}
.topbar-user-chip:hover { border-color: rgba(var(--accent-rgb), 0.45); }
.topbar-user-avatar img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: block;
}
.topbar-user-name {
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Topbar horizontal nav (wide layout only, desktop) ─────── */
.topbar-nav {
    display: none; /* shown via body.ha-layout-wide @media 768px+ */
    flex: 1;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding: 0 12px;
    min-width: 0;
}
.topbar-nav::-webkit-scrollbar { display: none; }
.topbar-nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.83rem;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
    flex-shrink: 0;
}
.topbar-nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}
.topbar-nav-link.active {
    color: var(--accent-primary);
    background: rgba(var(--accent-rgb), 0.1);
    font-weight: 600;
}
.topbar-nav-icon { flex-shrink: 0; color: inherit; }

.topbar-nav--desktop { display: none; }
.topbar-nav-link--desktop {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 14px;
    position: relative;
}
.topbar-nav-link--desktop.active {
    color: var(--accent-primary);
    background: transparent;
}
.topbar-nav-link--desktop.active::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -7px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent-primary);
}

/* Logo inside topbar — left-aligned, auto width */
.sidebar-logo.topbar-logo {
    flex: 0 0 auto;
    justify-content: flex-start;
    padding-right: 4px;
    min-width: 0;
}
.sidebar-logo.topbar-logo .logo-text { font-size: 2.5rem; }
.sidebar-logo.topbar-logo .site-logo-img { height: 28px; }

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottombar-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    align-items: stretch;
    justify-content: space-around;
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    padding: 6px 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    position: relative;
    transition: var(--transition);
    line-height: 1.2;
}

.mobile-nav-item svg { flex-shrink: 0; }

.mobile-nav-item.active { color: var(--accent-glow); }

.mobile-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 0 0 2px 2px;
}

/* ============================================================
   SEARCH OVERLAY
   ============================================================ */
.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(14px);
    z-index: 400;
    padding: 72px 20px 24px;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.search-overlay.open { display: flex; }

.search-overlay-inner {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-overlay-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-md);
    padding: 0 14px;
    box-shadow: var(--shadow-glow);
}

.search-bar-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 0;
}

.search-overlay-bar input {
    flex: 1;
    font-size: 1.1rem;
    padding: 14px 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
}
:is(.search-overlay-bar input)::placeholder { color: var(--text-muted); }

.search-close-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: var(--transition);
    white-space: nowrap;
}
.search-close-btn kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    padding: 1px 5px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 3px;
}
.search-close-btn:hover { color: var(--text-primary); }

.search-results-overlay {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.search-results-overlay::-webkit-scrollbar { width: 4px; }
.search-results-overlay::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.search-result-item:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
}

.search-result-poster {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: var(--bg-elevated);
    display: block;
}

.search-result-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.search-result-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.search-no-results {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 32px 0;
}

/* ============================================================
   SINGLE ANIME PAGE
   ============================================================ */
.anime-hero {
    position: relative;
    height: 430px;
    overflow: hidden;
}

.anime-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center 22%;
    filter: brightness(0.55) saturate(1.08);
}

.anime-hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to right, rgba(10,10,15,0.62) 0%, rgba(10,10,15,0.12) 56%, transparent 100%),
        linear-gradient(to bottom, rgba(10,10,15,0.08) 0%, rgba(10,10,15,0.58) 55%, var(--bg-base) 86%, var(--bg-base) 100%);
}

.anime-detail-container {
    position: relative;
    max-width: 1180px;
    margin: -148px auto 0;
    z-index: 2;
    padding: 28px 28px 34px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 16px 46px rgba(0,0,0,0.34);
}

.anime-detail-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
    align-items: start;
    margin-bottom: 0;
}

.anime-poster-col {
    display: flex;
    flex-direction: column;
    margin-top: -74px;
    position: relative;
    z-index: 3;
}

.anime-poster-widget-area {
    width: 100%;
    margin-top: 14px;
}

.anime-next-ep-countdown-wrap {
    margin-top: 12px;
}

/* Desktop watchlist button — full width under poster */
.anime-poster-col > .watchlist-btn {
    width: 100%;
    margin-top: 12px;
    justify-content: center;
}

.anime-poster-img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(var(--accent-rgb),0.25);
    border: 2px solid var(--border);
    margin-bottom: 16px;
    transition: box-shadow 0.3s ease;
}
.anime-poster-img:hover {
    box-shadow: 0 16px 60px rgba(0,0,0,0.8), 0 0 0 1px rgba(var(--accent-rgb),0.5);
}

.anime-quick-stats {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.stat-row:last-child { border-bottom: none; padding-bottom: 0; }

.stat-label { color: var(--text-muted); min-width: 0; }
.stat-value { font-weight: 600; color: var(--text-primary); text-align: right; max-width: 60%; }

.anime-info-col {
    min-width: 0;
}

.anime-status-wrap {
    margin-bottom: 14px;
}

.anime-detail-title {
    font-size: clamp(1.6rem, 3vw, 2.5rem);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.anime-alt-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.anime-genre-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.genre-pill {
    background: rgba(var(--accent-rgb),0.15);
    border: 1px solid rgba(var(--accent-rgb),0.4);
    color: var(--accent-glow);
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.genre-pill:hover {
    background: var(--accent-primary);
    color: #fff;
}

.anime-synopsis-wrap { margin-bottom: 24px; }

.anime-synopsis {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

.synopsis-toggle {
    background: none;
    border: none;
    color: var(--accent-glow);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    padding: 0;
}

.anime-synopsis.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trailer-section { margin-bottom: 24px; }

/* Trailer badge button */
.btn-trailer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 22px;
    background: rgba(var(--danger-rgb),0.1);
    border: 1px solid rgba(var(--danger-rgb),0.4);
    color: #f87171;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin: 4px;
    letter-spacing: 0.02em;
}
.btn-trailer-badge:hover {
    background: rgba(var(--danger-rgb),0.22);
    border-color: #f87171;
    color: #fff;
    transform: translateY(-1px);
}
.trailer-badge-icon {
    width: 26px;
    height: 26px;
    background: #ef4444;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #fff;
    flex-shrink: 0;
    padding-left: 2px; /* optical center for play icon */
}

/* Trailer Modal */
.trailer-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.trailer-modal.open { display: flex; }

.trailer-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.88);
    cursor: pointer;
    backdrop-filter: blur(4px);
}
.trailer-modal-inner {
    position: relative;
    z-index: 1;
    width: min(860px, 92vw);
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.08);
    animation: modal-pop 0.25s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes modal-pop {
    from { opacity: 0; transform: scale(0.93); }
    to   { opacity: 1; transform: scale(1); }
}
.trailer-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    width: 34px;
    height: 34px;
    background: rgba(0,0,0,0.65);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    line-height: 1;
}
.trailer-modal-close:hover {
    background: rgba(var(--danger-rgb),0.75);
    border-color: #ef4444;
}
.trailer-modal-embed {
    position: relative;
    padding-bottom: 56.25%;
}
.trailer-modal-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ============================================================
    Episode countdown container
============================================================== */

.episode-countdown{
      margin: 1rem;
}

.ha-wl-ep-num{
    color: var(--text-secondary) !important;
}

/* =================================================================
   Download buttons
================================================================= */

/* Modern Download Section wrapper */
.modern-download {
    border-radius: var(--radius-md);
    box-shadow: 0 2px 16px rgba(0,0,0,0.10);
    margin: 28px 0 0 0;
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.modern-download .download-header {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    font-size: 1.05em;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    color: var(--text-primary);
}
.modern-download .download-header svg {
    color: var(--accent-primary);
    flex-shrink: 0;
}
.modern-download .download-header:hover {
    background: var(--bg-elevated);
}

/* List layout — replaces the broken grid on a <ul> */
.modern-download .download-list {
    list-style: none;
    margin: 0;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.download-list-item {
    display: block;
}

/* ── Premium pill button (single canonical definition) ── */
.premium-download-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    border-radius: var(--radius-pill);
    /* Gradient uses theme vars — works in both dark & light */
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-cyan) 100%);
    /* Always white text — readable on purple→cyan gradient in any theme */
    color: #fff;
    border: none;
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(var(--accent-rgb), 0.22);
    transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
    position: relative;
    overflow: hidden;
}

.premium-download-btn:hover,
.premium-download-btn:focus-visible {
    background: linear-gradient(90deg, var(--accent-cyan) 0%, var(--accent-primary) 100%);
    box-shadow: 0 4px 20px rgba(var(--accent-cyan-rgb), 0.28);
    color: #fff;
    transform: translateY(-1px) scale(1.01);
    outline: none;
}

.premium-download-btn .premium-download-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: rgba(255,255,255,0.9);
}

.premium-download-btn .download-label {
    font-weight: 800;
    font-size: 1em;
    color: #fff;
    flex-shrink: 0;
}

.premium-download-btn .download-quality {
    font-size: 0.82em;
    font-weight: 600;
    /* Frosted pill — readable on gradient in both themes */
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    padding: 1px 6px;
    flex-shrink: 0;
}

.premium-download-btn .download-size {
    font-size: 0.82em;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
    margin-left: auto; /* pushes size to the far right */
    flex-shrink: 0;
}

/* ── Standalone modern-download-btn (grid variant, unused in current PHP but kept) ── */
.modern-download-btn {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    background: var(--bg-base);
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    font-size: 1em;
    font-weight: 500;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    transition: border-color 0.18s, background 0.18s, color 0.18s, box-shadow 0.18s;
    padding: 14px 18px;
    gap: 6px;
    text-decoration: none;
    cursor: pointer;
}
.modern-download-btn:hover {
    border-color: var(--accent-cyan);
    background: rgba(var(--accent-cyan-rgb), 0.08);
    color: var(--accent-cyan);
    box-shadow: 0 2px 12px rgba(var(--accent-cyan-rgb), 0.10);
}
.modern-download-btn .download-quality {
    font-size: 0.92em;
    color: var(--accent-cyan);
    font-weight: 700;
    margin-bottom: 2px;
}
.modern-download-btn .download-label {
    font-size: 1em;
    color: var(--text-primary);
    font-weight: 600;
}
.modern-download-btn .download-size {
    font-size: 0.85em;
    color: var(--text-muted);
}

/* Server Dropdown */
.server-dropdown {
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1.5px solid var(--border);
    font-size: 1em;
    font-weight: 500;
    padding: 7px 16px;
    min-width: 160px;
    transition: border-color 0.18s, background 0.18s, color 0.18s;
    outline: none;
    margin-left: 8px;
}
.server-dropdown:focus {
    border-color: var(--accent-primary);
    background: var(--bg-surface);
    color: var(--accent-primary);
}


/* ============================================================
   EPISODE LIST
   ============================================================ */
.episode-list-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 20px;
}

.episode-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-tabs {
    display: flex;
    gap: 4px;
}

.filter-tab {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.filter-tab.active, .filter-tab:hover {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

/* ── Genre tabs (homepage By Genre section) ── */
.genre-tabs-wrap {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    margin-bottom: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.genre-tabs-wrap::-webkit-scrollbar {
    display: none;
}

.genre-tab {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.genre-tab.active,
.genre-tab:hover {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

/* ============================================================
   RECENT EPISODE CARD
   ============================================================ */
.rec-ep-card {
    flex: 0 0 150px;
    scroll-snap-align: start;
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.rec-ep-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.rec-ep-poster {
    position: relative;
    aspect-ratio: 2/3;
    background: var(--bg-elevated);
    overflow: hidden;
}

.rec-ep-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.rec-ep-card:hover .rec-ep-poster img {
    transform: scale(1.05);
}

.rec-ep-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10,10,15,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.rec-ep-card:hover .rec-ep-overlay {
    opacity: 1;
}

.rec-ep-play {
    font-size: 1.6rem;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.rec-ep-num {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.15);
    white-space: nowrap;
}

.rec-ep-info {
    padding: 8px 10px;
}

.rec-ep-anime {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.rec-ep-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.rec-ep-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.rec-ep-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ── Recent Episodes grid (page template) ── */
.rec-ep-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

/* ── EP count label on anime card ── */
.ep-count-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--accent-light);
    font-weight: 600;
}

.episode-search-input {
    margin-left: auto;
    width: 200px;
}

.episode-grid {
    display: flex;
    flex-direction: column;
    max-height: 480px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.episode-grid::-webkit-scrollbar { width: 4px; }
.episode-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ============================================================
   EPISODE ROW (compact list style)
   ============================================================ */
.episode-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.12s;
    min-height: 38px;
}
.episode-row:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}
.episode-row.is-filler { opacity: 0.72; }

.er-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-glow);
    min-width: 28px;
    text-align: right;
    flex-shrink: 0;
}

.er-badges {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.ep-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.ep-badge-sub  { background: rgba(139,92,246,0.18);  color: #7d64e4; border: 1px solid rgba(139,92,246,0.35); box-shadow: 0 1px 6px rgba(139,92,246,0.15); }
.ep-badge-dub  { background: rgba(59,130,246,0.18);  color: #93c5fd; border: 1px solid rgba(59,130,246,0.35);  box-shadow: 0 1px 6px rgba(59,130,246,0.15); }
.ep-badge-raw  { background: rgba(156,163,175,0.12); color: #d1d5db; border: 1px solid rgba(156,163,175,0.28); }
.ep-badge-both { background: rgba(16,185,129,0.16);  color: #6ee7b7; border: 1px solid rgba(16,185,129,0.32);  box-shadow: 0 1px 6px rgba(16,185,129,0.12); }
.ep-badge-filler { background: rgba(245,158,11,0.15); color: #fde68a; border: 1px solid rgba(245,158,11,0.32); box-shadow: 0 1px 6px rgba(245,158,11,0.12); }
.ep-badge-recap  { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.32); box-shadow: 0 1px 6px rgba(99,102,241,0.12); }

.er-title {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.episode-row:hover .er-title { color: var(--accent-primary); }

.er-meta {
    display: flex;
    gap: 10px;
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.er-arrow {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.12s, transform 0.12s;
}
.episode-row:hover .er-arrow { opacity: 1; transform: translateX(2px); }

/* ============================================================
   SINGLE EPISODE / PLAYER
   ============================================================ */
/* ============================================================
   SINGLE EPISODE PAGE
   ============================================================ */
.ep-page {
    background: var(--bg-base);
    min-height: 100vh;
}

.ep-page-inner {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 0;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── Main column ─────────────────────────────────────── */
.ep-main {
    min-width: 0;
    border-right: 1px solid var(--border);
}

.ep-player-box {
    background: #000;
    position: relative;
    width: 100%;
}

.ep-player-ratio {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.ep-player-ratio iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.ep-no-source {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

/* ── Player loading overlay ─────────────────────────── */
/* ── Watch-party player lock overlay ─────────────────── */
.ep-wp-lock {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10,10,26,0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: not-allowed;
}
.ep-wp-lock-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 0 20px;
    pointer-events: none;
    user-select: none;
}
.ep-wp-lock-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb),0.18);
    border: 1px solid rgba(var(--accent-rgb),0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a78bfa;
    margin-bottom: 4px;
}
.ep-wp-lock-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #a78bfa;
}
.ep-wp-lock-line {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
}
.ep-wp-lock-countdown {
    font-size: 2.4rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.06em;
    color: #fff;
    line-height: 1;
}
.ep-wp-lock-time {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
}

.ep-player-loading {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(0,0,0,0.72);
    pointer-events: none;
}
.ep-player-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255,255,255,0.12);
    border-top-color: var(--accent-primary, #7c3aed);
    border-radius: 50%;
    animation: ep-spin 0.75s linear infinite;
}
@keyframes ep-spin { to { transform: rotate(360deg); } }
.ep-player-loading-txt {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.05em;
}

/* ── Native video element ───────────────────────────── */
#ep-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: block;
    cursor: pointer;
}

/* ── Custom controls overlay ────────────────────────── */
.ep-vc {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
}
.ep-vc-gradient-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 72px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
    opacity: 0;
    transition: opacity 0.28s;
    pointer-events: none;
}
.ep-vc-gradient-btm {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 130px;
    background: linear-gradient(to top, rgba(0,0,0,0.82), transparent);
    opacity: 0;
    transition: opacity 0.28s;
    pointer-events: none;
}
.ep-vc.ep-vc-active .ep-vc-gradient-top,
.ep-vc.ep-vc-active .ep-vc-gradient-btm { opacity: 1; }

/* Center play/pause button */
.ep-vc-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.ep-vc-play-big {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0,0,0,0.45);
    border: 2px solid rgba(255,255,255,0.25);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.88);
    transition: opacity 0.28s, transform 0.28s, background 0.15s;
    pointer-events: auto;
}
.ep-vc-play-big:hover { background: rgba(var(--accent-rgb),0.65); border-color: rgba(255,255,255,0.5); }
.ep-vc.ep-vc-active .ep-vc-play-big { opacity: 1; transform: scale(1); }
/* Hide big button while actively playing (show on pause or hover) */
.ep-vc.ep-vc-playing:not(.ep-vc-active) .ep-vc-play-big { opacity: 0; pointer-events: none; }

/* Bottom bar */
.ep-vc-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 0 14px 10px;
    opacity: 0;
    transition: opacity 0.28s;
}
.ep-vc.ep-vc-active .ep-vc-bar { opacity: 1; }

/* Seek / progress bar */
.ep-vc-progress {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 2px;
}
.ep-vc-progress-bg,
.ep-vc-buffer-fill,
.ep-vc-played-fill {
    position: absolute;
    left: 0;
    height: 4px;
    border-radius: 999px;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
    transition: height 0.12s;
}
.ep-vc-progress:hover .ep-vc-progress-bg,
.ep-vc-progress:hover .ep-vc-buffer-fill,
.ep-vc-progress:hover .ep-vc-played-fill { height: 6px; }
.ep-vc-progress-bg  { width: 100%; background: rgba(255,255,255,0.2); }
.ep-vc-buffer-fill  { width: 0;    background: rgba(255,255,255,0.32); }
.ep-vc-played-fill  { width: 0;    background: var(--accent-primary, #7c3aed); z-index: 1; }
.ep-vc-thumb {
    position: absolute;
    width: 12px; height: 12px;
    background: #fff;
    border-radius: 50%;
    top: 50%; left: 0;
    transform: translate(-50%, -50%) scale(0);
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 1px 5px rgba(0,0,0,0.5);
    transition: transform 0.12s;
}
.ep-vc-progress:hover .ep-vc-thumb { transform: translate(-50%, -50%) scale(1); }

/* Controls row */
.ep-vc-row {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 34px;
}
.ep-vc-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.88);
    padding: 5px 6px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.14s, background 0.14s;
}
.ep-vc-btn:hover { color: #fff; background: rgba(255,255,255,0.14); }
.ep-vc-btn-text {
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 28px;
    letter-spacing: 0;
}
.ep-vc-vol-group { display: flex; align-items: center; gap: 2px; }
.ep-vc-vol-range {
    -webkit-appearance: none;
    appearance: none;
    width: 68px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,0.28);
    outline: none;
    cursor: pointer;
}
.ep-vc-vol-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}
.ep-vc-time {
    font-size: 0.76rem;
    color: rgba(255,255,255,0.82);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    padding: 0 4px;
}
.ep-vc-spacer { flex: 1; }

/* Server quality badge */
.server-quality {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb),0.22);
    color: var(--accent-secondary, #a78bfa);
    border: 1px solid rgba(var(--accent-rgb),0.28);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Controls bar */
.ep-controls-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    min-height: 52px;
}

.ep-nav-btns {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.ep-nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    transition: var(--transition);
    white-space: nowrap;
}
.ep-nav-btn--next { padding: 6px 10px 6px 12px; }
.ep-nav-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}
.ep-nav-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ep-nav-hint {
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    line-height: 1;
}
.ep-nav-btn:hover .ep-nav-hint { color: rgba(255,255,255,0.7); }
.ep-nav-num { font-size: 0.78rem; font-weight: 700; line-height: 1; }

.ep-servers {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}
.ep-servers-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-right: 4px;
}

/* Episode info block */
.ep-info-block {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.ep-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.ep-breadcrumb a { color: var(--accent-glow); text-decoration: none; }
.ep-breadcrumb a:hover { text-decoration: underline; }
.ep-breadcrumb .sep { color: var(--text-dim); }

.ep-page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.35;
}

.ep-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.ep-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ep-synopsis {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.75;
    max-width: 700px;
}

/* ── Sidebar ─────────────────────────────────────── */
.ep-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
}
.ep-sidebar::-webkit-scrollbar { width: 4px; }
.ep-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.ep-anime-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    background: var(--bg-elevated);
    transition: background 0.15s;
    flex-shrink: 0;
}
.ep-anime-card:hover { background: var(--bg-base); }

.ep-anime-cover {
    width: 44px;
    height: 62px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
    background: var(--bg-base);
}

.ep-anime-info { flex: 1; min-width: 0; }

.ep-anime-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.ep-anime-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 4px;
}

.ep-anime-arrow { color: var(--text-muted); flex-shrink: 0; }

.ep-sidebar-eps {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ep-sidebar-eps-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    position: sticky;
    top: 91px;  /* anime card height */
    z-index: 1;
}

.ep-sidebar-eps-label {
    flex-shrink: 0;
}

.ep-sidebar-count {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 1px 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.ep-sidebar-search {
    flex: 1;
    min-width: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.75rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.ep-sidebar-search:focus {
    border-color: var(--accent-primary);
}

.ep-sidebar-search::placeholder {
    color: var(--text-dim);
}

.ep-sidebar-list {
    display: flex;
    flex-direction: column;
}

.ep-side-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    text-decoration: none;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    transition: background 0.1s;
    min-height: 38px;
}
.ep-side-row:last-child { border-bottom: none; }
.ep-side-row:hover { background: var(--bg-elevated); color: var(--text-primary); }
.ep-side-row.current {
    background: rgba(var(--accent-rgb),0.12);
    border-left: 3px solid var(--accent-primary);
    color: var(--text-primary);
}

.ep-side-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-glow);
    min-width: 26px;
    flex-shrink: 0;
    text-align: right;
}
.ep-side-row.current .ep-side-num { color: var(--accent-primary); }

.ep-side-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.82rem;
}

/* Related anime block */
.ep-related {
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
.ep-widget-area {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    width: 100%;
}

/* Re-used server-tab & download styles */
.server-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.server-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}
.server-tab:hover:not(.active) {
    border-color: var(--accent-glow);
    color: var(--text-primary);
}

.download-section {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 1rem;
}

.download-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-elevated);
    border: none;
}
.download-header:hover { background: var(--bg-surface); }

.download-body {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.download-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 14px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}
.download-btn:hover {
    border-color: var(--accent-cyan);
    background: rgba(var(--accent-cyan-rgb),0.05);
    color: var(--text-primary);
}

.download-quality {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-cyan);
}
.download-size { font-size: 0.72rem; color: var(--text-muted); }

/* ============================================================
   BROWSE PAGE
   ============================================================ */
.browse-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 24px;
    align-items: start;
}
#browse-results { order: 1; }

.filters-sidebar {
    order: 2;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: sticky;
    top: 24px;
}

/* Panel header — hidden on desktop, shown on mobile */
.filters-panel-head {
    display: none;
    align-items: center;
    justify-content: space-between;
    /* flush with drawer edges */
    margin: -20px -20px 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    background: var(--bg-elevated);
    /* Sticky inside the scrollable drawer */
    position: sticky;
    top: -20px;
    z-index: 1;
}
.filters-panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
}
.filters-panel-close:hover { background: rgba(255,255,255,.07); color: var(--text-primary); }

/* Mobile filter toggle bar — hidden on desktop */
.browse-filter-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 0 0 14px;
}
.browse-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.browse-filter-toggle:hover,
.browse-filter-toggle[aria-expanded="true"] {
    border-color: var(--accent-primary);
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent-primary);
}
.browse-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent-primary);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
}
.browse-filter-bar-meta {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: right;
}

/* Browse filter drawer overlay */
.browse-filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-bg, rgba(0,0,0,.55));
    z-index: 399;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}

.filter-group { margin-bottom: 20px; }

.filter-group-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-checkbox input { width: auto; }

.genre-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.genre-scroll::-webkit-scrollbar { width: 3px; }
.genre-scroll::-webkit-scrollbar-track { background: transparent; }
.genre-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.genre-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   A-Z INDEX PAGE
   ============================================================ */
.az-tabs-wrap {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.az-tabs-wrap::-webkit-scrollbar {
    height: 3px;
}

.az-tabs-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.az-tabs-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-pill);
}

.az-tabs-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

#az-results {
    min-height: 200px;
}

span#az-found-count {
    border: 1px solid var(--accent-primary);
    padding: 1px 10px;
    border-radius: 20px;
}


.az-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: auto;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.az-tab:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.az-tab.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.page-btn:hover, .page-btn.current {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    margin-top: 64px;
    margin-left: var(--sidebar-width);
    position: relative;
    overflow: hidden;
}

/* Accent gradient rule at top of footer */
.footer-accent-bar {
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-glow) 50%, var(--accent-cyan) 100%);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr;
    gap: 48px;
    padding: 48px 0 36px;
    border-bottom: 1px solid var(--border);
}

/* Footer brand column */
.footer-brand { display: flex; flex-direction: column; gap: 14px; }

.footer-logo { margin: 0; }
.footer-logo .logo-text { font-size: 2rem; }
.footer-logo .site-logo-img { height: 36px; max-width: 140px; }

.footer-tagline {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.7;
    max-width: 260px;
    margin: 0;
}

/* Social icons row */
.footer-social {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.footer-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}
.footer-social-link:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background: rgba(var(--accent-rgb), 0.1);
}

/* Footer nav columns */
.footer-col { display: flex; flex-direction: column; }

.footer-col-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 5px 0;
    transition: var(--transition);
    border-radius: var(--radius-sm);
}
.footer-link::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: var(--transition);
}
.footer-link:hover { color: var(--accent-primary); }
.footer-link:hover::before { background: var(--accent-primary); }

/* Genre pills */
.footer-links--pills {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
}
.footer-genre-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}
.footer-genre-pill:hover {
    background: rgba(var(--accent-rgb), 0.12);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Stats row */
.footer-stats {
    display: flex;
    gap: 0;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}
.footer-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
    padding: 12px 0;
    border-right: 1px solid var(--border);
    text-align: center;
}
.footer-stat:last-child { border-right: none; }
.footer-stat-num {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1;
}
.footer-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* Bottom bar */
.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    font-size: 0.8rem;
    color: var(--text-dim);
    gap: 12px;
    flex-wrap: wrap;
}
.footer-copy-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}
.footer-copy-link:hover { text-decoration: underline; }
.footer-heart { color: var(--accent-primary); }
.footer-made { color: var(--text-dim); }


/* ============================================================
   BLOG POST CARDS (homepage grid + single page "More Posts")
   ============================================================ */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.post-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
    border-color: var(--accent-primary);
}

.post-card-thumb {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-elevated);
    flex-shrink: 0;
}

.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-thumb img { transform: scale(1.04); }

.post-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.post-card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}

.post-card-cat {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-glow);
    text-decoration: none;
}

.post-card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
}

.post-card-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.post-card-title a:hover { color: var(--accent-glow); }

.post-card-excerpt {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    flex: 1;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.post-card-sep { color: var(--border); }

/* ============================================================
   SINGLE BLOG POST
   ============================================================ */
.single-post-hero {
    height: 340px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.single-post-hero-overlay {
    position: absolute;
    inset: 0;
}

.single-post-wrap {
    padding-top: 32px;
    padding-bottom: 56px;
}

.post-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.post-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.post-breadcrumb a:hover { color: var(--accent-glow); }
.post-breadcrumb svg { flex-shrink: 0; color: var(--text-dim); }
.post-breadcrumb-current { color: var(--text-primary); }

.single-post-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 48px;
    align-items: start;
}

/* ── Article ── */
.single-post-article {}

.post-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.post-cat-badge {
    background: rgba(var(--accent-rgb),0.15);
    border: 1px solid rgba(var(--accent-rgb),0.35);
    color: var(--accent-glow);
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    transition: var(--transition);
}

.post-cat-badge:hover {
    background: var(--accent-primary);
    color: #fff;
}

.single-post-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
}

.post-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.post-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.post-meta-info { display: flex; flex-direction: column; gap: 2px; }

.post-author-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-decoration: none;
}

.post-author-name:hover { color: var(--accent-glow); }

.post-meta-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-meta-sep { color: var(--border); }

.single-post-featured-img {
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 28px;
    border: 1px solid var(--border);
}

/* ── Content typography ── */
.single-post-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary, var(--text-muted));
}

[data-theme="light"] .single-post-content { color: #334155; }

.single-post-content h2,
.single-post-content h3,
.single-post-content h4 {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2em 0 0.6em;
}

.single-post-content h2 { font-size: 1.5rem; }
.single-post-content h3 { font-size: 1.25rem; }

.single-post-content p { margin-bottom: 1.2em; }

.single-post-content a {
    color: var(--accent-glow);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.single-post-content ul,
.single-post-content ol {
    list-style: revert;
    padding-left: 1.5em;
    margin-bottom: 1.2em;
}

.single-post-content blockquote {
    border-left: 4px solid var(--accent-primary);
    padding: 12px 20px;
    margin: 1.5em 0;
    background: var(--bg-elevated);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--text-muted);
}

.single-post-content img {
    border-radius: var(--radius-sm);
    max-width: 100%;
    height: auto;
}

.single-post-content code {
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.87em;
    color: var(--accent-cyan);
}

.single-post-content pre {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 1.2em;
}

/* ── Tags ── */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 2em 0;
    padding-top: 1.5em;
    border-top: 1px solid var(--border);
}

.post-tag-icon { color: var(--text-dim); flex-shrink: 0; }

.post-tag {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    text-decoration: none;
    transition: var(--transition);
}

.post-tag:hover {
    border-color: var(--accent-primary);
    color: var(--accent-glow);
}

/* ── Author box ── */
.post-author-box {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 2em 0;
}

.author-box-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.author-box-name { font-weight: 700; margin-bottom: 6px; }

.author-box-name a {
    color: var(--text-primary);
    text-decoration: none;
}

.author-box-name a:hover { color: var(--accent-glow); }

.author-box-bio {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ── Post navigation ── */
.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 2em 0;
    padding-top: 1.5em;
    border-top: 1px solid var(--border);
}

.post-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: var(--transition);
    min-width: 0;
}

.post-nav-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
}

.post-nav-item div { display: flex; flex-direction: column; min-width: 0; }

.post-nav-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.post-nav-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-nav-next { grid-column: 2; justify-content: flex-end; text-align: right; }

/* ── Sidebar widgets ── */
.single-post-sidebar { position: sticky; top: 80px; }

.sidebar-widget {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 20px;
}

.sidebar-widget-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-glow);
    margin-bottom: 14px;
}

.related-post-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: var(--transition);
}

.related-post-item:last-child { border-bottom: none; }

.related-post-item:hover .related-post-title { color: var(--accent-glow); }

.related-post-thumb {
    width: 56px;
    height: 42px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    background: var(--bg-elevated);
}

.related-post-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.related-post-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.related-post-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: var(--transition);
}

.related-post-date {
    font-size: 0.72rem;
    color: var(--text-dim);
}

/* ── Popular Anime sidebar widget ──────────────────────── */
.sidebar-widget-popular .sidebar-widget-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.popular-anime-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.popular-anime-item {
    display: flex;
    gap: 12px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    padding: 6px;
    margin: -6px;
    transition: var(--transition);
}

.popular-anime-item:hover {
    background: var(--bg-elevated);
}

.popular-anime-item:hover .popular-anime-title {
    color: var(--accent-glow);
}

.popular-anime-cover {
    position: relative;
    width: 52px;
    height: 76px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-elevated);
}

.popular-anime-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

.popular-anime-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.popular-anime-score {
    position: absolute;
    bottom: 3px;
    left: 0;
    right: 0;
    text-align: center;
    background: linear-gradient(transparent, rgba(0,0,0,0.85) 60%);
    color: #fbbf24;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 8px 2px 3px;
    line-height: 1;
}

.popular-anime-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
    padding: 2px 0;
}

.popular-anime-title {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition);
}

.popular-anime-meta {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.popular-anime-status {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(100,116,139,0.12);
    color: #94a3b8;
    border: 1px solid rgba(100,116,139,0.2);
}

.popular-anime-status-currently-airing,
.popular-anime-status-airing {
    background: rgba(34,197,94,0.1);
    color: #22c55e;
    border-color: rgba(34,197,94,0.25);
}

.popular-anime-status-not-yet-aired {
    background: rgba(59,130,246,0.1);
    color: #60a5fa;
    border-color: rgba(59,130,246,0.25);
}

.popular-anime-eps {
    font-size: 0.68rem;
    color: var(--text-dim);
}

/* ── Popular Anime Ranking Widget (tabbed) ─────────────── */
.pop-rank-widget {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 24px;
}

/* -- Tab header ------------------------------------------- */
.pop-rank-header {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 4px;
}

.pop-rank-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 6px;
    letter-spacing: 0.03em;
    transition: color .15s, border-color .15s;
    text-align: center;
    line-height: 1;
    outline-offset: -2px;
}

.pop-rank-tab:hover {
    color: var(--text-primary);
}

.pop-rank-tab-active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* -- Panel visibility ------------------------------------- */
.pop-rank-panel {
    display: none;
    padding: 8px 0;
}

.pop-rank-panel-active {
    display: block;
}

/* -- Each ranked row -------------------------------------- */
.pop-rank-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    text-decoration: none;
    transition: background .15s;
}

.pop-rank-item:hover {
    background: rgba(var(--accent-rgb), 0.05);
}

/* -- Rank number ------------------------------------------ */
.pop-rank-num {
    flex-shrink: 0;
    width: 22px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-dim);
    line-height: 1;
    padding-bottom: 2px;
    border-bottom: 2px solid var(--border);
}

/* Top 3 accent colours */
.pop-rank-num-1 {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}
.pop-rank-num-2 {
    color: var(--accent-glow);
    border-bottom-color: var(--accent-glow);
}
.pop-rank-num-3 {
    color: var(--accent-glow);
    border-bottom-color: var(--accent-glow);
    opacity: 0.7;
}

/* -- Cover thumbnail -------------------------------------- */
.pop-rank-cover {
    flex-shrink: 0;
    width: 46px;
    height: 64px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-surface);
}

.pop-rank-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

.pop-rank-cover-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

/* -- Info column ------------------------------------------ */
.pop-rank-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pop-rank-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .15s;
}

.pop-rank-item:hover .pop-rank-title {
    color: var(--accent-glow);
}

.pop-rank-genres {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* -- Stars ------------------------------------------------ */
.pop-rank-stars {
    display: flex;
    align-items: center;
    gap: 1px;
}

.pop-star {
    font-size: 0.7rem;
    line-height: 1;
}

.pop-star-full  { color: #fbbf24; }
.pop-star-half  { color: #fbbf24; opacity: .55; }
.pop-star-empty { color: rgba(255,255,255,.15); }

.pop-rank-score {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fbbf24;
    margin-left: 3px;
}

/* -- Empty state ------------------------------------------ */
.pop-rank-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 12px;
    margin: 0;
}

/* ============================================================
   COMMENTS
   ============================================================ */
.ha-comments {
    margin-top: 48px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

/* ── Header ─────────────────────────────────────────────── */
.ha-comments-header {
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ha-comments-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.01em;
}

.ha-comments-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 9px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb),0.18), rgba(var(--accent-rgb),0.10));
    color: var(--accent-primary);
    border: 1px solid rgba(var(--accent-rgb),0.30);
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    box-shadow: 0 1px 6px rgba(var(--accent-rgb),0.12);
}

.ha-comments-closed,
.ha-comment-password-notice {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--border);
}

/* ── Comment list ─────────────────────────────────────── */
.ha-comment-list,
.ha-comment-list .children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ha-comment-list .children {
    padding-left: 20px;
    border-left: 2px solid rgba(var(--accent-rgb),0.15);
    margin-left: 28px;
    margin-top: 12px;
    position: relative;
}

.ha-comment {
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.ha-comment:last-child {
    border-bottom: none;
}

.ha-comment-inner {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.ha-comment-avatar-wrap { flex-shrink: 0; position: relative; }

.ha-comment-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    display: block;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ha-comment:hover .ha-comment-avatar {
    border-color: rgba(var(--accent-rgb),0.4);
}

.ha-comment-byauthor > .ha-comment-inner .ha-comment-avatar {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.20), 0 2px 12px rgba(var(--accent-rgb),0.22);
}

.ha-comment-body {
    flex: 1;
    min-width: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    position: relative;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ha-comment:hover .ha-comment-body {
    border-color: rgba(var(--accent-rgb),0.22);
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.ha-comment-byauthor > .ha-comment-inner .ha-comment-body {
    border-color: rgba(var(--accent-rgb),0.28);
    background: rgba(var(--accent-rgb),0.04);
}

/* ── Meta row ──────────────────────────────────────────── */
.ha-comment-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ha-comment-author {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ha-comment-author-link {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.15s;
}

.ha-comment-author-link:hover { color: var(--accent-glow); text-decoration: underline; }

.ha-comment-badge-author {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, rgba(var(--accent-rgb),0.20), rgba(var(--accent-rgb),0.12));
    color: var(--accent-primary);
    border: 1px solid rgba(var(--accent-rgb),0.32);
    font-family: 'JetBrains Mono', monospace;
    box-shadow: 0 1px 4px rgba(var(--accent-rgb),0.12);
}

.ha-comment-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
}

.ha-comment-pending {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #fbbf24;
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.28);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    font-family: 'JetBrains Mono', monospace;
}

/* ── Comment text ───────────────────────────────────────── */
.ha-comment-text {
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

.ha-comment-text p {
    margin: 0 0 10px;
}

.ha-comment-text p:last-child { margin-bottom: 0; }

/* ── Comment actions ───────────────────────────────────── */
.ha-comment-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.ha-comment-actions .comment-reply-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.15s;
    background: none;
}

.ha-comment-actions .comment-reply-link:hover {
    color: var(--accent-primary);
    background: rgba(var(--accent-rgb),0.08);
    border-color: rgba(var(--accent-rgb),0.22);
}

.ha-comment-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.15s;
    margin-left: auto;
    flex-shrink: 0;
}

.ha-comment-edit:hover {
    color: var(--danger);
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.25);
}

/* ── Pagination ──────────────────────────────────────────── */
.ha-comment-pagination {
    display: flex;
    justify-content: space-between;
    padding: 20px 0 8px;
    font-size: 0.85rem;
}

.ha-comment-pagination a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.15s;
    background: var(--bg-surface);
}

.ha-comment-pagination a:hover {
    background: rgba(var(--accent-rgb),0.08);
    border-color: rgba(var(--accent-rgb),0.30);
}

/* ── Form ───────────────────────────────────────────────── */
#respond {
    margin-top: 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 24px;
}

.ha-comment-form-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ha-cancel-reply {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-muted);
}

.ha-cancel-reply a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--danger);
    text-decoration: none;
    margin-left: 8px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.ha-cancel-reply a:hover {
    background: rgba(239,68,68,0.08);
    text-decoration: none;
}

.ha-comment-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ha-comment-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 540px) {
    .ha-comment-fields-row { grid-template-columns: 1fr; }
}

.ha-comment-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ha-comment-field.ha-comment-field-full {
    grid-column: 1 / -1;
}

.ha-comment-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.ha-required {
    color: var(--danger);
    margin-left: 2px;
}

.ha-comment-input,
.ha-comment-textarea {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

.ha-comment-input:focus,
.ha-comment-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.12);
    background: var(--bg-surface);
}

.ha-comment-input::placeholder,
.ha-comment-textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.875rem;
}

.ha-comment-textarea {
    min-height: 120px;
    line-height: 1.7;
}

.ha-comment-cookie-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1.4;
}

.ha-comment-cookie-label input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent-primary);
    flex-shrink: 0;
}

.ha-comment-submit-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.ha-comment-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 28px;
    background: linear-gradient(135deg, var(--accent-primary), #6d28d9);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 16px rgba(var(--accent-rgb),0.30);
}

.ha-comment-submit-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb),0.42);
}

.ha-comment-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(var(--accent-rgb),0.25);
}

.ha-comment-reply { margin-top: 4px; }

/* ── Login notice ───────────────────────────────────────── */
.ha-comment-login-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px 24px;
    background: var(--bg-elevated);
    border: 1px dashed var(--border);
    border-radius: 14px;
    text-align: center;
}

.ha-comment-login-notice p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.ha-comment-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 26px;
    background: linear-gradient(135deg, var(--accent-primary), #6d28d9);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 4px 14px rgba(var(--accent-rgb),0.30);
    transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
}

.ha-comment-login-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb),0.42);
}

/* Episode page — embed inside ep-main (no sidebar context) */
.ep-main .ha-comments {
    margin-top: 36px;
    padding: 2rem;
}

/* ── Avatar badge icon (absolute on avatar, bottom-right) ───── */
.ha-comment-avatar-wrap {
    flex-shrink: 0;
    position: relative;
}

.ha-comment-badge-icon {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-elevated);
    cursor: default;
    transition: transform 0.15s;
    z-index: 2;
}

.ha-comment-badge-icon:hover { transform: scale(1.15); }

/* CSS tooltip */
.ha-comment-badge-icon::after {
    content: attr(data-badge-label);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    box-shadow: var(--shadow-card);
    z-index: 100;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
}

.ha-comment-badge-icon:hover::after { opacity: 1; }

/* Tier colors */
.ha-badge-commenter {
    background: linear-gradient(135deg, #7c2d00, #c2410c);
    color: #fed7aa;
}

.ha-badge-veteran {
    background: linear-gradient(135deg, #1e293b, #475569);
    color: #cbd5e1;
    border-color: var(--bg-surface);
}

.ha-badge-elite {
    background: linear-gradient(135deg, #78350f, #d97706);
    color: #fef3c7;
}

.ha-badge-legend {
    background: linear-gradient(135deg, var(--accent-primary), #a855f7);
    color: #f3e8ff;
    box-shadow: 0 0 8px rgba(var(--accent-rgb),0.6);
}

/* Inline tier label in meta row (small text pill) */
.ha-comment-tier {
    display: inline-flex;
    align-items: center;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    font-family: 'JetBrains Mono', monospace;
}

.ha-comment-tier.ha-badge-commenter { background: rgba(194,65,12,0.15); color: #d6680f; border: 1px solid rgba(194,65,12,0.3); }
.ha-comment-tier.ha-badge-veteran   { background: rgba(71,85,105,0.15);  color: #94a3b8; border: 1px solid rgba(71,85,105,0.3); }
.ha-comment-tier.ha-badge-elite     { background: rgba(217,119,6,0.15);  color: #fbbf24; border: 1px solid rgba(217,119,6,0.3); }
.ha-comment-tier.ha-badge-legend    { background: rgba(var(--accent-rgb),0.15); color: #c4b5fd; border: 1px solid rgba(var(--accent-rgb),0.3); }

/* ── Form user-info row ──────────────────────────────────── */
.ha-form-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px 10px 0 0;
    border-bottom: none;
    margin-bottom: 0;
}

.ha-form-user-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.ha-form-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    display: block;
}

.ha-form-user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ha-form-user-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ha-form-user-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Attach textarea box seamlessly below user-info row */
.ha-form-user-info + .ha-comment-form .ha-comment-textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
}



/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-card);
    animation: toast-in 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 320px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent-cyan); }

@keyframes haSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   WATCHLIST
   ============================================================ */
.watchlist-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    border: 1px solid var(--accent-primary);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.watchlist-btn.in-watchlist {
    background: rgba(var(--danger-rgb),0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.watchlist-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ============================================================
   GENRE / TAXONOMY ARCHIVE
   ============================================================ */
.archive-header {
    padding: 40px 32px 24px;
    border-bottom: 1px solid var(--border);
}

.archive-title {
    font-size: 2rem;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    margin-bottom: 8px;
}

.archive-description {
    color: var(--text-muted);
    max-width: 600px;
}

/* ============================================================
   404 PAGE
   ============================================================ */
.not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 40px;
}

.not-found-code {
    font-family: 'Rajdhani', sans-serif;
    font-size: 8rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */

@media (max-width: 1000px) {
        .episode-list-section { padding: 16px; margin: 0; border-radius: 0; border-left: 0; border-right: 0; }

    /* Episode page responsive */
    .ep-page-inner { grid-template-columns: 1fr; }
    .ep-main { border-right: none; }
    .ep-sidebar {
        position: static;
        height: auto;
        overflow-y: visible;
        max-height: 420px;
        border-top: 1px solid var(--border);
    }
    .ep-sidebar-list { max-height: 320px; overflow-y: auto; }
    .ep-controls-bar { padding: 8px 12px; }
    .ep-info-block { padding: 16px 14px 14px; }
    .ep-related { padding: 24px 14px; }
}


   @media (max-width: 767px) {
    .site-sidebar {
        transform: translateX(-100%);
        display: flex; /* keep flex layout, use transform to hide */
    }
    .site-sidebar.drawer-open {
        transform: translateX(0);
        box-shadow: 4px 0 40px rgba(0,0,0,0.5);
    }
    .site-main { margin-left: 0; padding-top: var(--topbar-height); padding-bottom: calc(var(--bottombar-height) + env(safe-area-inset-bottom)); }
    .mobile-topbar { display: flex; }
    /* Mobile auth visibility: show compact auth in topbar */
    .topbar-auth {
        display: inline-flex;
        gap: 6px;
    }
    .topbar-watchlist-btn {
        display: none;
    }
    .topbar-auth-btn {
        height: 30px;
        padding: 0 10px;
        font-size: 0.74rem;
    }
    .topbar-auth-btn--login {
        width: 30px;
        padding: 0;
        justify-content: center;
    }
    .topbar-auth-btn--login .topbar-auth-label {
        display: none;
    }
    .topbar-auth-btn--login .topbar-login-avatar {
        width: 20px;
        height: 20px;
    }
    /* Keep one clear CTA on small screens */
    .topbar-auth-btn--solid {
        display: none;
    }
    .topbar-user-chip {
        height: 30px;
        padding: 0 4px;
        border-radius: 999px;
        max-width: none;
    }
    .topbar-user-avatar img {
        width: 22px;
        height: 22px;
    }
    .topbar-user-name {
        display: none;
    }
    /* On mobile the logo is centered between the two icon buttons */
    .mobile-topbar .sidebar-logo.topbar-logo { flex: 1; justify-content: center; }
    .mobile-bottom-nav { display: flex; }
    .hero-banner { height: 380px; }
    .hero-content { flex-direction: column; align-items: flex-start; padding: 80px 20px 20px; gap: 16px; }
    .hero-poster { flex: 0 0 100px; }
    .hero-title { font-size: 1.4rem; }

    .anime-detail-layout { grid-template-columns: 1fr; }
    .anime-hero {
        height: 228px;
        border-radius: 0 0 18px 18px;
    }
    .anime-hero-bg {
        background-position: center 18%;
        filter: brightness(0.52) saturate(1.08);
    }
    .anime-hero-overlay {
        background:
            linear-gradient(to right, rgba(10,10,15,0.34) 0%, rgba(10,10,15,0.05) 56%, transparent 100%),
            linear-gradient(to bottom, rgba(10,10,15,0.08) 0%, rgba(10,10,15,0.5) 55%, var(--bg-base) 90%, var(--bg-base) 100%);
    }

    /* Mobile: coherent AniList-like ordering */
    .anime-detail-layout {
        grid-template-columns: 1fr;
        row-gap: 12px;
        align-items: start;
    }

    .anime-poster-col,
    .anime-info-col {
        display: contents;
    }

    .anime-poster-img {
        order: 1;
        grid-column: 1 / -1;
        justify-self: center;
        width: 108px;
        margin-top: -86px;
        margin-bottom: 0;
        border-radius: 8px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 0 1px rgba(var(--accent-rgb),0.14);
        z-index: 3;
    }

    .anime-poster-col > .watchlist-btn,
    .anime-poster-col > .btn-share {
        order: 2;
        grid-column: 1 / -1;
        width: 100%;
        justify-content: center;
        margin-top: 0;
        min-height: 40px;
        border-radius: 8px;
    }

    .anime-poster-col > .btn-share {
        margin-top: 10px;
    }

    .anime-status-wrap,
    .anime-genre-pills,
    .anime-synopsis-wrap,
    .btn-trailer-badge,
    .ha-ad-slot--anime_below_synopsis {
        order: 3;
        grid-column: 1 / -1;
    }

    .anime-info-col > .anime-detail-title {
        order: 3;
        grid-column: 1 / -1;
        margin-top: 6px;
    }

    .anime-quick-stats {
        order: 4;
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -ms-overflow-style: none;
        scrollbar-width: none;
        background: var(--bg-elevated);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 8px 10px;
        gap: 0;
        margin: 0;
        width: 100%;
        justify-content: flex-start;
    }
    .anime-quick-stats::-webkit-scrollbar { display: none; }
    .stat-row {
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        min-width: 92px;
        flex-shrink: 0;
        background: transparent;
        border: none;
        border-right: 1px solid rgba(255,255,255,0.08);
        border-radius: 0;
        padding: 2px 10px;
        gap: 2px;
        text-align: left;
    }
    .stat-row:last-child {
        border-right: none;
        border-bottom: none;
        padding-bottom: 2px;
    }
    .stat-label { font-size: 0.58rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); }
    .stat-value { font-size: 0.76rem; text-align: left; max-width: none; font-weight: 600; }

    .anime-next-ep-countdown-wrap {
        order: 5;
        grid-column: 1 / -1;
        margin-top: 0;
    }

    .anime-poster-widget-area {
        order: 6;
        grid-column: 1 / -1;
        width: 100% !important;
        margin-top: 0;
    }

    .anime-info-col > .episode-list-section {
        order: 7;
        grid-column: 1 / -1;
    }

    .anime-detail-container {
        margin-top: -12px;
        padding: 10px 12px 22px;
        border-radius: 16px 16px 0 0;
        border-top: 1px solid rgba(255,255,255,0.06);
        box-shadow: 0 -10px 30px rgba(0,0,0,0.22);
    }
    .anime-detail-title {
        font-size: 1.35rem;
        line-height: 1.2;
        margin-bottom: 8px;
    }

    .browse-layout { grid-template-columns: 1fr; }
    .browse-filter-bar { display: flex; }

    /* Hidden by default on mobile — becomes a fixed drawer when open */
    .filters-sidebar {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: min(320px, 88vw);
        height: 100dvh;
        overflow-y: auto;
        z-index: 400;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s;
        border-radius: 0;
        border-left: 1px solid var(--border);
        border-right: none;
        border-top: none;
        border-bottom: none;
        box-shadow: none;
        flex-direction: column;
        scrollbar-width: thin;
        scrollbar-color: var(--border) transparent;
    }
    .filters-sidebar.browse-filters-open {
        display: flex;
        transform: translateX(0);
        box-shadow: -4px 0 40px rgba(0,0,0,.5);
    }
    .filters-panel-head { display: flex; }
    #browse-results { order: 0; }

    /* Anime grid styles moved to mobile.css for proper cascade */
    /* .anime-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; } */
    /* .anime-grid-related { grid-template-columns: repeat(3, 1fr); gap: 8px; } */
    .episode-grid { grid-template-columns: repeat(4, 1fr); }

    .footer-grid { grid-template-columns: 1fr; gap: 24px; padding: 32px 0 24px; }
    .footer-stats { flex-wrap: wrap; }
    .footer-stat { flex: 1 1 33%; border-right: none; border-bottom: 1px solid var(--border); }
    .footer-stat:last-child { border-bottom: none; }
    .footer-tagline { max-width: 100%; }
    .footer-bottom { flex-direction: column; align-items: flex-start; gap: 6px; }

    .container { padding: 0 5px; }

    .episode-list-section { padding: 16px; margin: 0; border-radius: 0; border-left: 0; border-right: 0; }

   
    /* Episode page responsive */
    .ep-page-inner { grid-template-columns: 1fr; }
    .ep-main { border-right: none; }
    .ep-sidebar {
        position: static;
        height: auto;
        overflow-y: visible;
        max-height: 420px;
        border-top: 1px solid var(--border);
    }
    .ep-sidebar-list { max-height: 320px; overflow-y: auto; }
    .ep-controls-bar { padding: 8px 12px; }
    .ep-info-block { padding: 16px 14px 14px; }
    .ep-related { padding: 24px 14px; }

        
}

@media (max-width: 420px) {
    .anime-poster-img {
        width: 92px;
        margin-top: -74px;
    }
    .anime-poster-col > .watchlist-btn,
    .anime-poster-col > .btn-share { min-height: 36px; font-size: 0.8rem; }
    .stat-row { min-width: 82px; padding: 2px 8px; }
    .stat-label { font-size: 0.56rem; }
    .stat-value { font-size: 0.72rem; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    :root { --sidebar-width: 220px; }
    /* Anime grid styles now managed in mobile.css for consistent cascade */
    /* .anime-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } */
    /* .anime-grid-related { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; } */
    .browse-layout { grid-template-columns: 1fr 220px; }
    .site-footer { margin-left: var(--sidebar-width); }
    body.ha-layout-wide .site-footer { margin-left: 0; }
}

/* ============================================================
   AD SLOT WRAPPERS (frontend)
   ============================================================ */
.ha-ad-slot {
    text-align: center;
    margin: 28px 0;
    overflow: hidden;
    line-height: 0;           /* collapse whitespace around ad units */
    min-height: 0;            /* collapses when empty content is returned */
}

/* Full-width leaderboard style slots */
.ha-ad-slot--home_after_hero,
.ha-ad-slot--home_between_sections,
.ha-ad-slot--browse_above_grid,
.ha-ad-slot--browse_below_grid {
    margin-left: auto;
    margin-right: auto;
    max-width: 970px;
}

/* Inline / narrower slots inside single page content columns */
.ha-ad-slot--anime_below_synopsis,
.ha-ad-slot--anime_after_episodes,
.ha-ad-slot--episode_below_player,
.ha-ad-slot--episode_below_servers,
.ha-ad-slot--post_before_content,
.ha-ad-slot--post_after_content {
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================
   COMMENT SINGLE PAGE (.ha-csp-*)
   ============================================================ */
.ha-csp-page {
    padding-top: 36px;
    padding-bottom: 80px;
    margin-left: auto;
    margin-right: auto;
}

/* Breadcrumb */
.ha-csp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.ha-csp-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}
.ha-csp-breadcrumb a:hover { color: var(--accent-primary); }

/* Post context card */
.ha-csp-post-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-lg, 12px);
    text-decoration: none;
    margin-bottom: 18px;
    transition: background 0.15s, border-color 0.15s;
}
.ha-csp-post-card:hover { background: rgba(var(--accent-rgb), 0.06); }
.ha-csp-post-thumb {
    width: 54px;
    height: 76px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}
.ha-csp-post-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}
.ha-csp-post-type {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 700;
    color: var(--accent-primary);
}
.ha-csp-post-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ha-csp-post-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Parent comment context card (shown when viewed comment is a reply) */
.ha-csp-parent-card {
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-surface);
    overflow: hidden;
}
.ha-csp-parent-label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.ha-csp-parent-body {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    transition: background 0.15s;
}
.ha-csp-parent-body:hover { background: rgba(var(--accent-rgb), 0.05); }
.ha-csp-parent-avatar-wrap { position: relative; flex-shrink: 0; }
.ha-csp-parent-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    border: 1px solid var(--border);
    display: block !important;
}
.ha-csp-parent-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ha-csp-parent-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ha-csp-parent-author {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}
.ha-csp-parent-snippet {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ha-csp-parent-view {
    font-size: 1rem;
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 1;
}

/* Rich anime/episode context card */
.ha-csp-anime-card {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-lg, 12px);
    margin-bottom: 18px;
}
.ha-csp-anime-poster-wrap {
    position: relative;
    flex-shrink: 0;
}
.ha-csp-anime-poster {
    width: 80px;
    height: 112px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}
.ha-csp-score-badge {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.72);
    color: #facc15;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 2px 6px;
    border-radius: 999px;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}
.ha-csp-anime-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ha-csp-anime-parent-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    transition: color 0.15s;
}
.ha-csp-anime-parent-link:hover { color: var(--accent-primary); }
.ha-csp-anime-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    transition: color 0.15s;
}
.ha-csp-anime-title:hover { color: var(--accent-primary); }
.ha-csp-anime-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.ha-csp-status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent-primary);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
}
.ha-csp-status-finished-airing  { background: rgba(100,200,100,0.12); color: #4ade80; border-color: rgba(100,200,100,0.25); }
.ha-csp-status-currently-airing { background: rgba(250,204,21,0.12);  color: #facc15; border-color: rgba(250,204,21,0.25); }
.ha-csp-status-not-yet-aired    { background: rgba(148,163,184,0.12); color: #94a3b8; border-color: rgba(148,163,184,0.25); }
.ha-csp-type-pill,
.ha-csp-tag-pill {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.ha-csp-audio-pill { color: var(--text-secondary); }
.ha-csp-filler-pill { color: #fb923c; background: rgba(251,146,60,0.1); border-color: rgba(251,146,60,0.25); }
.ha-csp-recap-pill  { color: #a78bfa; background: rgba(167,139,250,0.1); border-color: rgba(167,139,250,0.25); }
.ha-csp-ep-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.78rem;
}
.ha-csp-ep-num {
    font-weight: 700;
    color: var(--text-secondary);
}
.ha-csp-ep-subtitle {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.ha-csp-ep-duration {
    color: var(--text-muted);
    white-space: nowrap;
}
.ha-csp-ep-duration::before { content: '· '; }
.ha-csp-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.ha-csp-genre-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 600;
    background: rgba(var(--accent-rgb), 0.07);
    color: rgba(var(--accent-rgb), 0.9);
    border: 1px solid rgba(var(--accent-rgb), 0.18);
}
.ha-csp-view-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-decoration: none;
    margin-top: 2px;
    transition: color 0.15s;
}
.ha-csp-view-link:hover { color: var(--accent-glow); text-decoration: underline; }

/* Main comment card */
.ha-csp-comment-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    padding: 20px;
    margin-bottom: 24px;
}
.ha-csp-comment-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}
.ha-csp-avatar-wrap { position: relative; flex-shrink: 0; }
.ha-csp-avatar {
    width: 52px !important;
    height: 52px !important;
    border-radius: 12px !important;
    border: 2px solid var(--border);
    display: block !important;
}
.ha-csp-comment-meta { flex: 1; min-width: 0; }
.ha-csp-meta-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.ha-csp-author { font-weight: 800; font-size: 1rem; }
.ha-csp-time {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
}
.ha-csp-share-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.ha-csp-share-btn:hover {
    color: var(--accent-primary);
    border-color: rgba(var(--accent-rgb), 0.4);
    background: rgba(var(--accent-rgb), 0.08);
}
.ha-csp-comment-body {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 16px;
}
.ha-csp-comment-body p { margin: 0 0 0.75em; }
.ha-csp-comment-body p:last-child { margin-bottom: 0; }
.ha-csp-reactions {
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Replies section */
.ha-csp-replies-section { margin-bottom: 24px; }
.ha-csp-replies-header { margin-bottom: 12px; }
.ha-csp-replies-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-secondary);
}
.ha-csp-reply-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ha-csp-no-replies {
    font-size: 0.875rem;
    color: var(--text-muted);
    padding: 16px 0;
    text-align: center;
}

/* Reply form wrapper */
.ha-csp-reply-wrap {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    padding: 20px;
}
.ha-csp-reply-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 14px;
}
.ha-csp-user-info { margin-bottom: 0; border-radius: 8px 8px 0 0; }
.ha-csp-form .ha-comment-textarea { min-height: 90px; }
.ha-csp-login-notice {
    padding: 16px;
    background: rgba(var(--accent-rgb), 0.06);
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
}
.ha-csp-login-notice a { color: var(--accent-primary); }

@media (max-width: 767px) {
    .ha-csp-page { padding-top: 20px; }
    .ha-csp-post-thumb { width: 44px; height: 62px; }
    .ha-csp-avatar { width: 42px !important; height: 42px !important; }
    .ha-csp-comment-card,
    .ha-csp-reply-wrap { padding: 14px; }
}

/* ============================================================
   COMMUNITY PAGE
   ============================================================ */
.ha-community-page {
    padding-top: 48px;
    padding-bottom: 80px;
}

/* Header */
.ha-community-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}

.ha-community-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    margin: 0 0 8px;
    line-height: 1.1;
}

.ha-community-subtitle {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
}

.ha-community-stats {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.ha-stat-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 18px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    min-width: 84px;
}

.ha-stat-num {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-primary);
    line-height: 1;
}

.ha-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 3px;
}

/* ── Search + filter bar ─────────────────────────────────── */
.ha-community-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 14px 18px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
}

.ha-community-search-wrap {
    flex: 1 1 200px;
    min-width: 140px;
    position: relative;
    display: flex;
    align-items: center;
}

.ha-community-search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.ha-community-search-input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ha-community-search-input:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb), 0.5);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.ha-community-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.ha-community-filter-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.ha-community-select {
    padding: 7px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 0.15s;
}

.ha-community-select:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb), 0.5);
}

.ha-community-filter-btn {
    padding: 7px 16px;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.ha-community-clear-btn {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
    padding: 6px 4px;
}

.ha-community-clear-btn:hover { color: var(--text-primary); }

.ha-community-result-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 14px;
}

/* ── Forum list ────────────────────────────────────────────── */
.ha-community-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}

/* Row */
.ha-community-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
    text-decoration: none;
    color: inherit;
}

.ha-community-row:last-child { border-bottom: none; }

.ha-community-row:hover { background: rgba(var(--accent-rgb), 0.03); }

/* Row — avatar column */
.ha-community-row-avatar {
    flex-shrink: 0;
}

.ha-community-avatar-wrap {
    position: relative;
    display: inline-block;
}

.ha-community-avatar {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.ha-community-avatar-wrap .ha-comment-badge-icon {
    width: 16px;
    height: 16px;
    bottom: -4px;
    right: -4px;
}

/* Row — content column */
.ha-community-row-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Row — meta line */
.ha-community-row-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 0.8rem;
    line-height: 1.3;
}

.ha-community-row-author {
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.ha-community-row-author:hover { color: var(--accent-primary); }

.ha-community-rep {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.72rem;
    color: var(--accent-primary);
    font-weight: 700;
    opacity: 0.8;
}

.ha-community-time {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.ha-community-row-sep {
    color: var(--text-muted);
    opacity: 0.5;
    font-size: 0.7rem;
}

.ha-community-row-post-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ha-community-row-post-link:hover { color: var(--accent-primary); }

.ha-community-pt-chip {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(var(--accent-rgb), 0.08);
    color: rgba(var(--accent-rgb), 0.9);
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Row — excerpt */
.ha-community-row-excerpt {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ha-community-read-more {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.8rem;
    white-space: nowrap;
}

.ha-community-read-more:hover { text-decoration: underline; }

/* Row — footer */
.ha-community-row-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 2px;
}

.ha-community-row-replies,
.ha-community-row-reactions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ha-community-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-decoration: none;
    margin-left: auto;
    padding: 3px 9px;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: 999px;
    transition: background 0.12s, border-color 0.12s;
}

.ha-community-view-btn:hover {
    background: rgba(var(--accent-rgb), 0.08);
    border-color: rgba(var(--accent-rgb), 0.5);
}

/* Pagination */
.ha-community-pagination {
    margin-top: 32px;
    text-align: center;
}

/* Empty state */
.ha-community-empty {
    text-align: center;
    padding: 80px 20px;
}

.ha-community-empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.ha-community-empty p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

@media (max-width: 767px) {
    .ha-community-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 24px;
    }
    .ha-community-stats {
        width: 100%;
    }
    .ha-stat-pill {
        flex: 1;
    }
    .ha-community-filters {
        gap: 8px;
        padding: 12px;
    }
    .ha-community-filter-group {
        flex-wrap: wrap;
    }
    .ha-community-row {
        padding: 12px 14px;
        gap: 10px;
    }
    .ha-community-row-post-link {
        max-width: 160px;
    }
    .ha-community-row-sep,
    .ha-community-rep { display: none; }
}

/* ============================================================
   USER PROFILE PAGE
   ============================================================ */
.ha-profile-page {
    margin: 0 auto;
    padding-top: 48px;
    padding-bottom: 80px;
}

/* ── Profile header ──────────────────────────────────────── */
.ha-profile-header {
    display: flex;
    align-items: flex-start;
    gap: 22px;
    padding: 28px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    margin-bottom: 32px;
    position: relative;
}

.ha-profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.ha-profile-avatar {
    display: block;
    width: 96px;
    height: 96px;
    border-radius: 18px;
    border: 2px solid var(--border);
    object-fit: cover;
}

.ha-profile-badge-icon {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    background: var(--bg-elevated);
    border-radius: 50%;
    padding: 2px;
    box-shadow: 0 0 0 2px var(--bg-elevated);
}

.ha-profile-info {
    flex: 1;
    min-width: 0;
}

.ha-profile-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.ha-profile-name {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
}

.ha-profile-tier {
    font-size: 0.72rem;
    padding: 3px 10px;
}

.ha-profile-bio {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 14px;
    line-height: 1.6;
}

.ha-profile-stats-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.ha-profile-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ha-profile-stat-num {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.ha-profile-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ha-profile-edit-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    text-decoration: none;
    transition: all 0.15s;
}

.ha-profile-edit-btn:hover {
    color: var(--accent-primary);
    border-color: rgba(var(--accent-rgb), 0.4);
    background: rgba(var(--accent-rgb), 0.06);
}

/* ── Tabs ─────────────────────────────────────────────────── */
.ha-profile-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.ha-profile-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.ha-profile-tab:hover {
    color: var(--text-primary);
}

.ha-profile-tab.is-active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.ha-profile-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.1);
    color: rgba(var(--accent-rgb), 0.9);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0;
}

/* ── Tab panels ──────────────────────────────────────────── */
.ha-profile-tab-panel {
    min-height: 200px;
}

.ha-profile-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 0.9rem;
}

/* ── Badges grid ─────────────────────────────────────────── */
.ha-profile-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.ha-profile-badge-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ha-profile-badge-card.is-unlocked {
    border-color: rgba(var(--accent-rgb), 0.3);
    box-shadow: 0 2px 12px rgba(var(--accent-rgb), 0.07);
}

.ha-profile-badge-card.is-locked {
    opacity: 0.5;
    filter: grayscale(0.6);
}

.ha-profile-tier-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent-primary);
}

.ha-profile-badge-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ha-profile-badge-name {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-primary);
}

.ha-profile-badge-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.ha-profile-badge-earned {
    font-size: 0.72rem;
    font-weight: 700;
    color: #4ade80;
    margin-top: 4px;
}

.ha-profile-badge-progress-wrap {
    height: 4px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
}

.ha-profile-badge-progress-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.ha-profile-badge-pct {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Edit profile form ───────────────────────────────────── */
.ha-profile-edit-form {
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ha-profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ha-profile-field label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.ha-profile-bio-input {
    resize: vertical;
    min-height: 80px;
}

.ha-profile-field-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.ha-profile-submit-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.ha-profile-message {
    font-size: 0.85rem;
}

.ha-profile-save-btn.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

@media (max-width: 767px) {
    .ha-profile-page { padding-top: 24px; }
    .ha-profile-header {
        flex-wrap: wrap;
        padding: 18px;
        gap: 14px;
    }
    .ha-profile-edit-btn {
        position: static;
        align-self: flex-start;
        margin-top: 4px;
    }
    .ha-profile-name { font-size: 1.2rem; }
    .ha-profile-tab { padding: 8px 12px; font-size: 0.8rem; }
    .ha-profile-badges-grid { grid-template-columns: 1fr; }
    .ha-community-list { border-radius: 0; border-left: none; border-right: none; }
}

/* ============================================================
   SINGLE POST MOBILE RESPONSIVENESS
   ============================================================ */
@media (max-width: 1023px) {
    .single-post-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .single-post-sidebar {
        position: static;
    }
}

@media (max-width: 767px) {
    .single-post-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .single-post-sidebar {
        position: static;
        top: auto;
    }
    .sidebar-widget {
        margin-bottom: 16px;
    }
    .pop-rank-widget .pop-rank-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    .pop-rank-tab {
        flex: 0 1 auto;
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    .pop-rank-item {
        padding: 10px 0;
    }
}