/* ==========================================================================
   luxenty.ru — тёмная витрина видео канала
   ========================================================================== */

:root {
    --bg: #0f0f0f;
    --bg-soft: #161616;
    --bg-elev: #212121;
    --bg-hover: #272727;
    --line: #303030;
    --text: #f1f1f1;
    --muted: #a8a8a8;
    --muted-2: #8b8b8b;
    --accent: #ff0033;
    --accent-soft: rgba(255, 0, 51, .14);
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-card: 0 14px 34px -20px rgba(0, 0, 0, .95);
    --shadow-modal: 0 40px 90px -30px rgba(0, 0, 0, .95);
    --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        radial-gradient(1100px 520px at 12% -12%, rgba(255, 0, 51, .10), transparent 62%),
        var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, "Helvetica Neue", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

body.is-locked {
    overflow: hidden;
}

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

a {
    color: inherit;
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

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

.skip-link {
    position: absolute;
    left: 50%;
    top: -60px;
    transform: translateX(-50%);
    z-index: 60;
    padding: 10px 18px;
    background: var(--accent);
    color: #fff;
    border-radius: 0 0 10px 10px;
    transition: top .2s var(--ease);
}

.skip-link:focus {
    top: 0;
}

/* Полоса-предупреждение: видна только владельцу в режиме диагностики. */
.diag {
    padding: 10px clamp(14px, 3vw, 40px);
    background: #3a2a00;
    color: #ffd479;
    font-size: 13px;
    line-height: 1.5;
    border-bottom: 1px solid #6b4d00;
}

.diag code {
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .4);
    font-size: 12px;
}

.diag__meta {
    display: inline-block;
    margin-left: 8px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 212, 121, .35);
    color: #d8b45c;
}

/* --------------------------------------------------------------- шапка -- */

.header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(15, 15, 15, .82);
    backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.header::after {
    content: "";
    display: block;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), rgba(255, 0, 51, 0) 65%);
}

.header__inner {
    max-width: 1680px;
    margin: 0 auto;
    padding: 12px clamp(14px, 3vw, 40px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: var(--bg-elev);
}

.brand__avatar--letter {
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 20px;
    color: #fff;
    background: linear-gradient(140deg, var(--accent), #7a0020);
}

.brand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand__title {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand__meta {
    font-size: 12.5px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-yt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-elev);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}

/* -------------------------------------------------------- разделы --- */

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.nav__link {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background .18s var(--ease), color .18s var(--ease);
}

.nav__link:hover {
    background: var(--bg-elev);
    color: var(--text);
}

.nav__link.is-active {
    background: var(--accent-soft);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(255, 0, 51, .35);
}

.nav .btn-yt {
    margin-left: 6px;
}

.btn-yt:hover {
    background: var(--bg-hover);
    border-color: #4a4a4a;
    transform: translateY(-1px);
}

.btn-yt__icon {
    flex: 0 0 auto;
}

/* ------------------------------------------------------------- каркас --- */

.wrap {
    max-width: 1680px;
    margin: 0 auto;
    padding: 20px clamp(14px, 3vw, 40px) 64px;
}

/* ---------------------------------------------------------- панель сверху */

.listbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.listbar__info {
    margin: 0;
    color: var(--muted);
    font-size: 13.5px;
}

.listbar__info strong {
    color: var(--text);
    font-weight: 600;
}

.listbar__nav {
    display: flex;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-elev);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    transition: background .18s var(--ease), border-color .18s var(--ease);
}

.chip:hover {
    background: var(--bg-hover);
    border-color: #4a4a4a;
}

.chip.is-disabled {
    opacity: .4;
    pointer-events: none;
}

.range {
    margin: 0 0 18px;
    color: var(--muted-2);
    font-size: 13px;
}

.range strong {
    color: var(--muted);
    font-weight: 600;
}

/* -------------------------------------------------------------- сетка --- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 292px), 1fr));
    gap: 28px 18px;
}

.card {
    min-width: 0;
}

.card__link {
    display: block;
    border-radius: var(--radius);
}

.card__thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background:
        radial-gradient(120% 120% at 50% 0%, #262626 0%, #171717 70%);
    box-shadow: var(--shadow-card);
    transition: box-shadow .22s var(--ease), transform .22s var(--ease);
}

.card__thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
    pointer-events: none;
}

.card__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s var(--ease), opacity .3s var(--ease);
}

.card__img.is-broken {
    opacity: 0;
}

.card__play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(180deg, rgba(0, 0, 0, .05), rgba(0, 0, 0, .45));
    opacity: 0;
    transition: opacity .22s var(--ease);
}

.card__play svg {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .7));
    transform: scale(.86);
    transition: transform .22s var(--ease);
}

.card__duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 3px 6px;
    border-radius: 5px;
    background: rgba(0, 0, 0, .82);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: .3px;
}

.card__title {
    margin: 12px 0 5px;
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.34;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card__meta {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    color: var(--muted-2);
    font-size: 13px;
}

.card__meta span + span::before {
    content: "•";
    margin-right: 8px;
    color: #555;
}

.card__link:hover .card__thumb,
.card__link:focus-visible .card__thumb {
    transform: translateY(-2px);
    box-shadow: 0 22px 44px -22px rgba(0, 0, 0, 1);
}

.card__link:hover .card__img,
.card__link:focus-visible .card__img {
    transform: scale(1.04);
}

.card__link:hover .card__play,
.card__link:focus-visible .card__play {
    opacity: 1;
}

.card__link:hover .card__play svg {
    transform: scale(1);
}

/* ---------------------------------------------------------- пагинация --- */

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 34px 0 6px;
}

