/* ==========================================================================
   LiteMedia — glass design system
   Monochrome, iOS-inspired. Blur is used only on small floating chrome
   (nav buttons, tab bar, menus, player controls) — never on grid cards —
   so scrolling large libraries stays smooth.
   ========================================================================== */

:root {
    color-scheme: dark;

    --bg: #000;
    --surface: #0e0e10;
    --surface-2: #161618;
    --fill-1: rgba(255, 255, 255, .05);
    --fill-2: rgba(255, 255, 255, .085);
    --fill-3: rgba(255, 255, 255, .14);
    --fill-4: rgba(255, 255, 255, .22);

    --label: #f5f5f7;
    --label-2: rgba(235, 235, 245, .6);
    --label-3: rgba(235, 235, 245, .34);
    --label-4: rgba(235, 235, 245, .18);
    --sep: rgba(255, 255, 255, .08);

    --red: #ff453a;
    --green: #30d158;
    --orange: #ff9f0a;

    --glass-bg: rgba(44, 44, 48, .36);
    --glass-bg-strong: rgba(30, 30, 33, .82);
    --glass-blur: blur(16px) saturate(190%) brightness(1.1);
    --glass-shadow: 0 12px 36px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .32);

    --r-xl: 28px;
    --r-lg: 22px;
    --r-md: 16px;
    --r-sm: 12px;

    --px: clamp(16px, 4.2vw, 56px);
    --maxw: 1680px;
    --ease: cubic-bezier(.22, .8, .24, 1);
    --spring: cubic-bezier(.34, 1.4, .5, 1);

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter",
            "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

    --tabbar-space: calc(108px + env(safe-area-inset-bottom));
}

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}

body {
    background: var(--bg);
    color: var(--label);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.35;
    letter-spacing: -.011em;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Soft ambient light so glass has something to refract at the top of the page */
body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 520px;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(60% 80% at 15% -10%, rgba(255,255,255,.075), transparent 70%),
        radial-gradient(50% 70% at 90% -20%, rgba(255,255,255,.05), transparent 70%);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: none; cursor: pointer; }
svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid rgba(255,255,255,.85); outline-offset: 2px; border-radius: 10px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   Glass material
   -------------------------------------------------------------------------- */
