:root {
    --bg: #f5f8ff;
    --surface: rgba(255, 255, 255, .82);
    --surface-solid: #ffffff;
    --surface-soft: #eef4ff;
    --line: #dce6f7;
    --text: #101828;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-2: #7c3aed;
    --cyan: #06b6d4;
    --shadow: 0 18px 48px rgba(37, 99, 235, .14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 0%, rgba(6, 182, 212, .16), transparent 32%),
        radial-gradient(circle at 86% 8%, rgba(124, 58, 237, .14), transparent 34%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 42%, #ffffff 100%);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(180px, auto) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 14px clamp(16px, 4vw, 42px);
    background: rgba(255, 255, 255, .78);
    border-bottom: 1px solid rgba(220, 230, 247, .82);
    box-shadow: 0 12px 36px rgba(15, 23, 42, .06);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 850;
    font-size: 20px;
    color: #0f172a;
}

.brand-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .2);
}

.brand-mark {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .28);
}

button,
.primary-btn,
.primary-link {
    cursor: pointer;
    border: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    border-radius: 12px;
    padding: 11px 18px;
    font-weight: 760;
    box-shadow: 0 14px 28px rgba(37, 99, 235, .22);
}

.top-nav {
    display: flex;
    justify-content: flex-end;
    min-width: 0;
    gap: 8px;
}

.top-nav a {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 650;
    white-space: nowrap;
}

.top-nav a:hover {
    background: var(--surface-soft);
    color: var(--primary);
}

.page {
    width: min(1580px, 100%);
    margin: 0 auto;
    padding: 28px clamp(14px, 3vw, 38px) 48px;
}

.toolbar {
    margin-bottom: 20px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.toolbar h1 {
    margin: 0 0 6px;
    color: #0f172a;
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 850;
}

.toolbar p {
    margin: 0;
}

.filter-hero {
    position: relative;
    display: grid;
    grid-template-columns: 1.18fr 1fr 1fr auto;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 20px;
    padding: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(238, 244, 255, .88));
    border: 1px solid rgba(220, 230, 247, .9);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.filter-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(37, 99, 235, .08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(37, 99, 235, .06) 1px, transparent 1px);
    background-size: 26px 26px;
    mask-image: linear-gradient(90deg, rgba(0, 0, 0, .22), transparent 70%);
}

.filter-group,
.clear-filter {
    position: relative;
    z-index: 1;
}

.filter-group {
    min-width: 0;
    padding: 14px;
    background: rgba(255, 255, 255, .82);
    border: 1px solid rgba(220, 230, 247, .9);
    border-radius: 14px;
}

.filter-group-primary {
    border-color: rgba(37, 99, 235, .22);
    background: linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(234, 242, 255, .92));
}

.filter-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 11px;
    color: #334155;
    font-size: 14px;
    font-weight: 800;
}

.filter-title i {
    color: var(--primary);
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #d9e4f5;
    border-radius: 999px;
    background: #f8fbff;
    color: #334155;
    font-weight: 750;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.filter-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, .45);
    box-shadow: 0 12px 24px rgba(37, 99, 235, .12);
}

.filter-chip.active {
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 14px 28px rgba(37, 99, 235, .24);
}

.clear-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 54px;
    align-self: center;
    padding: 0 16px;
    border: 1px solid rgba(37, 99, 235, .2);
    border-radius: 14px;
    background: rgba(255, 255, 255, .78);
    color: var(--primary);
    font-weight: 760;
}

.tag-panel {
    margin: 0 0 22px;
    padding: 18px 18px 14px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, .86), rgba(242, 247, 255, .74));
    border: 1px solid rgba(220, 230, 247, .82);
    border-radius: 18px;
    box-shadow: 0 14px 36px rgba(37, 99, 235, .08);
}

.tag-panel-head {
    margin-bottom: 14px;
}

.tag-panel-head h2 {
    margin: 0;
    color: #0f172a;
    font-size: 17px;
    font-weight: 820;
}

.tag-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: fit-content;
    margin: 12px auto 0;
    padding: 8px 16px;
    border: 1px solid rgba(37, 99, 235, .24);
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    color: var(--primary);
    font-weight: 760;
    box-shadow: 0 10px 22px rgba(37, 99, 235, .1);
}

