/* =====================================================================
   ROGUEPOPCORN design system
   Dark-first, mobile-first, no CSS framework.
   Layer order: tokens -> reset -> primitives -> components -> layout.
   ===================================================================== */

/* ---------------------------------------------------------------
   1. Design tokens
   --------------------------------------------------------------- */
:root {
    /* --accent is injected server-side from admin settings. */
    --accent: #f5a524;
    --accent-ink: #14100a;
    --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);

    --bg: #0a0a0f;
    --bg-elevated: #12121a;
    --bg-raised: #191922;
    --bg-hover: #21212c;

    --surface-border: #262633;
    --surface-border-strong: #34344a;

    --text: #e9e9f0;
    --text-muted: #a0a0b2;
    --text-dim: #6e6e82;

    --danger: #f2555a;
    --success: #3fbf7f;
    --warning: #f5a524;
    --info: #4b9bf5;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 6px 24px rgba(0, 0, 0, .45);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);

    --speed: 180ms;
    --speed-slow: 240ms;
    --ease: cubic-bezier(.4, 0, .2, 1);

    --header-h: 60px;
    --bottom-nav-h: 62px;
    --container: 1440px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
            'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
}

/* ---------------------------------------------------------------
   2. Reset
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    /* Nothing may ever cause a sideways scroll. */
    overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; background: var(--bg-raised); }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

/* Icons are stroked line art by default. */
svg.icon {
    width: 20px; height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}
.icon--xs { width: 14px; height: 14px; }
.icon--sm { width: 17px; height: 17px; }
.icon--lg { width: 26px; height: 26px; }

/* ---------------------------------------------------------------
   3. Accessibility
   --------------------------------------------------------------- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -100px; left: var(--space-3);
    z-index: 200;
    padding: var(--space-3) var(--space-4);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
    border-radius: var(--radius);
    transition: top var(--speed) var(--ease);
}
.skip-link:focus { top: var(--space-3); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------------------------------------------------------------
   4. Layout primitives
   --------------------------------------------------------------- */
.main {
    min-height: 60vh;
    /* Clear the fixed bottom nav on mobile, including the iOS home indicator. */
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + var(--space-5));
}

@media (min-width: 1024px) {
    .main { padding-bottom: var(--space-8); }
}

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space-4);
}

@media (min-width: 768px)  { .container { padding-inline: var(--space-5); } }
@media (min-width: 1280px) { .container { padding-inline: var(--space-6); } }

.section { padding-block: var(--space-5); }
.section__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}
.section__title { font-size: 20px; }
.section__subtitle { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

@media (min-width: 768px) { .section__title { font-size: 24px; } }

/* ---------------------------------------------------------------
   5. Buttons
   --------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    /* 44px minimum touch target. */
    min-height: 44px;
    padding: 0 var(--space-5);
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--speed) var(--ease),
                border-color var(--speed) var(--ease),
                transform var(--speed) var(--ease),
                opacity var(--speed) var(--ease);
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }

.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }

.btn--ghost {
    background: var(--bg-raised);
    border-color: var(--surface-border);
    color: var(--text);
}
.btn--ghost:hover { background: var(--bg-hover); border-color: var(--surface-border-strong); }

.btn--outline { border-color: var(--surface-border-strong); color: var(--text); }
.btn--outline:hover { background: var(--bg-raised); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 88%, black); }

.btn--sm { min-height: 38px; padding: 0 var(--space-4); font-size: 13px; }
.btn--lg { min-height: 50px; padding: 0 var(--space-6); font-size: 15px; }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: 44px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    border-radius: var(--radius);
    color: var(--text-muted);
    position: relative;
    transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.icon-btn:hover { background: var(--bg-raised); color: var(--text); }
.icon-btn.is-active { color: var(--accent); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 36px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--bg-raised);
    border: 1px solid var(--surface-border);
    color: var(--text-muted);
    font-size: 13px;
    transition: all var(--speed) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--surface-border-strong); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* Liquid glass utilities — frosted surfaces used on chrome and overlays. */
