:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-rgb: 37,99,235;
    --secondary: #7c3aed;
    --bg: #ffffff;
    --bg-surface: #f8fafc;
    --bg-card: #ffffff;
    --bg-dark: #0f172a;
    --bg-darker: #0f172a;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --radius: 8px;
    --radius-lg: 12px;
    --card-gap: 4px;
    --card-radius: var(--radius-lg);
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --max-width: 1800px;
    --logo-h: 36px;
    --logo-h-mobile: 28px;
    --header-mid-height: 64px;
    --header-vtype-height: 0px;
    --header-nav-height: 44px;
    --header-height: calc(var(--header-mid-height) + var(--header-vtype-height) + var(--header-nav-height));
    --grid-cols: 5;
    --cat-cols: 5;
    --perf-cols: 5;
    --channel-cols: 5;
    --app-bottom-inset: 0px;
}

/* ========== DARK MODE ========== */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-surface: #020617;
    --bg-card: #1e293b;
    --bg-dark: #020617;
    --bg-darker: #020617;
    --primary-light: rgba(37,99,235,0.15);
    --text: #f1f5f9;
    --text-muted: #b8c5d4;
    --text-light: #8899ab;
    --border: #334155;
    --border-light: #1e293b;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    color-scheme: dark;
}
[data-theme="dark"] img { opacity: 0.92; }
[data-theme="dark"] .video-card__thumb img,
[data-theme="dark"] .video-player img,
[data-theme="dark"] .video-player video { opacity: 1; }
[data-theme="dark"] .header__logo img { opacity: 1; }
[data-theme="dark"] .footer__logo img { opacity: 1; }
/* Single logo fallback: invert in dark mode */
[data-theme="dark"] .header__logo-only { filter: brightness(0) invert(1); }
/* Dual logos: toggle visibility */
/* Dual logos: stack in same space, toggle with visibility (no layout shift) */
.header__logo-light, .header__logo-dark { grid-area: 1 / 1; }
.header__logo-dark, .auth-modal__logo-dark { visibility: hidden; }
[data-theme="dark"] .header__logo-dark, [data-theme="dark"] .auth-modal__logo-dark { visibility: visible; }
[data-theme="dark"] .header__logo-light, [data-theme="dark"] .auth-modal__logo-light { visibility: hidden; }
[data-theme="dark"] .sort-tabs a.active { background: var(--primary); color: #fff; }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea { color-scheme: dark; }
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s !important;
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-surface);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Global select styling */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--container-padding, 24px); }
main.container { padding-top: 24px; padding-bottom: 24px; }

/* ========== TOP BAR ========== */
.topbar {
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    line-height: 1;
}
.topbar__inner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 6px;
    padding-bottom: 6px;
    flex-wrap: wrap;
}
.topbar__text {
    opacity: 0.9;
    white-space: nowrap;
}
.topbar__text + .topbar__link::before {
    content: '\00b7';
    margin-right: 6px;
    opacity: 0.5;
}
.topbar__link {
    color: inherit;
    text-decoration: none;
    opacity: 0.85;
    white-space: nowrap;
    transition: opacity 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.topbar__link i { font-size: 11px; }
.topbar__link:hover { opacity: 1; }
.topbar__link + .topbar__link::before {
    content: '\00b7';
    margin-right: 6px;
    opacity: 0.5;
}
@media (max-width: 768px) {
    .topbar { font-size: 11px; }
    .topbar__inner { gap: 4px; padding-top: 5px; padding-bottom: 5px; }
}

/* ========== HEADER ========== */
.header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* -- Logo group (burger + logo) -- */
.header__logo-group {
    display: flex;
    align-items: center;
    gap: 0;
}

/* -- Scroll burger (hidden by default, shown when scrolled) -- */
.header__scroll-burger {
    display: none;
    width: 0;
    overflow: hidden;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    color: var(--text);
    flex-shrink: 0;
    transition: width 0.25s ease, margin 0.25s ease, opacity 0.2s ease;
    opacity: 0;
}
.header__scroll-burger i { font-size: 22px; pointer-events: none; }
.header__scroll-burger:hover { color: var(--primary); }

/* -- Scrolled state: show burger, hide nav -- */
.header--scrolled .header__scroll-burger {
    display: flex;
    width: 40px;
    margin-right: 14px;
    opacity: 1;
}
body.header-scrolled .scroll-sidebar { display: block; }

/* Nav hidden on scroll — no transition to prevent height oscillation */
.header--scrolled .header-nav {
    display: none;
}
@media (min-width: 769px) {
    .header--scrolled.header--has-vtype {
        --header-nav-height: 0px;
    }
}

/* ========== SCROLL SIDEBAR ========== */
.scroll-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    pointer-events: none;
}
.scroll-sidebar.open {
    pointer-events: auto;
}
.scroll-sidebar__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.scroll-sidebar.open .scroll-sidebar__backdrop {
    opacity: 1;
}
.scroll-sidebar__panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--bg);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.scroll-sidebar.open .scroll-sidebar__panel {
    transform: translateX(0);
}
.scroll-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.scroll-sidebar__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.scroll-sidebar__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-surface);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}
.scroll-sidebar__close:hover {
    background: var(--primary);
    color: #fff;
}
.scroll-sidebar__links {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.scroll-sidebar__links a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}
.scroll-sidebar__links a:hover {
    color: var(--text);
    background: var(--bg-surface);
}
.scroll-sidebar__links a.active {
    color: var(--primary);
    background: var(--bg-surface);
}
.scroll-sidebar__links a .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 13px;
    opacity: 0.6;
}
.scroll-sidebar__links a:hover .nav-icon,
.scroll-sidebar__links a.active .nav-icon {
    opacity: 1;
}
.scroll-sidebar__child {
    padding-left: 36px !important;
    font-size: 13px !important;
    opacity: 0.85;
}
.scroll-sidebar__child::before {
    content: '';
    position: absolute;
    left: 22px;
    top: 50%;
    width: 6px;
    height: 1px;
    background: var(--text-muted);
    opacity: 0.3;
}
.scroll-sidebar__links .scroll-sidebar__child { position: relative; }

/* Sidebar vtype switcher — pill buttons side by side */
.scroll-sidebar__vtype {
    display: flex;
    gap: 6px;
    padding: 16px 12px 8px;
}
.scroll-sidebar__vtype-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 2px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.scroll-sidebar__vtype-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--pill-color);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.scroll-sidebar__vtype-pill:hover {
    border-color: var(--pill-color);
    color: var(--text);
}
.scroll-sidebar__vtype-pill:hover::before {
    opacity: 0.08;
}
.scroll-sidebar__vtype-pill.active {
    background: var(--pill-color);
    color: #fff;
    border-color: var(--pill-color);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--pill-color) 40%, transparent);
}
.scroll-sidebar__vtype-pill.active::before {
    opacity: 0;
}
.scroll-sidebar__vtype-icon {
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 1;
}
.scroll-sidebar__vtype-pill span {
    position: relative;
    z-index: 1;
}

/* -- Zone 2: Middle bar (Logo / Search / Actions) -- */
.header-mid {
    height: var(--header-mid-height);
}

.header-mid__inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    height: 100%;
    gap: 24px;
}

.header-mid__center {
    display: flex;
    justify-content: center;
}

.header__logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-grid;
    align-items: center;
}
.header__logo-img {
    height: var(--logo-h);
    max-width: 220px;
    object-fit: contain;
    vertical-align: middle;
}
.header__logo span { color: var(--primary); }
.header__logo:hover { color: var(--text); }

/* -- Zone 3: Navigation bar -- */
.header-nav {
    height: var(--header-nav-height);
    border-top: 1px solid var(--border-light);
}

.header-nav__inner {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 2px;
}

.header-nav__inner > a,
.header__nav-dropdown > a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 14px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    position: relative;
}

.header-nav__inner > a:hover,
.header-nav__inner > a.active,
.header__nav-dropdown > a:hover,
.header__nav-dropdown > a.active {
    color: var(--text);
    background: var(--bg-surface);
}

.header-nav__inner > a.active,
.header__nav-dropdown > a.active {
    color: var(--primary);
}

/* Nav menu icons (FA) */
.header-nav__inner .nav-icon {
    font-size: 13px;
    opacity: 0.6;
    width: 16px;
    text-align: center;
}
.header-nav__inner a:hover .nav-icon,
.header-nav__inner a.active .nav-icon {
    opacity: 1;
}
.mobile-nav__links .nav-icon {
    font-size: 14px;
    opacity: 0.5;
    width: 18px;
    text-align: center;
    margin-right: 4px;
}

/* Video type dropdown */
.vtype-dd {
    margin-left: auto;
}
.vtype-dd .header__nav-submenu {
    left: auto;
    right: 0;
}
.vtype-dd__trigger {
    cursor: pointer;
}
.vtype-dd__icon {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
}
.vtype-dd__icon--hetero { color: #4a90d9; }
.vtype-dd__icon--gay { color: #b44adb; }
.vtype-dd__icon--hentai { color: #e84393; }
.header__nav-submenu a.active .vtype-dd__icon--hetero,
.vtype-dd__mob-link.active .vtype-dd__icon--hetero { color: #4a90d9; }
.header__nav-submenu a.active .vtype-dd__icon--gay,
.vtype-dd__mob-link.active .vtype-dd__icon--gay { color: #b44adb; }
.header__nav-submenu a.active .vtype-dd__icon--hentai,
.vtype-dd__mob-link.active .vtype-dd__icon--hentai { color: #e84393; }
/* Full-width nav: push switcher to far right */
.header-nav--full .vtype-dd {
    margin-left: auto;
}
/* Mobile: icon + label links */
.vtype-dd__mob-link {
    display: flex;
    align-items: center;
    gap: 10px;
}
.vtype-dd__mob-link .vtype-dd__icon {
    width: 18px;
    text-align: center;
    font-size: 15px;
}

/* ========== VIDEO TYPE SEGMENTED BAR (Plan F) ========== */
.header--has-vtype {
    --header-vtype-height: 48px;
}
.header-vtype-seg {
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
    padding: 6px var(--container-padding, 24px);
}
.header-vtype-seg__bar {
    width: 100%;
}
.header-vtype-seg__track {
    display: grid;
    grid-template-columns: repeat(var(--vtype-count, 3), minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    max-width: 560px;
    margin: 0 auto;
}
.header-vtype-seg__bar:not(.container) .header-vtype-seg__track {
    max-width: none;
}
.header-vtype-seg__item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.header-vtype-seg__item:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .header-vtype-seg__item:hover {
    background: rgba(255, 255, 255, 0.06);
}
.header-vtype-seg__item.active {
    background: var(--bg);
    color: var(--vtype-color, var(--primary));
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    font-weight: 600;
}
[data-theme="dark"] .header-vtype-seg__item.active {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.header-vtype-seg__item--hetero.active { color: #4a90d9; }
.header-vtype-seg__item--gay.active { color: #b44adb; }
.header-vtype-seg__item--lesbian.active { color: #ff6b9d; }
.header-vtype-seg__item--trans.active { color: #26a69a; }
.header-vtype-seg__item--hentai.active { color: #e84393; }
.header-vtype-seg__item--manga.active { color: #f39c12; }
.header-vtype-seg__icon {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0.85;
}
.header-vtype-seg__item.active .header-vtype-seg__icon {
    opacity: 1;
    color: inherit;
}
.header-vtype-seg__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nav dropdowns (sub-menus) */
.header__nav-dropdown {
    position: relative;
}
.header__nav-dropdown > a .nav-chevron {
    font-size: 9px;
    opacity: 0.5;
    margin-left: 4px;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}
.header__nav-dropdown:hover > a .nav-chevron {
    transform: rotate(180deg);
    opacity: 0.85;
}
.header__nav-submenu {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    min-width: 100%;
    width: max-content;
    padding: 0 0 4px 0;
    z-index: 100;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    overflow: hidden;
}
.header__nav-dropdown:hover .header__nav-submenu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}
/* Active indicator line under tab when dropdown is open */
.header__nav-dropdown > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.25s ease;
}
.header__nav-dropdown:hover > a::after {
    transform: scaleX(1);
}
.header__nav-submenu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.12s, background 0.12s;
}
.header__nav-submenu a:hover {
    background: var(--bg-surface);
    color: var(--text);
}
.header__nav-submenu a.active {
    color: var(--primary);
    background: var(--bg-surface);
}

/* Mobile nav sub-items */
.mobile-nav__links .mobile-nav__child {
    padding-left: 44px;
    font-size: 14px;
    opacity: 0.75;
    position: relative;
}
.mobile-nav__links .mobile-nav__child::before {
    content: '';
    position: absolute;
    left: 28px;
    top: 50%;
    width: 6px;
    height: 1px;
    background: var(--text-muted);
    opacity: 0.3;
}

[dir="rtl"] .header__nav-submenu { left: auto; right: 0; }
[dir="rtl"] .mobile-nav__links .mobile-nav__child { padding-left: 12px; padding-right: 44px; }
[dir="rtl"] .mobile-nav__links .mobile-nav__child::before { left: auto; right: 28px; }

/* -- Mega-menu (categories) -- */
.header-nav__inner { position: relative; }

.header-nav__bar {
    display: flex;
    align-items: stretch;
    height: 100%;
    gap: 0;
}

.header-nav__more {
    display: none;
    flex-shrink: 0;
    align-items: center;
}

.header__nav-more {
    display: flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius);
    background: none;
    cursor: pointer;
    padding: 0;
    color: var(--text);
    flex-shrink: 0;
    transition: background 0.15s;
}
.header__nav-more:hover { background: var(--bg-surface); }
.header__nav-more i { pointer-events: none; width: 22px; height: 22px; font-size: 22px; }

.header-nav__item--hidden { display: none !important; }

.mobile-nav__links--overflow:empty,
.mobile-nav__links--submenus:not(:has(a)) { display: none !important; }

.header__nav-dropdown--mega { position: static; }
.header__mega-menu {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: 0 8px 20px -4px rgba(0,0,0,0.15);
    padding: 0;
    z-index: 100;
    overflow: hidden;
    transform: translateY(-6px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}
/* Full-width nav: inset by container padding so mega-menu aligns with nav items */
.header-nav--full .header__mega-menu {
    left: var(--container-padding, 24px);
    right: var(--container-padding, 24px);
}
.header__nav-dropdown--mega:hover .header__mega-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}
/* Two-column layout */
.mega-menu__wrap {
    display: flex;
    min-height: 280px;
}
/* Left sidebar */
.mega-menu__sidebar {
    flex: 0 0 260px;
    padding: 24px 20px 24px 20px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.mega-menu__title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: normal;
    color: var(--text);
    margin: 0 12px 16px;
    padding: 0 0 12px;
    text-align: left;
    border-bottom: 2px solid var(--primary);
}
.mega-menu__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}
.mega-menu__nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--radius);
    align-self: flex-start;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}
.mega-menu__nav-link:hover {
    color: var(--text);
    background: var(--bg-surface);
}
.mega-menu__nav-link.active {
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
    font-weight: 600;
}
.mega-menu__nav-icon {
    width: 16px;
    font-size: 12px;
    text-align: center;
    flex-shrink: 0;
}
.mega-menu__nav-link.active .mega-menu__nav-icon {
    color: var(--primary);
}
.mega-menu__nav-arrow {
    margin-left: auto;
    font-size: 10px;
    opacity: 0.4;
    transition: transform 0.15s, opacity 0.15s;
}
.mega-menu__nav-link:hover .mega-menu__nav-arrow {
    transform: translateX(2px);
    opacity: 0.8;
}
/* Right content */
.mega-menu__content {
    flex: 1;
    min-width: 0;
    padding: 20px 20px 20px 24px;
}
.mega-menu__heading {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    padding-bottom: 12px;
    margin: 0 0 14px;
    border-bottom: 2px solid var(--border);
}
.mega-menu__grid {
    display: grid;
    grid-template-columns: repeat(var(--cat-cols), 1fr);
    gap: var(--card-gap, 4px);
    overflow: hidden;
    grid-template-rows: 1fr;
    grid-auto-rows: 0;
}
.mega-menu__heading--spaced {
    margin-top: 20px;
}
/* When CTR is off: show 2 rows */
.mega-menu__content--2rows .mega-menu__grid {
    grid-template-rows: 1fr 1fr;
    grid-auto-rows: 0;
}
.mega-menu__item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/10;
    background: var(--bg-dark);
    display: block;
}
.mega-menu__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s, opacity 0.3s;
}
@media (hover: hover) {
    .mega-menu__item:hover img {
        transform: scale(1.06);
        opacity: 0.85;
    }
}
.mega-menu__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-surface);
}
.mega-menu__name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 18px 8px 5px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mega-menu__count {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1.3;
}

/* -- Full-width navigation variant -- */
.header-nav--full .header-nav__bar {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding, 24px);
}
.header-nav--full .header-nav__inner {
    align-items: stretch;
    gap: 0;
}
.header-nav--full .header-nav__inner > a,
.header-nav--full .header__nav-dropdown:not(.vtype-dd) {
    flex: 1;
    justify-content: center;
    text-align: center;
}
.header-nav--full .header__nav-dropdown {
    display: flex;
}
.header-nav--full .header-nav__inner > a,
.header-nav--full .header-nav__inner > .header__nav-dropdown > a {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    padding-top: 0;
    padding-bottom: 0;
    width: 100%;
}
.header__search {
    position: relative;
    width: 100%;
    max-width: 480px;
}

.header__search input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    background: var(--bg-surface);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.header__search input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.header__search svg,
.header__search > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
    font-size: 14px;
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    justify-self: end;
}

/* Theme icon visibility (used by mobile nav) */
.header__theme-icon--dark { display: none; }
[data-theme="dark"] .header__theme-icon--light { display: none; }
[data-theme="dark"] .header__theme-icon--dark { display: inline; }

/* ========== UNIFIED DROPDOWN (udd__) ========== */
.udd { position: relative; flex-shrink: 0; }

.udd__trigger {
    display: flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--text);
    cursor: pointer;
    padding: 0;
    font-size: 32px;
    transition: background 0.15s, color 0.15s;
}
.udd__trigger:hover {
    color: var(--primary);
}
.udd__trigger--auth { color: var(--primary); }