.glass {
    position: relative;
    isolation: isolate;
    /* Layered material: a soft top sheen over a light, translucent tint. */
    background:
        linear-gradient(180deg, rgba(255,255,255,.11) 0%, rgba(255,255,255,.03) 42%, rgba(255,255,255,0) 60%, rgba(255,255,255,.035) 100%),
        var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,.28),     /* top specular line */
        inset 0 -1px 1px rgba(255,255,255,.06),    /* bottom bounce light */
        inset 0 0 14px rgba(255,255,255,.045),     /* inner glow / thickness */
        var(--glass-shadow);
}
/* Specular rim: light catches the top-left and bottom-right edges */
.glass::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    padding: 1px;
    pointer-events: none;
    background: linear-gradient(135deg,
        rgba(255,255,255,.5) 0%,
        rgba(255,255,255,.12) 22%,
        rgba(255,255,255,.03) 50%,
        rgba(255,255,255,.1) 78%,
        rgba(255,255,255,.3) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass { background: var(--glass-bg-strong); }
}
@media (prefers-reduced-transparency: reduce) {
    .glass { background: #1c1c1e; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.gbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 44px;
    min-width: 44px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    color: var(--label);
    white-space: nowrap;
    transition: transform .25s var(--spring), background .2s, opacity .2s;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
.gbtn.icon { padding: 0; width: 44px; }
.gbtn:hover { background-color: rgba(60, 60, 64, .62); }
.gbtn:active { transform: scale(.92); }
.gbtn svg { width: 20px; height: 20px; fill: currentColor; }
.gbtn.active { background: rgba(255,255,255,.9); color: #000; }
.gbtn.active::after { opacity: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    background: var(--fill-2);
    color: var(--label);
    white-space: nowrap;
    transition: background .18s, transform .2s var(--spring), opacity .2s;
    touch-action: manipulation;
}
.btn:hover { background: var(--fill-3); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 17px; height: 17px; fill: currentColor; }
.btn.primary { background: #f5f5f7; color: #000; }
.btn.primary:hover { background: #fff; }
.btn.danger { background: rgba(255, 69, 58, .14); color: var(--red); }
.btn.danger:hover { background: rgba(255, 69, 58, .22); }
.btn.small { height: 32px; padding: 0 13px; font-size: 13px; }
.btn.block { width: 100%; height: 50px; border-radius: 14px; font-size: 17px; }

/* --------------------------------------------------------------------------
   Top navigation (floating glass buttons, compact title on scroll)
   -------------------------------------------------------------------------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: calc(10px + env(safe-area-inset-top)) var(--px) 10px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}
.navbar > * { pointer-events: auto; }
.navbar::before {
    content: "";
    position: absolute;
    inset: 0 0 -28px 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0,0,0,.86) 0%, rgba(0,0,0,.55) 55%, transparent 100%);
    opacity: 0;
    transition: opacity .3s var(--ease);
}
.navbar.scrolled::before { opacity: 1; }
.nav-left, .nav-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nav-right { justify-content: flex-end; }
.nav-title {
    font-size: 17px;
    font-weight: 600;
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .25s var(--ease), transform .25s var(--ease);
    pointer-events: none;
}
.navbar.scrolled .nav-title { opacity: 1; transform: none; }
.back-btn { max-width: 100%; padding: 0 16px 0 10px; }
.back-btn span { overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.back-btn svg { width: 22px; height: 22px; }

/* Page container */
.page {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 var(--px) var(--tabbar-space);
}

/* Large title */
.hero { padding: 6px 0 18px; }
.large-title {
    font-size: clamp(32px, 4.6vw, 44px);
    font-weight: 750;
    letter-spacing: -.028em;
    line-height: 1.08;
    overflow-wrap: anywhere;
}
.hero-sub { margin-top: 6px; color: var(--label-2); font-size: 15px; }

/* Folder title with inline rename (display name only — the folder on disk stays as is) */
.title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.title-row .large-title { min-width: 0; }
.large-title[contenteditable="true"] {
    outline: none;
    border-radius: 12px;
    padding: 0 10px;
    margin: 0 -10px;
    background: var(--fill-2);
    box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.28);
    cursor: text;
}
.rename-btn {
    flex: none;
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 50%;
    border: 0;
    background: var(--fill-2);
    color: var(--label-2);
    cursor: pointer;
    opacity: .7;
    transition: opacity .2s, background .2s, transform .2s var(--spring);
}
.rename-btn svg { width: 17px; height: 17px; fill: currentColor; }
.title-row:hover .rename-btn, .rename-btn:focus-visible { opacity: 1; }
.rename-btn:hover { background: var(--fill-3); color: var(--label); }
.rename-btn:active { transform: scale(.9); }
.rename-btn.saving { pointer-events: none; opacity: .4; }
.eyebrow {
    font-size: 13px; font-weight: 600; color: var(--label-3);
    text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px;
}

/* --------------------------------------------------------------------------
   Search field
   -------------------------------------------------------------------------- */
.search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 12px 0 14px;
    border-radius: 14px;
    background: var(--fill-2);
    transition: background .2s, box-shadow .2s;
    max-width: 640px;
}
.search:focus-within { background: var(--fill-3); box-shadow: 0 0 0 1px rgba(255,255,255,.14); }
.search svg { width: 18px; height: 18px; fill: var(--label-3); }
.search input {
    flex: 1; min-width: 0; height: 100%;
    background: transparent; border: none; outline: none;
    font-size: 17px; color: var(--label);
}
.search input::placeholder { color: var(--label-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--fill-4); color: #000;
}
.search-clear svg { width: 12px; height: 12px; fill: #1c1c1e; }
.search-clear[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Toolbar: segmented control + menus
   -------------------------------------------------------------------------- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }

.segmented {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 999px;
    background: var(--fill-1);
    box-shadow: inset 0 0 0 1px var(--sep);
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented a {
    flex-shrink: 0;
    height: 32px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 560;
    color: var(--label-2);
    transition: color .2s, background .25s var(--ease);
}
.segmented a:hover { color: var(--label); }
.segmented a.active {
    color: var(--label);
    background: var(--fill-3);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 1px 4px rgba(0,0,0,.35);
}

.menu-anchor { position: relative; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--fill-1);
    box-shadow: inset 0 0 0 1px var(--sep);
    font-size: 14px;
    font-weight: 560;
    color: var(--label);
    transition: background .2s, transform .2s var(--spring);
}
.pill:hover { background: var(--fill-2); }
.pill:active { transform: scale(.96); }
.pill svg { width: 16px; height: 16px; fill: currentColor; opacity: .8; }
.pill .dim { color: var(--label-2); font-weight: 500; }

.menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    min-width: 236px;
    padding: 6px;
    border-radius: 20px;
    background: rgba(36, 36, 38, .72);
    transform-origin: top right;
    transform: scale(.88);
    opacity: 0;
    visibility: hidden;
    transition: transform .28s var(--spring), opacity .18s var(--ease), visibility 0s .28s;
}
.menu.open-left { right: auto; left: 0; transform-origin: top left; }
.menu.open {
    transform: none;
    opacity: 1;
    visibility: visible;
    transition: transform .32s var(--spring), opacity .16s var(--ease), visibility 0s;
}
.menu-label {
    padding: 8px 12px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--label-3);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 15px;
    text-align: left;
    color: var(--label);
}
.menu-item:hover { background: rgba(255,255,255,.1); }
.menu-item .check { width: 16px; height: 16px; fill: currentColor; visibility: hidden; }
.menu-item.on .check { visibility: visible; }
.menu-item.danger { color: var(--red); }
.menu-item .ic { width: 18px; height: 18px; fill: currentColor; margin-left: auto; opacity: .75; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--sep); }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
.section { margin-top: 30px; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.section-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.section-count { font-size: 15px; color: var(--label-3); font-weight: 500; }

/* --------------------------------------------------------------------------
   Folder cards — wide black & white covers
   -------------------------------------------------------------------------- */
.folders {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr));
    gap: 26px 22px;
}
.folders + .folders { margin-top: 30px; }
/* Vertical posters: narrower columns, like a movie-poster wall */
.folders.tall {
    grid-template-columns: repeat(auto-fill, minmax(min(46%, 190px), 1fr));
    gap: 24px 18px;
    align-items: start;
}
.folders.tall .folder-cover { border-radius: var(--r-md); }
.folders.tall .folder-name { font-size: 14px; margin-top: 9px; }
.folder { display: block; position: relative; }
.folder-cover {
    position: relative;
    aspect-ratio: var(--cover-ratio, 16 / 9);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--surface-2);
    transform: translateZ(0);
    transition: transform .45s var(--ease), box-shadow .45s var(--ease);
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.folder-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .7s var(--ease), filter .4s var(--ease);
}
.folder-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.1), inset 0 1px 0 rgba(255,255,255,.12);
}
.folder:hover .folder-cover { transform: translateY(-3px); box-shadow: 0 22px 50px rgba(0,0,0,.6); }
.folder:hover .folder-cover img { transform: scale(1.03); }
.folder:active .folder-cover { transform: scale(.985); transition-duration: .15s; }
.folder-name {
    margin-top: 11px;
    padding: 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: rgba(235, 235, 245, .72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .2s;
}
.folder:hover .folder-name { color: var(--label); }
.folder-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    text-align: center;
    background:
        radial-gradient(120% 90% at 50% 0%, #26262a 0%, #111113 60%, #0b0b0c 100%);
}
.folder-placeholder svg { width: 34px; height: 34px; fill: var(--label-4); }
.folder-placeholder span {
    font-size: clamp(22px, 2.6vw, 34px);
    font-weight: 750;
    letter-spacing: -.02em;
    color: var(--label);
    overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Video cards
   -------------------------------------------------------------------------- */
.videos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    gap: 22px 16px;
    --thumb-ratio: 3 / 4;
}
.videos.landscape { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); --thumb-ratio: 16 / 10; }
.vwrap {
    position: relative;
    content-visibility: auto;
    contain-intrinsic-size: auto 320px;
}
.vcard { display: block; }
.thumb {
    position: relative;
    aspect-ratio: var(--thumb-ratio);
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--surface-2);
    transform: translateZ(0);
    transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .35s var(--ease), transform .6s var(--ease);
}
.thumb img.loaded { opacity: 1; }
.thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.vcard:hover .thumb { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(0,0,0,.55); }
.vcard:hover .thumb img { transform: scale(1.035); }
.vcard:active .thumb { transform: scale(.97); transition-duration: .15s; }

