/* ============================================================
   cabinet.css — стили личного кабинета (доп. блоки, не styles.css)
   Блок «Ваша неделя» — сводка слушателя за 7 дней (этап 3.3)
   ============================================================ */

.week-section {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.week-card {
    background: linear-gradient(135deg, rgba(240, 180, 120, 0.10), rgba(102, 126, 234, 0.08));
    border: 1px solid rgba(240, 180, 120, 0.25);
    border-radius: 16px;
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.week-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.week-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #f0b27a;
}

.week-title i {
    margin-right: 0.45rem;
}

/* Кнопка «Обновить» и отметка времени в шапке блока */
.week-title-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.week-updated {
    font-size: 0.72rem;
    color: #7d8b99;
    white-space: nowrap;
}

.week-refresh {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(240, 178, 122, 0.3);
    background: rgba(240, 178, 122, 0.08);
    color: #f0b27a;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.week-refresh:hover,
.week-refresh:focus-visible {
    background: rgba(240, 178, 122, 0.2);
    border-color: rgba(240, 178, 122, 0.6);
    outline: none;
}

.week-refresh:disabled {
    opacity: 0.55;
    cursor: default;
}

.week-refresh.is-busy i {
    animation: weekSpin 0.9s linear infinite;
}

@keyframes weekSpin {
    to { transform: rotate(360deg); }
}

/* Пояснение, как считается сводка */
.week-hint {
    margin: -0.35rem 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #8b98a5;
}

/* Динамическая часть сводки (перерисовывается JS) */
.week-card #weekCard {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.week-loading,
.week-empty {
    color: #b0c2d1;
    font-size: 0.92rem;
    text-align: center;
    margin: 0.5rem 0;
}

.week-empty i {
    color: #f0b27a;
    margin-right: 0.45rem;
}

.week-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.week-stat {
    flex: 1 1 120px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.week-stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f0b27a;
    line-height: 1.1;
}

.week-stat-label {
    font-size: 0.78rem;
    color: #8fa0b0;
}

/* мини-график прослушиваний по дням */
.week-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 90px;
    padding: 0.3rem 0.2rem 0;
}

.week-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    height: 100%;
}

.week-bar {
    width: 100%;
    min-height: 3px;
    background: linear-gradient(180deg, #f0b27a, #667eea);
    border-radius: 6px 6px 2px 2px;
    transition: height .3s ease;
}

.week-bar-day {
    font-size: 0.68rem;
    color: #8fa0b0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* топ-песня и топ-исполнитель */
.week-top {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.week-top-item {
    flex: 1 1 260px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
}

.week-cover {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}

.week-top-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.week-top-label {
    font-size: 0.72rem;
    color: #8fa0b0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.week-top-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: #e8eef3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.week-top-value a {
    color: #f0b27a;
    text-decoration: none;
}

.week-top-value a:hover {
    text-decoration: underline;
}

.week-top-sub {
    font-size: 0.76rem;
    color: #8fa0b0;
}

/* ============================================================
   Мобильная адаптация кабинета (этап 4.4, 390px)
   styles.css не трогаем — правила ниже перекрывают при узких экранах.
   Тап-зоны ≥44px: вкладки и кнопки кабинета.
   ============================================================ */
@media (max-width: 480px) {
    .week-card {
        padding: 1rem 0.9rem;
        border-radius: 12px;
    }

    .week-stats {
        gap: 0.6rem;
    }

    .week-stat {
        flex: 1 1 44%;
        padding: 0.6rem 0.5rem;
    }

    .week-stat-num { font-size: 1.25rem; }

    .week-top-item {
        flex: 1 1 100%;
        padding: 0.55rem 0.7rem;
    }

    .week-cover { width: 44px; height: 44px; }

    .week-chart { gap: 0.3rem; }

    /* вкладки кабинета — тап-зона ≥44px */
    .cabinet-tab {
        min-height: 44px;
        padding: 0.6rem 0.9rem;
    }

    /* кнопки внутри секций кабинета — тап-зона ≥44px */
    .modal .btn,
    .modal button,
    .cabinet-section .btn,
    .cabinet-section button {
        min-height: 44px;
        min-width: 44px;
    }

    /* модалка входа/о проекте — не выезжает за экран */
    .modal-content {
        max-width: calc(100vw - 24px);
        max-height: 84vh;
        overflow-y: auto;
        margin: 8vh auto;
    }

    /* страховка от горизонтального скролла */
    body, .main-content {
        overflow-x: hidden;
    }
}

/* ============================================================
   ЭТАП 5.4-M (19.11.2026): современный вид личного кабинета
   Тёмное стекло + аврора + янтарные акценты (как на лендинге).
   styles.css не трогаем — только перекрываем точечно.
   ============================================================ */

.cabinet-container {
    max-width: 1180px;
    padding: 2rem 1.5rem 3rem;
    scrollbar-width: none;
}
.cabinet-container::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- Приветствие ---------- */
.cabinet-container .welcome-section {
    position: relative;
    margin-bottom: 1.6rem;
    padding: 1.8rem 1.8rem 1.6rem;
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(240, 178, 122, 0.16), transparent 55%),
        radial-gradient(100% 100% at 100% 100%, rgba(102, 126, 234, 0.18), transparent 55%),
        linear-gradient(160deg, rgba(24, 28, 38, 0.92), rgba(13, 16, 22, 0.96));
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}
.cabinet-container .welcome-section::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 30%);
}
.cabinet-container .welcome-section h1 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.6rem, 3.4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    background: linear-gradient(120deg, #f6f8fb 25%, #f0b27a 70%, #e88bff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.cabinet-container .welcome-section p { color: #a9b7c6; margin: 0; }
.cabinet-container .user-name-display { color: #f0b27a; font-weight: 700; }

/* ---------- Публичная ссылка на плейлист ---------- */
.cabinet-container #playlistLinkBlock {
    background: rgba(8, 11, 15, 0.55) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 18px !important;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.cabinet-container #playlistUrlInput {
    background: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 999px !important;
    color: #ffd7ae !important;
    min-height: 40px;
}
.cabinet-container #copyPlaylistLinkBtn,
.cabinet-container #openPlaylistBtn {
    background: linear-gradient(135deg, #ffd9ac, #f0b27a) !important;
    color: #131820 !important;
    border-radius: 999px !important;
    font-weight: 700 !important;
    box-shadow: 0 10px 24px rgba(240, 163, 95, 0.22);
}
.cabinet-container #openPlaylistBtn {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #e8eef4 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: none;
}