.pager__list {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pager__num,
.pager__side {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-elev);
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}

.pager__num:hover,
.pager__side:hover {
    background: var(--bg-hover);
    border-color: #4a4a4a;
}

.pager__num.is-current {
    background: var(--text);
    border-color: var(--text);
    color: #0f0f0f;
    cursor: default;
}

.pager__side.is-disabled {
    opacity: .38;
    pointer-events: none;
}

.pager__gap {
    padding: 0 2px;
    color: var(--muted-2);
    user-select: none;
}

/* ------------------------------------------------------- плейлист --- */

.playlist-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin: 2px 0 18px;
}

.playlist-head__text {
    min-width: 0;
}

/* Переключатель ширины плеера: показываем только там, где есть выбор. */
.layout-toggle {
    flex: 0 0 auto;
    margin-top: 4px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-elev);
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}

.layout-toggle:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.layout-toggle[aria-pressed="true"] {
    border-color: rgba(255, 0, 51, .4);
    background: var(--accent-soft);
    color: var(--text);
}

@media (max-width: 1299px) {
    .layout-toggle {
        display: none;
    }
}

.playlist-head__title {
    margin: 0 0 6px;
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 700;
    line-height: 1.25;
}

.playlist-head__meta {
    margin: 0;
    color: var(--muted-2);
    font-size: 13.5px;
}

.playlist-head__meta a:hover {
    color: var(--text);
}

/* Список справа. Плеер во всю ширину — по кнопке: это нужно для качества,
   потому что YouTube подбирает его по размеру картинки. */
.playlist-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

@media (min-width: 1300px) {
    .playlist-layout {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    }

    .tracklist {
        max-height: min(72vh, 660px);
    }

    body.is-wide-player .playlist-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    body.is-wide-player .tracklist {
        max-height: min(62vh, 620px);
    }
}

.playlist-player {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow-card);
    scroll-margin-top: 88px;
}

.playlist-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.playlist-player__noscript {
    margin: 0;
    padding: 20px;
    color: var(--muted);
    font-size: 14px;
}

.playlist-player__noscript a {
    color: var(--text);
    text-decoration: underline;
}