.tag-toggle[hidden] {
    display: none;
}

.tag-panel.is-expanded .tag-toggle i {
    transform: rotate(180deg);
}

.tag-panel.is-expanded .tag-strip-wrap::after {
    opacity: 0;
}

.tag-strip,
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 22px;
}

.tag-panel .tag-strip {
    margin-bottom: 0;
}

.tag-strip-wrap {
    position: relative;
}

.tag-strip-wrap::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 42px;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(247, 250, 255, 0), rgba(247, 250, 255, .96));
    opacity: 1;
    transition: opacity .16s ease;
}

.tag-strip.is-collapsed {
    max-height: 184px;
    overflow: hidden;
}

.tag-strip a,
.tag-cloud a,
.detail-tags a,
.actions a {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #334155;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
}

.tag-strip a.active,
.tag-cloud a.active {
    border-color: rgba(37, 99, 235, .45);
    background: #eaf2ff;
    color: var(--primary);
}

.tag-strip span,
.tag-cloud span {
    color: var(--muted);
    font-size: 12px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px;
}

.video-card {
    display: block;
    min-width: 0;
    padding: 10px;
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(220, 230, 247, .86);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .06);
    transition: transform .16s ease, box-shadow .16s ease;
}

.video-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 42px rgba(37, 99, 235, .16);
}

.thumb {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #dbeafe, #eef2ff);
    border-radius: 12px;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .18s ease;
}

.video-card:hover img {
    transform: scale(1.04);
}

.duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 4px 7px;
    border-radius: 8px;
    background: rgba(15, 23, 42, .82);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.no-thumb {
    display: grid;
    height: 100%;
    place-items: center;
    color: var(--muted);
}

.card-title {
    display: -webkit-box;
    margin-top: 10px;
    min-height: 42px;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: #111827;
    line-height: 1.35;
    font-weight: 720;
}

.card-meta,
.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 32px;
}

.pagination a,
.pagination span {
    min-width: 38px;
    padding: 9px 12px;
    border-radius: 12px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    color: #334155;
    text-align: center;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
}

.pagination .active {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border-color: transparent;
    color: #fff;
}

.watch-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
}

.player {
    width: 100%;
    max-height: 76vh;
    background: black;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.detail-head {
    padding: 18px 0 10px;
}

.detail-head h1,
.toolbar h1,
.tag-cloud h1 {
    color: #0f172a;
}

.detail-tags,
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.actions button,
.my-actions button {
    box-shadow: none;
}

.link-action {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #334155;
    font-weight: 740;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
}

.link-action:hover,
.link-action.active {
    border-color: rgba(37, 99, 235, .45);
    background: #eaf2ff;
    color: var(--primary);
}

.link-action.danger {
    color: #be123c;
}

.side-panel {
    min-width: 0;
}

.side-panel h2 {
    color: #0f172a;
    font-size: 20px;
    font-weight: 800;
}

.side-list {
    display: grid;
    gap: 14px;
}

.side-list .video-card {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 10px;
}

.side-list .thumb {
    aspect-ratio: 16 / 10;
}

.side-list .card-title {
    margin-top: 0;
}

.empty,
.age-wrap {
    display: grid;
    min-height: 56vh;
    place-items: center;
    color: var(--muted);
    text-align: center;
}

.age-modal {
    position: fixed;
    inset: 0;
    z-index: 99;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(12px);
}

.age-modal[hidden] {
    display: none;
}

.age-panel {
    width: min(520px, 100%);
    padding: 30px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.age-panel h2 {
    color: #0f172a;
    font-weight: 850;
}

.age-panel p,
p,
.muted {
    color: var(--muted);
}

.site-footer {
    position: relative;
    display: grid;
    gap: 16px;
    padding: 38px clamp(16px, 4vw, 42px);
    overflow: hidden;
    border-top: 1px solid var(--line);
    background:
        radial-gradient(circle at 12% 20%, rgba(6, 182, 212, .16), transparent 28%),
        radial-gradient(circle at 88% 8%, rgba(124, 58, 237, .14), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(238, 244, 255, .86));
    color: var(--muted);
    font-size: 13px;
}

.site-footer::before {
    content: "";
    position: absolute;
    inset: 18px clamp(12px, 3vw, 36px) auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, .34), transparent);
}