.chip {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .01em;
    background: rgba(0,0,0,.55);
    color: #fff;
    box-shadow: inset 0 0 0 .5px rgba(255,255,255,.18);
}
.chip svg { width: 11px; height: 11px; fill: currentColor; }
.chip.new { background: rgba(245,245,247,.92); color: #000; box-shadow: none; }
.chip.watched { color: rgba(255,255,255,.82); }

.prog {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    height: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,.28);
    overflow: hidden;
}
.prog > div { height: 100%; background: #fff; border-radius: inherit; }
.thumb.has-prog::before {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 40%;
    z-index: 1;
    background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
    pointer-events: none;
}

.vtitle {
    margin-top: 9px;
    padding: 0 2px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}
.vmeta {
    margin-top: 3px;
    padding: 0 2px;
    font-size: 12.5px;
    color: var(--label-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty {
    padding: 90px 20px;
    text-align: center;
    color: var(--label-3);
}
.empty svg { width: 46px; height: 46px; fill: var(--label-4); margin: 0 auto 14px; }
.empty strong { display: block; color: var(--label-2); font-size: 19px; margin-bottom: 4px; }

/* --------------------------------------------------------------------------
   Selection mode (iOS Photos style)
   -------------------------------------------------------------------------- */
.selbox { position: absolute; opacity: 0; pointer-events: none; }
.selmark {
    position: absolute;
    z-index: 5;
    right: 10px;
    top: 10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1.5px solid rgba(255,255,255,.9);
    background: rgba(0,0,0,.28);
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
    opacity: 0;
    transform: scale(.6);
    pointer-events: none;
    transition: opacity .2s, transform .3s var(--spring), background .15s;
}
.selmark svg { width: 14px; height: 14px; fill: #000; opacity: 0; }
body.select-mode .selmark { opacity: 1; transform: none; }
.selected .selmark { background: #fff; border-color: #fff; }
.selected .selmark svg { opacity: 1; }
.selected .thumb img, .selected .folder-cover img { opacity: .55 !important; }
.selected .thumb, .selected .folder-cover { transform: scale(.95) !important; }
body.select-mode .vcard:hover .thumb,
body.select-mode .folder:hover .folder-cover { transform: none; box-shadow: none; }

/* --------------------------------------------------------------------------
   Floating tab bar
   -------------------------------------------------------------------------- */
.dock {
    position: fixed;
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(-50%);
    transition: transform .45s var(--spring), opacity .3s var(--ease);
}
.dock.hidden { transform: translate(-50%, 140%); opacity: 0; pointer-events: none; }
.tabbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px;
    border-radius: 999px;
}
.tab {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 76px;
    height: 54px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--label-2);
    white-space: nowrap;
    transition: color .2s, background .3s var(--ease), transform .25s var(--spring);
}
.tab svg { width: 24px; height: 24px; fill: currentColor; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.tab span, .dock-action svg { text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.tabbar, .dock-action { --glass-bg: rgba(36, 36, 40, .44); }
.tab:hover { color: var(--label); }
.tab:active { transform: scale(.92); }
.tab.active { color: var(--label); background: rgba(255,255,255,.14); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }
/* Sliding selection lens (added by JS; the static .active background is the no-JS fallback) */
.tabbar.has-lens .tab.active { background: none; box-shadow: none; }
.tab-lens {
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 0;
    z-index: 0;
    border-radius: 999px;
    pointer-events: none;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,.2), rgba(255,255,255,.06) 60%, rgba(255,255,255,.1));
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,.35),
        inset 0 -1px 1px rgba(255,255,255,.08),
        0 2px 10px rgba(0,0,0,.25);
    transition: transform .5s var(--spring), width .5s var(--spring);
}
.tab-lens.pressed { transition-duration: .35s; }
/* Soft dimming behind the dock so it stays legible over bright covers */
.dock-scrim {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(130px + env(safe-area-inset-bottom));
    z-index: 60;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.5) 70%, rgba(0,0,0,.65));
}
.dock-action { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: var(--label); transition: transform .25s var(--spring); }
.dock-action:active { transform: scale(.9); }
.dock-action svg { width: 26px; height: 26px; fill: currentColor; }