.glass-surface {
    background: color-mix(in srgb, var(--bg) 72%, transparent) !important;
    backdrop-filter: blur(18px) saturate(1.35);
    -webkit-backdrop-filter: blur(18px) saturate(1.35);
    border-bottom-color: color-mix(in srgb, #fff 12%, var(--surface-border));
}

.glass-panel {
    background: color-mix(in srgb, var(--bg-elevated) 78%, transparent) !important;
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    border: 1px solid color-mix(in srgb, #fff 14%, var(--surface-border));
    box-shadow:
        0 10px 40px rgba(0, 0, 0, .35),
        inset 0 1px 0 rgba(255, 255, 255, .08);
}

.chip.glass-chip,
.chip--social {
    background: color-mix(in srgb, var(--bg-elevated) 70%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-color: color-mix(in srgb, #fff 12%, var(--surface-border));
}

.site-notice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
}

.site-notice__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
}

.site-notice__body { flex: 1; min-width: 0; }
.site-notice__text {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}
.site-notice__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: var(--space-2);
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
}
.site-notice__close {
    flex: none;
    margin-top: -4px;
    color: var(--text-muted);
}
.site-notice__close:hover { color: var(--text); }
.site-notice--success .site-notice__icon {
    background: color-mix(in srgb, var(--success, #3ecf8e) 18%, transparent);
    color: var(--success, #3ecf8e);
}
.site-notice--warning .site-notice__icon {
    background: color-mix(in srgb, var(--warning, #f5a524) 18%, transparent);
    color: var(--warning, #f5a524);
}

/* ---------------------------------------------------------------
   6. Header
   --------------------------------------------------------------- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(18px) saturate(1.35);
    -webkit-backdrop-filter: blur(18px) saturate(1.35);
    border-bottom: 1px solid color-mix(in srgb, #fff 10%, var(--surface-border));
    padding-top: env(safe-area-inset-top);
}

.header__inner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    height: var(--header-h);
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space-3);
}

@media (min-width: 768px) { .header__inner { padding-inline: var(--space-5); gap: var(--space-4); } }

.header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: auto;
    /* Without this the actions refuse to shrink and push the row wider than
       the viewport at the narrow end of the desktop range. */
    min-width: 0;
}

.header__burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px; height: 42px;
    padding: 0 10px;
    border-radius: var(--radius);
}
.burger__bar {
    display: block; height: 2px; width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: transform var(--speed) var(--ease), opacity var(--speed) var(--ease);
}
.header__burger[aria-expanded="true"] .burger__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.header__burger[aria-expanded="true"] .burger__bar:nth-child(2) { opacity: 0; }
.header__burger[aria-expanded="true"] .burger__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/*
 * The desktop nav, the burger and the mobile drawer must share one breakpoint,
 * or the burger ends up visible with no drawer to open.
 */
@media (min-width: 1024px) { .header__burger { display: none; } }

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 800;
    /* Comfortable tap target even when the wordmark is hidden on small phones. */
    min-height: 44px;
    flex-shrink: 0;
}
.brand__mark {
    display: grid; place-items: center;
    width: 32px; height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #f5564a));
    color: var(--accent-ink);
    font-size: 13px;
    letter-spacing: -.03em;
}
.brand__text { font-size: 16px; letter-spacing: -.02em; }
.brand__logo { height: 32px; width: auto; }

@media (max-width: 419px) { .brand__text { display: none; } }

.nav--desktop { display: none; align-items: center; gap: 2px; flex-shrink: 0; }
@media (min-width: 1024px) { .nav--desktop { display: flex; } }

.nav__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 40px;
    padding: 0 var(--space-3);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.nav__link:hover { color: var(--text); background: color-mix(in srgb, #fff 6%, transparent); }
.nav__link.is-active { color: var(--accent); }
.nav__link--social .nav__social-label { display: none; }
@media (min-width: 1280px) {
    .nav__link--social .nav__social-label { display: inline; }
}

.nav__dropdown { position: relative; }

.dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 110;
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--speed) var(--ease),
                transform var(--speed) var(--ease),
                visibility var(--speed);
}
.nav__dropdown.is-open .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.nav__dropdown--right .dropdown { left: auto; right: 0; }

.dropdown--grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(130px, 1fr));
    gap: 2px;
    width: max-content;
    max-width: 90vw;
}
.dropdown--menu { min-width: 216px; }

.dropdown__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    /* 11px keeps the row at a 44px touch target: the account menu is reachable
       on phones, not just on desktop. */
    padding: 11px var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    text-align: left;
    transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.dropdown__item .icon { flex: none; opacity: .9; }
.dropdown__item:hover { background: var(--bg-hover); color: var(--text); }
.dropdown__item--accent { color: var(--accent); font-weight: 600; }
.dropdown__item--danger { color: var(--danger); }

.dropdown__header {
    display: flex; flex-direction: column;
    padding: var(--space-3);
    border-bottom: 1px solid var(--surface-border);
    margin-bottom: var(--space-2);
}
.dropdown__header span { font-size: 12px; color: var(--text-dim); }
.dropdown__form { margin: 0; }

.avatar-btn {
    display: grid; place-items: center;
    width: 42px; height: 42px;
    border-radius: var(--radius-pill);
}

.avatar { border-radius: 50%; object-fit: cover; flex: none; }
.avatar--initials {
    display: grid; place-items: center;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .72);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.6;
    backdrop-filter: blur(4px);
}
.badge--quality { background: var(--accent); color: var(--accent-ink); }
.badge--rating { background: rgba(0, 0, 0, .78); color: var(--accent); }

.icon-btn--badge .badge {
    position: absolute;
    top: 4px; right: 2px;
    min-width: 17px;
    padding: 0 4px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    border-radius: var(--radius-pill);
    text-align: center;
}

.header__hide-mobile { display: none; }
@media (min-width: 768px) { .header__hide-mobile { display: inline-flex; } }

.header__show-mobile { display: inline-flex; }
@media (min-width: 768px) { .header__show-mobile { display: none; } }

/* Mobile drawer */
.mobile-menu {
    position: fixed;
    inset: calc(var(--header-h) + env(safe-area-inset-top)) 0 0 0;
    z-index: 99;
    background: var(--bg);
    overflow-y: auto;
    padding: var(--space-4) var(--space-4)
             calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + var(--space-6));
    animation: slideDown var(--speed-slow) var(--ease);
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

@media (min-width: 1024px) { .mobile-menu { display: none !important; } }

.mobile-menu__nav { display: flex; flex-direction: column; gap: var(--space-1); }
.mobile-menu__link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 var(--space-3);
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.mobile-menu__link:hover { background: color-mix(in srgb, #fff 6%, transparent); }
.mobile-menu__link .icon { flex: none; color: var(--text-muted); }
.mobile-menu__social {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3) var(--space-3);
}
.mobile-menu__group summary { list-style: none; }
.mobile-menu__group summary::-webkit-details-marker { display: none; }
.mobile-menu__group summary::after {
    content: '';
    margin-left: auto;
    width: 8px; height: 8px;
    border-right: 2px solid var(--text-dim);
    border-bottom: 2px solid var(--text-dim);
    transform: rotate(45deg);
    transition: transform var(--speed) var(--ease);
}
.mobile-menu__group[open] summary::after { transform: rotate(-135deg); }

.mobile-menu__chips {
    display: flex; flex-wrap: wrap; gap: var(--space-2);
    padding: var(--space-3) var(--space-3) var(--space-4);
}
.mobile-menu__auth { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-5); }

/* ---------------------------------------------------------------
   7. Search
   --------------------------------------------------------------- */
.search { position: relative; display: none; }

/* Allowed to shrink so the header row never overflows: the search field gives
   up width before the navigation does. */
@media (min-width: 768px) {
    .search { display: block; flex: 0 1 220px; width: 220px; min-width: 120px; }
}
@media (min-width: 1280px) { .search { flex-basis: 320px; width: 320px; } }

.search.is-mobile-open {
    display: block;
    position: fixed;
    inset: calc(var(--header-h) + env(safe-area-inset-top)) 0 auto 0;
    width: auto;
    z-index: 120;
    padding: var(--space-3);
    background: var(--bg);
    border-bottom: 1px solid var(--surface-border);
}

.search__form { position: relative; display: flex; align-items: center; }
.search__icon {
    position: absolute; left: 12px;
    color: var(--text-dim);
    pointer-events: none;
}
.search__input {
    width: 100%;
    height: 42px;
    padding: 0 38px 0 40px;
    border-radius: var(--radius-pill);
    background: var(--bg-raised);
    border: 1px solid var(--surface-border);
    color: var(--text);
    font-size: 14px;
    transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.search__input::placeholder { color: var(--text-dim); }
.search__input:focus { outline: none; border-color: var(--accent); background: var(--bg-elevated); }
.search__input::-webkit-search-cancel-button { display: none; }

.search__clear {
    position: absolute; right: 8px;
    display: grid; place-items: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    color: var(--text-dim);
}
.search__clear:hover { background: var(--bg-hover); color: var(--text); }

.search__panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    z-index: 130;
    max-height: min(420px, 60vh);
    overflow-y: auto;
    padding: var(--space-2);
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.search__section + .search__section { margin-top: var(--space-2); }
.search__section-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-dim);
}
.search__link { color: var(--accent); font-size: 11px; font-weight: 600; }