.udd__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    overflow: hidden;
    animation: uddFadeIn 0.15s ease;
}
.udd.open .udd__dropdown { display: block; }

@keyframes uddFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.udd__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.udd__avatar {
    font-size: 28px;
    color: var(--text-muted);
    line-height: 1;
}
.udd__username {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sections */
.udd__section {
    padding: 6px;
    border-bottom: 1px solid var(--border);
}
.udd__section:last-child { border-bottom: none; }

/* Links */
.udd__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.udd__link i {
    width: 16px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.udd__link:hover {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
}
.udd__link:hover i { color: var(--primary); }

/* Danger link (logout) */
.udd__link--danger { color: var(--danger); }
.udd__link--danger i { color: var(--danger); opacity: 0.7; }
.udd__link--danger:hover { background: rgba(220,38,38,0.08); color: var(--danger); }

/* Auth buttons (logged out) */
.udd__auth-buttons {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
}
.udd__btn {
    flex: 1;
    height: 34px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}
.udd__btn:hover { opacity: 0.85; }
.udd__btn--primary {
    background: var(--primary);
    color: #fff;
}
.udd__btn--outline {
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Appearance row */
.udd__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
}
.udd__row > i {
    font-size: 14px;
    color: var(--text-muted);
    opacity: 0.6;
    width: 16px;
    text-align: center;
}
.udd__row-label {
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
}

/* Segmented theme toggle */
.udd__seg {
    position: relative;
    display: flex;
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 2px;
    gap: 0;
}
.udd__seg-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}
.udd__seg-btn.active { color: var(--primary); }
.udd__seg-indicator {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 32px;
    height: 28px;
    background: var(--bg-card);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    z-index: 0;
}
.udd__seg[data-active="dark"] .udd__seg-indicator {
    transform: translateX(32px);
}
[dir="rtl"] .udd__seg[data-active="dark"] .udd__seg-indicator {
    transform: translateX(-32px);
}

/* Section label */
.udd__section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 6px 10px 4px;
}

/* Language grid */
.udd__lang-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    max-height: 200px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.udd__lang-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text);
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.udd__lang-item:hover {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
}
.udd__lang-item.active {
    color: var(--primary);
    font-weight: 700;
    background: rgba(var(--primary-rgb), 0.12);
}
.udd__flag {
    width: 15px;
    height: 15px;
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

/* Logout section */
.udd__section--logout { padding: 4px 6px; }

/* Mobile icons group */
.header__mobile-icons {
    display: none;
    align-items: center;
    margin-left: auto;
}

/* Mobile menu toggle */
.header__burger {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius);
    background: none;
    cursor: pointer;
    padding: 0;
    color: var(--text);
    flex-shrink: 0;
    transition: background 0.15s;
}
.header__burger:hover { background: var(--bg-surface); }

.header__burger svg,
.header__burger i { pointer-events: none; width: 22px; height: 22px; font-size: 22px; }

/* ========== MOBILE NAV SIDEBAR ========== */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1002;
    pointer-events: none;
}

.mobile-nav.open { pointer-events: auto; }

.mobile-nav__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-nav.open .mobile-nav__backdrop { opacity: 1; }

.mobile-nav__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 85vw;
    height: 100%;
    background: var(--bg);
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mobile-nav.open .mobile-nav__panel { transform: translateX(0); }

/* User header */
.mobile-nav__user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.mobile-nav__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.mobile-nav__user-info { flex: 1; min-width: 0; }
.mobile-nav__user-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mobile-nav__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius);
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 18px;
    flex-shrink: 0;
    transition: all 0.15s;
}
.mobile-nav__close:hover {
    background: var(--bg-surface);
    color: var(--text);
}

/* Search */
.mobile-nav__search-wrap { padding: 12px 12px 4px; flex-shrink: 0; }
.mobile-nav__search { position: relative; }
.mobile-nav__search input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-surface);
    color: var(--text);
}
.mobile-nav__search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.mobile-nav__search > i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
    font-size: 14px;
}

/* Video type pills */
.mobile-nav__vtype {
    display: flex;
    gap: 6px;
    padding: 12px 12px 4px;
    flex-shrink: 0;
}
.mobile-nav__vtype-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}
.mobile-nav__vtype-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--pill-color);
    opacity: 0;
    transition: opacity 0.2s;
}
.mobile-nav__vtype-pill:hover {
    border-color: var(--pill-color);
    color: var(--text);
}
.mobile-nav__vtype-pill:hover::before { opacity: 0.08; }
.mobile-nav__vtype-pill.active {
    background: var(--pill-color);
    color: #fff;
    border-color: var(--pill-color);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--pill-color) 40%, transparent);
}
.mobile-nav__vtype-pill.active::before { opacity: 0; }
.mobile-nav__vtype-icon {
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 1;
}
.mobile-nav__vtype-pill span { position: relative; z-index: 1; }

/* Nav links */
.mobile-nav__links {
    padding: 8px 8px 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.mobile-nav__links + .mobile-nav__links {
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 4px;
}
/* Allow scrolling for all nav content */
.mobile-nav__panel > nav.mobile-nav__links { flex: 1; overflow-y: auto; }

.mobile-nav__section-label {
    padding: 10px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.mobile-nav__links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}
.mobile-nav__links a:hover { color: var(--text); background: var(--bg-surface); }
.mobile-nav__links a.active { color: var(--primary); background: var(--primary-light); }

.mobile-nav__icon {
    width: 18px;
    text-align: center;
    font-size: 15px;
    opacity: 0.55;
    flex-shrink: 0;
}
.mobile-nav__links a:hover .mobile-nav__icon,
.mobile-nav__links a.active .mobile-nav__icon { opacity: 1; }

.mobile-nav__logout { color: var(--danger, #ef4444) !important; }
.mobile-nav__logout .mobile-nav__icon { color: var(--danger, #ef4444); }

/* Bottom actions (dark mode + lang) */
.mobile-nav__bottom {
    border-top: 1px solid var(--border);
    padding: 8px;
    flex-shrink: 0;
    margin-top: auto;
}

.mobile-nav__toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius);
    background: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.mobile-nav__toggle-row:hover { background: var(--bg-surface); color: var(--text); }
.mobile-nav__toggle-row i { width: 18px; text-align: center; font-size: 15px; opacity: 0.55; }

.mobile-nav__lang-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 4px 0;
}
.mobile-nav__lang-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    transition: all 0.15s;
}
.mobile-nav__lang-item:hover { background: rgba(var(--primary-rgb), 0.08); color: var(--primary); }
.mobile-nav__lang-item.active { color: var(--primary); font-weight: 700; background: rgba(var(--primary-rgb), 0.12); }
.mobile-nav__lang-item .header__flag { width: 16px; height: 16px; border-radius: 2px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-outline { border-color: var(--border); color: var(--text-muted); background: var(--bg); }
.btn-outline:hover { border-color: var(--text-muted); color: var(--text); }

.btn-secondary { border-color: var(--border); color: var(--text-muted); background: var(--bg-surface); }
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); background: var(--bg); }

/* ========== CONFIRM DIALOG (global — auth-modal tokens) ========== */
.mo-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.mo-confirm-modal.open {
    display: flex;
}

.mo-confirm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.mo-confirm-modal__card {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    padding: 24px 28px;
    background: var(--bg-card);
    color: var(--text);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.mo-confirm-modal__title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
}

.mo-confirm-modal__message {
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-muted);
    white-space: pre-line;
}

.mo-confirm-modal__actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.mo-confirm-modal__actions .btn {
    min-width: 110px;
}

.mo-confirm-modal__pick-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.mo-confirm-modal__pick-list .btn {
    width: 100%;
    min-width: 0;
}

/* ========== RECHARGE PAY MODAL ========== */
.mo-pay-modal__card {
    width: min(100%, 480px);
    text-align: left;
}

.mo-pay-modal__channels {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.mo-pay-modal__channel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 84px;
    padding: 10px 8px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.mo-pay-modal__channel i {
    font-size: 1.5rem;
}

.mo-pay-modal__channel.is-selected {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, var(--bg-surface));
}

.mo-pay-modal__channel-label {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.mo-pay-modal__summary {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.mo-pay-modal__subtitle {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.mo-pay-modal__summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    padding: 2px 0;
}

.mo-pay-modal__account {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--primary) 6%, var(--bg));
    border: 1px dashed var(--border);
}

.mo-pay-modal__account-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.mo-pay-modal__account-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.mo-pay-modal__account-value {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-all;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--bg-card);
}

.mo-pay-modal__hint {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.mo-pay-modal__hint--muted {
    font-style: italic;
}

@media (max-width: 480px) {
    .mo-pay-modal__channels {
        grid-template-columns: 1fr;
    }
    .mo-pay-modal__channel {
        flex-direction: row;
        min-height: 0;
        justify-content: flex-start;
        padding: 12px 14px;
    }
}

/* ========== PAY CHECKOUT PAGE ========== */
.pay-checkout {
    max-width: 520px;
    margin: 32px auto 48px;
    padding: 0 16px;
}

.pay-checkout__card {
    padding: 24px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.pay-checkout__status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.pay-checkout__status.is-paid {
    color: var(--success, #16a34a);
}

.pay-checkout__amount {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 4px;
}

.pay-checkout__meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.pay-checkout__account {
    margin: 16px 0;
    padding: 14px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px dashed var(--border);
}

.pay-checkout__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.btn-sm { padding: 5px 12px; font-size: 13px; }

.btn-danger { background: var(--danger); color: #fff; }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
}

.btn-icon:hover { background: var(--bg-surface); color: var(--text); }
.btn-icon.active { color: var(--primary); border-color: var(--primary); }

/* ========== SORT TABS ========== */
.sort-tabs {
    display: flex;
    gap: 4px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sort-tabs a {
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.15s;
    white-space: nowrap;
}

.sort-tabs a:hover { color: var(--text); background: var(--bg-surface); }
.sort-tabs a.active { color: var(--bg); background: var(--text); }

/* ========== VIDEO GRID ========== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), 1fr);
    gap: var(--list-gap, var(--card-gap, 8px));
}

/* Grid column classes — set on <body> by admin setting */
body.cols-4 { --grid-cols: 4; }
body.cols-5 { --grid-cols: 5; }
body.cols-6 { --grid-cols: 6; }
body.cat-3 { --cat-cols: 3; }
body.cat-4 { --cat-cols: 4; }
body.cat-5 { --cat-cols: 5; }
body.cat-6 { --cat-cols: 6; }
body.perf-4 { --perf-cols: 4; }
body.perf-5 { --perf-cols: 5; }
body.perf-6 { --perf-cols: 6; }
body.perf-7 { --perf-cols: 7; }
body.channel-4 { --channel-cols: 4; }
body.channel-5 { --channel-cols: 5; }
body.channel-6 { --channel-cols: 6; }
body.channel-7 { --channel-cols: 7; }

/* Video Card */
.video-card {
    background: var(--bg-card);
    border-radius: var(--card-radius, var(--radius-lg));
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-light);
}

@media (hover: hover) {
    .video-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }
}

.video-card__thumb {
    position: relative;
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #1e293b;
}

.video-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

@media (hover: hover) {
    .video-card:hover .video-card__thumb img {
        transform: scale(1.05);
    }
    body.no-thumb-hover .video-card:hover .video-card__thumb img {
        transform: none;
    }
}

/* Play icon overlay */
.video-card__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    opacity: 0.75;
    transition: opacity 0.25s;
    pointer-events: none;
}

.video-card__play svg {
    width: 44px;
    height: 44px;
    color: #fff;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

@media (hover: hover) {
    .video-card:hover .video-card__play { opacity: 0; }
}
.video-card__thumb.is-previewing .video-card__play {
    opacity: 0;
}

/* Timeline sprite (hover-to-scrub) */
.video-card__sprite {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.3s;
    pointer-events: none;
}

.video-card__sprite.is-playing {
    opacity: 1;
}

/* Preview video (hover-to-play) */
.video-card__preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.3s;
    pointer-events: none;
}

.video-card__preview.is-playing {
    opacity: 1;
}

/* Hide duration badge and suppress zoom when preview is playing */
.video-card__thumb.is-previewing .video-card__duration {
    opacity: 0;
    transition: opacity 0.3s;
}

.video-card__thumb.is-previewing img {
    transform: none !important;
}

/* Progress bar under the preview */
.video-card__preview-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    z-index: 2;
    transition: width 0.2s linear;
    border-radius: 0 0 0 var(--card-radius, var(--radius-lg));
}

.video-card__duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.video-card__info {
    padding: 12px;
}

.video-card__title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.video-card__title--clamp2 {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-card__title a { color: var(--text); }
.video-card__title a:hover { color: var(--primary); }

.video-card__meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.video-card__meta span:last-child {
    font-size: 11px;
    opacity: 0.8;
}

/* ========== VIDEO PAGE ========== */
.video-page {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 28px;
    padding: 24px 0;
    align-items: start;
}
.video-page--full {
    grid-template-columns: 1fr;
}

.video-player {
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16/9;
}
.video-player iframe {
    width: 100%;
    height: 100%;
    display: block;
}

/* Info section */
.video-info {
    padding: 16px 4px 0;
}

.video-info__title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 14px;
}

