/* ============================================================
   BahirTube — Deep Ocean design system
   cinematic + modern + premium + global + fast
   ============================================================ */

:root {
    /* Surfaces — deep ocean at night */
    --bg-primary: #070b12;
    --bg-secondary: #0b111b;
    --bg-elevated: #101826;
    --bg-card: #0e1522;
    --bg-card-hover: #131c2c;
    --bg-glass: rgba(13, 20, 32, 0.82);

    /* Text */
    --text-primary: #eaf0f7;
    --text-secondary: #9fb0c3;
    --text-muted: #64788d;
    --accent-user: #2fbfa0;

    /* Brand accent — lagoon teal (overridable by admin setting) */
    --accent: var(--accent-user, #2fbfa0);
    --accent-strong: #26a087;
    --accent-soft: rgba(47, 191, 160, 0.14);
    --accent-gradient: linear-gradient(135deg, #2fbfa0 0%, #1e7fd9 100%);

    /* Status / badges */
    --danger: #ef5a66;
    --warning: #e9b44c;
    --info: #4aa3e0;

    /* Lines & shadows */
    --border: rgba(148, 170, 196, 0.14);
    --border-strong: rgba(148, 170, 196, 0.28);
    --shadow-sm: 0 2px 10px rgba(2, 6, 12, 0.45);
    --shadow-md: 0 10px 30px rgba(2, 6, 12, 0.55);
    --shadow-lg: 0 24px 60px rgba(2, 6, 12, 0.65);

    /* Radii — restrained, premium */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    /* Typography */
    --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, "Noto Sans",
                 "Noto Sans Ethiopic", sans-serif;
    --font-display: var(--font-sans);

    /* Motion */
    --transition-fast: 150ms cubic-bezier(.4, 0, .2, 1);
    --transition-med: 240ms cubic-bezier(.4, 0, .2, 1);

    /* Layout */
    --header-h: 64px;
    --page-max: 1560px;
    --rail-gap: 14px;

    color-scheme: dark;
}

/* ---------------------------------------------------------- reset */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background:
        radial-gradient(1200px 500px at 85% -180px, rgba(46, 128, 217, 0.10), transparent 60%),
        radial-gradient(900px 420px at -10% -140px, rgba(47, 191, 160, 0.08), transparent 55%),
        var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

main { flex: 1 0 auto; width: 100%; }
.container { max-width: var(--page-max); margin: 0 auto; padding: 0 clamp(16px, 3vw, 36px); }

.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;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
}

/* ---------------------------------------------------------- scrollbar */

::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #223048; border-radius: 999px; border: 2px solid var(--bg-primary); }
::-webkit-scrollbar-thumb:hover { background: #2e415f; }

/* ---------------------------------------------------------- header */

.site-header {
    position: sticky; top: 0; z-index: 90;
    backdrop-filter: blur(14px) saturate(1.25);
    -webkit-backdrop-filter: blur(14px) saturate(1.25);
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: background var(--transition-med), border-color var(--transition-med);
}
.site-header.scrolled {
    background: var(--bg-glass);
    border-bottom-color: var(--border);
}
.header-inner {
    height: var(--header-h);
    display: flex; align-items: center; gap: clamp(10px, 2vw, 28px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand svg { display: block; }
.brand-name {
    font-weight: 800; letter-spacing: .3px; font-size: 21px;
    background: linear-gradient(92deg, #ffffff 30%, var(--accent) 115%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    white-space: nowrap;
}
.brand-name b { font-weight: 800; }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
    padding: 8px 13px; border-radius: var(--radius-pill);
    color: var(--text-secondary); font-weight: 600; font-size: 14px;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.main-nav a:hover { color: var(--text-primary); background: rgba(255,255,255,.05); }
.main-nav a.active { color: var(--accent); background: var(--accent-soft); }

.header-search { flex: 1 1 auto; min-width: 120px; max-width: 560px; position: relative; }
.search-box {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 8px 0 14px; height: 42px;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.search-box:focus-within {
    border-color: var(--accent);
    background: rgba(255,255,255,.07);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box input {
    flex: 1; background: none; border: 0; outline: none;
    color: var(--text-primary); font-size: 14px; min-width: 40px; height: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box kbd {
    border: 1px solid var(--border-strong); border-radius: 5px;
    padding: 1px 7px; font-size: 11px; color: var(--text-muted);
    font-family: inherit;
}
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    border: none; background: none; color: var(--text-secondary);
    transition: all var(--transition-fast); flex-shrink: 0;
}
.icon-btn:hover { color: var(--text-primary); background: rgba(255,255,255,.08); }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.select-chip select {
    appearance: none; -webkit-appearance: none;
    background: rgba(255,255,255,.05); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-pill);
    height: 36px; padding: 0 28px 0 14px; font-size: 13px; font-weight: 600;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239fb0c3' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center;
}
.select-chip select:hover { color: var(--text-primary); border-color: var(--border-strong); }

.avatar-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--accent-gradient); color: #fff; border: none;
    font-weight: 800; font-size: 15px; text-transform: uppercase;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm);
}
.user-menu-wrap { position: relative; }
.dropdown {
    position: absolute; right: 0; top: calc(100% + 10px);
    min-width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px; z-index: 120;
    opacity: 0; transform: translateY(-6px); pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.dropdown.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.dropdown .dd-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown .dd-head strong { display: block; font-size: 14px; }
.dropdown .dd-head span { color: var(--text-muted); font-size: 12px; word-break: break-all; }
.dropdown a, .dropdown button.dd-item {
    display: block; width: 100%; text-align: left;
    padding: 9px 12px; border-radius: var(--radius-md);
    color: var(--text-secondary); font-size: 14px; font-weight: 550;
    border: 0; background: none;
}
.dropdown a:hover, .dropdown button.dd-item:hover { background: rgba(255,255,255,.06); color: var(--text-primary); }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

/* mobile-only search overlay */
.mobile-search {
    display: none; position: fixed; inset: 0; z-index: 130;
    background: rgba(4, 7, 12, .96);
    padding: 18px;
}
.mobile-search.open { display: block; }
.mobile-search .search-box { max-width: 720px; margin: 10vh auto 0; height: 52px; }

/* ---------------------------------------------------------- buttons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 20px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 14px; font-weight: 700; line-height: 1;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast),
                background var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
    white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 17px; height: 17px; }

.btn-primary { background: var(--accent); color: #04231c; box-shadow: 0 6px 20px rgba(47,191,160,.28); }
.btn-primary:hover { background: #35d0ae; color: #04231c; box-shadow: 0 8px 26px rgba(47,191,160,.38); }
.btn-outline { background: rgba(255,255,255,.06); color: var(--text-primary); border-color: var(--border-strong); }
.btn-outline:hover { background: rgba(255,255,255,.1); color: var(--text-primary); }
.btn-ghost { background: none; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,.06); }
.btn-danger { background: rgba(239,90,102,.14); color: var(--danger); border-color: rgba(239,90,102,.35); }
.btn-danger:hover { background: rgba(239,90,102,.22); color: #ff8993; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 26px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }

/* ---------------------------------------------------------- hero */

.hero {
    position: relative; min-height: 520px; max-height: 78vh;
    display: flex; align-items: flex-end;
    overflow: hidden;
}
.hero-media { position: absolute; inset: 0; }
.hero-media img {
    width: 100%; height: 100%; object-fit: cover; object-position: center 20%;
    filter: saturate(1.05);
    animation: heroIn 900ms ease both;
}
@keyframes heroIn { from { opacity: 0; transform: scale(1.02); } to { opacity: 1; transform: none; } }
.hero-shade {
    position: absolute; inset: 0;
    background:
        linear-gradient(to top, var(--bg-primary) 4%, rgba(7,11,18,.72) 38%, rgba(7,11,18,.25) 70%, rgba(7,11,18,.35) 100%),
        linear-gradient(105deg, rgba(7,11,18,.65) 0%, transparent 50%);
}
.hero-content {
    position: relative; width: 100%;
    padding: clamp(24px, 5vw, 64px) 0 clamp(30px, 4vw, 48px);
}
.hero-badges { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.hero-title {
    font-family: var(--font-display);
    font-size: clamp(26px, 4.4vw, 52px);
    font-weight: 850; letter-spacing: -.02em; line-height: 1.08;
    margin: 0 0 12px; max-width: 24ch;
    text-shadow: 0 2px 24px rgba(0,0,0,.5);
}
.hero-desc {
    color: #c8d4e2; max-width: 62ch;
    font-size: clamp(14px, 1.4vw, 16px);
    margin: 0 0 10px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-meta { color: var(--text-secondary); font-size: 13.5px; display: flex; gap: 10px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-dots { display: flex; gap: 8px; margin-top: 26px; }
.hero-dots button {
    width: 26px; height: 4px; border-radius: 99px; border: 0;
    background: rgba(255,255,255,.22); transition: all var(--transition-med);
}
.hero-dots button.active { background: var(--accent); width: 42px; }

/* ---------------------------------------------------------- rails */

.rail-section { margin: clamp(28px, 3.6vw, 46px) 0; }
.rail-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; margin-bottom: 14px;
}
.rail-title {
    font-size: clamp(17px, 1.8vw, 21px); font-weight: 800; letter-spacing: -.01em;
    margin: 0; display: flex; align-items: center; gap: 10px;
}
.rail-title .glyph {
    width: 4px; height: 18px; border-radius: 99px;
    background: var(--accent-gradient); display: inline-block;
}
.rail-link { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.rail-link:hover { color: var(--accent); }
.rail-arrows { display: flex; gap: 6px; }
.rail-arrow {
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid var(--border-strong); background: rgba(255,255,255,.03);
    color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast);
}
.rail-arrow:hover { color: var(--text-primary); border-color: var(--accent); }
.rail-arrow[disabled] { opacity: .3; pointer-events: none; }

.rail {
    display: grid; grid-auto-flow: column;
    grid-auto-columns: var(--card-w, 250px);
    gap: var(--rail-gap);
    overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding: 4px 2px 12px;
    scrollbar-width: thin;
    border-radius: var(--radius-sm);
}
.rail > * { scroll-snap-align: start; }
.rail::-webkit-scrollbar { height: 8px; }
.rail::-webkit-scrollbar-track { background: var(--bg-secondary); border-radius: 99px; margin-top: 6px; }

/* grid variant for category/search pages */
.grid-cards {
    display: grid; gap: var(--rail-gap);
    grid-template-columns: repeat(auto-fill, minmax(var(--card-w, 250px), 1fr));
}

/* ---------------------------------------------------------- video cards */

.vcard {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform var(--transition-med), box-shadow var(--transition-med), border-color var(--transition-med), background var(--transition-med);
    display: flex; flex-direction: column;
}
.vcard:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-md);
    z-index: 2;
}
.vcard-thumb {
    position: relative; aspect-ratio: 16/9; overflow: hidden;
    background: linear-gradient(135deg, #14203a 0%, #0d1526 60%, #12322e 100%);
}
.vcard-thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .5s cubic-bezier(.2,.6,.2,1);
}
.vcard:hover .vcard-thumb img { transform: scale(1.06); }
.thumb-ph {
    position: absolute; inset: 0; display: grid; place-items: center;
    color: rgba(255,255,255,.35); font-weight: 800; letter-spacing: .12em; font-size: 12px;
    background:
        radial-gradient(200px 90px at 30% 20%, rgba(47,191,160,.18), transparent 70%),
        radial-gradient(240px 120px at 80% 80%, rgba(30,127,217,.16), transparent 70%),
        linear-gradient(150deg, #131d31, #0d1424 70%);
}
.duration-chip {
    position: absolute; right: 8px; bottom: 8px;
    background: rgba(5, 9, 15, .86); color: #fff;
    font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
    border-radius: 5px; padding: 2px 6px;
    backdrop-filter: blur(4px);
}
.progress-chip { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.15); }
.progress-chip i { display: block; height: 100%; background: var(--accent); }
.save-btn {
    position: absolute; top: 8px; right: 8px;
    width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(5,9,15,.75); color: #cfd9e6; border: 0;
    opacity: 0; transform: translateY(-4px);
    transition: all var(--transition-fast);
    backdrop-filter: blur(4px);
}
.vcard:hover .save-btn, .save-btn.on { opacity: 1; transform: none; }
.save-btn:hover { color: #fff; background: rgba(20,30,48,.95); }
.save-btn.on { color: var(--accent); }
.short-flag {
    position: absolute; left: 8px; top: 8px;
    background: rgba(5,9,15,.78); color: var(--accent);
    font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 99px;
    display: inline-flex; align-items: center; gap: 4px;
}
.vcard-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.vcard-title {
    font-size: 14px; font-weight: 650; line-height: 1.38;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    color: var(--text-primary); min-height: 2.7em;
}
a.vcard-link:hover .vcard-title { color: #fff; }
.vcard-meta {
    color: var(--text-muted); font-size: 12.5px;
    display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center;
}
.vcard-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

/* provider badge */
.prov-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    padding: 2.5px 8px; border-radius: 4px;
    background: rgba(148,170,196,.1); color: #9fb0c3;
    border: 1px solid rgba(148,170,196,.16);
}
.prov-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.prov-youtube    { color: #ff6e63; background: rgba(255,110,99,.09); border-color: rgba(255,110,99,.22); }
.prov-vimeo      { color: #59c2ff; background: rgba(89,194,255,.09); border-color: rgba(89,194,255,.22); }
.prov-dailymotion{ color: #6ea8ff; background: rgba(110,168,255,.09); border-color: rgba(110,168,255,.22); }
.prov-peertube   { color: #f2b25c; background: rgba(242,178,92,.09); border-color: rgba(242,178,92,.22); }
.prov-archiveorg { color: #b9a3ff; background: rgba(185,163,255,.09); border-color: rgba(185,163,255,.22); }
.prov-wikimedia  { color: #8ee0c9; background: rgba(142,224,201,.09); border-color: rgba(142,224,201,.22); }
.prov-pexels     { color: #63e2c5; background: rgba(99,226,197,.09); border-color: rgba(99,226,197,.22); }
.prov-pixabay    { color: #67ca57; background: rgba(103,202,87,.09); border-color: rgba(103,202,87,.22); }

.rights-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10.5px; font-weight: 700;
    padding: 2.5px 7px; border-radius: 4px;
}
.rights-PUBLIC_DOMAIN    { color: #7fe3c3; background: rgba(127,227,195,.08); border: 1px solid rgba(127,227,195,.25); }
.rights-CREATIVE_COMMONS { color: #74b9ff; background: rgba(116,185,255,.08); border: 1px solid rgba(116,185,255,.25); }
.rights-EMBEDDABLE       { color: #94a9c2; background: rgba(148,169,194,.08); border: 1px solid rgba(148,169,194,.22); }
.rights-UNKNOWN          { color: #b9a37e; background: rgba(185,163,126,.07); border: 1px solid rgba(185,163,126,.2); }

.category-tag {
    font-size: 11.5px; font-weight: 700; color: var(--text-secondary);
    background: rgba(255,255,255,.045); border: 1px solid var(--border);
    padding: 2.5px 9px; border-radius: 99px; transition: all var(--transition-fast);
}
.category-tag:hover { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }

/* compact horizontal card (search results / up-next list) */
.vcard-row { display: grid; grid-template-columns: 210px 1fr; gap: 14px; padding: 10px; }
.vcard-row .vcard-thumb { aspect-ratio: 16/9; }
.vcard-row .vcard-body { padding: 2px 6px 2px 0; }
.vcard-row .vcard-title { min-height: 0; }
@media (max-width: 560px) { .vcard-row { grid-template-columns: 130px 1fr; } }

/* portrait card for shorts rail */
.vcard-portrait { width: calc(min(178px, 44vw)); }
.vcard-portrait .vcard-thumb { aspect-ratio: 9/16; }

/* ---------------------------------------------------------- shorts (full-screen feed) */

/* page shell: the feed IS the page — no footer, no page scroll */
body.page-shorts { overflow: hidden; }
body.page-shorts .site-footer,
body.page-shorts .bottom-nav { display: none !important; }
body.page-shorts { padding-bottom: 0 !important; }

.shorts-stage {
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    overflow-y: auto; overscroll-behavior-y: contain;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}
.shorts-stage::-webkit-scrollbar { display: none; }

.short-slide {
    height: 100%;
    grid-template-columns: minmax(0, 1fr); /* keep the track from outgrowing the viewport */
    scroll-snap-align: center; scroll-snap-stop: always;
    display: grid; place-items: center;
    padding: 12px clamp(12px, 3vw, 36px);
}
.short-frame { display: flex; align-items: flex-end; gap: 14px; height: 100%; max-height: 940px; }
.short-media {
    position: relative; height: 100%;
    aspect-ratio: 9 / 16;
    max-width: min(92vw, 470px);
    background: #000; border-radius: 16px; overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.short-media video, .short-media iframe {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: contain; border: 0; background: #000;
}

/* bottom shade so title stays legible over bright frames */
.short-media::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 110px;
    background: linear-gradient(to top, rgba(0,0,0,.72), transparent);
    pointer-events: none; z-index: 1;
}
.short-info {
    position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 2;
    color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.65); pointer-events: none;
}
.short-info strong { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.35; }
.short-info-sub { font-size: 12.5px; opacity: .85; }

/* tap layer + play/pause flash (direct videos) */
.short-tapzone { position: absolute; inset: 0; z-index: 3; background: none; border: 0; }
.short-flash {
    position: absolute; inset: 0; margin: auto; width: 70px; height: 70px;
    display: grid; place-items: center; color: #fff; opacity: 0; pointer-events: none; z-index: 4;
}
.short-flash svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 12px rgba(0,0,0,.6)); }
.short-flash .ic-pause { display: none; }
.short-flash.is-pause .ic-pause { display: block; }
.short-flash.is-pause .ic-play { display: none; }
.short-flash.go { animation: shortFlash .7s ease-out forwards; }
@keyframes shortFlash {
    0% { opacity: .95; transform: scale(1.12); }
    100% { opacity: 0; transform: scale(1); }
}

/* thin progress bar (direct videos) */
.short-progress {
    position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 5;
    background: rgba(255,255,255,.18);
}
.short-progress i { display: block; height: 100%; width: 0; background: var(--accent); }

/* action rail */
.short-rail {
    display: flex; flex-direction: column; align-items: center; gap: 18px;
    padding-bottom: 56px; flex-shrink: 0;
}
.short-action {
    display: grid; place-items: center; gap: 5px;
    background: none; border: 0; color: #fff; font-size: 11.5px; font-weight: 650;
    text-shadow: 0 1px 6px rgba(0,0,0,.55);
    transition: transform var(--transition-fast), color var(--transition-fast);
}
.short-action svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 5px rgba(0,0,0,.5)); }
.short-action:hover { transform: scale(1.1); color: #fff; }
.short-action.on svg { color: var(--accent); }
.short-action .count-label {
    max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: rgba(255,255,255,.94);
}

/* desktop nav arrows */
.shorts-nav {
    position: fixed; right: clamp(10px, 2.4vw, 30px); top: 50%; transform: translateY(-50%);
    display: grid; gap: 12px; z-index: 60;
}
.shorts-nav-btn {
    width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(255,255,255,.07); border: 1px solid var(--border-strong);
    color: var(--text-primary); transition: all var(--transition-fast);
}
.shorts-nav-btn:hover { background: rgba(255,255,255,.16); transform: scale(1.06); }
.shorts-nav-btn svg { width: 22px; height: 22px; }

@media (max-width: 768px) {
    .short-slide { padding: 6px; }
    .short-frame { position: relative; width: 100%; justify-content: center; gap: 0; max-height: none; }
    .short-media { max-width: 100%; }
    .short-rail { position: absolute; right: 8px; bottom: 16px; z-index: 6; gap: 14px; padding-bottom: 0; }
    .short-info { left: 14px; right: 72px; }
    .shorts-nav { display: none; }
}

/* ---------------------------------------------------------- watch page */

.watch-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 26px;
    padding: 22px 0 46px;
}
@media (max-width: 1080px) { .watch-grid { grid-template-columns: 1fr; } }

.player-shell {
    position: relative; width: 100%;
    aspect-ratio: 16/9; background: #000;
    border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-md);
}
.player-shell.theater {
    width: 100vw; margin-left: calc(50% - 50vw);
    aspect-ratio: auto; height: min(76vh, 900px);
}
.player-shell iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-shell video { width: 100%; height: 100%; }
.player-cover {
    position: absolute; inset: 0; z-index: 5;
    display: grid; place-items: center;
    background: radial-gradient(closest-side, #10192a, #05080d);
    border: 0; color: #fff;
}
.play-big {
    width: 84px; height: 84px; border-radius: 50%;
    background: var(--accent-gradient); border: 0; display: grid; place-items: center;
    box-shadow: 0 14px 44px rgba(47,191,160,.4);
    transition: transform var(--transition-fast);
}
.play-big:hover { transform: scale(1.07); }

.watch-head { margin-top: 16px; }
.watch-title { font-size: clamp(18px, 2.2vw, 24px); font-weight: 800; letter-spacing: -.01em; margin: 0 0 10px; line-height: 1.25; }
.watch-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.watch-channel { display: flex; align-items: center; gap: 11px; min-width: 0; }
.channel-avatar {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    background: var(--accent-gradient); color: #fff; font-weight: 800;
    display: grid; place-items: center; font-size: 16px;
}
.watch-channel .name { font-weight: 750; font-size: 14.5px; }
.watch-channel .sub { color: var(--text-muted); font-size: 12.5px; }
.watch-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.action-pill {
    display: inline-flex; align-items: center; gap: 7px;
    height: 38px; padding: 0 15px;
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,.055); border: 1px solid var(--border);
    color: var(--text-secondary); font-weight: 700; font-size: 13px;
    transition: all var(--transition-fast);
}
.action-pill:hover { color: var(--text-primary); border-color: var(--border-strong); }
.action-pill.on { background: var(--accent-soft); color: var(--accent); border-color: rgba(47,191,160,.4); }
.action-pill svg { width: 16px; height: 16px; }

.watch-info { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; margin-top: 14px; }
.watch-info .meta-line { color: var(--text-secondary); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; }
.watch-desc { color: #cbd6e4; white-space: pre-line; font-size: 14px; }
.watch-desc.clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.attribution-note {
    margin-top: 14px; padding: 10px 13px; border-radius: var(--radius-md);
    background: rgba(116,185,255,.06); border: 1px solid rgba(116,185,255,.18);
    color: #a8cdec; font-size: 13px; display: flex; gap: 8px; align-items: flex-start;
}
.attribution-note svg { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; }

.upnext-item {
    display: grid; grid-template-columns: 158px 1fr; gap: 11px;
    padding: 9px; border-radius: var(--radius-md); border: 1px solid transparent;
    transition: all var(--transition-fast);
}
.upnext-item:hover { background: var(--bg-card); border-color: var(--border); }
.upnext-item .up-thumb { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: linear-gradient(140deg,#141f36,#0d1524); }
.upnext-item .up-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upnext-item h4 { margin: 0 0 4px; font-size: 13.5px; font-weight: 650; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.upnext-item p { margin: 0; color: var(--text-muted); font-size: 12px; }

.side-panel h3 {
    font-size: 15px; margin: 2px 0 10px; display: flex; align-items: center; justify-content: space-between;
}
.toggle-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); font-weight: 600; cursor: pointer; }
.switch { position: relative; width: 34px; height: 19px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i {
    position: absolute; inset: 0; border-radius: 99px; background: #22304a;
    transition: background var(--transition-fast);
}
.switch i::after {
    content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%;
    background: #fff; top: 2px; left: 2px; transition: transform var(--transition-fast);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(15px); }

/* ---------------------------------------------------------- category pages */

.cat-hero {
    position: relative; padding: clamp(30px, 5vw, 58px) 0 26px;
    background:
        radial-gradient(700px 260px at 12% 0%, rgba(47,191,160,.12), transparent 65%),
        radial-gradient(600px 240px at 90% 10%, rgba(30,127,217,.12), transparent 60%);
    border-bottom: 1px solid var(--border);
}
.breadcrumbs { color: var(--text-muted); font-size: 12.5px; margin-bottom: 10px; display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.breadcrumbs a { color: var(--text-secondary); font-weight: 600; }
.cat-hero h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 850; letter-spacing: -.02em; margin: 0 0 8px; }
.cat-hero p { color: var(--text-secondary); max-width: 68ch; margin: 0; }
.subchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.subchip {
    padding: 7px 15px; border-radius: 99px;
    background: rgba(255,255,255,.05); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 13px; font-weight: 650;
    transition: all var(--transition-fast);
}
.subchip:hover, .subchip.active { color: #05241d; background: var(--accent); border-color: var(--accent); }

.filter-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 16px 0 4px;
}
.filter-select select, .filter-bar input[type="text"] {
    height: 38px; border-radius: var(--radius-md);
    background: rgba(255,255,255,.045); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 13px; font-weight: 600; padding: 0 12px;
}
.filter-bar label { font-size: 12px; color: var(--text-muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

/* category tiles */
.cat-tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cat-tile {
    position: relative; padding: 22px 20px 20px;
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
    border: 1px solid var(--border);
    transition: all var(--transition-med);
    overflow: hidden; display: block;
}
.cat-tile:hover { transform: translateY(-4px); border-color: var(--accent-soft); box-shadow: var(--shadow-md); }
.cat-tile .emoji { font-size: 30px; display: block; margin-bottom: 10px; }
.cat-tile h3 { margin: 0 0 4px; font-size: 17px; }
.cat-tile p { margin: 0; color: var(--text-muted); font-size: 12.5px; }

/* ---------------------------------------------------------- forms & misc */

.panel-form {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: clamp(18px, 3vw, 28px);
}
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--text-secondary); }
.field input, .field textarea, .field select {
    width: 100%; height: 44px;
    background: rgba(255,255,255,.045); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text-primary);
    padding: 0 13px; font-size: 14px; outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    font-family: inherit;
}
.field textarea { height: auto; min-height: 90px; padding: 10px 13px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-error {
    background: rgba(239,90,102,.1); border: 1px solid rgba(239,90,102,.3);
    color: #ffb3ba; padding: 11px 14px; border-radius: var(--radius-md);
    font-size: 13.5px; margin-bottom: 14px;
}
.form-hint { color: var(--text-muted); font-size: 12.5px; margin-top: 5px; }

.auth-shell {
    display: grid; place-items: center; padding: 48px 16px 72px;
}
.auth-card { width: min(430px, 94vw); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand p { color: var(--text-secondary); margin: 0; font-size: 14px; }

.alert-toast {
    position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--bg-elevated); border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    color: var(--text-primary); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); padding: 13px 22px; font-size: 14px; z-index: 300;
    opacity: 0; transition: all var(--transition-med);
    max-width: min(480px, 92vw);
}
.alert-toast.error { border-left-color: var(--danger); }
.alert-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* skeletons */
.skel { position: relative; overflow: hidden; background: #0d1524; border-radius: var(--radius-md); }
.skel::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.05) 50%, transparent 70%);
    animation: shimmer 1.6s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%);} to { transform: translateX(100%);} }
.skel-card .skel-thumb { aspect-ratio: 16/9; border-radius: 0; }
.skel-card .skel-line { height: 12px; margin: 12px; border-radius: 6px; }

.empty-state {
    text-align: center; padding: 64px 20px; color: var(--text-secondary);
}
.empty-state .big { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { color: var(--text-primary); margin: 0 0 6px; font-size: 18px; }
.empty-state p { margin: 0 auto 18px; max-width: 46ch; font-size: 14px; }

/* pagination */
.pagination { display: flex; gap: 6px; justify-content: center; margin: 34px 0 10px; flex-wrap: wrap; }
.page-btn {
    min-width: 40px; height: 40px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md); border: 1px solid var(--border);
    background: rgba(255,255,255,.04); color: var(--text-secondary);
    font-weight: 700; font-size: 13.5px;
}
.page-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.page-btn.current { background: var(--accent); border-color: var(--accent); color: #04231c; }
.page-btn[disabled] { opacity: .35; pointer-events: none; }

/* footer */
.site-footer {
    margin-top: 56px; flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: linear-gradient(to bottom, rgba(255,255,255,.015), transparent);
}
.footer-grid {
    display: grid; gap: 30px;
    grid-template-columns: 2.1fr 1fr 1fr 1fr 1fr;
    padding: 40px 0 30px;
}
@media (max-width: 1020px) {
    .footer-grid { grid-template-columns: repeat(4, 1fr); }
    .footer-brand { grid-column: 1 / -1; }
}
.footer-brand p { color: var(--text-muted); font-size: 13.5px; max-width: 40ch; margin: 10px 0 0; }
.footer-col h4 {
    font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
    color: var(--text-muted); margin: 4px 0 12px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-col a { color: var(--text-secondary); font-size: 13.5px; }
.footer-col a:hover { color: var(--accent); }
.footer-base {
    border-top: 1px solid var(--border);
    padding: 16px 0 22px;
    color: var(--text-muted); font-size: 12.5px;
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center;
}
.footer-base .ocean-note { display: flex; align-items: center; gap: 7px; }
.footer-base .wave { width: 46px; height: 10px; opacity: .55; }

/* mobile bottom nav */
.bottom-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    grid-auto-flow: column;
}
.bottom-nav a {
    display: grid; place-items: center; gap: 2px;
    color: var(--text-muted); font-size: 10.5px; font-weight: 650;
    padding: 5px 0; border-radius: 10px;
}
.bottom-nav a svg { width: 21px; height: 21px; }
.bottom-nav a.active { color: var(--accent); }

@media (max-width: 768px) {
    body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
    .bottom-nav { display: grid; }
    .main-nav { display: none; }
    .header-search.desktop-only { display: none; }
    .hero { min-height: 420px; max-height: 64vh; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    :root { --rail-gap: 11px; }
    .rail { --card-w: 208px !important; grid-auto-columns: var(--card-w, 208px); }
}

/* report dialog */
dialog.report-dialog {
    background: var(--bg-elevated); color: var(--text-primary);
    border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
    padding: 24px; width: min(430px, 92vw);
}
dialog.report-dialog::backdrop { background: rgba(3, 6, 11, .7); backdrop-filter: blur(3px); }
.radio-reason { display: grid; gap: 8px; margin: 14px 0 18px; }
.radio-reason label {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,.04); border: 1px solid var(--border);
    padding: 10px 13px; border-radius: var(--radius-md); font-size: 14px;
    cursor: pointer; transition: all var(--transition-fast);
}
.radio-reason label:hover { border-color: var(--border-strong); }
.radio-reason input { accent-color: var(--accent); }