.search__item {
    display: flex; align-items: center; gap: var(--space-3);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    text-align: left;
    transition: background var(--speed) var(--ease);
}
.search__item:hover, .search__item.is-active { background: var(--bg-hover); }
.search__item img { width: 38px; height: 54px; border-radius: 6px; object-fit: cover; flex: none; }
.search__item-body { min-width: 0; }
.search__item-title {
    font-size: 14px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search__item-meta { font-size: 12px; color: var(--text-dim); }

.search__state { padding: var(--space-5); text-align: center; color: var(--text-muted); font-size: 14px; }

.spinner {
    display: inline-block;
    width: 15px; height: 15px;
    border: 2px solid var(--surface-border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------
   8. Movie card + grid
   --------------------------------------------------------------- */
.grid {
    display: grid;
    /* 2 columns on the smallest phones, scaling up to 6 on wide desktops. */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}
@media (min-width: 480px)  { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px)  { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1440px) { .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.card { position: relative; min-width: 0; }

.card__poster {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-raised);
}

.card__img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--speed-slow) var(--ease);
}
@media (hover: hover) {
    .card:hover .card__img { transform: scale(1.05); }
}

.card__badges {
    position: absolute; top: var(--space-2); left: var(--space-2);
    display: flex; flex-wrap: wrap; gap: 4px;
    max-width: calc(100% - var(--space-4));
}

.card__episode {
    position: absolute; bottom: var(--space-2); left: var(--space-2); right: var(--space-2);
    padding: 3px 7px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .76);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.card__overlay {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    background: linear-gradient(180deg, rgba(0,0,0,.1), rgba(0,0,0,.6));
    opacity: 0;
    transition: opacity var(--speed) var(--ease);
}
@media (hover: hover) {
    .card:hover .card__overlay { opacity: 1; }
}

.card__play {
    display: grid; place-items: center;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    transform: scale(.85);
    transition: transform var(--speed) var(--ease);
}
.card:hover .card__play { transform: scale(1); }

/*
 * Card actions.
 * On touch devices they are always visible (there is no hover), on pointer
 * devices they fade in with the overlay.
 */
.card__actions {
    position: absolute;
    top: var(--space-2); right: var(--space-2);
    display: flex; flex-direction: column; gap: 6px;
    z-index: 2;
}

.card__action {
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(10, 10, 15, .82);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #fff;
    backdrop-filter: blur(6px);
    transition: background var(--speed) var(--ease),
                color var(--speed) var(--ease),
                transform var(--speed) var(--ease);
}
.card__action:hover { background: var(--accent); color: var(--accent-ink); }
.card__action:active { transform: scale(.9); }
.card__action.is-active { background: var(--accent); color: var(--accent-ink); }
.card__action.is-active svg { fill: currentColor; }

@media (hover: hover) and (pointer: fine) {
    .card__actions { opacity: 0; transition: opacity var(--speed) var(--ease); }
    .card:hover .card__actions,
    .card:focus-within .card__actions { opacity: 1; }
}

.card__body { padding-top: var(--space-2); }
.card__title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card__title a:hover { color: var(--accent); }
.card__origin {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card__meta {
    display: flex; gap: var(--space-2);
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-dim);
}
.card__meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Progress bar on continue-watching cards */
.card__progress {
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, .2);
}
.card__progress span { display: block; height: 100%; background: var(--accent); }