.footer-shell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(240px, .9fr) minmax(0, 1.6fr);
    gap: 22px;
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 22px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(220, 230, 247, .9);
    border-radius: 22px;
    box-shadow: 0 18px 46px rgba(37, 99, 235, .12);
    backdrop-filter: blur(18px);
}

.footer-brand {
    display: grid;
    align-content: start;
    gap: 14px;
    min-width: 0;
    padding: 4px;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    color: #0f172a;
    font-size: 20px;
    font-weight: 900;
}

.footer-logo img {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(37, 99, 235, .22);
}

.footer-brand p {
    max-width: 360px;
    margin: 0;
    line-height: 1.7;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.site-footer section {
    display: grid;
    align-content: start;
    gap: 8px;
}

.footer-grid section {
    padding: 18px;
    background: rgba(255, 255, 255, .7);
    border: 1px solid rgba(220, 230, 247, .82);
    border-radius: 18px;
}

.footer-grid h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 2px;
    color: #0f172a;
    font-size: 16px;
    font-weight: 850;
}

.footer-grid h2 i {
    color: var(--primary);
}

.footer-grid a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    color: var(--muted);
    font-weight: 650;
    transition: color .18s ease, transform .18s ease;
}

.footer-grid a::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .34);
}

.footer-grid a:hover {
    color: var(--primary);
    transform: translateX(2px);
}

.footer-bottom {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 0 8px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

.local-favorites {
    display: grid;
    gap: 20px;
}

.my-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    background: rgba(255, 255, 255, .86);
    border: 1px solid rgba(220, 230, 247, .9);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.my-head h1 {
    margin: 0 0 6px;
    color: #0f172a;
    font-size: 26px;
    font-weight: 850;
}

.my-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.my-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--primary);
    font-weight: 740;
}

.remove-local-favorite {
    padding: 0;
    border: 0;
    background: transparent;
    color: #be123c;
    font: inherit;
    font-weight: 740;
    box-shadow: none;
}

.local-favorite-link {
    display: block;
}

@media (max-width: 1080px) {
    .filter-hero {
        grid-template-columns: 1fr;
    }

    .video-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .site-header {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px 12px 10px;
    }

    .top-nav {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 2px 2px 8px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .top-nav::-webkit-scrollbar {
        display: none;
    }

    .top-nav a {
        scroll-snap-align: start;
        padding: 9px 13px;
        border: 1px solid rgba(220, 230, 247, .9);
        background: rgba(255, 255, 255, .72);
        border-radius: 999px;
        box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
    }

    .watch-layout {
        grid-template-columns: 1fr;
    }

    .video-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .brand {
        gap: 9px;
        font-size: 18px;
    }

    .brand-logo {
        width: 38px;
        height: 38px;
        border-radius: 11px;
    }

    .top-nav {
        margin-inline: -2px;
        gap: 7px;
    }

    .top-nav a {
        padding: 8px 11px;
        font-size: 14px;
    }

    .my-head {
        display: grid;
        padding: 16px;
    }

    .footer-shell {
        grid-template-columns: 1fr;
        padding: 16px;
        border-radius: 18px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .footer-brand,
    .site-footer {
        text-align: center;
    }

    .footer-logo {
        margin-inline: auto;
    }

    .footer-brand p {
        max-width: none;
    }

    .site-footer section {
        justify-items: center;
    }

    .page {
        padding-inline: 12px;
    }

    .filter-hero {
        padding: 12px;
        border-radius: 14px;
    }

    .filter-group {
        padding: 12px;
    }

    .filter-chip {
        flex: 1 1 auto;
        min-width: 42%;
    }

    .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .video-card {
        padding: 8px;
        border-radius: 14px;
    }

    .card-title {
        font-size: 14px;
    }

    .side-list .video-card {
        grid-template-columns: 120px minmax(0, 1fr);
    }
}