/* ---------- Вкладки-сегменты ---------- */
.cabinet-container .cabinet-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 1.4rem;
    padding: 0.35rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(8, 11, 15, 0.55);
}
.cabinet-container .cabinet-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.05rem;
    color: #9fb0c1;
    font-weight: 600;
    font-size: 0.92rem;
    background: transparent;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, transform 0.18s ease;
}
.cabinet-container .cabinet-tab:hover {
    color: #f0d3b0;
    background: rgba(240, 178, 122, 0.08);
}
.cabinet-container .cabinet-tab.active {
    color: #131820 !important;
    background: linear-gradient(135deg, #f6c48f, #f0a35f) !important;
    box-shadow: 0 10px 26px rgba(240, 163, 95, 0.28);
}
.cabinet-container .cabinet-tab i { margin-right: 0.4rem; }

/* «Сгенерировать» — акцентная, но без пёстрой анимации */
.cabinet-container .cabinet-tab[data-section="generate"] {
    background: rgba(232, 139, 255, 0.1) !important;
    color: #e9c7ff !important;
    animation: none !important;
}
.cabinet-container .cabinet-tab[data-section="generate"]::after { content: none !important; }
.cabinet-container .cabinet-tab[data-section="generate"].active {
    color: #131820 !important;
    background: linear-gradient(135deg, #e8b6ff, #b79cff) !important;
}

/* ---------- Секции ---------- */
.cabinet-container .cabinet-section {
    padding: 1.6rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: linear-gradient(160deg, rgba(22, 26, 35, 0.9), rgba(12, 15, 21, 0.95));
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.4);
    scrollbar-width: none;
}
.cabinet-container .cabinet-section::-webkit-scrollbar { width: 0; height: 0; }
.cabinet-container .section-title {
    border: none;
    margin-bottom: 1.1rem;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.8rem;
}
.cabinet-container .section-title small { color: #7f8fa0; font-size: 0.82rem; }
.cabinet-container .section-title h2 { color: #f0b27a; margin: 0; font-size: 1.35rem; }
.cabinet-container .section-title h3 { color: #f0b27a; margin: 0; }

/* ---------- Поля профиля и форм ---------- */
.cabinet-container .profile-field { margin-bottom: 1.1rem; }
.cabinet-container .profile-field label,
.cabinet-container .cabinet-section .form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: #93a4b6;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.cabinet-container .cabinet-section .form-group { margin-bottom: 1rem; }
.cabinet-container .profile-field input,
.cabinet-container .cabinet-section input[type="text"],
.cabinet-container .cabinet-section input[type="email"],
.cabinet-container .cabinet-section input[type="number"],
.cabinet-container .cabinet-section input[type="url"],
.cabinet-container .cabinet-section textarea,
.cabinet-container .cabinet-section select {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 0.95rem;
    border-radius: 13px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(7, 10, 14, 0.65);
    color: #f2f6fa;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.cabinet-container .profile-field input::placeholder,
.cabinet-container .cabinet-section input::placeholder,
.cabinet-container .cabinet-section textarea::placeholder { color: #6b7a89; }
.cabinet-container .profile-field input:focus,
.cabinet-container .cabinet-section input:focus,
.cabinet-container .cabinet-section textarea:focus,
.cabinet-container .cabinet-section select:focus {
    outline: none;
    border-color: rgba(240, 178, 122, 0.75);
    background: rgba(12, 16, 22, 0.9);
    box-shadow: 0 0 0 3px rgba(240, 178, 122, 0.16), 0 8px 24px rgba(0, 0, 0, 0.35);
}
.cabinet-container .cabinet-section input[type="file"] {
    color: #a9b7c6;
    min-height: 44px;
    padding: 0.55rem 0.75rem;
}

/* ---------- Кнопки ---------- */
.cabinet-container .auth-submit {
    width: auto;
    min-height: 46px;
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #ffd9ac, #f0b27a 55%, #e79a5c) !important;
    color: #131820 !important;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 12px 28px rgba(240, 163, 95, 0.24);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.cabinet-container .auth-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 16px 34px rgba(240, 163, 95, 0.34);
}
.cabinet-container #saveProfileBtn { width: 100%; margin-top: 0.6rem; }

/* ---------- Карточки песен и модерации ---------- */
.cabinet-container .user-song-card,
.cabinet-container .moderation-card {
    padding: 1.1rem 1.15rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 4px solid #f0b27a;
    background: linear-gradient(150deg, rgba(28, 33, 43, 0.92), rgba(15, 18, 24, 0.95));
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.cabinet-container .user-song-card:hover,
.cabinet-container .moderation-card:hover {
    transform: translateY(-2px);
    border-color: rgba(240, 178, 122, 0.45);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.42);
}
.cabinet-container .user-song-card .play-icon,
.cabinet-container .moderation-card .play-icon { width: auto; }
.cabinet-container .status-badge { letter-spacing: 0.03em; }

/* ---------- Блок «Ваша неделя» ---------- */
.cabinet-container .week-card {
    border-radius: 24px;
    background: linear-gradient(150deg, rgba(240, 178, 122, 0.12), rgba(102, 126, 234, 0.1));
    border: 1px solid rgba(240, 178, 122, 0.22);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

/* ---------- Скрытие полос прокрутки (этап 5.4-M) ---------- */
html, body { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ============================================================
   ЭТАП C (21.11.2026): вид кабинета — sections | stories.
   Переключатель в профиле + сторис-режим разделов.
   styles.css не трогаем; всё под .cabinet-container /
   html.cabinet-stories-mode.
   ============================================================ */

/* ---------- Переключатель «Вид кабинета» ---------- */
.cabinet-container .cabinet-view-field { margin-top: 0.4rem; }
.cabinet-container .cabinet-view-hint {
    color: #8ea0b3;
    font-size: 0.85rem;
    line-height: 1.45;
    margin: 0 0 0.85rem;
}
.cabinet-container .cabinet-view-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
    margin-bottom: 0.9rem;
}
.cabinet-container .cabinet-view-option {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    min-width: 0;
    padding: 0.85rem 0.9rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.28);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.cabinet-container .cabinet-view-option:hover {
    border-color: rgba(240, 180, 120, 0.45);
    background: rgba(240, 180, 120, 0.08);
}
.cabinet-container .cabinet-view-option input {
    margin: 0.2rem 0 0;
    accent-color: #f0b27a;
    flex: 0 0 auto;
}
.cabinet-container .cabinet-view-option-body { min-width: 0; }
.cabinet-container .cabinet-view-option-body strong {
    display: block;
    color: #f0d3b0;
    font-size: 0.95rem;
    line-height: 1.3;
}
.cabinet-container .cabinet-view-option-body small {
    display: block;
    color: #8ea0b3;
    font-size: 0.78rem;
    line-height: 1.4;
    margin-top: 0.2rem;
}
.cabinet-container .cabinet-view-option:has(input:checked) {
    border-color: #f0b27a;
    background: rgba(240, 180, 120, 0.12);
    box-shadow: inset 0 0 0 1px rgba(240, 180, 120, 0.35);
}
.cabinet-container #saveCabinetViewBtn {
    width: auto;
    padding: 0.6rem 1.4rem;
}

/* ---------- Сторис-режим кабинета ----------
   Линейка сегментов и кнопки «Назад/Вперёд» создаются
   stories-nav.js; стили дублируют лендинг (landing.css на
   cabinet.html не подключён), но только под html.cabinet-stories-mode.

   Этап 5.7 (23.11.2026): слайд = ровно один экран (100svh), иначе
   snap-точки стоят ближе экрана и в кадре видны «половинки» двух
   разделов. Шапка и линейка сегментов перекрывают padding слайда. */
html.cabinet-stories-mode {
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}
html.cabinet-stories-mode::-webkit-scrollbar {
    width: 0;
    height: 0;
}
/* шапка больше не сдвигает контент: её высоту резервирует сам слайд.
   !important — против инлайнового margin-top из index.js. */
html.cabinet-stories-mode .main-content {
    margin-top: 0 !important;
}
html.cabinet-stories-mode #cabinetSections > .cabinet-section.story-slide,
html.cabinet-stories-mode #cabinetHomeSlide.story-slide {
    box-sizing: border-box;
    height: 100svh;
    min-height: 100svh;
    max-height: 100svh;
    /* вертикальные margin сломали бы шаг привязки */
    margin: 0;
    /* единая линия старта: шапка + зона линейки (26px) + зазор 16px */
    padding-top: calc(var(--header-h, 130px) + 52px);
    padding-bottom: calc(1.6rem + 70px + var(--site-footer-h, 64px));
    scroll-snap-align: start;
    scroll-snap-stop: always;
    scroll-margin-top: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}
html.cabinet-stories-mode #cabinetSections > .cabinet-section.story-slide::-webkit-scrollbar,
html.cabinet-stories-mode #cabinetHomeSlide.story-slide::-webkit-scrollbar {
    width: 0;
    height: 0;
}
/* Резерв под кнопки «Назад/Вперёд» — CTA/поля не накрываются. */
html.cabinet-stories-mode.stories-arrows-on #cabinetSections > .cabinet-section.story-slide {
    padding-bottom: calc(1.6rem + 70px + var(--site-footer-h, 64px));
}
html.cabinet-stories-mode #cabinetSections > .cabinet-section.story-slide > .section-title:first-child {
    margin-top: 0;
}

/* ---------- Главная кабинета: фото, приветствие, лендинг-фон ---------- */
.cabinet-container .welcome-head {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    margin-bottom: 1.1rem;
}
.cabinet-container .welcome-avatar {
    width: 192px;
    height: 192px;
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
    background: #0d1016;
    border: 4px solid rgba(240, 178, 122, 0.85);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5),
        0 0 0 8px rgba(240, 178, 122, 0.10),
        0 0 46px rgba(232, 139, 255, 0.28);
}
.cabinet-container .welcome-head-text { min-width: 0; }

/* Аврора как на главной: слоистые радиальные градиенты + медленное дыхание. */
.cabinet-container .welcome-section {
    background:
        radial-gradient(120% 150% at 0% 0%, rgba(240, 178, 122, 0.28), transparent 55%),
        radial-gradient(110% 130% at 100% 0%, rgba(232, 139, 255, 0.24), transparent 58%),
        radial-gradient(120% 140% at 50% 120%, rgba(102, 126, 234, 0.30), transparent 62%),
        linear-gradient(160deg, rgba(22, 26, 36, 0.94), rgba(11, 14, 20, 0.97));
}
.cabinet-container .welcome-section::before {
    content: '';
    position: absolute;
    inset: -30% -10%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(closest-side, rgba(232, 139, 255, 0.30), transparent 70%) 18% 20% / 46% 60% no-repeat,
        radial-gradient(closest-side, rgba(240, 178, 122, 0.26), transparent 70%) 82% 28% / 42% 56% no-repeat,
        radial-gradient(closest-side, rgba(102, 126, 234, 0.28), transparent 70%) 55% 95% / 60% 60% no-repeat;
    filter: blur(18px);
    opacity: 0.8;
    animation: cabinetAurora 16s ease-in-out infinite alternate;
}
@keyframes cabinetAurora {
    from { transform: translate3d(-2%, -1%, 0) scale(1); }
    to   { transform: translate3d(2%, 2%, 0) scale(1.08); }
}
.cabinet-container .welcome-section > * { position: relative; z-index: 1; }

/* Лендинг-подсветка страницы в сторис-режиме. */
html.cabinet-stories-mode body {
    background-image:
        radial-gradient(900px 520px at 12% -10%, rgba(240, 178, 122, 0.16), transparent 60%),
        radial-gradient(900px 520px at 88% 0%, rgba(232, 139, 255, 0.14), transparent 62%),
        radial-gradient(1100px 700px at 50% 110%, rgba(102, 126, 234, 0.16), transparent 65%);
    background-attachment: fixed;
}

/* Главная кабинета как первый слайд сторис-режима:
   размеры и отступы заданы общим блоком выше. */
html.cabinet-stories-mode #cabinetHomeSlide.story-slide {
    justify-content: flex-start;
}