/* ---------------------------------------------------------------
   9. Horizontal rows
   --------------------------------------------------------------- */
.row { padding-block: var(--space-4); }

.row__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3);
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space-4);
    margin-bottom: var(--space-3);
}
@media (min-width: 768px)  { .row__head { padding-inline: var(--space-5); } }
@media (min-width: 1280px) { .row__head { padding-inline: var(--space-6); } }

.row__title { font-size: 18px; }
@media (min-width: 768px) { .row__title { font-size: 21px; } }

.row__tools { display: flex; align-items: center; gap: var(--space-3); }
.row__more {
    display: inline-flex; align-items: center; gap: 3px;
    color: var(--text-muted); font-size: 13px; font-weight: 600;
    white-space: nowrap;
}
.row__more:hover { color: var(--accent); }

.row__arrows { display: none; gap: var(--space-1); }
@media (min-width: 1024px) { .row__arrows { display: flex; } }

.row__arrow {
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--bg-raised);
    border: 1px solid var(--surface-border);
    color: var(--text-muted);
    transition: all var(--speed) var(--ease);
}
.row__arrow:hover { background: var(--bg-hover); color: var(--text); }
.row__arrow[disabled] { opacity: .35; pointer-events: none; }

.row__track {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: var(--space-4);
    padding-inline: var(--space-4);
    padding-bottom: var(--space-2);
    /* Hide the scrollbar without disabling scrolling. */
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.row__track::-webkit-scrollbar { display: none; }

@media (min-width: 768px)  { .row__track { padding-inline: var(--space-5); scroll-padding-left: var(--space-5); gap: var(--space-4); } }
@media (min-width: 1280px) { .row__track { padding-inline: var(--space-6); scroll-padding-left: var(--space-6); } }

.row__item {
    flex: 0 0 auto;
    width: 140px;
    scroll-snap-align: start;
}
@media (min-width: 480px)  { .row__item { width: 155px; } }
@media (min-width: 768px)  { .row__item { width: 170px; } }
@media (min-width: 1280px) { .row__item { width: 190px; } }

/* ---------------------------------------------------------------
   10. Hero
   --------------------------------------------------------------- */
.hero {
    position: relative;
    min-height: 66vh;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
@media (min-width: 768px)  { .hero { min-height: 72vh; } }
@media (min-width: 1280px) { .hero { min-height: 78vh; } }

.hero__media { position: absolute; inset: 0; }
.hero__img { width: 100%; height: 100%; object-fit: cover; }

.hero__scrim {
    position: absolute; inset: 0;
    background:
        linear-gradient(180deg, rgba(10,10,15,.35) 0%, rgba(10,10,15,.1) 30%, var(--bg) 96%),
        linear-gradient(90deg, rgba(10,10,15,.9) 0%, rgba(10,10,15,.35) 55%, transparent 100%);
}

.hero__inner {
    position: relative;
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--space-6) var(--space-4) var(--space-5);
}
@media (min-width: 768px)  { .hero__inner { padding: var(--space-7) var(--space-5) var(--space-6); } }
@media (min-width: 1280px) { .hero__inner { padding: var(--space-8) var(--space-6) var(--space-7); } }

.hero__content {
    max-width: 620px;
    position: relative;
}

/* Liquid-glass border around the hero banner content. */
.hero__content::before {
    content: '';
    position: absolute;
    inset: -14px -14px -12px -14px;
    border-radius: var(--radius-lg);
    background: rgba(10, 10, 15, .28);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .14);
    z-index: -1;
    pointer-events: none;
}

.hero__title {
    font-size: clamp(26px, 6vw, 52px);
    line-height: 1.08;
    letter-spacing: -.03em;
    margin-bottom: var(--space-2);
}
.hero__origin { color: var(--text-muted); font-size: 14px; margin-bottom: var(--space-3); }

.hero__meta {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: 13px;
    color: var(--text-muted);
}
.hero__dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-dim); }

.hero__desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: var(--space-5);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
@media (min-width: 768px) { .hero__desc { font-size: 15px; } }

.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

.hero__dots {
    display: flex; gap: 6px;
    margin-top: var(--space-5);
}
.hero__dot-btn {
    width: 24px; height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,.25);
    transition: background var(--speed) var(--ease), width var(--speed) var(--ease);
}
.hero__dot-btn.is-active { background: var(--accent); width: 34px; }

/* ---------------------------------------------------------------
   11. Movie detail
   --------------------------------------------------------------- */