.video-info__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.video-info__stats {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.video-info__stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.video-info__stat svg { opacity: 0.6; flex-shrink: 0; }

/* Channel (uploader) shown as a clickable stat next to the duration */
.video-info__stat--channel { text-decoration: none; transition: color .15s ease; }
.video-info__stat--channel:hover { color: var(--primary); }
.video-info__stat--channel:hover svg { opacity: 1; }

.video-info__actions {
    display: flex;
    gap: 8px;
}



/* Vote buttons */
.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    transition: all 0.15s;
}

.vote-btn:hover { border-color: var(--text-muted); color: var(--text); }
.vote-btn.active.like { color: var(--success); border-color: var(--success); background: #f0fdf4; }
.vote-btn.active.dislike { color: var(--danger); border-color: var(--danger); background: #fef2f2; }

/* Detail sections (performers, channels, categories, tags) */
.video-detail-section {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

.video-detail-section:first-of-type {
    border-top: none;
}

.video-detail-block {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.video-detail-block:last-child {
    margin-bottom: 0;
}

.video-detail-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    min-width: 100px;
    flex-shrink: 0;
}

.video-detail-label svg { opacity: 0.5; }

/* Performers */
.video-performers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.performer-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px 5px 5px;
    border-radius: 9999px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transition: all 0.15s;
}

.performer-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.performer-chip img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.performer-chip__initial {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

/* Channels */
.video-channels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.channel-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transition: all 0.15s;
}

.channel-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Categories */
.video-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Tags */
.video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-link {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all 0.15s;
}

.tag-link:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* Detail overflow "+N" button */
.detail-overflow { align-items: center; }
.detail-overflow__more {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px 12px; border-radius: 9999px; font-size: 12px; font-weight: 600;
    background: var(--primary); color: #fff; border: 1px solid var(--primary);
    cursor: pointer; transition: all 0.15s; min-width: 32px;
}
.detail-overflow__more:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* Embed Code Box */
.video-embed-box {
    padding: 8px 4px;
    border-bottom: 1px solid var(--border-light);
}
.video-embed-box__inner {
    display: flex;
    gap: 6px;
    align-items: center;
}
.video-embed-box__input {
    flex: 1;
    padding: 7px 10px;
    font-size: 11px;
    font-family: monospace;
    border: 1px solid var(--border, #333);
    border-radius: 6px;
    background: var(--bg-surface, #1a1a2e);
    color: var(--text-muted, #888);
    outline: none;
    cursor: text;
}
.video-embed-box__copy {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border, #333);
    border-radius: 6px;
    background: var(--bg-surface, #1a1a2e);
    color: var(--text-muted, #888);
    cursor: pointer;
    flex-shrink: 0;
}
.video-embed-box__copy:hover { color: var(--text); background: var(--bg-card); }

/* Description */
.video-description {
    padding: 14px 4px;
    border-bottom: 1px solid var(--border-light);
}

.video-description__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.video-description__text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary, var(--text-muted));
    margin: 0;
}

/* Comments login */
.comments__login {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 14px 18px;
    font-size: 14px;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

.comments__login svg { flex-shrink: 0; opacity: 0.5; }
.comments__login a { font-weight: 600; }

/* Sidebar related */
.video-sidebar h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--card-gap, 4px);
}

.related-grid .video-card__info {
    padding: 8px 10px;
}

.related-grid .video-card__title {
    font-size: 12px;
    margin-bottom: 2px;
}

.related-grid .video-card__meta {
    font-size: 11px;
}

/* ========== COMMENTS ========== */
.comments {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.comments__header {
    margin-bottom: 14px;
}

.comments__header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
}

.comments__header h3 svg { color: var(--text-muted); }

/* Comment form — YouTube-style with avatar */
.comment-form {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.comment-form__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}

.comment-form__input {
    flex: 1;
}

.comment-form textarea {
    width: 100%;
    padding: 10px 0;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 24px;
    overflow: hidden;
    background: transparent;
    color: var(--text);
    transition: border-color 0.2s;
}

.comment-form textarea:focus {
    outline: none;
    border-bottom-color: var(--primary);
}

.comment-form__actions {
    display: none;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.comment-form.focused .comment-form__actions {
    display: flex;
}

.comment-form__cancel {
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 20px;
    transition: background 0.15s;
}

.comment-form__cancel:hover { background: var(--bg-surface); }

.comment-form__submit {
    padding: 8px 16px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 20px;
    transition: background 0.15s;
}

.comment-form__submit:hover { background: var(--primary-dark); }

/* Empty state */
.comments__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 16px;
    color: var(--text-light);
    text-align: center;
}

.comments__empty svg { opacity: 0.3; }
.comments__empty p { font-size: 14px; }

/* Comment items */
.comment {
    display: flex;
    gap: 10px;
    padding: 10px 0;
}

.comment--hidden { display: none !important; }

.comments__list > .comment { border-bottom: 1px solid var(--border-light); }
.comments__list > .comment:last-child { border-bottom: none; }

.comment__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--border-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
    flex-shrink: 0;
}

.comment__avatar--sm {
    width: 26px;
    height: 26px;
    font-size: 11px;
}

.comment__body { flex: 1; min-width: 0; }

.comment__header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 1px;
}

.comment__author {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}

.comment__date {
    font-size: 11px;
    color: var(--text-light);
}

.comment__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    word-wrap: break-word;
}

.comment__text--clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.comment__text--clamped.comment__text--expanded {
    -webkit-line-clamp: unset;
    display: block;
}

.comment__text-more {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 0;
    margin-top: 4px;
    display: block;
}

.comment__text-more:hover { color: var(--text); }

/* View more comments button */
.comments__view-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 8px;
}

.comments__view-more:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

/* Replies */
.comment__replies {
    margin-top: 4px;
    margin-left: 16px;
    padding-left: 12px;
    border-left: 2px solid var(--border-light);
}

.comment--reply { padding: 8px 0; }
.comment--reply:last-child { padding-bottom: 0; }

/* ========== CATEGORIES PAGE ========== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(var(--cat-cols), 1fr);
    gap: var(--list-gap, var(--card-gap, 8px));
}

.category-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16/10;
    background: var(--bg-dark);
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s;
}

@media (hover: hover) { .category-card:hover img { opacity: 0.8; transform: scale(1.05); } }

.category-card__name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-card__count {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 8px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius);
    line-height: 1.4;
}

.category-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker, #1e293b);
    color: var(--text-muted);
    font-size: 48px;
    font-weight: 700;
}

/* ========== TAGS PAGE ========== */

/* Header row: title left, search right */
.tags-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 28px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.tags-header__left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.tags-header__title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.tags-header__count {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
}

.tags-header__right {
    flex-shrink: 0;
    width: 280px;
}

/* Tag search */
.tag-search__wrapper {
    position: relative;
}

.tag-search__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.tag-search__input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    font-size: 14px;
    color: var(--text);
    transition: border-color 0.15s;
}

.tag-search__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.tag-search__input::placeholder {
    color: var(--text-muted);
}

/* Sticky alphabet bar */
.tag-alphabet {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px 0;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 16px;
}

.tag-alphabet__letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 4px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-surface);
    text-decoration: none;
    transition: all 0.15s;
}

a.tag-alphabet__letter:hover {
    color: var(--text);
    background: var(--border);
}

.tag-alphabet__letter--disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

/* 3-column grid of letter sections */
.tag-sections-grid {
    column-count: 3;
    column-gap: 16px;
    padding-bottom: 32px;
}

/* Reading-order masonry (JS adds .is-masonry + .tag-col wrappers): packs sections with no
   vertical gaps while A→Z still flows left-to-right across the first row. column-count above
   is the no-JS fallback. */
.tag-sections-grid.is-masonry { column-count: initial; display: flex; align-items: flex-start; gap: 16px; }
.tag-sections-grid.is-masonry .tag-col { flex: 1 1 0; min-width: 0; }
.tag-sections-grid.is-masonry .tag-col .tag-section:last-child { margin-bottom: 0; }

.tag-section {
    background: var(--bg-surface);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-light);
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 16px;
}

.tag-section__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.tag-section__letter {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.tag-section__count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 2px 8px;
    border-radius: 10px;
}

.tag-section__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-section .tag-link {
    font-size: 13px;
    padding: 4px 12px;
}

/* Tags page — tablet */
@media (max-width: 900px) {
    .tag-sections-grid { column-count: 2; }
}

/* ========== PERFORMERS PAGE ========== */
.performer-grid {
    display: grid;
    grid-template-columns: repeat(var(--perf-cols), 1fr);
    gap: var(--list-gap, var(--card-gap, 8px));
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(var(--channel-cols), 1fr);
    gap: var(--list-gap, var(--card-gap, 8px));
}

/* Performer cards — rounded square image with overlay text */
.performer-card {
    position: relative;
    display: block;
    text-decoration: none;
    width: 100%;
    padding-bottom: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-dark);
    box-shadow: 0 0 0 3px var(--border, rgba(255,255,255,0.12));
    transition: box-shadow 0.3s;
}
@media (hover: hover) {
    .performer-card:hover {
        box-shadow: 0 0 0 3px var(--primary);
    }
}

.performer-card__photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.88);
    transition: transform 0.5s, filter 0.3s;
}
@media (hover: hover) {
    .performer-card:hover .performer-card__photo {
        transform: scale(1.1);
        filter: brightness(0.75);
    }
}

.performer-card__photo--placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker, #1e293b);
    color: var(--text-muted);
    font-size: 42px;
    font-weight: 700;
}

.performer-card__overlay {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.35) 45%, transparent 65%);
    pointer-events: none;
}

.performer-card__info {
    position: absolute;
    bottom: 12%;
    left: 8%;
    right: 8%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
}

.performer-card__name {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-shadow: 0 2px 6px rgba(0,0,0,0.7);
    line-height: 1.3;
}

.performer-card__videos {
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    line-height: 1.3;
}

.performer-card__views {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    line-height: 1.3;
}

/* Channel cards — rounded square style (matches performer cards) */
.channel-card {
    position: relative;
    display: block;
    text-decoration: none;
    width: 100%;
    padding-bottom: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-dark);
    box-shadow: 0 0 0 3px var(--border, rgba(255,255,255,0.12));
    transition: box-shadow 0.3s;
}
@media (hover: hover) {
    .channel-card:hover {
        box-shadow: 0 0 0 3px var(--primary);
    }
}

.channel-card__photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.88);
    transition: transform 0.5s, filter 0.3s;
}
@media (hover: hover) {
    .channel-card:hover .channel-card__photo {
        transform: scale(1.1);
        filter: brightness(0.75);
    }
}

.channel-card__photo--placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker, #1e293b);
    color: var(--text-muted);
    font-size: 42px;
    font-weight: 700;
}

.channel-card__overlay {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.35) 45%, transparent 65%);
    pointer-events: none;
}

.channel-card__info {
    position: absolute;
    bottom: 12%;
    left: 8%;
    right: 8%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
}

.channel-card__name {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-shadow: 0 2px 6px rgba(0,0,0,0.7);
    line-height: 1.3;
}

.channel-card__videos {
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    line-height: 1.3;
}

.channel-card__views {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    line-height: 1.3;
}

/* ========== PERFORMER / CHANNEL PROFILE ========== */
.performer-profile {
    display: flex;
    gap: 28px;
    padding: 28px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin-top: 28px;
    margin-bottom: 24px;
    align-items: flex-start;
}

.performer-profile__photo-wrap {
    flex-shrink: 0;
}

.performer-profile__photo {
    width: 160px;
    height: 160px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    box-shadow: 0 0 0 4px var(--border, rgba(255,255,255,0.12));
}

.performer-profile__photo--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker, #1e293b);
    color: var(--text-muted);
    font-size: 52px;
}

.performer-profile__info { flex: 1; min-width: 0; }

.performer-profile__name {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.2;
}

.performer-profile__bio {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 16px;
}

.performer-profile__stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.performer-profile__stat {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: var(--radius);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

.performer-profile__stat i {
    color: var(--primary);
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.performer-profile__links {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.performer-profile__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--primary);
    font-size: 13px;
    border: 1px solid var(--border);
    transition: border-color 0.2s, background 0.2s;
    text-decoration: none;
}

.performer-profile__link:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb, 250,0,62), 0.06);
}

.performer-profile__link i {
    font-size: 12px;
}

/* ========== SEARCH ========== */
.search-page__form {
    max-width: 600px;
    margin: 24px auto;
    position: relative;
}

.search-page__input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 16px;
    background: var(--bg);
    color: var(--text);
}

.search-page__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.search-page__form svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.search-results__count {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ========== AUTH MODAL ========== */
.auth-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-modal.open { display: flex; }

.auth-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s;
}

.auth-modal.open .auth-modal__backdrop { opacity: 1; }

.auth-modal__card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: scale(0.92) translateY(20px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
}

.auth-modal.open .auth-modal__card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.auth-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-surface);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    z-index: 1;
}

.auth-modal__close:hover { background: var(--border); color: var(--text); }

.auth-modal__header {
    padding: 32px 32px 0;
    text-align: center;
}

.auth-modal__logo {
    display: grid;
    justify-items: center;
    margin: 0 auto 16px;
}
.auth-modal__logo-light, .auth-modal__logo-dark { grid-area: 1 / 1; }
.auth-modal__logo img {
    max-height: 40px;
    max-width: 200px;
    object-fit: contain;
}
.auth-modal__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 28px;
}

.auth-modal__title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.auth-modal__subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

/* Tabs */
.auth-tabs {
    display: flex;
    margin: 24px 32px 0;
    background: var(--bg-surface);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
}

.auth-tabs__btn {
    flex: 1;
    padding: 10px 8px;
    background: none;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.auth-tabs__btn:hover { color: var(--text); }

.auth-tabs__btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Panels */
.auth-modal__body { padding: 24px 32px 32px; }

.auth-panel { display: none; }
.auth-panel.active { display: block; }

.auth-panel__desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Form elements inside modal */
.auth-modal .form-group { margin-bottom: 16px; }

.auth-modal .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.auth-modal .form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    color: var(--text);
    background: var(--bg-surface);
    transition: all 0.2s;
}

.auth-modal .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg);
}

.auth-modal .form-group input::placeholder {
    color: var(--text-light);
}

.auth-modal .btn-submit {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.auth-modal .btn-submit:hover { background: var(--primary-dark); }

.auth-modal .btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-forgot-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
}
.auth-forgot-link:hover { color: var(--primary); }

/* Messages */
.auth-msg {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: none;
    line-height: 1.4;
}

.auth-msg.error {
    display: block;
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.auth-msg.success {
    display: block;
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

/* Fallback (form-error / form-success used elsewhere) */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-error {
    padding: 10px 14px;
    background: #fee2e2;
    color: var(--danger);
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

.form-success {
    padding: 10px 14px;
    background: #d1fae5;
    color: var(--success);
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

/* Legacy auth page (profile) */
.auth-page { max-width: 440px; margin: 48px auto; }

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    padding: 32px;
}

.auth-card__title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-footer a { font-weight: 500; }

/* ========== USER PAGES ========== */
.user-page__header {
    margin-bottom: 24px;
}

.user-page__title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.user-page__subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* ========== PROFILE PAGE ========== */
.profile-page {
    width: 100%;
    padding: 26px 0 44px;
}

/* ── Hero (light, calm) ─────────────────────────────────── */
.profile-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
    padding: 24px 26px;
    margin-bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.profile-hero__bg { display: none; }

.profile-hero__main { display: flex; align-items: center; gap: 18px; min-width: 0; }

.profile-hero__avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 27px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.10);
    border: 1px solid rgba(var(--primary-rgb), 0.18);
}

.profile-hero__identity { min-width: 0; }
.profile-hero__name {
    margin: 0 0 5px;
    font-size: 23px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text);
    word-break: break-word;
}
.profile-hero__meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}
.profile-hero__meta i { font-size: 12px; opacity: 0.7; }