/* Selection action bar */
.actionbar {
    position: fixed;
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 71;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 999px;
    transform: translate(-50%, 140%);
    opacity: 0;
    pointer-events: none;
    transition: transform .45s var(--spring), opacity .25s var(--ease);
}
body.select-mode .actionbar { transform: translateX(-50%); opacity: 1; pointer-events: auto; }
.actionbar .count { padding: 0 14px; font-size: 15px; font-weight: 600; white-space: nowrap; min-width: 108px; text-align: center; }
.actionbar .btn { height: 44px; }

/* --------------------------------------------------------------------------
   Grouped lists (Settings style) — admin, insights
   -------------------------------------------------------------------------- */
.group-title {
    margin: 30px 16px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--label-3);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.group {
    background: var(--surface);
    border-radius: var(--r-md);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.055);
    overflow: hidden;
}
.group-foot { margin: 8px 16px 0; font-size: 13px; color: var(--label-3); line-height: 1.45; }
.row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 10px 16px;
    position: relative;
}
.row + .row::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 0;
    height: 1px;
    background: var(--sep);
}
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 13px; color: var(--label-3); margin-top: 1px; overflow-wrap: anywhere; }
.row .value { color: var(--label-2); font-size: 15px; }
.row.wrap { flex-wrap: wrap; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(180deg, #4a4a4f, #2a2a2e);
    font-weight: 700; font-size: 15px; text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.tag {
    display: inline-flex; align-items: center;
    height: 22px; padding: 0 9px; border-radius: 999px;
    font-size: 12px; font-weight: 650;
    background: var(--fill-2); color: var(--label-2);
}
.tag.light { background: #f5f5f7; color: #000; }
.tag.ok { background: rgba(48,209,88,.14); color: var(--green); }
.tag.fail { background: rgba(255,69,58,.14); color: var(--red); }

.field {
    height: 40px;
    padding: 0 14px;
    border-radius: 11px;
    border: none;
    outline: none;
    background: var(--fill-2);
    color: var(--label);
    font-size: 15px;
    transition: background .2s, box-shadow .2s;
    min-width: 0;
}
.field:focus { background: var(--fill-3); box-shadow: 0 0 0 1px rgba(255,255,255,.2); }
.field::placeholder { color: var(--label-3); }
select.field {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23999' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    cursor: pointer;
}
select.field option { background: #1c1c1e; }

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 6px;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 500;
    background: rgba(48,209,88,.12);
    color: #7ee59b;
    animation: toast-in .5s var(--spring);
}
.toast svg { width: 18px; height: 18px; fill: currentColor; }
@keyframes toast-in { from { transform: translateY(-8px) scale(.98); opacity: 0; } }

.spinner {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.18);
    border-top-color: #fff;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Insights
   -------------------------------------------------------------------------- */
.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.kpi {
    padding: 20px 20px 18px;
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.055);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}
.kpi-label { font-size: 13px; color: var(--label-2); font-weight: 560; }
.kpi-val {
    font-size: clamp(28px, 3.2vw, 40px);
    font-weight: 750;
    letter-spacing: -.03em;
    line-height: 1.1;
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.kpi-sub { font-size: 13px; color: var(--label-3); margin-top: 4px; }
.ring { position: relative; width: 68px; height: 68px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 7; }
.ring-fill { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 700; }

.shelf {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 4px var(--px) 12px;
    margin: 0 calc(-1 * var(--px));
    scroll-padding: 0 var(--px);
    scrollbar-width: none;
}
.shelf::-webkit-scrollbar { display: none; }
.shelf > * { scroll-snap-align: start; flex: 0 0 auto; }
.shelf .vcard { width: 168px; }
.shelf .folder { width: min(78vw, 420px); }
.shelf .folder.tall { width: 168px; }
.shelf .folder.tall .folder-cover { border-radius: var(--r-md); }

.bars { padding: 6px 0; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr auto; align-items: center; gap: 14px; }
.bar-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar-track > div { height: 100%; border-radius: inherit; background: #fff; }
.bar-num { font-size: 13px; color: var(--label-3); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    position: relative;
    overflow: hidden;
}
.auth-bg {
    position: fixed;
    inset: -20%;
    z-index: -1;
    background:
        radial-gradient(35% 40% at 30% 30%, rgba(255,255,255,.16), transparent 70%),
        radial-gradient(30% 35% at 72% 68%, rgba(255,255,255,.1), transparent 70%),
        radial-gradient(25% 30% at 70% 22%, rgba(255,255,255,.07), transparent 70%);
    filter: blur(10px);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 36px 28px 28px;
    border-radius: var(--r-xl);
}
.app-icon {
    width: 64px; height: 64px;
    border-radius: 16px;
    display: grid; place-items: center;
    margin: 0 auto 18px;
    background: linear-gradient(160deg, #3a3a3e, #121214);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 10px 26px rgba(0,0,0,.5);
}
.app-icon svg { width: 32px; height: 32px; fill: #fff; }
.auth h1 { text-align: center; font-size: 28px; font-weight: 750; letter-spacing: -.025em; }
.auth p.sub { text-align: center; color: var(--label-2); margin: 6px 0 26px; font-size: 15px; }
.auth .inputs { border-radius: 14px; overflow: hidden; background: rgba(255,255,255,.07); margin-bottom: 16px; }
.auth .inputs input {
    display: block; width: 100%; height: 52px; padding: 0 16px;
    background: transparent; border: none; outline: none;
    font-size: 17px; color: var(--label);
}
.auth .inputs input + input { border-top: 1px solid var(--sep); }
.auth .inputs input::placeholder { color: var(--label-3); }
.auth .error {
    display: flex; align-items: center; gap: 8px;
    padding: 11px 14px; margin-bottom: 14px; border-radius: 12px;
    background: rgba(255,69,58,.14); color: #ff7b72; font-size: 14px;
}
.auth .error svg { width: 16px; height: 16px; fill: currentColor; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    :root { --tabbar-space: calc(96px + env(safe-area-inset-bottom)); }
    .folders { gap: 20px; }
    .videos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
    .videos.landscape { grid-template-columns: minmax(0, 1fr); }
    .tab { min-width: 66px; height: 50px; padding: 0 6px; font-size: 10px; white-space: nowrap; }
    .segmented { display: flex; width: 100%; }
    .segmented a { flex: 1 0 auto; justify-content: center; padding: 0 10px; font-size: 13px; }
    .tab svg { width: 22px; height: 22px; }
    .dock-action { width: 60px; height: 60px; }
    .toolbar .spacer { display: none; }
    .toolbar { gap: 8px; }
    .kpi { padding: 16px; flex-direction: column; align-items: flex-start; }
    .ring { display: none; }
    .back-btn span { display: none; }
    .back-btn { width: 44px; padding: 0; }
    .bar-row { grid-template-columns: minmax(70px, 110px) 1fr auto; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