.detail__backdrop {
    position: relative;
    height: 240px;
    overflow: hidden;
}
@media (min-width: 768px)  { .detail__backdrop { height: 340px; } }
@media (min-width: 1280px) { .detail__backdrop { height: 420px; } }

.detail__backdrop img { width: 100%; height: 100%; object-fit: cover; }
.detail__backdrop::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(10,10,15,.45), var(--bg) 94%);
}

.detail__body {
    position: relative;
    max-width: var(--container);
    margin-inline: auto;
    padding: 0 var(--space-4) var(--space-6);
    margin-top: -80px;
}
@media (min-width: 768px)  { .detail__body { padding-inline: var(--space-5); margin-top: -110px; } }
@media (min-width: 1280px) { .detail__body { padding-inline: var(--space-6); } }

.detail__top {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--space-4);
    align-items: end;
}
@media (min-width: 768px)  { .detail__top { grid-template-columns: 200px 1fr; gap: var(--space-5); } }
@media (min-width: 1024px) { .detail__top { grid-template-columns: 240px 1fr; } }

.detail__poster {
    aspect-ratio: 2/3;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--bg-raised);
}
.detail__poster img { width: 100%; height: 100%; object-fit: cover; }

.detail__title { font-size: clamp(20px, 4.5vw, 36px); letter-spacing: -.025em; }
.detail__origin { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.detail__meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
    margin-top: var(--space-3);
    font-size: 13px;
    color: var(--text-muted);
}

.detail__tag {
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    border: 1px solid var(--surface-border);
    font-size: 12px;
}
.detail__tag--accent { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.detail__actions {
    display: flex; flex-wrap: wrap; gap: var(--space-2);
    margin-top: var(--space-4);
}

.detail__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    margin-top: var(--space-6);
}
@media (min-width: 1024px) { .detail__grid { grid-template-columns: minmax(0, 1fr) 320px; } }

.detail__section + .detail__section { margin-top: var(--space-6); }
.detail__section-title { font-size: 17px; margin-bottom: var(--space-3); }

.detail__desc { color: var(--text-muted); font-size: 14px; line-height: 1.7; }

.info-list { display: grid; gap: var(--space-3); }
.info-list__row {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: var(--space-3);
    font-size: 14px;
}
.info-list__label { color: var(--text-dim); }
.info-list__value { color: var(--text); }
.info-list__value a:hover { color: var(--accent); }

.tag-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Episode list */
.episodes__servers {
    display: flex; flex-wrap: wrap; gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.episodes__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: var(--space-2);
    max-height: 340px;
    overflow-y: auto;
}
@media (min-width: 768px) {
    .episodes__grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}

.episode {
    display: grid; place-items: center;
    min-height: 44px;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    border: 1px solid var(--surface-border);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: all var(--speed) var(--ease);
}
.episode:hover { background: var(--bg-hover); color: var(--text); border-color: var(--surface-border-strong); }
.episode.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.episode.is-watched { border-color: color-mix(in srgb, var(--success) 45%, transparent); }

/* ---------------------------------------------------------------
   12. Player
   --------------------------------------------------------------- */
.player-page {
    background: #000;
}

html:has(body.player-page),
body.player-page {
    overflow-x: clip;
}

/* Immersive watch mode: no bottom nav chewing controls or the tap overlay. */
.player-page .bottom-nav { display: none; }
.player-page .main {
    padding-bottom: var(--space-4);
    min-height: auto;
}
.player-page .header { border-bottom-color: transparent; }
.player-page .breadcrumbs { display: none; }
.player-page .footer { display: none; }

@media (min-width: 1024px) {
    .player-page .main { padding-bottom: var(--space-6); }
}

.player__stage {
    position: relative;
    width: 100%;
    background: #000;
}

.player__frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}
.player__frame iframe,
.player__frame video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
    touch-action: manipulation;
}

/* Tap hint for cross-origin embeds on touch devices (does not block taps). */
.player__tap {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-content: center;
    gap: var(--space-3);
    margin: 0;
    padding: var(--space-4);
    border: 0;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    pointer-events: none;
    opacity: 0;
    transition: opacity .35s ease;
    -webkit-tap-highlight-color: transparent;
}
.player__tap.is-visible {
    opacity: 1;
}
.player__tap-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-inline: auto;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
}
.player__tap-label {
    font-size: 15px;
    font-weight: 600;
}

.player__error {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-content: center;
    gap: var(--space-3);
    padding: var(--space-5);
    background: rgba(10, 10, 15, .92);
    text-align: center;
}
.player__error-text {
    font-size: 15px;
    color: var(--text-muted);
    margin: 0;
}
.player__error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
}

/* On short landscape phones the 16:9 box can exceed the viewport. */
@media (max-height: 480px) and (orientation: landscape) {
    .player-page .bottom-nav { display: none; }
    .player__frame { aspect-ratio: auto; height: 100vh; max-height: 100vh; }
    .player__bar { display: none; }
    .player__meta { display: none; }
}

.player__bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--space-3) var(--space-4);
}
@media (min-width: 768px) { .player__bar { padding-inline: var(--space-5); } }