/* ---------- Линейка сегментов (копия лендинга, scoped) ---------- */
html.cabinet-stories-mode .stories-rail {
    position: fixed;
    left: 14px;
    right: 14px;
    top: 0;
    display: flex;
    align-items: stretch;
    gap: 5px;
    padding: 0;
    background: none;
    border: none;
    z-index: 1040;
    opacity: 1;
    pointer-events: none;
}
html.cabinet-stories-mode .story-seg {
    flex: 1 1 0;
    height: 26px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    pointer-events: auto;
}
html.cabinet-stories-mode .story-seg::after {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 9px; bottom: 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
}
html.cabinet-stories-mode .story-seg:hover::after {
    background: rgba(255, 255, 255, 0.55);
    transform: scaleY(1.35);
}
html.cabinet-stories-mode .story-seg.is-active::after {
    background: linear-gradient(90deg, #f0b27a, #e88bff, #667eea);
    box-shadow: 0 0 14px rgba(232, 139, 255, 0.65);
    transform: scaleY(1.35);
}
html.cabinet-stories-mode .story-seg:focus-visible {
    outline: 2px solid #f0b27a;
    outline-offset: 3px;
    border-radius: 8px;
}

/* ---------- Кнопки «Назад/Вперёд» (копия лендинга, scoped) ---------- */
html.cabinet-stories-mode .stories-arrow {
    position: fixed;
    bottom: calc(var(--site-footer-h, 64px) + env(safe-area-inset-bottom, 0px) + 14px);
    width: 142px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background-color: rgba(14, 14, 24, 0.78);
    background-image: linear-gradient(100deg,
        rgba(240, 178, 122, 0.26) 0%,
        rgba(232, 139, 255, 0.34) 35%,
        rgba(102, 126, 234, 0.30) 60%,
        rgba(240, 178, 122, 0.26) 100%);
    background-size: 220% 100%;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    z-index: 1030;
    opacity: 0.88;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 18px rgba(232, 139, 255, 0.18);
    animation: cabinetStoriesArrowFlow 3.8s linear infinite;
    transition: opacity 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
html.cabinet-stories-mode .stories-arrow.prev {
    left: max(16px, env(safe-area-inset-left, 0px));
    animation-direction: reverse;
}
html.cabinet-stories-mode .stories-arrow.next {
    right: max(16px, env(safe-area-inset-right, 0px));
}
@keyframes cabinetStoriesArrowFlow {
    from { background-position: 0% 50%; }
    to   { background-position: 100% 50%; }
}
html.cabinet-stories-mode .stories-arrow i { font-size: 0.8rem; }
html.cabinet-stories-mode .stories-arrow:hover,
html.cabinet-stories-mode .stories-arrow:focus-visible {
    opacity: 1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 26px rgba(232, 139, 255, 0.45);
    transform: translateY(-2px) scale(1.03);
}
html.cabinet-stories-mode .stories-arrow:focus-visible {
    outline: 2px solid #f0b27a;
    outline-offset: 2px;
}
html.cabinet-stories-mode .stories-arrow:active { transform: translateY(0) scale(0.98); }
html.cabinet-stories-mode .stories-arrow:disabled {
    opacity: 0.24;
    cursor: default;
    pointer-events: none;
    animation: none;
    background-image: linear-gradient(100deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.14));
    box-shadow: none;
}

/* ---------- Мобильная версия ---------- */
@media (max-width: 640px) {
    .cabinet-container { padding: 1rem 0.9rem 2rem; }
    .cabinet-container .welcome-section { padding: 1.3rem 1.1rem; border-radius: 20px; }
    .cabinet-container .cabinet-nav { border-radius: 18px; padding: 0.3rem; }
    .cabinet-container .cabinet-tab { flex: 1 1 45%; padding: 0.6rem 0.7rem; }
    .cabinet-container .cabinet-section { padding: 1.1rem 0.95rem; border-radius: 20px; }
    .cabinet-container #playlistUrlInput { width: 100% !important; }

    /* Переключатель вида — в один столбец, без переполнения. */
    .cabinet-container .cabinet-view-options { grid-template-columns: 1fr; }
    .cabinet-container #saveCabinetViewBtn { width: 100%; }

    /* Главная кабинета на мобильных: компактное фото и отступы. */
    .cabinet-container .welcome-head { gap: 0.85rem; margin-bottom: 0.9rem; }
    .cabinet-container .welcome-avatar { width: 144px; height: 144px; border-width: 3px; }
    html.cabinet-stories-mode #cabinetHomeSlide.story-slide {
        padding-bottom: calc(1.1rem + 76px + var(--site-footer-h, 64px));
    }

    /* Сторис-режим: кнопки 116×44 и резерв под них. */
    html.cabinet-stories-mode .stories-arrow {
        width: 116px;
        height: 44px;
        padding: 0 12px;
        font-size: 0.8rem;
        gap: 0.35rem;
        opacity: 0.72;
        bottom: calc(var(--site-footer-h, 72px) + env(safe-area-inset-bottom, 0px) + 10px);
    }
    html.cabinet-stories-mode .stories-arrow.prev { left: max(8px, env(safe-area-inset-left, 0px)); }
    html.cabinet-stories-mode .stories-arrow.next { right: max(8px, env(safe-area-inset-right, 0px)); }
    html.cabinet-stories-mode.stories-arrows-on #cabinetSections > .cabinet-section.story-slide {
        padding-bottom: calc(1.1rem + 76px + var(--site-footer-h, 64px));
    }
}
@media (prefers-reduced-motion: reduce) {
    html.cabinet-stories-mode .stories-arrow { animation: none; transition: none; }
    .cabinet-container .welcome-section::before { animation: none; }
}