.profile-hero__stats { display: flex; align-items: center; gap: 0; }
.profile-hero__stat {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 76px;
    padding: 4px 18px;
}
.profile-hero__stat + .profile-hero__stat::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: var(--border);
}
.profile-hero__stat i { font-size: 13px; color: var(--primary); opacity: 0.85; margin-bottom: 1px; }
.profile-hero__stat-num { font-size: 19px; font-weight: 700; line-height: 1; color: var(--text); }
.profile-hero__stat-label { font-size: 11px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }

/* ── Tabs: calm segmented control ───────────────────────── */
.profile-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    margin-bottom: 22px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.profile-nav::-webkit-scrollbar { display: none; }

.profile-nav__tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.profile-nav__tab i { font-size: 14px; opacity: 0.6; }
.profile-nav__tab:hover { color: var(--text); }
.profile-nav__tab.active {
    color: var(--text);
    font-weight: 600;
    background: var(--bg-card);
    box-shadow: var(--shadow);
}
.profile-nav__tab.active i { color: var(--primary); opacity: 1; }

.profile-nav__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 19px;
    height: 19px;
    padding: 0 6px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.profile-nav__tab.active .profile-nav__badge {
    background: rgba(var(--primary-rgb), 0.10);
    border-color: rgba(var(--primary-rgb), 0.20);
    color: var(--primary);
}

/* ── Section header ─────────────────────────────────────── */
.profile-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.profile-section-header__count { font-size: 14px; color: var(--text-muted); }
.profile-section-header__clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.profile-section-header__clear:hover { color: var(--danger); border-color: var(--danger); }

/* ── Empty states (calm) ────────────────────────────────── */
.profile-empty {
    text-align: center;
    padding: 58px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.profile-empty__icon {
    display: inline-grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin-bottom: 18px;
    font-size: 28px;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
    border-radius: 50%;
}
.profile-empty__title { margin-bottom: 6px; font-size: 18px; font-weight: 600; color: var(--text); }
.profile-empty__text { max-width: 340px; margin: 0 auto 20px; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.profile-empty__btn { display: inline-flex; align-items: center; gap: 7px; }

/* ── Settings form (calm) ───────────────────────────────── */
.profile-settings { max-width: 680px; }

.profile-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
}
.profile-alert i { font-size: 16px; flex-shrink: 0; }
.profile-alert--error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.profile-alert--success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.profile-alert--warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
[data-theme="dark"] .profile-alert--error { background: rgba(220,38,38,0.12); color: #fca5a5; border-color: rgba(220,38,38,0.25); }
[data-theme="dark"] .profile-alert--success { background: rgba(5,150,105,0.12); color: #6ee7b7; border-color: rgba(5,150,105,0.25); }
[data-theme="dark"] .profile-alert--warning { background: rgba(180,83,9,0.12); color: #fcd34d; border-color: rgba(180,83,9,0.25); }

.profile-form__section {
    margin-bottom: 16px;
    padding: 24px 26px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.profile-form__title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.profile-form__title i { font-size: 14px; color: var(--primary); }
.profile-form__hint {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}
/* Section intro: directly under .profile-form__title, before fields */
.profile-form__hint--lead {
    margin-top: -12px;
    margin-bottom: 18px;
}
/* Helper text directly under an input, select, or button */
.profile-form__hint--below {
    margin-top: 8px;
    margin-bottom: 0;
}
.profile-form__field {
    margin-bottom: 16px;
}
.profile-form__field:last-child {
    margin-bottom: 0;
}

.profile-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.profile-form__grid--extended {
    margin-top: 16px;
    align-items: stretch;
}

.profile-form__field label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.profile-form__input-wrap { position: relative; }
.profile-form__input-wrap i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    font-size: 14px;
    color: var(--text-light);
    pointer-events: none;
    transition: color 0.15s;
}
.profile-form__input-wrap:focus-within i { color: var(--primary); }
.profile-form__input-wrap input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.profile-form__input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.10);
}
.profile-form__input-wrap input::placeholder { color: var(--text-light); }

.profile-form__input-wrap textarea {
    width: 100%;
    min-height: 132px;
    padding: 11px 14px 11px 38px;
    font-size: 15px;
    line-height: 1.5;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.profile-form__input-wrap textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.10);
}
.profile-form__input-wrap textarea::placeholder { color: var(--text-light); }
.profile-form__input-wrap--textarea i {
    top: 14px;
    transform: none;
}
.profile-form__field--bio {
    display: flex;
    flex-direction: column;
}
.profile-form__field--bio .profile-form__input-wrap--textarea {
    flex: 1;
    display: flex;
}
.profile-form__field--bio textarea {
    flex: 1;
    min-height: 148px;
}

.profile-form__avatar-preview {
    margin-bottom: 10px;
}
.profile-form__avatar-preview-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    display: block;
}
.profile-form__file-wrap {
    position: relative;
}
.profile-form__file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.profile-form__file-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    box-sizing: border-box;
}
.profile-form__file-btn:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.04);
}
.profile-form__file-input:focus + .profile-form__file-btn,
.profile-form__file-input:focus-visible + .profile-form__file-btn {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.10);
}
.profile-form__field--avatar .profile-form__hint--below {
    margin-top: 10px;
    margin-bottom: 8px;
}

[dir="rtl"] .profile-form__input-wrap textarea { padding: 11px 38px 11px 14px; }
[dir="rtl"] .profile-form__input-wrap i { left: auto; right: 13px; }
[dir="rtl"] .profile-form__input-wrap input { padding: 11px 38px 11px 14px; }

.profile-form__actions { margin-top: 8px; }
.profile-form__submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    background: var(--primary);
    transition: background 0.15s, transform 0.1s;
}
.profile-form__submit:hover { background: var(--primary-dark); }
.profile-form__submit:active { transform: scale(0.99); }

/* ── Monetization profile tabs ──────────────────────────── */
.profile-mo-loading[hidden],
.profile-mo-panel[hidden],
.profile-mo-debt[hidden],
.profile-mo-next-tier[hidden] { display: none !important; }

.profile-mo-skeleton__line {
    height: 14px;
    margin-bottom: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--border) 25%, rgba(var(--primary-rgb), 0.08) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: profile-mo-shimmer 1.2s ease-in-out infinite;
}
.profile-mo-skeleton__line--title { width: 38%; height: 18px; margin-bottom: 20px; }
.profile-mo-skeleton__line--lg { width: 55%; height: 32px; margin-bottom: 18px; }
.profile-mo-skeleton__line--short { width: 28%; margin-bottom: 0; }
@keyframes profile-mo-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.profile-mo-balance { margin-bottom: 18px; }
.profile-mo-balance__value {
    display: block;
    font-size: 36px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text);
}
.profile-mo-balance__label {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.profile-mo-breakdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.profile-mo-breakdown__item {
    padding: 12px 14px;
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.profile-mo-breakdown__num {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}
.profile-mo-breakdown__label {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}

.profile-mo-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.profile-mo-stats__item {
    padding: 12px 10px;
    text-align: center;
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.profile-mo-stats__num {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
}
.profile-mo-stats__label {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.3;
    color: var(--text-muted);
}

.profile-mo-plan-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.profile-mo-plan-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(var(--primary-rgb), 0.03);
}
.profile-mo-plan-card__title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.profile-mo-plan-card__duration {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}
.profile-mo-plan-card__price {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}
.profile-mo-plan-card__btn {
    margin-top: auto;
    width: 100%;
    justify-content: center;
}

.profile-mo-task-list { display: flex; flex-direction: column; gap: 10px; }
.profile-mo-task {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
}
.profile-mo-task__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.profile-mo-task__reward {
    grid-column: 1;
    font-size: 12px;
    color: var(--text-muted);
}
.profile-mo-task__progress {
    grid-column: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}
.profile-mo-task__progress-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
    transition: width 0.2s ease;
}
.profile-mo-task__meta {
    grid-column: 1;
    font-size: 12px;
    color: var(--text-muted);
}
.profile-mo-task__action {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
}
.profile-mo-task__badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(var(--primary-rgb), 0.10);
    color: var(--primary);
}
.profile-mo-task__badge--done {
    background: rgba(5, 150, 105, 0.12);
    color: #15803d;
}
[data-theme="dark"] .profile-mo-task__badge--done { color: #6ee7b7; }

.profile-mo-unlock-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.profile-mo-unlock-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.profile-mo-unlock-item:last-child { border-bottom: none; }
.profile-mo-unlock-item__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}
.profile-mo-unlock-item__title:hover { color: var(--primary); }
.profile-mo-unlock-item__meta {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.profile-mo-copy-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.profile-mo-copy-row__input { flex: 1; min-width: 0; }
.profile-mo-copy-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    white-space: nowrap;
}
.profile-mo-tier-line {
    margin: 0 0 8px;
    font-size: 15px;
    color: var(--text);
}
.profile-mo-tier-rate {
    margin-left: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}
.profile-mo-meta {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
}
.profile-mo-meta__sep { margin: 0 6px; opacity: 0.5; }

.profile-mo-recharge-hint { margin-bottom: 16px; }
.profile-mo-package-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.profile-mo-package-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(var(--primary-rgb), 0.03);
}
.profile-mo-package-card__price {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}
.profile-mo-package-card__points {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}
.profile-mo-package-card__bonus {
    font-size: 12px;
    color: var(--text-muted);
}
.profile-mo-package-card__btn {
    margin-top: auto;
    width: 100%;
    justify-content: center;
}

.profile-mo-stats--wallet { margin-top: 4px; }

.profile-mo-tier-table-wrap {
    margin-top: 16px;
    overflow-x: auto;
}
.profile-mo-tier-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.profile-mo-tier-table th,
.profile-mo-tier-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.profile-mo-tier-table th {
    color: var(--text-muted);
    font-weight: 600;
}
.profile-mo-tier-table tr.is-current td {
    background: rgba(var(--primary-rgb), 0.06);
    font-weight: 600;
}
.profile-mo-tier-table__badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.12);
}

.profile-mo-info-box .profile-mo-rules {
    margin: 0;
    padding-left: 18px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
}
.profile-mo-info-box .profile-mo-rules li + li { margin-top: 4px; }

.profile-mo-payout-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.profile-mo-payout-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
}
.profile-mo-payout-item__method {
    font-weight: 600;
    color: var(--primary);
}
.profile-mo-payout-item__no {
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
}
.profile-mo-payout-item__default {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary);
}

.profile-mo-payout-form,
.profile-mo-withdraw-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profile-mo-withdraw-hint { margin-top: 10px; }

.profile-mo-withdraw-history {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.profile-mo-withdraw-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.profile-mo-withdraw-item__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.profile-mo-withdraw-item__amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.profile-mo-withdraw-item__status {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}
.profile-mo-withdraw-item__status--pending_review { color: #b45309; background: #fef3c7; }
.profile-mo-withdraw-item__status--paying { color: #1d4ed8; background: #dbeafe; }
.profile-mo-withdraw-item__status--paid { color: #047857; background: #d1fae5; }
.profile-mo-withdraw-item__status--rejected,
.profile-mo-withdraw-item__status--failed { color: #b91c1c; background: #fee2e2; }
.profile-mo-withdraw-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 12px;
    color: var(--text-muted);
}
.profile-mo-withdraw-item__reason {
    margin: 8px 0 0;
    font-size: 12px;
    color: #b91c1c;
}

.profile-mo-ledger-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.profile-mo-ledger-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
}
.profile-mo-ledger-item__main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.profile-mo-ledger-item__amount { font-weight: 700; }
.profile-mo-ledger-item--in .profile-mo-ledger-item__amount { color: #047857; }
.profile-mo-ledger-item--out .profile-mo-ledger-item__amount { color: #b91c1c; }
.profile-mo-ledger-item__note,
.profile-mo-ledger-item__meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.profile-mo-ledger-item__meta {
    display: flex;
    gap: 12px;
}

.profile-mo-checkin-streak {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--text-muted);
}
.profile-mo-checkin-today {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-muted);
}
.profile-mo-checkin-today--done {
    color: #047857;
    font-weight: 600;
}
.profile-mo-checkin-calendar-wrap {
    margin-bottom: 16px;
}
.profile-mo-checkin-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}
.profile-mo-checkin-weekday {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}
.profile-mo-checkin-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.profile-mo-checkin-day {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: 6px;
    font-size: 12px;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.profile-mo-checkin-day__num {
    font-weight: 600;
    line-height: 1;
}
.profile-mo-checkin-day.is-checked {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
    border-color: rgba(var(--primary-rgb), 0.35);
}
.profile-mo-checkin-day.is-checked .profile-mo-checkin-day__num::after {
    content: '✓';
    display: block;
    font-size: 9px;
    margin-top: 2px;
}
.profile-mo-checkin-day.is-today {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.2);
}
.profile-mo-checkin-day.is-empty {
    visibility: hidden;
    border-color: transparent;
    background: transparent;
    min-height: 36px;
}

.profile-mo-task__desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.profile-mo-plan-card__benefits {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}
.profile-mo-vip-current-benefits {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--text-muted);
    font-size: 14px;
}

.profile-mo-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}
.profile-mo-pagination__info {
    font-size: 13px;
    color: var(--text-muted);
}