.player__title { flex: 1 1 200px; min-width: 0; }
.player__title h1 {
    font-size: 16px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player__title p { font-size: 13px; color: var(--text-muted); }

.player__nav { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

@media (max-width: 767px) {
    .player__nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .player__hint { display: none; }
}

.player__meta .episodes__grid {
    max-height: min(52vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.episode.is-progress:not(.is-current) {
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.episode__mark {
    margin-right: 4px;
    color: var(--success);
    font-weight: 700;
}

/* Auto-next countdown */
.autonext {
    position: absolute;
    right: var(--space-4); bottom: var(--space-4);
    z-index: 5;
    width: min(310px, calc(100% - var(--space-6)));
    padding: var(--space-4);
    background: rgba(10, 10, 15, .93);
    border: 1px solid var(--surface-border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    animation: fadeInUp var(--speed-slow) var(--ease);
}
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.autonext__label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.autonext__title { font-size: 15px; font-weight: 600; margin: var(--space-1) 0 var(--space-3); }
.autonext__actions { display: flex; gap: var(--space-2); }

.autonext__ring {
    position: absolute; top: var(--space-4); right: var(--space-4);
    font-size: 13px; font-weight: 700; color: var(--accent);
}

/* ---------------------------------------------------------------
   13. Comments
   --------------------------------------------------------------- */
.comment { display: flex; gap: var(--space-3); padding-block: var(--space-4); }
.comment + .comment { border-top: 1px solid var(--surface-border); }
.comment__body { flex: 1; min-width: 0; }

.comment__head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.comment__author { font-weight: 600; font-size: 14px; }
.comment__role {
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}
.comment__time { font-size: 12px; color: var(--text-dim); }

.comment__text {
    margin-top: var(--space-2);
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
    /* User content must never break the layout. */
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.comment__actions { display: flex; gap: var(--space-3); margin-top: var(--space-2); }
.comment__action {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600;
    color: var(--text-dim);
    transition: color var(--speed) var(--ease);
}
.comment__action:hover { color: var(--text); }
.comment__action.is-active { color: var(--accent); }
.comment__action.is-active svg { fill: currentColor; }

.comment__replies {
    margin-top: var(--space-3);
    padding-left: var(--space-4);
    border-left: 2px solid var(--surface-border);
}

.comment-form { margin-bottom: var(--space-4); }
.comment-form__row { display: flex; gap: var(--space-3); }
.comment-form__foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-2);
}
.comment-form__count { font-size: 12px; color: var(--text-dim); }

/* ---------------------------------------------------------------
   14. Forms
   --------------------------------------------------------------- */
.field { margin-bottom: var(--space-4); }
.field__label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}
.field__hint { margin-top: var(--space-1); font-size: 12px; color: var(--text-dim); }
.field__error { margin-top: var(--space-1); font-size: 12px; color: var(--danger); }

.input, .textarea, .select {
    width: 100%;
    min-height: 46px;
    padding: 11px var(--space-4);
    background: var(--bg-raised);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px; /* >=16px equivalents avoid iOS zoom; 15px + no zoom meta is fine */
    transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }

/* iOS zooms in on focus for inputs under 16px. */
@media (max-width: 767px) {
    .input, .textarea, .select { font-size: 16px; }
}

.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b2' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 38px;
}

.checkbox { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; min-height: 44px; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.form-grid { display: grid; gap: var(--space-3); }
@media (min-width: 640px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------
   Movie filter panel (menu / search)
   --------------------------------------------------------------- */
.movie-filter {
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
}

.movie-filter__summary {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    cursor: pointer;
    padding: var(--space-4) var(--space-5);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    user-select: none;
}
.movie-filter__summary::-webkit-details-marker { display: none; }
.movie-filter__chevron {
    margin-left: auto;
    transition: transform var(--speed) var(--ease);
}
.movie-filter[open] .movie-filter__chevron { transform: rotate(180deg); }

.movie-filter__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    padding: 0 var(--space-5) var(--space-5);
    border-top: 1px solid color-mix(in srgb, #fff 8%, var(--surface-border));
    padding-top: var(--space-5);
}

.movie-filter__label {
    margin: 0 0 var(--space-3);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.movie-filter__criteria {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}
@media (min-width: 640px) {
    .movie-filter__criteria { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .movie-filter__criteria { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

.movie-filter__select {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, #fff 12%, var(--surface-border));
    background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.movie-filter__select span {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
}
.movie-filter__select select {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    padding: 0;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9aab' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    padding-right: 16px;
    cursor: pointer;
}
.movie-filter__select select:focus { outline: none; }

.movie-filter__az {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.movie-filter__az-btn,
.movie-filter__genre-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, #fff 10%, var(--surface-border));
    background: color-mix(in srgb, var(--bg) 60%, transparent);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--speed) var(--ease), color var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.movie-filter__az-btn {
    min-width: 36px;
    padding: 0 8px;
}
.movie-filter__az-btn:hover,
.movie-filter__genre-btn:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--surface-border));
    color: var(--accent);
}
.movie-filter__az-btn.is-active,
.movie-filter__genre-btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.movie-filter__genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.movie-filter__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}
.movie-filter__submit {
    min-width: 140px;
}

/* ---------------------------------------------------------------
   15. Auth screens
   --------------------------------------------------------------- */
.body--auth, .body--bare { display: grid; place-items: center; min-height: 100vh; }

.auth-shell { width: 100%; padding: var(--space-5) var(--space-4); }
.auth-shell__inner { width: 100%; max-width: 420px; margin-inline: auto; }
.auth-shell__brand {
    display: flex; justify-content: center;
    margin-bottom: var(--space-5);
    font-size: 20px;
}

.auth-card {
    padding: var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}
@media (min-width: 480px) { .auth-card { padding: var(--space-6); } }

.auth-card__title { font-size: 22px; margin-bottom: var(--space-1); }
.auth-card__subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: var(--space-5); }
.auth-card__foot {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--surface-border);
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}
.auth-card__foot a { color: var(--accent); font-weight: 600; }

.link-accent { color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------
   16. Alerts, toasts, modals, sheets
   --------------------------------------------------------------- */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    border: 1px solid;
    font-size: 14px;
    margin-bottom: var(--space-4);
}
.alert--success { background: color-mix(in srgb, var(--success) 12%, transparent); border-color: color-mix(in srgb, var(--success) 40%, transparent); color: var(--success); }
.alert--error   { background: color-mix(in srgb, var(--danger) 12%, transparent);  border-color: color-mix(in srgb, var(--danger) 40%, transparent);  color: var(--danger); }
.alert--info    { background: color-mix(in srgb, var(--info) 12%, transparent);    border-color: color-mix(in srgb, var(--info) 40%, transparent);    color: var(--info); }
.alert--warning { background: color-mix(in srgb, var(--warning) 12%, transparent); border-color: color-mix(in srgb, var(--warning) 40%, transparent); color: var(--warning); }
.alert__list { display: grid; gap: 4px; padding-left: var(--space-4); list-style: disc; }

.toast-stack {
    position: fixed;
    left: 50%;
    bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + var(--space-4));
    transform: translateX(-50%);
    z-index: 300;
    display: flex; flex-direction: column; gap: var(--space-2);
    width: calc(100% - var(--space-6));
    max-width: 380px;
    pointer-events: none;
}
@media (min-width: 1024px) {
    .toast-stack { left: auto; right: var(--space-5); bottom: var(--space-5); transform: none; }
}

.toast {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    pointer-events: auto;
    animation: toastIn var(--speed-slow) var(--ease);
}
.toast.is-leaving { animation: toastOut var(--speed) var(--ease) forwards; }
.toast--success { border-left: 3px solid var(--success); }
.toast--error   { border-left: 3px solid var(--danger); }
.toast--info    { border-left: 3px solid var(--info); }

@keyframes toastIn  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

.modal, .sheet {
    position: fixed; inset: 0;
    z-index: 400;
    display: grid;
}
.modal { place-items: center; padding: var(--space-4); }
.sheet { align-items: end; }

.modal__backdrop, .sheet__backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(3px);
    animation: fadeIn var(--speed) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal__panel {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
    backdrop-filter: blur(20px) saturate(1.35);
    -webkit-backdrop-filter: blur(20px) saturate(1.35);
    border: 1px solid color-mix(in srgb, #fff 14%, var(--surface-border));
    border-radius: var(--radius-xl);
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, .08);
    animation: modalIn var(--speed-slow) var(--ease);
}
.modal__panel--sm { max-width: 400px; }
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(10px); } to { opacity: 1; transform: none; } }

.sheet__panel {
    position: relative;
    width: 100%;
    max-height: 84vh;
    overflow-y: auto;
    background: color-mix(in srgb, var(--bg-elevated) 84%, transparent);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    border-top: 1px solid color-mix(in srgb, #fff 12%, var(--surface-border));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheetIn var(--speed-slow) var(--ease);
}
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }

.sheet__grip {
    width: 38px; height: 4px;
    margin: var(--space-3) auto 0;
    border-radius: 2px;
    background: var(--surface-border-strong);
}

.modal__head, .sheet__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--surface-border);
}
.modal__title, .sheet__title { font-size: 17px; }
.modal__body, .sheet__body { padding: var(--space-5); }
.modal__text { color: var(--text-muted); font-size: 14px; margin-bottom: var(--space-4); }
.modal__actions { display: flex; flex-direction: column; gap: var(--space-2); }