/* ============================================================
   AI: блок «Создать по аудио» (K2–K4)
   ============================================================ */
.ai-audio-block {
    margin-bottom: 1.25rem;
    padding: 1.1rem 1.2rem;
    background: linear-gradient(145deg, rgba(102, 126, 234, 0.10), rgba(118, 75, 162, 0.08));
    border: 1px solid rgba(102, 126, 234, 0.28);
    border-radius: 18px;
}

.ai-audio-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.ai-audio-title {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #f0b27a;
}

.ai-audio-title i { margin-right: 0.4rem; }

.ai-audio-hint {
    margin: 0;
    color: #b0c2d1;
    font-size: 0.82rem;
    line-height: 1.4;
}

.ai-audio-parts {
    margin: 0.45rem 0 0;
    padding-left: 1.15rem;
    color: #b0c2d1;
    font-size: 0.8rem;
    line-height: 1.45;
}

.ai-audio-parts li { margin-bottom: 0.15rem; }
.ai-audio-parts strong { color: #e0e5ec; }

.ai-audio-or {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0.85rem 0 0.2rem;
    color: #6f7a84;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ai-audio-or::before,
.ai-audio-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.ai-audio-record {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.55rem;
}

.ai-audio-record-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255, 107, 107, 0.14);
    border: 1px solid rgba(255, 107, 107, 0.45);
    border-radius: 30px;
    color: #ffb3b3;
    font-size: 0.86rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.ai-audio-record-btn:hover { background: rgba(255, 107, 107, 0.24); }

.ai-audio-record-stop {
    background: rgba(255, 107, 107, 0.35);
    color: #fff;
    animation: ai-audio-pulse 1.2s ease-in-out infinite;
}

@keyframes ai-audio-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(255, 107, 107, 0); }
}