.profile-mo-qrcode-section {
    text-align: center;
}
.profile-mo-qrcode-section__title {
    justify-content: center;
}
.profile-mo-qrcode-wrap {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.profile-mo-qrcode {
    display: block;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
}
.profile-mo-qrcode-hint {
    text-align: center;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}
.profile-mo-qrcode-actions {
    justify-content: center;
    margin-top: 12px;
}

.profile-mo-tier-progress {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin: 12px 0;
}
.profile-mo-tier-progress__bar {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

.profile-mo-payout-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.profile-mo-commission-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.profile-mo-commission-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.profile-mo-commission-item__main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.profile-mo-commission-item__amount { font-weight: 700; }
.profile-mo-commission-item__meta {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 12px;
    color: var(--text-muted);
}
.profile-mo-commission-item__status--pending { color: #b45309; }
.profile-mo-commission-item__status--mature { color: #047857; }

.profile-form__input-wrap select {
    width: 100%;
    padding: 11px 38px 11px 38px;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: auto;
    cursor: pointer;
}
.profile-form__input-wrap select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.10);
}
.profile-form__input-wrap input:disabled,
.profile-form__input-wrap select:disabled {
    opacity: 0.72;
    cursor: not-allowed;
    background: rgba(var(--primary-rgb), 0.04);
    color: var(--text-muted);
}
.profile-form__input-wrap input:disabled::placeholder {
    color: var(--text-light);
}

.profile-mo-withdraw-notice { margin-bottom: 16px; }

.profile-form__field--checkbox { margin-top: 4px; }
.profile-form__checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
}
.profile-form__checkbox input { margin: 0; }

.profile-form__input-wrap input[readonly] {
    background: rgba(var(--primary-rgb), 0.04);
    cursor: default;
}

@media (max-width: 860px) {
    .profile-mo-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profile-mo-copy-row { flex-direction: column; }
    .profile-mo-copy-btn { width: 100%; justify-content: center; padding: 11px 16px; }
    .profile-mo-task { grid-template-columns: 1fr; }
    .profile-mo-task__action { grid-column: 1; grid-row: auto; justify-self: start; }
    .profile-mo-package-card,
    .profile-mo-plan-card { padding: 14px 12px; }
    .profile-mo-package-card__price,
    .profile-mo-plan-card__price { font-size: 20px; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 860px) {
    .profile-hero { flex-direction: column; align-items: stretch; text-align: center; gap: 18px; }
    .profile-hero__main { flex-direction: column; text-align: center; gap: 14px; }
    .profile-hero__identity { display: flex; flex-direction: column; align-items: center; }
    .profile-hero__stats { justify-content: center; }
}

@media (max-width: 768px) {
    .profile-page { padding: 18px 0 28px; }
    .profile-hero__avatar { width: 64px; height: 64px; font-size: 25px; }
    .profile-hero__name { font-size: 21px; }
    .profile-nav__label { display: none; }
    .profile-nav__tab { padding: 9px 14px; }
    .profile-nav__tab i { font-size: 16px; }
    .profile-settings { max-width: 100%; }
    .profile-form__grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .profile-page { padding: 10px 0 18px; }
    .profile-hero { padding: 20px 16px; }
    .profile-hero__stat { padding: 4px 12px; min-width: 0; flex: 1; }
    .profile-hero__stat-num { font-size: 17px; }
    .profile-hero__stat-label { font-size: 10px; }
    .profile-nav { margin-bottom: 16px; }
    .profile-form__section { padding: 18px; }
    .profile-form__submit { width: 100%; justify-content: center; }
    .profile-form__input-wrap textarea,
    .profile-form__field--bio textarea { min-height: 112px; }
    .profile-form__file-btn { min-height: 44px; font-size: 15px; }
    .profile-section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .profile-empty { padding: 44px 16px; }
}

/* ========== STATIC PAGE ========== */
.static-page {
    max-width: 100%;
    margin: 0 auto;
    padding: 40px 48px 48px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
}
.static-page__header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-light);
}
.static-page__title {
    font-size: 30px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
@media (max-width: 768px) {
    .static-page { padding: 24px 20px 28px; margin: 0 auto; }
    .static-page__title { font-size: 24px; }
}

/* ========== RICH CONTENT (TinyMCE output) ========== */
.rich-content { font-size: 15px; color: var(--text); }
.rich-content h1 { font-size: 26px; font-weight: 700; margin: 32px 0 14px; color: var(--text); }
.rich-content h2 { font-size: 21px; font-weight: 700; margin: 28px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); color: var(--text); }
.rich-content h3 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; color: var(--text); }
.rich-content h4 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; color: var(--text); }
.rich-content h2:first-child, .rich-content h3:first-child { margin-top: 0; }
.rich-content p { margin-bottom: 1em; line-height: 1.75; }
.rich-content ul, .rich-content ol { padding-left: 24px; margin: 12px 0; }
.rich-content ul { list-style: disc; }
.rich-content ol { list-style: decimal; }
.rich-content li { margin-bottom: 6px; line-height: 1.65; }
.rich-content li strong { color: var(--text); }
.rich-content a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; transition: color 0.15s; }
.rich-content a:hover { color: var(--primary-dark); }
.rich-content strong { font-weight: 600; }
.rich-content img { max-width: 100%; height: auto; border-radius: var(--radius, 8px); margin: 16px 0; }
.rich-content table { width: 100%; border-collapse: collapse; margin: 20px 0; border-radius: var(--radius, 8px); overflow: hidden; }
.rich-content th, .rich-content td { border: 1px solid var(--border-light, #e5e7eb); padding: 10px 14px; text-align: left; font-size: 14px; }
.rich-content th { background: var(--bg-surface, #f8fafc); font-weight: 600; }
.rich-content blockquote { border-left: 4px solid var(--primary, #3b82f6); padding: 14px 20px; margin: 20px 0; color: var(--text-muted, #6b7280); background: var(--bg-surface, #f8fafc); border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0; }
.rich-content blockquote p:last-child { margin-bottom: 0; }
.rich-content pre { background: #1e293b; color: #e2e8f0; padding: 16px 20px; border-radius: var(--radius, 8px); overflow-x: auto; margin: 20px 0; font-size: 13px; line-height: 1.6; }
.rich-content code { background: var(--bg-surface, #f1f5f9); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.rich-content pre code { background: transparent; padding: 0; border-radius: 0; font-size: inherit; }
.rich-content hr { border: none; border-top: 1px solid var(--border-light, #e5e7eb); margin: 32px 0; }
.rich-content figure { margin: 20px 0; }
.rich-content figcaption { font-size: 13px; color: var(--text-muted, #6b7280); text-align: center; margin-top: 8px; }
.rich-content p[style*="text-align:center"] { font-size: 14px; color: var(--text-muted); }
.rich-content p[style*="text-align:center"] a { color: var(--text-muted); text-decoration: none; font-weight: 500; }
.rich-content p[style*="text-align:center"] a:hover { color: var(--primary); }

/* ========== PAGINATION ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 32px 0;
    flex-wrap: wrap;
}

.pagination__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.15s;
}

@media (hover: hover) { .pagination__link:hover { color: var(--primary); border-color: var(--primary); } }

.pagination__link--active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination__dots {
    padding: 0 8px;
    color: var(--text-light);
}

/* ========== FOOTER ========== */
.footer {
    background: var(--bg-dark);
    color: var(--text-light);
    margin-top: 48px;
}
[data-theme="dark"] .footer {
    border-top: 1px solid var(--border);
}

.footer--stream {
    padding: 32px 0 20px;
}

.footer__stream:first-child {
    padding-top: 0;
}

.footer__stream {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    padding-bottom: 4px;
}

.footer__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 720px;
}

.footer__logo {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.footer__logo span { color: var(--primary); }

.footer__desc {
    font-size: 12px;
    line-height: 1.65;
    opacity: 0.65;
    max-width: 520px;
}

.footer__legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2px 0;
    max-width: 920px;
    width: 100%;
}

.footer__legal a {
    display: inline-block;
    font-size: 12px;
    color: var(--text-light);
    padding: 5px 10px;
    opacity: 0.88;
    transition: color 0.15s, opacity 0.15s;
}

.footer__legal a:hover {
    color: #fff;
    opacity: 1;
}

.footer__legal-sep {
    opacity: 0.35;
    font-size: 12px;
    line-height: 1;
    user-select: none;
}

.footer__trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px 18px;
    width: 100%;
    max-width: 920px;
}

.footer__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-light);
    opacity: 0.8;
}

.footer__badge svg {
    flex-shrink: 0;
    opacity: 0.75;
}

.footer__text {
    font-size: 12px;
    line-height: 1.65;
    opacity: 0.75;
    max-width: 720px;
}

.footer__text a { color: var(--primary-light); }
.footer__text a:hover { color: #fff; }

.footer__bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 24px;
    padding-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    opacity: 0.85;
    flex-wrap: wrap;
    gap: 12px;
}

.footer__disclaimer {
    font-size: 11px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.footer__copyright {
    white-space: nowrap;
    flex-shrink: 0;
}

.footer__social {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer__social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-light);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.footer__social a:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

/* Stream footer — desktop (YouTube-style row) */
@media (min-width: 769px) {
    .footer--stream { padding: 36px 0 22px; }
    .footer__stream {
        align-items: flex-start;
        text-align: left;
        gap: 14px;
    }
    .footer__brand { align-items: flex-start; }
    .footer__legal {
        justify-content: flex-start;
        gap: 0;
    }
    .footer__legal a { padding: 4px 12px 4px 0; }
    .footer__legal-sep { padding: 0 2px; }
    .footer__trust { justify-content: flex-start; }
}

/* Stream footer — mobile (Bilibili-style grid links) */
@media (max-width: 768px) {
    .footer--stream { padding: 24px 0 18px; margin-top: 32px; }
    .footer__stream {
        align-items: flex-start;
        text-align: left;
        gap: 12px;
    }
    .footer__legal {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px 12px;
        justify-items: start;
        text-align: left;
    }
    .footer__legal-sep { display: none; }
    .footer__legal a {
        padding: 6px 0;
        font-size: 12px;
    }
    .footer__trust {
        justify-content: flex-start;
        gap: 8px 14px;
    }
    .footer__bottom { flex-direction: column; text-align: center; }
    .footer__disclaimer { white-space: normal; text-align: center; }
}

@media (max-width: 480px) {
    .footer--stream { padding: 24px 0 16px; }
}

[dir="rtl"] .footer__legal a:hover { padding-left: 0; }

/* ========== PAGE HEADER ========== */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 28px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.page-header:has(+ .sort-tabs) {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 12px;
}

.page-header--with-search {
    justify-content: space-between;
}

.listing-search {
    position: relative;
    flex-shrink: 0;
    width: 240px;
}

.listing-search__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.listing-search__input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    font-size: 14px;
    color: var(--text);
    transition: border-color 0.15s;
}

.listing-search__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.listing-search__input::placeholder { color: var(--text-muted); }

.page-header__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.page-header__content {
    flex: 1;
    min-width: 0;
}

.page-header__title {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
}

.page-header__subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.page-header__desc {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
    margin-top: 8px;
    max-width: 700px;
}

.home-section--videos .section-title-row--tabs {
    margin-bottom: 0;
}
.home-section--videos .section-title-row--tabs .section-title {
    border-bottom: 2px solid var(--primary);
}
.home-section--videos .sort-tabs {
    margin-top: 0;
}

/* Listing pages: title row + horizontal sort tabs (Bilibili / YouTube) */
.section-title-row--tabs {
    margin-bottom: 0;
}
.section-title-row--tabs .section-title {
    border-bottom: 2px solid var(--primary);
}
.section-title-row + .sort-tabs {
    margin-top: 0;
    margin-bottom: 16px;
}

/* ========== HOMEPAGE ========== */
.home-section {
    margin-bottom: 36px;
}

/* ========== SECTION TITLES ========== */
.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

/* Title row: title left, "More" right, line below both with gap */
.section-title-row {
    display: flex;
    align-items: flex-end;
    margin-bottom: 16px;
}
.section-title-row .section-title {
    flex: 1;
    margin-bottom: 0;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary);
    white-space: nowrap;
}
.section-more {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    padding: 0 28px 6px;
    margin-left: 12px;
    border-bottom: 2px solid var(--primary);
    transition: color 0.15s;
}
.section-more:hover {
    color: var(--primary);
}
.section-more-placeholder { display: none; }
.section-title-row__search {
    position: relative;
    margin-left: 12px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 6px;
    flex-shrink: 0;
    width: 240px;
}
.section-title-row__search .listing-search__icon {
    position: absolute;
    left: 12px;
    top: calc(50% - 3px);
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.section-title-row__search .listing-search__input {
    width: 100%;
    padding: 7px 14px 7px 36px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    font-size: 14px;
    color: var(--text);
    transition: border-color 0.15s;
}
.section-title-row__search .listing-search__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.section-title-row__search .listing-search__input::placeholder { color: var(--text-muted); }
.section-sort-dropdown {
    position: relative;
    margin-left: 12px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 6px;
}
.section-sort-dropdown__toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px 0 8px;
    white-space: nowrap;
}
.section-sort-dropdown__toggle:hover {
    color: var(--text);
}
.section-sort-dropdown__arrow {
    transition: transform 0.2s;
}
.section-sort-dropdown.open .section-sort-dropdown__arrow {
    transform: rotate(180deg);
}
.section-sort-dropdown__menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 50;
    overflow: hidden;
}
.section-sort-dropdown.open .section-sort-dropdown__menu {
    display: block;
}
.section-sort-dropdown__item {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}
.section-sort-dropdown__item:hover {
    background: var(--bg-surface);
}
.section-sort-dropdown__item--active {
    color: var(--primary);
}
.section-sort-dropdown__divider {
    height: 1px;
    background: var(--border);
    margin: 0 12px;
}

/* ========== 404 PAGE ========== */
.error-404 {
    width: 100%;
    padding: 0 0 32px;
}

/* ── Hero ── */
.error-404__hero {
    text-align: center;
    padding: 56px 24px 48px;
    margin: -24px calc(-1 * var(--container-padding, 24px)) 28px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(var(--primary-rgb), 0.10) 0%, transparent 60%);
    border-bottom: 1px solid var(--border-light);
}

/* 4 ▶ 4 */
.error-404__code {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    user-select: none;
}

.error-404__digit {
    font-size: 96px;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.error-404__ring {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 0 32px rgba(var(--primary-rgb), 0.35);
    animation: e404pulse 2.5s ease-in-out infinite;
}

.error-404__ring i {
    font-size: 36px;
    color: #fff;
}

@keyframes e404pulse {
    0%, 100% { box-shadow: 0 0 24px rgba(var(--primary-rgb), 0.3); transform: scale(1); }
    50% { box-shadow: 0 0 48px rgba(var(--primary-rgb), 0.5); transform: scale(1.06); }
}

.error-404__title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text);
}

.error-404__desc {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 28px;
    line-height: 1.6;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Search ── */
.error-404__search {
    max-width: 480px;
    margin: 0 auto 24px;
    position: relative;
}

.error-404__search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: var(--text-light);
    pointer-events: none;
}

.error-404__search input {
    width: 100%;
    padding: 14px 20px 14px 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.error-404__search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.error-404__search input::placeholder { color: var(--text-light); }

[dir="rtl"] .error-404__search i { left: auto; right: 16px; }
[dir="rtl"] .error-404__search input { padding: 14px 44px 14px 20px; }

/* ── Action Buttons ── */
.error-404__actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.error-404__btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    text-decoration: none;
}

.error-404__btn:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.06);
    color: var(--primary);
}

.error-404__btn:active { transform: scale(0.97); }

.error-404__btn--primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.error-404__btn--primary:hover {
    background: var(--primary-dark);
    color: #fff;
    border-color: var(--primary-dark);
}

.error-404__btn i { font-size: 13px; }

/* ── Category Pills ── */
.error-404__categories {
    margin-bottom: 28px;
}

.error-404__cats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.error-404__cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.error-404__cat-pill span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    background: var(--bg-surface);
    padding: 1px 7px;
    border-radius: 10px;
}

.error-404__cat-pill:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

/* ── Trending Section ── */
.error-404__trending {
    margin-top: 8px;
}

.error-404__section-title {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text);
    margin-bottom: 16px;
    text-align: center;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .error-404__hero { padding: 36px 20px 32px; margin: -16px calc(-1 * var(--container-padding-mobile, 16px)) 24px; }
    .error-404__digit { font-size: 72px; }
    .error-404__ring { width: 60px; height: 60px; }
    .error-404__ring i { font-size: 28px; }
    .error-404__title { font-size: 22px; }
    .error-404__desc { font-size: 14px; margin-bottom: 24px; }
    .error-404__search input { padding: 12px 16px 12px 40px; font-size: 14px; }
    .error-404__btn { padding: 9px 16px; font-size: 13px; }
}

@media (max-width: 480px) {
    .error-404__hero { padding: 28px 16px 24px; margin: -16px calc(-1 * var(--container-padding-mobile, 10px)) 20px; }
    .error-404__code { gap: 4px; margin-bottom: 16px; }
    .error-404__digit { font-size: 56px; }
    .error-404__ring { width: 48px; height: 48px; }
    .error-404__ring i { font-size: 22px; }
    .error-404__title { font-size: 20px; }
    .error-404__desc { font-size: 13px; margin-bottom: 20px; }
    .error-404__search input { padding: 11px 14px 11px 38px; font-size: 13px; }
    .error-404__search { margin-bottom: 20px; }
    .error-404__actions { gap: 8px; }
    .error-404__btn { padding: 8px 14px; font-size: 12px; }
    .error-404__cat-pill { padding: 6px 12px; font-size: 12px; }
    .error-404__categories { margin-bottom: 20px; }
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    font-size: 28px;
    margin-bottom: 16px;
    color: var(--text-light);
    background: var(--bg-surface);
    border-radius: 50%;
}
.empty-state__text { font-size: 15px; }

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 32px);
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast--exit {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transition-duration: 0.2s;
}