/* ---------------------------------------------------------------
   17. Bottom navigation
   --------------------------------------------------------------- */
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: color-mix(in srgb, var(--bg-elevated) 72%, transparent);
    backdrop-filter: blur(18px) saturate(1.35);
    -webkit-backdrop-filter: blur(18px) saturate(1.35);
    border-top: 1px solid color-mix(in srgb, #fff 10%, var(--surface-border));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
    padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 1024px) { .bottom-nav { display: none; } }

.bottom-nav__item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    /* 44px+ target height. */
    min-height: var(--bottom-nav-h);
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 600;
    transition: color var(--speed) var(--ease);
}
.bottom-nav__item.is-active { color: var(--accent); }
.bottom-nav__item .icon { width: 22px; height: 22px; }

/* ---------------------------------------------------------------
   18. Footer
   --------------------------------------------------------------- */
.footer {
    margin-top: var(--space-7);
    border-top: 1px solid var(--surface-border);
    background: var(--bg-elevated);
}

.footer__inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--space-6) var(--space-4);
}
@media (min-width: 640px)  { .footer__inner { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer__inner { grid-template-columns: 2fr 1fr 1fr 1.4fr; padding-inline: var(--space-5); } }

.footer__tagline { margin-top: var(--space-3); color: var(--text-dim); font-size: 13px; max-width: 320px; }
.footer__col { display: flex; flex-direction: column; gap: var(--space-2); }
.footer__title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: var(--space-1); }
.footer__link { color: var(--text-muted); font-size: 14px; }
.footer__link:hover { color: var(--accent); }
.footer__note { color: var(--text-dim); font-size: 12px; line-height: 1.6; margin-top: var(--space-2); }