.ai-audio-record-timer {
    display: inline-flex;
    align-items: center;
    color: #ffb3b3;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.ai-audio-record-hint {
    margin: 0.4rem 0 0;
    color: #6f7a84;
    font-size: 0.78rem;
    line-height: 1.4;
}

.ai-audio-record-preview {
    margin-top: 0.7rem;
    padding: 0.7rem 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(240, 178, 122, 0.25);
    border-radius: 12px;
}

.ai-audio-record-preview audio {
    width: 100%;
    max-width: 420px;
}

.ai-audio-record-preview-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.ai-audio-balance {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #b0c2d1;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 30px;
    padding: 0.35rem 0.9rem;
    white-space: nowrap;
}

.ai-audio-balance strong { color: #f0b27a; }

.ai-audio-dropzone {
    margin-top: 0.9rem;
    padding: 1rem;
    border: 1.5px dashed rgba(240, 178, 122, 0.45);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.22);
    color: #d6dee6;
    font-size: 0.92rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.ai-audio-dropzone:hover,
.ai-audio-dropzone:focus-visible,
.ai-audio-dropzone.dragover {
    border-color: #f0b27a;
    background: rgba(240, 178, 122, 0.10);
    outline: none;
}

.ai-audio-actions {
    margin-top: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.ai-audio-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 30px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 1.4rem;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ai-audio-btn:hover:not(:disabled) { transform: translateY(-1px); }

.ai-audio-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ai-audio-cost {
    color: #6f7a84;
    font-size: 0.8rem;
}

.ai-audio-progress {
    margin-top: 0.85rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ai-audio-step {
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.78rem;
    color: #8b98a5;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.2s ease;
}

.ai-audio-step.active {
    color: #fff;
    background: rgba(102, 126, 234, 0.45);
    border-color: rgba(102, 126, 234, 0.7);
}

.ai-audio-step.done {
    color: #48c774;
    border-color: rgba(72, 199, 116, 0.45);
}

.ai-audio-cancel {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    background: transparent;
    border: 1px solid rgba(255, 107, 107, 0.45);
    border-radius: 20px;
    color: #ffb3b3;
    font-size: 0.78rem;
    padding: 0.25rem 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ai-audio-cancel:hover { background: rgba(255, 107, 107, 0.15); }

.ai-audio-status {
    margin-top: 0.8rem;
    font-size: 0.87rem;
    line-height: 1.45;
    color: #b0c2d1;
}

.ai-audio-status-success { color: #48c774; }
.ai-audio-status-error { color: #ff6b6b; }
.ai-audio-status-info { color: #b0c2d1; }

.ai-audio-transcript {
    margin-top: 0.8rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
}

.ai-audio-transcript summary {
    cursor: pointer;
    color: #f0b27a;
    font-size: 0.85rem;
    font-weight: 600;
}

.ai-audio-transcript-body {
    margin-top: 0.55rem;
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
    color: #d6dee6;
    font-size: 0.85rem;
    line-height: 1.45;
}

@media (max-width: 640px) {
    .ai-audio-block { padding: 0.95rem; border-radius: 16px; }
    .ai-audio-actions { gap: 0.6rem; }
    .ai-audio-btn { width: 100%; }
    .ai-audio-balance { width: 100%; justify-content: space-between; }
    .ai-audio-record { gap: 0.45rem; }
    .ai-audio-record-btn { width: 100%; justify-content: center; }
    .ai-audio-record-preview audio { max-width: 100%; }
    .ai-audio-record-preview-actions { flex-direction: column; align-items: stretch; }
}

/* ---------- B6: Биллинг ---------- */
.billing-balance-card {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.billing-balance-item {
    flex: 1 1 220px;
    padding: 1.1rem 1.25rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(145deg, rgba(102, 126, 234, 0.18), rgba(20, 25, 32, 0.9));
}
.billing-balance-label {
    color: #9fb0c1;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.billing-balance-value {
    margin-top: 0.35rem;
    font-size: 1.9rem;
    font-weight: 800;
    color: #f0b27a;
}
.billing-balance-available { color: #48c774; }
.billing-notice {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.92rem;
}
.billing-notice-success {
    background: rgba(72, 199, 116, 0.14);
    color: #a8ecc1;
    border: 1px solid rgba(72, 199, 116, 0.35);
}
.billing-notice-error {
    background: rgba(255, 107, 107, 0.14);
    color: #ffb3b3;
    border: 1px solid rgba(255, 107, 107, 0.35);
}
.billing-subtitle {
    margin: 1.5rem 0 0.8rem;
    font-size: 1.05rem;
    color: #e7edf4;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.billing-packages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.8rem;
}
.billing-package {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-start;
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(8, 11, 15, 0.55);
    color: #eef2f6;
    cursor: pointer;
    text-align: left;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.billing-package:hover {
    transform: translateY(-2px);
    border-color: rgba(240, 178, 122, 0.55);
    background: rgba(240, 178, 122, 0.08);
}
.billing-package:disabled { opacity: 0.6; cursor: wait; }
.billing-package-amount { font-size: 1.35rem; font-weight: 800; color: #f0b27a; }
.billing-package-label { font-size: 0.8rem; color: #9fb0c1; }
.billing-package-bonus { font-size: 0.78rem; color: #48c774; }
.billing-package-action { margin-top: 0.4rem; font-size: 0.8rem; font-weight: 700; color: #e7edf4; }
.billing-filters { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.billing-filter {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(8, 11, 15, 0.5);
    color: #9fb0c1;
    font-size: 0.85rem;
    cursor: pointer;
}
.billing-filter.is-active {
    background: linear-gradient(135deg, #f6c48f, #f0a35f);
    color: #131820;
    border-color: transparent;
    font-weight: 700;
}
.billing-history-wrap {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.billing-history { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.billing-history th,
.billing-history td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.billing-history th { text-align: left; color: #9fb0c1; font-weight: 600; }
.billing-amount-plus { color: #48c774; font-weight: 700; }
.billing-amount-minus { color: #ff8a8a; font-weight: 700; }
.billing-loading { text-align: center; color: #9fb0c1; padding: 1.2rem; }
.billing-pagination {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 1rem;
    color: #9fb0c1;
    font-size: 0.9rem;
}
.billing-page-btn {
    min-width: 36px;
    min-height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(8, 11, 15, 0.5);
    color: #eef2f6;
    cursor: pointer;
}
.billing-page-btn:disabled { opacity: 0.4; cursor: default; }

/* ============================================================
   Видеоклип по песне (video.js, этап Video) — форма-заготовка
   ============================================================ */
.video-badge {
    display: inline-block;
    margin-right: 0.5rem;
    padding: 0.18rem 0.7rem;
    border-radius: 20px;
    background: linear-gradient(135deg, #f0b27a, #d98f52);
    color: #0b0e12;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.video-notice {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    margin-bottom: 1.2rem;
    border-radius: 14px;
    background: rgba(240, 180, 120, 0.12);
    border: 1px solid rgba(240, 180, 120, 0.28);
    color: #f3e3d1;
    font-size: 0.92rem;
    line-height: 1.5;
}
.video-notice i { color: #f0b27a; margin-top: 0.15rem; }
.video-form .form-group select,
.video-form .form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    color: #eef2f6;
    font: inherit;
}
.video-form .form-group textarea { min-height: 110px; resize: vertical; }
.video-form .form-group select:focus,
.video-form .form-group textarea:focus {
    outline: none;
    border-color: #f0b27a;
    box-shadow: 0 0 0 3px rgba(240, 180, 120, 0.15);
}
.video-hint {
    display: block;
    margin-top: 0.45rem;
    color: #8a9aab;
    font-size: 0.82rem;
    line-height: 1.45;
}
.video-photos {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}
.video-photo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    background: rgba(8, 11, 15, 0.45);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.video-photo:hover { border-color: #f0b27a; background: rgba(240, 180, 120, 0.08); }
.video-photo.has-photo { border-style: solid; border-color: rgba(240, 180, 120, 0.45); }
.video-photo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: #8a9aab;
    font-size: 0.85rem;
}
.video-photo-empty i { font-size: 1.5rem; color: #f0b27a; opacity: 0.8; }
.video-photo-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.video-photo-remove {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    z-index: 2;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.video-photo-remove:hover { background: #e05252; }
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.video-grid input[type="range"] {
    width: 100%;
    margin-top: 0.5rem;
    accent-color: #f0b27a;
}
.video-status-info {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.35);
    color: #dfe6ff;
    font-size: 0.9rem;
    line-height: 1.45;
}
@media (max-width: 560px) {
    .video-photos { gap: 0.5rem; }
}