.toast__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.toast--error .toast__icon { background: #fef2f2; color: var(--danger); }
.toast--warning .toast__icon { background: #fffbeb; color: var(--warning); }
.toast--success .toast__icon { background: #f0fdf4; color: var(--success); }
.toast--info .toast__icon { background: var(--primary-light); color: var(--primary); }

.toast--error { border-color: #fecaca; }
.toast--warning { border-color: #fde68a; }
.toast--success { border-color: #bbf7d0; }
.toast--info { border-color: var(--primary-light); }

.toast__text {
    flex: 1;
    font-weight: 500;
    line-height: 1.4;
}

.toast__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    transition: color 0.15s;
}

.toast__close:hover { color: var(--text); }

@media (max-width: 480px) {
    .toast-container { bottom: 16px; max-width: 100%; width: calc(100% - 24px); }
    .toast { padding: 12px 14px; font-size: 13px; }
    .toast__icon { width: 28px; height: 28px; }
    .toast__icon svg { width: 16px; height: 16px; }
}

/* ========== RESPONSIVE ========== */

/* 6 cols → 5 on smaller desktops */
@media (max-width: 1600px) {
    body.cols-6 { --grid-cols: 5; }
}

/* 5,6,7 cols → 4 on laptops */
@media (max-width: 1280px) {
    body.cols-5, body.cols-6 { --grid-cols: 4; }
    body.cat-5, body.cat-6 { --cat-cols: 4; }
    body.perf-5, body.perf-6, body.perf-7 { --perf-cols: 4; }
    body.channel-5, body.channel-6, body.channel-7 { --channel-cols: 4; }
}

/* Recommended section */
.recommended-section {
    padding: 32px 0 0;
}

.recommended-more {
    display: flex;
    justify-content: center;
    padding: 24px 0 8px;
}

.recommended-more__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.recommended-more__btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Tablet landscape: 3 cols, video page single column, hide sidebar */
@media (max-width: 1024px) {
    body.cols-4, body.cols-5, body.cols-6 { --grid-cols: 3; }
    body.cat-3, body.cat-4, body.cat-5, body.cat-6 { --cat-cols: 3; }
    body.perf-4, body.perf-5, body.perf-6, body.perf-7 { --perf-cols: 3; }
    body.channel-4, body.channel-5, body.channel-6, body.channel-7 { --channel-cols: 3; }
    .video-page { grid-template-columns: 1fr; gap: 20px; }
    .video-sidebar { display: none; }
    .recommended-section { padding-top: 8px; }
}

@media (max-width: 1280px) and (min-width: 1025px) {
    .video-page { grid-template-columns: 1fr 380px; gap: 24px; }
}

/* Logo mobile height */
@media (max-width: 768px) {
    .header__logo-img { height: var(--logo-h-mobile); }
}

/* Tablet portrait: switch to mobile layout */
@media (max-width: 768px) {
    body.cols-4, body.cols-5, body.cols-6 { --grid-cols: 2; }
    body.cat-3, body.cat-4, body.cat-5, body.cat-6 { --cat-cols: 2; }
    body.perf-4, body.perf-5, body.perf-6, body.perf-7 { --perf-cols: 2; }
    body.channel-4, body.channel-5, body.channel-6, body.channel-7 { --channel-cols: 2; }

    /* Page header */
    .page-header { padding: 20px 0 16px; gap: 12px; margin-bottom: 16px; }
    .page-header__icon { width: 40px; height: 40px; }
    .page-header__icon svg { width: 18px; height: 18px; }
    .page-header__title { font-size: 20px; }
    .page-header__subtitle { font-size: 13px; }
    .page-header--with-search { flex-wrap: wrap; }
    .listing-search { width: 100%; order: 3; }
    .page-header__desc { font-size: 13px; margin-top: 6px; }

    /* Header: mobile — Logo | Search | Avatar + vtype seg + nav tab row */
    :root {
        --header-nav-height: 40px;
    }
    .header--has-vtype {
        --header-vtype-height: 40px;
    }
    .header-vtype-seg {
        padding: 4px var(--container-padding-mobile, 16px);
    }
    .header-vtype-seg__track {
        max-width: none;
        border-radius: 9px;
        padding: 3px;
        gap: 3px;
    }
    .header-vtype-seg__item {
        min-height: 32px;
        padding: 5px 6px;
        font-size: 12px;
        gap: 4px;
    }
    .header-vtype-seg__icon { font-size: 12px; }
    .header--scrolled .header-nav { display: block; }
    .header__scroll-burger {
        display: none !important;
        width: 0 !important;
        margin: 0 !important;
        opacity: 0 !important;
    }
    .header-nav {
        display: block;
        border-top: 1px solid var(--border-light);
    }
    .header-nav__bar {
        padding: 0;
        gap: 0;
    }
    .header-nav__inner {
        flex: 1;
        min-width: 0;
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
        mask-image: linear-gradient(to right, black calc(100% - 18px), transparent);
        -webkit-mask-image: linear-gradient(to right, black calc(100% - 18px), transparent);
    }
    .header-nav__inner::-webkit-scrollbar { display: none; }
    .header-nav__inner > a,
    .header-nav__inner > .header__nav-dropdown > a {
        flex-shrink: 0;
        padding: 0 14px;
        height: var(--header-nav-height);
        align-items: center;
        border-radius: 0;
        background: none;
        border-bottom: 2px solid transparent;
        font-size: 13px;
    }
    .header-nav__inner > a:hover,
    .header-nav__inner > .header__nav-dropdown > a:hover {
        background: none;
        color: var(--text);
    }
    .header-nav__inner > a.active,
    .header-nav__inner > .header__nav-dropdown > a.active {
        color: var(--primary);
        background: none;
        border-bottom-color: var(--primary);
    }
    .header-nav__inner .nav-icon { display: none; }
    .header__nav-dropdown .nav-chevron { display: none; }
    .header__nav-dropdown .header__nav-submenu,
    .header__mega-menu { display: none !important; }
    .header-nav__inner {
        flex: 1;
        max-width: 100%;
    }
    .header-mid__inner {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
    }
    .header-mid__center { display: flex; min-width: 0; }
    .header__search { max-width: none; min-width: 0; }
    .header__search input {
        padding: 7px 10px 7px 32px;
        font-size: 13px;
        border-radius: 18px;
    }
    .header__search svg,
    .header__search > i { left: 11px; font-size: 13px; }
    .header__actions { display: flex; }
    .header__mobile-icons { display: none !important; }
    .udd__trigger { width: 36px; height: 36px; font-size: 28px; }
    .udd__dropdown {
        width: min(280px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
    }
    .scroll-sidebar { display: none !important; }
    .header-nav--full .header-nav__inner > a,
    .header-nav--full .header-nav__inner > .header__nav-dropdown:not(.vtype-dd) {
        flex: 0 0 auto;
        width: auto;
        text-align: left;
    }

    .container { padding: 0 var(--container-padding-mobile, 16px); }
    .topbar__inner { padding-top: 5px; padding-bottom: 5px; }

    /* Video page — tighter layout */
    .video-page { gap: 0; padding: 0; }
    .video-player { border-radius: 0; }
    .video-main { padding: 0; }
    .video-info { padding: 12px 16px 0; }
    .video-info__title { font-size: 17px; margin-bottom: 10px; line-height: 1.35; }

    /* Stats & actions — stack vertically */
    .video-info__bar { flex-direction: column; align-items: stretch; gap: 10px; padding-bottom: 12px; }
    .video-info__stats { gap: 12px; }
    .video-info__stat { font-size: 12px; }
    .video-info__stat svg { width: 13px; height: 13px; }
    .video-info__actions { justify-content: flex-start; gap: 6px; }
    .vote-btn { padding: 6px 12px; font-size: 12px; }
    .vote-btn svg { width: 14px; height: 14px; }
    .btn-icon { width: 32px; height: 32px; }
    .btn-icon svg { width: 16px; height: 16px; }

    /* Detail blocks — all inline, same style */
    .video-detail-section { padding: 10px 16px; margin: 0; }
    .video-detail-block { flex-direction: row; flex-wrap: wrap; gap: 6px; align-items: center; }
    .video-detail-label { min-width: auto; width: auto; margin-bottom: 0; font-size: 11px; }

    /* Chips smaller on mobile */
    .performer-chip { padding: 3px 10px 3px 3px; font-size: 12px; gap: 6px; }
    .performer-chip img { width: 24px; height: 24px; }
    .performer-chip__initial { width: 24px; height: 24px; font-size: 11px; }
    .channel-chip { padding: 4px 10px; font-size: 12px; }
    .tag-link { padding: 3px 10px; font-size: 11px; }

    /* Description */
    .video-description { padding: 10px 0; }
    .video-description__text { font-size: 13px; }

    /* Comments compact */
    .comments { margin-top: 0; padding: 16px; border-top: 1px solid var(--border-light); }
    .comments__header { margin-bottom: 12px; }
    .comments__header h3 { font-size: 14px; }
    .comment { padding: 8px 0; gap: 8px; }
    .comment__avatar { width: 28px; height: 28px; font-size: 12px; }
    .comment__avatar--sm { width: 22px; height: 22px; font-size: 10px; }
    .comment__author { font-size: 12px; }
    .comment__date { font-size: 10px; }
    .comment__text { font-size: 12px; }
    .comment__text-more { font-size: 11px; }
    .comment__replies { margin-left: 10px; padding-left: 10px; }
    .comment-form__avatar { width: 28px; height: 28px; font-size: 12px; }
    .comment-form textarea { font-size: 13px; }
    .comments__login { padding: 10px 14px; font-size: 13px; }
    .comments__view-more { font-size: 12px; padding: 8px; }

    /* Listing grids — respect admin --card-gap */
    .video-grid { gap: var(--list-gap, var(--card-gap, 8px)); }
    .video-card__info { padding: 10px; }
    .video-card__title { font-size: 13px; }
    .video-card__meta { font-size: 11px; }

    /* Recommended section */
    .recommended-section { padding: 24px 16px 0; }
    .recommended-section .section-title { font-size: 16px; margin-bottom: 14px; padding-bottom: 10px; }
    .recommended-more { padding: 18px 0 4px; }
    .recommended-more__btn { padding: 9px 22px; font-size: 13px; }

    .performer-profile { flex-direction: column; align-items: center; text-align: center; }
    .performer-profile__photo { width: 130px; height: 130px; }
    .performer-profile__stats { justify-content: center; }
    .performer-profile__links { justify-content: center; }

    /* Circle cards — smaller text on tablet */
    .performer-card__name, .channel-card__name { font-size: 13px; }
    .performer-card__videos, .channel-card__videos { font-size: 11px; }
    .performer-card__views, .channel-card__views { font-size: 10px; }
    .performer-card__photo--placeholder, .channel-card__photo--placeholder { font-size: 36px; }
}

/* Small phones (< 480px) */
@media (max-width: 480px) {
    body.cols-4, body.cols-5, body.cols-6 { --grid-cols: 2; }
    .container { padding: 0 var(--container-padding-mobile, 10px); }
    .sort-tabs a { white-space: nowrap; padding: 8px 12px; font-size: 13px; }

    .tags-header { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px 0 12px; }
    .tags-header__right { width: 100%; }
    .tag-alphabet { gap: 3px; overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
    .tag-alphabet__letter { min-width: 30px; height: 30px; font-size: 12px; flex-shrink: 0; }
    .tag-search__input { padding: 8px 12px 8px 38px; font-size: 13px; }
    .tag-sections-grid { column-count: 1; column-gap: 10px; }
    .tag-section { padding: 12px; }
    .tag-section__letter { font-size: 18px; }
    .tag-section .tag-link { font-size: 12px; padding: 3px 10px; }

    .page-header { padding: 16px 0 12px; gap: 10px; margin-bottom: 12px; }
    .page-header__icon { width: 36px; height: 36px; }
    .page-header__icon svg { width: 16px; height: 16px; }
    .page-header__title { font-size: 18px; }
    .page-header__subtitle { font-size: 12px; }

    /* Video page extra compact */
    .video-info { padding: 10px 12px 0; }
    .video-info__title { font-size: 15px; margin-bottom: 8px; }
    .video-info__stats { gap: 8px; }
    .video-info__stat { font-size: 11px; gap: 3px; }
    .video-info__stat svg { width: 12px; height: 12px; }
    .vote-btn { padding: 5px 10px; font-size: 11px; gap: 4px; }

    /* Detail sections tighter */
    .video-detail-section { padding: 8px 12px; }
    .video-detail-label { font-size: 10px; }
    .performer-chip { font-size: 11px; padding: 2px 8px 2px 2px; }
    .performer-chip img { width: 22px; height: 22px; }
    .performer-chip__initial { width: 22px; height: 22px; font-size: 10px; }
    .channel-chip { padding: 3px 8px; font-size: 11px; }
    .tag-link { padding: 2px 8px; font-size: 10px; }

    .video-description__text { font-size: 12px; line-height: 1.6; }
    .comments { padding: 12px; }

    .recommended-section { padding: 20px 10px 0; }
    .recommended-section .section-title { font-size: 14px; margin-bottom: 10px; }

    /* Circle cards — phone */
    .performer-grid, .channel-grid { gap: 12px; }
    .performer-card__info, .channel-card__info { bottom: 10%; }
    .performer-card__name, .channel-card__name { font-size: 14px; }
    .performer-card__videos, .channel-card__videos { font-size: 11px; }
    .performer-card__views, .channel-card__views { font-size: 10px; }

    /* Listing grids — respect admin --card-gap */
    .video-grid { gap: var(--list-gap, var(--card-gap, 8px)); }
    .video-card { border-radius: 6px; }
    .video-card__info { padding: 8px; }
    .video-card__title { font-size: 12px; margin-bottom: 2px; }
    .video-card__meta { font-size: 10px; }
    .video-card__duration { font-size: 10px; padding: 1px 4px; bottom: 4px; right: 4px; }
}

/* header__flag kept for mobile nav */
.header__flag {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

/* ========== RTL OVERRIDES ========== */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

/* Header */
[dir="rtl"] .header__search input { padding: 9px 38px 9px 14px; }
[dir="rtl"] .header__search svg,
[dir="rtl"] .header__search > i { left: auto; right: 12px; }
[dir="rtl"] .header__mobile-icons { margin-left: 0; margin-right: auto; }
[dir="rtl"] .udd__dropdown { right: auto; left: 0; }

/* Video card */
[dir="rtl"] .video-card__duration { right: auto; left: 8px; }

/* Video page */
[dir="rtl"] .video-detail-label { text-align: right; }
[dir="rtl"] .video-info__actions { direction: ltr; }

/* Comments */
[dir="rtl"] .comment__replies { margin-left: 0; margin-right: 16px; padding-left: 0; padding-right: 12px; border-left: none; border-right: 2px solid var(--border-light); }
[dir="rtl"] .comment-form__actions { justify-content: flex-start; }

/* Auth modal */
[dir="rtl"] .auth-modal__close { right: auto; left: 16px; }

/* Pagination */
[dir="rtl"] .pagination { direction: ltr; }

/* Footer */
[dir="rtl"] .footer__stream { direction: rtl; }
[dir="rtl"] .footer__legal { direction: rtl; }

/* Search */
[dir="rtl"] .search-page__input { padding: 14px 48px 14px 20px; }
[dir="rtl"] .search-page__form svg { left: auto; right: 16px; }

/* Tag search */
[dir="rtl"] .tag-search__icon { left: auto; right: 14px; }
[dir="rtl"] .tag-search__input { padding: 10px 42px 10px 16px; }

/* Mobile nav search */
[dir="rtl"] .mobile-nav__search input { padding: 10px 38px 10px 12px; }
[dir="rtl"] .mobile-nav__search > i { left: auto; right: 12px; }
[dir="rtl"] .mobile-nav__panel { right: auto; left: 0; transform: translateX(-100%); }
[dir="rtl"] .mobile-nav.open .mobile-nav__panel { transform: translateX(0); }

/* Mobile responsive RTL fixes */
@media (max-width: 768px) {
    [dir="rtl"] .video-detail-section { padding: 10px 16px; }
    [dir="rtl"] .video-info { padding: 12px 16px 0; }
    [dir="rtl"] .comments { padding: 16px; }
    [dir="rtl"] .section-title-row__search { margin-left: 0; margin-right: 0; }
    [dir="rtl"] .section-more { margin-left: 0; margin-right: auto; }
    [dir="rtl"] .section-sort-dropdown { margin-left: 0; margin-right: auto; }
}

@media (max-width: 480px) {
    [dir="rtl"] .video-card__duration { left: 4px; right: auto; }
    [dir="rtl"] .video-info { padding: 10px 12px 0; }
    [dir="rtl"] .video-detail-section { padding: 8px 12px; }
}

/* ========== CONTACT PAGE LAYOUT ========== */

/* Two-column layout: form left, body right */
.page-contact-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}
.page-contact-layout__form {
    position: sticky;
    top: calc(var(--header-height, 60px) + 24px);
}
.page-contact-layout__body {
    padding-left: 24px;
    border-left: 1px solid var(--border-light);
}

/* Contact-only (no body): centered narrower form */
.page-contact-centered {
    max-width: 640px;
    margin: 0 auto;
}

/* Flash messages */
.contact-flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.contact-flash--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.contact-flash--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Form base */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.contact-form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.contact-form__group {
    display: flex;
    flex-direction: column;
}
.contact-form__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
    letter-spacing: 0.01em;
}
.contact-form__required {
    color: var(--danger, #ef4444);
}
.contact-form__input,
.contact-form__textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.contact-form__input:focus,
.contact-form__textarea:focus {
    border-color: var(--primary);
    background: var(--bg);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.contact-form__textarea {
    resize: vertical;
    min-height: 120px;
}

/* URL fields for DMCA/Report */
.contact-form__url-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.contact-form__url-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.contact-form__url-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.contact-form__url-row .contact-form__input {
    flex: 1;
}
.contact-form__remove-url {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--text-muted, #6b7280);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.contact-form__remove-url:hover {
    background: var(--danger, #ef4444);
    color: #fff;
    border-color: var(--danger, #ef4444);
}
.contact-form__add-url {
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    font-family: inherit;
}
.contact-form__add-url:hover {
    text-decoration: underline;
}
select.contact-form__input {
    cursor: pointer;
}

/* Submit button */
.contact-form__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    align-self: flex-start;
}
.contact-form__submit:hover {
    background: var(--primary-dark);
}
.contact-form__submit:active {
    transform: scale(0.98);
}
.contact-form__submit-icon {
    width: 18px;
    height: 18px;
}

@media (max-width: 900px) {
    .page-contact-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .page-contact-layout__form {
        position: static;
    }
    .page-contact-layout__body {
        padding-left: 0;
        border-left: none;
        padding-top: 24px;
        border-top: 1px solid var(--border-light);
    }
}
@media (max-width: 768px) {
    .contact-form__grid {
        grid-template-columns: 1fr;
    }
}

/* ========== MOBILE UX ENHANCEMENTS ========== */

/* Touch feedback: active states for interactive elements */
@media (hover: none) {
    .video-card:active { transform: scale(0.98); }
    .category-card:active, .performer-card:active, .channel-card:active { transform: scale(0.97); }
    .pagination a:active, .pagination button:active { transform: scale(0.92); }
    .sort-tabs a:active, .sort-dropdown__item:active { opacity: 0.7; }
    .btn:active, button[type="submit"]:active { transform: scale(0.97); }
    .mobile-nav__links a:active { background: var(--bg-surface); }
}

/* Disable tap highlight for a cleaner feel */
a, button, label, input, select, textarea, .video-card, .category-card, .performer-card, .channel-card {
    -webkit-tap-highlight-color: transparent;
}

/* Safe area padding for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-nav__bottom { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .footer__bottom { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--app-bottom-inset, 0px)); }
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: calc(var(--app-bottom-inset, 0px) + env(safe-area-inset-bottom, 0px));
    }
}

/* Smooth scrolling for the entire page */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Better mobile inputs: larger touch targets */
@media (max-width: 768px) {
    input[type="text"], input[type="email"], input[type="password"],
    input[type="url"], input[type="search"], input[type="number"],
    select, textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    .auth-modal input { font-size: 16px; }
}

/* Mobile nav: close button position for right-side panel */
.mobile-nav__close { order: -1; margin-right: 10px; margin-left: 0; }
[dir="rtl"] .mobile-nav__close { order: unset; margin-right: 0; margin-left: 10px; }

/* Container mobile padding uses CSS var */
@media (max-width: 480px) {
    .container { padding-left: var(--container-padding-mobile, 10px); padding-right: var(--container-padding-mobile, 10px); }
}

/* ========== SORT TABS SCROLL HINT ========== */
/* Fade edges on mobile to indicate horizontal scroll */
.sort-tabs {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sort-tabs::-webkit-scrollbar { display: none; }
@media (max-width: 768px) {
    .sort-tabs {
        mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 12px), transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 12px), transparent);
    }
    .profile-nav {
        mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 12px), transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 12px), transparent);
    }
}

/* ========== SECTION TITLE ROW — MOBILE WRAP ========== */
@media (max-width: 768px) {
    .section-title-row { flex-wrap: wrap; gap: 0; }
    .section-title-row--tabs { margin-bottom: 0; }
    .section-title-row--tabs .section-title {
        flex: 1 1 100%;
        white-space: normal;
    }
    .section-title-row__search {
        width: 100%;
        margin-left: 0;
        order: 3;
        border-bottom: none;
        padding-bottom: 0;
        margin-top: 8px;
    }
    .section-title-row + .sort-tabs {
        padding-top: 8px;
        margin-bottom: 16px;
    }
    .home-section--videos .sort-tabs {
        padding-top: 8px;
        margin-bottom: 16px;
    }
    .home-section--videos .sort-tabs a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .section-more { padding: 0 12px 6px; margin-left: auto; }
    .sort-tabs a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .pagination__link {
        min-width: 44px;
        height: 44px;
    }
    .vote-btn {
        min-height: 44px;
    }
    #beingWatched .section-title-row {
        margin-bottom: 12px;
    }
    #beingWatched .section-title {
        font-size: 15px;
        padding-bottom: 4px;
    }
}

@media (max-width: 480px) {
    .section-title { font-size: 16px; margin-bottom: 12px; padding-bottom: 6px; }
    .section-title-row .section-title { font-size: 16px; }
    .section-more { font-size: 13px; padding: 0 8px 6px; }
    .section-sort-dropdown__toggle { font-size: 13px; }
}

/* ========== 640PX INTERMEDIATE BREAKPOINT ========== */
@media (max-width: 640px) {
    /* Performer/channel grids: 3→2 for medium phones */
    body.perf-4, body.perf-5, body.perf-6, body.perf-7 { --perf-cols: 2; }
    body.channel-4, body.channel-5, body.channel-6, body.channel-7 { --channel-cols: 2; }

    /* Related videos: single column on smaller screens */
    .related-grid { grid-template-columns: 1fr; }

    /* Tighter main padding */
    main.container { padding-top: 16px; padding-bottom: 16px; }

    /* Home sections tighter */
    .home-section { margin-bottom: 24px; }

    /* Sort tabs tighter */
    .sort-tabs { padding: 10px 0; margin-bottom: 16px; }
    .sort-tabs a { padding: 7px 14px; font-size: 13px; }

    /* Pagination compact — keep 44px touch targets */
    .pagination { gap: 3px; margin: 24px 0; }
    .pagination__link { min-width: 44px; height: 44px; padding: 0 10px; font-size: 13px; }
    .pagination__dots { padding: 0 4px; }

    /* Performer profile tighter */
    .performer-profile { padding: 20px; gap: 20px; margin-top: 16px; }
    .performer-profile__photo { width: 110px; height: 110px; }
    .performer-profile__name { font-size: 22px; }
    .performer-profile__bio { font-size: 13px; }
    .performer-profile__stat { padding: 6px 12px; font-size: 12px; }

    /* Search page */
    .search-page__input { padding: 12px 16px 12px 44px; font-size: 15px; }

    /* Video card play button smaller */
    .video-card__play svg { width: 36px; height: 36px; }

    /* Auth modal — near full-screen */
    .auth-modal { padding: 12px; }
    .auth-modal__card { max-width: 100%; border-radius: 12px; }
    .auth-modal__header { padding: 24px 20px 0; }
    .auth-modal__title { font-size: 20px; }
    .auth-tabs { margin: 20px 20px 0; }
    .auth-modal__body { padding: 20px 20px 24px; }

    /* Footer tighter */
    .footer { margin-top: 32px; }
}

/* ========== PAGINATION — SMALL PHONES ========== */
@media (max-width: 480px) {
    .pagination { gap: 2px; margin: 20px 0; }
    .pagination__link { min-width: 44px; height: 44px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
}

/* ========== AUTH MODAL — SMALL PHONES ========== */
@media (max-width: 480px) {
    .auth-modal {
        padding: 12px;
        align-items: center;
        justify-content: center;
    }
    .auth-modal__card {
        max-width: 100%;
        border-radius: 12px;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .auth-modal__header { padding: 20px 16px 0; }
    .auth-modal__title { font-size: 18px; }
    .auth-modal__icon { width: 48px; height: 48px; font-size: 24px; margin-bottom: 12px; }
    .auth-tabs { margin: 16px 16px 0; padding: 3px; }
    .auth-tabs__btn { padding: 9px 6px; font-size: 12px; }
    .auth-modal__body { padding: 16px 16px 20px; }
    .auth-modal .form-group input { padding: 10px 12px; font-size: 14px; }
    .auth-modal .btn-submit { padding: 11px; font-size: 14px; }
}

/* ========== CATEGORY CARD — SMALL PHONES ========== */
@media (max-width: 480px) {
    .category-card__name { font-size: 12px; padding: 6px 8px; }
    .category-card__count { font-size: 10px; padding: 2px 6px; top: 4px; right: 4px; }
}

/* ========== VIDEO CARD — PLAY BUTTON MOBILE ========== */
@media (max-width: 480px) {
    .video-card__play svg { width: 28px; height: 28px; }
    .video-card__play { opacity: 0.65; }
}

/* ========== LISTING SEARCH — MOBILE ========== */
@media (max-width: 480px) {
    .listing-search__input { padding: 8px 12px 8px 34px; font-size: 13px; }
    .listing-search__icon svg { width: 14px; height: 14px; }
}

/* ========== SEARCH AUTOCOMPLETE ========== */
.search-suggest {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
    margin-top: 4px;
}
.search-suggest__item {
    display: block;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.12s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-suggest__item:hover {
    background: var(--bg-surface);
    color: var(--primary);
}

/* ========== CONTACT PAGE (redesigned hub) ========== */
.contact-page .contact-intro {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.7;
    margin: -6px 0 26px;
    max-width: 800px;
}
.contact-page .contact-hub {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 26px;
    align-items: start;
}
.contact-page .contact-hub__main {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.contact-page .contact-hub__main-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
    padding: 0;
    border: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}
.contact-page .contact-hub__main-title i { color: var(--primary); font-size: 16px; }
.contact-page .contact-hub__main-sub {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0 0 18px;
}
.contact-page .contact-hub__main .page-contact-centered { max-width: 100%; margin: 0; }
.contact-page .contact-hub__side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: calc(var(--header-height, 60px) + 18px);
}
.contact-page .cinfo {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
}
.contact-page .cinfo__head { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.contact-page .cinfo__icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary);
    font-size: 15px;
    flex-shrink: 0;
}
.contact-page .cinfo__title { font-size: 14.5px; font-weight: 700; color: var(--text); }
.contact-page .cinfo__text { font-size: 13px; color: var(--text-muted); line-height: 1.65; margin: 0; }
.contact-page .cinfo__text strong { color: var(--text); font-weight: 700; }
.contact-page .cinfo__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.contact-page .cinfo__list li { display: flex; gap: 9px; font-size: 13px; color: var(--text); line-height: 1.5; margin: 0; }
.contact-page .cinfo__list li i { color: var(--success); font-size: 12px; margin-top: 3px; flex-shrink: 0; }
.contact-page .cinfo__email {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    word-break: break-all;
}
.contact-page .cinfo__email:hover { color: var(--primary-dark); text-decoration: underline; }
.contact-page .cinfo__links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.contact-page .cinfo__links a {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 999px;
    text-decoration: none;
    transition: color .15s, border-color .15s, background .15s;
}
.contact-page .cinfo__links a:hover { color: var(--primary); border-color: var(--primary); background: rgba(var(--primary-rgb), 0.08); }
.contact-page .page-updated { margin: 22px 0 0; font-size: 12.5px; color: var(--text-light); }
.contact-page .page-updated time { font-style: normal; }
@media (max-width: 900px) {
    .contact-page .contact-hub { grid-template-columns: 1fr; gap: 18px; }
    .contact-page .contact-hub__side { position: static; }
}

/* Contact hub — mobile overflow guards (grid/flex items must be allowed to shrink) */
.contact-page .contact-hub__main,
.contact-page .contact-hub__side,
.contact-page .cinfo,
.contact-page .contact-form,
.contact-page .contact-form__group { min-width: 0; }
.contact-page .contact-form__input,
.contact-page .contact-form__textarea,
.contact-page select.contact-form__input { max-width: 100%; }

/* ========== APP / STANDALONE MODE HOOKS ========== */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top, 0px);
    }
    .header {
        padding-top: env(safe-area-inset-top, 0px);
    }
}