.footer__bottom {
    border-top: 1px solid var(--surface-border);
    padding: var(--space-4);
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

/* ---------------------------------------------------------------
   19. Pagination, breadcrumbs, empty states, skeletons
   --------------------------------------------------------------- */
.pagination {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-6);
}

.pagination__btn {
    display: grid; place-items: center;
    min-width: 42px; height: 42px;
    padding-inline: var(--space-2);
    border-radius: var(--radius);
    background: var(--bg-raised);
    border: 1px solid var(--surface-border);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    transition: all var(--speed) var(--ease);
}
.pagination__btn:hover { background: var(--bg-hover); color: var(--text); }
.pagination__btn.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pagination__btn.is-disabled { opacity: .35; pointer-events: none; }
.pagination__gap { color: var(--text-dim); padding-inline: 2px; }

.breadcrumbs {
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--space-3) var(--space-4) 0;
}
@media (min-width: 768px) { .breadcrumbs { padding-inline: var(--space-5); } }

.breadcrumbs__list {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1);
    font-size: 13px;
    color: var(--text-dim);
}
.breadcrumbs__item { display: inline-flex; align-items: center; gap: var(--space-1); }
.breadcrumbs__item a:hover { color: var(--accent); }
.breadcrumbs__sep { color: var(--text-dim); }

.empty-state {
    display: grid; place-items: center;
    gap: var(--space-3);
    padding: var(--space-8) var(--space-4);
    text-align: center;
}
.empty-state__icon { width: 52px; height: 52px; color: var(--text-dim); fill: none; stroke: currentColor; stroke-width: 1.4; }
.empty-state__title { font-size: 17px; }
.empty-state__text { color: var(--text-muted); font-size: 14px; max-width: 420px; }

.skeleton {
    background: linear-gradient(90deg, var(--bg-raised) 25%, var(--bg-hover) 50%, var(--bg-raised) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.skeleton--poster { aspect-ratio: 2/3; border-radius: var(--radius); }
.skeleton--line { height: 12px; margin-top: var(--space-2); }
.skeleton--short { width: 55%; }
.skeleton-card { min-width: 0; }

/* ---------------------------------------------------------------
   20. Account area
   --------------------------------------------------------------- */
.account {
    display: grid;
    /*
     * `minmax(0, 1fr)`, not `1fr`: a grid track sized `1fr` still refuses to go
     * below its content's min-content width, so the nowrap tab strip below
     * would widen the track past the viewport and take the whole page with it
     * instead of scrolling inside its own box.
     */
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--space-5) var(--space-4);
}
@media (min-width: 1024px) {
    .account { grid-template-columns: 240px minmax(0, 1fr); padding-inline: var(--space-5); }
}

.account__nav {
    display: flex;
    gap: var(--space-2);
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-2);
}
.account__nav::-webkit-scrollbar { display: none; }

@media (min-width: 1024px) {
    .account__nav {
        flex-direction: column;
        overflow: visible;
        position: sticky;
        top: calc(var(--header-h) + var(--space-4));
        align-self: start;
    }
}

.account__link {
    display: flex; align-items: center; gap: 8px;
    min-height: 44px;
    padding: 0 var(--space-4);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--bg-raised) 72%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid color-mix(in srgb, #fff 10%, var(--surface-border));
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: all var(--speed) var(--ease);
}
.account__link .icon { flex: none; }
.account__link:hover { color: var(--text); background: var(--bg-hover); }
.account__link.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.panel {
    background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
    backdrop-filter: blur(16px) saturate(1.25);
    -webkit-backdrop-filter: blur(16px) saturate(1.25);
    border: 1px solid color-mix(in srgb, #fff 12%, var(--surface-border));
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.panel + .panel { margin-top: var(--space-4); }
.panel__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}
.panel__title { font-size: 17px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}
@media (min-width: 640px)  { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .stat-grid { grid-template-columns: repeat(6, 1fr); } }

.stat {
    padding: var(--space-4);
    background: var(--bg-raised);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    text-align: center;
}
.stat__value { font-size: 22px; font-weight: 800; color: var(--accent); letter-spacing: -.02em; }
.stat__label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* Compact list rows used across history/library/admin */
.list-row {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) 0;
}
.list-row + .list-row { border-top: 1px solid var(--surface-border); }
.list-row__poster { width: 46px; height: 68px; border-radius: var(--radius-sm); object-fit: cover; flex: none; }
.list-row__body { flex: 1; min-width: 0; }
.list-row__title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row__meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.list-row__actions { display: flex; gap: var(--space-2); flex: none; }

.progress-bar { height: 4px; border-radius: 2px; background: var(--bg-hover); overflow: hidden; margin-top: 6px; }
.progress-bar span { display: block; height: 100%; background: var(--accent); }

/* ---------------------------------------------------------------
   21. Utilities
   --------------------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-accent{ color: var(--accent); }
.text-danger{ color: var(--danger); }
.text-center{ text-align: center; }
.text-sm    { font-size: 13px; }
.text-xs    { font-size: 12px; }

.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.wrap  { flex-wrap: wrap; }
.grow  { flex: 1; min-width: 0; }

[hidden] { display: none !important; }