.tracklist {
    margin: 0;
    padding: 0;
    list-style: none;
    /* Список — самостоятельная прокручиваемая область: при смене песни он
       сам держит её по центру, а страница при этом не прыгает. */
    max-height: min(62vh, 620px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.track + .track {
    border-top: 1px solid var(--line);
}

.track__link {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    transition: background .15s var(--ease);
}

.track__link:hover {
    background: var(--bg-hover);
}

.track__num {
    flex: 0 0 auto;
    min-width: 24px;
    color: var(--muted-2);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.track__title {
    font-size: 14px;
    line-height: 1.4;
}

.track__link.is-playing {
    background: var(--accent-soft);
}

.track__link.is-playing .track__num {
    color: var(--accent);
    font-weight: 700;
}

.tracklist-empty {
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.55;
}

/* ------------------------------------------------------ сообщения/итог --- */

.panel {
    margin: 40px auto;
    max-width: 620px;
    padding: 26px 26px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
    text-align: center;
}

.panel--error {
    border-color: rgba(255, 0, 51, .4);
    background: linear-gradient(180deg, var(--accent-soft), var(--bg-soft) 70%);
}

.panel__title {
    margin: 0 0 8px;
    font-size: 19px;
}

.panel__text {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.panel__reason {
    margin: 12px 0 0;
    color: #e8c65a;
    font-size: 13.5px;
    word-break: break-word;
}

.panel__debug {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: #000;
    color: #ff8a9b;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12.5px;
    word-break: break-word;
    text-align: left;
}

.panel__actions {
    margin: 18px 0 0;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.footer {
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
}

.footer__inner {
    max-width: 1680px;
    margin: 0 auto;
    padding: 20px clamp(14px, 3vw, 40px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted-2);
    font-size: 13px;
}

.footer__inner p {
    margin: 0;
    display: flex;
    gap: 12px;
    align-items: center;
}

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

.notice {
    max-width: 1680px;
    margin: 0 auto;
    padding: 0 clamp(14px, 3vw, 40px) 22px;
    color: #c9a227;
    font-size: 12.5px;
    line-height: 1.55;
}

.notice code {
    padding: 1px 5px;
    border-radius: 4px;
    background: #000;
    color: #e8c65a;
    font-size: 12px;
}

/* -------------------------------------------------------------- модал --- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: clamp(10px, 3vw, 40px);
}

.modal[hidden] {
    display: none;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .82);
    backdrop-filter: blur(4px);
    animation: fade .18s var(--ease);
}

.modal__dialog {
    position: relative;
    /* Ширина ограничена и высотой окна: плеер 16:9 плюс полоса с названием
       должны помещаться целиком, иначе страница начнёт прокручиваться. */
    width: min(1280px, 100%, calc((100vh - 150px) * 16 / 9));
    max-height: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
    box-shadow: var(--shadow-modal);
    animation: pop .22s var(--ease);
}

.modal__player {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}

.modal__player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    cursor: pointer;
    transition: background .18s var(--ease), transform .18s var(--ease);
}

.modal__close:hover {
    background: rgba(0, 0, 0, .85);
    transform: rotate(90deg);
}

.modal__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    flex-wrap: wrap;
}

.modal__title {
    margin: 0;
    font-size: 15.5px;
    font-weight: 600;
}

.modal__link {
    color: var(--muted);
    font-size: 13.5px;
    white-space: nowrap;
}

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

@keyframes fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pop {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

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

/* ------------------------------------------------------------ телефоны -- */

@media (max-width: 1020px) {
    .playlist-layout {
        gap: 16px;
    }
}

@media (max-width: 720px) {
    body {
        font-size: 14.5px;
    }

    .brand__title {
        font-size: 17px;
    }

    .nav {
        gap: 2px;
    }

    .nav__link {
        padding: 8px 10px;
        font-size: 13px;
    }

    .nav .btn-yt {
        margin-left: 2px;
    }

    .btn-yt span {
        display: none;
    }

    .btn-yt {
        padding: 9px 11px;
    }

    .wrap {
        padding-top: 14px;
        padding-bottom: 48px;
    }

    .grid {
        gap: 22px 14px;
    }

    .pager {
        gap: 6px;
        margin-top: 26px;
    }

    .pager__num,
    .pager__side {
        min-width: 38px;
        height: 38px;
        padding: 0 11px;
        font-size: 13.5px;
    }

    .modal {
        padding: 0;
    }

    .modal__dialog {
        width: 100%;
        border-radius: 0;
        border: 0;
        min-height: 100%;
    }

    .modal__player {
        border-radius: 0;
    }
}

@media (max-width: 400px) {
    .pager__side {
        padding: 0 10px;
    }

    .pager__num {
        min-width: 34px;
        padding: 0 8px;
    }
}