.app-tabbar {
    display: none;
}
@media (display-mode: standalone) {
    .app-tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 55;
        align-items: stretch;
        justify-content: space-around;
        background: var(--bg);
        border-top: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        min-height: calc(52px + env(safe-area-inset-bottom, 0px));
    }
    body.has-app-tabbar {
        --app-bottom-inset: calc(52px + env(safe-area-inset-bottom, 0px));
    }
    body.has-app-tabbar:has(#fluxBar) {
        --app-bottom-inset: calc(116px + env(safe-area-inset-bottom, 0px));
    }
}

/* ── Gallery / Manga reader ── */
.video-card--gallery .video-card__thumb--portrait,
.comic-card .comic-card__thumb { aspect-ratio: 3 / 4; }
.video-card--gallery .video-card__thumb img,
.comic-card .comic-card__thumb img { object-fit: cover; height: 100%; }
.gallery-page__title { font-size: 1.5rem; font-weight: 700; margin: 0 0 8px; }
.gallery-page__meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }
.gallery-page__desc { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
.gallery-page__controls { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.gallery-btn { border: 1px solid var(--border); background: var(--bg-elevated, var(--bg)); color: var(--text); padding: 6px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; }
.gallery-btn.active { border-color: var(--primary); color: var(--primary); }
.gallery-btn.active i { color: var(--primary); }
.gallery-reader__paginated { display: flex; align-items: center; gap: 8px; justify-content: center; min-height: 60vh; }
.gallery-reader__stage { flex: 1; max-width: min(900px, 100%); text-align: center; }
.gallery-reader__stage img { max-width: 100%; height: auto; margin: 0 auto; display: block; }
.gallery-nav { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-elevated, var(--bg)); color: var(--text); cursor: pointer; flex-shrink: 0; }
.gallery-reader__pager { margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.gallery-reader__webtoon { max-width: 800px; margin: 0 auto; }
.gallery-webtoon__page { display: block; width: 100%; height: auto; margin: 0; }
.gallery-page__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }

/* Manga detail (18mh-style book page) */
.manga-detail__hero {
    display: flex; gap: 20px; margin-bottom: 20px;
    flex-wrap: nowrap; align-items: flex-start;
}
.manga-detail__cover { flex-shrink: 0; width: 180px; position: relative; }
.manga-detail__cover img { width: 100%; height: auto; border-radius: 12px; display: block; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.manga-detail__cover-placeholder { width: 180px; aspect-ratio: 3/4; border-radius: 12px; background: var(--bg-elevated, #1e1e2e); display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--text-muted); }
.manga-detail__cover-badges { position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; flex-direction: column; gap: 4px; }
.manga-detail__badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; color: #fff; line-height: 1.4; }
.manga-detail__badge--origin { background: #e11d48; }
.manga-detail__badge--serial { background: #16a34a; }
.manga-detail__cover-stats {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    display: flex; gap: 12px; justify-content: center;
    padding: 28px 8px 10px;
    border-radius: 0 0 12px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,.72));
    color: #fff; font-size: 12px; font-weight: 600;
}
.manga-detail__cover-stats i { margin-right: 4px; opacity: .9; }
.manga-detail__info { flex: 1; min-width: 0; }
.manga-detail__title { font-size: 1.55rem; font-weight: 700; margin: 0 0 14px; line-height: 1.35; }
.manga-detail__fields { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.manga-detail__fields li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text); line-height: 1.45; }
.manga-detail__fields i { width: 16px; margin-top: 2px; color: var(--text-muted); flex-shrink: 0; }
.manga-detail__fields a { color: var(--primary); text-decoration: none; }
.manga-detail__fields a:hover { text-decoration: underline; }

.manga-detail__synopsis {
    margin: 0 0 18px; padding: 16px 18px;
    background: var(--bg-surface, var(--bg-elevated, rgba(255,255,255,.03)));
    border: 1px solid var(--border); border-radius: 12px;
}
.manga-detail__synopsis-title {
    margin: 0 0 10px; font-size: 15px; font-weight: 700;
    display: flex; align-items: center; gap: 8px;
}
.manga-detail__synopsis-title::before {
    content: ""; width: 3px; height: 1em; border-radius: 2px; background: var(--primary);
}
.manga-detail__synopsis-body { color: var(--text-muted); font-size: 14px; line-height: 1.75; }

.manga-detail__cta-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px 16px;
    margin-bottom: 18px; flex-wrap: nowrap;
}
.manga-detail__rating { display: flex; align-items: center; gap: 8px; min-height: 36px; flex-shrink: 0; }
.manga-detail__rating--empty .manga-detail__rating-score { color: var(--text-muted); font-weight: 700; }
.manga-detail__rating--empty .manga-detail__rating-stars { opacity: .45; }
.manga-detail__rating-score { font-size: 28px; font-weight: 800; color: var(--primary); line-height: 1; }
.manga-detail__rating-stars { display: flex; gap: 2px; color: var(--primary); font-size: 14px; }
.manga-detail__read-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 160px; padding: 12px 28px; border-radius: 999px; font-weight: 700;
    flex-shrink: 0; margin-left: auto;
}

.manga-detail__icon-bar {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
    margin-bottom: 16px; padding: 8px 0;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.manga-detail__icon-action {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 10px 4px; background: none; border: none; cursor: pointer;
    color: var(--text-muted); text-decoration: none; font-size: 12px;
}
.manga-detail__icon-action + .manga-detail__icon-action { border-left: 1px solid var(--border); }
.manga-detail__icon-circle {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary); font-size: 18px;
}
.manga-detail__icon-action.active .manga-detail__icon-circle,
.manga-detail__icon-action.active { color: var(--primary); }
.manga-detail__icon-action.active .manga-detail__icon-circle { background: color-mix(in srgb, var(--primary) 22%, transparent); }

.manga-detail__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.manga-detail__tag {
    display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary); text-decoration: none; font-size: 12px; font-weight: 600;
}
.manga-detail__tag:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }

.manga-detail__catalog { margin: 28px 0; }
.manga-detail__catalog-count { font-weight: 400; font-size: 14px; color: var(--text-muted); margin-left: 6px; }
.manga-detail__chapter-list { display: flex; flex-direction: column; gap: 2px; max-height: 480px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.manga-detail__chapter-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); transition: background .15s; }
.manga-detail__chapter-item:last-child { border-bottom: none; }
.manga-detail__chapter-item:hover { background: var(--bg-elevated, rgba(255,255,255,.04)); }
.manga-detail__chapter-badge { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--primary); min-width: 56px; }
.manga-detail__chapter-title { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manga-detail__chapter-pages { flex-shrink: 0; font-size: 12px; color: var(--text-muted); }
@media (max-width: 640px) {
    .manga-detail__hero { gap: 12px; }
    .manga-detail__cover { width: 118px; }
    .manga-detail__cover-placeholder { width: 118px; }
    .manga-detail__title { font-size: 1.12rem; margin-bottom: 10px; }
    .manga-detail__fields { gap: 8px; }
    .manga-detail__fields li { font-size: 12px; gap: 6px; }
    .manga-detail__cta-row { gap: 10px; }
    .manga-detail__rating-score { font-size: 22px; }
    .manga-detail__read-btn { min-width: 0; width: auto; padding: 10px 20px; }
}
@media (max-width: 380px) {
    .manga-detail__cover { width: 100px; }
    .manga-detail__cover-placeholder { width: 100px; }
    .manga-detail__title { font-size: 1.02rem; }
    .manga-detail__fields li { font-size: 11px; }
}

/* Manga read (18mh-style chapter reader) */
.manga-read { padding-bottom: 0; --manga-read-header-h: 56px; --manga-read-bar-h: 52px; }
.manga-read__header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 1100;
    height: var(--manga-read-header-h); padding: 0 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface, var(--bg));
    box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.manga-read__back { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; min-width: 0; flex: 1; }
.manga-read__back-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manga-read__header-actions { display: flex; gap: 6px; flex-shrink: 0; }
.manga-read__action { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elevated, var(--bg)); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.manga-read__action.active { color: var(--primary); border-color: var(--primary); }
.gallery-page--read {
    margin: 0;
    padding-top: calc(var(--manga-read-header-h) + 8px);
    padding-bottom: calc(var(--manga-read-bar-h) + 12px);
    min-height: 50vh;
}
.gallery-page--read.is-switching {
    opacity: .55;
    pointer-events: none;
    transition: opacity .15s ease;
}
.manga-read__pages { max-width: 900px; margin: 0 auto; }
.manga-read__page {
    display: block; width: 100%; height: auto; margin: 0;
    /* Hide broken-image alt glyphs (「第 N 页」) while src is empty / still loading */
    font-size: 0; line-height: 0; color: transparent;
}
.manga-read__page.is-pending {
    opacity: 0;
    min-height: 1px;
}
.manga-read__empty { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.manga-read__bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
    height: var(--manga-read-bar-h);
    margin: 0; border-radius: 0; border: none; border-top: 1px solid var(--border);
    background: var(--bg-surface, var(--bg));
    display: flex; align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}
.manga-read__bar-link { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; }
.manga-read__bar-link--next { justify-content: center; }
.manga-read__bar-link--disabled { opacity: .35; pointer-events: none; }
.manga-read__bar-center { flex: 1.2; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--text-muted); text-decoration: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.manga-read__catalog-panel {
    position: fixed; inset: 0; z-index: 1200;
    display: none;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}
/* Mounted = painted off-screen; open = sheet slid in. Never flash list in document flow. */
.manga-read__catalog-panel.is-mounted {
    display: block;
    visibility: visible;
    pointer-events: auto;
}
.manga-read__catalog-panel[hidden] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
.manga-read__catalog-backdrop {
    position: absolute; inset: 0; background: rgba(0,0,0,.55);
    opacity: 0;
    transition: opacity .2s ease-out;
}
.manga-read__catalog-panel.is-open .manga-read__catalog-backdrop {
    opacity: 1;
}
.manga-read__catalog-sheet {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: min(380px, 92vw); max-height: none;
    background: var(--bg-surface, var(--bg));
    border-radius: 0;
    display: flex; flex-direction: column;
    box-shadow: -8px 0 28px rgba(0,0,0,.2);
    transform: translate3d(100%, 0, 0);
    transition: transform .2s ease-out;
    will-change: transform;
}
.manga-read__catalog-panel.is-open .manga-read__catalog-sheet {
    transform: translate3d(0, 0, 0);
}
/* Monetization chapter picker must never appear on chapter reader pages */
.gallery-page--read .gallery-chapters,
.manga-read .gallery-chapters,
body.manga-reader-page .gallery-chapters {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
}
.manga-read__catalog-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.manga-read__catalog-sheet-head h3 { margin: 0; font-size: 16px; }
.manga-read__catalog-sheet-head button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 4px; }
.manga-read__catalog-list { overflow-y: auto; padding: 4px 0; -webkit-overflow-scrolling: touch; }
.manga-read__catalog-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text); text-decoration: none; font-size: 14px; border-bottom: 1px solid var(--border); }
.manga-read__catalog-item.active { color: var(--primary); font-weight: 600; background: rgba(var(--primary-rgb, 99,102,241), .08); }
.manga-read__catalog-item:last-child { border-bottom: none; }
.manga-read__catalog-badge { flex-shrink: 0; min-width: 52px; font-size: 12px; font-weight: 700; color: var(--primary); }
.manga-read__catalog-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manga-read__catalog-pages { flex-shrink: 0; font-size: 12px; color: var(--text-muted); }
/* Hide site chrome on reader so only manga top/bottom bars frame the pages */
body.manga-reader-page .topbar,
body.manga-reader-page .header,
body.manga-reader-page .header-mid,
body.manga-reader-page .header-nav,
body.manga-reader-page .header-vtype-seg,
body.manga-reader-page .mobile-nav,
body.manga-reader-page .footer {
    display: none !important;
}
body.manga-reader-page main.container {
    padding-top: 0;
    padding-bottom: 0;
    max-width: none;
}
body.manga-reader-page {
    --header-offset: 0px;
}
@media (max-width: 640px) {
    .manga-read__bar-link span { display: none; }
}

/* ========== LISTING POLISH (portal-aware) ========== */
.listing-title {
    text-transform: none;
    letter-spacing: normal;
}
.listing-title__count {
    font-weight: 400;
    font-size: 14px;
    color: var(--text-muted);
    margin-left: 6px;
}
.listing-lead {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
    max-width: 700px;
    margin: 0 0 20px;
}

/* Comic / manga book grid �� denser covers need roomier gutters */
.comic-grid {
    display: grid;
    grid-template-columns: repeat(var(--comic-cols, var(--grid-cols)), 1fr);
    gap: var(--comic-gap, 12px);
    align-items: start;
}
body.portal-manga.cols-6 { --comic-cols: 5; }
body.portal-manga.cols-5 { --comic-cols: 5; }
body.portal-manga.cols-4 { --comic-cols: 4; }

.comic-card {
    background: transparent;
    border: none;
    box-shadow: none;
}
.comic-card__link,
.video-card--gallery .video-card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}
.comic-card__info,
.video-card--gallery .video-card__info {
    padding: 10px 2px 4px;
}
.comic-card__title,
.video-card--gallery .video-card__title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow: hidden;
}
.comic-card__meta,
.video-card--gallery .video-card__meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.comic-card__thumb {
    border-radius: var(--card-radius, var(--radius-lg));
    overflow: hidden;
    background: var(--bg-dark);
    position: relative;
}

/* Filter-style chips (manga categories / tags) */
.listing-chip-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin: 4px 0 8px;
}
.listing-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-surface, var(--bg-elevated, transparent));
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.2;
    transition: border-color .15s, color .15s, background .15s;
}
.listing-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light, rgba(99,102,241,.08));
}
.listing-chip__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 14em;
}
.listing-chip__count {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.listing-chip:hover .listing-chip__count { color: inherit; opacity: .85; }

body.portal-manga .sort-tabs {
    margin-bottom: 16px;
}
body.portal-manga .section-title-row + .sort-tabs,
body.portal-video .section-title-row + .sort-tabs {
    margin-top: 4px;
}

@media (max-width: 1024px) {
    body.portal-manga.cols-4,
    body.portal-manga.cols-5,
    body.portal-manga.cols-6 { --comic-cols: 4; }
}
@media (max-width: 768px) {
    body.portal-manga.cols-4,
    body.portal-manga.cols-5,
    body.portal-manga.cols-6 { --comic-cols: 3; }
    .comic-grid { gap: max(10px, var(--card-gap, 8px)); }
    .listing-chip { padding: 6px 10px; font-size: 12px; }
}
@media (max-width: 480px) {
    body.portal-manga.cols-4,
    body.portal-manga.cols-5,
    body.portal-manga.cols-6 { --comic-cols: 2; }
    .comic-card__title,
    .video-card--gallery .video-card__title { font-size: 12px; }
}

/* Gallery cards: keep book-cover feel, avoid tube-card chrome */
.video-card.video-card--gallery,
.video-card.comic-card {
    background: transparent;
    border: none;
    box-shadow: none;
}
@media (hover: hover) {
    .video-card.video-card--gallery:hover,
    .video-card.comic-card:hover {
        transform: none;
        box-shadow: none;
    }
    .video-card.video-card--gallery:hover .video-card__thumb img,
    .video-card.comic-card:hover .comic-card__thumb img {
        transform: scale(1.04);
    }
}

/* ========== 18mh-style card taxonomy / badges ========== */
.comic-card__badges {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    display: flex;
    justify-content: space-between;
    gap: 6px;
    pointer-events: none;
    z-index: 2;
}
.comic-card__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
}
.comic-card__badge--origin { background: var(--primary, #e11d48); }
.comic-card__badge--serial {
    background: linear-gradient(135deg, rgba(22,163,74,.95), rgba(21,128,61,.95));
    margin-left: auto;
}
.comic-card__chapters { z-index: 2; }
.card-tax {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    margin: 0 0 6px;
    font-size: 12px;
    line-height: 1.3;
    color: var(--text-muted);
}
.card-tax__link {
    color: var(--text-muted);
    text-decoration: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-tax__link:hover { color: var(--primary); }
.card-tax__sep { opacity: .45; }
.comic-card__meta-stats {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.comic-card__meta-fav::before {
    content: "? ";
    opacity: .7;
}
.video-card .card-tax { margin-top: 2px; }

.listing-discover {
    margin-top: 28px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* Manga author list (replaces AV square wall) */
.author-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.author-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--card-radius, 10px);
    background: var(--bg-surface, var(--bg-elevated, transparent));
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s, background .15s;
}
.author-card:hover {
    border-color: var(--primary);
    background: var(--primary-light, rgba(99,102,241,.06));
}
.author-card__avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    background: var(--primary);
}
.author-card__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.author-card__name {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.author-card__meta {
    font-size: 12px;
    color: var(--text-muted);
}
@media (min-width: 900px) {
    .author-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 12px;
    }
}
